diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000..2351324 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,30 @@ +# This is the official list of people who can contribute +# (and typically have contributed) code to the gophernotes +# repository. +# +# Names should be added to this file only after verifying that +# the individual or the individual's organization has agreed to +# the appropriate Contributor License Agreement, found here: +# +# http://code.google.com/legal/individual-cla-v1.0.html +# http://code.google.com/legal/corporate-cla-v1.0.html +# +# The agreement for individuals can be filled out on the web. +# +# Names should be added to this file like so: +# Name +# +# Please keep the list sorted. + +Bobby Norton +Dan Kortschak +Daniel Whitenack +Fransesc Campoy +Harry Moreno +Josh Cheek +Kevin Burke +Matthew Steffen +Sebastien Binet +Spencer Park +Thomas Kluyver +Yang Yang diff --git a/Dockerfile b/Dockerfile index 7beabdb..4501aff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,44 @@ -FROM golang +FROM alpine:3.5 +MAINTAINER dwhitena -# dependencies -RUN apt-get update && \ - apt-get install -y pkg-config libzmq3-dev build-essential python3-pip && \ - pip3 install --upgrade pip +# Add gophernotes +ADD . /go/src/github.com/gopherdata/gophernotes/ -# set up golang -ENV PATH /usr/local/go/bin:$PATH -ENV GOPATH /go -ENV PATH $GOPATH/bin:$PATH -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" - -# install gophernotes -RUN go get golang.org/x/tools/cmd/goimports -RUN go get -tags zmq_3_x github.com/gopherds/gophernotes -RUN mkdir -p ~/.ipython/kernels/gophernotes -RUN cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/.ipython/kernels/gophernotes - -# install jupyter -RUN pip3 install jupyter +# Install Jupyter and gophernotes. +RUN set -x \ + # install python and dependencies + && apk update \ + && apk --no-cache add \ + ca-certificates \ + python3 \ + su-exec \ + gcc \ + git \ + py3-zmq \ + pkgconfig \ + zeromq-dev \ + musl-dev \ + && pip3 install --upgrade pip \ + && ln -s /usr/bin/python3.5 /usr/bin/python \ + ## install Go + && apk --update-cache --allow-untrusted \ + --repository http://dl-4.alpinelinux.org/alpine/edge/community \ + --arch=x86_64 add \ + go \ + ## jupyter notebook + && ln -s /usr/include/locale.h /usr/include/xlocale.h \ + && pip3 install jupyter notebook \ + ## install gophernotes + && GOPATH=/go go install github.com/gopherdata/gophernotes \ + && cp /go/bin/gophernotes /usr/local/bin/ \ + && mkdir -p ~/.local/share/jupyter/kernels/gophernotes \ + && cp -r /go/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes \ + ## clean + && find /usr/lib/python3.5 -name __pycache__ | xargs rm -r \ + && rm -rf \ + /root/.[acpw]* \ + ipaexg00301* \ + && rm -rf /var/cache/apk/* EXPOSE 8888 -CMD ["jupyter", "notebook"] +CMD [ "jupyter", "notebook", "--no-browser", "--allow-root", "--ip=0.0.0.0" ] diff --git a/Dockerfile.DS b/Dockerfile.DS new file mode 100644 index 0000000..bd6ed4d --- /dev/null +++ b/Dockerfile.DS @@ -0,0 +1,66 @@ +FROM alpine:3.5 +MAINTAINER dwhitena + +# Add gophernotes +ADD . /go/src/github.com/gopherdata/gophernotes/ + +# Install Jupyter and gophernotes. +RUN set -x \ + # install python and dependencies + && apk update \ + && apk --no-cache add \ + ca-certificates \ + python3 \ + su-exec \ + gcc \ + g++ \ + git \ + py3-zmq \ + pkgconfig \ + zeromq-dev \ + musl-dev \ + mercurial \ + && pip3 install --upgrade pip \ + && cp /usr/bin/python3.5 /usr/bin/python \ + ## install Go + && apk --update-cache --allow-untrusted \ + --repository http://dl-4.alpinelinux.org/alpine/edge/community \ + --arch=x86_64 add \ + go \ + ## jupyter notebook + && ln -s /usr/include/locale.h /usr/include/xlocale.h \ + && pip3 install jupyter notebook \ + ## install gophernotes + && GOPATH=/go go install github.com/gopherdata/gophernotes \ + && cp /go/bin/gophernotes /usr/local/bin/ \ + && mkdir -p ~/.local/share/jupyter/kernels/gophernotes \ + && cp -r /go/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes \ + ## get the relevant Go packages + && go get -insecure gonum.org/v1/plot/... \ + && go get -insecure gonum.org/v1/gonum/... \ + && go get github.com/kniren/gota/... \ + && go get github.com/sajari/regression \ + && go get github.com/sjwhitworth/golearn/... \ + && go get -insecure go-hep.org/x/hep/csvutil/... \ + && go get -insecure go-hep.org/x/hep/fit \ + && go get -insecure go-hep.org/x/hep/hbook \ + && go get github.com/montanaflynn/stats \ + && go get github.com/boltdb/bolt \ + && go get github.com/patrickmn/go-cache \ + && go get github.com/chewxy/math32 \ + && go get github.com/chewxy/hm \ + && go get github.com/chewxy/vecf64 \ + && go get github.com/chewxy/vecf32 \ + && go get github.com/awalterschulze/gographviz \ + && go get github.com/leesper/go_rng \ + && go get github.com/pkg/errors \ + && go get github.com/stretchr/testify/assert \ + ## clean + && find /usr/lib/python3.5 -name __pycache__ | xargs rm -r \ + && rm -rf \ + /root/.[acpw]* \ + ipaexg00301* \ + && rm -rf /var/cache/apk/* + +EXPOSE 8888 +CMD [ "jupyter", "notebook", "--no-browser", "--allow-root", "--ip=0.0.0.0" ] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 59c2857..0000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "ImportPath": "github.com/gopherds/gophernotes", - "GoVersion": "go1.6", - "GodepVersion": "v74", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/alecthomas/gozmq", - "Rev": "d1b01a2df6b2c64f03fecaeabea541963fc4749f" - }, - { - "ImportPath": "github.com/davecgh/go-spew/spew", - "Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d" - }, - { - "ImportPath": "github.com/mitchellh/go-homedir", - "Rev": "d682a8f0cf139663a984ff12528da460ca963de9" - }, - { - "ImportPath": "github.com/motemen/go-quickfix", - "Rev": "5c522febc6796f9c2ceabf9374a75490e2d268da" - }, - { - "ImportPath": "github.com/nu7hatch/gouuid", - "Rev": "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" - }, - { - "ImportPath": "github.com/pmezard/go-difflib/difflib", - "Rev": "792786c7400a136282c1664665ae0a8db921c6c2" - }, - { - "ImportPath": "github.com/stretchr/testify/assert", - "Comment": "v1.1.3", - "Rev": "f390dcf405f7b83c997eac1b06768bb9f44dec18" - }, - { - "ImportPath": "golang.org/x/tools/go/ast/astutil", - "Rev": "ed69e84b1518b5857a9f4e01d1f9cefdcc45246e" - }, - { - "ImportPath": "golang.org/x/tools/imports", - "Rev": "ed69e84b1518b5857a9f4e01d1f9cefdcc45246e" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000..995b961 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,33 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/cosmos72/gomacro" + packages = ["ast2","base","classic","fast","imports","parser","scanner","token","typeutil","xreflect"] + revision = "b90dd5143957e920ac0ce87f9a3277bbc3ce1641" + +[[projects]] + branch = "master" + name = "github.com/nu7hatch/gouuid" + packages = ["."] + revision = "179d4d0c4d8d407a32af483c2354df1d2c91e6c3" + +[[projects]] + branch = "master" + name = "github.com/pebbe/zmq4" + packages = ["."] + revision = "90d69e412a09549f2e90bac70fbb449081f1e5c1" + +[[projects]] + branch = "master" + name = "golang.org/x/sync" + packages = ["syncmap"] + revision = "f52d1811a62927559de87708c8913c1650ce4f26" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "fa5d7d9ec51b9210ed3ca68de1105ddbbc070a941c737b3955518eaee951d10c" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000..81cb874 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,34 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + branch = "master" + name = "github.com/cosmos72/gomacro" + +[[constraint]] + branch = "master" + name = "github.com/nu7hatch/gouuid" + +[[constraint]] + branch = "master" + name = "github.com/pebbe/zmq4" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 853b46d..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index d5c9753..455a9dd 100644 --- a/README.md +++ b/README.md @@ -1,196 +1,106 @@ -![alt tag](https://raw.githubusercontent.com/gopherds/gophernotes/master/files/gophernotes2.jpg) +![alt tag](files/gophernotes-logo.png) -# gophernotes - Go in Notebooks +# gophernotes - Use Go in Jupyter notebooks and nteract -`gophernotes` is a Go kernel for [Jupyter](http://jupyter.org/) notebooks. Finally, we can have a reliable and maintained way to use Go interactively and code in the browser. Use `gophernotes` to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks, with the live Go code, can then be shared with others via email, Dropbox, GitHub and the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/). Go forth and do data science, or anything else interesting, with go notebooks! +`gophernotes` is a Go kernel for [Jupyter](http://jupyter.org/) notebooks and [nteract](https://nteract.io/). It lets you use Go interactively in a browser-based notebook or desktop app. Use `gophernotes` to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks, with the live Go code, can then be shared with others via email, Dropbox, GitHub and the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/). Go forth and do data science, or anything else interesting, with Go notebooks! -This project came out of the [Gopher Gala](http://gophergala.com/) 2016. It is inspired by a REPL called [gore](https://github.com/motemen/gore) and by a limited kernel called [iGo](https://github.com/takluyver/igo), which is no longer maintained. +**Acknowledgements** - This project utilizes a Go interpreter called [gomacro](https://github.com/cosmos72/gomacro) under the hood to evaluate Go code interactively. The gophernotes logo was designed by the brilliant [Marcus Olsson](https://github.com/marcusolsson) and was inspired by Renee French's original Go Gopher design. -## Screenshots/Examples +- [Examples](#examples) +- Install gophernotes: + - [Prerequisites](#prerequisites) + - [Linux](#linux) + - [Mac](#mac) + - [Windows](#windows) + - [Docker](#docker) +- [Getting Started](#getting-started) +- [Limitations](#limitations) +- [Troubleshooting](#troubleshooting) -### Simple interactive use: +## Examples -![alt tag](https://raw.githubusercontent.com/gopherds/gophernotes/master/files/screencast.gif) +### Jupyter Notebook: -### Example Notebooks (dowload and run them locally, follow the links to view in Github, or use the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/)): -- [Simple Printing and Channels](https://github.com/gopherds/gophernotes/blob/master/examples/Simple-Example.ipynb) -- [Pattern Recognition with Golearn](https://github.com/gopherds/gophernotes/blob/master/examples/Pattern-Recognition.ipynb) -- [Feed Forward, Recurrent Neural Nets](https://github.com/gopherds/gophernotes/blob/master/examples/Feed-Forward-Recurrent-NN.ipynb) -- [Time Parsing, Formatting](https://github.com/gopherds/gophernotes/blob/master/examples/Time-Formatting-Parsing.ipynb) -- [Stateful Goroutines](https://github.com/gopherds/gophernotes/blob/master/examples/Stateful-Goroutines.ipynb) -- [Worker Pools](https://github.com/gopherds/gophernotes/blob/master/examples/Worker-Pools.ipynb) - -## Installation - -### Docker - -- Pull down and run the [latest image](https://hub.docker.com/r/dwhitena/gophernotes/): - - ``` - docker pull dwhitena/gophernotes:latest - docker run --name gophernotes --net host -d dwhitena/gophernotes:latest - ``` - -*Possible issues* - For OSX Docker Machine / Dlite users, you may need to set the IP to `0.0.0.0` instead of the default `localhost` with: - - ``` - docker run -p 8888:8888 -d dwhitena/gophernotes jupyter notebook --no-browser --ip=0.0.0.0 - ``` - -*Note* - this is a pretty large image, because it contains a full distribution of [Anaconda](http://docs.continuum.io/anaconda/index) plus the add ons of gophernotes. However, with this image, you can create Go notebooks, Python notebooks, text files, run ipython in the shell, etc. - -### Local, Linux +![](files/jupyter.gif) -Make sure you have the following dependencies: +### nteract: - - [Go](https://golang.org/) 1.5+ - - Jupyter (see [here](http://jupyter.readthedocs.org/en/latest/install.html) for more details on installing jupyter) - - [ZeroMQ](http://zeromq.org/) (2.2.X or 4.x) +![](files/nteract.gif) -Then: +### Example Notebooks (dowload and run them locally, follow the links to view in Github, or use the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/)): +- [Worker Pools](examples/Worker_Pools.ipynb) +- [Matrix Operations](examples/Matrix_Operations.ipynb) +- [Facial Recognition](examples/Facial_Recognition_MachineBox.ipynb) -1. Create a workspace and setup your `GOPATH`, see https://golang.org/doc/code.html#GOPATH +## Installation -2. Install `goimports` if you haven't already: +### Prerequisites - ``` - go get golang.org/x/tools/cmd/goimports - ``` +- [Go 1.9+](https://golang.org/doc/install) - including GOPATH/bin added to your PATH (i.e., you can run Go binaries that you `go install`). +- [Jupyter Notebook](http://jupyter.readthedocs.io/en/latest/install.html) or [nteract](https://nteract.io/desktop) +- [ZeroMQ 4.X.X](http://zeromq.org/intro:get-the-software) - for convenience, pre-built Windows binaries (v4.2.1) are included in the zmq-win directory. -3. Get the kernel: - - with ZeroMQ 2.2.x: +### Linux - ``` - go get github.com/gopherds/gophernotes - ``` - - - with ZeroMQ 4.x: - - ``` - go get -tags zmq_4_x github.com/gopherds/gophernotes - ``` +```sh +$ go install github.com/gopherdata/gophernotes +$ mkdir -p ~/.local/share/jupyter/kernels/gophernotes +$ cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes +``` -4. Create a directory for the new kernel config: +To confirm that the `gophernotes` binary is installed and in your PATH, you should see the following when running `gophernotes` directly: - ``` - mkdir -p ~/.local/share/jupyter/kernels/gophernotes - ``` - - Note, depending on which version of jupyter you are using and if you are using Anaconda, you may need to copy to `~/.ipython` rather than `~/.local/share`: - - ``` - mkdir ~/.ipython/kernels/gophernotes - cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/.ipython/kernels/gophernotes/ - ``` -5. Copy the kernel config into the `~/.local/jupyter` directory: +```sh +$ gophernotes +2017/09/20 10:33:12 Need a command line argument specifying the connection file. +``` - ``` - cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes - ``` +**Note** - if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: - Note, if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: - - ``` - jupyter --data-dir - ``` - -### Local, OSX - -Make sure you have the following dependencies: - - - [Go](https://golang.org/) 1.5+ - - Jupyter (see [here](http://jupyter.readthedocs.org/en/latest/install.html) for more details on installing jupyter) - - [ZeroMQ](http://zeromq.org/) (2.2.X or 4.x) +```sh +$ jupyter --data-dir +``` -Then: +### Mac -1. Install goimports, if not already installed: +**Important Note** - gomacro relies on the `plugin` package when importing third party libraries. This package is only supported on Linux currently. Thus, if you need to utilize third party packages in your Go notebooks and you are running on Mac, you should use the [Docker](#docker) install and run gophernotes/Jupyter in Docker. - ``` - go get golang.org/x/tools/cmd/goimports - ``` - -2. Install gophernotes: - - with ZeroMQ 2.2.x: - - ``` - go get github.com/gopherds/gophernotes - ``` - - - with ZeroMQ 4.x: +```sh +$ go install github.com/gopherdata/gophernotes +$ mkdir -p ~/Library/Jupyter/kernels/gophernotes +$ cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/Library/Jupyter/kernels/gophernotes +``` - ``` - go get -tags zmq_4_x github.com/gopherds/gophernotes - ``` - - - if you get this error: - - ``` - # pkg-config --cflags libzmq libzmq libzmq libzmq - Package libzmq was not found in the pkg-config search path. - Perhaps you should add the directory containing `libzmq.pc' - to the PKG_CONFIG_PATH environment variable - No package 'libzmq' found - ``` - - then: - - ``` - export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq22/lib/pkgconfig/ - ``` +To confirm that the `gophernotes` binary is installed and in your PATH, you should see the following when running `gophernotes` directly: -3. Copy the kernel config: +```sh +$ gophernotes +2017/09/20 10:33:12 Need a command line argument specifying the connection file. +``` - ``` - mkdir -p ~/Library/Jupyter/kernels/gophernotes - cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/Library/Jupyter/kernels/gophernotes - ``` +**Note** - if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: - Note, if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: - - ``` - jupyter --data-dir - ``` - -4. Update `~/Library/Jupyter/kernels/gophernotes/kernel.json` with the FULL PATH to your gophernotes binary (in $GOPATH/bin). For example: - - ``` - { - "argv": [ - "/Users//go/bin/gophernotes", - "{connection_file}" - ], - "display_name": "Go", - "language": "go", - "name": "go" - } - ``` - -### Local, Windows +```sh +$ jupyter --data-dir +``` -Make sure you have the following dependencies: +### Windows - - [Go](https://golang.org/) 1.5+ with cgo enabled - - MinGW toolchain, such as: - - [MinGW-w64](https://sourceforge.net/projects/mingw-w64/), for 32 and 64 bit Windows - - [MinGW Distro](https://nuwen.net/mingw.html), for 64 bit Windows only - - Jupyter (see [here](http://jupyter.readthedocs.org/en/latest/install.html) for more details on installing jupyter) - - [ZeroMQ](http://zeromq.org/) (2.2.X or 4.x); for convenience, pre-built binaries (v4.2.1) are included in the zmq-win directory +**Important Note** - gomacro relies on the `plugin` package when importing third party libraries. This package is only supported on Linux currently. Thus, if you need to utilize third party packages in your Go notebooks and you are running on Windows, you should use the [Docker](#docker) install and run gophernotes/Jupyter in Docker. -Then: +Make sure you have the MinGW toolchain: -1. Install goimports, if not already installed: +- [MinGW-w64](https://sourceforge.net/projects/mingw-w64/), for 32 and 64 bit Windows +- [MinGW Distro](https://nuwen.net/mingw.html), for 64 bit Windows only - ``` - go get golang.org/x/tools/cmd/goimports - ``` +Then: -2. Build and install gophernotes (using the pre-built binaries and `zmq-win\build.bat`): +1. build and install gophernotes (using the pre-built binaries and `zmq-win\build.bat`): ``` REM Download w/o building. - go get -d github.com/gopherds/gophernotes - cd %GOPATH%\src\github.com\gopherds\gophernotes\zmq-win + go get -d github.com/gopherdata/gophernotes + cd %GOPATH%\src\github.com\gopherdata\gophernotes\zmq-win REM Build x64 version. build.bat amd64 @@ -205,52 +115,94 @@ Then: 3. Copy the kernel config: - ``` - mkdir %APPDATA%\jupyter\kernels\gophernotes - xcopy %GOPATH%\src\github.com\gopherds\gophernotes\kernel %APPDATA%\jupyter\kernels\gophernotes /s - ``` + ``` + mkdir %APPDATA%\jupyter\kernels\gophernotes + xcopy %GOPATH%\src\github.com\gopherdata\gophernotes\kernel %APPDATA%\jupyter\kernels\gophernotes /s + ``` - Note, if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: + Note, if you have the `JUPYTER_PATH` environmental variable set or if you are using an older version of Jupyter, you may need to copy this kernel config to another directory. You can check which directories will be searched by executing: - ``` - jupyter --data-dir - ``` + ``` + jupyter --data-dir + ``` 4. Update `%APPDATA%\jupyter\kernels\gophernotes\kernel.json` with the FULL PATH to your gophernotes.exe (in %GOPATH%\bin), unless it's already on the PATH. For example: - ``` - { - "argv": [ - "C:\\gopath\\bin\\gophernotes.exe", - "{connection_file}" - ], - "display_name": "Go", - "language": "go", - "name": "go" - } - ``` + ``` + { + "argv": [ + "C:\\gopath\\bin\\gophernotes.exe", + "{connection_file}" + ], + "display_name": "Go", + "language": "go", + "name": "go" + } + ``` +### Docker + +You can try out or run Jupyter + gophernotes without installing anything using Docker. To run a Go notebook that only needs things from the standard library, run: + +``` +$ docker run -it -p 8888:8888 gopherdata/gophernotes +``` + +Or to run a Go notebook with access to common Go data science packages (gonum, gota, golearn, etc.), run: + +``` +$ docker run -it -p 8888:8888 gopherdata/gophernotes-ds +``` + +In either case, running this command should output a link that you can follow to access Jupyter in a browser. Also, to save notebooks to and/or load notebooks from a location outside of the Docker image, you should utilize a volume mount. For example: + +``` +$ docker run -it -p 8888:8888 -v /path/to/local/notebooks:/path/to/notebooks/in/docker gopherdata/gophernotes +``` ## Getting Started -- If you completed one of the local installs above (i.e., not the Docker install), start the jupyter notebook: +### Jupyter + +- If you completed one of the local installs above (i.e., not the Docker install), start the jupyter notebook server: ``` jupyter notebook ``` -- If you have a docker install, point a browser at `http://localhost:8888/`. +- Select `Go` from the `New` drop down menu. + +- Have fun! + +### nteract -- Select `Golang` from the `New` drop down menu. +- Launch nteract. -- Have Fun! +- From the nteract menu select Language -> Go. +- Have fun! + +## Limitations + +gophernotes uses [gomacro](https://github.com/cosmos72/gomacro) under the hood to evaluate Go code interactively. You can evaluate most any Go code with gomacro, but there are some limitation, which are discussed in further detail [here](https://github.com/cosmos72/gomacro#current-status). Most noteably, gophernotes does NOT support: + +- third party packages when running natively on Mac and Windows - This is a current limitation of the Go `plugin` package. +- unexported struct fields +- interfaces - They can be declared, but nothing more: there is no way to implement them or call their methods +- extracting methods from types - For example time.Duration.String should return a func(time.Duration) string but currently gives an error. Instead extracting methods from objects is supported: time.Duration(1s).String correctly returns a func() string +- goto +- named return values +- named imports like: + + ``` + import tf "github.com/tensorflow/tensorflow/tensorflow/go" + ``` ## Troubleshooting ### gophernotes not found -- Depending on your environment, you may need to manually change the path to the `gophernotes` executable in `kernel/kernel.json` before copying it to `~/.local/share/jupyter/kernels/gophernotes`. You can put the **full path** to the `gophernotes` executable here, and you shouldn't have any further issues. +Depending on your environment, you may need to manually change the path to the `gophernotes` executable in `kernel/kernel.json` before copying it to `~/.local/share/jupyter/kernels/gophernotes`. You can put the **full path** to the `gophernotes` executable here, and you shouldn't have any further issues. ### "Kernel error" in a running notebook @@ -275,20 +227,3 @@ sudo ln -s $HOME/go/bin/gophernotes /go/bin/gophernotes ``` Restart jupyter, and you should now be up and running. - - -## Custom Commands -Some of the custom commands from the [gore](https://github.com/motemen/gore) REPL have carried over to `gophernotes`. Note, in particular, the syntax for importing packages: - -``` -:print Show current source (currently prints to the terminal where the notebook server is running) -:write [] Write out current source to file -:help List commands -:containerize Build a Docker image that executes the compiled Go code (must have Docker installed) -``` - -## Licenses - -`gophernotes` was created by [Daniel Whitenack](http://www.datadan.io/), and is licensed under an [MIT-style License](LICENSE.md). - -The Golang Gopher image adapted for the gophernotes logo was created by [Takuya Ueda](http://u.hinoichi.net) and is licensed under the Creative Commons 3.0 Attributions license. diff --git a/examples/Elman_srnn.png b/examples/Elman_srnn.png deleted file mode 100644 index 723a964..0000000 Binary files a/examples/Elman_srnn.png and /dev/null differ diff --git a/examples/Facial_Recognition_MachineBox.ipynb b/examples/Facial_Recognition_MachineBox.ipynb new file mode 100644 index 0000000..77bbbe9 --- /dev/null +++ b/examples/Facial_Recognition_MachineBox.ipynb @@ -0,0 +1,420 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import (\n", + " \"flag\"\n", + " \"io/ioutil\"\n", + " \"log\"\n", + " \"os\"\n", + " \"path/filepath\"\n", + " \"strings\"\n", + " \"time\"\n", + " \"unicode\"\n", + " \"fmt\"\n", + " \"encoding/json\"\n", + "\n", + " \"github.com/machinebox/sdk-go/facebox\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Connect to MachineBox" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To perform facial recognition, we are going to use MachineBox's FaceBox. If you haven't heard of MachineBox, [check them out](https://machinebox.io/)! They provide state of the art machine learning technology inside a Docker container which you can run, deploy and scale.\n", + "\n", + "Here we will assume that we have MachineBox's facebox running locally." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "faceboxClient := facebox.New(\"http://localhost:8080\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Train FaceBox to recognize a face" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We are now going to walk over images of faces in a directory and provide these faces to facebox. FaceBox will learn how to recognize these faces in images. The faces that we are going to use here are of someone that is probably familiar to most:\n", + "\n", + "trump1.jpg | trump2.jpg | trump3.jpg \n", + ":-------------------------:|:-------------------------:|:-------------------------:\n", + "![](https://raw.githubusercontent.com/dwhitena/pach-machine-box/master/data/train/faces1/trump1.jpg) | ![](https://raw.githubusercontent.com/dwhitena/pach-machine-box/master/data/train/faces1/trump2.jpg) | ![](https://raw.githubusercontent.com/dwhitena/pach-machine-box/master/data/train/faces1/trump3.jpg)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "inDir := \"/home/dwhitena/go/src/github.com/dwhitena/pach-machine-box/data/train/faces1\"" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "ename": "ERROR", + "evalue": "// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n", + "output_type": "error", + "traceback": [ + "// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n// warning: redefined identifier: err\n// warning: call to deferred function f.Close() returned [] values, expecting zero: %!v(MISSING)\n" + ] + } + ], + "source": [ + "// Walk over images in the training directory.\n", + "if err := filepath.Walk(inDir, func(path string, info os.FileInfo, err error) error {\n", + "\n", + " // Skip any directories.\n", + " if info.IsDir() {\n", + " return nil\n", + " }\n", + "\n", + " // Open the training image file.\n", + " f, err := os.Open(filepath.Join(inDir, info.Name()))\n", + " if err != nil {\n", + " return err\n", + " }\n", + " defer f.Close()\n", + "\n", + " // Teach FaceBox the input image.\n", + " if err := faceboxClient.Teach(f, info.Name(), \"trump\"); err != nil {\n", + " return err\n", + " }\n", + "\n", + " return nil\n", + "}); err != nil {\n", + " log.Println(err)\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Using the trained FaceBox to recognize a face" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now that we have trained FaceBox to recognize our face of interest, we can try to identify this face in an image. For example, let's try to recognize this face in the following image:\n", + "\n", + "![](https://raw.githubusercontent.com/dwhitena/pach-machine-box/master/data/unidentified/image1.jpg)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "First, let's create a struct that will allow us to unmarshal the JSON response from FaceBox. This JSON response should include an indication that faces where detected along with labels of recognized faces and their locations." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "// IdentifiedFaces includes information about the faces\n", + "// identified in an image.\n", + "type IdentifiedFaces struct {\n", + " Success bool `json:\"success\"`\n", + " FacesCount int `json:\"facesCount\"`\n", + " Faces []facebox.Face `json:\"faces\"`\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Then we can use the `Check()` method on the FaceBox client to check the image for recognized faces:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "ename": "ERROR", + "evalue": "// warning: redefined identifier: err\n", + "output_type": "error", + "traceback": [ + "// warning: redefined identifier: err\n" + ] + } + ], + "source": [ + "// Open the input image.\n", + "f, err := os.Open(\"/home/dwhitena/go/src/github.com/dwhitena/pach-machine-box/data/unidentified/image1.jpg\")\n", + "if err != nil {\n", + " log.Println(err)\n", + "}\n", + "defer f.Close()\n", + "\n", + "// Teach FaceBox the input image.\n", + "faces, err := faceboxClient.Check(f)\n", + "if err != nil {\n", + " log.Println(err)\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, we can output the detected face information:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{\n", + " \"Success\": true,\n", + " \"FacesCount\": 13,\n", + " \"Faces\": [\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 199,\n", + " \"Left\": 677,\n", + " \"Width\": 107,\n", + " \"Height\": 108\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 96,\n", + " \"Left\": 1808,\n", + " \"Width\": 89,\n", + " \"Height\": 90\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 163,\n", + " \"Left\": 509,\n", + " \"Width\": 108,\n", + " \"Height\": 108\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 186,\n", + " \"Left\": 2186,\n", + " \"Width\": 89,\n", + " \"Height\": 89\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 166,\n", + " \"Left\": 1638,\n", + " \"Width\": 90,\n", + " \"Height\": 89\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 116,\n", + " \"Left\": 1453,\n", + " \"Width\": 107,\n", + " \"Height\": 107\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 405,\n", + " \"Left\": 1131,\n", + " \"Width\": 89,\n", + " \"Height\": 89\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 206,\n", + " \"Left\": 1300,\n", + " \"Width\": 90,\n", + " \"Height\": 89\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 176,\n", + " \"Left\": 1957,\n", + " \"Width\": 90,\n", + " \"Height\": 89\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 495,\n", + " \"Left\": 1462,\n", + " \"Width\": 62,\n", + " \"Height\": 62\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 1158,\n", + " \"Left\": 2181,\n", + " \"Width\": 62,\n", + " \"Height\": 63\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 175,\n", + " \"Left\": 963,\n", + " \"Width\": 108,\n", + " \"Height\": 108\n", + " },\n", + " \"ID\": \"trump3.jpg\",\n", + " \"Name\": \"trump\",\n", + " \"Matched\": true\n", + " },\n", + " {\n", + " \"Rect\": {\n", + " \"Top\": 544,\n", + " \"Left\": 1647,\n", + " \"Width\": 75,\n", + " \"Height\": 75\n", + " },\n", + " \"ID\": \"\",\n", + " \"Name\": \"\",\n", + " \"Matched\": false\n", + " }\n", + " ]\n", + "}\n" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + }, + { + "ename": "ERROR", + "evalue": "// warning: redefined identifier: err\n", + "output_type": "error", + "traceback": [ + "// warning: redefined identifier: err\n" + ] + } + ], + "source": [ + "// Prepare the output.\n", + "output := IdentifiedFaces{\n", + " Success: true,\n", + " FacesCount: len(faces),\n", + " Faces: faces,\n", + "}\n", + "\n", + "// Marshal the output.\n", + "outputData, err := json.MarshalIndent(output, \"\", \" \")\n", + "if err != nil {\n", + " return log.Println(err)\n", + "}\n", + "\n", + "fmt.Println(string(outputData))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Go", + "language": "go", + "name": "gophernotes" + }, + "language_info": { + "codemirror_mode": "", + "file_extension": ".go", + "mimetype": "", + "name": "go", + "nbconvert_exporter": "", + "pygments_lexer": "", + "version": "go1.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/Feed-Forward-Recurrent-NN.ipynb b/examples/Feed-Forward-Recurrent-NN.ipynb deleted file mode 100644 index e4b50aa..0000000 --- a/examples/Feed-Forward-Recurrent-NN.ipynb +++ /dev/null @@ -1,250 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import (\n", - " \"math/rand\"\n", - " \"github.com/goml/gobrain\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Feed Forward vs. Recurrent Neural Networks" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "(comments from [wikipedia](https://en.wikipedia.org), examples from the [gobrain](https://github.com/goml/gobrain) documentation)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Feed Forward Description:" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "A feedforward neural network is an artificial neural network where connections between the units do not form a cycle. This is different from recurrent neural networks.\n", - "\n", - "The feedforward neural network was the first and simplest type of artificial neural network devised. In this network, the information moves in only one direction, forward, from the input nodes, through the hidden nodes (if any) and to the output nodes. There are no cycles or loops in the network." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## [Gobrain](https://github.com/goml/gobrain) Example - Feed Forward Function" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "// set the random seed to 0\n", - "rand.Seed(0)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "&gobrain.\u001b[32mFeedForward\u001b[0m{\n", - " \u001b[33mNInputs\u001b[0m: \u001b[34m\u001b[1m0\u001b[0m,\n", - " \u001b[33mNHiddens\u001b[0m: \u001b[34m\u001b[1m0\u001b[0m,\n", - " \u001b[33mNOutputs\u001b[0m: \u001b[34m\u001b[1m0\u001b[0m,\n", - " \u001b[33mRegression\u001b[0m: \u001b[36m\u001b[1mfalse\u001b[0m,\n", - " \u001b[33mInputActivations\u001b[0m: []\u001b[32mfloat64\u001b[0m{},\n", - " \u001b[33mHiddenActivations\u001b[0m: []\u001b[32mfloat64\u001b[0m{},\n", - " \u001b[33mOutputActivations\u001b[0m: []\u001b[32mfloat64\u001b[0m{},\n", - " \u001b[33mContexts\u001b[0m: []\u001b[32m[]float64\u001b[0m{},\n", - " \u001b[33mInputWeights\u001b[0m: []\u001b[32m[]float64\u001b[0m{},\n", - " \u001b[33mOutputWeights\u001b[0m: []\u001b[32m[]float64\u001b[0m{},\n", - " \u001b[33mInputChanges\u001b[0m: []\u001b[32m[]float64\u001b[0m{},\n", - " \u001b[33mOutputChanges\u001b[0m: []\u001b[32m[]float64\u001b[0m{},\n", - "}\n" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "// create the XOR representation patter to train the network\n", - "patterns := [][][]float64{\n", - " {{0, 0}, {0}},\n", - " {{0, 1}, {1}},\n", - " {{1, 0}, {1}},\n", - " {{1, 1}, {0}},\n", - "}\n", - "\n", - "// instantiate the Feed Forward\n", - "ff := &gobrain.FeedForward{}" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "// initialize the Neural Network;\n", - "// the networks structure will contain:\n", - "// 2 inputs, 2 hidden nodes and 1 output.\n", - "ff.Init(2, 2, 1)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "0 0.5524794213542835\n", - "[0 0] -> [0.05750394570844524] : [0]\n", - "[0 1] -> [0.9301006350712102] : [1]\n", - "[1 0] -> [0.927809966227284] : [1]\n", - "[1 1] -> [0.09740879532462095] : [0]\n" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "// train the network using the XOR patterns\n", - "// the training will run for 1000 epochs\n", - "// the learning rate is set to 0.6 and the momentum factor to 0.4\n", - "// use true in the last parameter to receive reports about the learning error\n", - "ff.Train(patterns, 1000, 0.6, 0.4, true)\n", - "ff.Test(patterns)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Where the first values are the inputs, the values after the arrow `->` are the output values from the network and the values after `:` are the expected outputs." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Recurrent Description:" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "A recurrent neural network (RNN) is a class of artificial neural network where connections between units form a directed cycle. This creates an internal state of the network which allows it to exhibit dynamic temporal behavior. Unlike feedforward neural networks, RNNs can use their internal memory to process arbitrary sequences of inputs. This makes them applicable to tasks such as unsegmented connected handwriting recognition or speech recognition." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## [Gobrain](https://github.com/goml/gobrain) - Recurrent Example" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Gobrain implements Elman's Simple Recurrent Network. To take advantage of this, one can use the `SetContexts` function." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "0 0.5524794213542835\n", - "[0 0] -> [0.05750394570844524] : [0]\n", - "[0 1] -> [0.9301006350712102] : [1]\n", - "[1 0] -> [0.927809966227284] : [1]\n", - "[1 1] -> [0.09740879532462095] : [0]\n" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ff.SetContexts(1, nil)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In the example above, a single context will be created initilized with 0.5. " - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Golang", - "language": "go", - "name": "gophernotes" - }, - "language_info": { - "name": "go" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/examples/Feed_forward_neural_net.gif b/examples/Feed_forward_neural_net.gif deleted file mode 100644 index bd7ab30..0000000 Binary files a/examples/Feed_forward_neural_net.gif and /dev/null differ diff --git a/examples/Matrix_Operations.ipynb b/examples/Matrix_Operations.ipynb new file mode 100644 index 0000000..23ad389 --- /dev/null +++ b/examples/Matrix_Operations.ipynb @@ -0,0 +1,164 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import (\n", + " \"fmt\"\n", + " \"math\"\n", + "\n", + " \"gonum.org/v1/gonum/mat\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Create some matrices" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "// Create two matrices of the same size, a and b.\n", + "a := mat.NewDense(3, 3, []float64{1, 2, 3, 0, 4, 5, 0, 0, 6})\n", + "b := mat.NewDense(3, 3, []float64{8, 9, 10, 1, 4, 2, 9, 0, 2})\n", + "c := mat.NewDense(3, 2, []float64{3, 2, 1, 4, 0, 8})" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\n", + "a = ⎡1 2 3⎤\n", + " ⎢0 4 5⎥\n", + " ⎣0 0 6⎦\n", + "\n", + "b = ⎡ 8 9 10⎤\n", + " ⎢ 1 4 2⎥\n", + " ⎣ 9 0 2⎦\n", + "\n" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fa := mat.Formatted(a, mat.Prefix(\" \"))\n", + "fb := mat.Formatted(b, mat.Prefix(\" \"))\n", + "fmt.Printf(\"\\na = %0.4v\\n\\n\", fa)\n", + "fmt.Printf(\"b = %0.4v\\n\\n\", fb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Matrix addition, multiplication, powers, and apply" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "d = a + b = ⎡ 9 11 13⎤\n", + " ⎢ 1 8 7⎥\n", + " ⎣ 9 0 8⎦\n", + "\n", + "f = a c = ⎡ 5 34⎤\n", + " ⎢ 4 56⎥\n", + " ⎣ 0 48⎦\n", + "\n", + "g = a^5 = ⎡ 1 682 1.074e+04⎤\n", + " ⎢ 0 1024 1.688e+04⎥\n", + " ⎣ 0 0 7776⎦\n", + "\n", + "h = sqrt(a) = ⎡ 1 1.414 1.732⎤\n", + " ⎢ 0 2 2.236⎥\n", + " ⎣ 0 0 2.449⎦\n", + "\n" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "// Add a and b.\n", + "d := mat.NewDense(0, 0, nil)\n", + "d.Add(a, b)\n", + "fd := mat.Formatted(d, mat.Prefix(\" \"))\n", + "fmt.Printf(\"d = a + b = %0.4v\\n\\n\", fd)\n", + "\n", + "// Multiply a and c.\n", + "f := mat.NewDense(0, 0, nil)\n", + "f.Mul(a, c)\n", + "ff := mat.Formatted(f, mat.Prefix(\" \"))\n", + "fmt.Printf(\"f = a c = %0.4v\\n\\n\", ff)\n", + "\n", + "// Raising a matrix to a power.\n", + "g := mat.NewDense(0, 0, nil)\n", + "g.Pow(a, 5)\n", + "fg := mat.Formatted(g, mat.Prefix(\" \"))\n", + "fmt.Printf(\"g = a^5 = %0.4v\\n\\n\", fg)\n", + "\n", + "// Apply a function to each of the elements of a.\n", + "h := mat.NewDense(0, 0, nil)\n", + "sqrt := func(_, _ int, v float64) float64 { return math.Sqrt(v) }\n", + "h.Apply(sqrt, a)\n", + "fh := mat.Formatted(h, mat.Prefix(\" \"))\n", + "fmt.Printf(\"h = sqrt(a) = %0.4v\\n\\n\", fh)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Go", + "language": "go", + "name": "gophernotes" + }, + "language_info": { + "codemirror_mode": "", + "file_extension": ".go", + "mimetype": "", + "name": "go", + "nbconvert_exporter": "", + "pygments_lexer": "", + "version": "go1.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/Pattern-Recognition.ipynb b/examples/Pattern-Recognition.ipynb deleted file mode 100644 index ae42ea4..0000000 --- a/examples/Pattern-Recognition.ipynb +++ /dev/null @@ -1,244 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Imports" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import (\n", - " \"fmt\"\n", - " \"github.com/sjwhitworth/golearn/base\"\n", - " \"github.com/sjwhitworth/golearn/evaluation\"\n", - " \"github.com/sjwhitworth/golearn/knn\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Problem/Data Description" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Information about this dataset comes from [here](https://archive.ics.uci.edu/ml/datasets/Iris)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Data Set Information:" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This is perhaps the best known database to be found in the pattern recognition literature. Fisher's paper is a classic in the field and is referenced frequently to this day. (See Duda & Hart, for example.) The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly separable from each other. \n", - "\n", - "Predicted attribute: class of iris plant. " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Attribute Information:" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "1. sepal length in cm \n", - "2. sepal width in cm \n", - "3. petal length in cm \n", - "4. petal width in cm \n", - "5. class: \n", - "-- Iris Setosa \n", - "-- Iris Versicolour \n", - "-- Iris Virginica" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Building a Pattern Recognition Model" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This example model comes from the [golearn](https://github.com/sjwhitworth/golearn) documentation." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "Optimisations are switched off\n", - "KNN: 1.14 % done\n", - "KNN: 2.27 % done\n", - "KNN: 3.41 % done\n", - "KNN: 4.55 % done\n", - "KNN: 5.68 % done\n", - "KNN: 6.82 % done\n", - "KNN: 7.95 % done\n", - "KNN: 9.09 % done\n", - "KNN: 10.23 % done\n", - "KNN: 11.36 % done\n", - "KNN: 12.50 % done\n", - "KNN: 13.64 % done\n", - "KNN: 14.77 % done\n", - "KNN: 15.91 % done\n", - "KNN: 17.05 % done\n", - "KNN: 18.18 % done\n", - "KNN: 19.32 % done\n", - "KNN: 20.45 % done\n", - "KNN: 21.59 % done\n", - "KNN: 22.73 % done\n", - "KNN: 23.86 % done\n", - "KNN: 25.00 % done\n", - "KNN: 26.14 % done\n", - "KNN: 27.27 % done\n", - "KNN: 28.41 % done\n", - "KNN: 29.55 % done\n", - "KNN: 30.68 % done\n", - "KNN: 31.82 % done\n", - "KNN: 32.95 % done\n", - "KNN: 34.09 % done\n", - "KNN: 35.23 % done\n", - "KNN: 36.36 % done\n", - "KNN: 37.50 % done\n", - "KNN: 38.64 % done\n", - "KNN: 39.77 % done\n", - "KNN: 40.91 % done\n", - "KNN: 42.05 % done\n", - "KNN: 43.18 % done\n", - "KNN: 44.32 % done\n", - "KNN: 45.45 % done\n", - "KNN: 46.59 % done\n", - "KNN: 47.73 % done\n", - "KNN: 48.86 % done\n", - "KNN: 50.00 % done\n", - "KNN: 51.14 % done\n", - "KNN: 52.27 % done\n", - "KNN: 53.41 % done\n", - "KNN: 54.55 % done\n", - "KNN: 55.68 % done\n", - "KNN: 56.82 % done\n", - "KNN: 57.95 % done\n", - "KNN: 59.09 % done\n", - "KNN: 60.23 % done\n", - "KNN: 61.36 % done\n", - "KNN: 62.50 % done\n", - "KNN: 63.64 % done\n", - "KNN: 64.77 % done\n", - "KNN: 65.91 % done\n", - "KNN: 67.05 % done\n", - "KNN: 68.18 % done\n", - "KNN: 69.32 % done\n", - "KNN: 70.45 % done\n", - "KNN: 71.59 % done\n", - "KNN: 72.73 % done\n", - "KNN: 73.86 % done\n", - "KNN: 75.00 % done\n", - "KNN: 76.14 % done\n", - "KNN: 77.27 % done\n", - "KNN: 78.41 % done\n", - "KNN: 79.55 % done\n", - "KNN: 80.68 % done\n", - "KNN: 81.82 % done\n", - "KNN: 82.95 % done\n", - "KNN: 84.09 % done\n", - "KNN: 85.23 % done\n", - "KNN: 86.36 % done\n", - "KNN: 87.50 % done\n", - "KNN: 88.64 % done\n", - "KNN: 89.77 % done\n", - "KNN: 90.91 % done\n", - "KNN: 92.05 % done\n", - "KNN: 93.18 % done\n", - "KNN: 94.32 % done\n", - "KNN: 95.45 % done\n", - "KNN: 96.59 % done\n", - "KNN: 97.73 % done\n", - "KNN: 98.86 % done\n", - "Reference Class\tTrue Positives\tFalse Positives\tTrue Negatives\tPrecision\tRecall\tF1 Score\n", - "---------------\t--------------\t---------------\t--------------\t---------\t------\t--------\n", - "Iris-setosa\t30\t\t0\t\t58\t\t1.0000\t\t1.0000\t1.0000\n", - "Iris-virginica\t28\t\t1\t\t58\t\t0.9655\t\t0.9655\t0.9655\n", - "Iris-versicolor\t28\t\t1\t\t58\t\t0.9655\t\t0.9655\t0.9655\n", - "Overall accuracy: 0.9773\n", - "\n" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "// Load in a dataset, with headers. Header attributes will be stored.\n", - "// Think of instances as a Data Frame structure in R or Pandas.\n", - "// You can also create instances from scratch.\n", - "rawData, err := base.ParseCSVToInstances(\"iris.csv\", false)\n", - "\n", - "//Initialises a new KNN classifier\n", - "cls := knn.NewKnnClassifier(\"euclidean\", 2)\n", - "\n", - "//Do a training-test split\n", - "trainData, testData := base.InstancesTrainTestSplit(rawData, 0.50)\n", - "cls.Fit(trainData)\n", - "\n", - "//Calculates the Euclidean distance and returns the most popular label\n", - "predictions := cls.Predict(testData)\n", - "\n", - "// Calculate precision/recall metrics, and summarize results\n", - "confusionMat, err := evaluation.GetConfusionMatrix(testData, predictions)\n", - "fmt.Println(evaluation.GetSummary(confusionMat))" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Golang", - "language": "go", - "name": "gophernotes" - }, - "language_info": { - "name": "go" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/examples/Simple-Example.ipynb b/examples/Simple-Example.ipynb deleted file mode 100644 index d283f17..0000000 --- a/examples/Simple-Example.ipynb +++ /dev/null @@ -1,154 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Imports" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import \"fmt\"" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Hello World" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31mworld\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "world := \"world\"" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31mhello world\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "fmt.Sprintf(\"hello %s\", world)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Channels" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Here is a simple example of a channel. " - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "(\u001b[32mchan string\u001b[0m)(\u001b[34m\u001b[1m0xc4200180c0\u001b[0m)\n" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "messages := make(chan string)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "go func() { messages <- \"ping\" }()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31mping\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "msg := <- messages" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Golang", - "language": "go", - "name": "gophernotes" - }, - "language_info": { - "name": "go" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/examples/Stateful-Goroutines.ipynb b/examples/Stateful-Goroutines.ipynb deleted file mode 100644 index b19ab20..0000000 --- a/examples/Stateful-Goroutines.ipynb +++ /dev/null @@ -1,286 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Stateful Goroutines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "To synchronize access to shared state across multiple goroutines, one option is to use the built-in synchronization features of goroutines and channels. This channel-based approach aligns with Go’s ideas of sharing memory by communicating and having each piece of data owned by exactly 1 goroutine.\n", - "\n", - "Comments from [Go by Example](https://gobyexample.com)." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import (\n", - " \"fmt\"\n", - " \"math/rand\"\n", - " \"sync/atomic\"\n", - " \"time\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## `structs` to Encapsulate Requests" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In this example our state will be owned by a single goroutine. This will guarantee that the data is never corrupted with concurrent access. In order to read or write that state, other goroutines will send messages to the owning goroutine and receive corresponding replies. These readOp and writeOp structs encapsulate those requests and a way for the owning goroutine to respond." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "type readOp struct {\n", - " key int\n", - " resp chan int\n", - "}" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "type writeOp struct {\n", - " key int\n", - " val int\n", - " resp chan bool\n", - "}" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Definitions" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Count how many operations we perform." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "var ops int64 = 0" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The reads and writes channels will be used by other goroutines to issue read and write requests, respectively." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "(chan *main.\u001b[32mwriteOp\u001b[0m)(\u001b[34m\u001b[1m0xc420018120\u001b[0m)\n" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "reads := make(chan *readOp)\n", - "writes := make(chan *writeOp)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Goroutines" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Here is the goroutine that owns the state, which is a map as in the previous example but now private to the stateful goroutine. This goroutine repeatedly selects on the reads and writes channels, responding to requests as they arrive. A response is executed by first performing the requested operation and then sending a value on the response channel resp to indicate success (and the desired value in the case of reads)." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "go func() {\n", - " var state = make(map[int]int)\n", - " for {\n", - " select {\n", - " case read := <-reads:\n", - " read.resp <- state[read.key]\n", - " case write := <-writes:\n", - " state[write.key] = write.val\n", - " write.resp <- true\n", - " }\n", - " }\n", - "}()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "This starts 100 goroutines to issue reads to the state-owning goroutine via the reads channel. Each read requires constructing a readOp, sending it over the reads channel, and the receiving the result over the provided resp channel." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "for r := 0; r < 100; r++ {\n", - " go func() {\n", - " for {\n", - " read := &readOp{\n", - " key: rand.Intn(5),\n", - " resp: make(chan int)}\n", - " reads <- read\n", - " <-read.resp\n", - " atomic.AddInt64(&ops, 1)\n", - " }\n", - " }()\n", - "}" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We start 10 writes as well, using a similar approach." - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "for w := 0; w < 10; w++ {\n", - " go func() {\n", - " for {\n", - " write := &writeOp{\n", - " key: rand.Intn(5),\n", - " val: rand.Intn(100),\n", - " resp: make(chan bool)}\n", - " writes <- write\n", - " <-write.resp\n", - " atomic.AddInt64(&ops, 1)\n", - " }\n", - " }()\n", - "}\n", - "// let the goroutines work for a second\n", - "time.Sleep(time.Second)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Collect the Ops Count" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Let the goroutines work for a second. Finally, capture and report the ops count." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[34m\u001b[1m918893\u001b[0m\n" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "opsFinal := atomic.LoadInt64(&ops)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Running our program shows that the goroutine-based state management example achieves about 800,000 operations per second." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Golang", - "language": "go", - "name": "gophernotes" - }, - "language_info": { - "name": "go" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/examples/Time-Formatting-Parsing.ipynb b/examples/Time-Formatting-Parsing.ipynb deleted file mode 100644 index e336b2d..0000000 --- a/examples/Time-Formatting-Parsing.ipynb +++ /dev/null @@ -1,324 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Time Formatting / Parsing" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Go supports time formatting and parsing via pattern-based layouts. Comments from [Go by Example](https://gobyexample.com)." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Imports" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "import (\n", - " \"fmt\"\n", - " \"time\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Basic Time Formatting" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Here’s a basic example of formatting a time according to RFC3339, using the corresponding layout constant." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[34m\u001b[1m2016\u001b[0m-\u001b[34m\u001b[1m09\u001b[0m-\u001b[34m\u001b[1m08\u001b[0m \u001b[34m\u001b[1m07\u001b[0m:\u001b[34m\u001b[1m04\u001b[0m:\u001b[34m\u001b[1m48\u001b[0m \u001b[34m\u001b[1mLocal\u001b[0m\n" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t := time.Now()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31m2016-09-08T07:04:49-05:00\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t.Format(time.RFC3339)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Time Parsing" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Time parsing uses the same layout values as Format." - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[34m\u001b[1m2012\u001b[0m-\u001b[34m\u001b[1m11\u001b[0m-\u001b[34m\u001b[1m01\u001b[0m \u001b[34m\u001b[1m22\u001b[0m:\u001b[34m\u001b[1m08\u001b[0m:\u001b[34m\u001b[1m41\u001b[0m \u001b[34m\u001b[1m\u001b[0m\n" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t1, _ := time.Parse(time.RFC3339, \"2012-11-01T22:08:41+00:00\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Parse will return an error on malformed input explaining the parsing problem." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "&time.\u001b[32mParseError\u001b[0m{\n", - " \u001b[33mLayout\u001b[0m: \u001b[31m\u001b[1m\"\u001b[0m\u001b[31mMon Jan _2 15:04:05 2006\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m,\n", - " \u001b[33mValue\u001b[0m: \u001b[31m\u001b[1m\"\u001b[0m\u001b[31m8:41PM\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m,\n", - " \u001b[33mLayoutElem\u001b[0m: \u001b[31m\u001b[1m\"\u001b[0m\u001b[31mMon\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m,\n", - " \u001b[33mValueElem\u001b[0m: \u001b[31m\u001b[1m\"\u001b[0m\u001b[31m8:41PM\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m,\n", - " \u001b[33mMessage\u001b[0m: \u001b[31m\u001b[1m\"\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m,\n", - "}\n" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ansic := \"Mon Jan _2 15:04:05 2006\"\n", - "_, e := time.Parse(ansic, \"8:41PM\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Custom Layouts" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Format and Parse use example-based layouts. Usually you’ll use a constant from time for these layouts, but you can also supply custom layouts. Layouts must use the reference time Mon Jan 2 15:04:05 MST 2006 to show the pattern with which to format/parse a given time/string. The example time must be exactly as shown: the year 2006, 15 for the hour, Monday for the day of the week, etc." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31m7:05AM\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t.Format(\"3:04PM\")" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31mThu Sep 8 07:05:16 2016\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t.Format(\"Mon Jan _2 15:04:05 2006\")" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[31m\u001b[1m\"\u001b[0m\u001b[31m2016-09-08T07:05:17.689228-05:00\u001b[0m\u001b[31m\u001b[1m\"\u001b[0m\n" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "t.Format(\"2006-01-02T15:04:05.999999-07:00\")" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[34m\u001b[1m0\u001b[0m-\u001b[34m\u001b[1m01\u001b[0m-\u001b[34m\u001b[1m01\u001b[0m \u001b[34m\u001b[1m20\u001b[0m:\u001b[34m\u001b[1m41\u001b[0m:\u001b[34m\u001b[1m00\u001b[0m \u001b[34m\u001b[1mUTC\u001b[0m\n" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "form := \"3 04 PM\"\n", - "t2, _ := time.Parse(form, \"8 41 PM\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## String Formatting" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "For purely numeric representations you can also use standard string formatting with the extracted components of the time value." - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "2016-09-08T07:05:21-00:00\n", - "\u001b[34m\u001b[1m26\u001b[0m\n", - "\u001b[36m\u001b[1mnil\u001b[0m\n" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "fmt.Printf(\"%d-%02d-%02dT%02d:%02d:%02d-00:00\\n\",\n", - " t.Year(), t.Month(), t.Day(),\n", - " t.Hour(), t.Minute(), t.Second())" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Golang", - "language": "go", - "name": "gophernotes" - }, - "language_info": { - "name": "go" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/examples/Worker-Pools.ipynb b/examples/Worker_Pools.ipynb similarity index 64% rename from examples/Worker-Pools.ipynb rename to examples/Worker_Pools.ipynb index ebd9331..701d552 100644 --- a/examples/Worker-Pools.ipynb +++ b/examples/Worker_Pools.ipynb @@ -13,7 +13,7 @@ "source": [ "In this example we’ll look at how to implement a worker pool using goroutines and channels.\n", "\n", - "Comments from [Go by Example](https://gobyexample.com)." + "Comments from [Go by Example](https://gobyexample.com/worker-pools)." ] }, { @@ -34,7 +34,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Worker Function" + "# Worker Function" ] }, { @@ -65,7 +65,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Utilize Workers" + "# Utilize Workers" ] }, { @@ -79,20 +79,9 @@ "cell_type": "code", "execution_count": 3, "metadata": { - "collapsed": false + "collapsed": true }, - "outputs": [ - { - "data": { - "text/plain": [ - "(\u001b[32mchan int\u001b[0m)(\u001b[34m\u001b[1m0xc42006f500\u001b[0m)\n" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "jobs := make(chan int, 100)\n", "results := make(chan int, 100)" @@ -109,7 +98,7 @@ "cell_type": "code", "execution_count": 4, "metadata": { - "collapsed": false + "collapsed": true }, "outputs": [], "source": [ @@ -128,81 +117,52 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "for j := 1; j <= 9; j++ {\n", - " jobs <- j\n", - "}\n", - "close(jobs)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Collect Results" - ] - }, - { - "cell_type": "markdown", "metadata": {}, - "source": [ - "Finally we collect all the results of the work:" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, "outputs": [ { "data": { "text/plain": [ - "worker 3 processing job 1\n", - "worker 1 processing job 2\n", - "worker 2 processing job 3\n", - "worker 3 processing job 5\n", - "worker 1 processing job 6\n", - "worker 2 processing job 4\n", - "worker 2 processing job 7\n", - "worker 1 processing job 8\n", - "worker 3 processing job 9\n" + "worker 4 processing job 1\n", + "worker 4 processing job 2\n", + "worker 4 processing job 3\n", + "worker 4 processing job 4\n", + "worker 4 processing job 5\n", + "worker 4 processing job 6\n", + "worker 4 processing job 7\n", + "worker 4 processing job 8\n", + "worker 4 processing job 9\n" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "for a := 1; a <= 9; a++ {\n", - " <-results\n", - "}" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Our running program shows the 9 jobs being executed by various workers. The program only takes about 3 seconds despite doing about 9 seconds of total work because there are 3 workers operating concurrently." + "for j := 1; j <= 9; j++ {\n", + " jobs <- j\n", + "}\n", + "time.Sleep(3*time.Second)\n", + "close(jobs)" ] } ], "metadata": { "kernelspec": { - "display_name": "Golang", + "display_name": "Go", "language": "go", "name": "gophernotes" }, "language_info": { - "name": "go" + "codemirror_mode": "", + "file_extension": ".go", + "mimetype": "", + "name": "go", + "nbconvert_exporter": "", + "pygments_lexer": "", + "version": "go1.9" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 2 } diff --git a/examples/iris.csv b/examples/iris.csv deleted file mode 100644 index a3490e0..0000000 --- a/examples/iris.csv +++ /dev/null @@ -1,150 +0,0 @@ -5.1,3.5,1.4,0.2,Iris-setosa -4.9,3.0,1.4,0.2,Iris-setosa -4.7,3.2,1.3,0.2,Iris-setosa -4.6,3.1,1.5,0.2,Iris-setosa -5.0,3.6,1.4,0.2,Iris-setosa -5.4,3.9,1.7,0.4,Iris-setosa -4.6,3.4,1.4,0.3,Iris-setosa -5.0,3.4,1.5,0.2,Iris-setosa -4.4,2.9,1.4,0.2,Iris-setosa -4.9,3.1,1.5,0.1,Iris-setosa -5.4,3.7,1.5,0.2,Iris-setosa -4.8,3.4,1.6,0.2,Iris-setosa -4.8,3.0,1.4,0.1,Iris-setosa -4.3,3.0,1.1,0.1,Iris-setosa -5.8,4.0,1.2,0.2,Iris-setosa -5.7,4.4,1.5,0.4,Iris-setosa -5.4,3.9,1.3,0.4,Iris-setosa -5.1,3.5,1.4,0.3,Iris-setosa -5.7,3.8,1.7,0.3,Iris-setosa -5.1,3.8,1.5,0.3,Iris-setosa -5.4,3.4,1.7,0.2,Iris-setosa -5.1,3.7,1.5,0.4,Iris-setosa -4.6,3.6,1.0,0.2,Iris-setosa -5.1,3.3,1.7,0.5,Iris-setosa -4.8,3.4,1.9,0.2,Iris-setosa -5.0,3.0,1.6,0.2,Iris-setosa -5.0,3.4,1.6,0.4,Iris-setosa -5.2,3.5,1.5,0.2,Iris-setosa -5.2,3.4,1.4,0.2,Iris-setosa -4.7,3.2,1.6,0.2,Iris-setosa -4.8,3.1,1.6,0.2,Iris-setosa -5.4,3.4,1.5,0.4,Iris-setosa -5.2,4.1,1.5,0.1,Iris-setosa -5.5,4.2,1.4,0.2,Iris-setosa -4.9,3.1,1.5,0.1,Iris-setosa -5.0,3.2,1.2,0.2,Iris-setosa -5.5,3.5,1.3,0.2,Iris-setosa -4.9,3.1,1.5,0.1,Iris-setosa -4.4,3.0,1.3,0.2,Iris-setosa -5.1,3.4,1.5,0.2,Iris-setosa -5.0,3.5,1.3,0.3,Iris-setosa -4.5,2.3,1.3,0.3,Iris-setosa -4.4,3.2,1.3,0.2,Iris-setosa -5.0,3.5,1.6,0.6,Iris-setosa -5.1,3.8,1.9,0.4,Iris-setosa -4.8,3.0,1.4,0.3,Iris-setosa -5.1,3.8,1.6,0.2,Iris-setosa -4.6,3.2,1.4,0.2,Iris-setosa -5.3,3.7,1.5,0.2,Iris-setosa -5.0,3.3,1.4,0.2,Iris-setosa -7.0,3.2,4.7,1.4,Iris-versicolor -6.4,3.2,4.5,1.5,Iris-versicolor -6.9,3.1,4.9,1.5,Iris-versicolor -5.5,2.3,4.0,1.3,Iris-versicolor -6.5,2.8,4.6,1.5,Iris-versicolor -5.7,2.8,4.5,1.3,Iris-versicolor -6.3,3.3,4.7,1.6,Iris-versicolor -4.9,2.4,3.3,1.0,Iris-versicolor -6.6,2.9,4.6,1.3,Iris-versicolor -5.2,2.7,3.9,1.4,Iris-versicolor -5.0,2.0,3.5,1.0,Iris-versicolor -5.9,3.0,4.2,1.5,Iris-versicolor -6.0,2.2,4.0,1.0,Iris-versicolor -6.1,2.9,4.7,1.4,Iris-versicolor -5.6,2.9,3.6,1.3,Iris-versicolor -6.7,3.1,4.4,1.4,Iris-versicolor -5.6,3.0,4.5,1.5,Iris-versicolor -5.8,2.7,4.1,1.0,Iris-versicolor -6.2,2.2,4.5,1.5,Iris-versicolor -5.6,2.5,3.9,1.1,Iris-versicolor -5.9,3.2,4.8,1.8,Iris-versicolor -6.1,2.8,4.0,1.3,Iris-versicolor -6.3,2.5,4.9,1.5,Iris-versicolor -6.1,2.8,4.7,1.2,Iris-versicolor -6.4,2.9,4.3,1.3,Iris-versicolor -6.6,3.0,4.4,1.4,Iris-versicolor -6.8,2.8,4.8,1.4,Iris-versicolor -6.7,3.0,5.0,1.7,Iris-versicolor -6.0,2.9,4.5,1.5,Iris-versicolor -5.7,2.6,3.5,1.0,Iris-versicolor -5.5,2.4,3.8,1.1,Iris-versicolor -5.5,2.4,3.7,1.0,Iris-versicolor -5.8,2.7,3.9,1.2,Iris-versicolor -6.0,2.7,5.1,1.6,Iris-versicolor -5.4,3.0,4.5,1.5,Iris-versicolor -6.0,3.4,4.5,1.6,Iris-versicolor -6.7,3.1,4.7,1.5,Iris-versicolor -6.3,2.3,4.4,1.3,Iris-versicolor -5.6,3.0,4.1,1.3,Iris-versicolor -5.5,2.5,4.0,1.3,Iris-versicolor -5.5,2.6,4.4,1.2,Iris-versicolor -6.1,3.0,4.6,1.4,Iris-versicolor -5.8,2.6,4.0,1.2,Iris-versicolor -5.0,2.3,3.3,1.0,Iris-versicolor -5.6,2.7,4.2,1.3,Iris-versicolor -5.7,3.0,4.2,1.2,Iris-versicolor -5.7,2.9,4.2,1.3,Iris-versicolor -6.2,2.9,4.3,1.3,Iris-versicolor -5.1,2.5,3.0,1.1,Iris-versicolor -5.7,2.8,4.1,1.3,Iris-versicolor -6.3,3.3,6.0,2.5,Iris-virginica -5.8,2.7,5.1,1.9,Iris-virginica -7.1,3.0,5.9,2.1,Iris-virginica -6.3,2.9,5.6,1.8,Iris-virginica -6.5,3.0,5.8,2.2,Iris-virginica -7.6,3.0,6.6,2.1,Iris-virginica -4.9,2.5,4.5,1.7,Iris-virginica -7.3,2.9,6.3,1.8,Iris-virginica -6.7,2.5,5.8,1.8,Iris-virginica -7.2,3.6,6.1,2.5,Iris-virginica -6.5,3.2,5.1,2.0,Iris-virginica -6.4,2.7,5.3,1.9,Iris-virginica -6.8,3.0,5.5,2.1,Iris-virginica -5.7,2.5,5.0,2.0,Iris-virginica -5.8,2.8,5.1,2.4,Iris-virginica -6.4,3.2,5.3,2.3,Iris-virginica -6.5,3.0,5.5,1.8,Iris-virginica -7.7,3.8,6.7,2.2,Iris-virginica -7.7,2.6,6.9,2.3,Iris-virginica -6.0,2.2,5.0,1.5,Iris-virginica -6.9,3.2,5.7,2.3,Iris-virginica -5.6,2.8,4.9,2.0,Iris-virginica -7.7,2.8,6.7,2.0,Iris-virginica -6.3,2.7,4.9,1.8,Iris-virginica -6.7,3.3,5.7,2.1,Iris-virginica -7.2,3.2,6.0,1.8,Iris-virginica -6.2,2.8,4.8,1.8,Iris-virginica -6.1,3.0,4.9,1.8,Iris-virginica -6.4,2.8,5.6,2.1,Iris-virginica -7.2,3.0,5.8,1.6,Iris-virginica -7.4,2.8,6.1,1.9,Iris-virginica -7.9,3.8,6.4,2.0,Iris-virginica -6.4,2.8,5.6,2.2,Iris-virginica -6.3,2.8,5.1,1.5,Iris-virginica -6.1,2.6,5.6,1.4,Iris-virginica -7.7,3.0,6.1,2.3,Iris-virginica -6.3,3.4,5.6,2.4,Iris-virginica -6.4,3.1,5.5,1.8,Iris-virginica -6.0,3.0,4.8,1.8,Iris-virginica -6.9,3.1,5.4,2.1,Iris-virginica -6.7,3.1,5.6,2.4,Iris-virginica -6.9,3.1,5.1,2.3,Iris-virginica -5.8,2.7,5.1,1.9,Iris-virginica -6.8,3.2,5.9,2.3,Iris-virginica -6.7,3.3,5.7,2.5,Iris-virginica -6.7,3.0,5.2,2.3,Iris-virginica -6.3,2.5,5.0,1.9,Iris-virginica -6.5,3.0,5.2,2.0,Iris-virginica -6.2,3.4,5.4,2.3,Iris-virginica -5.9,3.0,5.1,1.8,Iris-virginica diff --git a/examples/iris.jpg b/examples/iris.jpg deleted file mode 100644 index 85bb9b4..0000000 Binary files a/examples/iris.jpg and /dev/null differ diff --git a/execution.go b/execution.go deleted file mode 100644 index 5ac8254..0000000 --- a/execution.go +++ /dev/null @@ -1,93 +0,0 @@ -package main - -import ( - "fmt" - "go/token" - - repl "github.com/gopherds/gophernotes/internal/repl" -) - -var ( - // REPLSession manages the I/O to/from the notebook. - REPLSession *repl.Session - fset *token.FileSet -) - -// ExecCounter is incremented each time we run user code in the notebook. -var ExecCounter int - -// SetupExecutionEnvironment initializes the REPL session and set of tmp files. -func SetupExecutionEnvironment() { - - var err error - REPLSession, err = repl.NewSession() - if err != nil { - panic(err) - } - - fset = token.NewFileSet() -} - -// OutputMsg holds the data for a pyout message. -type OutputMsg struct { - Execcount int `json:"execution_count"` - Data map[string]string `json:"data"` - Metadata map[string]interface{} `json:"metadata"` -} - -// ErrMsg encodes the traceback of errors output to the notebook. -type ErrMsg struct { - EName string `json:"ename"` - EValue string `json:"evalue"` - Traceback []string `json:"traceback"` -} - -// HandleExecuteRequest runs code from an execute_request method, and sends the various -// reply messages. -func HandleExecuteRequest(receipt MsgReceipt) { - - reply := NewMsg("execute_reply", receipt.Msg) - content := make(map[string]interface{}) - reqcontent := receipt.Msg.Content.(map[string]interface{}) - code := reqcontent["code"].(string) - silent := reqcontent["silent"].(bool) - if !silent { - ExecCounter++ - } - content["execution_count"] = ExecCounter - - // Do the compilation/execution magic. - val, stderr, err := REPLSession.Eval(code) - - if err == nil { - content["status"] = "ok" - content["payload"] = make([]map[string]interface{}, 0) - content["user_variables"] = make(map[string]string) - content["user_expressions"] = make(map[string]string) - if len(val) > 0 && !silent { - var outContent OutputMsg - out := NewMsg("pyout", receipt.Msg) - outContent.Execcount = ExecCounter - outContent.Data = make(map[string]string) - outContent.Data["text/plain"] = fmt.Sprint(val) - outContent.Metadata = make(map[string]interface{}) - out.Content = outContent - receipt.SendResponse(receipt.Sockets.IOPubSocket, out) - } - } else { - content["status"] = "error" - content["ename"] = "ERROR" - content["evalue"] = err.Error() - content["traceback"] = []string{stderr.String()} - errormsg := NewMsg("pyerr", receipt.Msg) - errormsg.Content = ErrMsg{"Error", err.Error(), []string{stderr.String()}} - receipt.SendResponse(receipt.Sockets.IOPubSocket, errormsg) - } - - // send the output back to the notebook - reply.Content = content - receipt.SendResponse(receipt.Sockets.ShellSocket, reply) - idle := NewMsg("status", receipt.Msg) - idle.Content = KernelStatus{"idle"} - receipt.SendResponse(receipt.Sockets.IOPubSocket, idle) -} diff --git a/files/gophernotes-gopher.png b/files/gophernotes-gopher.png new file mode 100644 index 0000000..ebd2446 Binary files /dev/null and b/files/gophernotes-gopher.png differ diff --git a/files/gophernotes-logo.png b/files/gophernotes-logo.png new file mode 100644 index 0000000..87b8f12 Binary files /dev/null and b/files/gophernotes-logo.png differ diff --git a/files/gophernotes.jpg b/files/gophernotes.jpg deleted file mode 100644 index a14172b..0000000 Binary files a/files/gophernotes.jpg and /dev/null differ diff --git a/files/gophernotes2.jpg b/files/gophernotes2.jpg deleted file mode 100644 index fd25046..0000000 Binary files a/files/gophernotes2.jpg and /dev/null differ diff --git a/files/jupyter.gif b/files/jupyter.gif new file mode 100644 index 0000000..4ecbe9a Binary files /dev/null and b/files/jupyter.gif differ diff --git a/files/nteract.gif b/files/nteract.gif new file mode 100644 index 0000000..88f59fc Binary files /dev/null and b/files/nteract.gif differ diff --git a/files/screencast.gif b/files/screencast.gif deleted file mode 100644 index bbc3848..0000000 Binary files a/files/screencast.gif and /dev/null differ diff --git a/fixtures/connection_file.json b/fixtures/connection_file.json new file mode 100644 index 0000000..37bf45e --- /dev/null +++ b/fixtures/connection_file.json @@ -0,0 +1,11 @@ +{ + "control_port": 50160, + "shell_port": 57503, + "transport": "tcp", + "signature_scheme": "hmac-sha256", + "stdin_port": 52597, + "hb_port": 42540, + "ip": "127.0.0.1", + "iopub_port": 40885, + "key": "a0436f6c-1916-498b-8eb9-e81ab9368e84" +} diff --git a/gophernotes.go b/gophernotes.go deleted file mode 100644 index 9230428..0000000 --- a/gophernotes.go +++ /dev/null @@ -1,211 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "io" - "io/ioutil" - "log" - "os" - - zmq "github.com/alecthomas/gozmq" - "github.com/pkg/errors" -) - -var logger *log.Logger - -// ConnectionInfo stores the contents of the kernel connection file created by Jupyter. -type ConnectionInfo struct { - SignatureScheme string `json:"signature_scheme"` - Transport string `json:"transport"` - StdinPort int `json:"stdin_port"` - ControlPort int `json:"control_port"` - IOPubPort int `json:"iopub_port"` - HBPort int `json:"hb_port"` - ShellPort int `json:"shell_port"` - Key string `json:"key"` - IP string `json:"ip"` -} - -// SocketGroup holds the sockets needed to communicate with the kernel, and -// the key for message signing. -type SocketGroup struct { - ShellSocket *zmq.Socket - ControlSocket *zmq.Socket - StdinSocket *zmq.Socket - IOPubSocket *zmq.Socket - Key []byte -} - -// PrepareSockets sets up the ZMQ sockets through which the kernel will communicate. -func PrepareSockets(connInfo ConnectionInfo) (SocketGroup, error) { - - // Initialize the Socket Group. - context, sg, err := createSockets() - if err != nil { - return sg, errors.Wrap(err, "Could not initialize context and Socket Group") - } - - // Bind the sockets. - address := fmt.Sprintf("%v://%v:%%v", connInfo.Transport, connInfo.IP) - sg.ShellSocket.Bind(fmt.Sprintf(address, connInfo.ShellPort)) - sg.ControlSocket.Bind(fmt.Sprintf(address, connInfo.ControlPort)) - sg.StdinSocket.Bind(fmt.Sprintf(address, connInfo.StdinPort)) - sg.IOPubSocket.Bind(fmt.Sprintf(address, connInfo.IOPubPort)) - - // Message signing key - sg.Key = []byte(connInfo.Key) - - // Start the heartbeat device - HBSocket, err := context.NewSocket(zmq.REP) - if err != nil { - return sg, errors.Wrap(err, "Could not get the Heartbeat device socket") - } - HBSocket.Bind(fmt.Sprintf(address, connInfo.HBPort)) - go zmq.Device(zmq.FORWARDER, HBSocket, HBSocket) - - return sg, nil -} - -// createSockets initializes the sockets for the socket group based on values from zmq. -func createSockets() (*zmq.Context, SocketGroup, error) { - - context, err := zmq.NewContext() - if err != nil { - return context, SocketGroup{}, errors.Wrap(err, "Could not create zmq Context") - } - - var sg SocketGroup - sg.ShellSocket, err = context.NewSocket(zmq.ROUTER) - if err != nil { - return context, sg, errors.Wrap(err, "Could not get Shell Socket") - } - - sg.ControlSocket, err = context.NewSocket(zmq.ROUTER) - if err != nil { - return context, sg, errors.Wrap(err, "Could not get Control Socket") - } - - sg.StdinSocket, err = context.NewSocket(zmq.ROUTER) - if err != nil { - return context, sg, errors.Wrap(err, "Could not get Stdin Socket") - } - - sg.IOPubSocket, err = context.NewSocket(zmq.PUB) - if err != nil { - return context, sg, errors.Wrap(err, "Could not get IOPub Socket") - } - - return context, sg, nil -} - -// HandleShellMsg responds to a message on the shell ROUTER socket. -func HandleShellMsg(receipt MsgReceipt) { - switch receipt.Msg.Header.MsgType { - case "kernel_info_request": - SendKernelInfo(receipt) - case "execute_request": - HandleExecuteRequest(receipt) - case "shutdown_request": - HandleShutdownRequest(receipt) - default: - logger.Println("Unhandled shell message:", receipt.Msg.Header.MsgType) - } -} - -// KernelInfo holds information about the igo kernel, for kernel_info_reply messages. -type KernelInfo struct { - ProtocolVersion []int `json:"protocol_version"` - Language string `json:"language"` -} - -// KernelStatus holds a kernel state, for status broadcast messages. -type KernelStatus struct { - ExecutionState string `json:"execution_state"` -} - -// SendKernelInfo sends a kernel_info_reply message. -func SendKernelInfo(receipt MsgReceipt) { - reply := NewMsg("kernel_info_reply", receipt.Msg) - reply.Content = KernelInfo{[]int{4, 0}, "go"} - receipt.SendResponse(receipt.Sockets.ShellSocket, reply) -} - -// ShutdownReply encodes a boolean indication of stutdown/restart -type ShutdownReply struct { - Restart bool `json:"restart"` -} - -// HandleShutdownRequest sends a "shutdown" message -func HandleShutdownRequest(receipt MsgReceipt) { - reply := NewMsg("shutdown_reply", receipt.Msg) - content := receipt.Msg.Content.(map[string]interface{}) - restart := content["restart"].(bool) - reply.Content = ShutdownReply{restart} - receipt.SendResponse(receipt.Sockets.ShellSocket, reply) - logger.Println("Shutting down in response to shutdown_request") - os.Exit(0) -} - -// RunKernel is the main entry point to start the kernel. -func RunKernel(connectionFile string, logwriter io.Writer) { - - logger = log.New(logwriter, "gophernotes ", log.LstdFlags) - - // Set up the "Session" with the replpkg. - SetupExecutionEnvironment() - - var connInfo ConnectionInfo - bs, err := ioutil.ReadFile(connectionFile) - if err != nil { - log.Fatalln(err) - } - if err = json.Unmarshal(bs, &connInfo); err != nil { - log.Fatalln(err) - } - logger.Printf("%+v\n", connInfo) - - // Set up the ZMQ sockets through which the kernel will communicate. - sockets, err := PrepareSockets(connInfo) - if err != nil { - log.Fatalln(err) - } - - pi := zmq.PollItems{ - zmq.PollItem{Socket: sockets.ShellSocket, Events: zmq.POLLIN}, - zmq.PollItem{Socket: sockets.StdinSocket, Events: zmq.POLLIN}, - zmq.PollItem{Socket: sockets.ControlSocket, Events: zmq.POLLIN}, - } - - // Start a message receiving loop. - var msgparts [][]byte - for { - if _, err = zmq.Poll(pi, -1); err != nil { - log.Fatalln(err) - } - switch { - case pi[0].REvents&zmq.POLLIN != 0: // shell socket - msgparts, _ = pi[0].Socket.RecvMultipart(0) - msg, ids, err := WireMsgToComposedMsg(msgparts, sockets.Key) - if err != nil { - log.Println(err) - return - } - HandleShellMsg(MsgReceipt{msg, ids, sockets}) - case pi[1].REvents&zmq.POLLIN != 0: // stdin socket - not implemented. - pi[1].Socket.RecvMultipart(0) - case pi[2].REvents&zmq.POLLIN != 0: // control socket - treat like shell socket. - msgparts, err = pi[2].Socket.RecvMultipart(0) - if err != nil { - log.Println(err) - return - } - msg, ids, err := WireMsgToComposedMsg(msgparts, sockets.Key) - if err != nil { - log.Println(err) - return - } - HandleShellMsg(MsgReceipt{msg, ids, sockets}) - } - } -} diff --git a/gophernotes_test.go b/gophernotes_test.go deleted file mode 100644 index 36d302f..0000000 --- a/gophernotes_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package main - -import ( - "testing" - - repl "github.com/gopherds/gophernotes/internal/repl" - "github.com/stretchr/testify/assert" -) - -// noError is a helper function for testing -func noError(t *testing.T, err error) { - if err != nil { - t.Fatal(err) - } -} - -// TestStub is a canary test to make sure testing and testify are good to go -func TestStub(t *testing.T) { - assert.True(t, true, "This is good. Canary test passing") -} - -// TestRun_import tests importing and use of a package -func TestRun_import(t *testing.T) { - s, err := repl.NewSession() - noError(t, err) - - codes := []string{ - ":import encoding/json", - "b, err := json.Marshal(nil)", - "string(b)", - } - - for _, code := range codes { - _, _, err := s.Eval(code) - noError(t, err) - } -} - -// TestRun_QuickFix_evaluated_but_not_used makes sure errors are not thrown for -// evaluations of variables that aren't used -func TestRun_QuickFix_evaluated_but_not_used(t *testing.T) { - s, err := repl.NewSession() - noError(t, err) - - codes := []string{ - `[]byte("")`, - `make([]int, 0)`, - `1+1`, - `func() {}`, - `(4 & (1 << 1))`, - `1`, - } - - for _, code := range codes { - _, _, err := s.Eval(code) - noError(t, err) - } -} - -// TestRun_QuickFix_used_as_value tests assignment of values to variables -// and subsequent use -func TestRun_QuickFix_used_as_value(t *testing.T) { - s, err := repl.NewSession() - noError(t, err) - - codes := []string{ - `:import log`, - `a := 1`, - `log.SetPrefix("")`, - } - - for _, code := range codes { - _, _, err := s.Eval(code) - noError(t, err) - } -} - -// TestRun_Copy tests a copy within the replpkg -func TestRun_Copy(t *testing.T) { - s, err := repl.NewSession() - noError(t, err) - - codes := []string{ - `a := []string{"hello", "world"}`, - `b := []string{"goodbye", "world"}`, - `copy(a, b)`, - `if (a[0] != "goodbye") { - panic("should be copied") - }`, - } - - for _, code := range codes { - _, _, err := s.Eval(code) - noError(t, err) - } -} - -// TestRun_Const tests a constant within the replpkg -func TestRun_Const(t *testing.T) { - s, err := repl.NewSession() - noError(t, err) - - codes := []string{ - `const ( a = iota; b )`, - `a`, - `b`, - } - - for _, code := range codes { - _, _, err := s.Eval(code) - noError(t, err) - } -} diff --git a/internal/repl/commands.go b/internal/repl/commands.go deleted file mode 100644 index 79c2413..0000000 --- a/internal/repl/commands.go +++ /dev/null @@ -1,375 +0,0 @@ -package replpkg - -import ( - "fmt" - "io/ioutil" - "os" - "os/exec" - "path" - "path/filepath" - "runtime" - "strings" - "text/tabwriter" - "time" - - "go/ast" - "go/build" - "go/importer" - "go/types" - - "golang.org/x/tools/go/ast/astutil" -) - -type command struct { - name string - action func(*Session, string) (string, error) - complete func(*Session, string) []string - arg string - document string -} - -// TODO -// - :edit -// - :undo -// - :reset -// - :type -var commands []command - -func init() { - commands = []command{ - { - name: "import", - action: actionImport, - complete: completeImport, - arg: "", - document: "import a package", - }, - { - name: "print", - action: actionPrint, - document: "print current source", - }, - { - name: "write", - action: actionWrite, - complete: nil, // TODO implement - arg: "[]", - document: "write out current source", - }, - { - name: "help", - action: actionHelp, - document: "show this help", - }, - { - name: "quit", - action: actionQuit, - document: "quit the session", - }, - { - name: "containerize", - action: actionContainerize, - document: "containerize go binary", - }, - } -} - -func actionImport(s *Session, arg string) (string, error) { - if arg == "" { - return "", fmt.Errorf("arg required") - } - - path := strings.Trim(arg, `"`) - - // check if the package specified by path is importable - _, err := importer.Default().Import(path) - if err != nil { - return "", err - } - - astutil.AddImport(s.Fset, s.File, path) - - return "", nil -} - -var gorootSrc = filepath.Join(filepath.Clean(runtime.GOROOT()), "src") - -func completeImport(s *Session, prefix string) []string { - result := []string{} - seen := map[string]bool{} - - d, fn := path.Split(prefix) - for _, srcDir := range build.Default.SrcDirs() { - dir := filepath.Join(srcDir, d) - - if fi, err := os.Stat(dir); err != nil || !fi.IsDir() { - if err != nil && !os.IsNotExist(err) { - errorf("Stat %s: %s", dir, err.Error()) - } - continue - } - - entries, err := ioutil.ReadDir(dir) - if err != nil { - errorf("ReadDir %s: %s", dir, err.Error()) - continue - } - for _, fi := range entries { - if !fi.IsDir() { - continue - } - - name := fi.Name() - if strings.HasPrefix(name, ".") || strings.HasPrefix(name, "_") || name == "testdata" { - continue - } - - if strings.HasPrefix(name, fn) { - r := path.Join(d, name) - if srcDir != gorootSrc { - // append "/" if this directory is not a repository - // e.g. does not have VCS directory such as .git or .hg - // TODO: do not append "/" to subdirectories of repos - var isRepo bool - for _, vcsDir := range []string{".git", ".hg", ".svn", ".bzr"} { - _, err := os.Stat(filepath.Join(srcDir, filepath.FromSlash(r), vcsDir)) - if err == nil { - isRepo = true - break - } - } - if !isRepo { - r = r + "/" - } - } - - if !seen[r] { - result = append(result, r) - seen[r] = true - } - } - } - } - - return result -} - -func actionPrint(s *Session, _ string) (string, error) { - source, err := s.source(true) - - if err == nil { - fmt.Println(source) - } - - return source, err -} - -func actionWrite(s *Session, filename string) (string, error) { - source, err := s.source(false) - if err != nil { - return "", err - } - - if filename == "" { - filename = fmt.Sprintf("gore_session_%s.go", time.Now().Format("20060102_150405")) - } - - err = ioutil.WriteFile(filename, []byte(source), 0644) - if err != nil { - return "", err - } - - infof("Source wrote to %s", filename) - - return "", nil -} - -func actionDoc(s *Session, in string) (string, error) { - s.clearQuickFix() - - s.storeMainBody() - defer s.restoreMainBody() - - expr, err := s.evalExpr(in) - if err != nil { - return "", err - } - - s.TypeInfo = types.Info{ - Types: make(map[ast.Expr]types.TypeAndValue), - Uses: make(map[*ast.Ident]types.Object), - Defs: make(map[*ast.Ident]types.Object), - Scopes: make(map[ast.Node]*types.Scope), - } - _, err = s.Types.Check("_tmp", s.Fset, []*ast.File{s.File}, &s.TypeInfo) - if err != nil { - debugf("typecheck error (ignored): %s", err) - } - - // :doc patterns: - // - "json" -> "encoding/json" (package name) - // - "json.Encoder" -> "encoding/json", "Encoder" (package member) - // - "json.NewEncoder(nil).Encode" -> "encoding/json", "Decode" (package type member) - var docObj types.Object - if sel, ok := expr.(*ast.SelectorExpr); ok { - // package member, package type member - docObj = s.TypeInfo.ObjectOf(sel.Sel) - } else if t := s.TypeInfo.TypeOf(expr); t != nil && t != types.Typ[types.Invalid] { - for { - if pt, ok := t.(*types.Pointer); ok { - t = pt.Elem() - } else { - break - } - } - switch t := t.(type) { - case *types.Named: - docObj = t.Obj() - case *types.Basic: - // builtin types - docObj = types.Universe.Lookup(t.Name()) - } - } else if ident, ok := expr.(*ast.Ident); ok { - // package name - mainScope := s.TypeInfo.Scopes[s.mainFunc().Type] - _, docObj = mainScope.LookupParent(ident.Name, ident.NamePos) - } - - if docObj == nil { - return "", fmt.Errorf("cannot determine the document location") - } - - debugf("doc :: obj=%#v", docObj) - - var pkgPath, objName string - if pkgName, ok := docObj.(*types.PkgName); ok { - pkgPath = pkgName.Imported().Path() - } else { - if pkg := docObj.Pkg(); pkg != nil { - pkgPath = pkg.Path() - } else { - pkgPath = "builtin" - } - objName = docObj.Name() - } - - debugf("doc :: %q %q", pkgPath, objName) - - args := []string{pkgPath} - if objName != "" { - args = append(args, objName) - } - - godoc := exec.Command("godoc", args...) - godoc.Stderr = os.Stderr - - // TODO just use PAGER? - if pagerCmd := os.Getenv("GORE_PAGER"); pagerCmd != "" { - r, err := godoc.StdoutPipe() - if err != nil { - return "", err - } - - pager := exec.Command(pagerCmd) - pager.Stdin = r - pager.Stdout = os.Stdout - pager.Stderr = os.Stderr - - err = pager.Start() - if err != nil { - return "", err - } - - err = godoc.Run() - if err != nil { - return "", err - } - - return "", pager.Wait() - } - - godoc.Stdout = os.Stdout - return "", godoc.Run() - -} - -func actionHelp(s *Session, _ string) (string, error) { - w := tabwriter.NewWriter(os.Stdout, 0, 8, 4, ' ', 0) - for _, command := range commands { - cmd := ":" + command.name - if command.arg != "" { - cmd = cmd + " " + command.arg - } - w.Write([]byte(" " + cmd + "\t" + command.document + "\n")) - } - w.Flush() - - return "", nil -} - -func actionQuit(s *Session, _ string) (string, error) { - return "", ErrQuit -} - -func actionContainerize(s *Session, _ string) (string, error) { - - // get the source code - source, err := s.source(true) - if err != nil { - return "", err - } - - // create tmp directory in GOPATH - gopath := os.Getenv("GOPATH") - os.Mkdir(gopath+"/src/tmpcontainerize", 0777) - - d := []byte(source) - err = ioutil.WriteFile(gopath+"/src/tmpcontainerize/containerize.go", d, 0777) - if err != nil { - return "", err - } - - cmd := exec.Command("go", "install", "tmpcontainerize") - err = cmd.Run() - if err != nil { - panic(err) - } - - // dockerize - dockerfile := ` - FROM scratch - ADD tmpcontainerize /tmpcontainerize - CMD ["/tmpcontainerize"] - ` - d = []byte(dockerfile) - err = ioutil.WriteFile(gopath+"/bin/Dockerfile", d, 0777) - - out, err := exec.Command("uuidgen").Output() - containerid := string(out) - containerid = containerid[0 : len(containerid)-1] - if err != nil { - return "", err - } - - fmt.Println("Dockerizing") - cmd = exec.Command("docker", "build", "-t", containerid, gopath+"/bin/") - err = cmd.Run() - if err != nil { - fmt.Println(err) - panic(err) - } - - fmt.Println("removing src") - // now that we have the binary, remove the tmp src - err = os.RemoveAll(gopath + "/src/tmpcontainerize/") - if err != nil { - return "", err - } - fmt.Println("removing docker image") - err = os.Remove(gopath + "/bin/Dockerfile") - if err != nil { - return "", err - } - - return "", nil -} diff --git a/internal/repl/log.go b/internal/repl/log.go deleted file mode 100644 index aa05a0b..0000000 --- a/internal/repl/log.go +++ /dev/null @@ -1,32 +0,0 @@ -package replpkg - -import ( - "fmt" - "os" - "path/filepath" - "runtime" -) - -var debug bool - -func debugf(format string, args ...interface{}) { - - if !debug { - return - } - - _, file, line, ok := runtime.Caller(1) - if ok { - format = fmt.Sprintf("%s:%d %s", filepath.Base(file), line, format) - } - - fmt.Fprintf(os.Stderr, format+"\n", args...) -} - -func errorf(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, "error: "+format+"\n", args...) -} - -func infof(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, format+"\n", args...) -} diff --git a/internal/repl/node.go b/internal/repl/node.go deleted file mode 100644 index 7b4359d..0000000 --- a/internal/repl/node.go +++ /dev/null @@ -1,41 +0,0 @@ -package replpkg - -import ( - "reflect" - - "go/ast" - "go/token" -) - -// normalizeNodePos resets all position information of node and its descendants. -func normalizeNodePos(node ast.Node) { - ast.Inspect(node, func(node ast.Node) bool { - if node == nil { - return true - } - - if node.Pos() == token.NoPos && node.End() == token.NoPos { - return true - } - - pv := reflect.ValueOf(node) - if pv.Kind() != reflect.Ptr { - return true - } - - v := pv.Elem() - if v.Kind() != reflect.Struct { - return true - } - - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - ft := f.Type() - if f.CanSet() && ft.PkgPath() == "go/token" && ft.Name() == "Pos" && f.Int() != 0 { - f.SetInt(1) - } - } - - return true - }) -} diff --git a/internal/repl/quickfix.go b/internal/repl/quickfix.go deleted file mode 100644 index 2e4998e..0000000 --- a/internal/repl/quickfix.go +++ /dev/null @@ -1,276 +0,0 @@ -package replpkg - -import ( - "strings" - - "go/ast" - "go/types" - - "golang.org/x/tools/go/ast/astutil" - - "github.com/motemen/go-quickfix" -) - -// doQuickFix tries to fix the source AST so that it compiles well. -func (s *Session) doQuickFix() error { - const maxAttempts = 10 - - s.reset() - -quickFixAttempt: - for i := 0; i < maxAttempts; i++ { - s.TypeInfo = types.Info{ - Types: make(map[ast.Expr]types.TypeAndValue), - } - - files := s.ExtraFiles - files = append(files, s.File) - - config := quickfix.Config{ - Fset: s.Fset, - Files: files, - TypeInfo: &s.TypeInfo, - } - _, err := config.QuickFixOnce() - if err == nil { - break - } - - debugf("quickFix :: err = %#v", err) - - errList, ok := err.(quickfix.ErrorList) - if !ok { - continue - } - - // (try to) fix gore-specific remaining errors - for _, err := range errList { - err, ok := err.(types.Error) - if !ok { - continue - } - - // "... used as value": - // - // convert - // __gore_pp(funcWithSideEffectReturningNoValue()) - // to - // funcWithSideEffectReturningNoValue() - if strings.HasSuffix(err.Msg, " used as value") { - nodepath, _ := astutil.PathEnclosingInterval(s.File, err.Pos, err.Pos) - - for _, node := range nodepath { - stmt, ok := node.(ast.Stmt) - if !ok { - continue - } - - for i := range s.mainBody.List { - if s.mainBody.List[i] != stmt { - continue - } - - exprs := printedExprs(stmt) - - stmts := s.mainBody.List[0:i] - for _, expr := range exprs { - stmts = append(stmts, &ast.ExprStmt{X: expr}) - } - - s.mainBody.List = append(stmts, s.mainBody.List[i+1:]...) - continue quickFixAttempt - } - } - } - } - - debugf("quickFix :: give up: %#v", err) - } - - return nil -} - -func (s *Session) clearQuickFix() { - - // make all import specs explicit (i.e. no "_"). - for _, imp := range s.File.Imports { - imp.Name = nil - } - - for i := 0; i < len(s.mainBody.List); { - stmt := s.mainBody.List[i] - - // remove "_ = x" stmt - if assign, ok := stmt.(*ast.AssignStmt); ok && len(assign.Lhs) == 1 { - if isNamedIdent(assign.Lhs[0], "_") { - s.mainBody.List = append(s.mainBody.List[0:i], s.mainBody.List[i+1:]...) - continue - } - } - - // remove expressions just for printing out - // i.e. what causes "evaluated but not used." - if exprs := printedExprs(stmt); exprs != nil { - allPure := true - for _, expr := range exprs { - if !s.isPureExpr(expr) { - allPure = false - break - } - } - - if allPure { - s.mainBody.List = append(s.mainBody.List[0:i], s.mainBody.List[i+1:]...) - continue - } - - // strip (possibly impure) printing expression to expression - var trailing []ast.Stmt - s.mainBody.List, trailing = s.mainBody.List[0:i], s.mainBody.List[i+1:] - for _, expr := range exprs { - if !isNamedIdent(expr, "_") { - s.mainBody.List = append(s.mainBody.List, &ast.ExprStmt{X: expr}) - } - } - - s.mainBody.List = append(s.mainBody.List, trailing...) - continue - } - - i++ - } - - debugf("clearQuickFix :: %s", showNode(s.Fset, s.mainBody)) -} - -// printedExprs returns arguments of statement stmt of form "p(x...)" -func printedExprs(stmt ast.Stmt) []ast.Expr { - st, ok := stmt.(*ast.ExprStmt) - if !ok { - return nil - } - - // first check whether the expr is p(_) form - call, ok := st.X.(*ast.CallExpr) - if !ok { - return nil - } - - if !isNamedIdent(call.Fun, printerName) { - return nil - } - - return call.Args -} - -var pureBuiltinFuncNames = map[string]bool{ - "append": true, - "cap": true, - "complex": true, - "imag": true, - "len": true, - "make": true, - "new": true, - "real": true, -} - -var pureNotBuiltinFuncNames = map[string]bool{ - "Println": true, - "Printf": true, -} - -// isPureExpr checks if an expression expr is "pure", which means -// removing this expression will no affect the entire program. -// - identifiers ("x") -// - types -// - selectors ("x.y") -// - slices ("a[n:m]") -// - literals ("1") -// - type conversion ("int(1)") -// - type assertion ("x.(int)") -// - call of some built-in functions as listed in pureBuiltinFuncNames -func (s *Session) isPureExpr(expr ast.Expr) bool { - if expr == nil { - return true - } - - switch expr := expr.(type) { - case *ast.Ident: - return true - case *ast.BasicLit: - return true - case *ast.BinaryExpr: - return s.isPureExpr(expr.X) && s.isPureExpr(expr.Y) - case *ast.CallExpr: - tv := s.TypeInfo.Types[expr.Fun] - - //for _, arg := range expr.Args { - // if s.isPureExpr(arg) == false { - // return false - // } - //} - - if tv.IsType() { - return true - } - - if tv.IsBuiltin() { - if ident, ok := expr.Fun.(*ast.Ident); ok { - if pureBuiltinFuncNames[ident.Name] { - return true - } - } - } - - if !tv.IsBuiltin() { - if selectorExpr, ok := expr.Fun.(*ast.SelectorExpr); ok { - if pureNotBuiltinFuncNames[selectorExpr.Sel.Name] { - return true - } - } - } - - return false - case *ast.CompositeLit: - return true - case *ast.FuncLit: - return true - case *ast.IndexExpr: - return s.isPureExpr(expr.X) && s.isPureExpr(expr.Index) - case *ast.SelectorExpr: - return s.isPureExpr(expr.X) - case *ast.SliceExpr: - return s.isPureExpr(expr.Low) && s.isPureExpr(expr.High) && s.isPureExpr(expr.Max) - case *ast.StarExpr: - return s.isPureExpr(expr.X) - case *ast.TypeAssertExpr: - return true - case *ast.UnaryExpr: - return s.isPureExpr(expr.X) - case *ast.ParenExpr: - return s.isPureExpr(expr.X) - - case *ast.InterfaceType: - return true - case *ast.ArrayType: - return true - case *ast.ChanType: - return true - case *ast.KeyValueExpr: - return true - case *ast.MapType: - return true - case *ast.StructType: - return true - case *ast.FuncType: - return true - - case *ast.Ellipsis: - return true - - case *ast.BadExpr: - return false - } - - return false -} diff --git a/internal/repl/repl.go b/internal/repl/repl.go deleted file mode 100644 index b567193..0000000 --- a/internal/repl/repl.go +++ /dev/null @@ -1,654 +0,0 @@ -package replpkg - -import ( - "bytes" - "errors" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - "syscall" - - "go/ast" - "go/build" - "go/importer" - "go/parser" - "go/printer" - "go/scanner" - "go/token" - "go/types" - - // Importing this package installs Import as go/types.DefaultImport. - "golang.org/x/tools/imports" - - "github.com/motemen/go-quickfix" -) - -const printerName = "__gophernotes" - -// Session encodes info about the current REPL session. -type Session struct { - FilePath string - File *ast.File - Fset *token.FileSet - Types *types.Config - TypeInfo types.Info - ExtraFilePaths []string - ExtraFiles []*ast.File - - mainBody *ast.BlockStmt - storedBodyLength int -} - -const initialSourceTemplate = ` -package main - -import %q - -func ` + printerName + `(xx ...interface{}) { - for _, x := range xx { - %s - } -} - -func main() { -} -` - -// printerPkgs is a list of packages that provides -// pretty printing function. -var printerPkgs = []struct { - path string - code string -}{ - {"github.com/k0kubun/pp", `pp.Println(x)`}, - {"github.com/davecgh/go-spew/spew", `spew.Printf("%#v\n", x)`}, - {"fmt", `fmt.Printf("%#v\n", x)`}, -} - -// NewSession initiates a new REPL -func NewSession() (*Session, error) { - - s := &Session{ - Fset: token.NewFileSet(), - Types: &types.Config{ - Importer: importer.Default(), - }, - } - - var err error - s.FilePath, err = tempFile() - if err != nil { - return nil, err - } - - var initialSource string - for _, pp := range printerPkgs { - _, err := importer.Default().Import(pp.path) - if err == nil { - initialSource = fmt.Sprintf(initialSourceTemplate, pp.path, pp.code) - break - } - debugf("could not import %q: %s", pp.path, err) - } - if initialSource == "" { - return nil, fmt.Errorf("Could not load pretty printing package") - } - - s.File, err = parser.ParseFile(s.Fset, "gophernotes_session.go", initialSource, parser.Mode(0)) - if err != nil { - return nil, err - } - - s.mainBody = s.mainFunc().Body - - return s, nil -} - -func (s *Session) mainFunc() *ast.FuncDecl { - return s.File.Scope.Lookup("main").Decl.(*ast.FuncDecl) -} - -// Run calls "go run" with appropriate files appended. -func (s *Session) Run() ([]byte, bytes.Buffer, error) { - f, err := os.Create(s.FilePath) - if err != nil { - return nil, bytes.Buffer{}, err - } - - err = printer.Fprint(f, s.Fset, s.File) - if err != nil { - return nil, bytes.Buffer{}, err - } - - return goRun(append(s.ExtraFilePaths, s.FilePath)) -} - -// tempFile prepares the temporary session file for the REPL. -func tempFile() (string, error) { - dir, err := ioutil.TempDir("", "") - if err != nil { - return "", err - } - - err = os.MkdirAll(dir, 0755) - if err != nil { - return "", err - } - - return filepath.Join(dir, "gophernotes_session.go"), nil -} - -func goRun(files []string) ([]byte, bytes.Buffer, error) { - - var stderr bytes.Buffer - - args := append([]string{"run"}, files...) - debugf("go %s", strings.Join(args, " ")) - cmd := exec.Command("go", args...) - cmd.Stdin = os.Stdin - cmd.Stderr = &stderr - out, err := cmd.Output() - return out, stderr, err -} - -func (s *Session) evalExpr(in string) (ast.Expr, error) { - expr, err := parser.ParseExpr(in) - if err != nil { - return nil, err - } - - stmt := &ast.ExprStmt{ - X: &ast.CallExpr{ - Fun: ast.NewIdent(printerName), - Args: []ast.Expr{expr}, - }, - } - - s.appendStatements(stmt) - - return expr, nil -} - -func isNamedIdent(expr ast.Expr, name string) bool { - ident, ok := expr.(*ast.Ident) - return ok && ident.Name == name -} - -func (s *Session) evalStmt(in string, noPrint bool) error { - src := fmt.Sprintf("package P; func F() { %s }", in) - f, err := parser.ParseFile(s.Fset, "stmt.go", src, parser.Mode(0)) - if err != nil { - debugf("stmt :: err = %s", err) - - // try to import this as a proxy function and correct for any imports - appendForImport := `package main - - - ` - - f, err := os.Create(string(filepath.Dir(s.FilePath)) + "/func_proxy.go") - if err != nil { - return err - } - - _, err = f.Write([]byte(appendForImport + in)) - if err != nil { - return err - } - f.Close() - - b := new(bytes.Buffer) - cmd := exec.Command("goimports", "-w", string(filepath.Dir(s.FilePath))+"/func_proxy.go") - cmd.Stdout = b - cmd.Stderr = b - err = cmd.Run() - if err != nil { - err = errors.New(b.String()) - return err - } - - functproxy, err := ioutil.ReadFile(string(filepath.Dir(s.FilePath)) + "/func_proxy.go") - if err != nil { - return err - } - - if err = s.importFile(functproxy); err != nil { - errorf("%s", err.Error()) - if _, ok := err.(scanner.ErrorList); ok { - return ErrContinue - } - } - - } - - enclosingFunc := f.Scope.Lookup("F").Decl.(*ast.FuncDecl) - stmts := enclosingFunc.Body.List - - if len(stmts) > 0 { - - debugf("evalStmt :: %s", showNode(s.Fset, stmts)) - lastStmt := stmts[len(stmts)-1] - - // print last assigned/defined values - if !noPrint { - if assign, ok := lastStmt.(*ast.AssignStmt); ok { - vs := []ast.Expr{} - for _, v := range assign.Lhs { - if !isNamedIdent(v, "_") { - vs = append(vs, v) - } - } - if len(vs) > 0 { - printLastValues := &ast.ExprStmt{ - X: &ast.CallExpr{ - Fun: ast.NewIdent(printerName), - Args: vs, - }, - } - stmts = append(stmts, printLastValues) - } - } - } - } - - s.appendStatements(stmts...) - - return nil -} - -func (s *Session) appendStatements(stmts ...ast.Stmt) { - s.mainBody.List = append(s.mainBody.List, stmts...) -} - -// Error is an exported error. -type Error string - -// ErrContinue and ErrQuit are specific exported error types. -const ( - ErrContinue Error = "" - ErrQuit Error = "" -) - -func (e Error) Error() string { - return string(e) -} - -func (s *Session) source(space bool) (string, error) { - normalizeNodePos(s.mainFunc()) - - var config *printer.Config - if space { - config = &printer.Config{ - Mode: printer.UseSpaces, - Tabwidth: 4, - } - } else { - config = &printer.Config{ - Tabwidth: 8, - } - } - - var buf bytes.Buffer - err := config.Fprint(&buf, s.Fset, s.File) - return buf.String(), err -} - -func (s *Session) reset() error { - source, err := s.source(false) - if err != nil { - return err - } - - file, err := parser.ParseFile(s.Fset, "gophernotes_session.go", source, parser.Mode(0)) - if err != nil { - return err - } - - s.File = file - s.mainBody = s.mainFunc().Body - - return nil -} - -// Eval handles the evaluation of code parsed from received messages -func (s *Session) Eval(in string) (string, bytes.Buffer, error) { - debugf("eval >>> %q", in) - - s.clearQuickFix() - s.storeMainBody() - - // Split the lines of the input to check for special commands. - inLines := strings.Split(in, "\n") - var nonImportLines []string - for idx, line := range inLines { - - // Extract non-special lines. - trimLine := strings.TrimSpace(line) - if !strings.HasPrefix(line, "import") && !strings.HasPrefix(line, ":") && !strings.HasPrefix(trimLine, "\"") && !strings.HasPrefix(line, ")") { - nonImportLines = append(nonImportLines, line) - continue - } - - // Process special commands. - var args []string - for _, command := range commands { - - // Clear the args. - args = []string{} - - // Extract any argument provided with the special command. - arg := strings.TrimPrefix(line, ":"+command.name) - if command.name == "import" { - arg = strings.TrimPrefix(arg, "import") - } - switch { - case arg == line: - continue - case strings.HasPrefix(strings.TrimSpace(arg), "("): - advance := 1 - currentLine := inLines[idx+advance] - for !strings.Contains(currentLine, ")") { - args = append(args, currentLine) - advance++ - currentLine = inLines[idx+advance] - } - default: - args = append(args, arg) - } - - // Apply the action associated with the special command. - for _, arg = range args { - if arg == "" || strings.HasPrefix(arg, " ") { - arg = strings.TrimSpace(arg) - _, err := command.action(s, arg) - if err != nil { - if err == ErrQuit { - return "", bytes.Buffer{}, err - } - errorf("%s: %s", command.name, err.Error()) - } - } - } - } - } - - // Join the non-special lines back together for evaluation. - in = strings.Join(nonImportLines, "\n") - if len(in) == 0 { - s.doQuickFix() - return "", bytes.Buffer{}, nil - } - - // Extract statements. - priorListLength := len(s.mainBody.List) - if err := s.separateEvalStmt(in); err != nil { - return "", *bytes.NewBuffer([]byte(err.Error())), err - } - - s.doQuickFix() - - output, stderr, runErr := s.Run() - if runErr != nil || stderr.String() != "" { - if exitErr, ok := runErr.(*exec.ExitError); ok { - // if failed with status 2, remove the last statement - if st, ok := exitErr.ProcessState.Sys().(syscall.WaitStatus); ok { - if st.ExitStatus() == 2 { - debugf("got exit status 2, popping out last input") - s.restoreMainBody() - runErr = nil - } - } - } - } - - // Cleanup the session file. - s.mainBody.List = s.mainBody.List[0:priorListLength] - if err := s.cleanEvalStmt(in); err != nil { - return string(output), stderr, err - } - f, err := os.Create(s.FilePath) - if err != nil { - return string(output), stderr, err - } - err = printer.Fprint(f, s.Fset, s.File) - if err != nil { - return string(output), stderr, err - } - - // Catch any unexpected stderr. - if stderr.String() != "" { - runErr = errors.New("Unexpected stderr from execution") - } - - return string(output), stderr, runErr -} - -// separateEvalStmt separates what can be evaluated via evalExpr from what cannot. -func (s *Session) separateEvalStmt(in string) error { - var stmtLines []string - var exprCount int - var bracketCount int - - inLines := strings.Split(in, "\n") - - for _, line := range inLines { - - if bracketCount == 0 && len(stmtLines) == 0 { - _, err := s.evalExpr(line) - if err != nil { - if strings.LastIndex(line, "{") == len(line)-1 { - bracketCount++ - } - } - if err == nil { - continue - } - } - - if strings.LastIndex(line, "}") == len(line)-1 { - if !strings.HasSuffix(line, "{}") { - bracketCount-- - } - } - if strings.LastIndex(line, "{") == len(line)-1 { - bracketCount++ - } - stmtLines = append(stmtLines, line) - - if bracketCount == 0 && len(stmtLines) > 0 { - - if err := s.evalStmt(strings.Join(stmtLines, "\n"), true); err != nil { - return err - } - stmtLines = []string{} - continue - } - - exprCount++ - } - - if len(stmtLines) > 0 { - var noPrint bool - if exprCount > 0 { - noPrint = true - } - if err := s.evalStmt(strings.Join(stmtLines, "\n"), noPrint); err != nil { - return err - } - } - - return nil -} - -// cleanEvalStmt cleans up prior print statements etc. -func (s *Session) cleanEvalStmt(in string) error { - var stmtLines []string - - inLines := strings.Split(in, "\n") - - for _, line := range inLines { - - beforeLines := len(s.mainBody.List) - if expr, err := s.evalExpr(line); err == nil { - if !s.isPureExpr(expr) { - s.mainBody.List = s.mainBody.List[0:beforeLines] - stmtLines = append(stmtLines, line) - } - continue - } - stmtLines = append(stmtLines, line) - } - - if len(stmtLines) != 0 { - if err := s.evalStmt(strings.Join(stmtLines, "\n"), true); err != nil { - return err - } - } - - return nil -} - -// storeMainBody stores current state of code so that it can be restored -// actually it saves the length of statements inside main() -func (s *Session) storeMainBody() { - s.storedBodyLength = len(s.mainBody.List) -} - -func (s *Session) restoreMainBody() { - s.mainBody.List = s.mainBody.List[0:s.storedBodyLength] -} - -// includeFiles imports packages and funcsions from multiple golang source -func (s *Session) includeFiles(files []string) { - for _, file := range files { - s.includeFile(file) - } -} - -func (s *Session) includeFile(file string) { - content, err := ioutil.ReadFile(file) - if err != nil { - errorf("%s", err.Error()) - return - } - - if err = s.importPackages(content); err != nil { - errorf("%s", err.Error()) - return - } - - if err = s.importFile(content); err != nil { - errorf("%s", err.Error()) - } - - infof("added file %s", file) -} - -// importPackages includes packages defined on external file into main file -func (s *Session) importPackages(src []byte) error { - astf, err := parser.ParseFile(s.Fset, "", src, parser.Mode(0)) - if err != nil { - return err - } - - for _, imt := range astf.Imports { - debugf("import package: %s", imt.Path.Value) - actionImport(s, imt.Path.Value) - } - - return nil -} - -// importFile adds external golang file to goRun target to use its function -func (s *Session) importFile(src []byte) error { - // Don't need to same directory - tmp, err := ioutil.TempFile(filepath.Dir(s.FilePath), "gore_extarnal_") - if err != nil { - return err - } - - ext := tmp.Name() + ".go" - - f, err := parser.ParseFile(s.Fset, ext, src, parser.Mode(0)) - if err != nil { - return err - } - - // rewrite to package main - f.Name.Name = "main" - - // remove func main() - for i, decl := range f.Decls { - if funcDecl, ok := decl.(*ast.FuncDecl); ok { - if isNamedIdent(funcDecl.Name, "main") { - f.Decls = append(f.Decls[0:i], f.Decls[i+1:]...) - // main() removed from this file, we may have to - // remove some unsed import's - quickfix.QuickFix(s.Fset, []*ast.File{f}) - break - } - } - } - - out, err := os.Create(ext) - if err != nil { - return err - } - defer out.Close() - - err = printer.Fprint(out, s.Fset, f) - if err != nil { - return err - } - - debugf("import file: %s", ext) - s.ExtraFilePaths = append(s.ExtraFilePaths, ext) - s.ExtraFiles = append(s.ExtraFiles, f) - - return nil -} - -// fixImports formats and adjusts imports for the current AST. -func (s *Session) fixImports() error { - - var buf bytes.Buffer - err := printer.Fprint(&buf, s.Fset, s.File) - if err != nil { - return err - } - - formatted, err := imports.Process("", buf.Bytes(), nil) - if err != nil { - return err - } - - s.File, err = parser.ParseFile(s.Fset, "", formatted, parser.Mode(0)) - if err != nil { - return err - } - s.mainBody = s.mainFunc().Body - - return nil -} - -func (s *Session) includePackage(path string) error { - pkg, err := build.Import(path, ".", 0) - if err != nil { - var err2 error - pkg, err2 = build.ImportDir(path, 0) - if err2 != nil { - return err // return package path import error, not directory import error as build.Import can also import directories if "./foo" is specified - } - } - - files := make([]string, len(pkg.GoFiles)) - for i, f := range pkg.GoFiles { - files[i] = filepath.Join(pkg.Dir, f) - } - s.includeFiles(files) - - return nil -} diff --git a/internal/repl/utils.go b/internal/repl/utils.go deleted file mode 100644 index 6b22f4d..0000000 --- a/internal/repl/utils.go +++ /dev/null @@ -1,14 +0,0 @@ -package replpkg - -import ( - "bytes" - - "go/printer" - "go/token" -) - -func showNode(fset *token.FileSet, node interface{}) string { - var buf bytes.Buffer - printer.Fprint(&buf, fset, node) - return buf.String() -} diff --git a/kernel.go b/kernel.go new file mode 100644 index 0000000..5fe6de1 --- /dev/null +++ b/kernel.go @@ -0,0 +1,391 @@ +package main + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "log" + "os" + "runtime" + "strings" + + "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/classic" + zmq "github.com/pebbe/zmq4" +) + +// ExecCounter is incremented each time we run user code in the notebook. +var ExecCounter int + +// ConnectionInfo stores the contents of the kernel connection +// file created by Jupyter. +type ConnectionInfo struct { + SignatureScheme string `json:"signature_scheme"` + Transport string `json:"transport"` + StdinPort int `json:"stdin_port"` + ControlPort int `json:"control_port"` + IOPubPort int `json:"iopub_port"` + HBPort int `json:"hb_port"` + ShellPort int `json:"shell_port"` + Key string `json:"key"` + IP string `json:"ip"` +} + +// SocketGroup holds the sockets needed to communicate with the kernel, +// and the key for message signing. +type SocketGroup struct { + ShellSocket *zmq.Socket + ControlSocket *zmq.Socket + StdinSocket *zmq.Socket + IOPubSocket *zmq.Socket + Key []byte +} + +// KernelLanguageInfo holds information about the language that this kernel executes code in. +type kernelLanguageInfo struct { + Name string `json:"name"` + Version string `json:"version"` + MIMEType string `json:"mimetype"` + FileExtension string `json:"file_extension"` + PygmentsLexer string `json:"pygments_lexer"` + CodeMirrorMode string `json:"codemirror_mode"` + NBConvertExporter string `json:"nbconvert_exporter"` +} + +// HelpLink stores data to be displayed in the help menu of the notebook. +type helpLink struct { + Text string `json:"text"` + URL string `json:"url"` +} + +// KernelInfo holds information about the igo kernel, for kernel_info_reply messages. +type kernelInfo struct { + ProtocolVersion string `json:"protocol_version"` + Implementation string `json:"implementation"` + ImplementationVersion string `json:"implementation_version"` + LanguageInfo kernelLanguageInfo `json:"language_info"` + Banner string `json:"banner"` + HelpLinks []helpLink `json:"help_links"` +} + +// shutdownReply encodes a boolean indication of stutdown/restart. +type shutdownReply struct { + Restart bool `json:"restart"` +} + +const ( + kernelStarting = "starting" + kernelBusy = "busy" + kernelIdle = "idle" +) + +// runKernel is the main entry point to start the kernel. +func runKernel(connectionFile string) { + + // Set up the "Session" with the replpkg. + ir := classic.New() + + // Parse the connection info. + var connInfo ConnectionInfo + + connData, err := ioutil.ReadFile(connectionFile) + if err != nil { + log.Fatal(err) + } + + if err = json.Unmarshal(connData, &connInfo); err != nil { + log.Fatal(err) + } + + // Set up the ZMQ sockets through which the kernel will communicate. + sockets, err := prepareSockets(connInfo) + if err != nil { + log.Fatal(err) + } + + poller := zmq.NewPoller() + poller.Add(sockets.ShellSocket, zmq.POLLIN) + poller.Add(sockets.StdinSocket, zmq.POLLIN) + poller.Add(sockets.ControlSocket, zmq.POLLIN) + + // msgParts will store a received multipart message. + var msgParts [][]byte + + // Start a message receiving loop. + for { + + polled, err := poller.Poll(-1) + if err != nil { + log.Fatal(err) + } + + for _, item := range polled { + + // Handle various types of messages. + switch socket := item.Socket; socket { + + // Handle shell messages. + case sockets.ShellSocket: + msgParts, err = sockets.ShellSocket.RecvMessageBytes(0) + if err != nil { + log.Println(err) + } + + msg, ids, err := WireMsgToComposedMsg(msgParts, sockets.Key) + if err != nil { + log.Println(err) + return + } + + handleShellMsg(ir, msgReceipt{msg, ids, sockets}) + + // TODO Handle stdin socket. + case sockets.StdinSocket: + sockets.StdinSocket.RecvMessageBytes(0) + + // Handle control messages. + case sockets.ControlSocket: + msgParts, err = sockets.ControlSocket.RecvMessageBytes(0) + if err != nil { + log.Println(err) + return + } + + msg, ids, err := WireMsgToComposedMsg(msgParts, sockets.Key) + if err != nil { + log.Println(err) + return + } + + handleShellMsg(ir, msgReceipt{msg, ids, sockets}) + } + } + } +} + +// prepareSockets sets up the ZMQ sockets through which the kernel +// will communicate. +func prepareSockets(connInfo ConnectionInfo) (SocketGroup, error) { + + // Initialize the context. + context, err := zmq.NewContext() + if err != nil { + return SocketGroup{}, err + } + + // Initialize the socket group. + var sg SocketGroup + + sg.ShellSocket, err = context.NewSocket(zmq.ROUTER) + if err != nil { + return sg, err + } + + sg.ControlSocket, err = context.NewSocket(zmq.ROUTER) + if err != nil { + return sg, err + } + + sg.StdinSocket, err = context.NewSocket(zmq.ROUTER) + if err != nil { + return sg, err + } + + sg.IOPubSocket, err = context.NewSocket(zmq.PUB) + if err != nil { + return sg, err + } + + // Bind the sockets. + address := fmt.Sprintf("%v://%v:%%v", connInfo.Transport, connInfo.IP) + sg.ShellSocket.Bind(fmt.Sprintf(address, connInfo.ShellPort)) + sg.ControlSocket.Bind(fmt.Sprintf(address, connInfo.ControlPort)) + sg.StdinSocket.Bind(fmt.Sprintf(address, connInfo.StdinPort)) + sg.IOPubSocket.Bind(fmt.Sprintf(address, connInfo.IOPubPort)) + + // Set the message signing key. + sg.Key = []byte(connInfo.Key) + + return sg, nil +} + +// handleShellMsg responds to a message on the shell ROUTER socket. +func handleShellMsg(ir *classic.Interp, receipt msgReceipt) { + switch receipt.Msg.Header.MsgType { + case "kernel_info_request": + if err := sendKernelInfo(receipt); err != nil { + log.Fatal(err) + } + case "execute_request": + if err := handleExecuteRequest(ir, receipt); err != nil { + log.Fatal(err) + } + case "shutdown_request": + handleShutdownRequest(receipt) + default: + log.Println("Unhandled shell message: ", receipt.Msg.Header.MsgType) + } +} + +// sendKernelInfo sends a kernel_info_reply message. +func sendKernelInfo(receipt msgReceipt) error { + return receipt.Reply("kernel_info_reply", + kernelInfo{ + ProtocolVersion: ProtocolVersion, + Implementation: "gophernotes", + ImplementationVersion: Version, + Banner: fmt.Sprintf("Go kernel: gophernotes - v%s", Version), + LanguageInfo: kernelLanguageInfo{ + Name: "go", + Version: runtime.Version(), + FileExtension: ".go", + }, + HelpLinks: []helpLink{ + {Text: "Go", URL: "https://golang.org/"}, + {Text: "gophernotes", URL: "https://github.com/gopherdata/gophernotes"}, + }, + }, + ) +} + +// handleExecuteRequest runs code from an execute_request method, +// and sends the various reply messages. +func handleExecuteRequest(ir *classic.Interp, receipt msgReceipt) error { + // Extract the data from the request + reqcontent := receipt.Msg.Content.(map[string]interface{}) + code := reqcontent["code"].(string) + in := bufio.NewReader(strings.NewReader(code)) + silent := reqcontent["silent"].(bool) + + if !silent { + ExecCounter++ + } + + // Prepare the map that will hold the reply content. + content := make(map[string]interface{}) + content["execution_count"] = ExecCounter + + // Tell the front-end that the kernel is working and when finished notify the + // front-end that the kernel is idle again. + if err := receipt.PublishKernelStatus(kernelBusy); err != nil { + log.Printf("Error publishing kernel status 'busy': %v\n", err) + } + defer func() { + if err := receipt.PublishKernelStatus(kernelIdle); err != nil { + log.Printf("Error publishing kernel status 'idle': %v\n", err) + } + }() + + // Tell the front-end what the kernel is about to execute. + if err := receipt.PublishExecutionInput(ExecCounter, code); err != nil { + log.Printf("Error publishing execution input: %v\n", err) + } + + // Redirect the standard out from the REPL. + oldStdout := os.Stdout + rOut, wOut, err := os.Pipe() + if err != nil { + return err + } + os.Stdout = wOut + + // Redirect the standard error from the REPL. + rErr, wErr, err := os.Pipe() + if err != nil { + return err + } + ir.Stderr = wErr + + // Prepare and perform the multiline evaluation. + env := ir.Env + env.Options &^= base.OptShowPrompt + env.Line = 0 + + // Perform the first iteration manually, to collect comments. + var comments string + str, firstToken := env.ReadMultiline(in, base.ReadOptCollectAllComments) + if firstToken >= 0 { + comments = str[0:firstToken] + if firstToken > 0 { + str = str[firstToken:] + env.IncLine(comments) + } + } + if ir.ParseEvalPrint(str, in) { + ir.Repl(in) + } + + // Copy the stdout in a separate goroutine to prevent + // blocking on printing. + outStdout := make(chan string) + go func() { + var buf bytes.Buffer + io.Copy(&buf, rOut) + outStdout <- buf.String() + }() + + // Return stdout back to normal state. + wOut.Close() + os.Stdout = oldStdout + val := <-outStdout + + // Copy the stderr in a separate goroutine to prevent + // blocking on printing. + outStderr := make(chan string) + go func() { + var buf bytes.Buffer + io.Copy(&buf, rErr) + outStderr <- buf.String() + }() + + wErr.Close() + stdErr := <-outStderr + + // TODO write stdout and stderr to streams rather than publishing as results + + if len(val) > 0 { + content["status"] = "ok" + content["user_expressions"] = make(map[string]string) + + if !silent { + // Publish the result of the execution. + if err := receipt.PublishExecutionResult(ExecCounter, val); err != nil { + log.Printf("Error publishing execution result: %v\n", err) + } + } + } + + if len(stdErr) > 0 { + content["status"] = "error" + content["ename"] = "ERROR" + content["evalue"] = stdErr + content["traceback"] = nil + + if err := receipt.PublishExecutionError(stdErr, []string{stdErr}); err != nil { + log.Printf("Error publishing execution error: %v\n", err) + } + } + + // Send the output back to the notebook. + return receipt.Reply("execute_reply", content) +} + +// handleShutdownRequest sends a "shutdown" message. +func handleShutdownRequest(receipt msgReceipt) { + content := receipt.Msg.Content.(map[string]interface{}) + restart := content["restart"].(bool) + + reply := shutdownReply{ + Restart: restart, + } + + if err := receipt.Reply("shutdown_reply", reply); err != nil { + log.Fatal(err) + } + + log.Println("Shutting down in response to shutdown_request") + os.Exit(0) +} diff --git a/kernel_test.go b/kernel_test.go new file mode 100644 index 0000000..c772158 --- /dev/null +++ b/kernel_test.go @@ -0,0 +1,449 @@ +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "log" + "os" + "strings" + "testing" + "time" + + zmq "github.com/pebbe/zmq4" +) + +const ( + failure = "\u2717" + success = "\u2713" +) + +const ( + connectionFile = "fixtures/connection_file.json" + sessionID = "ba65a05c-106a-4799-9a94-7f5631bbe216" +) + +var ( + connectionKey string + transport string + ip string + shellPort int + iopubPort int +) + +//============================================================================== + +func TestMain(m *testing.M) { + os.Exit(runTest(m)) +} + +// runTest initializes the environment for the tests and allows for +// the proper exit if the test fails or succeeds. +func runTest(m *testing.M) int { + // Parse the connection info. + var connInfo ConnectionInfo + + connData, err := ioutil.ReadFile(connectionFile) + if err != nil { + log.Fatal(err) + } + + if err = json.Unmarshal(connData, &connInfo); err != nil { + log.Fatal(err) + } + + // Store the connection parameters globally for use by the test client. + connectionKey = connInfo.Key + transport = connInfo.Transport + ip = connInfo.IP + shellPort = connInfo.ShellPort + iopubPort = connInfo.IOPubPort + + // Start the kernel. + go runKernel(connectionFile) + + return m.Run() +} + +//============================================================================== + +// TestEvaluate tests the evaluation of consecutive cells. +func TestEvaluate(t *testing.T) { + cases := []struct { + Input []string + Output string + }{ + {[]string{ + "import \"fmt\"", + "a := 1", + "fmt.Println(a)", + }, "1\n"}, + {[]string{ + "a = 2", + "fmt.Println(a)", + }, "2\n"}, + {[]string{ + "func myFunc(x int) int {", + " return x+1", + "}", + "fmt.Println(\"func defined\")", + }, "func defined\n"}, + {[]string{ + "b := myFunc(1)", + "fmt.Println(b)", + }, "2\n"}, + } + + t.Logf("Should be able to evaluate valid code in notebook cells.") + + for k, tc := range cases { + + // Give a progress report. + t.Logf(" Evaluating code snippet %d/%d.", k+1, len(cases)) + + // Get the result. + result := testEvaluate(t, strings.Join(tc.Input, "\n")) + + // Compare the result. + if result != tc.Output { + t.Errorf("\t%s Test case produced unexpected results.", failure) + continue + } + t.Logf("\t%s Should return the correct cell output.", success) + } +} + +// testEvaluate evaluates a cell. +func testEvaluate(t *testing.T, codeIn string) string { + client, closeClient := newTestJupyterClient(t) + defer closeClient() + + // Create a message. + request, err := NewMsg("execute_request", ComposedMsg{}) + if err != nil { + t.Fatalf("\t%s NewMsg: %s", failure, err) + } + + // Fill in remaining header information. + request.Header.Session = sessionID + request.Header.Username = "KernelTester" + + // Fill in Metadata. + request.Metadata = make(map[string]interface{}) + + // Fill in content. + content := make(map[string]interface{}) + content["code"] = codeIn + content["silent"] = false + request.Content = content + + reply, pub := client.performJupyterRequest(t, request, 10*time.Second) + + assertMsgTypeEquals(t, reply, "execute_reply") + + content = getMsgContentAsJSONObject(t, reply) + status := getString(t, "content", content, "status") + + if status != "ok" { + t.Fatalf("\t%s Execution encountered error [%s]: %s", failure, content["ename"], content["evalue"]) + } + + for _, pubMsg := range pub { + if pubMsg.Header.MsgType == "execute_result" { + content = getMsgContentAsJSONObject(t, pubMsg) + + bundledMIMEData := getJSONObject(t, "content", content, "data") + textRep := getString(t, "content[\"data\"]", bundledMIMEData, "text/plain") + + return textRep + } + } + + return "" +} + +// TestPanicGeneratesError tests that executing code with an un-recovered panic properly generates both +// an error "execute_reply" and publishes an "error" message. +func TestPanicGeneratesError(t *testing.T) { + client, closeClient := newTestJupyterClient(t) + defer closeClient() + + // Create a message. + request, err := NewMsg("execute_request", ComposedMsg{}) + if err != nil { + t.Fatalf("\t%s NewMsg: %s", failure, err) + } + + // Fill in remaining header information. + request.Header.Session = sessionID + request.Header.Username = "KernelTester" + + // Fill in Metadata. + request.Metadata = make(map[string]interface{}) + + // Fill in content. + content := make(map[string]interface{}) + content["code"] = "panic(\"Error\")" + content["silent"] = false + request.Content = content + + reply, pub := client.performJupyterRequest(t, request, 10*time.Second) + + assertMsgTypeEquals(t, reply, "execute_reply") + + content = getMsgContentAsJSONObject(t, reply) + status := getString(t, "content", content, "status") + + if status != "error" { + t.Fatalf("\t%s Execution did not raise expected error", failure) + } + + var foundPublishedError bool + for _, pubMsg := range pub { + if pubMsg.Header.MsgType == "error" { + foundPublishedError = true + break + } + } + + if !foundPublishedError { + t.Fatalf("\t%s Execution did not publish an expected \"error\" message", failure) + } +} + +//============================================================================== + +// testJupyterClient holds references to the 2 sockets it uses to communicate with the kernel. +type testJupyterClient struct { + shellSocket *zmq.Socket + ioSocket *zmq.Socket +} + +// newTestJupyterClient creates and connects a fresh client to the kernel. Upon error, newTestJupyterClient +// will Fail the test. +func newTestJupyterClient(t *testing.T) (testJupyterClient, func()) { + t.Helper() + + addrShell := fmt.Sprintf("%s://%s:%d", transport, ip, shellPort) + addrIO := fmt.Sprintf("%s://%s:%d", transport, ip, iopubPort) + + // Prepare the shell socket. + shell, err := zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatalf("\t%s NewSocket: %s", failure, err) + } + + if err = shell.Connect(addrShell); err != nil { + t.Fatalf("\t%s shell.Connect: %s", failure, err) + } + + // Prepare the IOPub socket. + iopub, err := zmq.NewSocket(zmq.SUB) + if err != nil { + t.Fatalf("\t%s NewSocket: %s", failure, err) + } + + if err = iopub.Connect(addrIO); err != nil { + t.Fatalf("\t%s iopub.Connect: %s", failure, err) + } + + if err = iopub.SetSubscribe(""); err != nil { + t.Fatalf("\t%s iopub.SetSubscribe: %s", failure, err) + } + + // Wait for a second to give the tcp connection time to complete to avoid missing the early pub messages. + time.Sleep(1 * time.Second) + + return testJupyterClient{shell, iopub}, func() { + if err := shell.Close(); err != nil { + t.Errorf("\t%s shell.Close: %s", failure, err) + } + if err = iopub.Close(); err != nil { + t.Errorf("\t%s iopub.Close: %s", failure, err) + } + } +} + +// sendShellRequest sends a message to the kernel over the shell channel. Upon error, sendShellRequest +// will Fail the test. +func (client *testJupyterClient) sendShellRequest(t *testing.T, request ComposedMsg) { + t.Helper() + + if _, err := client.shellSocket.Send("", zmq.SNDMORE); err != nil { + t.Fatalf("\t%s shellSocket.Send: %s", failure, err) + } + + reqMsgParts, err := request.ToWireMsg([]byte(connectionKey)) + if err != nil { + t.Fatalf("\t%s request.ToWireMsg: %s", failure, err) + } + + if _, err = client.shellSocket.SendMessage(reqMsgParts); err != nil { + t.Fatalf("\t%s shellSocket.SendMessage: %s", failure, err) + } +} + +// recvShellReply tries to read a reply message from the shell channel. It will timeout after the given +// timeout delay. Upon error or timeout, recvShellReply will Fail the test. +func (client *testJupyterClient) recvShellReply(t *testing.T, timeout time.Duration) (reply ComposedMsg) { + t.Helper() + + ch := make(chan ComposedMsg) + + go func() { + repMsgParts, err := client.shellSocket.RecvMessageBytes(0) + if err != nil { + t.Fatalf("\t%s Shell socket RecvMessageBytes: %s", failure, err) + } + + msgParsed, _, err := WireMsgToComposedMsg(repMsgParts, []byte(connectionKey)) + if err != nil { + t.Fatalf("\t%s Could not parse wire message: %s", failure, err) + } + + ch <- msgParsed + }() + + select { + case reply = <-ch: + case <-time.After(timeout): + t.Fatalf("\t%s recvShellReply timed out", failure) + } + + return +} + +// recvIOSub tries to read a published message from the IOPub channel. It will timeout after the given +// timeout delay. Upon error or timeout, recvIOSub will Fail the test. +func (client *testJupyterClient) recvIOSub(t *testing.T, timeout time.Duration) (sub ComposedMsg) { + t.Helper() + + ch := make(chan ComposedMsg) + + go func() { + repMsgParts, err := client.ioSocket.RecvMessageBytes(0) + if err != nil { + t.Fatalf("\t%s IOPub socket RecvMessageBytes: %s", failure, err) + } + + msgParsed, _, err := WireMsgToComposedMsg(repMsgParts, []byte(connectionKey)) + if err != nil { + t.Fatalf("\t%s Could not parse wire message: %s", failure, err) + } + + ch <- msgParsed + }() + + select { + case sub = <-ch: + case <-time.After(timeout): + t.Fatalf("\t%s recvIOSub timed out", failure) + } + + return +} + +// performJupyterRequest preforms a request and awaits a reply on the shell channel. Additionally all messages on the +// IOPub channel between the opening 'busy' messages and closing 'idle' message are captured and returned. The request +// will timeout after the given timeout delay. Upon error or timeout, request will Fail the test. +func (client *testJupyterClient) performJupyterRequest(t *testing.T, request ComposedMsg, timeout time.Duration) (reply ComposedMsg, pub []ComposedMsg) { + t.Helper() + + client.sendShellRequest(t, request) + reply = client.recvShellReply(t, timeout) + + // Read the expected 'busy' message and ensure it is in fact, a 'busy' message. + subMsg := client.recvIOSub(t, 1*time.Second) + assertMsgTypeEquals(t, subMsg, "status") + + subData := getMsgContentAsJSONObject(t, subMsg) + execState := getString(t, "content", subData, "execution_state") + + if execState != kernelBusy { + t.Fatalf("\t%s Expected a 'busy' status message but got '%s'", failure, execState) + } + + // Read messages from the IOPub channel until an 'idle' message is received. + for { + subMsg = client.recvIOSub(t, 100*time.Millisecond) + + // If the message is a 'status' message, ensure it is an 'idle' status. + if subMsg.Header.MsgType == "status" { + subData = getMsgContentAsJSONObject(t, subMsg) + execState = getString(t, "content", subData, "execution_state") + + if execState != kernelIdle { + t.Fatalf("\t%s Expected a 'idle' status message but got '%s'", failure, execState) + } + + // Break from the loop as we don't expect any other IOPub messages after the 'idle'. + break + } + + // Add the message to the pub collection. + pub = append(pub, subMsg) + } + + return +} + +// assertMsgTypeEquals is a test helper that fails the test if the message header's MsgType is not the +// expectedType. +func assertMsgTypeEquals(t *testing.T, msg ComposedMsg, expectedType string) { + t.Helper() + + if msg.Header.MsgType != expectedType { + t.Fatalf("\t%s Expected message of type '%s' but was '%s'", failure, expectedType, msg.Header.MsgType) + } +} + +// getMsgContentAsJSONObject is a test helper that fails the rest if the message content is not a +// map[string]interface{} and returns the content as a map[string]interface{} if it is of the correct type. +func getMsgContentAsJSONObject(t *testing.T, msg ComposedMsg) map[string]interface{} { + t.Helper() + + content, ok := msg.Content.(map[string]interface{}) + if !ok { + t.Fatalf("\t%s Message content is not a JSON object", failure) + } + + return content +} + +// getString is a test helper that retrieves a value as a string from the content at the given key. If the key +// does not exist in the content map or the value is not a string this will fail the test. The jsonObjectName +// parameter is a string used to name the content for more helpful fail messages. +func getString(t *testing.T, jsonObjectName string, content map[string]interface{}, key string) string { + t.Helper() + + raw, ok := content[key] + if !ok { + t.Fatalf("\t%s %s[\"%s\"] field not present", failure, jsonObjectName, key) + } + + value, ok := raw.(string) + if !ok { + t.Fatalf("\t%s %s[\"%s\"] is not a string", failure, jsonObjectName, key) + } + + return value +} + +// getJSONObject is a test helper that retrieves a value as a map[string]interface{} from the content at the given key. +// If the key does not exist in the content map or the value is not a map[string]interface{} this will fail the test. +// The jsonObjectName parameter is a string used to name the content for more helpful fail messages. +func getJSONObject(t *testing.T, jsonObjectName string, content map[string]interface{}, key string) map[string]interface{} { + t.Helper() + + raw, ok := content[key] + if !ok { + t.Fatalf("\t%s %s[\"%s\"] field not present", failure, jsonObjectName, key) + } + + value, ok := raw.(map[string]interface{}) + if !ok { + t.Fatalf("\t%s %s[\"%s\"] is not a JSON object", failure, jsonObjectName, key) + } + + return value +} diff --git a/main.go b/main.go index 00a7eba..2095901 100644 --- a/main.go +++ b/main.go @@ -2,25 +2,26 @@ package main import ( "flag" - "io" - "io/ioutil" "log" - "os" ) -func main() { +const ( + + // Version defines the gophernotes version. + Version string = "1.0.0" - debug := flag.Bool("debug", false, "Log extra info to stderr") + // ProtocolVersion defines the Jupyter protocol version. + ProtocolVersion string = "5.0" +) +func main() { + + // Parse the connection file. flag.Parse() if flag.NArg() < 1 { - log.Fatalln("Need a command line argument for the connection file.") - } - - var logwriter io.Writer = os.Stderr - if !*debug { - logwriter = ioutil.Discard + log.Fatalln("Need a command line argument specifying the connection file.") } - RunKernel(flag.Arg(0), logwriter) + // Run the kernel. + runKernel(flag.Arg(0)) } diff --git a/messages.go b/messages.go index 2e23f2a..49cbd68 100644 --- a/messages.go +++ b/messages.go @@ -5,19 +5,20 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" - "log" + "time" - zmq "github.com/alecthomas/gozmq" - uuid "github.com/nu7hatch/gouuid" - "github.com/pkg/errors" + "github.com/nu7hatch/gouuid" + zmq "github.com/pebbe/zmq4" ) // MsgHeader encodes header info for ZMQ messages. type MsgHeader struct { - MsgID string `json:"msg_id"` - Username string `json:"username"` - Session string `json:"session"` - MsgType string `json:"msg_type"` + MsgID string `json:"msg_id"` + Username string `json:"username"` + Session string `json:"session"` + MsgType string `json:"msg_type"` + ProtocolVersion string `json:"version"` + Timestamp string `json:"date"` } // ComposedMsg represents an entire message in a high-level structure. @@ -28,6 +29,19 @@ type ComposedMsg struct { Content interface{} } +// msgReceipt represents a received message, its return identities, and +// the sockets for communication. +type msgReceipt struct { + Msg ComposedMsg + Identities [][]byte + Sockets SocketGroup +} + +// bundledMIMEData holds data that can be presented in multiple formats. The keys are MIME types +// and the values are the data formatted with respect to it's MIME type. All bundles should contain +// at least a "text/plain" representation with a string value. +type bundledMIMEData map[string]interface{} + // InvalidSignatureError is returned when the signature on a received message does not // validate. type InvalidSignatureError struct{} @@ -47,7 +61,7 @@ func WireMsgToComposedMsg(msgparts [][]byte, signkey []byte) (ComposedMsg, [][]b } identities := msgparts[:i] - // Validate signature + // Validate signature. var msg ComposedMsg if len(signkey) != 0 { mac := hmac.New(sha256.New, signkey) @@ -60,6 +74,8 @@ func WireMsgToComposedMsg(msgparts [][]byte, signkey []byte) (ComposedMsg, [][]b return msg, nil, &InvalidSignatureError{} } } + + // Unmarshal contents. json.Unmarshal(msgparts[i+2], &msg.Header) json.Unmarshal(msgparts[i+3], &msg.ParentHeader) json.Unmarshal(msgparts[i+4], &msg.Metadata) @@ -72,30 +88,32 @@ func WireMsgToComposedMsg(msgparts [][]byte, signkey []byte) (ComposedMsg, [][]b func (msg ComposedMsg) ToWireMsg(signkey []byte) ([][]byte, error) { msgparts := make([][]byte, 5) + header, err := json.Marshal(msg.Header) if err != nil { - return msgparts, errors.Wrap(err, "Could not marshal message header") + return msgparts, err } msgparts[1] = header parentHeader, err := json.Marshal(msg.ParentHeader) if err != nil { - return msgparts, errors.Wrap(err, "Could not marshal parent header") + return msgparts, err } msgparts[2] = parentHeader if msg.Metadata == nil { msg.Metadata = make(map[string]interface{}) } + metadata, err := json.Marshal(msg.Metadata) if err != nil { - return msgparts, errors.Wrap(err, "Could not marshal metadata") + return msgparts, err } msgparts[3] = metadata content, err := json.Marshal(msg.Content) if err != nil { - return msgparts, errors.Wrap(err, "Could not marshal content") + return msgparts, err } msgparts[4] = content @@ -108,43 +126,145 @@ func (msg ComposedMsg) ToWireMsg(signkey []byte) ([][]byte, error) { msgparts[0] = make([]byte, hex.EncodedLen(mac.Size())) hex.Encode(msgparts[0], mac.Sum(nil)) } - return msgparts, nil -} -// MsgReceipt represents a received message, its return identities, and the sockets for -// communication. -type MsgReceipt struct { - Msg ComposedMsg - Identities [][]byte - Sockets SocketGroup + return msgparts, nil } // SendResponse sends a message back to return identites of the received message. -func (receipt *MsgReceipt) SendResponse(socket *zmq.Socket, msg ComposedMsg) { +func (receipt *msgReceipt) SendResponse(socket *zmq.Socket, msg ComposedMsg) error { - socket.SendMultipart(receipt.Identities, zmq.SNDMORE) - socket.Send([]byte(""), zmq.SNDMORE) + for _, idt := range receipt.Identities { + _, err := socket.Send(string(idt), zmq.SNDMORE) + if err != nil { + return err + } + } + + _, err := socket.Send("", zmq.SNDMORE) + if err != nil { + return err + } msgParts, err := msg.ToWireMsg(receipt.Sockets.Key) if err != nil { - log.Fatalln(err) + return err } - socket.SendMultipart(msgParts, 0) - logger.Println("<--", msg.Header.MsgType) - logger.Printf("%+v\n", msg.Content) + + _, err = socket.SendMessage(msgParts) + if err != nil { + return err + } + + return nil } -// NewMsg creates a new ComposedMsg to respond to a parent message. This includes setting -// up its headers. -func NewMsg(msgType string, parent ComposedMsg) (msg ComposedMsg) { +// NewMsg creates a new ComposedMsg to respond to a parent message. +// This includes setting up its headers. +func NewMsg(msgType string, parent ComposedMsg) (ComposedMsg, error) { + var msg ComposedMsg + msg.ParentHeader = parent.Header msg.Header.Session = parent.Header.Session msg.Header.Username = parent.Header.Username msg.Header.MsgType = msgType + msg.Header.ProtocolVersion = ProtocolVersion + msg.Header.Timestamp = time.Now().UTC().Format(time.RFC3339) + u, err := uuid.NewV4() if err != nil { - log.Fatalln(errors.Wrap(err, "Could not generate UUID")) + return msg, err } msg.Header.MsgID = u.String() - return + + return msg, nil +} + +// Publish creates a new ComposedMsg and sends it back to the return identities over the +// IOPub channel. +func (receipt *msgReceipt) Publish(msgType string, content interface{}) error { + msg, err := NewMsg(msgType, receipt.Msg) + + if err != nil { + return err + } + + msg.Content = content + return receipt.SendResponse(receipt.Sockets.IOPubSocket, msg) +} + +// Reply creates a new ComposedMsg and sends it back to the return identities over the +// Shell channel. +func (receipt *msgReceipt) Reply(msgType string, content interface{}) error { + msg, err := NewMsg(msgType, receipt.Msg) + + if err != nil { + return err + } + + msg.Content = content + return receipt.SendResponse(receipt.Sockets.ShellSocket, msg) +} + +// newTextMIMEDataBundle creates a bundledMIMEData that only contains a text representation described +// by the value parameter. +func newTextBundledMIMEData(value string) bundledMIMEData { + return bundledMIMEData{ + "text/plain": value, + } +} + +// PublishKernelStatus publishes a status message notifying front-ends of the state the kernel is in. Supports +// states "starting", "busy", and "idle". +func (receipt *msgReceipt) PublishKernelStatus(status string) error { + return receipt.Publish("status", + struct { + ExecutionState string `json:"execution_state"` + }{ + ExecutionState: status, + }, + ) +} + +// PublishExecutionInput publishes a status message notifying front-ends of what code is +// currently being executed. +func (receipt *msgReceipt) PublishExecutionInput(execCount int, code string) error { + return receipt.Publish("execute_input", + struct { + ExecCount int `json:"execution_count"` + Code string `json:"code"` + }{ + ExecCount: execCount, + Code: code, + }, + ) +} + +// PublishExecuteResult publishes the result of the `execCount` execution as a string. +func (receipt *msgReceipt) PublishExecutionResult(execCount int, output string) error { + return receipt.Publish("execute_result", + struct { + ExecCount int `json:"execution_count"` + Data bundledMIMEData `json:"data"` + Metadata bundledMIMEData `json:"metadata"` + }{ + ExecCount: execCount, + Data: newTextBundledMIMEData(output), + Metadata: make(bundledMIMEData), + }, + ) +} + +// PublishExecuteResult publishes a serialized error that was encountered during execution. +func (receipt *msgReceipt) PublishExecutionError(err string, trace []string) error { + return receipt.Publish("error", + struct { + Name string `json:"ename"` + Value string `json:"evalue"` + Trace []string `json:"traceback"` + }{ + Name: "ERROR", + Value: err, + Trace: trace, + }, + ) } diff --git a/vendor/github.com/alecthomas/gozmq/.gitignore b/vendor/github.com/alecthomas/gozmq/.gitignore deleted file mode 100644 index 9b46cdf..0000000 --- a/vendor/github.com/alecthomas/gozmq/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.o -*.a -*.[568vq] -[568vq].out -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* -*.so -_obj -_test -_testmain.go -*.exe -.cache diff --git a/vendor/github.com/alecthomas/gozmq/.godocdown.md b/vendor/github.com/alecthomas/gozmq/.godocdown.md deleted file mode 100644 index 8a3e12f..0000000 --- a/vendor/github.com/alecthomas/gozmq/.godocdown.md +++ /dev/null @@ -1,158 +0,0 @@ -# Go (golang) Bindings for 0mq (zmq, zeromq) - -[![Build Status](https://travis-ci.org/alecthomas/gozmq.png)](https://travis-ci.org/alecthomas/gozmq) - -This package implements [Go](http://golang.org) (golang) bindings for -the [0mq](http://zeromq.org) C API. - -It is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). - -GoZMQ [does not](#zero-copy) support zero-copy. - -A full list of examples is included in the [zguide](https://github.com/imatix/zguide/tree/master/examples/Go). - -Note that this is *not* the same as [this -implementation](http://github.com/boggle/gozero) or [this -implementation](http://code.google.com/p/gozmq/). - -## Upgrading - -GoZMQ has made some public changes that will break old code. Fortunately, we've also written a tool based on `go fix` that will upgrade your code for you! Here's how to run it over your source (after making a backup of course): - - go get github.com/alecthomas/gozmq/gozmqfix - cd $YOUR_SOURCE_DIR - gozmqfix . - -## Installing - -GoZMQ currently supports ZMQ 2.1.x, 2.2.x and *basic* support for 3.x. Following are instructions on how to compile against these versions. - -Install gozmq with: - - go get github.com/alecthomas/gozmq - -This implementation works currently against:: ZeroMQ 2.2.x - -### ZeroMQ 2.1.x - -If you're using ZeroMQ 2.1.x, install with: - - go get -tags zmq_2_1 github.com/alecthomas/gozmq - -### ZeroMQ 3.x - -There is *basic* support for ZeroMQ 3.x. Install with: - - go get -tags zmq_3_x github.com/alecthomas/gozmq - -### Troubleshooting - -#### Go can't find ZMQ - -If the go tool can't find zmq and you know it is installed, you may need to override the C compiler/linker flags. - -eg. If you installed zmq into `/opt/zmq` you might try: - - CGO_CFLAGS=-I/opt/zmq/include CGO_LDFLAGS=-L/opt/zmq/lib \ - go get github.com/alecthomas/gozmq - -#### Mismatch in version of ZMQ - -If you get errors like this with 'go get' or 'go build': - - 1: error: 'ZMQ_FOO' undeclared (first use in this function) - -There are two possibilities: - -1. Your version of zmq is *very* old. In this case you will need to download and build zmq yourself. -2. You are building gozmq against the wrong version of zmq. See the [installation](#installation) instructions for details on how to target the correct version. - -## Differences from the C API - -The API implemented by this package does not attempt to expose -`zmq_msg_t` at all. Instead, `Recv()` and `Send()` both operate on byte -slices, allocating and freeing the memory automatically. Currently this -requires copying to/from C malloced memory, but a future implementation -may be able to avoid this to a certain extent. - -All major features are supported: contexts, sockets, devices, and polls. - -## Example - -Here are direct translations of some of the examples from [this blog -post](http://nichol.as/zeromq-an-introduction). - -A simple echo server: - -```go -package main - -import zmq "github.com/alecthomas/gozmq" - -func main() { - context, _ := zmq.NewContext() - socket, _ := context.NewSocket(zmq.REP) - socket.Bind("tcp://127.0.0.1:5000") - socket.Bind("tcp://127.0.0.1:6000") - - for { - msg, _ := socket.Recv(0) - println("Got", string(msg)) - socket.Send(msg, 0) - } -} -``` - -A simple client for the above server: - -```go -package main - -import "fmt" -import zmq "github.com/alecthomas/gozmq" - -func main() { - context, _ := zmq.NewContext() - socket, _ := context.NewSocket(zmq.REQ) - socket.Connect("tcp://127.0.0.1:5000") - socket.Connect("tcp://127.0.0.1:6000") - - for i := 0; i < 10; i++ { - msg := fmt.Sprintf("msg %d", i) - socket.Send([]byte(msg), 0) - println("Sending", msg) - socket.Recv(0) - } -} -``` - -## Caveats - -### Zero-copy - -GoZMQ does not support zero-copy. - -GoZMQ does not attempt to expose `zmq_msg_t` at all. Instead, `Recv()` and `Send()` -both operate on byte slices, allocating and freeing the memory automatically. -Currently this requires copying to/from C malloced memory, but a future -implementation may be able to avoid this to a certain extent. - - -### Memory management - -It's not entirely clear from the 0mq documentation how memory for -`zmq_msg_t` and packet data is managed once 0mq takes ownership. After -digging into the source a little, this package operates under the -following (educated) assumptions: - -- References to `zmq_msg_t` structures are not held by the C API - beyond the duration of any function call. -- Packet data is reference counted internally by the C API. The count - is incremented when a packet is queued for delivery to a destination - (the inference being that for delivery to N destinations, the - reference count will be incremented N times) and decremented once - the packet has either been delivered or errored. - -{{ .EmitUsage }} - -*(generated from .[godocdown](https://github.com/robertkrimen/godocdown).md with `godocdown github.com/alecthomas/gozmq > README.md`)* diff --git a/vendor/github.com/alecthomas/gozmq/.todo2 b/vendor/github.com/alecthomas/gozmq/.todo2 deleted file mode 100644 index 375a2b8..0000000 --- a/vendor/github.com/alecthomas/gozmq/.todo2 +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "GoZMQ - ZMQ bindings for Go", - "tasks": [] -} \ No newline at end of file diff --git a/vendor/github.com/alecthomas/gozmq/.travis.yml b/vendor/github.com/alecthomas/gozmq/.travis.yml deleted file mode 100644 index 462490a..0000000 --- a/vendor/github.com/alecthomas/gozmq/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -before_install: -- sudo apt-get install libzmq3-dev -language: go -go: 1.1.1 -install: go get -tags zmq_3_x -d -v ./... && go build -tags zmq_3_x -v ./... -script: go test -v -tags zmq_3_x ./... diff --git a/vendor/github.com/alecthomas/gozmq/AUTHORS b/vendor/github.com/alecthomas/gozmq/AUTHORS deleted file mode 100644 index 1687393..0000000 --- a/vendor/github.com/alecthomas/gozmq/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -The GoZmq package was originally written by Alec Thomas . - -Thanks to the following frequent contributors: - - @mcgoo Jim McGrath (https://github.com/mcgoo) - @jtacoma Joshua Tacoma (https://github.com/jtacoma) - @jhawk28 - -And many others. diff --git a/vendor/github.com/alecthomas/gozmq/README.md b/vendor/github.com/alecthomas/gozmq/README.md deleted file mode 100644 index 15f836f..0000000 --- a/vendor/github.com/alecthomas/gozmq/README.md +++ /dev/null @@ -1,1024 +0,0 @@ -# _NOTE:_ These gozmq bindings are in maintenance mode. Only critical bugs will be fixed. Henceforth I would suggest using [@pebbe's](https://github.com/pebbe) actively maintained bindings for [zmq2](https://github.com/pebbe/zmq2), [zmq3](https://github.com/pebbe/zmq3) and [zmq4](https://github.com/pebbe/zmq4). - -## Go (golang) Bindings for 0mq (zmq, zeromq) - -[![Build Status](https://travis-ci.org/alecthomas/gozmq.png)](https://travis-ci.org/alecthomas/gozmq) - -This package implements [Go](http://golang.org) (golang) bindings for -the [0mq](http://zeromq.org) C API. - -GoZMQ [does not](#zero-copy) support zero-copy. - -A full list of examples is included in the [zguide](https://github.com/imatix/zguide/tree/master/examples/Go). - -Note that this is *not* the same as [this -implementation](http://github.com/boggle/gozero) or [this -implementation](http://code.google.com/p/gozmq/). - -## Upgrading - -GoZMQ has made some public changes that will break old code. Fortunately, we've also written a tool based on `go fix` that will upgrade your code for you! Here's how to run it over your source (after making a backup of course): - - go get github.com/alecthomas/gozmq/gozmqfix - cd $YOUR_SOURCE_DIR - gozmqfix . - -## Installing - -GoZMQ currently supports ZMQ 2.1.x, 2.2.x, 3.x and 4.x. Following are instructions on how to compile against these versions. - -For ZeroMQ 2.2.x install with: - - go get github.com/alecthomas/gozmq - -For 2.1.x install with: - - go get -tags zmq_2_1 github.com/alecthomas/gozmq - -For 3.x install with: - - go get -tags zmq_3_x github.com/alecthomas/gozmq - -For 4.x install with: - - go get -tags zmq_4_x github.com/alecthomas/gozmq - -### Troubleshooting - -#### Go can't find ZMQ - -If the go tool can't find zmq and you know it is installed, you may need to override the C compiler/linker flags. - -eg. If you installed zmq into `/opt/zmq` you might try: - - CGO_CFLAGS=-I/opt/zmq/include CGO_LDFLAGS=-L/opt/zmq/lib \ - go get github.com/alecthomas/gozmq - -#### Mismatch in version of ZMQ - -If you get errors like this with 'go get' or 'go build': - - 1: error: 'ZMQ_FOO' undeclared (first use in this function) - -There are two possibilities: - -1. Your version of zmq is *very* old. In this case you will need to download and build zmq yourself. -2. You are building gozmq against the wrong version of zmq. See the [installation](#installation) instructions for details on how to target the correct version. - -## Differences from the C API - -The API implemented by this package does not attempt to expose -`zmq_msg_t` at all. Instead, `Recv()` and `Send()` both operate on byte -slices, allocating and freeing the memory automatically. Currently this -requires copying to/from C malloced memory, but a future implementation -may be able to avoid this to a certain extent. - -All major features are supported: contexts, sockets, devices, and polls. - -## Example - -Here are direct translations of some of the examples from [this blog -post](http://nichol.as/zeromq-an-introduction). - -A simple echo server: - -```go -package main - -import zmq "github.com/alecthomas/gozmq" - -func main() { - context, _ := zmq.NewContext() - socket, _ := context.NewSocket(zmq.REP) - socket.Bind("tcp://127.0.0.1:5000") - socket.Bind("tcp://127.0.0.1:6000") - - for { - msg, _ := socket.Recv(0) - println("Got", string(msg)) - socket.Send(msg, 0) - } -} -``` - -A simple client for the above server: - -```go -package main - -import "fmt" -import zmq "github.com/alecthomas/gozmq" - -func main() { - context, _ := zmq.NewContext() - socket, _ := context.NewSocket(zmq.REQ) - socket.Connect("tcp://127.0.0.1:5000") - socket.Connect("tcp://127.0.0.1:6000") - - for i := 0; i < 10; i++ { - msg := fmt.Sprintf("msg %d", i) - socket.Send([]byte(msg), 0) - println("Sending", msg) - socket.Recv(0) - } -} -``` - -## Caveats - -### Zero-copy - -GoZMQ does not support zero-copy. - -GoZMQ does not attempt to expose `zmq_msg_t` at all. Instead, `Recv()` and `Send()` -both operate on byte slices, allocating and freeing the memory automatically. -Currently this requires copying to/from C malloced memory, but a future -implementation may be able to avoid this to a certain extent. - - -### Memory management - -It's not entirely clear from the 0mq documentation how memory for -`zmq_msg_t` and packet data is managed once 0mq takes ownership. After -digging into the source a little, this package operates under the -following (educated) assumptions: - -- References to `zmq_msg_t` structures are not held by the C API - beyond the duration of any function call. -- Packet data is reference counted internally by the C API. The count - is incremented when a packet is queued for delivery to a destination - (the inference being that for delivery to N destinations, the - reference count will be incremented N times) and decremented once - the packet has either been delivered or errored. - -## Usage - -```go -const ( - // NewSocket types - PAIR = SocketType(C.ZMQ_PAIR) - PUB = SocketType(C.ZMQ_PUB) - SUB = SocketType(C.ZMQ_SUB) - REQ = SocketType(C.ZMQ_REQ) - REP = SocketType(C.ZMQ_REP) - DEALER = SocketType(C.ZMQ_DEALER) - ROUTER = SocketType(C.ZMQ_ROUTER) - PULL = SocketType(C.ZMQ_PULL) - PUSH = SocketType(C.ZMQ_PUSH) - XPUB = SocketType(C.ZMQ_XPUB) - XSUB = SocketType(C.ZMQ_XSUB) - - // Deprecated aliases - XREQ = DEALER - XREP = ROUTER - UPSTREAM = PULL - DOWNSTREAM = PUSH - - // NewSocket options - AFFINITY = UInt64SocketOption(C.ZMQ_AFFINITY) - IDENTITY = StringSocketOption(C.ZMQ_IDENTITY) - SUBSCRIBE = StringSocketOption(C.ZMQ_SUBSCRIBE) - UNSUBSCRIBE = StringSocketOption(C.ZMQ_UNSUBSCRIBE) - RATE = Int64SocketOption(C.ZMQ_RATE) - RECOVERY_IVL = Int64SocketOption(C.ZMQ_RECOVERY_IVL) - SNDBUF = UInt64SocketOption(C.ZMQ_SNDBUF) - RCVBUF = UInt64SocketOption(C.ZMQ_RCVBUF) - FD = Int64SocketOption(C.ZMQ_FD) - EVENTS = UInt64SocketOption(C.ZMQ_EVENTS) - TYPE = UInt64SocketOption(C.ZMQ_TYPE) - LINGER = IntSocketOption(C.ZMQ_LINGER) - RECONNECT_IVL = IntSocketOption(C.ZMQ_RECONNECT_IVL) - RECONNECT_IVL_MAX = IntSocketOption(C.ZMQ_RECONNECT_IVL_MAX) - BACKLOG = IntSocketOption(C.ZMQ_BACKLOG) - - // Send/recv options - SNDMORE = SendRecvOption(C.ZMQ_SNDMORE) -) -``` - -```go -const ( - POLLIN = PollEvents(C.ZMQ_POLLIN) - POLLOUT = PollEvents(C.ZMQ_POLLOUT) - POLLERR = PollEvents(C.ZMQ_POLLERR) -) -``` - -```go -const ( - STREAMER = DeviceType(C.ZMQ_STREAMER) - FORWARDER = DeviceType(C.ZMQ_FORWARDER) - QUEUE = DeviceType(C.ZMQ_QUEUE) -) -``` - -```go -const ( - RCVTIMEO = IntSocketOption(C.ZMQ_RCVTIMEO) - SNDTIMEO = IntSocketOption(C.ZMQ_SNDTIMEO) -) -``` - -```go -const ( - RCVMORE = UInt64SocketOption(C.ZMQ_RCVMORE) - RECOVERY_IVL_MSEC = Int64SocketOption(C.ZMQ_RECOVERY_IVL_MSEC) - SWAP = Int64SocketOption(C.ZMQ_SWAP) - MCAST_LOOP = Int64SocketOption(C.ZMQ_MCAST_LOOP) - HWM = UInt64SocketOption(C.ZMQ_HWM) - NOBLOCK = SendRecvOption(C.ZMQ_NOBLOCK) - - // Forwards-compatible aliases: - DONTWAIT = NOBLOCK -) -``` - -```go -const ( - RCVMORE = IntSocketOption(C.ZMQ_RCVMORE) - SNDHWM = IntSocketOption(C.ZMQ_SNDHWM) - RCVHWM = IntSocketOption(C.ZMQ_RCVHWM) - - // TODO Not documented in the man page... - //LAST_ENDPOINT = UInt64SocketOption(C.ZMQ_LAST_ENDPOINT) - FAIL_UNROUTABLE = BoolSocketOption(C.ZMQ_FAIL_UNROUTABLE) - TCP_KEEPALIVE = IntSocketOption(C.ZMQ_TCP_KEEPALIVE) - TCP_KEEPALIVE_CNT = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_CNT) - TCP_KEEPALIVE_IDLE = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_IDLE) - TCP_KEEPALIVE_INTVL = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_INTVL) - TCP_ACCEPT_FILTER = StringSocketOption(C.ZMQ_TCP_ACCEPT_FILTER) - - // Message options - MORE = MessageOption(C.ZMQ_MORE) - - // Send/recv options - DONTWAIT = SendRecvOption(C.ZMQ_DONTWAIT) - - // Deprecated aliases - NOBLOCK = DONTWAIT -) -``` - -```go -var ( - // Additional ZMQ errors - ENOTSOCK error = zmqErrno(C.ENOTSOCK) - EFSM error = zmqErrno(C.EFSM) - EINVAL error = zmqErrno(C.EINVAL) - ENOCOMPATPROTO error = zmqErrno(C.ENOCOMPATPROTO) - ETERM error = zmqErrno(C.ETERM) - EMTHREAD error = zmqErrno(C.EMTHREAD) -) -``` - -#### func Device - -```go -func Device(t DeviceType, in, out *Socket) error -``` -run a zmq_device passing messages between in and out - -#### func Poll - -```go -func Poll(items []PollItem, timeout time.Duration) (count int, err error) -``` -Poll ZmqSockets and file descriptors for I/O readiness. Timeout is in -time.Duration. The smallest possible timeout is time.Millisecond for ZeroMQ -version 3 and above, and time.Microsecond for earlier versions. - -#### func Proxy - -```go -func Proxy(in, out, capture *Socket) error -``` -run a zmq_proxy with in, out and capture sockets - -#### func Version - -```go -func Version() (int, int, int) -``` -void zmq_version (int *major, int *minor, int *patch); - -#### type BoolSocketOption - -```go -type BoolSocketOption int -``` - - -#### type Context - -```go -type Context struct { -} -``` - -* A context handles socket creation and asynchronous message delivery. * There -should generally be one context per application. - -#### func NewContext - -```go -func NewContext() (*Context, error) -``` -Create a new context. - -#### func (*Context) Close - -```go -func (c *Context) Close() -``` - -#### func (*Context) IOThreads - -```go -func (c *Context) IOThreads() (int, error) -``` -Get a context option. - -#### func (*Context) MaxSockets - -```go -func (c *Context) MaxSockets() (int, error) -``` - -#### func (*Context) NewSocket - -```go -func (c *Context) NewSocket(t SocketType) (*Socket, error) -``` -Create a new socket. void *zmq_socket (void *context, int type); - -#### func (*Context) SetIOThreads - -```go -func (c *Context) SetIOThreads(value int) error -``` -Set a context option. - -#### func (*Context) SetMaxSockets - -```go -func (c *Context) SetMaxSockets(value int) error -``` - -#### type DeviceType - -```go -type DeviceType int -``` - - -#### type Int64SocketOption - -```go -type Int64SocketOption int -``` - - -#### type IntSocketOption - -```go -type IntSocketOption int -``` - - -#### type MessageOption - -```go -type MessageOption int -``` - - -#### type PollEvents - -```go -type PollEvents C.short -``` - - -#### type PollItem - -```go -type PollItem struct { - Socket *Socket // socket to poll for events on - Fd ZmqOsSocketType // fd to poll for events on as returned from os.File.Fd() - Events PollEvents // event set to poll for - REvents PollEvents // events that were present -} -``` - -Item to poll for read/write events on, either a *Socket or a file descriptor - -#### type PollItems - -```go -type PollItems []PollItem -``` - -a set of items to poll for events on - -#### type SendRecvOption - -```go -type SendRecvOption int -``` - - -#### type Socket - -```go -type Socket struct { -} -``` - - -#### func (*Socket) Affinity - -```go -func (s *Socket) Affinity() (uint64, error) -``` -ZMQ_AFFINITY: Retrieve I/O thread affinity. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc7 - -#### func (*Socket) Backlog - -```go -func (s *Socket) Backlog() (int, error) -``` -ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc18 - -#### func (*Socket) Bind - -```go -func (s *Socket) Bind(address string) error -``` -Bind the socket to a listening address. int zmq_bind (void *s, const char -*addr); - -#### func (*Socket) Close - -```go -func (s *Socket) Close() error -``` -Shutdown the socket. int zmq_close (void *s); - -#### func (*Socket) Connect - -```go -func (s *Socket) Connect(address string) error -``` -Connect the socket to an address. int zmq_connect (void *s, const char *addr); - -#### func (*Socket) Events - -```go -func (s *Socket) Events() (uint64, error) -``` -ZMQ_EVENTS: Retrieve socket event state. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc20 - -#### func (*Socket) GetSockOptBool - -```go -func (s *Socket) GetSockOptBool(option BoolSocketOption) (value bool, err error) -``` - -#### func (*Socket) GetSockOptInt - -```go -func (s *Socket) GetSockOptInt(option IntSocketOption) (value int, err error) -``` -Get an int option from the socket. int zmq_getsockopt (void *s, int option, void -*optval, size_t *optvallen); - -#### func (*Socket) GetSockOptInt64 - -```go -func (s *Socket) GetSockOptInt64(option Int64SocketOption) (value int64, err error) -``` -Get an int64 option from the socket. int zmq_getsockopt (void *s, int option, -void *optval, size_t *optvallen); - -#### func (*Socket) GetSockOptString - -```go -func (s *Socket) GetSockOptString(option StringSocketOption) (value string, err error) -``` -Get a string option from the socket. int zmq_getsockopt (void *s, int option, -void *optval, size_t *optvallen); - -#### func (*Socket) GetSockOptUInt64 - -```go -func (s *Socket) GetSockOptUInt64(option UInt64SocketOption) (value uint64, err error) -``` -Get a uint64 option from the socket. int zmq_getsockopt (void *s, int option, -void *optval, size_t *optvallen); - -#### func (*Socket) HWM - -```go -func (s *Socket) HWM() (uint64, error) -``` -ZMQ_HWM: Retrieve high water mark. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc5 - -#### func (*Socket) Identity - -```go -func (s *Socket) Identity() (string, error) -``` -ZMQ_IDENTITY: Retrieve socket identity. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc8 - -#### func (*Socket) Linger - -```go -func (s *Socket) Linger() (time.Duration, error) -``` -ZMQ_LINGER: Retrieve linger period for socket shutdown. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc15 - -#### func (*Socket) McastLoop - -```go -func (s *Socket) McastLoop() (bool, error) -``` -ZMQ_MCAST_LOOP: Control multicast loop-back. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc12 - -#### func (*Socket) Rate - -```go -func (s *Socket) Rate() (int64, error) -``` -ZMQ_RATE: Retrieve multicast data rate. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc9 - -#### func (*Socket) RcvBuf - -```go -func (s *Socket) RcvBuf() (uint64, error) -``` -ZMQ_RCVBUF: Retrieve kernel receive buffer size. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc14 - -#### func (*Socket) RcvHWM - -```go -func (s *Socket) RcvHWM() (int, error) -``` -ZMQ_RCVHWM: Retrieve high water mark for inbound messages. - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc6 - -#### func (*Socket) RcvMore - -```go -func (s *Socket) RcvMore() (bool, error) -``` -ZMQ_RCVMORE: More message parts to follow. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc4 - -#### func (*Socket) RcvTimeout - -```go -func (s *Socket) RcvTimeout() (time.Duration, error) -``` -ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN. - -See: http://api.zeromq.org/2.2:zmq-getsockopt#toc6 - -#### func (*Socket) ReconnectIvl - -```go -func (s *Socket) ReconnectIvl() (time.Duration, error) -``` -ZMQ_RECONNECT_IVL: Retrieve reconnection interval. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc16 - -#### func (*Socket) ReconnectIvlMax - -```go -func (s *Socket) ReconnectIvlMax() (time.Duration, error) -``` -ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc17 - -#### func (*Socket) RecoveryIvl - -```go -func (s *Socket) RecoveryIvl() (time.Duration, error) -``` -ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc11 - -#### func (*Socket) Recv - -```go -func (s *Socket) Recv(flags SendRecvOption) (data []byte, err error) -``` -Receive a message from the socket. int zmq_recv (void *s, zmq_msg_t *msg, int -flags); - -#### func (*Socket) RecvMultipart - -```go -func (s *Socket) RecvMultipart(flags SendRecvOption) (parts [][]byte, err error) -``` -Receive a multipart message. - -#### func (*Socket) Send - -```go -func (s *Socket) Send(data []byte, flags SendRecvOption) error -``` -Send a message to the socket. int zmq_send (void *s, zmq_msg_t *msg, int flags); - -#### func (*Socket) SendMultipart - -```go -func (s *Socket) SendMultipart(parts [][]byte, flags SendRecvOption) (err error) -``` -Send a multipart message. - -#### func (*Socket) SetAffinity - -```go -func (s *Socket) SetAffinity(value uint64) error -``` -ZMQ_AFFINITY: Set I/O thread affinity. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc5 - -#### func (*Socket) SetBacklog - -```go -func (s *Socket) SetBacklog(value int) error -``` -ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc18 - -#### func (*Socket) SetHWM - -```go -func (s *Socket) SetHWM(value uint64) error -``` -ZMQ_HWM: Set high water mark. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc3 - -#### func (*Socket) SetIdentity - -```go -func (s *Socket) SetIdentity(value string) error -``` -ZMQ_IDENTITY: Set socket identity. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc6 - -#### func (*Socket) SetLinger - -```go -func (s *Socket) SetLinger(value time.Duration) error -``` -ZMQ_LINGER: Set linger period for socket shutdown. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc15 - -#### func (*Socket) SetMcastLoop - -```go -func (s *Socket) SetMcastLoop(value bool) error -``` -ZMQ_MCAST_LOOP: Control multicast loop-back. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc12 - -#### func (*Socket) SetRate - -```go -func (s *Socket) SetRate(value int64) error -``` -ZMQ_RATE: Set multicast data rate. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc9 - -#### func (*Socket) SetRcvBuf - -```go -func (s *Socket) SetRcvBuf(value uint64) error -``` -ZMQ_RCVBUF: Set kernel receive buffer size. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc14 - -#### func (*Socket) SetRcvHWM - -```go -func (s *Socket) SetRcvHWM(value int) error -``` -ZMQ_RCVHWM: Set high water mark for inbound messages. - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc4 - -#### func (*Socket) SetRcvTimeout - -```go -func (s *Socket) SetRcvTimeout(value time.Duration) error -``` -ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN. - -See: http://api.zeromq.org/2.2:zmq-setsockopt#toc9 - -#### func (*Socket) SetReconnectIvl - -```go -func (s *Socket) SetReconnectIvl(value time.Duration) error -``` -ZMQ_RECONNECT_IVL: Set reconnection interval. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc16 - -#### func (*Socket) SetReconnectIvlMax - -```go -func (s *Socket) SetReconnectIvlMax(value time.Duration) error -``` -ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc17 - -#### func (*Socket) SetRecoveryIvl - -```go -func (s *Socket) SetRecoveryIvl(value time.Duration) error -``` -ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc11 - -#### func (*Socket) SetSndBuf - -```go -func (s *Socket) SetSndBuf(value uint64) error -``` -ZMQ_SNDBUF: Set kernel transmit buffer size. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc13 - -#### func (*Socket) SetSndHWM - -```go -func (s *Socket) SetSndHWM(value int) error -``` -ZMQ_SNDHWM: Set high water mark for outbound messages. - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc3 - -#### func (*Socket) SetSndTimeout - -```go -func (s *Socket) SetSndTimeout(value time.Duration) error -``` -ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN. - -See: http://api.zeromq.org/2.2:zmq-setsockopt#toc10 - -#### func (*Socket) SetSockOptInt - -```go -func (s *Socket) SetSockOptInt(option IntSocketOption, value int) error -``` -Set an int option on the socket. int zmq_setsockopt (void *s, int option, const -void *optval, size_t optvallen); - -#### func (*Socket) SetSockOptInt64 - -```go -func (s *Socket) SetSockOptInt64(option Int64SocketOption, value int64) error -``` -Set an int64 option on the socket. int zmq_setsockopt (void *s, int option, -const void *optval, size_t optvallen); - -#### func (*Socket) SetSockOptString - -```go -func (s *Socket) SetSockOptString(option StringSocketOption, value string) error -``` -Set a string option on the socket. int zmq_setsockopt (void *s, int option, -const void *optval, size_t optvallen); - -#### func (*Socket) SetSockOptStringNil - -```go -func (s *Socket) SetSockOptStringNil(option StringSocketOption) error -``` -Set a string option on the socket to nil. int zmq_setsockopt (void *s, int -option, const void *optval, size_t optvallen); - -#### func (*Socket) SetSockOptUInt64 - -```go -func (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error -``` -Set a uint64 option on the socket. int zmq_setsockopt (void *s, int option, -const void *optval, size_t optvallen); - -#### func (*Socket) SetSubscribe - -```go -func (s *Socket) SetSubscribe(value string) error -``` -ZMQ_SUBSCRIBE: Establish message filter. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc7 - -#### func (*Socket) SetSwap - -```go -func (s *Socket) SetSwap(value int64) error -``` -ZMQ_SWAP: Set disk offload size. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc4 - -#### func (*Socket) SetTCPKeepalive - -```go -func (s *Socket) SetTCPKeepalive(value int) error -``` -ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc25 - -#### func (*Socket) SetTCPKeepaliveCnt - -```go -func (s *Socket) SetTCPKeepaliveCnt(value int) error -``` -ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc27 - -#### func (*Socket) SetTCPKeepaliveIdle - -```go -func (s *Socket) SetTCPKeepaliveIdle(value int) error -``` -ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS). - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc26 - -#### func (*Socket) SetTCPKeepaliveIntvl - -```go -func (s *Socket) SetTCPKeepaliveIntvl(value int) error -``` -ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. - -See: http://api.zeromq.org/3.2:zmq-setsockopt#toc28 - -#### func (*Socket) SetUnsubscribe - -```go -func (s *Socket) SetUnsubscribe(value string) error -``` -ZMQ_UNSUBSCRIBE: Remove message filter. - -See: http://api.zeromq.org/2.1:zmq-setsockopt#toc8 - -#### func (*Socket) SndBuf - -```go -func (s *Socket) SndBuf() (uint64, error) -``` -ZMQ_SNDBUF: Retrieve kernel transmit buffer size. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc13 - -#### func (*Socket) SndHWM - -```go -func (s *Socket) SndHWM() (int, error) -``` -ZMQ_SNDHWM: Retrieves high water mark for outbound messages. - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc5 - -#### func (*Socket) SndTimeout - -```go -func (s *Socket) SndTimeout() (time.Duration, error) -``` -ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN. - -See: http://api.zeromq.org/2.2:zmq-getsockopt#toc7 - -#### func (*Socket) Swap - -```go -func (s *Socket) Swap() (int64, error) -``` -ZMQ_SWAP: Retrieve disk offload size. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc6 - -#### func (*Socket) TCPKeepalive - -```go -func (s *Socket) TCPKeepalive() (int, error) -``` -ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc26 - -#### func (*Socket) TCPKeepaliveCnt - -```go -func (s *Socket) TCPKeepaliveCnt() (int, error) -``` -ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc28 - -#### func (*Socket) TCPKeepaliveIdle - -```go -func (s *Socket) TCPKeepaliveIdle() (int, error) -``` -ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS). - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc27 - -#### func (*Socket) TCPKeepaliveIntvl - -```go -func (s *Socket) TCPKeepaliveIntvl() (int, error) -``` -ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. - -See: http://api.zeromq.org/3.2:zmq-getsockopt#toc29 - -#### func (*Socket) Type - -```go -func (s *Socket) Type() (SocketType, error) -``` -ZMQ_TYPE: Retrieve socket type. - -See: http://api.zeromq.org/2.1:zmq-getsockopt#toc3 - -#### type SocketType - -```go -type SocketType int -``` - - -#### type StringSocketOption - -```go -type StringSocketOption int -``` - - -#### type UInt64SocketOption - -```go -type UInt64SocketOption int -``` - - -#### type ZmqOsSocketType - -```go -type ZmqOsSocketType C.SOCKET -``` - - -#### func (ZmqOsSocketType) ToRaw - -```go -func (self ZmqOsSocketType) ToRaw() C.SOCKET -``` - -*(generated from .[godocdown](https://github.com/robertkrimen/godocdown).md with `godocdown github.com/alecthomas/gozmq > README.md`)* diff --git a/vendor/github.com/alecthomas/gozmq/zmq.go b/vendor/github.com/alecthomas/gozmq/zmq.go deleted file mode 100644 index de987f0..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq.go +++ /dev/null @@ -1,455 +0,0 @@ -/* - Copyright 2010-2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -// Go (golang) Bindings for 0mq (zmq, zeromq) -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -#include -#include -*/ -import "C" - -import ( - "errors" - "sync" - "syscall" - "time" - "unsafe" -) - -type SocketType int - -type IntSocketOption int -type Int64SocketOption int -type UInt64SocketOption int -type StringSocketOption int -type BoolSocketOption int - -type MessageOption int -type SendRecvOption int - -const ( - // NewSocket types - PAIR = SocketType(C.ZMQ_PAIR) - PUB = SocketType(C.ZMQ_PUB) - SUB = SocketType(C.ZMQ_SUB) - REQ = SocketType(C.ZMQ_REQ) - REP = SocketType(C.ZMQ_REP) - DEALER = SocketType(C.ZMQ_DEALER) - ROUTER = SocketType(C.ZMQ_ROUTER) - PULL = SocketType(C.ZMQ_PULL) - PUSH = SocketType(C.ZMQ_PUSH) - XPUB = SocketType(C.ZMQ_XPUB) - XSUB = SocketType(C.ZMQ_XSUB) - - // Deprecated aliases - XREQ = DEALER - XREP = ROUTER - UPSTREAM = PULL - DOWNSTREAM = PUSH - - // NewSocket options - AFFINITY = UInt64SocketOption(C.ZMQ_AFFINITY) - IDENTITY = StringSocketOption(C.ZMQ_IDENTITY) - SUBSCRIBE = StringSocketOption(C.ZMQ_SUBSCRIBE) - UNSUBSCRIBE = StringSocketOption(C.ZMQ_UNSUBSCRIBE) - RATE = Int64SocketOption(C.ZMQ_RATE) - RECOVERY_IVL = Int64SocketOption(C.ZMQ_RECOVERY_IVL) - SNDBUF = UInt64SocketOption(C.ZMQ_SNDBUF) - RCVBUF = UInt64SocketOption(C.ZMQ_RCVBUF) - FD = Int64SocketOption(C.ZMQ_FD) - EVENTS = UInt64SocketOption(C.ZMQ_EVENTS) - TYPE = UInt64SocketOption(C.ZMQ_TYPE) - LINGER = IntSocketOption(C.ZMQ_LINGER) - RECONNECT_IVL = IntSocketOption(C.ZMQ_RECONNECT_IVL) - RECONNECT_IVL_MAX = IntSocketOption(C.ZMQ_RECONNECT_IVL_MAX) - BACKLOG = IntSocketOption(C.ZMQ_BACKLOG) - - // Send/recv options - SNDMORE = SendRecvOption(C.ZMQ_SNDMORE) -) - -type zmqErrno syscall.Errno - -var ( - // Additional ZMQ errors - ENOTSOCK error = zmqErrno(C.ENOTSOCK) - EFSM error = zmqErrno(C.EFSM) - EINVAL error = syscall.EINVAL - ENOCOMPATPROTO error = zmqErrno(C.ENOCOMPATPROTO) - ETERM error = zmqErrno(C.ETERM) - EMTHREAD error = zmqErrno(C.EMTHREAD) -) - -type PollEvents C.short - -const ( - POLLIN = PollEvents(C.ZMQ_POLLIN) - POLLOUT = PollEvents(C.ZMQ_POLLOUT) - POLLERR = PollEvents(C.ZMQ_POLLERR) -) - -type DeviceType int - -const ( - STREAMER = DeviceType(C.ZMQ_STREAMER) - FORWARDER = DeviceType(C.ZMQ_FORWARDER) - QUEUE = DeviceType(C.ZMQ_QUEUE) -) - -var ( - pollunit time.Duration -) - -func init() { - if v, _, _ := Version(); v < 3 { - pollunit = time.Microsecond - } else { - pollunit = time.Millisecond - } -} - -// void zmq_version (int *major, int *minor, int *patch); -func Version() (int, int, int) { - var major, minor, patch C.int - C.zmq_version(&major, &minor, &patch) - return int(major), int(minor), int(patch) -} - -func (e zmqErrno) Error() string { - return C.GoString(C.zmq_strerror(C.int(e))) -} - -// If possible, convert a syscall.Errno to a zmqErrno. -func casterr(fromcgo error) error { - errno, ok := fromcgo.(syscall.Errno) - if !ok { - return fromcgo - } - zmqerrno := zmqErrno(errno) - switch zmqerrno { - case ENOTSOCK: - return zmqerrno - } - if zmqerrno >= C.ZMQ_HAUSNUMERO { - return zmqerrno - } - return errno -} - -func getErrorForTesting() error { - return zmqErrno(C.EFSM) -} - -/* - * A context handles socket creation and asynchronous message delivery. - * There should generally be one context per application. - */ -type Context struct { - c unsafe.Pointer - mutex sync.Mutex // ensure init is only called once - init func() // func that calls zmq_init - err error // error returned from zmq_init - iothreads int // hold the iothreads option until zmq_init time -} - -// Create a new context. -func NewContext() (*Context, error) { - c := &Context{iothreads: 1} - c.init = func() { - c.mutex.Lock() - defer c.mutex.Unlock() - if c.c == nil && c.err == nil { - // C.NULL is correct but causes a runtime failure on darwin at present - if ptr, err := C.zmq_init(C.int(c.iothreads)); ptr != nil /*C.NULL*/ { - c.c = ptr - } else { - c.err = casterr(err) - } - } - } - return c, nil -} - -func (c *Context) Close() { - // C.NULL is correct but causes a runtime failure on darwin at present - if c.c != nil /*C.NULL*/ { - C.zmq_term(c.c) - } -} - -// Create a new socket. -// void *zmq_socket (void *context, int type); -func (c *Context) NewSocket(t SocketType) (*Socket, error) { - if c.init(); c.err != nil { - return nil, c.err - } - s, err := C.zmq_socket(c.c, C.int(t)) - // C.NULL is correct but causes a runtime failure on darwin at present - if s != nil /*C.NULL*/ { - return &Socket{c: c, s: s}, nil - } - return nil, casterr(err) -} - -type Socket struct { - // XXX Ensure the zmq context doesn't get destroyed underneath us. - c *Context - s unsafe.Pointer -} - -// Shutdown the socket. -// int zmq_close (void *s); -func (s *Socket) Close() error { - if s.c == nil { - return ENOTSOCK - } - if rc, err := C.zmq_close(s.s); rc != 0 { - return casterr(err) - } - s.c = nil - return nil -} - -// Set an int option on the socket. -// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); -func (s *Socket) SetSockOptInt(option IntSocketOption, value int) error { - val := C.int(value) - if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); rc != 0 { - return casterr(err) - } - return nil -} - -// Set an int64 option on the socket. -// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); -func (s *Socket) SetSockOptInt64(option Int64SocketOption, value int64) error { - if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&value), C.size_t(unsafe.Sizeof(value))); rc != 0 { - return casterr(err) - } - return nil -} - -// Set a uint64 option on the socket. -// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); -func (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error { - if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(&value), C.size_t(unsafe.Sizeof(value))); rc != 0 { - return casterr(err) - } - return nil -} - -// Set a string option on the socket. -// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); -func (s *Socket) SetSockOptString(option StringSocketOption, value string) error { - v := C.CString(value) - defer C.free(unsafe.Pointer(v)) - if rc, err := C.zmq_setsockopt(s.s, C.int(option), unsafe.Pointer(v), C.size_t(len(value))); rc != 0 { - return casterr(err) - } - return nil -} - -// Set a string option on the socket to nil. -// int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); -func (s *Socket) SetSockOptStringNil(option StringSocketOption) error { - if rc, err := C.zmq_setsockopt(s.s, C.int(option), nil, 0); rc != 0 { - return casterr(err) - } - return nil -} - -// Get an int option from the socket. -// int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen); -func (s *Socket) GetSockOptInt(option IntSocketOption) (value int, err error) { - size := C.size_t(unsafe.Sizeof(value)) - var rc C.int - if rc, err = C.zmq_getsockopt(s.s, C.int(option), unsafe.Pointer(&value), &size); rc != 0 { - err = casterr(err) - return - } - return -} - -// Get an int64 option from the socket. -// int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen); -func (s *Socket) GetSockOptInt64(option Int64SocketOption) (value int64, err error) { - size := C.size_t(unsafe.Sizeof(value)) - var rc C.int - if rc, err = C.zmq_getsockopt(s.s, C.int(option), unsafe.Pointer(&value), &size); rc != 0 { - err = casterr(err) - return - } - return -} - -// Get a uint64 option from the socket. -// int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen); -func (s *Socket) GetSockOptUInt64(option UInt64SocketOption) (value uint64, err error) { - size := C.size_t(unsafe.Sizeof(value)) - var rc C.int - if rc, err = C.zmq_getsockopt(s.s, C.int(option), unsafe.Pointer(&value), &size); rc != 0 { - println("GetSockOptUInt64:", err.Error()) - err = casterr(err) - return - } - return -} - -// Get a string option from the socket. -// int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen); -func (s *Socket) GetSockOptString(option StringSocketOption) (value string, err error) { - var buffer [1024]byte - var size C.size_t = 1024 - var rc C.int - if rc, err = C.zmq_getsockopt(s.s, C.int(option), unsafe.Pointer(&buffer), &size); rc != 0 { - err = casterr(err) - return - } - value = string(buffer[:size]) - return -} - -func (s *Socket) GetSockOptBool(option BoolSocketOption) (value bool, err error) { - size := C.size_t(unsafe.Sizeof(value)) - var rc C.int - if rc, err = C.zmq_getsockopt(s.s, C.int(option), unsafe.Pointer(&value), &size); rc != 0 { - err = casterr(err) - return - } - return -} - -// Bind the socket to a listening address. -// int zmq_bind (void *s, const char *addr); -func (s *Socket) Bind(address string) error { - a := C.CString(address) - defer C.free(unsafe.Pointer(a)) - if rc, err := C.zmq_bind(s.s, a); rc != 0 { - return casterr(err) - } - return nil -} - -// Connect the socket to an address. -// int zmq_connect (void *s, const char *addr); -func (s *Socket) Connect(address string) error { - if s.c == nil { - return ENOTSOCK - } - a := C.CString(address) - defer C.free(unsafe.Pointer(a)) - if rc, err := C.zmq_connect(s.s, a); rc != 0 { - return casterr(err) - } - return nil -} - -// Send a multipart message. -func (s *Socket) SendMultipart(parts [][]byte, flags SendRecvOption) (err error) { - for i := 0; i < len(parts)-1; i++ { - if err = s.Send(parts[i], SNDMORE|flags); err != nil { - return - } - } - err = s.Send(parts[(len(parts)-1)], flags) - return -} - -// Receive a multipart message. -func (s *Socket) RecvMultipart(flags SendRecvOption) (parts [][]byte, err error) { - parts = make([][]byte, 0) - for { - var data []byte - var more bool - - data, err = s.Recv(flags) - if err != nil { - return - } - parts = append(parts, data) - more, err = s.getRcvmore() - if err != nil { - return - } - if !more { - break - } - } - return -} - -// return the -func (s *Socket) apiSocket() unsafe.Pointer { - return s.s -} - -// Item to poll for read/write events on, either a *Socket or a file descriptor -type PollItem struct { - Socket *Socket // socket to poll for events on - Fd ZmqOsSocketType // fd to poll for events on as returned from os.File.Fd() - Events PollEvents // event set to poll for - REvents PollEvents // events that were present -} - -// a set of items to poll for events on -type PollItems []PollItem - -// Poll ZmqSockets and file descriptors for I/O readiness. Timeout is in -// time.Duration. The smallest possible timeout is time.Millisecond for -// ZeroMQ version 3 and above, and time.Microsecond for earlier versions. -func Poll(items []PollItem, timeout time.Duration) (count int, err error) { - zitems := make([]C.zmq_pollitem_t, len(items)) - for i, pi := range items { - zitems[i].socket = pi.Socket.apiSocket() - zitems[i].fd = pi.Fd.ToRaw() - zitems[i].events = C.short(pi.Events) - } - ztimeout := C.long(-1) - if timeout >= 0 { - ztimeout = C.long(uint64(timeout / pollunit)) - } - rc, err := C.zmq_poll(&zitems[0], C.int(len(zitems)), ztimeout) - if rc == -1 { - return 0, casterr(err) - } - - for i, zi := range zitems { - items[i].REvents = PollEvents(zi.revents) - } - - return int(rc), nil -} - -// run a zmq_device passing messages between in and out -func Device(t DeviceType, in, out *Socket) error { - if rc, err := C.zmq_device(C.int(t), in.apiSocket(), out.apiSocket()); rc != 0 { - return casterr(err) - } - return errors.New("zmq_device() returned unexpectedly.") -} - -// XXX For now, this library abstracts zmq_msg_t out of the API. -// int zmq_msg_init (zmq_msg_t *msg); -// int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -// int zmq_msg_close (zmq_msg_t *msg); -// size_t zmq_msg_size (zmq_msg_t *msg); -// void *zmq_msg_data (zmq_msg_t *msg); -// int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -// int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); diff --git a/vendor/github.com/alecthomas/gozmq/zmq_2_2.go b/vendor/github.com/alecthomas/gozmq/zmq_2_2.go deleted file mode 100644 index 66775e2..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_2_2.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build !zmq_2_1 - -/* - Copyright 2010-2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -*/ -import "C" - -const ( - RCVTIMEO = IntSocketOption(C.ZMQ_RCVTIMEO) - SNDTIMEO = IntSocketOption(C.ZMQ_SNDTIMEO) -) diff --git a/vendor/github.com/alecthomas/gozmq/zmq_2_x.go b/vendor/github.com/alecthomas/gozmq/zmq_2_x.go deleted file mode 100644 index 45be2ad..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_2_x.go +++ /dev/null @@ -1,110 +0,0 @@ -// +build !zmq_3_x,!zmq_4_x - -/* - Copyright 2010-2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -#include -#include -*/ -import "C" -import "unsafe" - -const ( - RCVMORE = UInt64SocketOption(C.ZMQ_RCVMORE) - RECOVERY_IVL_MSEC = Int64SocketOption(C.ZMQ_RECOVERY_IVL_MSEC) - SWAP = Int64SocketOption(C.ZMQ_SWAP) - MCAST_LOOP = Int64SocketOption(C.ZMQ_MCAST_LOOP) - HWM = UInt64SocketOption(C.ZMQ_HWM) - NOBLOCK = SendRecvOption(C.ZMQ_NOBLOCK) - - // Forwards-compatible aliases: - DONTWAIT = NOBLOCK -) - -// Get a context option. -func (c *Context) IOThreads() (int, error) { - return c.iothreads, nil -} - -// Set a context option. -func (c *Context) SetIOThreads(value int) error { - c.iothreads = value - return nil -} - -// Send a message to the socket. -// int zmq_send (void *s, zmq_msg_t *msg, int flags); -func (s *Socket) Send(data []byte, flags SendRecvOption) error { - var m C.zmq_msg_t - // Copy data array into C-allocated buffer. - size := C.size_t(len(data)) - - if rc, err := C.zmq_msg_init_size(&m, size); rc != 0 { - return casterr(err) - } - - if size > 0 { - // FIXME Ideally this wouldn't require a copy. - C.memcpy(C.zmq_msg_data(&m), unsafe.Pointer(&data[0]), size) // XXX I hope this works...(seems to) - } - - if rc, err := C.zmq_send(s.s, &m, C.int(flags)); rc != 0 { - // zmq_send did not take ownership, free message - C.zmq_msg_close(&m) - return casterr(err) - } - return nil -} - -// Receive a message from the socket. -// int zmq_recv (void *s, zmq_msg_t *msg, int flags); -func (s *Socket) Recv(flags SendRecvOption) (data []byte, err error) { - // Allocate and initialise a new zmq_msg_t - var m C.zmq_msg_t - var rc C.int - if rc, err = C.zmq_msg_init(&m); rc != 0 { - err = casterr(err) - return - } - defer C.zmq_msg_close(&m) - // Receive into message - if rc, err = C.zmq_recv(s.s, &m, C.int(flags)); rc != 0 { - err = casterr(err) - return - } - err = nil - // Copy message data into a byte array - // FIXME Ideally this wouldn't require a copy. - size := C.zmq_msg_size(&m) - if size > 0 { - data = C.GoBytes(C.zmq_msg_data(&m), C.int(size)) - } else { - data = nil - } - return -} - -// Portability helper -func (s *Socket) getRcvmore() (more bool, err error) { - value, err := s.GetSockOptUInt64(RCVMORE) - more = value != 0 - return -} diff --git a/vendor/github.com/alecthomas/gozmq/zmq_3_x.go b/vendor/github.com/alecthomas/gozmq/zmq_3_x.go deleted file mode 100644 index c1d0692..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_3_x.go +++ /dev/null @@ -1,237 +0,0 @@ -// +build zmq_3_x zmq_4_x - -/* - Copyright 2010-2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -#include -#include -*/ -import "C" -import ( - "errors" - "unsafe" -) - -const ( - RCVMORE = IntSocketOption(C.ZMQ_RCVMORE) - SNDHWM = IntSocketOption(C.ZMQ_SNDHWM) - RCVHWM = IntSocketOption(C.ZMQ_RCVHWM) - - // TODO Not documented in the man page... - //LAST_ENDPOINT = UInt64SocketOption(C.ZMQ_LAST_ENDPOINT) - DELAY_ATTACH_ON_CONNECT = IntSocketOption(C.ZMQ_DELAY_ATTACH_ON_CONNECT) - FAIL_UNROUTABLE = BoolSocketOption(C.ZMQ_FAIL_UNROUTABLE) - IPV4ONLY = IntSocketOption(C.ZMQ_IPV4ONLY) - MAXMSGSIZE = Int64SocketOption(C.ZMQ_MAXMSGSIZE) - ROUTER_MANDATORY = IntSocketOption(C.ZMQ_ROUTER_MANDATORY) - TCP_KEEPALIVE = IntSocketOption(C.ZMQ_TCP_KEEPALIVE) - TCP_KEEPALIVE_CNT = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_CNT) - TCP_KEEPALIVE_IDLE = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_IDLE) - TCP_KEEPALIVE_INTVL = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_INTVL) - TCP_ACCEPT_FILTER = StringSocketOption(C.ZMQ_TCP_ACCEPT_FILTER) - XPUB_VERBOSE = IntSocketOption(C.ZMQ_XPUB_VERBOSE) - - // Message options - MORE = MessageOption(C.ZMQ_MORE) - - // Send/recv options - DONTWAIT = SendRecvOption(C.ZMQ_DONTWAIT) - - // Deprecated aliases - NOBLOCK = DONTWAIT -) - -// Socket transport events -type Event int - -const ( - EVENT_CONNECTED = Event(C.ZMQ_EVENT_CONNECTED) - EVENT_CONNECT_DELAYED = Event(C.ZMQ_EVENT_CONNECT_DELAYED) - EVENT_CONNECT_RETRIED = Event(C.ZMQ_EVENT_CONNECT_RETRIED) - - EVENT_LISTENING = Event(C.ZMQ_EVENT_LISTENING) - EVENT_BIND_FAILED = Event(C.ZMQ_EVENT_BIND_FAILED) - - EVENT_ACCEPTED = Event(C.ZMQ_EVENT_ACCEPTED) - EVENT_ACCEPT_FAILED = Event(C.ZMQ_EVENT_ACCEPT_FAILED) - - EVENT_CLOSED = Event(C.ZMQ_EVENT_CLOSED) - EVENT_CLOSE_FAILED = Event(C.ZMQ_EVENT_CLOSE_FAILED) - EVENT_DISCONNECTED = Event(C.ZMQ_EVENT_DISCONNECTED) - - EVENT_ALL = EVENT_CONNECTED | EVENT_CONNECT_DELAYED | - EVENT_CONNECT_RETRIED | EVENT_LISTENING | EVENT_BIND_FAILED | - EVENT_ACCEPTED | EVENT_ACCEPT_FAILED | EVENT_CLOSED | - EVENT_CLOSE_FAILED | EVENT_DISCONNECTED -) - -// Get a context option. -// int zmq_ctx_get (void *c, int); -func (c *Context) get(option C.int) (int, error) { - if c.init(); c.err != nil { - return -1, c.err - } - var value C.int - var err error - if value, err = C.zmq_ctx_get(c.c, option); err != nil { - return -1, casterr(err) - } - return int(value), nil -} - -// Set a context option. -// int zmq_ctx_set (void *c, int, int); -func (c *Context) set(option C.int, value int) error { - if c.init(); c.err != nil { - return c.err - } - if rc, err := C.zmq_ctx_set(c.c, option, C.int(value)); rc == -1 { - return casterr(err) - } - return nil -} - -func (c *Context) IOThreads() (int, error) { - return c.get(C.ZMQ_IO_THREADS) -} - -func (c *Context) MaxSockets() (int, error) { - return c.get(C.ZMQ_MAX_SOCKETS) -} - -func (c *Context) SetIOThreads(value int) error { - return c.set(C.ZMQ_IO_THREADS, value) -} - -func (c *Context) SetMaxSockets(value int) error { - return c.set(C.ZMQ_MAX_SOCKETS, value) -} - -func (s *Socket) SetHWM(value int) error { - snd := s.SetSndHWM(value) - rcv := s.SetRcvHWM(value) - if snd != nil { - return snd - } - return rcv -} - -func (s *Socket) SetTCPAcceptFilterNil() error { - return s.SetSockOptStringNil(TCP_ACCEPT_FILTER) -} - -// Disconnect the socket from the address. -// int zmq_disconnect (void *s, const char *addr); -func (s *Socket) Disconnect(address string) error { - if s.c == nil { - return ENOTSOCK - } - a := C.CString(address) - defer C.free(unsafe.Pointer(a)) - if rc, err := C.zmq_disconnect(s.s, a); rc != 0 { - return casterr(err) - } - return nil -} - -// Send a message to the socket. -// int zmq_send (void *s, zmq_msg_t *msg, int flags); -func (s *Socket) Send(data []byte, flags SendRecvOption) error { - var m C.zmq_msg_t - // Copy data array into C-allocated buffer. - size := C.size_t(len(data)) - - if rc, err := C.zmq_msg_init_size(&m, size); rc != 0 { - return casterr(err) - } - - if size > 0 { - // FIXME Ideally this wouldn't require a copy. - C.memcpy(C.zmq_msg_data(&m), unsafe.Pointer(&data[0]), size) // XXX I hope this works...(seems to) - } - - if rc, err := C.zmq_sendmsg(s.s, &m, C.int(flags)); rc == -1 { - // zmq_send did not take ownership, free message - C.zmq_msg_close(&m) - return casterr(err) - } - return nil -} - -// Receive a message from the socket. -// int zmq_recv (void *s, zmq_msg_t *msg, int flags); -func (s *Socket) Recv(flags SendRecvOption) (data []byte, err error) { - // Allocate and initialise a new zmq_msg_t - var m C.zmq_msg_t - var rc C.int - if rc, err = C.zmq_msg_init(&m); rc != 0 { - err = casterr(err) - return - } - defer C.zmq_msg_close(&m) - // Receive into message - if rc, err = C.zmq_recvmsg(s.s, &m, C.int(flags)); rc == -1 { - err = casterr(err) - return - } - err = nil - // Copy message data into a byte array - // FIXME Ideally this wouldn't require a copy. - size := C.zmq_msg_size(&m) - if size > 0 { - data = C.GoBytes(C.zmq_msg_data(&m), C.int(size)) - } else { - data = nil - } - return -} - -// Register a monitoring callback endpoint. -// int zmq_socket_monitor (void *s, const char *addr, int events); -func (s *Socket) Monitor(address string, events Event) error { - a := C.CString(address) - defer C.free(unsafe.Pointer(a)) - - rc, err := C.zmq_socket_monitor(s.apiSocket(), a, C.int(events)) - if rc == -1 { - return casterr(err) - } - return nil -} - -// Portability helper -func (s *Socket) getRcvmore() (more bool, err error) { - value, err := s.GetSockOptInt(RCVMORE) - more = value != 0 - return -} - -// run a zmq_proxy with in, out and capture sockets -func Proxy(in, out, capture *Socket) error { - var c unsafe.Pointer - if capture != nil { - c = capture.apiSocket() - } - if rc, err := C.zmq_proxy(in.apiSocket(), out.apiSocket(), c); rc != 0 { - return casterr(err) - } - return errors.New("zmq_proxy() returned unexpectedly.") -} diff --git a/vendor/github.com/alecthomas/gozmq/zmq_4_x.go b/vendor/github.com/alecthomas/gozmq/zmq_4_x.go deleted file mode 100644 index 7fdacbc..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_4_x.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build zmq_4_x - -/* - Copyright 2010-2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -#include -#include -*/ -import "C" - -const ( - IPV6 = IntSocketOption(C.ZMQ_IPV6) - IMMEDIATE = IntSocketOption(C.ZMQ_IMMEDIATE) - MECHANISM = IntSocketOption(C.ZMQ_MECHANISM) - PLAIN_SERVER = IntSocketOption(C.ZMQ_PLAIN_SERVER) - PLAIN_USERNAME = StringSocketOption(C.ZMQ_PLAIN_USERNAME) - PLAIN_PASSWORD = StringSocketOption(C.ZMQ_PLAIN_PASSWORD) - CURVE_PUBLICKEY = StringSocketOption(C.ZMQ_CURVE_PUBLICKEY) - CURVE_SECRETKEY = StringSocketOption(C.ZMQ_CURVE_SECRETKEY) - CURVE_SERVERKEY = StringSocketOption(C.ZMQ_CURVE_SERVERKEY) - ZAP_DOMAIN = StringSocketOption(C.ZMQ_ZAP_DOMAIN) - ROUTER_RAW = IntSocketOption(C.ZMQ_ROUTER_RAW) - PROBE_ROUTER = IntSocketOption(C.ZMQ_PROBE_ROUTER) - REQ_CORRELATE = IntSocketOption(C.ZMQ_REQ_CORRELATE) - REQ_RELAXED = IntSocketOption(C.ZMQ_REQ_RELAXED) - CURVE_SERVER = IntSocketOption(C.ZMQ_CURVE_SERVER) - CONFLATE = IntSocketOption(C.ZMQ_CONFLATE) -) diff --git a/vendor/github.com/alecthomas/gozmq/zmq_unix.go b/vendor/github.com/alecthomas/gozmq/zmq_unix.go deleted file mode 100644 index 0c3d2fc..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_unix.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build darwin freebsd linux netbsd openbsd - -/* - Copyright 2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -*/ -import "C" - -type ZmqOsSocketType C.int - -func (self ZmqOsSocketType) ToRaw() C.int { - return C.int(self) -} diff --git a/vendor/github.com/alecthomas/gozmq/zmq_windows.go b/vendor/github.com/alecthomas/gozmq/zmq_windows.go deleted file mode 100644 index 8fb2f6f..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmq_windows.go +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright 2012 Alec Thomas - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package gozmq - -/* -#cgo !windows pkg-config: libzmq -#include -*/ -import "C" - -type ZmqOsSocketType C.SOCKET - -func (self ZmqOsSocketType) ToRaw() C.SOCKET { - return C.SOCKET(self) -} diff --git a/vendor/github.com/alecthomas/gozmq/zmqgen_2_1.go b/vendor/github.com/alecthomas/gozmq/zmqgen_2_1.go deleted file mode 100644 index 0eb1ae3..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmqgen_2_1.go +++ /dev/null @@ -1,272 +0,0 @@ -// +build zmq_2_1 -// - -package gozmq - -import ( - "time" -) - -// This file was generated automatically. Changes made here will be lost. - -// Socket Option Getters - -// ZMQ_TYPE: Retrieve socket type. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc3 -// -func (s *Socket) Type() (SocketType, error) { - value, err := s.GetSockOptUInt64(TYPE) - return SocketType(value), err -} - -// ZMQ_RCVMORE: More message parts to follow. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc4 -// -func (s *Socket) RcvMore() (bool, error) { - value, err := s.GetSockOptUInt64(RCVMORE) - return value != 0, err -} - -// ZMQ_HWM: Retrieve high water mark. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc5 -// -func (s *Socket) HWM() (uint64, error) { - return s.GetSockOptUInt64(HWM) -} - -// ZMQ_SWAP: Retrieve disk offload size. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc6 -// -func (s *Socket) Swap() (int64, error) { - return s.GetSockOptInt64(SWAP) -} - -// ZMQ_AFFINITY: Retrieve I/O thread affinity. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc7 -// -func (s *Socket) Affinity() (uint64, error) { - return s.GetSockOptUInt64(AFFINITY) -} - -// ZMQ_IDENTITY: Retrieve socket identity. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc8 -// -func (s *Socket) Identity() (string, error) { - return s.GetSockOptString(IDENTITY) -} - -// ZMQ_RATE: Retrieve multicast data rate. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc9 -// -func (s *Socket) Rate() (int64, error) { - return s.GetSockOptInt64(RATE) -} - -// ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc11 -// -func (s *Socket) RecoveryIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt64(RECOVERY_IVL_MSEC) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_MCAST_LOOP: Control multicast loop-back. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc12 -// -func (s *Socket) McastLoop() (bool, error) { - value, err := s.GetSockOptInt64(MCAST_LOOP) - return value != 0, err -} - -// ZMQ_SNDBUF: Retrieve kernel transmit buffer size. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc13 -// -func (s *Socket) SndBuf() (uint64, error) { - return s.GetSockOptUInt64(SNDBUF) -} - -// ZMQ_RCVBUF: Retrieve kernel receive buffer size. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc14 -// -func (s *Socket) RcvBuf() (uint64, error) { - return s.GetSockOptUInt64(RCVBUF) -} - -// ZMQ_LINGER: Retrieve linger period for socket shutdown. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc15 -// -func (s *Socket) Linger() (time.Duration, error) { - ms, err := s.GetSockOptInt(LINGER) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL: Retrieve reconnection interval. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc16 -// -func (s *Socket) ReconnectIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc17 -// -func (s *Socket) ReconnectIvlMax() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL_MAX) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc18 -// -func (s *Socket) Backlog() (int, error) { - return s.GetSockOptInt(BACKLOG) -} - -// ZMQ_EVENTS: Retrieve socket event state. -// -// See: http://api.zeromq.org/2.1:zmq-getsockopt#toc20 -// -func (s *Socket) Events() (uint64, error) { - return s.GetSockOptUInt64(EVENTS) -} - -// Socket Option Setters - -// ZMQ_HWM: Set high water mark. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc3 -// -func (s *Socket) SetHWM(value uint64) error { - return s.SetSockOptUInt64(HWM, value) -} - -// ZMQ_SWAP: Set disk offload size. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc4 -// -func (s *Socket) SetSwap(value int64) error { - return s.SetSockOptInt64(SWAP, value) -} - -// ZMQ_AFFINITY: Set I/O thread affinity. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc5 -// -func (s *Socket) SetAffinity(value uint64) error { - return s.SetSockOptUInt64(AFFINITY, value) -} - -// ZMQ_IDENTITY: Set socket identity. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc6 -// -func (s *Socket) SetIdentity(value string) error { - return s.SetSockOptString(IDENTITY, value) -} - -// ZMQ_SUBSCRIBE: Establish message filter. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc7 -// -func (s *Socket) SetSubscribe(value string) error { - return s.SetSockOptString(SUBSCRIBE, value) -} - -// ZMQ_UNSUBSCRIBE: Remove message filter. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc8 -// -func (s *Socket) SetUnsubscribe(value string) error { - return s.SetSockOptString(UNSUBSCRIBE, value) -} - -// ZMQ_RATE: Set multicast data rate. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc9 -// -func (s *Socket) SetRate(value int64) error { - return s.SetSockOptInt64(RATE, value) -} - -// ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc11 -// -func (s *Socket) SetRecoveryIvl(value time.Duration) error { - return s.SetSockOptInt64(RECOVERY_IVL_MSEC, int64(value/time.Millisecond)) -} - -// ZMQ_MCAST_LOOP: Control multicast loop-back. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc12 -// -func (s *Socket) SetMcastLoop(value bool) error { - if value { - return s.SetSockOptInt64(MCAST_LOOP, 1) - } - return s.SetSockOptInt64(MCAST_LOOP, 0) -} - -// ZMQ_SNDBUF: Set kernel transmit buffer size. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc13 -// -func (s *Socket) SetSndBuf(value uint64) error { - return s.SetSockOptUInt64(SNDBUF, value) -} - -// ZMQ_RCVBUF: Set kernel receive buffer size. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc14 -// -func (s *Socket) SetRcvBuf(value uint64) error { - return s.SetSockOptUInt64(RCVBUF, value) -} - -// ZMQ_LINGER: Set linger period for socket shutdown. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc15 -// -func (s *Socket) SetLinger(value time.Duration) error { - return s.SetSockOptInt(LINGER, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL: Set reconnection interval. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc16 -// -func (s *Socket) SetReconnectIvl(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc17 -// -func (s *Socket) SetReconnectIvlMax(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL_MAX, int(value/time.Millisecond)) -} - -// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/2.1:zmq-setsockopt#toc18 -// -func (s *Socket) SetBacklog(value int) error { - return s.SetSockOptInt(BACKLOG, value) -} diff --git a/vendor/github.com/alecthomas/gozmq/zmqgen_2_2.go b/vendor/github.com/alecthomas/gozmq/zmqgen_2_2.go deleted file mode 100644 index 77cbadd..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmqgen_2_2.go +++ /dev/null @@ -1,306 +0,0 @@ -// +build !zmq_2_1,!zmq_3_x,!zmq_4_x -// - -package gozmq - -import ( - "time" -) - -// This file was generated automatically. Changes made here will be lost. - -// Socket Option Getters - -// ZMQ_TYPE: Retrieve socket type. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc3 -// -func (s *Socket) Type() (SocketType, error) { - value, err := s.GetSockOptUInt64(TYPE) - return SocketType(value), err -} - -// ZMQ_RCVMORE: More message parts to follow. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc4 -// -func (s *Socket) RcvMore() (bool, error) { - value, err := s.GetSockOptUInt64(RCVMORE) - return value != 0, err -} - -// ZMQ_HWM: Retrieve high water mark. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc5 -// -func (s *Socket) HWM() (uint64, error) { - return s.GetSockOptUInt64(HWM) -} - -// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc6 -// -func (s *Socket) RcvTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(RCVTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc7 -// -func (s *Socket) SndTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(SNDTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SWAP: Retrieve disk offload size. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc8 -// -func (s *Socket) Swap() (int64, error) { - return s.GetSockOptInt64(SWAP) -} - -// ZMQ_AFFINITY: Retrieve I/O thread affinity. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc9 -// -func (s *Socket) Affinity() (uint64, error) { - return s.GetSockOptUInt64(AFFINITY) -} - -// ZMQ_IDENTITY: Retrieve socket identity. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc10 -// -func (s *Socket) Identity() (string, error) { - return s.GetSockOptString(IDENTITY) -} - -// ZMQ_RATE: Retrieve multicast data rate. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc11 -// -func (s *Socket) Rate() (int64, error) { - return s.GetSockOptInt64(RATE) -} - -// ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc13 -// -func (s *Socket) RecoveryIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt64(RECOVERY_IVL_MSEC) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_MCAST_LOOP: Control multicast loop-back. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc14 -// -func (s *Socket) McastLoop() (bool, error) { - value, err := s.GetSockOptInt64(MCAST_LOOP) - return value != 0, err -} - -// ZMQ_SNDBUF: Retrieve kernel transmit buffer size. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc15 -// -func (s *Socket) SndBuf() (uint64, error) { - return s.GetSockOptUInt64(SNDBUF) -} - -// ZMQ_RCVBUF: Retrieve kernel receive buffer size. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc16 -// -func (s *Socket) RcvBuf() (uint64, error) { - return s.GetSockOptUInt64(RCVBUF) -} - -// ZMQ_LINGER: Retrieve linger period for socket shutdown. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc17 -// -func (s *Socket) Linger() (time.Duration, error) { - ms, err := s.GetSockOptInt(LINGER) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL: Retrieve reconnection interval. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc18 -// -func (s *Socket) ReconnectIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc19 -// -func (s *Socket) ReconnectIvlMax() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL_MAX) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc20 -// -func (s *Socket) Backlog() (int, error) { - return s.GetSockOptInt(BACKLOG) -} - -// ZMQ_EVENTS: Retrieve socket event state. -// -// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc22 -// -func (s *Socket) Events() (uint64, error) { - return s.GetSockOptUInt64(EVENTS) -} - -// Socket Option Setters - -// ZMQ_HWM: Set high water mark. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc3 -// -func (s *Socket) SetHWM(value uint64) error { - return s.SetSockOptUInt64(HWM, value) -} - -// ZMQ_SWAP: Set disk offload size. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc4 -// -func (s *Socket) SetSwap(value int64) error { - return s.SetSockOptInt64(SWAP, value) -} - -// ZMQ_AFFINITY: Set I/O thread affinity. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc5 -// -func (s *Socket) SetAffinity(value uint64) error { - return s.SetSockOptUInt64(AFFINITY, value) -} - -// ZMQ_IDENTITY: Set socket identity. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc6 -// -func (s *Socket) SetIdentity(value string) error { - return s.SetSockOptString(IDENTITY, value) -} - -// ZMQ_SUBSCRIBE: Establish message filter. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc7 -// -func (s *Socket) SetSubscribe(value string) error { - return s.SetSockOptString(SUBSCRIBE, value) -} - -// ZMQ_UNSUBSCRIBE: Remove message filter. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc8 -// -func (s *Socket) SetUnsubscribe(value string) error { - return s.SetSockOptString(UNSUBSCRIBE, value) -} - -// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc9 -// -func (s *Socket) SetRcvTimeout(value time.Duration) error { - return s.SetSockOptInt(RCVTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc10 -// -func (s *Socket) SetSndTimeout(value time.Duration) error { - return s.SetSockOptInt(SNDTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_RATE: Set multicast data rate. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc11 -// -func (s *Socket) SetRate(value int64) error { - return s.SetSockOptInt64(RATE, value) -} - -// ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc13 -// -func (s *Socket) SetRecoveryIvl(value time.Duration) error { - return s.SetSockOptInt64(RECOVERY_IVL_MSEC, int64(value/time.Millisecond)) -} - -// ZMQ_MCAST_LOOP: Control multicast loop-back. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc14 -// -func (s *Socket) SetMcastLoop(value bool) error { - if value { - return s.SetSockOptInt64(MCAST_LOOP, 1) - } - return s.SetSockOptInt64(MCAST_LOOP, 0) -} - -// ZMQ_SNDBUF: Set kernel transmit buffer size. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc15 -// -func (s *Socket) SetSndBuf(value uint64) error { - return s.SetSockOptUInt64(SNDBUF, value) -} - -// ZMQ_RCVBUF: Set kernel receive buffer size. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc16 -// -func (s *Socket) SetRcvBuf(value uint64) error { - return s.SetSockOptUInt64(RCVBUF, value) -} - -// ZMQ_LINGER: Set linger period for socket shutdown. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc17 -// -func (s *Socket) SetLinger(value time.Duration) error { - return s.SetSockOptInt(LINGER, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL: Set reconnection interval. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc18 -// -func (s *Socket) SetReconnectIvl(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc19 -// -func (s *Socket) SetReconnectIvlMax(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL_MAX, int(value/time.Millisecond)) -} - -// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc20 -// -func (s *Socket) SetBacklog(value int) error { - return s.SetSockOptInt(BACKLOG, value) -} diff --git a/vendor/github.com/alecthomas/gozmq/zmqgen_3_2.go b/vendor/github.com/alecthomas/gozmq/zmqgen_3_2.go deleted file mode 100644 index 41683a5..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmqgen_3_2.go +++ /dev/null @@ -1,436 +0,0 @@ -// +build zmq_3_x -// - -package gozmq - -import ( - "time" -) - -// This file was generated automatically. Changes made here will be lost. - -// Socket Option Getters - -// ZMQ_TYPE: Retrieve socket type. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc3 -// -func (s *Socket) Type() (SocketType, error) { - value, err := s.GetSockOptUInt64(TYPE) - return SocketType(value), err -} - -// ZMQ_RCVMORE: More message data parts to follow. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc4 -// -func (s *Socket) RcvMore() (bool, error) { - value, err := s.GetSockOptInt(RCVMORE) - return value != 0, err -} - -// ZMQ_SNDHWM: Retrieves high water mark for outbound messages. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc5 -// -func (s *Socket) SndHWM() (int, error) { - return s.GetSockOptInt(SNDHWM) -} - -// ZMQ_RCVHWM: Retrieve high water mark for inbound messages. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc6 -// -func (s *Socket) RcvHWM() (int, error) { - return s.GetSockOptInt(RCVHWM) -} - -// ZMQ_AFFINITY: Retrieve I/O thread affinity. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc7 -// -func (s *Socket) Affinity() (uint64, error) { - return s.GetSockOptUInt64(AFFINITY) -} - -// ZMQ_IDENTITY: Set socket identity. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc8 -// -func (s *Socket) Identity() (string, error) { - return s.GetSockOptString(IDENTITY) -} - -// ZMQ_RATE: Retrieve multicast data rate. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc9 -// -func (s *Socket) Rate() (int64, error) { - return s.GetSockOptInt64(RATE) -} - -// ZMQ_RECOVERY_IVL: Get multicast recovery interval. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc10 -// -func (s *Socket) RecoveryIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt64(RECOVERY_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SNDBUF: Retrieve kernel transmit buffer size. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc11 -// -func (s *Socket) SndBuf() (uint64, error) { - return s.GetSockOptUInt64(SNDBUF) -} - -// ZMQ_RCVBUF: Retrieve kernel receive buffer size. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc12 -// -func (s *Socket) RcvBuf() (uint64, error) { - return s.GetSockOptUInt64(RCVBUF) -} - -// ZMQ_LINGER: Retrieve linger period for socket shutdown. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc13 -// -func (s *Socket) Linger() (time.Duration, error) { - ms, err := s.GetSockOptInt(LINGER) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL: Retrieve reconnection interval. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc14 -// -func (s *Socket) ReconnectIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc15 -// -func (s *Socket) ReconnectIvlMax() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL_MAX) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc16 -// -func (s *Socket) Backlog() (int, error) { - return s.GetSockOptInt(BACKLOG) -} - -// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc17 -// -func (s *Socket) MaxMsgSize() (int64, error) { - return s.GetSockOptInt64(MAXMSGSIZE) -} - -// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc19 -// -func (s *Socket) RcvTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(RCVTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc20 -// -func (s *Socket) SndTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(SNDTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_IPV4ONLY: Retrieve IPv4-only socket override status. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc21 -// -func (s *Socket) IPv4Only() (bool, error) { - value, err := s.GetSockOptInt(IPV4ONLY) - return value != 0, err -} - -// ZMQ_DELAY_ATTACH_ON_CONNECT: Retrieve attach-on-connect value. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc22 -// -func (s *Socket) DelayAttachOnConnect() (bool, error) { - value, err := s.GetSockOptInt(DELAY_ATTACH_ON_CONNECT) - return value != 0, err -} - -// ZMQ_EVENTS: Retrieve socket event state. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc24 -// -func (s *Socket) Events() (uint64, error) { - return s.GetSockOptUInt64(EVENTS) -} - -// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc26 -// -func (s *Socket) TCPKeepalive() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE) -} - -// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS). -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc27 -// -func (s *Socket) TCPKeepaliveIdle() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_IDLE) -} - -// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc28 -// -func (s *Socket) TCPKeepaliveCnt() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_CNT) -} - -// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. -// -// See: http://api.zeromq.org/3.2:zmq-getsockopt#toc29 -// -func (s *Socket) TCPKeepaliveIntvl() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_INTVL) -} - -// Socket Option Setters - -// ZMQ_SNDHWM: Set high water mark for outbound messages. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc3 -// -func (s *Socket) SetSndHWM(value int) error { - return s.SetSockOptInt(SNDHWM, value) -} - -// ZMQ_RCVHWM: Set high water mark for inbound messages. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc4 -// -func (s *Socket) SetRcvHWM(value int) error { - return s.SetSockOptInt(RCVHWM, value) -} - -// ZMQ_AFFINITY: Set I/O thread affinity. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc5 -// -func (s *Socket) SetAffinity(value uint64) error { - return s.SetSockOptUInt64(AFFINITY, value) -} - -// ZMQ_SUBSCRIBE: Establish message filter. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc6 -// -func (s *Socket) SetSubscribe(value string) error { - return s.SetSockOptString(SUBSCRIBE, value) -} - -// ZMQ_UNSUBSCRIBE: Remove message filter. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc7 -// -func (s *Socket) SetUnsubscribe(value string) error { - return s.SetSockOptString(UNSUBSCRIBE, value) -} - -// ZMQ_IDENTITY: Set socket identity. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc8 -// -func (s *Socket) SetIdentity(value string) error { - return s.SetSockOptString(IDENTITY, value) -} - -// ZMQ_RATE: Set multicast data rate. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc9 -// -func (s *Socket) SetRate(value int64) error { - return s.SetSockOptInt64(RATE, value) -} - -// ZMQ_RECOVERY_IVL: Set multicast recovery interval. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc10 -// -func (s *Socket) SetRecoveryIvl(value time.Duration) error { - return s.SetSockOptInt64(RECOVERY_IVL, int64(value/time.Millisecond)) -} - -// ZMQ_SNDBUF: Set kernel transmit buffer size. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc11 -// -func (s *Socket) SetSndBuf(value uint64) error { - return s.SetSockOptUInt64(SNDBUF, value) -} - -// ZMQ_RCVBUF: Set kernel receive buffer size. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc12 -// -func (s *Socket) SetRcvBuf(value uint64) error { - return s.SetSockOptUInt64(RCVBUF, value) -} - -// ZMQ_LINGER: Set linger period for socket shutdown. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc13 -// -func (s *Socket) SetLinger(value time.Duration) error { - return s.SetSockOptInt(LINGER, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL: Set reconnection interval. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc14 -// -func (s *Socket) SetReconnectIvl(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc15 -// -func (s *Socket) SetReconnectIvlMax(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL_MAX, int(value/time.Millisecond)) -} - -// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc16 -// -func (s *Socket) SetBacklog(value int) error { - return s.SetSockOptInt(BACKLOG, value) -} - -// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc17 -// -func (s *Socket) SetMaxMsgSize(value int64) error { - return s.SetSockOptInt64(MAXMSGSIZE, value) -} - -// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc19 -// -func (s *Socket) SetRcvTimeout(value time.Duration) error { - return s.SetSockOptInt(RCVTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc20 -// -func (s *Socket) SetSndTimeout(value time.Duration) error { - return s.SetSockOptInt(SNDTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_IPV4ONLY: Use IPv4-only sockets. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc21 -// -func (s *Socket) SetIPv4Only(value bool) error { - if value { - return s.SetSockOptInt(IPV4ONLY, 1) - } - return s.SetSockOptInt(IPV4ONLY, 0) -} - -// ZMQ_DELAY_ATTACH_ON_CONNECT: Accept messages only when connections are made. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc22 -// -func (s *Socket) SetDelayAttachOnConnect(value bool) error { - if value { - return s.SetSockOptInt(DELAY_ATTACH_ON_CONNECT, 1) - } - return s.SetSockOptInt(DELAY_ATTACH_ON_CONNECT, 0) -} - -// ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc23 -// -func (s *Socket) SetROUTERMandatory(value bool) error { - if value { - return s.SetSockOptInt(ROUTER_MANDATORY, 1) - } - return s.SetSockOptInt(ROUTER_MANDATORY, 0) -} - -// ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc24 -// -func (s *Socket) SetXPUBVerbose(value bool) error { - if value { - return s.SetSockOptInt(XPUB_VERBOSE, 1) - } - return s.SetSockOptInt(XPUB_VERBOSE, 0) -} - -// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc25 -// -func (s *Socket) SetTCPKeepalive(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE, value) -} - -// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS). -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc26 -// -func (s *Socket) SetTCPKeepaliveIdle(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_IDLE, value) -} - -// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc27 -// -func (s *Socket) SetTCPKeepaliveCnt(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_CNT, value) -} - -// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc28 -// -func (s *Socket) SetTCPKeepaliveIntvl(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_INTVL, value) -} - -// ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections. -// -// See: http://api.zeromq.org/3.2:zmq-setsockopt#toc29 -// -func (s *Socket) SetTCPAcceptFilter(value string) error { - return s.SetSockOptString(TCP_ACCEPT_FILTER, value) -} diff --git a/vendor/github.com/alecthomas/gozmq/zmqgen_4_0.go b/vendor/github.com/alecthomas/gozmq/zmqgen_4_0.go deleted file mode 100644 index d9c6587..0000000 --- a/vendor/github.com/alecthomas/gozmq/zmqgen_4_0.go +++ /dev/null @@ -1,627 +0,0 @@ -// +build zmq_4_x -// - -package gozmq - -import ( - "time" -) - -// This file was generated automatically. Changes made here will be lost. - -// Socket Option Getters - -// ZMQ_TYPE: Retrieve socket type. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc3 -// -func (s *Socket) Type() (SocketType, error) { - value, err := s.GetSockOptUInt64(TYPE) - return SocketType(value), err -} - -// ZMQ_RCVMORE: More message data parts to follow. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc4 -// -func (s *Socket) RcvMore() (bool, error) { - value, err := s.GetSockOptInt(RCVMORE) - return value != 0, err -} - -// ZMQ_SNDHWM: Retrieves high water mark for outbound messages. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc5 -// -func (s *Socket) SndHWM() (int, error) { - return s.GetSockOptInt(SNDHWM) -} - -// ZMQ_RCVHWM: Retrieve high water mark for inbound messages. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc6 -// -func (s *Socket) RcvHWM() (int, error) { - return s.GetSockOptInt(RCVHWM) -} - -// ZMQ_AFFINITY: Retrieve I/O thread affinity. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc7 -// -func (s *Socket) Affinity() (uint64, error) { - return s.GetSockOptUInt64(AFFINITY) -} - -// ZMQ_IDENTITY: Retrieve socket identity. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc8 -// -func (s *Socket) Identity() (string, error) { - return s.GetSockOptString(IDENTITY) -} - -// ZMQ_RATE: Retrieve multicast data rate. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc9 -// -func (s *Socket) Rate() (int64, error) { - return s.GetSockOptInt64(RATE) -} - -// ZMQ_RECOVERY_IVL: Get multicast recovery interval. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc10 -// -func (s *Socket) RecoveryIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt64(RECOVERY_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SNDBUF: Retrieve kernel transmit buffer size. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc11 -// -func (s *Socket) SndBuf() (uint64, error) { - return s.GetSockOptUInt64(SNDBUF) -} - -// ZMQ_RCVBUF: Retrieve kernel receive buffer size. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc12 -// -func (s *Socket) RcvBuf() (uint64, error) { - return s.GetSockOptUInt64(RCVBUF) -} - -// ZMQ_LINGER: Retrieve linger period for socket shutdown. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc13 -// -func (s *Socket) Linger() (time.Duration, error) { - ms, err := s.GetSockOptInt(LINGER) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL: Retrieve reconnection interval. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc14 -// -func (s *Socket) ReconnectIvl() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc15 -// -func (s *Socket) ReconnectIvlMax() (time.Duration, error) { - ms, err := s.GetSockOptInt(RECONNECT_IVL_MAX) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc16 -// -func (s *Socket) Backlog() (int, error) { - return s.GetSockOptInt(BACKLOG) -} - -// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc17 -// -func (s *Socket) MaxMsgSize() (int64, error) { - return s.GetSockOptInt64(MAXMSGSIZE) -} - -// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc19 -// -func (s *Socket) RcvTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(RCVTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc20 -// -func (s *Socket) SndTimeout() (time.Duration, error) { - ms, err := s.GetSockOptInt(SNDTIMEO) - return time.Duration(ms) * time.Millisecond, err -} - -// ZMQ_IPV6: Retrieve IPv6 socket status. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc21 -// -func (s *Socket) Ipv6() (bool, error) { - value, err := s.GetSockOptInt(IPV6) - return value != 0, err -} - -// ZMQ_IPV4ONLY: Retrieve IPv4-only socket override status. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc22 -// -func (s *Socket) IPv4Only() (bool, error) { - value, err := s.GetSockOptInt(IPV4ONLY) - return value != 0, err -} - -// ZMQ_IMMEDIATE: Retrieve attach-on-connect value. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc23 -// -func (s *Socket) Immediate() (bool, error) { - value, err := s.GetSockOptInt(IMMEDIATE) - return value != 0, err -} - -// ZMQ_EVENTS: Retrieve socket event state. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc25 -// -func (s *Socket) Events() (uint64, error) { - return s.GetSockOptUInt64(EVENTS) -} - -// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc27 -// -func (s *Socket) TCPKeepalive() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE) -} - -// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS). -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc28 -// -func (s *Socket) TCPKeepaliveIdle() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_IDLE) -} - -// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc29 -// -func (s *Socket) TCPKeepaliveCnt() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_CNT) -} - -// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc30 -// -func (s *Socket) TCPKeepaliveIntvl() (int, error) { - return s.GetSockOptInt(TCP_KEEPALIVE_INTVL) -} - -// ZMQ_MECHANISM: Retrieve current security mechanism. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc31 -// -func (s *Socket) Mechanism() (int, error) { - return s.GetSockOptInt(MECHANISM) -} - -// ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc32 -// -func (s *Socket) PlainServer() (int, error) { - return s.GetSockOptInt(PLAIN_SERVER) -} - -// ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc33 -// -func (s *Socket) PlainUsername() (string, error) { - return s.GetSockOptString(PLAIN_USERNAME) -} - -// ZMQ_PLAIN_PASSWORD: Retrieve current password. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc34 -// -func (s *Socket) PlainPassword() (string, error) { - return s.GetSockOptString(PLAIN_PASSWORD) -} - -// ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc35 -// -func (s *Socket) CurvePublickey() (string, error) { - return s.GetSockOptString(CURVE_PUBLICKEY) -} - -// ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc36 -// -func (s *Socket) CurveSecretkey() (string, error) { - return s.GetSockOptString(CURVE_SECRETKEY) -} - -// ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc37 -// -func (s *Socket) CurveServerkey() (string, error) { - return s.GetSockOptString(CURVE_SERVERKEY) -} - -// ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain. -// -// See: http://api.zeromq.org/4.0:zmq-getsockopt#toc38 -// -func (s *Socket) ZapDomain() (string, error) { - return s.GetSockOptString(ZAP_DOMAIN) -} - -// Socket Option Setters - -// ZMQ_SNDHWM: Set high water mark for outbound messages. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc3 -// -func (s *Socket) SetSndHWM(value int) error { - return s.SetSockOptInt(SNDHWM, value) -} - -// ZMQ_RCVHWM: Set high water mark for inbound messages. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc4 -// -func (s *Socket) SetRcvHWM(value int) error { - return s.SetSockOptInt(RCVHWM, value) -} - -// ZMQ_AFFINITY: Set I/O thread affinity. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc5 -// -func (s *Socket) SetAffinity(value uint64) error { - return s.SetSockOptUInt64(AFFINITY, value) -} - -// ZMQ_SUBSCRIBE: Establish message filter. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc6 -// -func (s *Socket) SetSubscribe(value string) error { - return s.SetSockOptString(SUBSCRIBE, value) -} - -// ZMQ_UNSUBSCRIBE: Remove message filter. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc7 -// -func (s *Socket) SetUnsubscribe(value string) error { - return s.SetSockOptString(UNSUBSCRIBE, value) -} - -// ZMQ_IDENTITY: Set socket identity. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc8 -// -func (s *Socket) SetIdentity(value string) error { - return s.SetSockOptString(IDENTITY, value) -} - -// ZMQ_RATE: Set multicast data rate. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc9 -// -func (s *Socket) SetRate(value int64) error { - return s.SetSockOptInt64(RATE, value) -} - -// ZMQ_RECOVERY_IVL: Set multicast recovery interval. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc10 -// -func (s *Socket) SetRecoveryIvl(value time.Duration) error { - return s.SetSockOptInt64(RECOVERY_IVL, int64(value/time.Millisecond)) -} - -// ZMQ_SNDBUF: Set kernel transmit buffer size. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc11 -// -func (s *Socket) SetSndBuf(value uint64) error { - return s.SetSockOptUInt64(SNDBUF, value) -} - -// ZMQ_RCVBUF: Set kernel receive buffer size. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc12 -// -func (s *Socket) SetRcvBuf(value uint64) error { - return s.SetSockOptUInt64(RCVBUF, value) -} - -// ZMQ_LINGER: Set linger period for socket shutdown. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc13 -// -func (s *Socket) SetLinger(value time.Duration) error { - return s.SetSockOptInt(LINGER, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL: Set reconnection interval. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc14 -// -func (s *Socket) SetReconnectIvl(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL, int(value/time.Millisecond)) -} - -// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc15 -// -func (s *Socket) SetReconnectIvlMax(value time.Duration) error { - return s.SetSockOptInt(RECONNECT_IVL_MAX, int(value/time.Millisecond)) -} - -// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc16 -// -func (s *Socket) SetBacklog(value int) error { - return s.SetSockOptInt(BACKLOG, value) -} - -// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc17 -// -func (s *Socket) SetMaxMsgSize(value int64) error { - return s.SetSockOptInt64(MAXMSGSIZE, value) -} - -// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc19 -// -func (s *Socket) SetRcvTimeout(value time.Duration) error { - return s.SetSockOptInt(RCVTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc20 -// -func (s *Socket) SetSndTimeout(value time.Duration) error { - return s.SetSockOptInt(SNDTIMEO, int(value/time.Millisecond)) -} - -// ZMQ_IPV6: Enable IPv6 on socket. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc21 -// -func (s *Socket) SetIpv6(value bool) error { - if value { - return s.SetSockOptInt(IPV6, 1) - } - return s.SetSockOptInt(IPV6, 0) -} - -// ZMQ_IPV4ONLY: Use IPv4-only on socket. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc22 -// -func (s *Socket) SetIPv4Only(value bool) error { - if value { - return s.SetSockOptInt(IPV4ONLY, 1) - } - return s.SetSockOptInt(IPV4ONLY, 0) -} - -// ZMQ_IMMEDIATE: Queue messages only to completed connections. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc23 -// -func (s *Socket) SetImmediate(value bool) error { - if value { - return s.SetSockOptInt(IMMEDIATE, 1) - } - return s.SetSockOptInt(IMMEDIATE, 0) -} - -// ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc24 -// -func (s *Socket) SetROUTERMandatory(value bool) error { - if value { - return s.SetSockOptInt(ROUTER_MANDATORY, 1) - } - return s.SetSockOptInt(ROUTER_MANDATORY, 0) -} - -// ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc25 -// -func (s *Socket) SetROUTERRaw(value int) error { - return s.SetSockOptInt(ROUTER_RAW, value) -} - -// ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc26 -// -func (s *Socket) SetProbeROUTER(value int) error { - return s.SetSockOptInt(PROBE_ROUTER, value) -} - -// ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc27 -// -func (s *Socket) SetXPUBVerbose(value bool) error { - if value { - return s.SetSockOptInt(XPUB_VERBOSE, 1) - } - return s.SetSockOptInt(XPUB_VERBOSE, 0) -} - -// ZMQ_REQ_CORRELATE: match replies with requests. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc28 -// -func (s *Socket) SetReqCorrelate(value int) error { - return s.SetSockOptInt(REQ_CORRELATE, value) -} - -// ZMQ_REQ_RELAXED: relax strict alternation between request and reply. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc29 -// -func (s *Socket) SetReqRelaxed(value int) error { - return s.SetSockOptInt(REQ_RELAXED, value) -} - -// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc30 -// -func (s *Socket) SetTCPKeepalive(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE, value) -} - -// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT (or TCP_KEEPALIVE on some OS). -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc31 -// -func (s *Socket) SetTCPKeepaliveIdle(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_IDLE, value) -} - -// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc32 -// -func (s *Socket) SetTCPKeepaliveCnt(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_CNT, value) -} - -// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc33 -// -func (s *Socket) SetTCPKeepaliveIntvl(value int) error { - return s.SetSockOptInt(TCP_KEEPALIVE_INTVL, value) -} - -// ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc34 -// -func (s *Socket) SetTCPAcceptFilter(value string) error { - return s.SetSockOptString(TCP_ACCEPT_FILTER, value) -} - -// ZMQ_PLAIN_SERVER: Set PLAIN server role. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc35 -// -func (s *Socket) SetPlainServer(value int) error { - return s.SetSockOptInt(PLAIN_SERVER, value) -} - -// ZMQ_PLAIN_USERNAME: Set PLAIN security username. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc36 -// -func (s *Socket) SetPlainUsername(value string) error { - return s.SetSockOptString(PLAIN_USERNAME, value) -} - -// ZMQ_PLAIN_PASSWORD: Set PLAIN security password. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc37 -// -func (s *Socket) SetPlainPassword(value string) error { - return s.SetSockOptString(PLAIN_PASSWORD, value) -} - -// ZMQ_CURVE_SERVER: Set CURVE server role. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc38 -// -func (s *Socket) SetCurveServer(value int) error { - return s.SetSockOptInt(CURVE_SERVER, value) -} - -// ZMQ_CURVE_PUBLICKEY: Set CURVE public key. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc39 -// -func (s *Socket) SetCurvePublickey(value string) error { - return s.SetSockOptString(CURVE_PUBLICKEY, value) -} - -// ZMQ_CURVE_SECRETKEY: Set CURVE secret key. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc40 -// -func (s *Socket) SetCurveSecretkey(value string) error { - return s.SetSockOptString(CURVE_SECRETKEY, value) -} - -// ZMQ_CURVE_SERVERKEY: Set CURVE server key. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc41 -// -func (s *Socket) SetCurveServerkey(value string) error { - return s.SetSockOptString(CURVE_SERVERKEY, value) -} - -// ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc42 -// -func (s *Socket) SetZapDomain(value string) error { - return s.SetSockOptString(ZAP_DOMAIN, value) -} - -// ZMQ_CONFLATE: Keep only last message. -// -// See: http://api.zeromq.org/4.0:zmq-setsockopt#toc43 -// -func (s *Socket) SetConflate(value bool) error { - if value { - return s.SetSockOptInt(CONFLATE, 1) - } - return s.SetSockOptInt(CONFLATE, 0) -} diff --git a/vendor/github.com/cosmos72/gomacro/.gitignore b/vendor/github.com/cosmos72/gomacro/.gitignore new file mode 100644 index 0000000..8c3cff0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/.gitignore @@ -0,0 +1,4 @@ +gomacro +*.exe +*.test +examples/examples diff --git a/vendor/github.com/cosmos72/gomacro/LICENSE b/vendor/github.com/cosmos72/gomacro/LICENSE new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/github.com/cosmos72/gomacro/README.md b/vendor/github.com/cosmos72/gomacro/README.md new file mode 100644 index 0000000..b1fe2db --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/README.md @@ -0,0 +1,186 @@ +## gomacro - interactive Go interpreter with macros + +gomacro is a fairly complete Go interpreter, implemented in pure Go. It offers both +an interactive REPL and a scripting mode, and does not require a Go toolchain at runtime +(except in one very specific case: import of a non-standard package). + +It has very few dependencies: go/ast, go/types, reflect and, +for goroutines support, golang.org/x/sync/syncmap. + +Gomacro can be used as: +* a standalone executable with interactive Go REPL: + just run `gomacro` from your command line or, better, `rlwrap gomacro` + (rlwrap is a wrapper that adds history and line editing to terminal-based + programs - available on many platforms) + Available options: + ``` + -c, --collect collect declarations and statements, to print them later + -e, --expr EXPR evaluate expression + -f, --force-overwrite option -w will overwrite existing files + -h, --help show this help and exit + -i, --repl interactive. start a REPL after evaluating expression, files and dirs. + default: start a REPL only if no expressions, files or dirs are specified + -m, --macro-only do not execute code, only parse and macroexpand it. + useful to run gomacro as a Go preprocessor + -n, --no-trap do not trap panics in the interpreter + -t, --trap trap panics in the interpreter (default) + -s, --silent silent. do NOT show startup message, prompt, and expressions results. + default when executing files and dirs. + -v, --verbose verbose. show startup message, prompt, and expressions results. + default when executing an expression. + -vv, --very-verbose as -v, and in addition show the type of expressions results. + default when executing a REPL + -w, --write-decls write collected declarations and statements to *.go files. + implies -c + -x, --exec execute parsed code (default). disabled by -m + ``` + + Options are processed in order, except for -i that is always processed as last. + + Collected declarations and statements can be also written to standard output + or to a file with the REPL command :write + +* an interactive tool to make science more productive and more fun. + If you use compiled Go with scientific libraries (physics, bioinformatics, statistics...) + you can import the same libraries from gomacro REPL (requires Go 1.8+ and Linux), + call them interactively, inspect the results, feed them to other functions/libraries, + all in a single session. + The imported libraries will be **compiled**, not interpreted, + so they will be as fast as in compiled Go. + +* a library that adds Eval() and scripting capabilities + to your Go programs - provided you comply with its LGPL license + +* a way to execute Go source code on-the-fly without a Go compiler: + you can either run `gomacro FILENAME.go` (works on every supported platform) + + or you can insert a line `#!/usr/bin/env gomacro` at the beginning of a Go source file, + then mark the file as executable with `chmod +x FILENAME.go` and finally execute it + with `./FILENAME.go` (works only on Unix-like systems: Linux, *BSD, Mac OS X ...) + +* a Go code generation tool: + gomacro was started as an experiment to add Lisp-like macros to Go, and they are + extremely useful (in the author's opinion) to simplify code generation. + Macros are normal Go functions, they are special only in one aspect: + they are executed **before** compiling code, and their input and output **is** code + (abstract syntax trees, in the form of go/ast.Node) + + Don't confuse them with C preprocessor macros: in Lisp, Scheme and now in Go, + macros are regular functions written in the same programming language + as the rest of the source code. They can perform arbitrary computations + and call any other function or library: they can even read and write files, + open network connections, etc... as a normal Go function can do. + + Run `gomacro -m -w FILENAMES` to parse and expand macros in one or more files. + For each filename on the command line, gomacro will parse it, expand macros, + then create a corresponding FILENAME.go with the parsed and macroexpanded + imports, declarations and statements. + + To parse and macroexpand all *.gomacro files in a directory, run `gomacro -m -w DIRECTORY` + +## Current Status + +Fairly complete. + +The intepreter supports: +* multiline input +* line comments starting with #! in addition to // +* basic types: booleans, integers, floats, complex numbers, strings (and iota) +* the empty interface, i.e. interface{} - other interfaces not implemented yet +* constant, variable and type declarations (untyped constants are emulated with typed constants) +* Go 1.9 type aliases (experimental) +* unary and binary operators +* assignment, i.e. operators = += -= *= /= %= &= |= ^= &^= <<= >>= +* composite types: arrays, channels, maps, pointers, slices, strings, structs +* composite literals +* type assertions +* function declarations (including variadic functions) +* method declarations (including variadic methods and methods with pointer receiver) +* seamless invocation of compiled functions from interpreter, and vice-versa +* channel send and receive +* goroutines, i.e. go function(args) +* function and method calls, including multiple return values +* if, for, for-range, break, continue, fallthrough, return (unimplemented: goto) +* select, switch, type switch, fallthrough +* all builtins: append, cap, close, comples, defer, delete, imag, len, make, new, panic, print, println, real, recover +* imports: Go standard packages "just work", importing other packages requires the "plugin" package (available only for Go 1.8+ on Linux) +* switching to a different package +* macro declarations, for example `macro foo(a, b, c interface{}) interface{} { return b }` +* macro calls, for example `foo; x; y; z` +* macroexpansion: code walker, MacroExpand and MacroExpand1 +* ~quote and ~quasiquote. they take any number of arguments in curly braces, for example: + `~quote { x; y; z }` +* ~unquote and ~unquote_splice +* ~func, ~lambda: specializations of "func". + * ~lambda always starts a closure (lambda) or a function type + * ~func always starts a function or method declaration + useful to resolve a limitation in Go syntax that becomes significant for ~quote and ~quasiquote: + * in declarations, "func" always declares a function or method - there is no way to declare a closure (lambda) or function type + * in statements and expressions, including the body of ~quote and ~quasiquote, + "func" always declares a closure (lambda) or a function type - there is no way to declare a function or method +* nesting macros, quotes and unquotes + +Some features are still missing: +* interfaces. They can be declared, but nothing more: there is no way to implement them or call their methods +* extracting methods from types. For example `time.Duration.String` should return a `func(time.Duration) string` + but currently gives an error. + Instead extracting methods from objects is supported: `time.Duration(1s).String` correctly returns a func() string +* goto +* named return values +* history/readline (rlwrap does the job in most cases) + +Limitations: +* no distinction between named and unnamed types created by interpreted code. + For the interpreter, `struct { A, B int }` and `type Pair struct { A, B int }` + are exactly the same type. This has subtle consequences, including the risk + that two different packages define the same type and overwrite each other's methods. + + The reason for such limitation is simple: the interpreter uses `reflect.StructOf()` + to define new types, which can only create unnamed types. + The interpreter then defines named types as aliases for the underlying unnamed types. + +* cannot create recursive types, as for example `type List struct { First interface{}; Rest *List}` + The reason is the same as above: the interpreter uses `reflect.StructOf()` to define new types, + which cannot create recursive types + + +## Why it was created + +First of all, to experiment with Go :) + +Second, to simplify Go code generation tools (keep reading for the gory details) + +--- + +Problem: "go generate" and many other Go tools automatically create +Go source code from some kind of description - usually an interface +specifications as WSDL, XSD, JSON... + +Such specification may be written in Go, for example when creating JSON +marshallers/unmarshallers from Go structs, or in some other language, +for example when creating Go structs from JSON sample data. + +In both cases, a variety of external programs are needed to +generate Go source code: such programs need to be installed +separately from the code being generated and compiled. + +Also, Go is currently lacking generics (read: C++-like templates) +because of the rationale "we do not yet know how to do them right, +and once you do them wrong everybody is stuck with them" + +The purpose of Lisp-like macros is to execute arbitrary code +while compiling, **in particular** to generate source code. + +This makes them very well suited (although arguably a bit low level) +for both purposes: code generation and C++-like templates, which +are a special case of code generation - for a demonstration of how +to implement C++-like templates on top of Lisp-like macros, +see for example the project https://github.com/cosmos72/cl-parametric-types +from the same author. + +Building a Go interpreter that supports Lisp-like macros, +allows to embed all these code-generation activities +into regular Go source code, without the need for external programs +(except for the intepreter itself). + +As a free bonus, we get support for Eval() diff --git a/vendor/github.com/cosmos72/gomacro/TrickyGo.md b/vendor/github.com/cosmos72/gomacro/TrickyGo.md new file mode 100644 index 0000000..3a01cfa --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/TrickyGo.md @@ -0,0 +1,46 @@ +A collection of tricky go code + +``` +// change the meaning of true +const true = false +println(true) +``` + +``` +// change the meaning of uint +type uint int +println(uint(1)) +``` + +``` +// change the meaning of uint (again) +func uint(x int) int { return x + 7 } +println(uint(1)) +``` + +``` +// nil interface values don't implement interfaces +var x error +y := x.(error) // panic! +``` + +``` +// except that nil interface{} implements interface{} +var x interface{} +y := x.(interface{}) // works +``` + +``` +import "os" +func getGoPath() string { + dir := os.Getenv("GOPATH") + if len(dir) == 0 { + dir := os.Getenv("HOME") // shadows outer "dir", does NOT modify it + if len(dir) == 0 { + panic("cannot determine go source directory: both $GOPATH and $HOME are unset or empty") + } + dir += "/go" + } + return dir // inner "dir" is not seen -> always returns os.Getenv("GOPATH") +} +``` diff --git a/vendor/github.com/cosmos72/gomacro/all_test.go b/vendor/github.com/cosmos72/gomacro/all_test.go new file mode 100644 index 0000000..ce1f015 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/all_test.go @@ -0,0 +1,793 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * all_test.go + * + * Created on: Mar 06 2017 + * Author: Massimiliano Ghilardi + */ + +package main + +import ( + "go/ast" + "go/token" + r "reflect" + "testing" + "time" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/classic" + "github.com/cosmos72/gomacro/fast" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type TestFor int + +const ( + I TestFor = 1 << iota + F + S // set option OptDebugSleepOnSwitch + A = I | F +) + +type TestCase struct { + testfor TestFor + name string + program string + result0 interface{} + results []interface{} +} + +func TestClassic(t *testing.T) { + ir := classic.New() + // ir.Options |= OptDebugCallStack | OptDebugPanicRecover + for _, test := range testcases { + if test.testfor&I != 0 { + test := test + t.Run(test.name, func(t *testing.T) { test.classic(t, ir) }) + } + } +} + +func TestFast(t *testing.T) { + ir := fast.New() + for _, test := range testcases { + if test.testfor&F != 0 { + test := test + t.Run(test.name, func(t *testing.T) { test.fast(t, ir) }) + } + } +} + +func (test *TestCase) classic(t *testing.T, ir *classic.Interp) { + + rets := PackValues(ir.Eval(test.program)) + + test.compareResults(t, rets) +} + +func (test *TestCase) fast(t *testing.T, ir *fast.Interp) { + + if test.testfor&S != 0 { + ir.Comp.Options |= OptDebugSleepOnSwitch + } else { + ir.Comp.Options &^= OptDebugSleepOnSwitch + } + rets := PackValues(ir.Eval(test.program)) + + test.compareResults(t, rets) +} + +const sum_source_string = "func sum(n int) int { total := 0; for i := 1; i <= n; i++ { total += i }; return total }" +const fibonacci_source_string = "func fibonacci(n int) int { if n <= 2 { return 1 }; return fibonacci(n-1) + fibonacci(n-2) }" +const shellsort_source_string = ` +var shellshort_gaps = &[...]int{701, 301, 132, 57, 23, 10, 4, 1} + +func shellsort(v []int) { + var i, j, n, gi, gapn, gap, temp int + n = len(v) + gapn = len(shellshort_gaps) // fast interpreter currently lacks for-range + for gi = 0; gi < gapn; gi++ { + gap = shellshort_gaps[gi] + for i = gap; i < n; i++ { + temp = v[i] + for j = i; j >= gap && v[j-gap] > temp; j -= gap { + v[j] = v[j-gap] + } + v[j] = temp + } + } +} +` +const switch_source_string = `func bigswitch(n int) int { + for i := 0; i < 1000; i++ { + switch n&15 { + case 0: n++ + case 1: n+=2 + case 2: n+=3 + case 3: n+=4 + case 4: n+=5 + case 5: n+=6 + case 6: n+=7 + case 7: n+=8 + case 8: n+=9 + case 9: n+=10 + case 10: n+=11 + case 11: n+=12 + case 12: n+=13 + case 13: n+=14 + case 14: n+=15 + case 15: n-- + } + } + return n +}` + +var ( + cti = r.StructOf( + []r.StructField{ + r.StructField{Name: StrGensymInterface, Type: r.TypeOf((*interface{})(nil)).Elem()}, + r.StructField{Name: "String", Type: r.TypeOf((*func() string)(nil)).Elem()}, + }, + ) + fti = r.StructOf( + []r.StructField{ + r.StructField{Name: StrGensymInterface, Type: r.TypeOf((*xr.InterfaceHeader)(nil)).Elem()}, + r.StructField{Name: "String", Type: r.TypeOf((*func() string)(nil)).Elem()}, + }, + ) + + csi = r.Zero(cti).Interface() + fsi = r.Zero(r.PtrTo(fti)).Interface() + + zeroValues = []r.Value{} +) + +var nil_map_int_string map[int]string + +func for_range_string(s string) int32 { + var v0 int32 + for i, r := range s { + v0 += r << (uint8(i) * 8) + } + return v0 +} + +var testcases = []TestCase{ + TestCase{A, "1+1", "1+1", 1 + 1, nil}, + TestCase{A, "1+'A'", "1+'A'", 'B', nil}, // rune i.e. int32 should win over untyped constant (or int) + TestCase{A, "int8+1", "int8(1)+1", int8(1) + 1, nil}, + TestCase{A, "int8_overflow", "int8(64)+64", int8(-128), nil}, + TestCase{A, "string", "\"foobar\"", "foobar", nil}, + TestCase{A, "expr_and", "3 & 6", 3 & 6, nil}, + TestCase{A, "expr_or", "7 | 8", 7 | 8, nil}, + TestCase{A, "expr_xor", "0x1f ^ 0xf1", 0x1f ^ 0xf1, nil}, + TestCase{A, "expr_arith", "((1+2)*3^4|99)%112", ((1+2)*3 ^ 4 | 99) % 112, nil}, + TestCase{A, "expr_shift", "7<<(10>>1)", 7 << (10 >> 1), nil}, + + TestCase{A, "complex_1", "7i", 7i, nil}, + TestCase{A, "complex_2", "0.5+1.75i", 0.5 + 1.75i, nil}, + TestCase{A, "complex_3", "1i * 2i", 1i * 2i, nil}, + TestCase{A, "const_0", "const c0 rune = 'x'; c0", 'x', nil}, + TestCase{A, "const_1", "const c1 = 11; c1", 11, nil}, + TestCase{A, "const_2", "const c2 = 0xff&555+23/12.2; c2", 0xff&555 + 23/12.2, nil}, + + // the classic interpreter is not accurate in this cases... missing exact arithmetic on constants + TestCase{I, "const_3", "const c3 = 0.1+0.2; c3", float64(0.1) + float64(0.2), nil}, + TestCase{I, "const_4", "const c4 = c3/3; c4", (float64(0.1) + float64(0.2)) / 3, nil}, + + // the fast interpreter instead *IS* accurate, thanks to exact arithmetic on untyped constants + TestCase{F, "const_3", "const c3 = 0.1+0.2; c3", 0.1 + 0.2, nil}, + TestCase{F, "const_4", "const c4 = c3/3; c4", (0.1 + 0.2) / 3, nil}, + + TestCase{F, "untyped_1", "2.0 >> 1", 1, nil}, + TestCase{A, "untyped_2", "1/2", 0, nil}, + TestCase{A, "untyped_unary", "-+^6", -+^6, nil}, + + TestCase{A, "iota_1", "const c5 = iota^7; c5", 7, nil}, + TestCase{A, "iota_2", "const ( c6 = iota+6; c7=iota+6 ); c6", 6, nil}, + TestCase{A, "iota_3", "c7", 7, nil}, + TestCase{A, "iota_implicit_1", "const ( c8 uint = iota+8; c9 ); c8", uint(8), nil}, + TestCase{A, "iota_implicit_2", "c9", uint(9), nil}, + + TestCase{A, "var_0", "var v0 int = 11; v0", 11, nil}, + TestCase{A, "var_1", "var v1 bool; v1", false, nil}, + TestCase{A, "var_2", "var v2 uint8 = 7; v2", uint8(7), nil}, + TestCase{A, "var_3", "var v3 uint16 = 12; v3", uint16(12), nil}, + TestCase{A, "var_4", "var v uint32 = 99; v", uint32(99), nil}, + TestCase{A, "var_5", "var v5 string; v5", "", nil}, + TestCase{A, "var_6", "var v6 float32; v6", float32(0), nil}, + TestCase{A, "var_7", "var v7 complex64; v7", complex64(0), nil}, + TestCase{A, "var_8", "var err error; err", nil, nil}, + TestCase{A, "var_9", `ve, vf := "", 1.23; ve`, "", nil}, + TestCase{A, "var_pointer", "var vp *string; vp", (*string)(nil), nil}, + TestCase{A, "var_map", "var vm *map[error]bool; vm", (*map[error]bool)(nil), nil}, + TestCase{A, "var_slice", "var vs []byte; vs", ([]byte)(nil), nil}, + TestCase{A, "var_array", "var va [2]rune; va", [2]rune{}, nil}, + TestCase{A, "var_interface_1", "var vi interface{} = 1; vi", 1, nil}, + TestCase{A, "var_interface_2", "var vnil interface{}; vnil", nil, nil}, + TestCase{A, "var_shift_1", "7 << 8", 7 << 8, nil}, + TestCase{A, "var_shift_2", "-9 >> 2", -9 >> 2, nil}, + TestCase{A, "var_shift_3", "v2 << 3", uint8(7) << 3, nil}, + TestCase{A, "var_shift_4", "v2 >> 1", uint8(7) >> 1, nil}, + TestCase{A, "var_shift_5", "0xff << v2", 0xff << 7, nil}, + TestCase{A, "var_shift_6", "0x12345678 >> v2", 0x12345678 >> uint8(7), nil}, + TestCase{A, "var_shift_7", "v << v2", uint32(99) << uint8(7), nil}, + TestCase{A, "var_shift_8", "v3 << v3 >> v2", uint16(12) << 12 >> uint8(7), nil}, + TestCase{A, "var_shift_9", "v3 << 0", uint16(12), nil}, + TestCase{A, "var_shift_overflow", "v3 << 13", uint16(32768), nil}, + + // test division by constant power-of-two + TestCase{I, "var_div_1", "v3 = 11; v3 / 2", uint64(11) / 2, nil}, // classic interpreter is not type-accurate here + TestCase{I, "var_div_2", "v3 = 63; v3 / 8", uint64(63) / 8, nil}, + TestCase{F, "var_div_1", "v3 = 11; v3 / 2", uint16(11) / 2, nil}, + TestCase{F, "var_div_2", "v3 = 63; v3 / 8", uint16(63) / 8, nil}, + + TestCase{A, "var_div_3", "v3 = 11; v3 /=2; v3", uint16(11) / 2, nil}, + TestCase{A, "var_div_4", "v3 = 63; v3 /=8; v3", uint16(63) / 8, nil}, + + TestCase{A, "var_div_5", "v0 =+7; v0 /-1", -7, nil}, + TestCase{A, "var_div_6", "v0 =-7; v0 /+1", -7, nil}, + TestCase{A, "var_div_7", "v0 =-7; v0 /-1", +7, nil}, + TestCase{A, "var_div_8", "v0 =+11; v0 /-2", +11 / -2, nil}, + TestCase{A, "var_div_9", "v0 =-11; v0 /+2", -11 / +2, nil}, + TestCase{A, "var_div_10", "v0 =-11; v0 /-2", -11 / -2, nil}, + TestCase{A, "var_div_11", "v0 =+63; v0 /-8", +63 / -8, nil}, + TestCase{A, "var_div_12", "v0 =-63; v0 /+8", -63 / +8, nil}, + TestCase{A, "var_div_13", "v0 =-63; v0 /-8", -63 / -8, nil}, + + // test remainder by constant power-of-two + TestCase{I, "var_rem_1", "v3 = 17; v3 % 4", uint64(17) % 4, nil}, // classic interpreter is not type-accurate here + TestCase{I, "var_rem_2", "v3 = 61; v3 % 8", uint64(61) % 8, nil}, + TestCase{F, "var_rem_1", "v3 = 17; v3 % 4", uint16(17) % 4, nil}, + TestCase{F, "var_rem_2", "v3 = 61; v3 % 8", uint16(61) % 8, nil}, + + TestCase{A, "var_rem_3", "v0 =+17; v0 %-4", +17 % -4, nil}, + TestCase{A, "var_rem_4", "v0 =-17; v0 %+4", -17 % +4, nil}, + TestCase{A, "var_rem_5", "v0 =-17; v0 %-4", -17 % -4, nil}, + TestCase{A, "var_rem_6", "v0 =+61; v0 %-8", +61 % -8, nil}, + TestCase{A, "var_rem_7", "v0 =-61; v0 %+8", -61 % +8, nil}, + TestCase{A, "var_rem_8", "v0 =-61; v0 %-8", -61 % -8, nil}, + + TestCase{A, "eql_nil_1", "err == nil", true, nil}, + TestCase{A, "eql_nil_2", "vp == nil", true, nil}, + TestCase{A, "eql_nil_3", "vm == nil", true, nil}, + TestCase{A, "eql_nil_4", "vs == nil", true, nil}, + TestCase{A, "eql_nil_5", "vi == nil", false, nil}, + TestCase{A, "eql_nil_6", "vnil == nil", true, nil}, + TestCase{A, "eql_halfnil_1", "var vhalfnil interface{} = vm; vhalfnil == nil", false, nil}, + TestCase{A, "eql_halfnil_2", "vm = nil; vhalfnil = vm; vhalfnil == nil", false, nil}, + TestCase{A, "eql_interface", "vi == 1", true, nil}, + + TestCase{A, "typed_unary_1", "!!!v1", true, nil}, + TestCase{A, "typed_unary_2", "+-^v2", uint8(8), nil}, + TestCase{A, "typed_unary_3", "v3 = 12; +^-v3", uint16(11), nil}, + TestCase{A, "typed_unary_4", "v7 = 2.5i; -v7", complex64(-2.5i), nil}, + + TestCase{A, "type_int8", "type t8 int8; var v8 t8; v8", int8(0), nil}, + TestCase{A, "type_complicated", "type tfff func(int,int) func(error, func(bool)) string; var vfff tfff; vfff", (func(int, int) func(error, func(bool)) string)(nil), nil}, + TestCase{I, "type_interface", "type Stringer interface { String() string }; var s Stringer; s", csi, nil}, + TestCase{F, "type_interface", "type Stringer interface { String() string }; var s Stringer; s", fsi, nil}, + TestCase{A, "type_struct_1", "type Pair struct { A rune; B string }; var pair Pair; pair", struct { + A rune + B string + }{}, nil}, + TestCase{A, "type_struct_2", "type Triple struct { Pair; C float32 }; var triple Triple; triple.C", float32(0), nil}, + TestCase{A, "field_get_1", "pair.A", rune(0), nil}, + TestCase{A, "field_get_2", "pair.B", "", nil}, + TestCase{F, "field_anonymous_1", "triple.Pair", struct { + A rune + B string + }{}, nil}, + TestCase{F, "field_embedded_1", "triple.A", rune(0), nil}, + TestCase{F, "field_embedded_2", "triple.Pair.B", "", nil}, + + TestCase{A, "address_0", "var vf = 1.25; *&vf == vf", true, nil}, + TestCase{A, "address_1", "var pvf = &vf; *pvf", 1.25, nil}, + TestCase{A, "address_2", "&*pvf == *&pvf", true, nil}, + TestCase{A, "address_3", "var pvs = &vs; v1 = (*pvs == nil); v1", true, nil}, + + TestCase{A, "make_chan", "cx := make(chan interface{}, 2); cx", make(chan interface{}, 2), nil}, + TestCase{A, "make_map", "m := make(map[int]string); m", make(map[int]string), nil}, + TestCase{A, "make_slice", "y := make([]uint8, 7); y[0] = 100; y[3] = 103; y", []uint8{100, 0, 0, 103, 0, 0, 0}, nil}, + TestCase{A, "expr_index_string_1", `"abc"[2]`, byte('c'), nil}, + TestCase{A, "expr_index_string_2", `v5 = "foo"; v0 = 0; v5[v0]`, byte('f'), nil}, + TestCase{A, "expr_index_array_1", `va[1]`, rune(0), nil}, + TestCase{A, "expr_index_array_2", `(&va)[0]`, rune(0), nil}, + TestCase{A, "expr_index_map", `var m2 map[rune]string; m2['x']`, nil, []interface{}{"", false}}, + TestCase{A, "expr_slice_0", "y[:]", []uint8{100, 0, 0, 103, 0, 0, 0}, nil}, + TestCase{A, "expr_slice_1", "y[1:]", []uint8{0, 0, 103, 0, 0, 0}, nil}, + TestCase{A, "expr_slice_2", "y[2:4]", []uint8{0, 103}, nil}, + TestCase{A, "expr_slice_3", "y[:3]", []uint8{100, 0, 0}, nil}, + TestCase{A, "expr_slice_4", "y = y[:3:7]; y", []uint8{100, 0, 0}, nil}, + TestCase{A, "expr_slice_5", `"abc"[:]`, "abc", nil}, + TestCase{A, "expr_slice_6", `"abc"[1:]`, "bc", nil}, + TestCase{A, "expr_slice_7", `"abc"[1:2]`, "b", nil}, + + TestCase{A, "set_const_1", "v1 = true; v1", true, nil}, + TestCase{A, "set_const_2", "v2 = 9; v2", uint8(9), nil}, + TestCase{A, "set_const_3", "v3 = 60000; v3", uint16(60000), nil}, + TestCase{A, "set_const_4", "v = 987; v", uint32(987), nil}, + TestCase{A, "set_const_5", `v5 = "8y57r"; v5`, "8y57r", nil}, + TestCase{A, "set_const_6", "v6 = 0.12345678901234; v6", float32(0.12345678901234), nil}, // v6 is declared float32 + TestCase{A, "set_const_7", "v7 = 0.98765432109i; v7", complex(0, float32(0.98765432109)), nil}, // v7 is declared complex64 + + TestCase{A, "set_expr_1", "v1 = v1 == v1; v1", true, nil}, + TestCase{A, "set_expr_2", "v2 -= 7; v2", uint8(2), nil}, + TestCase{A, "set_expr_3", "v3 %= 7; v3", uint16(60000) % 7, nil}, + TestCase{A, "set_expr_4", "v = v * 10; v", uint32(9870), nil}, + TestCase{A, "set_expr_5", `v5 = v5 + "iuh"; v5`, "8y57riuh", nil}, + TestCase{A, "set_expr_6", "v6 = 1/v6; v6", 1 / float32(0.12345678901234), nil}, // v6 is declared float32 + TestCase{A, "set_expr_7", "v7 = v7 * v7; v7", complex(-float32(0.98765432109)*float32(0.98765432109), 0), nil}, // v7 is declared complex64 + + TestCase{A, "add_2", "v2 += 255; v2", uint8(1), nil}, // overflow + TestCase{A, "add_3", "v3 += 536; v3", uint16(60000)%7 + 536, nil}, + TestCase{A, "add_4", "v += 111; v", uint32(9870 + 111), nil}, + TestCase{A, "add_5", `v5 += "@#$"; v5`, "8y57riuh@#$", nil}, + TestCase{A, "add_6", "v6 += 0.975319; v6", 1/float32(0.12345678901234) + float32(0.975319), nil}, // v6 is declared float32 + TestCase{A, "add_7", "v7 = 1; v7 += 0.999999i; v7", complex(float32(1), float32(0.999999)), nil}, // v7 is declared complex64 + + TestCase{A, "mul_1", "v2 = 4; v2 *= 3; v2", uint8(12), nil}, + TestCase{A, "rem_1", "v3 = 12; v3 %= 7; v3", uint16(5), nil}, + TestCase{A, "and_1", "v3 &= 9; v3", uint16(1), nil}, + + TestCase{A, "shift_1", "v3 <<= 7; v3", uint16(128), nil}, + TestCase{A, "shift_2", "v3 >>= (v3>>5); v3", uint16(128 >> (128 >> 5)), nil}, + + TestCase{A, "if_1", "v2 = 1; if v2 < 1 { v2 = v2-1 } else { v2 = v2+1 }; v2", uint8(2), nil}, + TestCase{A, "if_2", "if v2 < 5 { v2 = v2+2 } else { v2 = v2-2 }; v2", uint8(4), nil}, + TestCase{A, "for_1", "var i, j, k int; for i=1; i<=2; i=i+1 { if i<2 {j=i} else {k=i} }; i", 3, nil}, + TestCase{A, "for_2", "j", 1, nil}, + TestCase{A, "for_3", "k", 2, nil}, + TestCase{A, "continue_1", "j=0; k=0; for i:=1; i<=7; i=i+1 { if i==3 {j=i; continue}; k=k+i }; j", 3, nil}, + TestCase{A, "continue_2", "k", 25, nil}, + TestCase{A, "continue_3", "j=0; k=0; for i:=1; i<=7; i=i+1 { var ii = i; if ii==3 {j=ii; continue}; k=k+ii }; j", 3, nil}, + TestCase{A, "continue_4", "k", 25, nil}, + + TestCase{A, "for_range_array", `v0 = 0; for _, s := range [2]string{"a", "bc"} { v0 += len(s) }; v0`, 3, nil}, + TestCase{A, "for_range_chan", `v0 = 0; c := make(chan int, 2); c <- 1; c <- 2; close(c); for e := range c { v0 += e }; v0`, 3, nil}, + TestCase{A, "for_range_map", `var vrune rune; m2 = map[rune]string{'x':"x", 'y':"y", 'z':"z"}; for k,v := range m2 { vrune += k + rune(v[0]) }; vrune`, ('x' + 'y' + 'z') * 2, nil}, + TestCase{A, "for_range_slice", `v0 = 0; for _, s := range [ ]string{"a", "bc"} { v0 += len(s) }; v0`, 3, nil}, + TestCase{A, "for_range_string", `vrune = 0; for i, r := range "abc\u00ff" { vrune += r << (uint8(i)*8) }; vrune`, for_range_string("abc\u00ff"), nil}, + + TestCase{A, "function_0", "func nop() { }; nop()", nil, []interface{}{}}, + TestCase{A, "function_1", "func seven() int { return 7 }; seven()", 7, nil}, + TestCase{A, "function_2", "i=0; func seti(ii int) { i=ii }; seti(-493); i", -493, nil}, + TestCase{A, "function_3", "func ident(x uint) uint { return x }; ident(42)", uint(42), nil}, + TestCase{A, "function_4", "func equal(x, y float32) bool { return x == y }; equal(1.1, 1.1)", true, nil}, + TestCase{A, "function_5", "func swap(x, y int) (int,int) { return y, x }; swap(88,99)", nil, []interface{}{99, 88}}, + TestCase{A, "function_6", "i=0; func seti2() { i=2 }; seti2(); i", 2, nil}, + TestCase{A, "function_7", "i=0; func setiadd(x, y int) { i=x+y }; setiadd(7,8); i", 15, nil}, + + // bool is the param name, NOT its type! + TestCase{F, "function_named_return", "func add3(bool, x, y int) (z int) { z=bool+x+y; return }; add3(1,2,3)", 6, nil}, + + TestCase{A, "function_variadic_1", "func list_args(args ...interface{}) []interface{} { return args }; list_args(1,2,3)", []interface{}{1, 2, 3}, nil}, + TestCase{A, "function_variadic_2", "si := make([]interface{}, 4); si[1]=1; si[2]=2; si[3]=3; list_args(si...)", []interface{}{nil, 1, 2, 3}, nil}, + TestCase{A, "fibonacci", fibonacci_source_string + "; fibonacci(13)", 233, nil}, + TestCase{A, "function_literal", "adder := func(a,b int) int { return a+b }; adder(-7,-9)", -16, nil}, + + TestCase{A, "closure_1", ` + func test_closure_1() int { + var x int + func() { + x = 1 + }() + return x + } + test_closure_1()`, 1, nil}, + + TestCase{F, "closure_2", ` + func test_closure_2() (x int) { + func() { + x = 2 + }() + } + test_closure_2()`, 2, nil}, + + TestCase{A, "setvar_deref_1", `vstr := "foo"; pvstr := &vstr; *pvstr = "bar"; vstr`, "bar", nil}, + TestCase{A, "setvar_deref_2", `vint := 5; pvint := &vint; *pvint = 6; vint`, 6, nil}, + TestCase{A, "setplace_deref_1", `func vstr_addr() *string { return &vstr }; *vstr_addr() = "qwerty"; vstr`, "qwerty", nil}, + TestCase{A, "setplace_deref_2", `*vstr_addr() += "uiop"; vstr`, "qwertyuiop", nil}, + TestCase{A, "setplace_deref_3", `func vint_addr() *int { return &vint }; *vint_addr() = 7; vint`, 7, nil}, + TestCase{A, "setplace_deref_4", `*vint_addr() %= 4; vint`, 3, nil}, + + TestCase{A, "setmap_1", `m[1]="x"; m[2]="y"; m`, map[int]string{1: "x", 2: "y"}, nil}, + TestCase{A, "setmap_2", `m[2]+="z"; m`, map[int]string{1: "x", 2: "yz"}, nil}, + TestCase{A, "setmap_3", `mi := make(map[rune]byte); mi['@']+=2; mi`, map[rune]byte{'@': 2}, nil}, + TestCase{A, "setmap_4", `mi['a'] |= 7; mi`, map[rune]byte{'@': 2, 'a': 7}, nil}, + TestCase{A, "getmap_1", `m[1]`, nil, []interface{}{"x", true}}, + TestCase{A, "getmap_2", `m1 := m[1]; m1`, "x", nil}, + TestCase{A, "getmap_3", `mi['b']`, nil, []interface{}{byte(0), false}}, + TestCase{A, "getmap_4", `v2 = mi['@']; v2`, byte(2), nil}, + + TestCase{A, "divmap_1", "mi['@'] = 99; mi['@'] /= 3; v2 = mi['@']; v2", byte(33), nil}, + TestCase{A, "divmap_2", "mi['@'] /= 4; v2 = mi['@']; v2", byte(8), nil}, + + TestCase{A, "swap_assignment", `i=1;j=2; i,j=j,i; list_args(i, j)`, []interface{}{2, 1}, nil}, + TestCase{A, "evil_assignment_1", `i=0; si[0]=7; si[1]=8 + i, si[i] = 1, 2 + list_args(i,si[0],si[1])`, []interface{}{1, 2, 8}, nil}, + TestCase{A, "evil_assignment_2", `i=0; m=make(map[int]string); mcopy:=m; + i, m, m[i] = 1, nil, "foo" + list_args(i,m,mcopy)`, + []interface{}{1, nil_map_int_string, map[int]string{0: "foo"}}, nil}, + + TestCase{A, "field_set_1", `pair.A = 'k'; pair.B = "m"; pair`, struct { + A rune + B string + }{'k', "m"}, nil}, + TestCase{A, "field_set_2", `pair.A, pair.B = 'x', "y"; pair`, struct { + A rune + B string + }{'x', "y"}, nil}, + TestCase{F, "field_set_3", `triple.Pair.A, triple.C = 'a', 1.0; triple.Pair`, struct { + A rune + B string + }{'a', ""}, nil}, + TestCase{F, "field_set_embedded_1", `triple.A, triple.B = 'b', "xy"; triple.Pair`, struct { + A rune + B string + }{'b', "xy"}, nil}, + TestCase{F, "field_addr_1", "ppair := &triple.Pair; ppair.A", 'b', nil}, + TestCase{F, "field_addr_2", "ppair.A++; triple.Pair.A", 'c', nil}, + + TestCase{I, "import", `import ( "fmt"; "time" )`, "time", nil}, + TestCase{F, "import", `import ( "fmt"; "time" )`, nil, []interface{}{}}, + + TestCase{A, "goroutine_1", `go seti(9); time.Sleep(time.Second/50); i`, 9, nil}, + + TestCase{A, "builtin_append", "append(vs,0,1,2)", []byte{0, 1, 2}, nil}, + TestCase{A, "builtin_cap", "cap(va)", 2, nil}, + TestCase{A, "builtin_len", "len(v5)", len("8y57riuh@#$"), nil}, + TestCase{A, "builtin_new", "new(int)", new(int), nil}, + TestCase{A, "builtin_make_1", "make(map[int]int)", make(map[int]int), nil}, + TestCase{A, "builtin_make_2", "make(map[int]int, 10)", make(map[int]int), nil}, // capacity is ignored + TestCase{A, "builtin_make_4", "make([]*error, 2)", make([]*error, 2), nil}, + TestCase{A, "builtin_make_5", "make([]rune, 3, 4)", make([]rune, 3, 4), nil}, + TestCase{A, "builtin_make_6", "make(chan byte)", make(chan byte), nil}, + TestCase{A, "builtin_make_7", "make(chan byte, 2)", make(chan byte, 2), nil}, + TestCase{A, "builtin_make_8", "vs = make([]byte, 5); vs", make([]byte, 5), nil}, + TestCase{A, "builtin_copy_1", "copy(vs, v5)", 5, nil}, + TestCase{A, "builtin_copy_2", "vs", []byte("8y57r"), nil}, + TestCase{A, "builtin_delete_1", "delete(mi,64); mi", map[rune]byte{'a': 7}, nil}, + TestCase{A, "builtin_real_1", "real(0.5+1.75i)", real(0.5 + 1.75i), nil}, + TestCase{A, "builtin_real_2", "var cplx complex64 = 1.5+0.25i; real(cplx)", real(complex64(1.5 + 0.25i)), nil}, + TestCase{A, "builtin_imag_1", "imag(0.5+1.75i)", imag(0.5 + 1.75i), nil}, + TestCase{A, "builtin_imag_2", "imag(cplx)", imag(complex64(1.5 + 0.25i)), nil}, + TestCase{A, "builtin_complex_1", "complex(0,1)", complex(0, 1), nil}, + TestCase{A, "builtin_complex_2", "v6 = 0.1; complex(v6,-v6)", complex(float32(0.1), -float32(0.1)), nil}, + + TestCase{A, "time_duration_0", `var td time.Duration = 1; td`, time.Duration(1), nil}, + TestCase{A, "time_duration_1", `- td`, time.Duration(-1), nil}, + TestCase{A, "time_duration_2", `td + 1`, time.Duration(2), nil}, + TestCase{A, "time_duration_3", `4 - td`, time.Duration(3), nil}, + TestCase{A, "time_duration_4", `td * 4`, time.Duration(4), nil}, + TestCase{A, "time_duration_5", `5 / td`, time.Duration(5), nil}, + TestCase{A, "time_duration_6", `&td`, func() *time.Duration { td := time.Duration(1); return &td }(), nil}, + TestCase{A, "time_duration_method", ` td = time.Second; td.String()`, "1s", nil}, + TestCase{A, "time_duration_closure", ` tds := td.String; tds()`, "1s", nil}, + TestCase{A, "time_utc", ` utc := time.UTC; utc.String()`, "UTC", nil}, + TestCase{A, "time_utc_addr", ` utcaddr := &time.UTC; *utcaddr == utc`, true, nil}, + TestCase{A, "time_utc_set_1", ` time.UTC = nil; time.UTC == nil`, true, nil}, + TestCase{A, "time_utc_set_2", ` time.UTC = utc; time.UTC.String()`, "UTC", nil}, + + TestCase{A, "literal_array", "[3]int{1,2:3}", [3]int{1, 0, 3}, nil}, + TestCase{A, "literal_array_address", "&[...]int{3:4,5:6}", &[...]int{3: 4, 5: 6}, nil}, + TestCase{A, "literal_map", `map[int]string{1: "foo", 2: "bar"}`, map[int]string{1: "foo", 2: "bar"}, nil}, + TestCase{A, "literal_map_address", `&map[int]byte{6:7, 8:9}`, &map[int]byte{6: 7, 8: 9}, nil}, + TestCase{A, "literal_slice", "[]rune{'a','b','c'}", []rune{'a', 'b', 'c'}, nil}, + TestCase{A, "literal_slice_address", "&[]rune{'x','y'}", &[]rune{'x', 'y'}, nil}, + TestCase{A, "literal_struct", `Pair{A: 0x73, B: "\x94"}`, struct { + A rune + B string + }{A: 0x73, B: "\x94"}, nil}, + TestCase{A, "literal_struct_address", `&Pair{1,"2"}`, &struct { + A rune + B string + }{A: 1, B: "2"}, nil}, + + TestCase{A, "method_decl_1", `func (p *Pair) SetA(a rune) { p.A = a }; func (p Pair) SetAV(a rune) { p.A = a }; nil`, nil, nil}, + TestCase{A, "method_decl_2", `func (p Pair) SetAV(a rune) { p.A = a }; nil`, nil, nil}, + TestCase{A, "method_decl_3", `func (p Pair) String() string { return fmt.Sprintf("%c %s", p.A, p.B) }; nil`, nil, nil}, + + TestCase{A, "method_on_ptr", `pair.SetA(33); pair.A`, rune(33), nil}, + TestCase{A, "method_on_val_1", `pair.SetAV(11); pair.A`, rune(33), nil}, // method on value gets a copy of the receiver - changes to not propagate + TestCase{A, "method_on_val_2", `pair.String()`, "! y", nil}, + TestCase{F, "method_embedded_on_ptr", `triple.SetA('+'); triple.A`, '+', nil}, + TestCase{F, "method_embedded_on_val", `triple.SetAV('*'); triple.A`, '+', nil}, + + TestCase{A, "interface_1", "var st fmt.Stringer = time.Second; st", time.Second, nil}, + TestCase{A, "interface_method_1", "bind := st.String; bind()", "1s", nil}, + TestCase{F, "interface_2", "st = pair; nil", nil, nil}, + TestCase{F, "interface_method_2", "bind = st.String; bind()", "! y", nil}, + + TestCase{F, "concrete_method_to_func", "f1 := time.Duration.Seconds; f1(time.Hour)", 3600.0, nil}, + TestCase{F, "interface_method_to_func", "f2 := fmt.Stringer.String; f2(time.Hour)", "1h0m0s", nil}, + + TestCase{A, "multiple_values_1", "func twins(x float32) (float32,float32) { return x, x+1 }; twins(17.0)", nil, []interface{}{float32(17.0), float32(18.0)}}, + TestCase{A, "multiple_values_2", "func twins2(x float32) (float32,float32) { return twins(x) }; twins2(19.0)", nil, []interface{}{float32(19.0), float32(20.0)}}, + TestCase{A, "multiple_values_3", "f1, f2 := twins(23.0); list_args(f1, f2)", []interface{}{float32(23.0), float32(24.0)}, nil}, + TestCase{A, "multiple_values_4", "fm := make(map[int]float32); fm[1], fm[2] = twins(3.0); fm", map[int]float32{1: 3.0, 2: 4.0}, nil}, + TestCase{A, "multiple_values_5", "swap(swap(3,4))", nil, []interface{}{3, 4}}, + + TestCase{A, "pred_bool_1", "false==false && true==true && true!=false", true, nil}, + TestCase{A, "pred_bool_2", "false!=false || true!=true || true==false", false, nil}, + TestCase{A, "pred_int", "1==1 && 1<=1 && 1>=1 && 1!=2 && 1<2 && 2>1 || 0==1", true, nil}, + TestCase{A, "pred_string_1", `""=="" && "">="" && ""<="" && ""<"a" && ""<="b" && "a">"" && "b">=""`, true, nil}, + TestCase{A, "pred_string_2", `ve=="" && ve>="" && ve<="" && ve<"a" && ve<="b" && "a">ve && "b">=ve`, true, nil}, + TestCase{A, "pred_string_3", `"x"=="x" && "x"<="x" && "x">="x" && "x"!="y" && "x"<"y" && "y">"x"`, true, nil}, + TestCase{A, "pred_string_4", `"x"!="x" || "y"!="y" || "x">="y" || "y"<="x"`, false, nil}, + + TestCase{A, "defer_1", ` + vi = nil + func test_defer_1() { + defer func() { + vi = 1 + }() + } + test_defer_1(); vi`, 1, nil}, + TestCase{F, "defer_2", ` + func test_defer_2() (x int) { + defer func() { + x = 2 + }() + } + test_defer_2()`, 2, nil}, + TestCase{A, "defer_3", "v = 0; func testdefer(x uint32) { if x != 0 { defer func() { v = x }() } }; testdefer(29); v", uint32(29), nil}, + TestCase{A, "defer_4", "v = 12; testdefer(0); v", uint32(12), nil}, + TestCase{A, "recover_1", `var vpanic interface{} + func test_recover(rec bool, panick interface{}) { + defer func() { + if rec { + vpanic = recover() + } + }() + panic(panick) + } + test_recover(true, -1) + vpanic`, -1, nil}, + TestCase{A, "recover_2", `var vpanic2, vpanic3 interface{} + func test_nested_recover(repanic bool, panick interface{}) { + defer func() { + vpanic = recover() + }() + defer func() { + func() { + vpanic3 = recover() + }() + vpanic2 = recover() + if repanic { + panic(vpanic2) + } + }() + panic(panick) + } + test_nested_recover(false, -2) + list_args(vpanic, vpanic2, vpanic3) + `, []interface{}{nil, -2, nil}, nil}, + TestCase{A, "recover_3", `vpanic, vpanic2, vpanic3 = nil, nil, nil + test_nested_recover(true, -3) + list_args(vpanic, vpanic2, vpanic3) + `, []interface{}{-3, -3, nil}, nil}, + TestCase{A, "recover_4", `vpanic = nil + func test_defer_panic(panick interface{}) { + defer func() { + vpanic = recover() + }() + defer func() { + panic(panick) + }() + } + test_defer_panic(-4) + vpanic + `, -4, nil}, + TestCase{A, "send_recv", `cx <- "x"; <-cx`, nil, []interface{}{"x", true}}, + TestCase{A, "sum", sum_source_string + "; sum(100)", 5050, nil}, + + TestCase{A, "select_1", "vi = nil; cx <- 1; { var x interface{}; select { case x=<-cx: vi=x; default: } }; vi", 1, nil}, + TestCase{A, "select_2", "vi = nil; cx <- map[int]int{1:2}; select { case x:=<-cx: vi=x; default: }; vi", map[int]int{1: 2}, nil}, + TestCase{A, "select_3", "vi = nil; select { case cx<-1: vi=1; default: vi=0 }; vi", 1, nil}, + TestCase{A, "select_4", "vi = nil; select { case cx<-2: vi=2; default: vi=0 }; vi", 2, nil}, + TestCase{A, "select_5", "vi = nil; select { case cx<-3: vi=3; default: vi=0 }; vi", 0, nil}, + TestCase{A, "select_6", "vi = nil; select { case cx<-4: vi=4; case x:=<-cx: vi=x; default: vi=0 }; vi", 1, nil}, + + TestCase{A, "switch_1", "vi=nil; switch { case false: ; default: vi='1' }; vi", '1', nil}, + TestCase{A, "switch_2", "vi=nil; switch v:=20; v { case 20: vi='2'; vi='3' }; vi", '3', nil}, + TestCase{A, "switch_3", `v3=0; vi=nil + func inc_u16(addr *uint16, n uint16) uint16 { *addr += n; return *addr } + switch v3++; inc_u16(&v3, 2) { case 1: ; case 2: ; case 3: vi='3'; default: }; vi`, '3', nil}, + TestCase{A, "switch_4", "v0=7; switch v:=7; v { default: vi=0; case 1: vi=1; case v0: vi=7; case 7: vi=-7 }; vi", 7, nil}, + TestCase{A, "switch_fallthrough", `vi=nil; switch v:=0; v { + default: fallthrough + case 1: vi=10; fallthrough + case 2: vi=20; break + case 3: vi=30 + }; vi`, 20, nil}, + TestCase{A | S, "switch_multithread", `func doswitch(i, j int) { switch i { case 1: v0 = j; case 2: vi = j } } + v0, vi = 0, nil + go doswitch(1, 10) + doswitch(2, 20) + time.Sleep(time.Second/10) + list_args(v0, vi) + `, []interface{}{10, 20}, nil}, + + TestCase{A, "typeswitch_1", `vi = nil; var x interface{} = "abc"; switch y := x.(type) { default: vi = 0; case string: vi = len(y) }; vi`, 3, nil}, + TestCase{A, "typeswitch_2", `vi = nil; switch x.(type) { default: vi = 0; case byte, bool: vi = 1; case interface{}: vi = 2 }; vi`, 2, nil}, + TestCase{A, "typeswitch_3", `vi = nil; switch x.(type) { default: vi = 0; case int: vi = 3 }; vi`, 0, nil}, + TestCase{A, "typeswitch_4", `vi = nil; switch x.(type) { default: vi = 0; case string: vi = 4 }; vi`, 4, nil}, + TestCase{A, "typeswitch_5", `vi,x = nil,nil; switch x.(type) { default: vi=0; case nil: vi = 5 }; vi`, 5, nil}, + TestCase{A, "typeswitch_6", `var stringer fmt.Stringer = time.Minute + switch s := stringer.(type) { + case nil: vi = 0 + default: vi = 1 + case time.Duration: vi = 6 + case fmt.Stringer: vi = 7 + }; vi`, 6, nil}, + + TestCase{A, "typeassert_1", `var xi interface{} = "abc"; yi := xi.(string); yi`, "abc", nil}, + TestCase{A, "typeassert_2", `xi.(string)`, nil, []interface{}{"abc", true}}, + TestCase{A, "typeassert_3", `xi.(int)`, nil, []interface{}{0, false}}, + TestCase{A, "typeassert_4", `xi = nil; xi.(error)`, nil, []interface{}{error(nil), false}}, + + TestCase{A, "quote_1", `~quote{7}`, &ast.BasicLit{Kind: token.INT, Value: "7"}, nil}, + TestCase{A, "quote_2", `~quote{x}`, &ast.Ident{Name: "x"}, nil}, + TestCase{A, "quote_3", `var ab = ~quote{a;b}; ab`, &ast.BlockStmt{List: []ast.Stmt{ + &ast.ExprStmt{X: &ast.Ident{Name: "a"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "b"}}, + }}, nil}, + TestCase{A, "quote_4", `~'{"foo"+"bar"}`, &ast.BinaryExpr{ + Op: token.ADD, + X: &ast.BasicLit{Kind: token.STRING, Value: `"foo"`}, + Y: &ast.BasicLit{Kind: token.STRING, Value: `"bar"`}, + }, nil}, + TestCase{A, "quasiquote_1", `~quasiquote{1 + ~unquote{2+3}}`, &ast.BinaryExpr{ + Op: token.ADD, + X: &ast.BasicLit{Kind: token.INT, Value: "1"}, + Y: &ast.BasicLit{Kind: token.INT, Value: "5"}, + }, nil}, + TestCase{A, "quasiquote_2", `~"{2 * ~,{3<<1}}`, &ast.BinaryExpr{ + Op: token.MUL, + X: &ast.BasicLit{Kind: token.INT, Value: "2"}, + Y: &ast.BasicLit{Kind: token.INT, Value: "6"}, + }, nil}, + TestCase{A, "quasiquote_3", `~"{func(int) {}}`, &ast.FuncLit{ + Type: &ast.FuncType{ + Params: &ast.FieldList{ + List: []*ast.Field{ + &ast.Field{ + Names: nil, + Type: &ast.Ident{ + Name: "int", + }, + }, + }, + }, + }, + Body: &ast.BlockStmt{}, + }, nil}, + TestCase{A, "quasiquote_func", `func qq_func(x interface{}) interface{} { y := ~"~,x; return y }; qq_func(123)`, + &ast.BasicLit{Kind: token.INT, Value: "123"}, nil}, + TestCase{A, "quasiquote_case", `~"{case xy: nil}`, + &ast.CaseClause{ + List: []ast.Expr{&ast.Ident{Name: "xy"}}, + Body: []ast.Stmt{&ast.ExprStmt{&ast.Ident{Name: "nil"}}}, + }, nil, + }, + + TestCase{A, "unquote_splice_1", `~quasiquote{~unquote_splice ab ; c}`, &ast.BlockStmt{List: []ast.Stmt{ + &ast.ExprStmt{X: &ast.Ident{Name: "a"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "b"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "c"}}, + }}, nil}, + TestCase{A, "unquote_splice_2", `~"{zero ; ~,@ab ; one}`, &ast.BlockStmt{List: []ast.Stmt{ + &ast.ExprStmt{X: &ast.Ident{Name: "zero"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "a"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "b"}}, + &ast.ExprStmt{X: &ast.Ident{Name: "one"}}, + }}, nil}, + TestCase{A, "macro", "~macro second_arg(a,b,c interface{}) interface{} { return b }; v = 98; v", uint32(98), nil}, + TestCase{A, "macro_call", "second_arg;1;v;3", uint32(98), nil}, + TestCase{A, "macro_nested", "second_arg;1;{second_arg;2;3;4};5", 3, nil}, + TestCase{I, "values", "Values(3,4,5)", nil, []interface{}{3, 4, 5}}, + TestCase{A, "eval", "Eval(~quote{1+2})", 3, nil}, + TestCase{I, "eval_quote", "Eval(~quote{Values(3,4,5)})", nil, []interface{}{3, 4, 5}}, +} + +func (c *TestCase) compareResults(t *testing.T, actual []r.Value) { + expected := c.results + if expected == nil { + expected = []interface{}{c.result0} + } + if len(actual) != len(expected) { + c.fail(t, actual, expected) + return + } + for i := range actual { + c.compareResult(t, actual[i], expected[i]) + } +} + +func (c *TestCase) compareResult(t *testing.T, actualv r.Value, expected interface{}) { + if actualv == Nil || actualv == None { + if expected != nil { + c.fail(t, nil, expected) + } + return + } + actual := actualv.Interface() + if !r.DeepEqual(actual, expected) { + if r.TypeOf(actual) == r.TypeOf(expected) { + if actualNode, ok := actual.(ast.Node); ok { + if expectedNode, ok := expected.(ast.Node); ok { + c.compareAst(t, ToAst(actualNode), ToAst(expectedNode)) + return + } + } else if actualv.Kind() == r.Chan { + // for channels just check the type, length and capacity + expectedv := r.ValueOf(expected) + if actualv.Len() == expectedv.Len() && actualv.Cap() == expectedv.Cap() { + return + } + } + } + c.fail(t, actual, expected) + } +} + +func (c *TestCase) compareAst(t *testing.T, actual Ast, expected Ast) { + if actual == nil || expected == nil { + if actual != nil || expected != nil { + c.fail(t, actual, expected) + } + return + } + if r.TypeOf(actual) == r.TypeOf(expected) { + switch actual := actual.(type) { + case BadDecl, BadExpr, BadStmt: + return + case Ident: + if actual.X.Name == expected.(Ident).X.Name { + return + } + case BasicLit: + actualp := actual.X + expectedp := expected.(BasicLit).X + if actualp == expectedp || (actualp != nil && expectedp != nil && actualp.Kind == expectedp.Kind && actualp.Value == expectedp.Value) { + return + } + default: + na := actual.Size() + ne := expected.Size() + if actual.Op() == expected.Op() && na == ne { + for i := 0; i < na; i++ { + c.compareAst(t, actual.Get(i), expected.Get(i)) + } + return + } + } + } + c.fail(t, actual, expected) +} + +func (c *TestCase) fail(t *testing.T, actual interface{}, expected interface{}) { + t.Errorf("expecting %v <%T>, found %v <%T>\n", expected, expected, actual, actual) +} diff --git a/vendor/github.com/cosmos72/gomacro/ast2/ast.go b/vendor/github.com/cosmos72/gomacro/ast2/ast.go new file mode 100644 index 0000000..c5abc58 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/ast.go @@ -0,0 +1,114 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * ast.go + * + * Created on Feb 24, 2017 + * Author Massimiliano Ghilardi + */ + +package ast2 + +import ( + "go/ast" + "go/token" +) + +type ( + Ast interface { + Interface() interface{} + Op() token.Token + Size() int + Get(i int) Ast + Set(i int, child Ast) + New() Ast // returns a copy of Ast. the children are not copied + } + AstWithNode interface { + Ast + Node() ast.Node + } + AstWithSlice interface { + Ast + Slice(lo, hi int) AstWithSlice + Append(child Ast) AstWithSlice + } + + AstSlice struct{ X []Ast } + NodeSlice struct{ X []ast.Node } + ExprSlice struct{ X []ast.Expr } + FieldSlice struct{ X []*ast.Field } + DeclSlice struct{ X []ast.Decl } + IdentSlice struct{ X []*ast.Ident } + StmtSlice struct{ X []ast.Stmt } + SpecSlice struct{ X []ast.Spec } + + ArrayType struct{ X *ast.ArrayType } + AssignStmt struct{ X *ast.AssignStmt } + BadDecl struct{ X *ast.BadDecl } + BadExpr struct{ X *ast.BadExpr } + BadStmt struct{ X *ast.BadStmt } + BasicLit struct{ X *ast.BasicLit } + BinaryExpr struct{ X *ast.BinaryExpr } + BlockStmt struct{ X *ast.BlockStmt } + BranchStmt struct{ X *ast.BranchStmt } + CallExpr struct{ X *ast.CallExpr } + CaseClause struct{ X *ast.CaseClause } + ChanType struct{ X *ast.ChanType } + CommClause struct{ X *ast.CommClause } + CompositeLit struct{ X *ast.CompositeLit } + DeclStmt struct{ X *ast.DeclStmt } + DeferStmt struct{ X *ast.DeferStmt } + Ellipsis struct{ X *ast.Ellipsis } + EmptyStmt struct{ X *ast.EmptyStmt } + ExprStmt struct{ X *ast.ExprStmt } + Field struct{ X *ast.Field } + FieldList struct{ X *ast.FieldList } + File struct{ X *ast.File } + ForStmt struct{ X *ast.ForStmt } + FuncDecl struct{ X *ast.FuncDecl } + FuncLit struct{ X *ast.FuncLit } + FuncType struct{ X *ast.FuncType } + GenDecl struct{ X *ast.GenDecl } + GoStmt struct{ X *ast.GoStmt } + Ident struct{ X *ast.Ident } + IfStmt struct{ X *ast.IfStmt } + ImportSpec struct{ X *ast.ImportSpec } + IncDecStmt struct{ X *ast.IncDecStmt } + IndexExpr struct{ X *ast.IndexExpr } + InterfaceType struct{ X *ast.InterfaceType } + KeyValueExpr struct{ X *ast.KeyValueExpr } + LabeledStmt struct{ X *ast.LabeledStmt } + MapType struct{ X *ast.MapType } + Package struct{ X *ast.Package } + ParenExpr struct{ X *ast.ParenExpr } + RangeStmt struct{ X *ast.RangeStmt } + ReturnStmt struct{ X *ast.ReturnStmt } + SelectStmt struct{ X *ast.SelectStmt } + SelectorExpr struct{ X *ast.SelectorExpr } + SendStmt struct{ X *ast.SendStmt } + SliceExpr struct{ X *ast.SliceExpr } + StarExpr struct{ X *ast.StarExpr } + StructType struct{ X *ast.StructType } + SwitchStmt struct{ X *ast.SwitchStmt } + TypeAssertExpr struct{ X *ast.TypeAssertExpr } + TypeSpec struct{ X *ast.TypeSpec } + TypeSwitchStmt struct{ X *ast.TypeSwitchStmt } + UnaryExpr struct{ X *ast.UnaryExpr } + ValueSpec struct{ X *ast.ValueSpec } +) diff --git a/vendor/github.com/cosmos72/gomacro/ast2/ast_convert.go b/vendor/github.com/cosmos72/gomacro/ast2/ast_convert.go new file mode 100644 index 0000000..def12e2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/ast_convert.go @@ -0,0 +1,621 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * ast_convert.go + * + * Created on: Feb 25, 2017 + * Author: Massimiliano Ghilardi + */ + +package ast2 + +import ( + "fmt" + "go/ast" + "go/token" + r "reflect" + + mt "github.com/cosmos72/gomacro/token" +) + +// unused +/* +func CloneAst(in Ast) Ast { + switch in := in.(type) { + case AstWithNode: + return CloneAstWithNode(in) + case AstWithSlice: + return CloneAstWithSlice(in) + default: + errorf("CloneAst: unsupported argument type, expecting AstWithNode or AstWithSlice: %v <%v>", in, r.TypeOf(in)) + return nil + } +} + +func CloneAstWithNode(in AstWithNode) AstWithNode { + form := in.New().(AstWithNode) + n := in.Size() + for i := 0; i < n; i++ { + form.Set(i, CloneAst(in.Get(i))) + } + return form +} + +func CloneAstWithSlice(in AstWithSlice) AstWithSlice { + form := in.New().(AstWithSlice) + n := in.Size() + for i := 0; i < n; i++ { + form = form.Append(CloneAst(in.Get(i))) + } + return form +} +*/ + +func AnyToAstWithNode(any interface{}, caller interface{}) AstWithNode { + node := AnyToAst(any, caller) + switch node := node.(type) { + case AstWithNode: + return node + default: + errorf("%s: cannot convert to ast.Node: %v <%v>", caller, any, r.TypeOf(any)) + return nil + } +} + +func AnyToAstWithSlice(any interface{}, caller interface{}) AstWithSlice { + node := AnyToAst(any, caller) + switch node := node.(type) { + case nil: + return NodeSlice{} + case AstWithSlice: + return node + default: + errorf("%s: cannot convert to slice of ast.Node: %v <%v>", caller, any, r.TypeOf(any)) + return nil + } +} + +func AnyToAst(any interface{}, caller interface{}) Ast { + var str string + var tok token.Token + switch node := any.(type) { + case nil: + return nil + case Ast: + return node + case ast.Node: + return ToAst(node) + case []Ast: + return AstSlice{X: node} + case []ast.Node: + return NodeSlice{X: node} + case []*ast.Field: + return FieldSlice{X: node} + case []ast.Decl: + return DeclSlice{X: node} + case []ast.Expr: + return ExprSlice{X: node} + case []*ast.Ident: + return IdentSlice{X: node} + case []ast.Stmt: + return StmtSlice{X: node} + case []ast.Spec: + return SpecSlice{X: node} + case bool: + if node { + str = "true" + } else { + str = "false" + } + return Ident{X: &ast.Ident{Name: str}} + /* + case rune: // Go cannot currently distinguish rune from int32 + tok = token.CHAR + str = fmt.Sprintf("%q", node) + */ + case int, int8, int16, int32, int64, + uint, uint8, uint16, uint32, uint64, uintptr: + tok = token.INT + str = fmt.Sprintf("%d", node) + case float32, float64: + tok = token.FLOAT + str = fmt.Sprintf("%g", node) + case complex64, complex128: + errorf("%s: unimplemented conversion of <%v> to ast.Node: %v", r.TypeOf(any), caller, any) + return nil + case string: + tok = token.STRING + str = fmt.Sprintf("%q", node) + default: + errorf("%s: cannot convert to ast.Node: %v <%v>", caller, any, r.TypeOf(any)) + return nil + } + return BasicLit{X: &ast.BasicLit{Kind: tok, Value: str}} + +} + +// ToAst2 returns either n0 (if i == 0) or n1, converted to Ast +func ToAst1(i int, node ast.Node) AstWithNode { + if i == 0 { + return ToAst(node) + } else { + return badIndex(i, 1) + } +} + +// ToAst2 returns either n0 (if i == 0) or n1, converted to Ast +func ToAst2(i int, n0 ast.Node, n1 ast.Node) AstWithNode { + var n ast.Node + switch i { + case 0: + n = n0 + case 1: + n = n1 + default: + return badIndex(i, 2) + } + return ToAst(n) +} + +func ToAst3(i int, n0 ast.Node, n1 ast.Node, n2 *ast.BlockStmt) AstWithNode { + var n ast.Node + switch i { + case 0: + n = n0 + case 1: + n = n1 + case 2: + if n2 == nil { + return nil + } + return BlockStmt{n2} + default: + return badIndex(i, 3) + } + return ToAst(n) +} + +func ToAst4(i int, n0 ast.Node, n1 ast.Node, n2 ast.Node, n3 ast.Node) AstWithNode { + var n ast.Node + switch i { + case 0: + n = n0 + case 1: + n = n1 + case 2: + n = n2 + case 3: + n = n3 + default: + return badIndex(i, 4) + } + return ToAst(n) +} + +// ToAst converts an ast.Node to Ast, providing uniform access to the node contents +// +func ToAst(node ast.Node) AstWithNode { + var x AstWithNode + switch node := node.(type) { + case nil: + return nil + case *ast.ArrayType: + x = ArrayType{node} + case *ast.AssignStmt: + x = AssignStmt{node} + case *ast.BadDecl: + x = BadDecl{node} + case *ast.BadExpr: + x = BadExpr{node} + case *ast.BadStmt: + x = BadStmt{node} + case *ast.BasicLit: + x = BasicLit{node} + case *ast.BinaryExpr: + x = BinaryExpr{node} + case *ast.BlockStmt: + if node != nil { // we can get typed nil from many places + x = BlockStmt{node} + } + case *ast.BranchStmt: + x = BranchStmt{node} + case *ast.CallExpr: + x = CallExpr{node} + case *ast.CaseClause: + x = CaseClause{node} + case *ast.ChanType: + x = ChanType{node} + case *ast.CommClause: + x = CommClause{node} + case *ast.CompositeLit: + x = CompositeLit{node} + case *ast.DeclStmt: + x = DeclStmt{node} + case *ast.DeferStmt: + x = DeferStmt{node} + case *ast.Ellipsis: + x = Ellipsis{node} + case *ast.EmptyStmt: + x = EmptyStmt{node} + case *ast.ExprStmt: + x = ExprStmt{node} + case *ast.Field: + x = Field{node} + case *ast.FieldList: + if node != nil { // we can get typed nil from many places + x = FieldList{node} + } + case *ast.File: + x = File{node} + case *ast.ForStmt: + x = ForStmt{node} + case *ast.FuncDecl: + x = FuncDecl{node} + case *ast.FuncLit: + x = FuncLit{node} + case *ast.FuncType: + x = FuncType{node} + case *ast.GenDecl: + if node != nil { + x = GenDecl{node} + } + case *ast.GoStmt: + x = GoStmt{node} + case *ast.Ident: + x = Ident{node} + case *ast.IfStmt: + x = IfStmt{node} + case *ast.ImportSpec: + x = ImportSpec{node} + case *ast.IncDecStmt: + x = IncDecStmt{node} + case *ast.IndexExpr: + x = IndexExpr{node} + case *ast.InterfaceType: + x = InterfaceType{node} + case *ast.KeyValueExpr: + x = KeyValueExpr{node} + case *ast.LabeledStmt: + x = LabeledStmt{node} + case *ast.MapType: + x = MapType{node} + case *ast.Package: + x = Package{node} + case *ast.ParenExpr: + x = ParenExpr{node} + case *ast.RangeStmt: + x = RangeStmt{node} + case *ast.ReturnStmt: + x = ReturnStmt{node} + case *ast.SelectStmt: + x = SelectStmt{node} + case *ast.SelectorExpr: + x = SelectorExpr{node} + case *ast.SendStmt: + x = SendStmt{node} + case *ast.SliceExpr: + x = SliceExpr{node} + case *ast.StarExpr: + x = StarExpr{node} + case *ast.StructType: + x = StructType{node} + case *ast.SwitchStmt: + x = SwitchStmt{node} + case *ast.TypeAssertExpr: + x = TypeAssertExpr{node} + case *ast.TypeSpec: + x = TypeSpec{node} + case *ast.TypeSwitchStmt: + x = TypeSwitchStmt{node} + case *ast.UnaryExpr: + x = UnaryExpr{node} + case *ast.ValueSpec: + x = ValueSpec{node} + default: + errorf("unsupported node type <%v>", r.TypeOf(node)) + } + return x +} + +func ToAstWithSlice(x Ast, caller interface{}) AstWithSlice { + switch x := x.(type) { + case AstWithSlice: + return x + default: + y := x.Interface() + errorf("%s: cannot convert to slice of ast.Node: %v <%v>", caller, y, r.TypeOf(y)) + return nil + } +} + +// ToNode converts Ast back ast.Node, or panics on failure +// (it fails if the argument is not AstWithNode) +func ToNode(x Ast) ast.Node { + switch x := x.(type) { + case nil: + return nil + case AstWithNode: + return x.Node() + default: + y := x.Interface() + errorf("cannot convert to ast.Node: %v <%v>", y, r.TypeOf(y)) + return nil + } +} + +func ToBasicLit(x Ast) *ast.BasicLit { + switch x := x.(type) { + case nil: + break + case BasicLit: + return x.X + default: + y := x.Interface() + errorf("cannot convert to *ast.BasicLit: %v <%v>", y, r.TypeOf(y)) + } + return nil +} + +func ToBlockStmt(x Ast) *ast.BlockStmt { + switch x := x.(type) { + case nil: + break + case BlockStmt: + return x.X + default: + stmt := ToStmt(x) + return &ast.BlockStmt{Lbrace: stmt.Pos(), List: []ast.Stmt{stmt}, Rbrace: stmt.End()} + } + return nil +} + +func ToCallExpr(x Ast) *ast.CallExpr { + switch x := x.(type) { + case nil: + break + case CallExpr: + return x.X + default: + y := x.Interface() + errorf("cannot convert to *ast.CallExpr: %v <%v>", y, r.TypeOf(y)) + } + return nil +} + +func ToDecl(x Ast) ast.Decl { + switch node := ToNode(x).(type) { + case ast.Decl: + return node + case nil: + default: + y := x.Interface() + errorf("cannot convert to ast.Decl: %v <%v>", y, r.TypeOf(y)) + } + return nil +} + +func ToExpr(x Ast) ast.Expr { + switch node := ToNode(x).(type) { + case nil: + break + case ast.Expr: + return node + case *ast.BlockStmt: + return BlockStmtToExpr(node) + case *ast.EmptyStmt: + return &ast.Ident{NamePos: node.Semicolon, Name: "nil"} + case *ast.ExprStmt: + return node.X + case ast.Stmt: + list := []ast.Stmt{node} + block := &ast.BlockStmt{List: list} + return BlockStmtToExpr(block) + default: + errorf("unimplemented conversion from %v to ast.Expr: %v <%v>", + r.TypeOf(node), node, r.TypeOf(node)) + } + return nil +} + +func ToExprSlice(x Ast) []ast.Expr { + switch x := x.(type) { + case nil: + break + case ExprSlice: + return x.X + case AstWithSlice: + n := x.Size() + ret := make([]ast.Expr, n) + for i := 0; i < n; i++ { + ret[i] = ToExpr(x.Get(i)) + } + return ret + default: + errorf("unimplemented conversion from %v <%v> to []ast.Expr", x, r.TypeOf(x)) + } + return nil +} + +func ToField(x Ast) *ast.Field { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.Field: + return node + default: + errorf("cannot convert %v <%v> to *ast.Field", node, r.TypeOf(node)) + } + return nil +} + +func ToFile(x Ast) *ast.File { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.File: + return node + default: + errorf("cannot convert %v <%v> to *ast.File", node, r.TypeOf(node)) + } + return nil +} + +func ToFieldList(x Ast) *ast.FieldList { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.FieldList: + return node + case *ast.Field: + return &ast.FieldList{Opening: node.Pos(), List: []*ast.Field{node}, Closing: node.End()} + default: + errorf("cannot convert %v <%v> to *ast.Field", node, r.TypeOf(node)) + } + return nil +} + +func ToFuncType(x Ast) *ast.FuncType { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.FuncType: + return node + default: + errorf("cannot convert %v <%v> to *ast.FuncType", node, r.TypeOf(node)) + } + return nil +} + +func ToImportSpec(x Ast) *ast.ImportSpec { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.ImportSpec: + return node + default: + errorf("cannot convert %v <%v> to *ast.ImportSpec", node, r.TypeOf(node)) + } + return nil +} + +func ToIdent(x Ast) *ast.Ident { + switch node := ToNode(x).(type) { + case nil: + break + case *ast.Ident: + return node + default: + errorf("cannot convert %v <%v> to *ast.Ident", node, r.TypeOf(node)) + } + return nil +} + +func ToIdentSlice(x Ast) []*ast.Ident { + switch x := x.(type) { + case nil: + break + case IdentSlice: + return x.X + case AstWithSlice: + n := x.Size() + ret := make([]*ast.Ident, n) + for i := 0; i < n; i++ { + ret[i] = ToIdent(x.Get(i)) + } + return ret + default: + errorf("unimplemented conversion from %v <%v> to []*ast.Ident", x, r.TypeOf(x)) + } + return nil +} + +func ToSpec(x Ast) ast.Spec { + switch node := ToNode(x).(type) { + case nil: + break + case ast.Spec: + return node + default: + errorf("cannot convert %v <%v> to ast.Spec", node, r.TypeOf(node)) + } + return nil +} + +func ToStmt(x Ast) ast.Stmt { + switch node := ToNode(x).(type) { + case ast.Stmt: + return node + case ast.Decl: + return &ast.DeclStmt{Decl: node} + case ast.Expr: + return &ast.ExprStmt{X: node} + case nil: + break + default: + errorf("unimplemented conversion from %v <%v> to ast.Stmt", node, r.TypeOf(node)) + } + return nil +} + +func ToStmtSlice(x Ast) []ast.Stmt { + switch x := x.(type) { + case nil: + break + case StmtSlice: + return x.X + case AstWithSlice: + n := x.Size() + ret := make([]ast.Stmt, n) + for i := 0; i < n; i++ { + ret[i] = ToStmt(x.Get(i)) + } + return ret + default: + errorf("unimplemented conversion from %v <%v> to []ast.Stmt", x, r.TypeOf(x)) + } + return nil +} + +func BlockStmtToExpr(node *ast.BlockStmt) ast.Expr { + if node == nil { + return nil + } + list := node.List + switch len(list) { + case 0: + // convert {} to nil, because {} in expression context means "no useful value" + return &ast.Ident{NamePos: node.Lbrace, Name: "nil"} + case 1: + // check if we are lucky... + switch node := list[0].(type) { + case *ast.ExprStmt: + return node.X + case *ast.EmptyStmt: + // convert { ; } to nil, because { ; } in expression context means "no useful value" + return &ast.Ident{NamePos: node.Semicolon, Name: "nil"} + } + } + + // due to go/ast strictly typed model, there is only one mechanism + // to insert a statement inside an expression: use a closure. + // so we return a unary expression: MACRO (func() { /*block*/ }) + typ := &ast.FuncType{Func: token.NoPos, Params: &ast.FieldList{}} + fun := &ast.FuncLit{Type: typ, Body: node} + return &ast.UnaryExpr{Op: mt.MACRO, X: fun} +} diff --git a/vendor/github.com/cosmos72/gomacro/ast2/ast_node.go b/vendor/github.com/cosmos72/gomacro/ast2/ast_node.go new file mode 100644 index 0000000..3668a02 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/ast_node.go @@ -0,0 +1,903 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * ast_node.go + * + * Created on Feb 25, 2017 + * Author Massimiliano Ghilardi + */ + +package ast2 + +import ( + "go/ast" + "go/token" +) + +func asInterface(x interface{}, isnil bool) interface{} { + if isnil { + return nil + } + return x +} + +func asNode(x ast.Node, isnil bool) ast.Node { + if isnil { + return nil + } + return x +} + +// +// .................. functions Interface() interface{} +// +func (x ArrayType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x AssignStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BadDecl) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BadExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BadStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BasicLit) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BinaryExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x BranchStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x CallExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x CaseClause) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ChanType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x CommClause) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x CompositeLit) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x DeclStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x DeferStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x Ellipsis) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x EmptyStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ExprStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x Field) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ForStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x FuncDecl) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x FuncLit) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x FuncType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x GoStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x Ident) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x IfStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ImportSpec) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x IncDecStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x IndexExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x InterfaceType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x KeyValueExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x LabeledStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x MapType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x Package) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ParenExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x RangeStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SelectStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SelectorExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SendStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SliceExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x StarExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x StructType) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SwitchStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x TypeAssertExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x TypeSpec) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x TypeSwitchStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x UnaryExpr) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ValueSpec) Interface() interface{} { return asInterface(x.X, x.X == nil) } + +// +// .................. functions Node() ast.Node +// +func (x ArrayType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x AssignStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BadDecl) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BadExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BadStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BasicLit) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BinaryExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x BranchStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x CallExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x CaseClause) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ChanType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x CommClause) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x CompositeLit) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x DeclStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x DeferStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x Ellipsis) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x EmptyStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ExprStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x Field) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ForStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x FuncDecl) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x FuncLit) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x FuncType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x GoStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x Ident) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x IfStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ImportSpec) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x IncDecStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x IndexExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x InterfaceType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x KeyValueExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x LabeledStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x MapType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x Package) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ParenExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x RangeStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x SelectStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x SelectorExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x SendStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x SliceExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x StarExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x StructType) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x SwitchStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x TypeAssertExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x TypeSpec) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x TypeSwitchStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x UnaryExpr) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ValueSpec) Node() ast.Node { return asNode(x.X, x.X == nil) } + +// +// .................. functions Op() token.Token +// +func (x ArrayType) Op() token.Token { return token.LBRACK } +func (x AssignStmt) Op() token.Token { return x.X.Tok } +func (x BadDecl) Op() token.Token { return token.ILLEGAL } +func (x BadExpr) Op() token.Token { return token.ILLEGAL } +func (x BadStmt) Op() token.Token { return token.ILLEGAL } +func (x BasicLit) Op() token.Token { return x.X.Kind } +func (x BinaryExpr) Op() token.Token { return x.X.Op } +func (x BranchStmt) Op() token.Token { return x.X.Tok } +func (x CallExpr) Op() token.Token { return token.RPAREN } +func (x CaseClause) Op() token.Token { + if len(x.X.List) != 0 { + return token.CASE + } else { + return token.DEFAULT + } +} +func (x ChanType) Op() token.Token { return token.CHAN } +func (x CommClause) Op() token.Token { + if x.X.Comm != nil { + return token.CASE + } else { + return token.DEFAULT + } +} +func (x CompositeLit) Op() token.Token { return token.RBRACE } +func (x DeclStmt) Op() token.Token { return x.X.Decl.(*ast.GenDecl).Tok } +func (x DeferStmt) Op() token.Token { return token.DEFER } +func (x Ellipsis) Op() token.Token { return token.ELLIPSIS } +func (x EmptyStmt) Op() token.Token { return token.SEMICOLON } +func (x ExprStmt) Op() token.Token { return token.ELSE } // FIXME +func (x Field) Op() token.Token { return token.PERIOD } +func (x ForStmt) Op() token.Token { return token.FOR } +func (x FuncDecl) Op() token.Token { return token.FUNC } +func (x FuncLit) Op() token.Token { return token.FUNC } +func (x FuncType) Op() token.Token { return token.FUNC } +func (x GoStmt) Op() token.Token { return token.GO } +func (x Ident) Op() token.Token { return token.IDENT } +func (x IfStmt) Op() token.Token { return token.IF } +func (x ImportSpec) Op() token.Token { return token.IMPORT } +func (x IncDecStmt) Op() token.Token { return x.X.Tok } +func (x IndexExpr) Op() token.Token { return token.LBRACK } +func (x InterfaceType) Op() token.Token { return token.INTERFACE } +func (x KeyValueExpr) Op() token.Token { return token.COLON } // FIXME +func (x LabeledStmt) Op() token.Token { return token.COLON } // FIXME +func (x MapType) Op() token.Token { return token.MAP } +func (x Package) Op() token.Token { return token.PACKAGE } +func (x ParenExpr) Op() token.Token { return token.LPAREN } +func (x RangeStmt) Op() token.Token { return token.RANGE } +func (x SelectStmt) Op() token.Token { return token.SELECT } +func (x SelectorExpr) Op() token.Token { return token.CASE } +func (x SendStmt) Op() token.Token { return token.CHAN } // FIXME +func (x SliceExpr) Op() token.Token { return token.RBRACK } // FIXME +func (x StarExpr) Op() token.Token { return token.MUL } +func (x StructType) Op() token.Token { return token.STRUCT } +func (x SwitchStmt) Op() token.Token { return token.SWITCH } +func (x TypeAssertExpr) Op() token.Token { return token.TYPE } // FIXME +func (x TypeSpec) Op() token.Token { return token.TYPE } +func (x TypeSwitchStmt) Op() token.Token { return token.SWITCH } // FIXME +func (x UnaryExpr) Op() token.Token { return x.X.Op } +func (x ValueSpec) Op() token.Token { return token.VAR } // can be VAR or CONST + +// +// .................. functions New() Ast +// +func (x ArrayType) New() Ast { return ArrayType{&ast.ArrayType{Lbrack: x.X.Lbrack}} } +func (x AssignStmt) New() Ast { return AssignStmt{&ast.AssignStmt{TokPos: x.X.TokPos, Tok: x.X.Tok}} } +func (x BadDecl) New() Ast { return BadDecl{&ast.BadDecl{From: x.X.From, To: x.X.To}} } +func (x BadExpr) New() Ast { return BadExpr{&ast.BadExpr{From: x.X.From, To: x.X.To}} } +func (x BadStmt) New() Ast { return BadStmt{&ast.BadStmt{From: x.X.From, To: x.X.To}} } +func (x BasicLit) New() Ast { + return BasicLit{&ast.BasicLit{ValuePos: x.X.ValuePos, Value: x.X.Value, Kind: x.X.Kind}} +} +func (x BinaryExpr) New() Ast { return BinaryExpr{&ast.BinaryExpr{OpPos: x.X.OpPos, Op: x.X.Op}} } +func (x BranchStmt) New() Ast { return BranchStmt{&ast.BranchStmt{TokPos: x.X.TokPos, Tok: x.X.Tok}} } +func (x CallExpr) New() Ast { + return CallExpr{&ast.CallExpr{Lparen: x.X.Lparen, Ellipsis: x.X.Ellipsis, Rparen: x.X.Rparen}} +} +func (x CaseClause) New() Ast { return CaseClause{&ast.CaseClause{Case: x.X.Case, Colon: x.X.Colon}} } +func (x ChanType) New() Ast { + return ChanType{&ast.ChanType{Begin: x.X.Begin, Arrow: x.X.Arrow, Dir: x.X.Dir}} +} +func (x CommClause) New() Ast { return CommClause{&ast.CommClause{Case: x.X.Case, Colon: x.X.Colon}} } +func (x CompositeLit) New() Ast { + return CompositeLit{&ast.CompositeLit{Lbrace: x.X.Lbrace, Rbrace: x.X.Rbrace}} +} +func (x DeclStmt) New() Ast { return DeclStmt{&ast.DeclStmt{}} } +func (x DeferStmt) New() Ast { return DeferStmt{&ast.DeferStmt{Defer: x.X.Defer}} } +func (x Ellipsis) New() Ast { return Ellipsis{&ast.Ellipsis{Ellipsis: x.X.Ellipsis}} } +func (x EmptyStmt) New() Ast { + return EmptyStmt{&ast.EmptyStmt{Semicolon: x.X.Semicolon, Implicit: x.X.Implicit}} +} +func (x ExprStmt) New() Ast { return ExprStmt{&ast.ExprStmt{}} } +func (x Field) New() Ast { return Field{&ast.Field{Doc: x.X.Doc, Comment: x.X.Comment}} } +func (x ForStmt) New() Ast { return ForStmt{&ast.ForStmt{For: x.X.For}} } +func (x FuncDecl) New() Ast { return FuncDecl{&ast.FuncDecl{Doc: x.X.Doc}} } +func (x FuncLit) New() Ast { return FuncLit{&ast.FuncLit{}} } +func (x FuncType) New() Ast { return FuncType{&ast.FuncType{Func: x.X.Func}} } +func (x GoStmt) New() Ast { return GoStmt{&ast.GoStmt{Go: x.X.Go}} } +func (x Ident) New() Ast { return Ident{&ast.Ident{NamePos: x.X.NamePos, Name: x.X.Name}} } +func (x IfStmt) New() Ast { return IfStmt{&ast.IfStmt{If: x.X.If}} } +func (x ImportSpec) New() Ast { + return ImportSpec{&ast.ImportSpec{Doc: x.X.Doc, Comment: x.X.Comment, EndPos: x.X.EndPos}} +} +func (x IncDecStmt) New() Ast { return IncDecStmt{&ast.IncDecStmt{TokPos: x.X.TokPos, Tok: x.X.Tok}} } +func (x IndexExpr) New() Ast { return IndexExpr{&ast.IndexExpr{Lbrack: x.X.Lbrack, Rbrack: x.X.Rbrack}} } +func (x InterfaceType) New() Ast { + return InterfaceType{&ast.InterfaceType{Interface: x.X.Interface, Incomplete: x.X.Incomplete}} +} +func (x KeyValueExpr) New() Ast { return KeyValueExpr{&ast.KeyValueExpr{Colon: x.X.Colon}} } +func (x LabeledStmt) New() Ast { return LabeledStmt{&ast.LabeledStmt{Colon: x.X.Colon}} } +func (x MapType) New() Ast { return MapType{&ast.MapType{Map: x.X.Map}} } +func (x Package) New() Ast { + return Package{&ast.Package{Name: x.X.Name, Scope: x.X.Scope, Imports: x.X.Imports}} +} +func (x ParenExpr) New() Ast { return ParenExpr{&ast.ParenExpr{Lparen: x.X.Lparen, Rparen: x.X.Rparen}} } +func (x RangeStmt) New() Ast { + return RangeStmt{&ast.RangeStmt{For: x.X.For, TokPos: x.X.TokPos, Tok: x.X.Tok}} +} +func (x SelectStmt) New() Ast { return SelectStmt{&ast.SelectStmt{Select: x.X.Select}} } +func (x SelectorExpr) New() Ast { return SelectorExpr{&ast.SelectorExpr{}} } +func (x SendStmt) New() Ast { return SendStmt{&ast.SendStmt{Arrow: x.X.Arrow}} } +func (x SliceExpr) New() Ast { return SliceExpr{&ast.SliceExpr{Lbrack: x.X.Lbrack, Rbrack: x.X.Rbrack}} } +func (x StarExpr) New() Ast { return StarExpr{&ast.StarExpr{Star: x.X.Star}} } +func (x StructType) New() Ast { return StructType{&ast.StructType{Incomplete: x.X.Incomplete}} } +func (x SwitchStmt) New() Ast { return SwitchStmt{&ast.SwitchStmt{Switch: x.X.Switch}} } +func (x TypeAssertExpr) New() Ast { + return TypeAssertExpr{&ast.TypeAssertExpr{Lparen: x.X.Lparen, Rparen: x.X.Rparen}} +} +func (x TypeSpec) New() Ast { return TypeSpec{&ast.TypeSpec{Doc: x.X.Doc, Comment: x.X.Comment}} } +func (x TypeSwitchStmt) New() Ast { return TypeSwitchStmt{&ast.TypeSwitchStmt{Switch: x.X.Switch}} } +func (x UnaryExpr) New() Ast { return UnaryExpr{&ast.UnaryExpr{OpPos: x.X.OpPos, Op: x.X.Op}} } +func (x ValueSpec) New() Ast { return ValueSpec{&ast.ValueSpec{Doc: x.X.Doc, Comment: x.X.Comment}} } + +// +// .................. functions Size() int +// +func (x ArrayType) Size() int { return 2 } +func (x AssignStmt) Size() int { return 2 } +func (x BadDecl) Size() int { return 0 } +func (x BadExpr) Size() int { return 0 } +func (x BadStmt) Size() int { return 0 } +func (x BasicLit) Size() int { return 0 } +func (x BinaryExpr) Size() int { return 2 } +func (x BranchStmt) Size() int { return 1 } +func (x CallExpr) Size() int { return 2 } +func (x CaseClause) Size() int { return 2 } +func (x ChanType) Size() int { return 1 } +func (x CommClause) Size() int { return 2 } +func (x CompositeLit) Size() int { return 2 } +func (x DeclStmt) Size() int { return 1 } +func (x DeferStmt) Size() int { return 1 } +func (x Ellipsis) Size() int { return 1 } +func (x EmptyStmt) Size() int { return 0 } +func (x ExprStmt) Size() int { return 1 } +func (x Field) Size() int { return 3 } +func (x ForStmt) Size() int { return 4 } +func (x FuncDecl) Size() int { return 4 } +func (x FuncLit) Size() int { return 2 } +func (x FuncType) Size() int { return 2 } +func (x GoStmt) Size() int { return 1 } +func (x Ident) Size() int { return 0 } +func (x IfStmt) Size() int { return 4 } +func (x ImportSpec) Size() int { return 2 } +func (x IncDecStmt) Size() int { return 1 } +func (x IndexExpr) Size() int { return 2 } +func (x InterfaceType) Size() int { return 1 } +func (x KeyValueExpr) Size() int { return 2 } +func (x LabeledStmt) Size() int { return 2 } +func (x MapType) Size() int { return 2 } +func (x Package) Size() int { return 2 } +func (x ParenExpr) Size() int { return 1 } +func (x RangeStmt) Size() int { return 4 } +func (x SelectStmt) Size() int { return 1 } +func (x SelectorExpr) Size() int { return 2 } +func (x SendStmt) Size() int { return 2 } +func (x SliceExpr) Size() int { return 4 } +func (x StarExpr) Size() int { return 1 } +func (x StructType) Size() int { return 1 } +func (x SwitchStmt) Size() int { return 3 } +func (x TypeAssertExpr) Size() int { return 2 } +func (x TypeSpec) Size() int { return 2 } +func (x TypeSwitchStmt) Size() int { return 3 } +func (x UnaryExpr) Size() int { return 1 } +func (x ValueSpec) Size() int { return 3 } + +// +// .................. functions Get(int) Ast +// +func (x ArrayType) Get(i int) Ast { return ToAst2(i, x.X.Len, x.X.Elt) } +func (x AssignStmt) Get(i int) Ast { + var slice []ast.Expr + switch i { + case 0: + slice = x.X.Lhs + case 1: + slice = x.X.Rhs + default: + return badIndex(i, 2) + } + if slice != nil { + return ExprSlice{slice} + } + return nil +} +func (x BadDecl) Get(i int) Ast { return badIndex(i, 0) } +func (x BadExpr) Get(i int) Ast { return badIndex(i, 0) } +func (x BadStmt) Get(i int) Ast { return badIndex(i, 0) } +func (x BasicLit) Get(i int) Ast { return badIndex(i, 0) } +func (x BinaryExpr) Get(i int) Ast { return ToAst2(i, x.X.X, x.X.Y) } +func (x BranchStmt) Get(i int) Ast { return Ident{x.X.Label} } +func (x CallExpr) Get(i int) Ast { + if i == 0 { + return ToAst(x.X.Fun) + } else if i == 1 { + if node := x.X.Args; node != nil { + return ExprSlice{node} + } + return nil + } else { + return badIndex(i, 2) + } +} +func (x CaseClause) Get(i int) Ast { + if i == 0 { + if list := x.X.List; list != nil { + return ExprSlice{list} + } + return nil + } else if i == 1 { + if list := x.X.Body; list != nil { + return StmtSlice{list} + } + return nil + } else { + return badIndex(i, 2) + } +} +func (x ChanType) Get(i int) Ast { return ToAst1(i, x.X.Value) } +func (x CommClause) Get(i int) Ast { + if i == 0 { + return ToAst(x.X.Comm) + } else if i == 1 { + if list := x.X.Body; list != nil { + return StmtSlice{list} + } + return nil + } else { + return badIndex(i, 2) + } +} +func (x CompositeLit) Get(i int) Ast { + if i == 0 { + return ToAst(x.X.Type) + } else if i == 1 { + if x.X.Elts != nil { + return ExprSlice{x.X.Elts} + } + return nil + } else { + return badIndex(i, 2) + } +} +func (x DeclStmt) Get(i int) Ast { return ToAst1(i, x.X.Decl) } +func (x DeferStmt) Get(i int) Ast { return CallExpr{x.X.Call} } +func (x Ellipsis) Get(i int) Ast { return ToAst1(i, x.X.Elt) } +func (x EmptyStmt) Get(i int) Ast { return badIndex(i, 0) } +func (x ExprStmt) Get(i int) Ast { return ToAst1(i, x.X.X) } +func (x Field) Get(i int) Ast { + if i == 0 { + if x.X.Names != nil { + return IdentSlice{x.X.Names} + } + return nil + } else if i == 1 { + return ToAst(x.X.Type) + } else if i == 2 { + return ToAst(x.X.Tag) + } else { + return badIndex(i, 3) + } +} +func (x ForStmt) Get(i int) Ast { + var node ast.Node + switch i { + case 0: + node = x.X.Init + case 1: + node = x.X.Cond + case 2: + node = x.X.Post + case 3: + node = x.X.Body + default: + return badIndex(i, 4) + } + return ToAst(node) +} +func (x FuncDecl) Get(i int) Ast { return ToAst4(i, x.X.Recv, x.X.Name, x.X.Type, x.X.Body) } +func (x FuncLit) Get(i int) Ast { return ToAst2(i, x.X.Type, x.X.Body) } +func (x FuncType) Get(i int) Ast { return ToAst2(i, x.X.Params, x.X.Results) } +func (x GoStmt) Get(i int) Ast { return CallExpr{x.X.Call} } +func (x Ident) Get(i int) Ast { return badIndex(i, 0) } +func (x IfStmt) Get(i int) Ast { return ToAst4(i, x.X.Init, x.X.Cond, x.X.Body, x.X.Else) } +func (x ImportSpec) Get(i int) Ast { return ToAst2(i, x.X.Name, x.X.Path) } +func (x IncDecStmt) Get(i int) Ast { return ToAst1(i, x.X.X) } +func (x IndexExpr) Get(i int) Ast { return ToAst2(i, x.X.X, x.X.Index) } +func (x InterfaceType) Get(i int) Ast { + if i == 0 { + if x.X.Methods != nil { + return FieldList{x.X.Methods} + } + return nil + } else { + return badIndex(i, 1) + } +} +func (x KeyValueExpr) Get(i int) Ast { return ToAst2(i, x.X.Key, x.X.Value) } +func (x LabeledStmt) Get(i int) Ast { return ToAst2(i, x.X.Label, x.X.Stmt) } +func (x MapType) Get(i int) Ast { return ToAst2(i, x.X.Key, x.X.Value) } +func (x Package) Get(i int) Ast { return nil } // TODO +func (x ParenExpr) Get(i int) Ast { return ToAst1(i, x.X.X) } +func (x RangeStmt) Get(i int) Ast { return ToAst4(i, x.X.Key, x.X.Value, x.X.X, x.X.Body) } +func (x SelectStmt) Get(i int) Ast { return ToAst1(i, x.X.Body) } +func (x SelectorExpr) Get(i int) Ast { return ToAst2(i, x.X.X, x.X.Sel) } +func (x SendStmt) Get(i int) Ast { return ToAst2(i, x.X.Chan, x.X.Value) } +func (x SliceExpr) Get(i int) Ast { return ToAst4(i, x.X.X, x.X.Low, x.X.High, x.X.Max) } +func (x StarExpr) Get(i int) Ast { return ToAst1(i, x.X.X) } +func (x StructType) Get(i int) Ast { return ToAst1(i, x.X.Fields) } +func (x SwitchStmt) Get(i int) Ast { return ToAst3(i, x.X.Init, x.X.Tag, x.X.Body) } +func (x TypeAssertExpr) Get(i int) Ast { return ToAst2(i, x.X.X, x.X.Type) } +func (x TypeSpec) Get(i int) Ast { return ToAst2(i, x.X.Name, x.X.Type) } +func (x TypeSwitchStmt) Get(i int) Ast { return ToAst3(i, x.X.Init, x.X.Assign, x.X.Body) } +func (x UnaryExpr) Get(i int) Ast { return ToAst1(i, x.X.X) } +func (x ValueSpec) Get(i int) Ast { + switch i { + case 0: + if x.X.Names != nil { + return IdentSlice{x.X.Names} + } + case 1: + if x.X.Type != nil { + return ToAst(x.X.Type) + } + case 2: + if x.X.Values != nil { + return ExprSlice{x.X.Values} + } + default: + return badIndex(i, 3) + } + return nil +} + +// +// .................. functions Set(int, Ast) +// +func (x ArrayType) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.Len = expr + } else if i == 1 { + x.X.Elt = expr + } else { + badIndex(i, 2) + } +} +func (x AssignStmt) Set(i int, child Ast) { + exprs := ToExprSlice(child) + if i == 0 { + x.X.Lhs = exprs + } else if i == 1 { + x.X.Rhs = exprs + } else { + badIndex(i, 2) + } +} +func (x BadDecl) Set(i int, child Ast) { badIndex(i, 0) } +func (x BadExpr) Set(i int, child Ast) { badIndex(i, 0) } +func (x BadStmt) Set(i int, child Ast) { badIndex(i, 0) } +func (x BasicLit) Set(i int, child Ast) { badIndex(i, 0) } +func (x BinaryExpr) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.X = expr + } else if i == 1 { + x.X.Y = expr + } else { + badIndex(i, 2) + } +} +func (x BranchStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Label = ToIdent(child) + } else { + badIndex(i, 1) + } +} +func (x CallExpr) Set(i int, child Ast) { + if i == 0 { + x.X.Fun = ToExpr(child) + } else if i == 1 { + x.X.Args = ToExprSlice(child) + } else { + badIndex(i, 2) + } +} +func (x CaseClause) Set(i int, child Ast) { + if i == 0 { + x.X.List = ToExprSlice(child) + } else if i == 1 { + x.X.Body = ToStmtSlice(child) + } else { + badIndex(i, 2) + } +} +func (x ChanType) Set(i int, child Ast) { + if i == 0 { + x.X.Value = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x CommClause) Set(i int, child Ast) { + if i == 0 { + x.X.Comm = ToStmt(child) + } else if i == 1 { + x.X.Body = ToStmtSlice(child) + } else { + badIndex(i, 2) + } +} +func (x CompositeLit) Set(i int, child Ast) { + if i == 0 { + x.X.Type = ToExpr(child) + } else if i == 1 { + x.X.Elts = ToExprSlice(child) + } else { + badIndex(i, 2) + } +} +func (x DeclStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Decl = ToDecl(child) + } else { + badIndex(i, 1) + } +} +func (x DeferStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Call = ToCallExpr(child) + } else { + badIndex(i, 1) + } +} +func (x Ellipsis) Set(i int, child Ast) { + if i == 0 { + x.X.Elt = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x EmptyStmt) Set(i int, child Ast) { badIndex(i, 0) } +func (x ExprStmt) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x Field) Set(i int, child Ast) { + if i == 0 { + x.X.Names = ToIdentSlice(child) + } else if i == 1 { + x.X.Type = ToExpr(child) + } else if i == 2 { + x.X.Tag = ToBasicLit(child) + } else { + badIndex(i, 3) + } +} +func (x ForStmt) Set(i int, child Ast) { + switch i { + case 0: + x.X.Init = ToStmt(child) + case 1: + x.X.Cond = ToExpr(child) + case 2: + x.X.Post = ToStmt(child) + case 3: + x.X.Body = ToBlockStmt(child) + default: + badIndex(i, 4) + } +} +func (x FuncDecl) Set(i int, child Ast) { + switch i { + case 0: + x.X.Recv = ToFieldList(child) + case 1: + x.X.Name = ToIdent(child) + case 2: + x.X.Type = ToFuncType(child) + case 3: + x.X.Body = ToBlockStmt(child) + default: + badIndex(i, 4) + } +} +func (x FuncLit) Set(i int, child Ast) { + if i == 0 { + x.X.Type = ToFuncType(child) + } else if i == 1 { + x.X.Body = ToBlockStmt(child) + } else { + badIndex(i, 2) + } +} +func (x FuncType) Set(i int, child Ast) { + list := ToFieldList(child) + if i == 0 { + x.X.Params = list + } else if i == 1 { + x.X.Results = list + } else { + badIndex(i, 2) + } +} +func (x GoStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Call = ToCallExpr(child) + } else { + badIndex(i, 1) + } +} +func (x Ident) Set(i int, child Ast) { badIndex(i, 0) } +func (x IfStmt) Set(i int, child Ast) { + switch i { + case 0: + x.X.Init = ToStmt(child) + case 1: + x.X.Cond = ToExpr(child) + case 2: + x.X.Body = ToBlockStmt(child) + case 3: + x.X.Else = ToStmt(child) + default: + badIndex(i, 4) + } +} +func (x ImportSpec) Set(i int, child Ast) { + if i == 0 { + x.X.Name = ToIdent(child) + } else if i == 1 { + x.X.Path = ToBasicLit(child) + } else { + badIndex(i, 2) + } +} +func (x IncDecStmt) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x IndexExpr) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.X = expr + } else if i == 1 { + x.X.Index = expr + } else { + badIndex(i, 2) + } +} +func (x InterfaceType) Set(i int, child Ast) { + if i == 0 { + x.X.Methods = ToFieldList(child) + } else { + badIndex(i, 1) + } +} +func (x KeyValueExpr) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.Key = expr + } else if i == 1 { + x.X.Value = expr + } else { + badIndex(i, 2) + } +} +func (x LabeledStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Label = ToIdent(child) + } else if i == 1 { + x.X.Stmt = ToStmt(child) + } else { + badIndex(i, 2) + } +} +func (x MapType) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.Key = expr + } else if i == 1 { + x.X.Value = expr + } else { + badIndex(i, 2) + } +} +func (x Package) Set(i int, child Ast) {} // TODO +func (x ParenExpr) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x RangeStmt) Set(i int, child Ast) { + switch i { + case 0: + x.X.Key = ToExpr(child) + case 1: + x.X.Value = ToExpr(child) + case 2: + x.X.X = ToExpr(child) + case 3: + x.X.Body = ToBlockStmt(child) + default: + badIndex(i, 4) + } +} +func (x SelectStmt) Set(i int, child Ast) { + if i == 0 { + x.X.Body = ToBlockStmt(child) + } else { + badIndex(i, 1) + } +} +func (x SelectorExpr) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else if i == 1 { + x.X.Sel = ToIdent(child) + } else { + badIndex(i, 2) + } +} +func (x SendStmt) Set(i int, child Ast) { + expr := ToExpr(child) + if i == 0 { + x.X.Chan = expr + } else if i == 1 { + x.X.Value = expr + } else { + badIndex(i, 2) + } +} +func (x SliceExpr) Set(i int, child Ast) { + expr := ToExpr(child) + switch i { + case 0: + x.X.X = expr + case 1: + x.X.Low = expr + case 2: + x.X.High = expr + case 3: + x.X.Max = expr + x.X.Slice3 = expr != nil + default: + badIndex(i, 4) + } +} +func (x StarExpr) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x StructType) Set(i int, child Ast) { + if i == 0 { + x.X.Fields = ToFieldList(child) + } else { + badIndex(i, 1) + } +} +func (x SwitchStmt) Set(i int, child Ast) { + switch i { + case 0: + x.X.Init = ToStmt(child) + case 1: + x.X.Tag = ToExpr(child) + case 2: + x.X.Body = ToBlockStmt(child) + default: + badIndex(i, 3) + } +} +func (x TypeAssertExpr) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else if i == 1 { + x.X.Type = ToExpr(child) + } else { + badIndex(i, 2) + } +} +func (x TypeSpec) Set(i int, child Ast) { + if i == 0 { + x.X.Name = ToIdent(child) + } else if i == 1 { + x.X.Type = ToExpr(child) + } else { + badIndex(i, 2) + } +} +func (x TypeSwitchStmt) Set(i int, child Ast) { + switch i { + case 0: + x.X.Init = ToStmt(child) + case 1: + x.X.Assign = ToStmt(child) + case 2: + x.X.Body = ToBlockStmt(child) + default: + badIndex(i, 3) + } +} +func (x UnaryExpr) Set(i int, child Ast) { + if i == 0 { + x.X.X = ToExpr(child) + } else { + badIndex(i, 1) + } +} +func (x ValueSpec) Set(i int, child Ast) { + switch i { + case 0: + x.X.Names = ToIdentSlice(child) + case 1: + x.X.Type = ToExpr(child) + case 2: + x.X.Values = ToExprSlice(child) + default: + badIndex(i, 3) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/ast2/ast_slice.go b/vendor/github.com/cosmos72/gomacro/ast2/ast_slice.go new file mode 100644 index 0000000..35af48d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/ast_slice.go @@ -0,0 +1,183 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * ast_slice.go + * + * Created on Feb 25, 2017 + * Author Massimiliano Ghilardi + */ + +package ast2 + +import ( + "go/ast" + "go/token" +) + +// Ast wrappers for variable-length slices of ast.Nodes - they are not full-blown ast.Node + +func (x AstSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x NodeSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ExprSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x FieldSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x DeclSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x IdentSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x SpecSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x StmtSlice) Interface() interface{} { return asInterface(x.X, x.X == nil) } + +func (x AstSlice) Op() token.Token { return token.COMMA } // FIXME +func (x NodeSlice) Op() token.Token { return token.COMMA } // FIXME +func (x ExprSlice) Op() token.Token { return token.COMMA } // FIXME +func (x FieldSlice) Op() token.Token { return token.SEMICOLON } // FIXME +func (x DeclSlice) Op() token.Token { return token.SEMICOLON } // FIXME +func (x IdentSlice) Op() token.Token { return token.COMMA } // FIXME +func (x SpecSlice) Op() token.Token { return token.SEMICOLON } // FIXME +func (x StmtSlice) Op() token.Token { return token.SEMICOLON } // FIXME + +func (x AstSlice) New() Ast { return AstSlice{} } +func (x NodeSlice) New() Ast { return NodeSlice{} } +func (x ExprSlice) New() Ast { return ExprSlice{} } +func (x FieldSlice) New() Ast { return FieldSlice{} } +func (x DeclSlice) New() Ast { return DeclSlice{} } +func (x IdentSlice) New() Ast { return IdentSlice{} } +func (x SpecSlice) New() Ast { return SpecSlice{} } +func (x StmtSlice) New() Ast { return StmtSlice{} } + +func (x AstSlice) Size() int { return len(x.X) } +func (x NodeSlice) Size() int { return len(x.X) } +func (x ExprSlice) Size() int { return len(x.X) } +func (x FieldSlice) Size() int { return len(x.X) } +func (x DeclSlice) Size() int { return len(x.X) } +func (x IdentSlice) Size() int { return len(x.X) } +func (x SpecSlice) Size() int { return len(x.X) } +func (x StmtSlice) Size() int { return len(x.X) } + +func (x AstSlice) Get(i int) Ast { return x.X[i] } +func (x NodeSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x ExprSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x FieldSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x DeclSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x IdentSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x SpecSlice) Get(i int) Ast { return ToAst(x.X[i]) } +func (x StmtSlice) Get(i int) Ast { return ToAst(x.X[i]) } + +func (x AstSlice) Set(i int, child Ast) { x.X[i] = child } +func (x NodeSlice) Set(i int, child Ast) { x.X[i] = ToNode(child) } +func (x ExprSlice) Set(i int, child Ast) { x.X[i] = ToExpr(child) } +func (x FieldSlice) Set(i int, child Ast) { x.X[i] = ToField(child) } +func (x DeclSlice) Set(i int, child Ast) { x.X[i] = ToDecl(child) } +func (x IdentSlice) Set(i int, child Ast) { x.X[i] = ToIdent(child) } +func (x SpecSlice) Set(i int, child Ast) { x.X[i] = ToSpec(child) } +func (x StmtSlice) Set(i int, child Ast) { x.X[i] = ToStmt(child) } + +func (x AstSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x NodeSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x ExprSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x FieldSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x DeclSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x IdentSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x SpecSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } +func (x StmtSlice) Slice(lo, hi int) AstWithSlice { x.X = x.X[lo:hi]; return x } + +func (x AstSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, child); return x } +func (x NodeSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToNode(child)); return x } +func (x ExprSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToExpr(child)); return x } +func (x FieldSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToField(child)); return x } +func (x DeclSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToDecl(child)); return x } +func (x IdentSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToIdent(child)); return x } +func (x SpecSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToSpec(child)); return x } +func (x StmtSlice) Append(child Ast) AstWithSlice { x.X = append(x.X, ToStmt(child)); return x } + +// variable-length ast.Nodes + +func (x BlockStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x FieldList) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x File) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x GenDecl) Interface() interface{} { return asInterface(x.X, x.X == nil) } +func (x ReturnStmt) Interface() interface{} { return asInterface(x.X, x.X == nil) } + +func (x BlockStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x FieldList) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x File) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x GenDecl) Node() ast.Node { return asNode(x.X, x.X == nil) } +func (x ReturnStmt) Node() ast.Node { return asNode(x.X, x.X == nil) } + +func (x BlockStmt) Op() token.Token { return token.LBRACE } +func (x FieldList) Op() token.Token { return token.ELLIPSIS } +func (x File) Op() token.Token { return token.EOF } +func (x GenDecl) Op() token.Token { return x.X.Tok } +func (x ReturnStmt) Op() token.Token { return token.RETURN } + +func (x BlockStmt) New() Ast { return BlockStmt{&ast.BlockStmt{Lbrace: x.X.Lbrace, Rbrace: x.X.Rbrace}} } +func (x FieldList) New() Ast { return FieldList{&ast.FieldList{}} } +func (x File) New() Ast { + return File{&ast.File{Doc: x.X.Doc, Package: x.X.Package, Name: x.X.Name, Scope: x.X.Scope, Imports: x.X.Imports, Comments: x.X.Comments}} +} +func (x GenDecl) New() Ast { + return GenDecl{&ast.GenDecl{Doc: x.X.Doc, TokPos: x.X.TokPos, Tok: x.X.Tok, Lparen: x.X.Lparen, Rparen: x.X.Rparen}} +} + +// do not copy position of "return" keyword. +// otherwise go/format may insert a newline between "return" and the following expressions +func (x ReturnStmt) New() Ast { return ReturnStmt{&ast.ReturnStmt{}} } + +func (x BlockStmt) Size() int { return len(x.X.List) } +func (x FieldList) Size() int { return len(x.X.List) } +func (x File) Size() int { return len(x.X.Decls) } +func (x GenDecl) Size() int { return len(x.X.Specs) } +func (x ReturnStmt) Size() int { return len(x.X.Results) } + +func (x BlockStmt) Get(i int) Ast { return ToAst(x.X.List[i]) } +func (x FieldList) Get(i int) Ast { return ToAst(x.X.List[i]) } +func (x File) Get(i int) Ast { return ToAst(x.X.Decls[i]) } +func (x GenDecl) Get(i int) Ast { return ToAst(x.X.Specs[i]) } +func (x ReturnStmt) Get(i int) Ast { return ToAst(x.X.Results[i]) } + +func (x BlockStmt) Set(i int, child Ast) { x.X.List[i] = ToStmt(child) } +func (x FieldList) Set(i int, child Ast) { x.X.List[i] = ToField(child) } +func (x File) Set(i int, child Ast) { x.X.Decls[i] = ToDecl(child) } +func (x GenDecl) Set(i int, child Ast) { x.X.Specs[i] = ToSpec(child) } +func (x ReturnStmt) Set(i int, child Ast) { x.X.Results[i] = ToExpr(child) } + +func (x BlockStmt) Slice(lo, hi int) AstWithSlice { x.X.List = x.X.List[lo:hi]; return x } +func (x FieldList) Slice(lo, hi int) AstWithSlice { x.X.List = x.X.List[lo:hi]; return x } +func (x File) Slice(lo, hi int) AstWithSlice { x.X.Decls = x.X.Decls[lo:hi]; return x } +func (x GenDecl) Slice(lo, hi int) AstWithSlice { x.X.Specs = x.X.Specs[lo:hi]; return x } +func (x ReturnStmt) Slice(lo, hi int) AstWithSlice { x.X.Results = x.X.Results[lo:hi]; return x } + +func (x BlockStmt) Append(child Ast) AstWithSlice { + x.X.List = append(x.X.List, ToStmt(child)) + return x +} +func (x FieldList) Append(child Ast) AstWithSlice { + x.X.List = append(x.X.List, ToField(child)) + return x +} +func (x File) Append(child Ast) AstWithSlice { + x.X.Decls = append(x.X.Decls, ToDecl(child)) + return x +} +func (x GenDecl) Append(child Ast) AstWithSlice { + x.X.Specs = append(x.X.Specs, ToSpec(child)) + return x +} +func (x ReturnStmt) Append(child Ast) AstWithSlice { + x.X.Results = append(x.X.Results, ToExpr(child)) + return x +} diff --git a/vendor/github.com/cosmos72/gomacro/ast2/error.go b/vendor/github.com/cosmos72/gomacro/ast2/error.go new file mode 100644 index 0000000..9490f09 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/error.go @@ -0,0 +1,44 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * error.go + * + * Created on: Mar 18, 2017 + * Author: Massimiliano Ghilardi + */ + +package ast2 + +import ( + "errors" + "fmt" +) + +func badIndex(index int, size int) AstWithNode { + if size > 0 { + errorf("index out of range: %d not in 0...%d", index, size-1) + } else { + errorf("index out of range: %d, slice is empty", index) + } + return nil +} + +func errorf(format string, args ...interface{}) { + panic(errors.New(fmt.Sprintf(format, args...))) +} diff --git a/vendor/github.com/cosmos72/gomacro/ast2/x_package.go b/vendor/github.com/cosmos72/gomacro/ast2/x_package.go new file mode 100644 index 0000000..e4e275c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/ast2/x_package.go @@ -0,0 +1,218 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/ast2" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package ast2 + +import ( + "go/ast" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/ast2" +func init() { + imports.Packages["github.com/cosmos72/gomacro/ast2"] = imports.Package{ + Binds: map[string]r.Value{ + "AnyToAst": r.ValueOf(AnyToAst), + "AnyToAstWithNode": r.ValueOf(AnyToAstWithNode), + "AnyToAstWithSlice": r.ValueOf(AnyToAstWithSlice), + "BlockStmtToExpr": r.ValueOf(BlockStmtToExpr), + "ToAst": r.ValueOf(ToAst), + "ToAst1": r.ValueOf(ToAst1), + "ToAst2": r.ValueOf(ToAst2), + "ToAst3": r.ValueOf(ToAst3), + "ToAst4": r.ValueOf(ToAst4), + "ToAstWithSlice": r.ValueOf(ToAstWithSlice), + "ToBasicLit": r.ValueOf(ToBasicLit), + "ToBlockStmt": r.ValueOf(ToBlockStmt), + "ToCallExpr": r.ValueOf(ToCallExpr), + "ToDecl": r.ValueOf(ToDecl), + "ToExpr": r.ValueOf(ToExpr), + "ToExprSlice": r.ValueOf(ToExprSlice), + "ToField": r.ValueOf(ToField), + "ToFieldList": r.ValueOf(ToFieldList), + "ToFile": r.ValueOf(ToFile), + "ToFuncType": r.ValueOf(ToFuncType), + "ToIdent": r.ValueOf(ToIdent), + "ToIdentSlice": r.ValueOf(ToIdentSlice), + "ToImportSpec": r.ValueOf(ToImportSpec), + "ToNode": r.ValueOf(ToNode), + "ToSpec": r.ValueOf(ToSpec), + "ToStmt": r.ValueOf(ToStmt), + "ToStmtSlice": r.ValueOf(ToStmtSlice), + }, + Types: map[string]r.Type{ + "ArrayType": r.TypeOf((*ArrayType)(nil)).Elem(), + "AssignStmt": r.TypeOf((*AssignStmt)(nil)).Elem(), + "Ast": r.TypeOf((*Ast)(nil)).Elem(), + "AstWithNode": r.TypeOf((*AstWithNode)(nil)).Elem(), + "AstWithSlice": r.TypeOf((*AstWithSlice)(nil)).Elem(), + "BadDecl": r.TypeOf((*BadDecl)(nil)).Elem(), + "BadExpr": r.TypeOf((*BadExpr)(nil)).Elem(), + "BadStmt": r.TypeOf((*BadStmt)(nil)).Elem(), + "BasicLit": r.TypeOf((*BasicLit)(nil)).Elem(), + "BinaryExpr": r.TypeOf((*BinaryExpr)(nil)).Elem(), + "BlockStmt": r.TypeOf((*BlockStmt)(nil)).Elem(), + "BranchStmt": r.TypeOf((*BranchStmt)(nil)).Elem(), + "CallExpr": r.TypeOf((*CallExpr)(nil)).Elem(), + "CaseClause": r.TypeOf((*CaseClause)(nil)).Elem(), + "ChanType": r.TypeOf((*ChanType)(nil)).Elem(), + "CommClause": r.TypeOf((*CommClause)(nil)).Elem(), + "CompositeLit": r.TypeOf((*CompositeLit)(nil)).Elem(), + "DeclSlice": r.TypeOf((*DeclSlice)(nil)).Elem(), + "DeclStmt": r.TypeOf((*DeclStmt)(nil)).Elem(), + "DeferStmt": r.TypeOf((*DeferStmt)(nil)).Elem(), + "Ellipsis": r.TypeOf((*Ellipsis)(nil)).Elem(), + "EmptyStmt": r.TypeOf((*EmptyStmt)(nil)).Elem(), + "ExprSlice": r.TypeOf((*ExprSlice)(nil)).Elem(), + "ExprStmt": r.TypeOf((*ExprStmt)(nil)).Elem(), + "Field": r.TypeOf((*Field)(nil)).Elem(), + "FieldList": r.TypeOf((*FieldList)(nil)).Elem(), + "FieldSlice": r.TypeOf((*FieldSlice)(nil)).Elem(), + "File": r.TypeOf((*File)(nil)).Elem(), + "ForStmt": r.TypeOf((*ForStmt)(nil)).Elem(), + "FuncDecl": r.TypeOf((*FuncDecl)(nil)).Elem(), + "FuncLit": r.TypeOf((*FuncLit)(nil)).Elem(), + "FuncType": r.TypeOf((*FuncType)(nil)).Elem(), + "GenDecl": r.TypeOf((*GenDecl)(nil)).Elem(), + "GoStmt": r.TypeOf((*GoStmt)(nil)).Elem(), + "Ident": r.TypeOf((*Ident)(nil)).Elem(), + "IdentSlice": r.TypeOf((*IdentSlice)(nil)).Elem(), + "IfStmt": r.TypeOf((*IfStmt)(nil)).Elem(), + "ImportSpec": r.TypeOf((*ImportSpec)(nil)).Elem(), + "IncDecStmt": r.TypeOf((*IncDecStmt)(nil)).Elem(), + "IndexExpr": r.TypeOf((*IndexExpr)(nil)).Elem(), + "InterfaceType": r.TypeOf((*InterfaceType)(nil)).Elem(), + "KeyValueExpr": r.TypeOf((*KeyValueExpr)(nil)).Elem(), + "LabeledStmt": r.TypeOf((*LabeledStmt)(nil)).Elem(), + "MapType": r.TypeOf((*MapType)(nil)).Elem(), + "NodeSlice": r.TypeOf((*NodeSlice)(nil)).Elem(), + "Package": r.TypeOf((*Package)(nil)).Elem(), + "ParenExpr": r.TypeOf((*ParenExpr)(nil)).Elem(), + "RangeStmt": r.TypeOf((*RangeStmt)(nil)).Elem(), + "ReturnStmt": r.TypeOf((*ReturnStmt)(nil)).Elem(), + "SelectStmt": r.TypeOf((*SelectStmt)(nil)).Elem(), + "SelectorExpr": r.TypeOf((*SelectorExpr)(nil)).Elem(), + "SendStmt": r.TypeOf((*SendStmt)(nil)).Elem(), + "SliceExpr": r.TypeOf((*SliceExpr)(nil)).Elem(), + "SpecSlice": r.TypeOf((*SpecSlice)(nil)).Elem(), + "StarExpr": r.TypeOf((*StarExpr)(nil)).Elem(), + "StmtSlice": r.TypeOf((*StmtSlice)(nil)).Elem(), + "StructType": r.TypeOf((*StructType)(nil)).Elem(), + "SwitchStmt": r.TypeOf((*SwitchStmt)(nil)).Elem(), + "TypeAssertExpr": r.TypeOf((*TypeAssertExpr)(nil)).Elem(), + "TypeSpec": r.TypeOf((*TypeSpec)(nil)).Elem(), + "TypeSwitchStmt": r.TypeOf((*TypeSwitchStmt)(nil)).Elem(), + "UnaryExpr": r.TypeOf((*UnaryExpr)(nil)).Elem(), + "ValueSpec": r.TypeOf((*ValueSpec)(nil)).Elem(), + }, + Proxies: map[string]r.Type{ + "Ast": r.TypeOf((*Ast_github_com_cosmos72_gomacro_ast2)(nil)).Elem(), + "AstWithNode": r.TypeOf((*AstWithNode_github_com_cosmos72_gomacro_ast2)(nil)).Elem(), + "AstWithSlice": r.TypeOf((*AstWithSlice_github_com_cosmos72_gomacro_ast2)(nil)).Elem(), + }} +} + +// --------------- proxy for github.com/cosmos72/gomacro/ast2.Ast --------------- +type Ast_github_com_cosmos72_gomacro_ast2 struct { + Object interface{} + Get_ func(i int) Ast + Interface_ func() interface{} + New_ func() Ast + Op_ func() token.Token + Set_ func(i int, child Ast) + Size_ func() int +} + +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) Get(i int) Ast { + return Proxy.Get_(i) +} +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) Interface() interface{} { + return Proxy.Interface_() +} +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) New() Ast { + return Proxy.New_() +} +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) Op() token.Token { + return Proxy.Op_() +} +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) Set(i int, child Ast) { + Proxy.Set_(i, child) +} +func (Proxy *Ast_github_com_cosmos72_gomacro_ast2) Size() int { + return Proxy.Size_() +} + +// --------------- proxy for github.com/cosmos72/gomacro/ast2.AstWithNode --------------- +type AstWithNode_github_com_cosmos72_gomacro_ast2 struct { + Object interface{} + Get_ func(i int) Ast + Interface_ func() interface{} + New_ func() Ast + Node_ func() ast.Node + Op_ func() token.Token + Set_ func(i int, child Ast) + Size_ func() int +} + +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Get(i int) Ast { + return Proxy.Get_(i) +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Interface() interface{} { + return Proxy.Interface_() +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) New() Ast { + return Proxy.New_() +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Node() ast.Node { + return Proxy.Node_() +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Op() token.Token { + return Proxy.Op_() +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Set(i int, child Ast) { + Proxy.Set_(i, child) +} +func (Proxy *AstWithNode_github_com_cosmos72_gomacro_ast2) Size() int { + return Proxy.Size_() +} + +// --------------- proxy for github.com/cosmos72/gomacro/ast2.AstWithSlice --------------- +type AstWithSlice_github_com_cosmos72_gomacro_ast2 struct { + Object interface{} + Append_ func(child Ast) AstWithSlice + Get_ func(i int) Ast + Interface_ func() interface{} + New_ func() Ast + Op_ func() token.Token + Set_ func(i int, child Ast) + Size_ func() int + Slice_ func(lo int, hi int) AstWithSlice +} + +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Append(child Ast) AstWithSlice { + return Proxy.Append_(child) +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Get(i int) Ast { + return Proxy.Get_(i) +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Interface() interface{} { + return Proxy.Interface_() +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) New() Ast { + return Proxy.New_() +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Op() token.Token { + return Proxy.Op_() +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Set(i int, child Ast) { + Proxy.Set_(i, child) +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Size() int { + return Proxy.Size_() +} +func (Proxy *AstWithSlice_github_com_cosmos72_gomacro_ast2) Slice(lo int, hi int) AstWithSlice { + return Proxy.Slice_(lo, hi) +} diff --git a/vendor/github.com/cosmos72/gomacro/base/constants.go b/vendor/github.com/cosmos72/gomacro/base/constants.go new file mode 100644 index 0000000..4155714 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/constants.go @@ -0,0 +1,115 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * constants.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + r "reflect" +) + +type none struct{} + +const ( + StrGensymInterface = "\u0080" // name of extra struct field needed by the interpreter when creating interface proxies + StrGensymPrivate = "\u00AD" // prefix to generate names for unexported struct fields + StrGensymEmbedded = "\u00BB" // prefix to generate names for embedded struct fields + StrGensym = "\U000124AD" // prefix to generate names in macros - arbitrarily chosen U+124AD CUNEIFORM SIGN ERIN2 X - reasons: + // * accepted by Go compiler identifier name in source code + // * belongs to an ancient language no longer spoken, so hopefully low collision risk + // * outside Unicode basic place, so hopefully lower collision risk + // * relatively simple glyph picture + + MaxUint16 = ^uint16(0) + MaxUint = ^uint(0) + MinUint = 0 + MaxInt = int(MaxUint >> 1) + MinInt = ^MaxInt +) + +var ( + Nil = r.Value{} + + None = r.ValueOf(none{}) // used to indicate "no value" + + True = r.ValueOf(true) + False = r.ValueOf(false) + + One = r.ValueOf(1) + + TypeOfInt = r.TypeOf(int(0)) + TypeOfInt8 = r.TypeOf(int8(0)) + TypeOfInt16 = r.TypeOf(int16(0)) + TypeOfInt32 = r.TypeOf(int32(0)) + TypeOfInt64 = r.TypeOf(int64(0)) + + TypeOfUint = r.TypeOf(uint(0)) + TypeOfUint8 = r.TypeOf(uint8(0)) + TypeOfUint16 = r.TypeOf(uint16(0)) + TypeOfUint32 = r.TypeOf(uint32(0)) + TypeOfUint64 = r.TypeOf(uint64(0)) + TypeOfUintptr = r.TypeOf(uintptr(0)) + + TypeOfFloat32 = r.TypeOf(float32(0)) + TypeOfFloat64 = r.TypeOf(float64(0)) + TypeOfComplex64 = r.TypeOf(complex64(0)) + TypeOfComplex128 = r.TypeOf(complex128(0)) + + TypeOfBool = r.TypeOf(false) + TypeOfByte = r.TypeOf(byte(0)) + TypeOfRune = r.TypeOf(rune(0)) + TypeOfString = r.TypeOf("") + TypeOfInterface = r.TypeOf((*interface{})(nil)).Elem() + TypeOfError = r.TypeOf((*error)(nil)).Elem() + TypeOfDeferFunc = r.TypeOf(func() {}) + TypeOfReflectType = r.TypeOf((*r.Type)(nil)).Elem() // inception + + TypeOfSliceOfByte = r.TypeOf([]byte{}) + TypeOfSliceOfInterface = r.TypeOf([]interface{}{}) + + TypeOfPtrInt = r.TypeOf((*int)(nil)) + TypeOfPtrInt8 = r.TypeOf((*int8)(nil)) + TypeOfPtrInt16 = r.TypeOf((*int16)(nil)) + TypeOfPtrInt32 = r.TypeOf((*int32)(nil)) + TypeOfPtrInt64 = r.TypeOf((*int64)(nil)) + + TypeOfPtrUint = r.TypeOf((*uint)(nil)) + TypeOfPtrUint8 = r.TypeOf((*uint8)(nil)) + TypeOfPtrUint16 = r.TypeOf((*uint16)(nil)) + TypeOfPtrUint32 = r.TypeOf((*uint32)(nil)) + TypeOfPtrUint64 = r.TypeOf((*uint64)(nil)) + TypeOfPtrUintptr = r.TypeOf((*uintptr)(nil)) + + TypeOfPtrFloat32 = r.TypeOf((*float32)(nil)) + TypeOfPtrFloat64 = r.TypeOf((*float64)(nil)) + TypeOfPtrComplex64 = r.TypeOf((*complex64)(nil)) + TypeOfPtrComplex128 = r.TypeOf((*complex128)(nil)) + + TypeOfPtrBool = r.TypeOf((*bool)(nil)) + TypeOfPtrString = r.TypeOf((*string)(nil)) + + ZeroStrings = []string{} + ZeroTypes = []r.Type{} + ZeroValues = []r.Value{} +) diff --git a/vendor/github.com/cosmos72/gomacro/base/genimport.go b/vendor/github.com/cosmos72/gomacro/base/genimport.go new file mode 100644 index 0000000..46d743f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/genimport.go @@ -0,0 +1,353 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * import_wrappers.go + * + * Created on May 26, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "bytes" + "fmt" + "go/constant" + "go/types" + "math" + "strconv" + "strings" +) + +type genimport struct { + globals *Globals + mode ImportMode + gpkg *types.Package + scope *types.Scope + names []string + out *bytes.Buffer + path string + name, name_ string + suffix string + reflect string +} + +func (g *Globals) writeImportFile(out *bytes.Buffer, path string, gpkg *types.Package, mode ImportMode) (isEmpty bool) { + + gen := g.newGenImport(out, path, gpkg, mode) + if gen == nil { + return true + } + gen.write() + return false +} + +func (g *Globals) newGenImport(out *bytes.Buffer, path string, gpkg *types.Package, mode ImportMode) *genimport { + scope := gpkg.Scope() + names := scope.Names() + + isEmpty := true + for _, name := range names { + if obj := scope.Lookup(name); obj.Exported() { + switch obj.(type) { + case *types.Const, *types.Var, *types.Func, *types.TypeName: + isEmpty = false + break + } + } + } + if isEmpty { + return nil + } + + gen := &genimport{globals: g, mode: mode, gpkg: gpkg, scope: scope, names: names, out: out, path: path} + + name := path[1+strings.LastIndexByte(path, '/'):] + name = sanitizeIdentifier(name) + gen.name = name + + if mode == ImInception { + gen.reflect = "r." + } else { + gen.name_ = name + "." + } + if mode != ImSharedLib { + gen.suffix = fmt.Sprintf("_%s", sanitizeIdentifier(path)) + } + return gen +} + +func (gen *genimport) write() { + + gen.writePreamble() + + gen.writeBinds() + gen.writeTypes() + gen.writeProxies() + gen.writeUntypeds() + gen.writeWrappers() + + if gen.mode == ImSharedLib { + gen.out.WriteString("\n}\n") + } else { + gen.out.WriteString("\n\t}\n}\n") + } + gen.writeInterfaceProxies() +} + +type mapdecl struct { + out *bytes.Buffer + head string + foot string +} + +func (gen *genimport) mapdecl(head, althead string) mapdecl { + var foot string + if gen.mode == ImSharedLib { + foot = "nil" + } else if strings.IndexByte(althead, '%') < 0 { + head = althead + } else { + head = fmt.Sprintf(althead, gen.reflect) + } + return mapdecl{gen.out, head, foot} +} + +func (d *mapdecl) header() { + if len(d.head) != 0 { + d.out.WriteString(d.head) + d.out.WriteByte('{') + d.head = "" + d.foot = "\n\t}" + } +} + +func (d *mapdecl) footer(more bool) { + if len(d.foot) != 0 { + d.out.WriteString(d.foot) + if more { + d.out.WriteString(", ") + } + } +} + +func (gen *genimport) writePreamble() { + mode := gen.mode + out := gen.out + path := gen.path + + var alias, filepkg string + switch mode { + case ImBuiltin: + alias = "_b " + filepkg = "imports" + case ImInception: + alias = "_i " + filepkg = gen.name + default: + filepkg = "main" + } + + fmt.Fprintf(gen.out, `// this file was generated by gomacro command: import %s%q +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package %s + +import (`, alias, path, filepkg) + + var imports string + if mode == ImInception { + fmt.Fprintf(gen.out, "\n\tr \"reflect\"\n\t\"github.com/cosmos72/gomacro/imports\"") + imports = "imports." + } else { + fmt.Fprintf(out, "\n\t. \"reflect\"") + } + for _, str := range gen.globals.CollectPackageImports(gen.gpkg, true) { + if mode != ImInception || str != path { + fmt.Fprintf(out, "\n\t%q", str) + } + } + fmt.Fprintf(out, "\n)\n") + + if mode == ImSharedLib { + fmt.Fprint(out, ` +func main() { +} + +func Exports() (map[string]Value, map[string]Type, map[string]Type, map[string]string, map[string][]string) { + return `) + } else { + fmt.Fprintf(out, ` +// reflection: allow interpreted code to import %q +func init() { + %sPackages[%q] = %sPackage{ + `, path, imports, path, imports) + } +} + +func (gen *genimport) writeBinds() { + d := gen.mapdecl("map[string]Value", "Binds: map[string]%sValue") + + for _, name := range gen.names { + if obj := gen.scope.Lookup(name); obj.Exported() { + switch obj := obj.(type) { + case *types.Const: + val := obj.Val() + var conv1, conv2 string + if t, ok := obj.Type().(*types.Basic); ok && t.Info()&types.IsUntyped != 0 { + // untyped constants have arbitrary precision... they may overflow integers + // this is just an approximation, use Package.Untypeds for exact value + if val.Kind() == constant.Int { + str := val.ExactString() + conv1, conv2 = gen.globals.detectIntKind(gen.path, name, str) + } + } + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%sValueOf(%s%s%s%s),", name, gen.reflect, conv1, gen.name_, name, conv2) + case *types.Var: + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%sValueOf(&%s%s).Elem(),", name, gen.reflect, gen.name_, name) + case *types.Func: + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%sValueOf(%s%s),", name, gen.reflect, gen.name_, name) + } + } + } + d.footer(true) +} + +func (gen *genimport) writeTypes() { + d := gen.mapdecl("map[string]Type", "Types: map[string]%sType") + + for _, name := range gen.names { + if obj := gen.scope.Lookup(name); obj.Exported() { + switch obj.(type) { + case *types.TypeName: + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%sTypeOf((*%s%s)(nil)).Elem(),", name, gen.reflect, gen.name_, name) + } + } + } + d.footer(true) +} + +func (gen *genimport) writeProxies() { + d := gen.mapdecl("map[string]Type", "Proxies: map[string]%sType") + + for _, name := range gen.names { + if obj := gen.scope.Lookup(name); obj.Exported() { + if t := extractInterface(obj, true); t != nil { + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%sTypeOf((*%s%s)(nil)).Elem(),", name, gen.reflect, name, gen.suffix) + } + } + } + d.footer(true) +} + +func (gen *genimport) writeUntypeds() { + d := gen.mapdecl("map[string]string", "Untypeds: map[string]string") + + for _, name := range gen.names { + if obj := gen.scope.Lookup(name); obj.Exported() { + switch obj := obj.(type) { + case *types.Const: + if t, ok := obj.Type().(*types.Basic); ok && t.Info()&types.IsUntyped != 0 { + str := MarshalUntyped(t.Kind(), obj.Val()) + if len(str) != 0 { + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t%q,", name, str) + } + } + } + } + } + d.footer(true) +} + +func (gen *genimport) writeWrappers() { + d := gen.mapdecl("map[string][]string", "Wrappers: map[string][]string") + + for _, name := range gen.names { + if obj := gen.scope.Lookup(name); obj.Exported() { + switch obj.(type) { + case *types.TypeName: + if t, ok := obj.Type().(*types.Named); ok { + // only structs can have embedded fields, and thus wrapper methods for embedded fields + if _, ok := t.Underlying().(*types.Struct); ok { + wrappers := new(analyzer).Analyze(t) + if len(wrappers) != 0 { + d.header() + fmt.Fprintf(gen.out, "\n\t\t%q:\t[]string{", obj.Name()) + for _, wrapper := range wrappers { + fmt.Fprintf(gen.out, "%q,", wrapper) + } + fmt.Fprint(gen.out, "},") + } + } + } + } + } + } + d.footer(false) +} + +func (gen *genimport) writeInterfaceProxies() { + path := gen.gpkg.Path() + for _, name := range gen.names { + obj := gen.scope.Lookup(name) + if t := extractInterface(obj, true); t != nil { + writeInterfaceProxy(gen.out, path, gen.suffix, name, t) + } + } +} + +func (g *Globals) detectIntKind(path, name, str string) (string, string) { + i, err := strconv.ParseInt(str, 0, 64) + if err == nil { + if i == int64(int32(i)) { + // constant fits int32. We can use the default (i.e. int) + // on both 32-bit and 64-bit platforms + return "", "" + } else if i == int64(uint32(i)) { + // constant fits uint32 + return "uint32(", ")" + } else { + return "int64(", ")" + } + } + _, err = strconv.ParseUint(str, 0, 64) + if err == nil { + return "uint64(", ")" + } + f, err := strconv.ParseFloat(str, 64) + if err != nil { + // nothing fits... leave the default + return "", "" + } else { + prefix := "float64" + f = math.Abs(f) + if f == float64(float32(f)) && f <= math.MaxFloat32 && f >= math.SmallestNonzeroFloat32 { + // float32 loses no precision vs. float64 + prefix = "float32" + } + g.Warnf("package %q: integer constant %s = %s overflows both int64 and uint64, converting to %s", path, name, str, prefix) + return prefix + "(", ")" + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/genimport_proxy.go b/vendor/github.com/cosmos72/gomacro/base/genimport_proxy.go new file mode 100644 index 0000000..38768a0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/genimport_proxy.go @@ -0,0 +1,153 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * genimport_proxy.go + * + * Created on Mar 06, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "bytes" + "fmt" + "go/types" + "strings" +) + +type writeTypeOpts int + +const ( + writeMethodsAsFields writeTypeOpts = 1 << iota + writeForceParamNames + writeIncludeParamTypes +) + +func writeInterfaceProxy(out *bytes.Buffer, pkgPath string, pkgSuffix string, name string, t *types.Interface) { + fmt.Fprintf(out, "\n// --------------- proxy for %s.%s ---------------\ntype %s%s struct {", pkgPath, name, name, pkgSuffix) + writeInterfaceMethods(out, pkgSuffix, name, t, writeMethodsAsFields) + out.WriteString("\n}\n") + writeInterfaceMethods(out, pkgSuffix, name, t, writeForceParamNames) +} + +func writeInterfaceMethods(out *bytes.Buffer, pkgSuffix string, name string, t *types.Interface, opts writeTypeOpts) { + if opts&writeMethodsAsFields != 0 { + fmt.Fprint(out, "\n\tObject\tinterface{}") // will be used to retrieve object wrapped in the proxy + } + n := t.NumMethods() + for i := 0; i < n; i++ { + writeInterfaceMethod(out, pkgSuffix, name, t.Method(i), opts) + } +} + +func writeInterfaceMethod(out *bytes.Buffer, pkgSuffix string, interfaceName string, method *types.Func, opts writeTypeOpts) { + if !method.Exported() { + return + } + sig, ok := method.Type().(*types.Signature) + if !ok { + return + } + params := sig.Params() + if opts&writeMethodsAsFields != 0 { + var param0 string + if opts&writeForceParamNames != 0 || isNamedTypeTuple(params) { + param0 = "_proxy_obj_ " + } + fmt.Fprintf(out, "\n\t%s_\tfunc(%sinterface{}", method.Name(), param0) + if params != nil && params.Len() != 0 { + out.WriteString(", ") + } + } else { + fmt.Fprintf(out, "func (Proxy *%s%s) %s(", interfaceName, pkgSuffix, method.Name()) + } + results := sig.Results() + writeTypeTuple(out, params, opts|writeIncludeParamTypes) + out.WriteString(") ") + writeTypeTupleOut(out, results) + if opts&writeMethodsAsFields != 0 { + return + } + out.WriteString(" {\n\t") + if results != nil && results.Len() > 0 { + out.WriteString("return ") + } + fmt.Fprintf(out, "Proxy.%s_(Proxy.Object", method.Name()) + if params != nil && params.Len() != 0 { + out.WriteString(", ") + } + writeTypeTuple(out, params, writeForceParamNames) + out.WriteString(")\n}\n") +} + +func isNamedTypeTuple(tuple *types.Tuple) bool { + if tuple == nil || tuple.Len() == 0 { + return false + } + for i, n := 0, tuple.Len(); i < n; i++ { + if len(tuple.At(i).Name()) != 0 { + return true + } + } + return false +} + +func writeTypeTupleOut(out *bytes.Buffer, tuple *types.Tuple) { + if tuple == nil || tuple.Len() == 0 { + return + } + ret0 := tuple.At(0) + if tuple.Len() > 1 || len(ret0.Name()) > 0 { + out.WriteString("(") + writeTypeTuple(out, tuple, writeIncludeParamTypes) + out.WriteString(")") + } else { + types.WriteType(out, ret0.Type(), packageNameQualifier) + } +} + +func writeTypeTuple(out *bytes.Buffer, tuple *types.Tuple, opts writeTypeOpts) { + n := tuple.Len() + for i := 0; i < n; i++ { + if i != 0 { + out.WriteString(", ") + } + writeTypeVar(out, tuple.At(i), i, opts) + } +} + +func writeTypeVar(out *bytes.Buffer, v *types.Var, index int, opts writeTypeOpts) { + name := v.Name() + if len(name) == 0 && opts&writeForceParamNames != 0 { + name = fmt.Sprintf("unnamed%d", index) + } + out.WriteString(name) + if opts&writeIncludeParamTypes != 0 { + if len(name) != 0 { + out.WriteString(" ") + } + types.WriteType(out, v.Type(), packageNameQualifier) + } +} + +func packageNameQualifier(pkg *types.Package) string { + path := pkg.Path() + return path[1+strings.LastIndexByte(path, '/'):] +} diff --git a/vendor/github.com/cosmos72/gomacro/base/genimport_untyped.go b/vendor/github.com/cosmos72/gomacro/base/genimport_untyped.go new file mode 100644 index 0000000..9727ff6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/genimport_untyped.go @@ -0,0 +1,119 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * genimport_untyped.go + * + * Created on May 27, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "fmt" + "go/constant" + "go/token" + "go/types" + "strings" +) + +func MarshalUntyped(kind types.BasicKind, val constant.Value) string { + // untyped constants have arbitrary precision... they may overflow integers + switch kind { + case types.UntypedBool: + if constant.BoolVal(val) { + return "bool:true" + } else { + return "bool:false" + } + case types.UntypedInt: + return fmt.Sprintf("int:%s", val.ExactString()) + case types.UntypedRune: + return fmt.Sprintf("rune:%s", val.ExactString()) + case types.UntypedFloat: + return fmt.Sprintf("float:%s", val.ExactString()) + case types.UntypedComplex: + return fmt.Sprintf("complex:%s:%s", constant.Real(val).ExactString(), constant.Imag(val).ExactString()) + case types.UntypedString: + return fmt.Sprintf("string:%s", constant.StringVal(val)) + case types.UntypedNil: + return "nil" + default: + return "" + } +} + +func UnmarshalUntyped(marshalled string) (types.BasicKind, constant.Value) { + var skind, str string + if sep := strings.IndexByte(marshalled, ':'); sep >= 0 { + skind = marshalled[:sep] + str = marshalled[sep+1:] + } else { + skind = marshalled + } + + var kind types.BasicKind + var val constant.Value + switch skind { + case "bool": + kind = types.UntypedBool + if str == "true" { + val = constant.MakeBool(true) + } else { + val = constant.MakeBool(false) + } + case "int": + kind = types.UntypedInt + val = constant.MakeFromLiteral(str, token.INT, 0) + case "rune": + kind = types.UntypedRune + val = constant.MakeFromLiteral(str, token.INT, 0) + case "float": + kind = types.UntypedFloat + val = unmarshalUntypedFloat(str) + case "complex": + kind = types.UntypedComplex + if sep := strings.IndexByte(str, ':'); sep >= 0 { + re := unmarshalUntypedFloat(str[:sep]) + im := unmarshalUntypedFloat(str[sep+1:]) + val = constant.BinaryOp(constant.ToComplex(re), token.ADD, constant.MakeImag(im)) + } else { + val = constant.ToComplex(unmarshalUntypedFloat(str)) + } + case "string": + kind = types.UntypedString + val = constant.MakeString(str) + case "nil": + kind = types.UntypedNil + default: + kind = types.Invalid + } + return kind, val +} + +// generalization of constant.MakeFromLiteral, accepts the fractions generated by +// constant.Value.ExactString() for floating-point values +func unmarshalUntypedFloat(str string) constant.Value { + if sep := strings.IndexByte(str, '/'); sep >= 0 { + x := constant.MakeFromLiteral(str[:sep], token.FLOAT, 0) + y := constant.MakeFromLiteral(str[sep+1:], token.FLOAT, 0) + return constant.BinaryOp(x, token.QUO, y) + } + return constant.MakeFromLiteral(str, token.FLOAT, 0) +} diff --git a/vendor/github.com/cosmos72/gomacro/base/genimport_wrapper.go b/vendor/github.com/cosmos72/gomacro/base/genimport_wrapper.go new file mode 100644 index 0000000..671f145 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/genimport_wrapper.go @@ -0,0 +1,86 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * genimport_wrapper.go + * + * Created on May 26, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "go/types" + "sort" +) + +// analyzer examines all methods of a named type and its embedded fields, +// and determines the wrapper methods for embedded fields. +type analyzer map[string][]int + +func (a *analyzer) add(mtd *types.Func, depth int) { + if *a == nil { + (*a) = make(map[string][]int) + } + name := mtd.Name() + (*a)[name] = append((*a)[name], depth) +} + +func (a *analyzer) Analyze(t *types.Named) []string { + a.analyze(t, 0) + return a.wrappers() +} + +func (a *analyzer) analyze(t *types.Named, depth int) { + for i, n := 0, t.NumMethods(); i < n; i++ { + mtd := t.Method(i) + if mtd.Exported() { + a.add(mtd, depth) + } + } + + if u, ok := t.Underlying().(*types.Struct); ok { + for i, n := 0, u.NumFields(); i < n; i++ { + if f := u.Field(i); f.Anonymous() { + switch ft := f.Type().(type) { + case *types.Named: + a.analyze(ft, depth+1) + case *types.Pointer: + if ft, ok := ft.Elem().(*types.Named); ok { + a.analyze(ft, depth+1) + } + } + } + } + } +} + +// listWrappers returns the names of wrapper methods for an analyzed type +func (a *analyzer) wrappers() []string { + var wrappers []string + for name, depths := range *a { + if depths[0] == 0 { + // explicit method declared in the outermost type. no ambiguity + continue + } + wrappers = append(wrappers, name) + } + sort.Strings(wrappers) + return wrappers +} diff --git a/vendor/github.com/cosmos72/gomacro/base/global.go b/vendor/github.com/cosmos72/gomacro/base/global.go new file mode 100644 index 0000000..2c8085a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/global.go @@ -0,0 +1,279 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * global.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "fmt" + "go/ast" + "go/token" + "io" + "os" + r "reflect" + "strings" + + mp "github.com/cosmos72/gomacro/parser" + mt "github.com/cosmos72/gomacro/token" + + . "github.com/cosmos72/gomacro/ast2" +) + +type Globals struct { + Output + Options Options + PackagePath string + Filename string + GensymN uint + Importer *Importer + Imports []*ast.GenDecl + Declarations []ast.Decl + Statements []ast.Stmt + ParserMode mp.Mode + SpecialChar rune +} + +func (g *Globals) Init() { + g.Output = Output{ + Stringer: Stringer{ + Fileset: mt.NewFileSet(), + NamedTypes: make(map[r.Type]string), + }, + // using both os.Stdout and os.Stderr can interleave impredictably + // normal output and diagnostic messages - ugly in interactive use + Stdout: os.Stdout, + Stderr: os.Stdout, + } + g.Options = OptTrapPanic // set by default + g.PackagePath = "main" + g.Filename = "repl.go" + g.GensymN = 0 + g.Importer = DefaultImporter() + g.Imports = nil + g.Declarations = nil + g.Statements = nil + g.ParserMode = 0 + g.SpecialChar = '~' +} + +func NewGlobals() *Globals { + g := &Globals{} + g.Init() + return g +} + +func (g *Globals) Gensym() string { + n := g.GensymN + g.GensymN++ + return fmt.Sprintf("%s%d", StrGensym, n) +} + +func (g *Globals) GensymEmbedded(name string) string { + if len(name) == 0 { + n := g.GensymN + g.GensymN++ + name = fmt.Sprintf("%d", n) + } + return StrGensymEmbedded + name +} + +func (g *Globals) GensymPrivate(name string) string { + if len(name) == 0 { + n := g.GensymN + g.GensymN++ + name = fmt.Sprintf("%d", n) + } + return StrGensymPrivate + name +} + +func IsGensym(name string) bool { + return strings.HasPrefix(name, StrGensym) +} + +func IsGensymInterface(name string) bool { + return name == StrGensymInterface +} + +func IsGensymEmbedded(name string) bool { + return strings.HasPrefix(name, StrGensymEmbedded) +} + +func IsGensymPrivate(name string) bool { + return strings.HasPrefix(name, StrGensymPrivate) +} + +// parse phase. no macroexpansion. +func (g *Globals) ParseBytes(src []byte) []ast.Node { + var parser mp.Parser + + mode := g.ParserMode + if g.Options&OptDebugParse != 0 { + mode |= mp.Trace + } else { + mode &^= mp.Trace + } + parser.Configure(mode, g.SpecialChar) + parser.Init(g.Fileset, g.Filename, g.Line, src) + + nodes, err := parser.Parse() + if err != nil { + Error(err) + return nil + } + return nodes +} + +// CollectAst accumulates declarations in ir.Decls and statements in ir.Stmts +// allows generating a *.go file on user request +func (g *Globals) CollectAst(form Ast) { + if g.Options&(OptCollectDeclarations|OptCollectStatements) == 0 { + return + } + + switch form := form.(type) { + case AstWithNode: + g.CollectNode(form.Node()) + case AstWithSlice: + n := form.Size() + for i := 0; i < n; i++ { + g.CollectAst(form.Get(i)) + } + } +} + +func (g *Globals) CollectNode(node ast.Node) { + collectDecl := g.Options&OptCollectDeclarations != 0 + collectStmt := g.Options&OptCollectStatements != 0 + + switch node := node.(type) { + case *ast.GenDecl: + if collectDecl { + switch node.Tok { + case token.IMPORT: + g.Imports = append(g.Imports, node) + case token.PACKAGE: // exception: modified parser parses "package foo" as a declaration + if len(node.Specs) == 1 { + if spec, ok := node.Specs[0].(*ast.ValueSpec); ok && len(spec.Names) == 1 { + g.PackagePath = spec.Names[0].Name + break + } + } + fallthrough + default: + g.Declarations = append(g.Declarations, node) + } + } + case *ast.FuncDecl: + if collectDecl { + if node.Recv == nil || len(node.Recv.List) != 0 { + // function or method declaration. + // skip macro declarations, Go compilers would choke on them + g.Declarations = append(g.Declarations, node) + } + } + case ast.Decl: + if collectDecl { + g.Declarations = append(g.Declarations, node) + } + case *ast.AssignStmt: + if node.Tok == token.DEFINE { + if collectDecl { + idents := make([]*ast.Ident, len(node.Lhs)) + for i, lhs := range node.Lhs { + idents[i] = lhs.(*ast.Ident) + } + decl := &ast.GenDecl{ + TokPos: node.Pos(), + Tok: token.VAR, + Specs: []ast.Spec{ + &ast.ValueSpec{ + Names: idents, + Type: nil, + Values: node.Rhs, + }, + }, + } + g.Declarations = append(g.Declarations, decl) + } + } else { + if collectStmt { + g.Statements = append(g.Statements, node) + } + } + case ast.Stmt: + if collectStmt { + g.Statements = append(g.Statements, node) + } + case ast.Expr: + if unary, ok := node.(*ast.UnaryExpr); ok && collectDecl { + if unary.Op == token.PACKAGE && unary.X != nil { + if ident, ok := unary.X.(*ast.Ident); ok { + g.PackagePath = ident.Name + break + } + } + } + if collectStmt { + stmt := &ast.ExprStmt{X: node} + g.Statements = append(g.Statements, stmt) + } + } +} + +func (g *Globals) WriteDeclsToFile(filename string, prologue ...string) { + f, err := os.Create(filename) + if err != nil { + g.Errorf("failed to create file %q: %v", filename, err) + } + defer f.Close() + for _, str := range prologue { + f.WriteString(str) + } + g.WriteDeclsToStream(f) +} + +func (g *Globals) WriteDeclsToStream(out io.Writer) { + fmt.Fprintf(out, "package %s\n\n", g.PackagePath) + + for _, imp := range g.Imports { + fmt.Fprintln(out, g.toPrintable("%v", imp)) + } + if len(g.Imports) != 0 { + fmt.Fprintln(out) + } + for _, decl := range g.Declarations { + fmt.Fprintln(out, g.toPrintable("%v", decl)) + } + if len(g.Statements) != 0 { + fmt.Fprint(out, "\nfunc init() {\n") + config.Indent = 1 + defer func() { + config.Indent = 0 + }() + for _, stmt := range g.Statements { + fmt.Fprintln(out, g.toPrintable("%v", stmt)) + } + fmt.Fprint(out, "}\n") + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/import_scanner.go b/vendor/github.com/cosmos72/gomacro/base/import_scanner.go new file mode 100644 index 0000000..bd95cf2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/import_scanner.go @@ -0,0 +1,211 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * import_scanner.go + * + * Created on Mar 06, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "fmt" + "go/types" + r "reflect" + "sort" +) + +type TypeVisitor func(name string, t types.Type) bool + +// implemented by *types.Pointer, *types.Array, *types.Slice, *types.Chan +type typeWithElem interface { + Elem() types.Type +} + +var depth int = 0 + +func (o *Output) trace(msg ...interface{}) { + const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + const n = len(dots) + i := 2 * depth + for i > n { + fmt.Fprint(o.Stdout, dots) + i -= n + } + // i <= n + fmt.Fprint(o.Stdout, dots[0:i]) + fmt.Fprintln(o.Stdout, msg...) +} + +func trace(o *Output, caller string, name string, x interface{}) *Output { + o.trace(caller, "(", name, x) + depth++ + return o +} + +func un(o *Output) { + depth-- + o.trace(")") +} + +func (o *Output) traverseType(name string, in types.Type, visitor TypeVisitor) { + for { + // defer un(trace(o, "traverseType", name, r.TypeOf(in))) + + if !visitor(name, in) { + return + } + switch t := in.(type) { + case *types.Basic: + break + case *types.Named: + u := t.Underlying() + if in != u { + name = t.Obj().Name() + in = u + continue + } + case *types.Signature: + if recv := t.Recv(); recv != nil { + u := recv.Type() + // the receiver is often the interface containing this signature... + // avoid infinite recursion! + if in != u { + if _, ok := u.(*types.Interface); !ok { + o.traverseType(recv.Name(), u, visitor) + } + } + } + tuples := []*types.Tuple{t.Params(), t.Results()} + for _, tuple := range tuples { + n := tuple.Len() + for i := 0; i < n; i++ { + v := tuple.At(i) + o.traverseType(v.Name(), v.Type(), visitor) + } + } + case *types.Interface: + n := t.NumMethods() + for i := 0; i < n; i++ { + method := t.Method(i) + o.traverseType(method.Name(), method.Type(), visitor) + } + case *types.Struct: + n := t.NumFields() + for i := 0; i < n; i++ { + field := t.Field(i) + o.traverseType(field.Name(), field.Type(), visitor) + } + case *types.Map: + o.traverseType("", t.Key(), visitor) + name = "" + in = t.Elem() + continue + case typeWithElem: // *types.Pointer, *types.Array, *types.Slice, *types.Chan + name = "" + in = t.Elem() + continue + default: + o.Warnf("traverseType: unimplemented %#v <%v>", t, r.TypeOf(t)) + } + break + } +} + +type importExtractor struct { + imports map[string]bool + seen map[types.Type]bool + o *Output +} + +func (ie *importExtractor) visitPackage(pkg *types.Package, requireAllInterfaceMethodsExported bool) { + scope := pkg.Scope() + for _, name := range scope.Names() { + obj := scope.Lookup(name) + t := extractInterface(obj, requireAllInterfaceMethodsExported) + if t != nil { + ie.o.traverseType("", t, ie.visitType) + } + } +} + +func (ie *importExtractor) visitType(name string, t types.Type) bool { + if ie.seen[t] { + return false + } + switch t := t.(type) { + case *types.Named: + if obj := t.Obj(); obj != nil { + if pkg := obj.Pkg(); pkg != nil { + ie.imports[pkg.Path()] = true + } + } + // no need to visit the definition of a named type + return false + default: + return true + } +} + +func extractInterface(obj types.Object, requireAllMethodsExported bool) *types.Interface { + if obj == nil || !obj.Exported() { + return nil + } + switch obj.(type) { + case *types.TypeName: + u := obj.Type().Underlying() + if u, ok := u.(*types.Interface); ok { + if !requireAllMethodsExported || allMethodsExported(u) { + return u + } + } + } + return nil +} + +func allMethodsExported(intf *types.Interface) bool { + n := intf.NumMethods() + for i := 0; i < n; i++ { + if !intf.Method(i).Exported() { + return false + } + } + return true +} + +// we need to collect only the imports that actually appear in package's interfaces methods +// because Go rejects programs with unused imports +func (o *Output) CollectPackageImports(pkg *types.Package, requireAllInterfaceMethodsExported bool) []string { + ie := importExtractor{ + // we always need to import the package itself + imports: map[string]bool{pkg.Path(): true}, + o: o, + } + ie.visitPackage(pkg, requireAllInterfaceMethodsExported) + + strings := make([]string, len(ie.imports)) + i := 0 + for str := range ie.imports { + strings[i] = str + i++ + } + sort.Strings(strings) + return strings +} diff --git a/vendor/github.com/cosmos72/gomacro/base/importer.go b/vendor/github.com/cosmos72/gomacro/base/importer.go new file mode 100644 index 0000000..6cbfca8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/importer.go @@ -0,0 +1,191 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * importer.go + * + * Created on Feb 27, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "bytes" + "errors" + "fmt" + "go/importer" + "go/types" + "io/ioutil" + "os" + r "reflect" + "strings" + + "github.com/cosmos72/gomacro/imports" +) + +type ImportMode int + +const ( + ImSharedLib ImportMode = iota + ImBuiltin + ImInception +) + +type Importer struct { + from types.ImporterFrom + compat types.Importer + srcDir string + mode types.ImportMode +} + +func DefaultImporter() *Importer { + imp := Importer{} + compat := importer.Default() + if from, ok := compat.(types.ImporterFrom); ok { + imp.from = from + } else { + imp.compat = compat + } + return &imp +} + +func (imp *Importer) Import(path string) (*types.Package, error) { + return imp.ImportFrom(path, imp.srcDir, imp.mode) +} + +func (imp *Importer) ImportFrom(path string, srcDir string, mode types.ImportMode) (*types.Package, error) { + if imp.from != nil { + return imp.from.ImportFrom(path, srcDir, mode) + } else if imp.compat != nil { + return imp.compat.Import(path) + } else { + return nil, errors.New(fmt.Sprintf("importer.Default() returned nil, cannot import %q", path)) + } +} + +// LookupPackage returns a package if already present in cache +func (g *Globals) LookupPackage(name, path string) *PackageRef { + pkg, found := imports.Packages[path] + if !found { + return nil + } + return &PackageRef{Package: pkg, Name: name, Path: path} +} + +func (g *Globals) ImportPackage(name, path string) *PackageRef { + ref := g.LookupPackage(name, path) + if ref != nil { + return ref + } + gpkg, err := g.Importer.Import(path) // loads names and types, not the values! + if err != nil { + g.Errorf("error loading package %q metadata, maybe you need to download (go get), compile (go build) and install (go install) it? %v", path, err) + } + var mode ImportMode + switch name { + case "_b": + mode = ImBuiltin + case "_i": + mode = ImInception + } + file := g.createImportFile(path, gpkg, mode) + if mode != ImSharedLib { + return nil + } + ref = &PackageRef{Name: name, Path: path} + if len(file) == 0 { + // empty package. still cache it for future use. + imports.Packages[path] = ref.Package + return ref + } + soname := g.compilePlugin(file, g.Stdout, g.Stderr) + ifun := g.loadPlugin(soname, "Exports") + fun := ifun.(func() (map[string]r.Value, map[string]r.Type, map[string]r.Type, map[string]string, map[string][]string)) + binds, types, proxies, untypeds, wrappers := fun() + + // done. cache package for future use. + ref.Package = imports.Package{ + Binds: binds, + Types: types, + Proxies: proxies, + Untypeds: untypeds, + Wrappers: wrappers, + } + imports.Packages[path] = ref.Package + return ref +} + +func (g *Globals) createImportFile(path string, pkg *types.Package, mode ImportMode) string { + buf := bytes.Buffer{} + isEmpty := g.writeImportFile(&buf, path, pkg, mode) + if isEmpty { + g.Warnf("package %q exports zero constants, functions, types and variables", path) + return "" + } + + file := computeImportFilename(path, mode) + err := ioutil.WriteFile(file, buf.Bytes(), os.FileMode(0666)) + if err != nil { + g.Errorf("error writing file %q: %v", file, err) + } + if mode != ImSharedLib { + g.Warnf("created file %q, recompile gomacro to use it", file) + } else { + g.Debugf("created file %q...", file) + } + return file +} + +func sanitizeIdentifier(str string) string { + return sanitizeIdentifier2(str, '_') +} + +func sanitizeIdentifier2(str string, replacement rune) string { + runes := []rune(str) + for i, ch := range runes { + if (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_' || + (i != 0 && ch >= '0' && ch <= '9') { + continue + } + runes[i] = replacement + } + return string(runes) +} + +const gomacro_dir = "github.com/cosmos72/gomacro" + +func computeImportFilename(path string, mode ImportMode) string { + srcdir := getGoSrcPath() + + switch mode { + case ImBuiltin: + return fmt.Sprintf("%s/%s/imports/%s.go", srcdir, gomacro_dir, sanitizeIdentifier(path)) + case ImInception: + return fmt.Sprintf("%s/%s/x_package.go", srcdir, path) + } + + file := path[1+strings.LastIndexByte(path, '/'):] + file = fmt.Sprintf("%s/gomacro_imports/%s/%s.go", srcdir, path, file) + dir := file[0 : 1+strings.LastIndexByte(file, '/')] + err := os.MkdirAll(dir, 0700) + if err != nil { + Errorf("error creating directory %q: %v", dir, err) + } + return file +} diff --git a/vendor/github.com/cosmos72/gomacro/base/literal.go b/vendor/github.com/cosmos72/gomacro/base/literal.go new file mode 100644 index 0000000..cf5e05f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/literal.go @@ -0,0 +1,120 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * literal.go + * + * Created on Apr 11, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + r "reflect" +) + +func KindToCategory(k r.Kind) r.Kind { + switch k { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + return r.Int + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return r.Uint + case r.Float32, r.Float64: + return r.Float64 + case r.Complex64, r.Complex128: + return r.Complex128 + default: + return k + } +} + +func IsCategory(k r.Kind, categories ...r.Kind) bool { + k = KindToCategory(k) + for _, c := range categories { + if k == c { + return true + } + } + return false +} + +// IsOptimizedKind returns true if fast interpreter expects optimized expressions for given Kind +func IsOptimizedKind(k r.Kind) bool { + switch k { + case r.Bool, r.Int, r.Int8, r.Int16, r.Int32, r.Int64, + r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr, + r.Float32, r.Float64, r.Complex64, r.Complex128, r.String: + return true + } + return false +} + +var kindToType = [...]r.Type{ + r.Bool: TypeOfBool, + r.Int: TypeOfInt, + r.Int8: TypeOfInt8, + r.Int16: TypeOfInt16, + r.Int32: TypeOfInt32, + r.Int64: TypeOfInt64, + r.Uint: TypeOfUint, + r.Uint8: TypeOfUint8, + r.Uint16: TypeOfUint16, + r.Uint32: TypeOfUint32, + r.Uint64: TypeOfUint64, + r.Uintptr: TypeOfUintptr, + r.Float32: TypeOfFloat32, + r.Float64: TypeOfFloat64, + r.Complex64: TypeOfComplex64, + r.Complex128: TypeOfComplex128, + r.String: TypeOfString, +} + +func KindToType(k r.Kind) r.Type { + if int(k) < len(kindToType) { + return kindToType[k] + } + return nil +} + +// ConvertValue converts a value to type t and returns the converted value. +// extends reflect.Value.Convert(t) by allowing conversions from/to complex numbers. +// does not check for overflows or truncation. +func ConvertValue(v r.Value, to r.Type) r.Value { + t := ValueType(v) + if t == to { + return v + } + if !t.ConvertibleTo(to) { + // reflect.Value does not allow conversions from/to complex types + k := v.Kind() + kto := to.Kind() + if IsCategory(kto, r.Complex128) { + if IsCategory(k, r.Int, r.Uint, r.Float64) { + temp := v.Convert(TypeOfFloat64).Float() + v = r.ValueOf(complex(temp, 0.0)) + } + } else if IsCategory(k, r.Complex128) { + if IsCategory(k, r.Int, r.Uint, r.Float64) { + temp := real(v.Complex()) + v = r.ValueOf(temp) + } + } + } + return v.Convert(to) +} diff --git a/vendor/github.com/cosmos72/gomacro/base/output.go b/vendor/github.com/cosmos72/gomacro/base/output.go new file mode 100644 index 0000000..5751bcc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/output.go @@ -0,0 +1,337 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * output.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "bytes" + "fmt" + "go/ast" + "go/printer" + "go/token" + "io" + r "reflect" + "strings" + "unsafe" + + . "github.com/cosmos72/gomacro/ast2" + mt "github.com/cosmos72/gomacro/token" +) + +type Stringer struct { + Fileset *mt.FileSet + Pos token.Pos + Line int + NamedTypes map[r.Type]string +} + +type Output struct { + Stringer + Stdout io.Writer + Stderr io.Writer +} + +type RuntimeError struct { + st *Stringer + format string + args []interface{} +} + +func (st *Stringer) Copy(other *Stringer) { + st.Fileset = other.Fileset + st.Pos = other.Pos + st.Line = other.Line +} + +func (err RuntimeError) Error() string { + args := err.args + var prefix string + if st := err.st; st != nil { + args = st.toPrintables(err.format, args) + prefix = st.Position().String() + } + msg := fmt.Sprintf(err.format, args...) + if prefix != "" && prefix != "-" { + msg = fmt.Sprintf("%s: %s", prefix, msg) + } + return msg +} + +func Error(err error) interface{} { + panic(err) +} + +func (o *Output) Error(err error) interface{} { + panic(err) +} + +func Errorf(format string, args ...interface{}) { + panic(RuntimeError{nil, format, args}) +} + +func (st *Stringer) Errorf(format string, args ...interface{}) (r.Value, []r.Value) { + panic(RuntimeError{st, format, args}) +} + +func Warnf(format string, args ...interface{}) { + str := fmt.Sprintf(format, args...) + fmt.Printf("// warning: %s\n", str) +} + +func (o *Output) Warnf(format string, args ...interface{}) { + args = o.toPrintables(format, args) + str := fmt.Sprintf(format, args...) + fmt.Fprintf(o.Stderr, "// warning: %s\n", str) +} + +var warnExtraValues = 5 + +func (o *Output) WarnExtraValues(extraValues []r.Value) { + if warnExtraValues > 0 { + o.Warnf("expression returned %d values, using only the first one: %v", + len(extraValues), extraValues) + warnExtraValues-- + if warnExtraValues == 0 { + o.Warnf("suppressing further similar warnings") + } + } +} + +func Debugf(format string, args ...interface{}) { + str := fmt.Sprintf(format, args...) + fmt.Printf("// debug: %s\n", str) +} + +func (o *Output) Debugf(format string, args ...interface{}) { + args = o.toPrintables(format, args) + str := fmt.Sprintf(format, args...) + fmt.Fprintf(o.Stdout, "// debug: %s\n", str) +} + +func (st *Stringer) IncLine(src string) { + st.Line += strings.Count(src, "\n") +} + +func (st *Stringer) IncLineBytes(src []byte) { + st.Line += bytes.Count(src, []byte("\n")) +} + +func (st *Stringer) Position() token.Position { + if st == nil || st.Fileset == nil { + return token.Position{} + } + return st.Fileset.Position(st.Pos) +} + +var typeOfReflectValue = r.TypeOf(r.Value{}) + +type unsafeType struct { +} + +type unsafeFlag uintptr + +type unsafeValue struct { + typ *unsafeType + ptr unsafe.Pointer + unsafeFlag +} + +func asUnsafeValue(v r.Value) unsafeValue { + return *(*unsafeValue)(unsafe.Pointer(&v)) +} + +func (st *Stringer) Fprintf(out io.Writer, format string, values ...interface{}) (n int, err error) { + values = st.toPrintables(format, values) + return fmt.Fprintf(out, format, values...) +} + +func (st *Stringer) Sprintf(format string, values ...interface{}) string { + values = st.toPrintables(format, values) + return fmt.Sprintf(format, values...) +} + +func (st *Stringer) ToString(separator string, values ...interface{}) string { + if len(values) == 0 { + return "" + } + values = st.toPrintables("", values) + var buf bytes.Buffer + for i, value := range values { + if i != 0 { + buf.WriteString(separator) + } + fmt.Fprint(&buf, value) + } + return buf.String() +} + +func (st *Stringer) toPrintables(format string, values []interface{}) []interface{} { + rets := make([]interface{}, len(values)) + for i, vi := range values { + if percent := strings.IndexByte(format, '%'); percent >= 0 { + format = format[percent:] + } + rets[i] = st.toPrintable(format, vi) + switch len(format) { + case 0: + case 1, 2: + format = "" + default: + format = format[2:] // skip %* + } + } + return rets +} + +func (st *Stringer) toPrintable(format string, value interface{}) (ret interface{}) { + if value == nil { + return nil + } + defer func() { + if rec := recover(); rec != nil { + ret = fmt.Sprintf("error pretty-printing %v", value) + } + }() + + switch v := value.(type) { + case r.Value: + return st.rvalueToPrintable(format, v) + case fmt.Formatter: + return v + case fmt.GoStringer: + if strings.HasPrefix(format, "%#v") { + return v.GoString() + } + } + + usual := len(format) == 0 || strings.HasPrefix(format, "%v") || strings.HasPrefix(format, "%s") + if usual { + switch v := value.(type) { + case AstWithNode: + return st.nodeToPrintable(v.Node()) + case Ast: + return st.toPrintable(format, v.Interface()) + case ast.Node: + return st.nodeToPrintable(v) + case r.Type: + return st.typeToPrintable(v) + case error: + return v.Error() + case fmt.Stringer: + return v.String() + } + } + + v := r.ValueOf(value) + switch k := v.Kind(); k { + case r.Array, r.Slice: + n := v.Len() + values := make([]interface{}, n) + converted := false + for i := 0; i < n; i++ { + vi := v.Index(i) + if vi == Nil { + values[i] = nil + } else if !vi.CanInterface() { + values[i] = vi + } else { + valuei := vi.Interface() + values[i] = st.toPrintable(format, valuei) + converted = converted || !vi.Type().Comparable() || valuei != values[i] + } + } + // return []interface{} only if we actually converted some element + if converted { + return values + } else { + return value + } + case r.Struct: + if usual { + return st.structToPrintable(format, v) + } + case r.Func: + return asUnsafeValue(v).ptr + } + return value +} + +var config = printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8} + +func (st *Stringer) nodeToPrintable(node ast.Node) interface{} { + if node == nil { + return nil + } + var fset *mt.FileSet + if st != nil { + fset = st.Fileset + } + if fset == nil { + fset = mt.NewFileSet() + } + var buf bytes.Buffer + err := config.Fprint(&buf, &fset.FileSet, node) + if err != nil { + return err + } + return buf.String() +} + +func (st *Stringer) rvalueToPrintable(format string, value r.Value) interface{} { + if value == None { + return "/*no value*/" + } else if value == Nil { + return nil + } else if value.CanInterface() { + return st.toPrintable(format, value.Interface()) + } else { + return value + } +} + +func (st *Stringer) typeToPrintable(t r.Type) interface{} { + if t == nil { + return "nil" // because fmt.Printf("%v", nil) prints i.e adds extra <> + } + if st != nil { + if name, ok := st.NamedTypes[t]; ok { + return name + } + } + return t +} + +func (st *Stringer) structToPrintable(format string, v r.Value) string { + buf := bytes.Buffer{} + n := v.NumField() + t := v.Type() + ch := '{' + for i := 0; i < n; i++ { + fmt.Fprintf(&buf, "%c%s:%v", ch, t.Field(i).Name, v.Field(i)) + ch = ' ' + } + buf.WriteByte('}') + return buf.String() +} diff --git a/vendor/github.com/cosmos72/gomacro/base/plugin.go b/vendor/github.com/cosmos72/gomacro/base/plugin.go new file mode 100644 index 0000000..b9fd0c6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/plugin.go @@ -0,0 +1,93 @@ +// +build go1.8,linux,!android,!gccgo + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * plugin.go + * + * Created on Feb 27, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "fmt" + "io" + "os" + "os/exec" + "plugin" + "strings" +) + +func getGoPath() string { + dir := os.Getenv("GOPATH") + if len(dir) == 0 { + dir = os.Getenv("HOME") + if len(dir) == 0 { + Errorf("cannot determine go source directory: both $GOPATH and $HOME are unset or empty") + } + dir += "/go" + } + return dir +} + +func getGoSrcPath() string { + return getGoPath() + "/src" +} + +func (g *Globals) compilePlugin(filename string, stdout io.Writer, stderr io.Writer) string { + gosrcdir := getGoSrcPath() + gosrclen := len(gosrcdir) + filelen := len(filename) + if filelen < gosrclen || filename[0:gosrclen] != gosrcdir { + g.Errorf("source %q is in unsupported directory, cannot compile it: should be inside %q", filename, gosrcdir) + } + + cmd := exec.Command("go", "build", "-buildmode=plugin") + cmd.Dir = filename[0 : 1+strings.LastIndexByte(filename, '/')] + cmd.Stdin = nil + cmd.Stdout = stdout + cmd.Stderr = stderr + + g.Debugf("compiling %q ...", filename) + err := cmd.Run() + if err != nil { + g.Errorf("error executing \"go build -buildmode=plugin\" in directory %q: %v", cmd.Dir, err) + } + + dirname := filename[:strings.LastIndexByte(filename, '/')] + // go build uses innermost directory name as shared object name, + // i.e. foo/bar/main.go is compiled to foo/bar/bar.so + filename = dirname[1+strings.LastIndexByte(dirname, '/'):] + + return fmt.Sprintf("%s/%s.so", dirname, filename) +} + +func (g *Globals) loadPlugin(soname string, symbolName string) interface{} { + pkg, err := plugin.Open(soname) + if err != nil { + g.Errorf("error loading plugin %q: %v", soname, err) + } + val, err := pkg.Lookup(symbolName) + if err != nil { + g.Errorf("error loading symbol %q from plugin %q: %v", symbolName, soname, err) + } + return val +} diff --git a/vendor/github.com/cosmos72/gomacro/base/plugin_dummy.go b/vendor/github.com/cosmos72/gomacro/base/plugin_dummy.go new file mode 100644 index 0000000..03e944f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/plugin_dummy.go @@ -0,0 +1,51 @@ +// +build !go1.8 !linux android gccgo + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * plugin_dummy.go + * + * Created on Mar 21, 2017 + * Author Massimiliano Ghilardi + */ + +package base + +import ( + "io" + "os" +) + +func getGoPath() string { + return os.Getenv("GOPATH") +} + +func getGoSrcPath() string { + return getGoPath() + "/src" +} + +func (g *Globals) compilePlugin(filename string, stdout io.Writer, stderr io.Writer) string { + g.Errorf("gomacro compiled without support to load plugins - requires Go 1.8+ and Linux - cannot import packages at runtime") + return "" +} + +func (g *Globals) loadPlugin(soname string, symbolName string) interface{} { + g.Errorf("gomacro compiled without support to load plugins - requires Go 1.8+ and Linux - cannot import packages at runtime") + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/base/quasiquote.go b/vendor/github.com/cosmos72/gomacro/base/quasiquote.go new file mode 100644 index 0000000..9134be6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/quasiquote.go @@ -0,0 +1,223 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * quasiquote.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "go/ast" + "go/token" + + . "github.com/cosmos72/gomacro/ast2" + mp "github.com/cosmos72/gomacro/parser" + mt "github.com/cosmos72/gomacro/token" +) + +// SimplifyNodeForQuote unwraps ast.BlockStmt, ast.ExprStmt, ast.ParenExpr and ast.DeclStmt +// and returns their contents. +// used to implement classic.Env.evalQuote() and classic.Env.evalQuasiQuote(), be extra careful if you patch it! +func SimplifyNodeForQuote(in ast.Node, unwrapTrivialBlocks bool) ast.Node { + // unwrap expressions... they fit in more places and make the life easier to MacroExpand and evalQuasiquote + // also, if unwrapTrivialBlocks is true, unwrap a single-statement block { foo } to foo + for { + switch node := in.(type) { + case *ast.BlockStmt: + if unwrapTrivialBlocks { + switch len(node.List) { + case 0: + return &ast.EmptyStmt{Semicolon: node.End(), Implicit: false} + case 1: + in = node.List[0] + unwrapTrivialBlocks = false + continue + } + } + return node + case *ast.ExprStmt: + return node.X + case *ast.ParenExpr: + return node.X + case *ast.DeclStmt: + return node.Decl + } + return in + } +} + +// SimplifyAstForQuote unwraps ast2.BlockStmt, ast2.ExprStmt, ast2.ParenExpr and ast2.DeclStmt +// and returns their contents. +// used to implement fast.Comp.QuasiQuote(), be extra careful if you patch it! +func SimplifyAstForQuote(in Ast, unwrapTrivialBlocks bool) Ast { + // unwrap expressions... they fit in more places and make the life easier to MacroExpand and evalQuasiquote + // also, if unwrapTrivialBlocks is true, unwrap a single-statement block { foo } to foo + for { + switch form := in.(type) { + case BlockStmt: + if unwrapTrivialBlocks { + switch form.Size() { + case 0: + return EmptyStmt{&ast.EmptyStmt{Semicolon: form.X.List[0].End(), Implicit: false}} + case 1: + in = form.Get(0) + unwrapTrivialBlocks = false + continue + } + } + return form + case ExprStmt, ParenExpr, DeclStmt: + return in.Get(0) + } + return in + } +} + +// restricted version of UnwrapTrivialAst +func UnwrapTrivialNode(node ast.Node) ast.Node { + in := ToAst(node) + out := unwrapTrivialAst2(in, true) + return ToNode(out) +} + +// unwrapTrivialAst extract the content from ParenExpr, ExprStmt, DeclStmt: +// such nodes are trivial wrappers for their contents +func UnwrapTrivialAst(in Ast) Ast { + return unwrapTrivialAst2(in, true) +} + +func UnwrapTrivialAstKeepBlocks(in Ast) Ast { + return unwrapTrivialAst2(in, false) +} + +func unwrapTrivialAst2(in Ast, unwrapTrivialBlockStmt bool) Ast { + for { + switch form := in.(type) { + case BlockStmt: + if !unwrapTrivialBlockStmt || form.Size() != 1 { + return form + } + // a one-element block is trivial UNLESS it contains a declaration. + // reason: the declaration alters its scope with new bindings. + // unwrapping it would alters the OUTER scope. + // i.e. { var x = foo() } and var x = foo() give different scopes + // to the variable 'x' so they are not equivalent. + // + // same reasoning for { x := foo() } versus x := foo() + child := form.Get(0) + switch child := child.(type) { + case DeclStmt: + return in + case AssignStmt: + if child.Op() == token.DEFINE { + return in + } + } + // Debugf("unwrapTrivialAst(block) unwrapping %#v <%T>\n\tto %#v <%T>\n", form.Interface(), form.Interface(), child.Interface(), child.Interface()) + in = child + case ParenExpr, ExprStmt, DeclStmt: + child := form.Get(0) + // Debugf("unwrapTrivialAst(1) unwrapped %#v <%T>\n\tto %#v <%T>\n", form.Interface(), form.Interface(), child.Interface(), child.Interface()) + in = child + default: + return in + } + } +} + +// MakeQuote invokes parser.MakeQuote() and wraps the resulting ast.Node, +// which represents quote{
}, into an Ast struct +func MakeQuote(form UnaryExpr) (UnaryExpr, BlockStmt) { + expr, block := mp.MakeQuote(nil, form.X.Op, form.X.OpPos, nil) + return UnaryExpr{expr}, BlockStmt{block} +} + +// MakeQuote2 invokes parser.MakeQuote() and wraps the resulting ast.Node, +// which represents quote{}, into an Ast struct +func MakeQuote2(form UnaryExpr, toQuote AstWithNode) UnaryExpr { + var node ast.Node + if toQuote != nil { + node = toQuote.Node() + } + // Debugf("node = %#v\n", node) + // Debugf("form = %#v\n", form) + // Debugf("form.X = %#v\n", form.X) + expr, _ := mp.MakeQuote(nil, form.X.Op, form.X.OpPos, node) + return UnaryExpr{expr} +} + +// DuplicateNestedUnquotes is a support function to handle the following complication: +// in Common Lisp, the right-most unquote pairs with the left-most comma! +// we implement the same mechanics, so we must drill down to the last unquote/unquote_splice +// and, for unquote_splice, create a copy of the unquote/unquote_splice stack for each result. +// Example: +// x:=quote{7; 8} +// quasiquote{quasiquote{1; unquote{2}; unquote{unquote_splice{x}}}} +// must return +// quasiquote{1; unquote{2}; unquote{7}; unquote{8}} +func DuplicateNestedUnquotes(src UnaryExpr, depth int, content Ast) Ast { + if depth == 0 { + return content + } + head, tail := MakeQuote(src) + var form Ast = src + + for ; depth > 1; depth-- { + form = form.Get(0).Get(1) + form = UnwrapTrivialAst(form) + + src = form.(UnaryExpr) + expr, newTail := MakeQuote(src) + // cheat: we know that BlockStmt.Append() always returns the receiver unmodified + tail.Append(expr) + tail = newTail + } + // cheat: we know that BlockStmt.Append() always returns the receiver unmodified + if content != nil { + tail.Append(content) + } + return head +} + +func DescendNestedUnquotes(unquote UnaryExpr) (lastUnquote UnaryExpr, depth int) { + depth = 1 + for { + form := unquote.Get(0).Get(1) + form = UnwrapTrivialAst(form) + + if form != nil && form.Size() == 1 { + if block, ok := form.(BlockStmt); ok { + form = UnwrapTrivialAst(block.Get(0)) + if form != nil && form.Size() == 1 { + if expr, ok := form.(UnaryExpr); ok { + if op := expr.Op(); op == mt.UNQUOTE || op == mt.UNQUOTE_SPLICE { + unquote = expr + depth++ + continue + } + } + } + } + } + return unquote, depth + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/read.go b/vendor/github.com/cosmos72/gomacro/base/read.go new file mode 100644 index 0000000..871cf5d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/read.go @@ -0,0 +1,450 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * read.go + * + * Created on: Mar 12, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "go/token" + "io" + r "reflect" + + mt "github.com/cosmos72/gomacro/token" +) + +func ReadBytes(src interface{}) []byte { + switch s := src.(type) { + case []byte: + if s != nil { + return s + } + case string: + return []byte(s) + case *bytes.Buffer: + // is io.Reader, but src is already available in []byte form + if s != nil { + return s.Bytes() + } + case io.Reader: + if s != nil { + var buf bytes.Buffer + if _, err := io.Copy(&buf, s); err != nil { + Error(err) + } + return buf.Bytes() + } + } + Errorf("unsupported source, cannot read from: %v <%v>", src, r.TypeOf(src)) + return nil +} + +func ReadString(src interface{}) string { + switch s := src.(type) { + case []byte: + if s != nil { + return string(s) + } + case string: + return s + case *bytes.Buffer: + // is io.Reader, but src is already available in string form + if s != nil { + return s.String() + } + case io.Reader: + if s != nil { + var buf bytes.Buffer + if _, err := io.Copy(&buf, s); err != nil { + Error(err) + } + return buf.String() + } + } + Errorf("unsupported source, cannot read from: %v <%v>", src, r.TypeOf(src)) + return "" +} + +type ReadOptions int + +const ( + ReadOptShowPrompt ReadOptions = 1 << iota + ReadOptCollectAllComments // continue until non-comment is found. default is to return comments one by one +) + +const debug = false + +type mode int + +const ( + mNormal mode = iota + mPlus + mMinus + mRune + mString + mRuneEscape + mStringEscape + mRawString + mSlash + mHash + mLineComment + mComment + mCommentStar + mTilde +) + +func (m mode) String() string { + switch m { + case mNormal: + return "norm" + case mPlus: + return "plus" + case mMinus: + return "minus" + case mRune: + return "rune" + case mString: + return "string" + case mRuneEscape: + return "runesc" + case mStringEscape: + return "stresc" + case mRawString: + return "strraw" + case mSlash: + return "slash" + case mHash: + return "hash" + case mLineComment: + return "lcomm" + case mComment: + return "comment" + case mCommentStar: + return "comm*" + case mTilde: + return "tilds" + default: + return "???" + } +} + +var paragraph_separator_bytes = []byte{0xe2, 0x80, 0xa9} +var nl_bytes = []byte{'\n'} + +func ReadMultiline(in *bufio.Reader, opts ReadOptions, out io.Writer, prompt string) (src string, firstToken int, err error) { + m := mNormal + paren := 0 + optPrompt := opts&ReadOptShowPrompt != 0 + optAllComments := opts&ReadOptCollectAllComments != 0 + ignorenl := false + firstToken = -1 + lastToken := -1 + + if optPrompt { + fmt.Fprint(out, prompt) + } + var line, buf []byte + + // comments do not reset ignorenl + resetnl := func(paren int, m mode) bool { + return paren != 0 || + (m != mNormal && m != mSlash && m != mHash && + m != mLineComment && m != mComment && m != mCommentStar) + } + foundtoken := func(pos int) { + lastToken = len(buf) + pos + if firstToken < 0 { + firstToken = lastToken + if debug { + Debugf("ReadMultiline: setting firstToken to %d, line up to it = %q", firstToken, line[:pos]) + } + } + } + invalidChar := func(i int, ch byte, ctx string) (string, int, error) { + return string(append(buf, line[:i]...)), firstToken, + errors.New(fmt.Sprintf("unexpected character %q inside %s literal", ch, ctx)) + } + + for { + line, err = in.ReadBytes('\n') + line = bytes.Replace(line, paragraph_separator_bytes, nl_bytes, -1) + for i, ch := range line { + if debug { + Debugf("ReadMultiline: found %q\tmode=%v\tparen=%d ignorenl=%t", ch, m, paren, ignorenl) + } + switch m { + case mPlus, mMinus: + if ch == '+' { + if m == mPlus { + m = mNormal + } else { + m = mPlus + } + break + } else if ch == '-' { + if m == mMinus { + m = mNormal + } else { + m = mMinus + } + break + } + m = mNormal + ignorenl = true + if ch <= ' ' { + continue + } + fallthrough + case mNormal: + switch ch { + case '(', '[', '{': + paren++ + case ')', ']', '}': + paren-- + case '\'': + m = mRune + case '"': + m = mString + case '`': + m = mRawString + case '/': + m = mSlash + continue // no tokens yet + case '#': + m = mHash // support #! line comments + continue // no tokens yet + case '~': + m = mTilde + case '!', '%', '&', '*', ',', '.', '<', '=', '>', '^', '|': + ignorenl = paren == 0 + case '+': + ignorenl = false + if paren == 0 { + m = mPlus + } + case '-': + ignorenl = false + if paren == 0 { + m = mMinus + } + default: + if ch <= ' ' { + continue // not a token + } + ignorenl = false // found a token + } + case mRune: + switch ch { + case '\\': + m = mRuneEscape + case '\'': + m = mNormal + default: + if ch < ' ' { + return invalidChar(i, ch, "rune") + } + } + case mRuneEscape: + if ch < ' ' { + return invalidChar(i, ch, "rune") + } + m = mRune + case mString: + switch ch { + case '\\': + m = mStringEscape + case '"': + m = mNormal + default: + if ch < ' ' { + return invalidChar(i, ch, "string") + } + } + case mStringEscape: + if ch < ' ' { + return invalidChar(i, ch, "string") + } + m = mString + case mRawString: + switch ch { + case '`': + m = mNormal + } + case mSlash: + switch ch { + case '/': + m = mLineComment + continue // no tokens + case '*': + m = mComment + continue // no tokens + default: + m = mNormal + if ch <= ' ' { + ignorenl = true + } else { + foundtoken(i - 1) + } + } + case mHash: + switch ch { + case '!': + m = mLineComment + line[i-1] = '/' + line[i] = '/' + continue // no tokens + default: + m = mNormal + foundtoken(i - 1) + } + case mLineComment: + continue + case mComment: + switch ch { + case '*': + m = mCommentStar + } + continue + case mCommentStar: + switch ch { + case '/': + m = mNormal + default: + m = mComment + } + continue + case mTilde: + m = mNormal + } + if debug { + Debugf("ReadMultiline: \tmode=%v\tparen=%d ignorenl=%t resetnl=%t", m, paren, ignorenl, resetnl(paren, m)) + } + if resetnl(paren, m) { + ignorenl = false + if debug { + Debugf("ReadMultiline: cleared ignorenl") + } + } + if ch > ' ' { + foundtoken(i) + } + } + buf = append(buf, line...) + if m == mLineComment { + m = mNormal + } + if err != nil { + break + } + if paren <= 0 && !ignorenl && m == mNormal && (firstToken >= 0 || !optAllComments) { + if firstToken >= 0 && lastIsKeywordIgnoresNl(line, firstToken, lastToken) { + ignorenl = true + } else { + break + } + } + if debug { + Debugf("ReadMultiline: continuing\tmode=%v\tparen=%d ignorenl=%t", m, paren, ignorenl) + } + if m == mPlus || m == mMinus { + m = mNormal + } + if optPrompt { + printDots(out, 4+2*paren) + } + } + if err != nil { + if err == io.EOF && paren > 0 { + err = errors.New("unexpected EOF") + } + return string(buf), firstToken, err + } + if debug { + Debugf("ReadMultiline: read %d bytes, firstToken at %d", len(buf), firstToken) + if firstToken >= 0 { + Debugf("ReadMultiline: comments: %q", buf[:firstToken]) + Debugf("ReadMultiline: tokens: %q", buf[firstToken:]) + } else { + Debugf("ReadMultiline: comments: %q", buf) + } + } + return string(buf), firstToken, nil +} + +func lastIsKeywordIgnoresNl(line []byte, first, last int) bool { + if last >= 0 && last < len(line) { + line = line[:last+1] + } + if first >= 0 && first <= len(line) { + line = line[first:] + } + n := len(line) + var start, end int + for i := n - 1; i >= 0; i-- { + ch := line[i] + if ch <= ' ' { + continue + } else if ch >= 'a' && ch <= 'z' { + end = i + 1 + break + } + return false + } + for i := end - 1; i >= 0; i-- { + ch := line[i] + if ch < 'a' || ch > 'z' { + start = i + 1 + break + } + } + str := string(line[start:end]) + tok := mt.Lookup(str) + ignorenl := false + switch tok { + case token.IDENT, token.BREAK, token.CONTINUE, token.FALLTHROUGH, token.RETURN: + default: + ignorenl = true + } + if debug { + Debugf("lastIsKeywordIgnoresNl: found %ignorenl=%t", str, ignorenl) + } + return ignorenl +} + +func printDots(out io.Writer, count int) { + const ( + dots = ". . . . . . . . . . . . . . . . " + ndots = len(dots) + ) + for count >= ndots { + fmt.Fprint(out, dots) + count -= ndots + } + if count > 0 { + fmt.Fprint(out, dots[0:count]) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/string.go b/vendor/github.com/cosmos72/gomacro/base/string.go new file mode 100644 index 0000000..fb0b7be --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/string.go @@ -0,0 +1,113 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * string.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "strconv" +) + +func UnescapeChar(str string) (rune, error) { + // Debugf("unescapeChar(): parsing CHAR %#v", str) + n := len(str) + if n >= 2 && str[0] == '\'' && str[n-1] == '\'' { + str = str[1 : n-1] + } + ret, _, _, err := strconv.UnquoteChar(str, '\'') + if err != nil { + return 0, err + } + return ret, nil +} + +func UnescapeString(str string) string { + ret, err := strconv.Unquote(str) + if err != nil { + Error(err) + } + return ret +} + +func FindFirstToken(src []byte) int { + n := len(src) + const ( + Normal = iota + Slash + LineComment + MultiLineComment + MultiLineCommentStar + ) + mode := Normal + for i := 0; i < n; i++ { + ch := src[i] + switch mode { + case Normal: + if ch == '/' { + mode = Slash + } else if ch > ' ' { + return i + } + case Slash: + if ch == '/' { + mode = LineComment + } else if ch == '*' { + mode = MultiLineComment + } else { + return i - 1 + } + case LineComment: + if ch == '\n' { + mode = Normal + } + case MultiLineComment: + if ch == '*' { + mode = MultiLineCommentStar + } + case MultiLineCommentStar: + if ch == '/' { + mode = Normal + } else { + mode = MultiLineComment + } + } + } + return n +} + +/* +func extractFirstIdentifier(src []byte) []byte { + n := len(src) + for i := 0; i < n; i++ { + ch := src[i] + if (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || + ch == '_' || ch >= 128 || + (i != 0 && (ch >= '0' && ch <= '9')) { + } else { + return src[:i] + } + } + return src +} +*/ diff --git a/vendor/github.com/cosmos72/gomacro/base/types.go b/vendor/github.com/cosmos72/gomacro/base/types.go new file mode 100644 index 0000000..5a0b954 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/types.go @@ -0,0 +1,141 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * types.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + "sort" + "strings" + + "github.com/cosmos72/gomacro/imports" +) + +type PackageRef struct { + imports.Package + Name, Path string +} + +type Options uint +type WhichMacroExpand uint + +const ( + OptTrapPanic Options = 1 << iota + OptPanicStackTrace + OptMacroExpandOnly // do not compile or execute code, only parse and macroexpand it + OptFastInterpreter // use the new (and incomplete) fast interpreter + OptCollectDeclarations + OptCollectStatements + OptShowCompile + OptShowEval + OptShowEvalType + OptShowMacroExpand + OptShowParse + OptShowPrompt + OptShowTime + OptDebugCallStack + OptDebugField + OptDebugMacroExpand + OptDebugMethod + OptDebugPanicRecover + OptDebugParse + OptDebugQuasiquote + OptDebugSleepOnSwitch // to torture-test "switch" implementation for race conditions +) + +const ( + CMacroExpand1 WhichMacroExpand = iota + CMacroExpand + CMacroExpandCodewalk +) + +var optNames = map[Options]string{ + OptTrapPanic: "TrapPanic", + OptPanicStackTrace: "StackTrace.OnPanic", + OptMacroExpandOnly: "MacroExpandOnly", + OptFastInterpreter: "FastInterpreter", + OptCollectDeclarations: "Declarations.Collect", + OptCollectStatements: "Statements.Collect", + OptShowCompile: "Compile.Show", + OptShowEval: "Eval.Show", + OptShowEvalType: "Type.Eval.Show", + OptShowMacroExpand: "MacroExpand.Show", + OptShowParse: "Parse.Show", + OptShowPrompt: "Prompt.Show", + OptShowTime: "Time.Show", + OptDebugCallStack: "?CallStack.Debug", + OptDebugField: "?Field.Debug", + OptDebugMacroExpand: "?MacroExpand.Debug", + OptDebugMethod: "?Method.Debug", + OptDebugPanicRecover: "?PanicRecover.Debug", + OptDebugParse: "?Parse.Debug", + OptDebugQuasiquote: "?Quasiquote.Debug", + OptDebugSleepOnSwitch: "?SwitchSleep.Debug", +} + +var optValues = map[string]Options{} + +func init() { + for k, v := range optNames { + optValues[v] = k + } +} + +func (o Options) String() string { + names := make([]string, 0) + for k, v := range optNames { + if k&o != 0 { + names = append(names, v) + } + } + sort.Strings(names) + return strings.Join(names, " ") +} + +func ParseOptions(str string) Options { + var opts Options + for _, name := range strings.Split(str, " ") { + if opt, ok := optValues[name]; ok { + opts ^= opt + } else if len(name) != 0 { + for k, v := range optNames { + if strings.HasPrefix(v, name) { + opts ^= k + } + } + } + } + return opts +} + +func (m WhichMacroExpand) String() string { + switch m { + case CMacroExpand1: + return "MacroExpand1" + case CMacroExpandCodewalk: + return "MacroExpandCodewalk" + default: + return "MacroExpand" + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/util.go b/vendor/github.com/cosmos72/gomacro/base/util.go new file mode 100644 index 0000000..1e0266f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/util.go @@ -0,0 +1,71 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * util.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package base + +import ( + r "reflect" +) + +func PackValues(val0 r.Value, vals []r.Value) []r.Value { + if len(vals) == 0 && val0 != None { + vals = []r.Value{val0} + } + return vals +} + +func UnpackValues(vals []r.Value) (r.Value, []r.Value) { + val0 := None + if len(vals) > 0 { + val0 = vals[0] + } + return val0, vals +} + +// ValueInterface() is a zero-value-safe version of reflect.Value.Interface() +func ValueInterface(v r.Value) interface{} { + if v == Nil || v == None || !v.IsValid() || !v.CanInterface() { + return nil + } + return v.Interface() +} + +// ValueType() is a zero-value-safe version of reflect.Value.Type() +func ValueType(v r.Value) r.Type { + if v == Nil || v == None || !v.IsValid() { + return nil + } + return v.Type() +} + +func IsNillableKind(k r.Kind) bool { + switch k { + case r.Invalid, // nil is nillable... + r.Chan, r.Func, r.Interface, r.Map, r.Ptr, r.Slice: + return true + default: + return false + } +} diff --git a/vendor/github.com/cosmos72/gomacro/base/x_package.go b/vendor/github.com/cosmos72/gomacro/base/x_package.go new file mode 100644 index 0000000..ebf9670 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/base/x_package.go @@ -0,0 +1,166 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/base" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package base + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/base" +func init() { + imports.Packages["github.com/cosmos72/gomacro/base"] = imports.Package{ + Binds: map[string]r.Value{ + "CMacroExpand": r.ValueOf(CMacroExpand), + "CMacroExpand1": r.ValueOf(CMacroExpand1), + "CMacroExpandCodewalk": r.ValueOf(CMacroExpandCodewalk), + "ConvertValue": r.ValueOf(ConvertValue), + "Debugf": r.ValueOf(Debugf), + "DefaultImporter": r.ValueOf(DefaultImporter), + "DescendNestedUnquotes": r.ValueOf(DescendNestedUnquotes), + "DuplicateNestedUnquotes": r.ValueOf(DuplicateNestedUnquotes), + "Error": r.ValueOf(Error), + "Errorf": r.ValueOf(Errorf), + "False": r.ValueOf(&False).Elem(), + "FindFirstToken": r.ValueOf(FindFirstToken), + "ImBuiltin": r.ValueOf(ImBuiltin), + "ImInception": r.ValueOf(ImInception), + "ImSharedLib": r.ValueOf(ImSharedLib), + "IsCategory": r.ValueOf(IsCategory), + "IsGensym": r.ValueOf(IsGensym), + "IsGensymEmbedded": r.ValueOf(IsGensymEmbedded), + "IsGensymInterface": r.ValueOf(IsGensymInterface), + "IsGensymPrivate": r.ValueOf(IsGensymPrivate), + "IsNillableKind": r.ValueOf(IsNillableKind), + "IsOptimizedKind": r.ValueOf(IsOptimizedKind), + "KindToCategory": r.ValueOf(KindToCategory), + "KindToType": r.ValueOf(KindToType), + "MakeQuote": r.ValueOf(MakeQuote), + "MakeQuote2": r.ValueOf(MakeQuote2), + "MarshalUntyped": r.ValueOf(MarshalUntyped), + "MaxInt": r.ValueOf(MaxInt), + "MaxUint": r.ValueOf(MaxUint), + "MaxUint16": r.ValueOf(MaxUint16), + "MinInt": r.ValueOf(MinInt), + "MinUint": r.ValueOf(MinUint), + "NewGlobals": r.ValueOf(NewGlobals), + "Nil": r.ValueOf(&Nil).Elem(), + "None": r.ValueOf(&None).Elem(), + "One": r.ValueOf(&One).Elem(), + "OptCollectDeclarations": r.ValueOf(OptCollectDeclarations), + "OptCollectStatements": r.ValueOf(OptCollectStatements), + "OptDebugCallStack": r.ValueOf(OptDebugCallStack), + "OptDebugField": r.ValueOf(OptDebugField), + "OptDebugMacroExpand": r.ValueOf(OptDebugMacroExpand), + "OptDebugMethod": r.ValueOf(OptDebugMethod), + "OptDebugPanicRecover": r.ValueOf(OptDebugPanicRecover), + "OptDebugParse": r.ValueOf(OptDebugParse), + "OptDebugQuasiquote": r.ValueOf(OptDebugQuasiquote), + "OptDebugSleepOnSwitch": r.ValueOf(OptDebugSleepOnSwitch), + "OptFastInterpreter": r.ValueOf(OptFastInterpreter), + "OptMacroExpandOnly": r.ValueOf(OptMacroExpandOnly), + "OptPanicStackTrace": r.ValueOf(OptPanicStackTrace), + "OptShowCompile": r.ValueOf(OptShowCompile), + "OptShowEval": r.ValueOf(OptShowEval), + "OptShowEvalType": r.ValueOf(OptShowEvalType), + "OptShowMacroExpand": r.ValueOf(OptShowMacroExpand), + "OptShowParse": r.ValueOf(OptShowParse), + "OptShowPrompt": r.ValueOf(OptShowPrompt), + "OptShowTime": r.ValueOf(OptShowTime), + "OptTrapPanic": r.ValueOf(OptTrapPanic), + "PackValues": r.ValueOf(PackValues), + "ParseOptions": r.ValueOf(ParseOptions), + "ReadBytes": r.ValueOf(ReadBytes), + "ReadMultiline": r.ValueOf(ReadMultiline), + "ReadOptCollectAllComments": r.ValueOf(ReadOptCollectAllComments), + "ReadOptShowPrompt": r.ValueOf(ReadOptShowPrompt), + "ReadString": r.ValueOf(ReadString), + "SimplifyAstForQuote": r.ValueOf(SimplifyAstForQuote), + "SimplifyNodeForQuote": r.ValueOf(SimplifyNodeForQuote), + "StrGensym": r.ValueOf(StrGensym), + "StrGensymEmbedded": r.ValueOf(StrGensymEmbedded), + "StrGensymInterface": r.ValueOf(StrGensymInterface), + "StrGensymPrivate": r.ValueOf(StrGensymPrivate), + "True": r.ValueOf(&True).Elem(), + "TypeOfBool": r.ValueOf(&TypeOfBool).Elem(), + "TypeOfByte": r.ValueOf(&TypeOfByte).Elem(), + "TypeOfComplex128": r.ValueOf(&TypeOfComplex128).Elem(), + "TypeOfComplex64": r.ValueOf(&TypeOfComplex64).Elem(), + "TypeOfDeferFunc": r.ValueOf(&TypeOfDeferFunc).Elem(), + "TypeOfError": r.ValueOf(&TypeOfError).Elem(), + "TypeOfFloat32": r.ValueOf(&TypeOfFloat32).Elem(), + "TypeOfFloat64": r.ValueOf(&TypeOfFloat64).Elem(), + "TypeOfInt": r.ValueOf(&TypeOfInt).Elem(), + "TypeOfInt16": r.ValueOf(&TypeOfInt16).Elem(), + "TypeOfInt32": r.ValueOf(&TypeOfInt32).Elem(), + "TypeOfInt64": r.ValueOf(&TypeOfInt64).Elem(), + "TypeOfInt8": r.ValueOf(&TypeOfInt8).Elem(), + "TypeOfInterface": r.ValueOf(&TypeOfInterface).Elem(), + "TypeOfPtrBool": r.ValueOf(&TypeOfPtrBool).Elem(), + "TypeOfPtrComplex128": r.ValueOf(&TypeOfPtrComplex128).Elem(), + "TypeOfPtrComplex64": r.ValueOf(&TypeOfPtrComplex64).Elem(), + "TypeOfPtrFloat32": r.ValueOf(&TypeOfPtrFloat32).Elem(), + "TypeOfPtrFloat64": r.ValueOf(&TypeOfPtrFloat64).Elem(), + "TypeOfPtrInt": r.ValueOf(&TypeOfPtrInt).Elem(), + "TypeOfPtrInt16": r.ValueOf(&TypeOfPtrInt16).Elem(), + "TypeOfPtrInt32": r.ValueOf(&TypeOfPtrInt32).Elem(), + "TypeOfPtrInt64": r.ValueOf(&TypeOfPtrInt64).Elem(), + "TypeOfPtrInt8": r.ValueOf(&TypeOfPtrInt8).Elem(), + "TypeOfPtrString": r.ValueOf(&TypeOfPtrString).Elem(), + "TypeOfPtrUint": r.ValueOf(&TypeOfPtrUint).Elem(), + "TypeOfPtrUint16": r.ValueOf(&TypeOfPtrUint16).Elem(), + "TypeOfPtrUint32": r.ValueOf(&TypeOfPtrUint32).Elem(), + "TypeOfPtrUint64": r.ValueOf(&TypeOfPtrUint64).Elem(), + "TypeOfPtrUint8": r.ValueOf(&TypeOfPtrUint8).Elem(), + "TypeOfPtrUintptr": r.ValueOf(&TypeOfPtrUintptr).Elem(), + "TypeOfReflectType": r.ValueOf(&TypeOfReflectType).Elem(), + "TypeOfRune": r.ValueOf(&TypeOfRune).Elem(), + "TypeOfSliceOfByte": r.ValueOf(&TypeOfSliceOfByte).Elem(), + "TypeOfSliceOfInterface": r.ValueOf(&TypeOfSliceOfInterface).Elem(), + "TypeOfString": r.ValueOf(&TypeOfString).Elem(), + "TypeOfUint": r.ValueOf(&TypeOfUint).Elem(), + "TypeOfUint16": r.ValueOf(&TypeOfUint16).Elem(), + "TypeOfUint32": r.ValueOf(&TypeOfUint32).Elem(), + "TypeOfUint64": r.ValueOf(&TypeOfUint64).Elem(), + "TypeOfUint8": r.ValueOf(&TypeOfUint8).Elem(), + "TypeOfUintptr": r.ValueOf(&TypeOfUintptr).Elem(), + "UnescapeChar": r.ValueOf(UnescapeChar), + "UnescapeString": r.ValueOf(UnescapeString), + "UnmarshalUntyped": r.ValueOf(UnmarshalUntyped), + "UnpackValues": r.ValueOf(UnpackValues), + "UnwrapTrivialAst": r.ValueOf(UnwrapTrivialAst), + "UnwrapTrivialAstKeepBlocks": r.ValueOf(UnwrapTrivialAstKeepBlocks), + "UnwrapTrivialNode": r.ValueOf(UnwrapTrivialNode), + "ValueInterface": r.ValueOf(ValueInterface), + "ValueType": r.ValueOf(ValueType), + "Warnf": r.ValueOf(Warnf), + "ZeroStrings": r.ValueOf(&ZeroStrings).Elem(), + "ZeroTypes": r.ValueOf(&ZeroTypes).Elem(), + "ZeroValues": r.ValueOf(&ZeroValues).Elem(), + }, Types: map[string]r.Type{ + "Globals": r.TypeOf((*Globals)(nil)).Elem(), + "ImportMode": r.TypeOf((*ImportMode)(nil)).Elem(), + "Importer": r.TypeOf((*Importer)(nil)).Elem(), + "Options": r.TypeOf((*Options)(nil)).Elem(), + "Output": r.TypeOf((*Output)(nil)).Elem(), + "PackageRef": r.TypeOf((*PackageRef)(nil)).Elem(), + "ReadOptions": r.TypeOf((*ReadOptions)(nil)).Elem(), + "RuntimeError": r.TypeOf((*RuntimeError)(nil)).Elem(), + "Stringer": r.TypeOf((*Stringer)(nil)).Elem(), + "TypeVisitor": r.TypeOf((*TypeVisitor)(nil)).Elem(), + "WhichMacroExpand": r.TypeOf((*WhichMacroExpand)(nil)).Elem(), + }, Untypeds: map[string]string{ + "MinUint": "int:0", + "StrGensym": "string:𒒭", + "StrGensymEmbedded": "string:»", + "StrGensymInterface": "string:\u0080", + "StrGensymPrivate": "string:\u00ad", + }, Wrappers: map[string][]string{ + "Globals": []string{"CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "IncLine", "IncLineBytes", "Position", "Sprintf", "ToString", "WarnExtraValues", "Warnf"}, + "Output": []string{"Copy", "Errorf", "Fprintf", "IncLine", "IncLineBytes", "Position", "Sprintf", "ToString"}, + "PackageRef": []string{"Init", "Merge", "SaveToPackages"}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/benchmark_test.go b/vendor/github.com/cosmos72/gomacro/benchmark_test.go new file mode 100644 index 0000000..76eb6d3 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/benchmark_test.go @@ -0,0 +1,735 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * expr_test.go + * + * Created on: Mar 06 2017 + * Author: Massimiliano Ghilardi + */ +package main + +import ( + "fmt" + r "reflect" + "testing" + + // . "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/classic" + "github.com/cosmos72/gomacro/experiments/bytecode_interfaces" + "github.com/cosmos72/gomacro/experiments/bytecode_values" + "github.com/cosmos72/gomacro/experiments/closure_interfaces" + "github.com/cosmos72/gomacro/experiments/closure_maps" + "github.com/cosmos72/gomacro/experiments/closure_values" + "github.com/cosmos72/gomacro/fast" +) + +const ( + collatz_n = 837799 // sequence climbs to 1487492288, which also fits 32-bit ints + sum_n = 1000 + fib_n = 12 + bigswitch_n = 100 +) + +var verbose = false + +/* + --------- 2017-05-21: results on Intel Core i7 4770 --------------- + + BenchmarkFibonacciCompiler-8 3000000 501 ns/op + BenchmarkFibonacciFast-8 100000 15774 ns/op + BenchmarkFibonacciFast2-8 100000 15141 ns/op + BenchmarkFibonacciClassic-8 2000 915990 ns/op + BenchmarkFibonacciClassic2-8 2000 912180 ns/op + BenchmarkFibonacciClosureValues-8 5000 259074 ns/op + BenchmarkFibonacciClosureInterfaces-8 10000 193098 ns/op + BenchmarkFibonacciClosureMaps-8 5000 358345 ns/op + BenchmarkShellSortCompiler-8 20000000 74.0 ns/op + BenchmarkShellSortFast-8 200000 7790 ns/op + BenchmarkShellSortClassic-8 5000 276673 ns/op + BenchmarkSwitchCompiler-8 1000000 2363 ns/op + BenchmarkSwitchFast-8 50000 37773 ns/op + BenchmarkSwitchClassic-8 500 3454461 ns/op + BenchmarkArithCompiler1-8 200000000 8.41 ns/op + BenchmarkArithCompiler2-8 200000000 8.41 ns/op + BenchmarkArithFast-8 50000000 30.8 ns/op + BenchmarkArithFast2-8 30000000 50.6 ns/op + BenchmarkArithFastConst-8 100000000 15.2 ns/op + BenchmarkArithFastCompileLoop-8 100000 21442 ns/op + BenchmarkArithClassic-8 1000000 1686 ns/op + BenchmarkArithClassic2-8 500000 2916 ns/op + BenchmarkCollatzCompiler-8 5000000 265 ns/op + BenchmarkCollatzFast-8 200000 11812 ns/op + BenchmarkCollatzClassic-8 2000 654139 ns/op + BenchmarkCollatzBytecodeInterfaces-8 50000 30203 ns/op + BenchmarkCollatzClosureValues-8 100000 16570 ns/op + BenchmarkSumCompiler-8 5000000 294 ns/op + BenchmarkSumFast-8 100000 20789 ns/op + BenchmarkSumFast2-8 100000 20720 ns/op + BenchmarkSumClassic-8 1000 1223624 ns/op + BenchmarkSumBytecodeValues-8 20000 76201 ns/op + BenchmarkSumBytecodeInterfaces-8 30000 53031 ns/op + BenchmarkSumClosureValues-8 30000 41124 ns/op + BenchmarkSumClosureInterfaces-8 10000 147109 ns/op + BenchmarkSumClosureMaps-8 20000 93320 ns/op +*/ + +// ---------------------- recursion: fibonacci ---------------------- + +func fibonacci(n int) int { + if n <= 2 { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) +} + +func BenchmarkFibonacciCompiler(b *testing.B) { + var total int + n := fib_n + for i := 0; i < b.N; i++ { + total += fibonacci(n) + } + if verbose { + println(total) + } +} + +func BenchmarkFibonacciFast(b *testing.B) { + ir := fast.New() + ir.Eval(fibonacci_source_string) + + // compile the call to fibonacci(fib_n) + expr := ir.Compile(fmt.Sprintf("fibonacci(%d)", fib_n)) + fun := expr.Fun.(func(*fast.Env) int) + env := ir.PrepareEnv() + + fun(env) // warm up + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fun(env) + } +} + +func BenchmarkFibonacciFast2(b *testing.B) { + ir := fast.New() + ir.Eval(fibonacci_source_string) + + // alternative: extract the function fibonacci, and call it ourselves + // + // ValueOf is the method to retrieve constants, functions and variables from the classic and fast interpreters + // (if you are going to read or write the same interpreter variable repeatedly, + // dereferencing the address returned by AddressOfVar is faster) + fun := ir.ValueOf("fibonacci").Interface().(func(int) int) + + fun(fib_n) // warm up + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fun(fib_n) + } +} + +func BenchmarkFibonacciClassic(b *testing.B) { + ir := classic.New() + ir.Eval(fibonacci_source_string) + + // compile the call to fibonacci(fib_n) + form := ir.Parse(fmt.Sprintf("fibonacci(%d)", fib_n)) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += int(ir.EvalAst1(form).Int()) + } +} + +func BenchmarkFibonacciClassic2(b *testing.B) { + ir := classic.New() + ir.Eval(fibonacci_source_string) + + // alternative: extract the function fibonacci, and call it ourselves + fun := ir.ValueOf("fibonacci").Interface().(func(int) int) + + fun(fib_n) // warm up + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fun(fib_n) + } +} + +func BenchmarkFibonacciClosureValues(b *testing.B) { + env := closure_values.NewEnv(nil) + fib := closure_values.DeclFibonacci(env, 0) + n := r.ValueOf(fib_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fib(n) + } +} + +func BenchmarkFibonacciClosureInterfaces(b *testing.B) { + env := closure_interfaces.NewEnv(nil) + fib := closure_interfaces.DeclFibonacci(env, 0) + var n interface{} = fib_n + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fib(n) + } +} + +func BenchmarkFibonacciClosureMaps(b *testing.B) { + env := closure_maps.NewEnv(nil) + fib := closure_maps.DeclFibonacci(env, "fib") + n := r.ValueOf(fib_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fib(n) + } +} + +// ---------------------- arrays: shellsort ------------------------ + +// array indexing is faster that slice indexing, +// provided the array is *not* copied. so use a pointer to array +var shellshort_gaps = &[...]int{701, 301, 132, 57, 23, 10, 4, 1} + +func shellsort(v []int) { + var i, j, n, gap, temp int + n = len(v) + for _, gap = range shellshort_gaps { + for i = gap; i < n; i++ { + temp = v[i] + for j = i; j >= gap && v[j-gap] > temp; j -= gap { + v[j] = v[j-gap] + } + v[j] = temp + } + } +} + +var sort_data = []int{97, 89, 3, 4, 7, 0, 36, 79, 1, 12, 2, 15, 70, 18, 35, 70, 15, 73} + +func BenchmarkShellSortCompiler(b *testing.B) { + benchmark_sort(b, shellsort) +} + +func BenchmarkShellSortFast(b *testing.B) { + ir := fast.New() + ir.Eval(shellsort_source_string) + + // extract the function shellsort() + sort := ir.ValueOf("shellsort").Interface().(func([]int)) + + benchmark_sort(b, sort) +} + +func BenchmarkShellSortFastCompileLoop(b *testing.B) { + ir := fast.New() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + ir.Comp.Binds = make(map[string]*fast.Bind) + ir.Comp.BindNum = fast.NoIndex + ir.Compile(shellsort_source_string) + } +} + +func BenchmarkShellSortClassic(b *testing.B) { + ir := classic.New() + ir.Eval(shellsort_source_string) + + // extract the function shellsort() + sort := ir.ValueOf("shellsort").Interface().(func([]int)) + + benchmark_sort(b, sort) +} + +func benchmark_sort(b *testing.B, sort func([]int)) { + // call sort once for warm-up + v := make([]int, len(sort_data)) + copy(v, sort_data) + sort(v) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + copy(v, sort_data) + sort(v) + } + if verbose { + fmt.Println(v) + } +} + +// ---------------------- switch ------------------------ + +func bigswitch(n int) int { + for i := 0; i < 1000; i++ { + switch n & 15 { + case 0: + n++ + case 1: + n += 2 + case 2: + n += 3 + case 3: + n += 4 + case 4: + n += 5 + case 5: + n += 6 + case 6: + n += 7 + case 7: + n += 8 + case 8: + n += 9 + case 9: + n += 10 + case 10: + n += 11 + case 11: + n += 12 + case 12: + n += 13 + case 13: + n += 14 + case 14: + n += 15 + case 15: + n-- + } + } + return n +} + +func BenchmarkSwitchCompiler(b *testing.B) { + var total int + for i := 0; i < b.N; i++ { + total += bigswitch(bigswitch_n) + } + if verbose { + println(total) + } +} + +func BenchmarkSwitchFast(b *testing.B) { + ir := fast.New() + ir.Eval(switch_source_string) + + fun := ir.ValueOf("bigswitch").Interface().(func(int) int) + fun(bigswitch_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fun(bigswitch_n) + } +} + +func BenchmarkSwitchClassic(b *testing.B) { + ir := classic.New() + ir.Eval(switch_source_string) + + fun := ir.ValueOf("bigswitch").Interface().(func(int) int) + fun(bigswitch_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += fun(bigswitch_n) + } +} + +// ---------------- simple arithmetic ------------------ + +func arith(n int) int { + return ((n*2+3)&4 | 5 ^ 6) / (n | 1) +} + +func BenchmarkArithCompiler1(b *testing.B) { + total := 0 + for i := 0; i < b.N; i++ { + n := b.N + total += ((n*2+3)&4 | 5 ^ 6) / (n | 1) + } + if verbose { + println(total) + } +} + +func BenchmarkArithCompiler2(b *testing.B) { + total := 0 + for i := 0; i < b.N; i++ { + total += arith(b.N) + } + if verbose { + println(total) + } +} + +func BenchmarkArithFast(b *testing.B) { + ir := fast.New() + ir.DeclVar("n", nil, int(0)) + + addr := ir.AddressOfVar("n").Interface().(*int) + + expr := ir.Compile("((n*2+3)&4 | 5 ^ 6) / (n|1)") + fun := expr.Fun.(func(*fast.Env) int) + env := ir.PrepareEnv() + fun(env) + + // interpreted code performs only arithmetic - iteration performed here + b.ResetTimer() + total := 0 + for i := 0; i < b.N; i++ { + *addr = b.N + total += fun(env) + } + if verbose { + println(total) + } +} + +func BenchmarkArithFast2(b *testing.B) { + ir := fast.New() + ir.Eval("var i, n, total int") + + n := ir.AddressOfVar("n").Interface().(*int) + total := ir.AddressOfVar("total").Interface().(*int) + + // interpreted code performs iteration and arithmetic + fun := ir.Compile("for i = 0; i < n; i++ { total += ((n*2+3)&4 | 5 ^ 6) / (n|1) }").AsX() + env := ir.PrepareEnv() + fun(env) + + b.ResetTimer() + + *n = b.N + *total = 0 + fun(env) + + if verbose { + println(*total) + } +} + +func BenchmarkArithFastConst(b *testing.B) { + ir := fast.New() + // "cheat" a bit and declare n as a constant. checks if constant propagation works :) + ir.DeclConst("n", nil, b.N) + + // interpreted code performs only arithmetic - iteration performed here + expr := ir.Compile("((n*2+3)&4 | 5 ^ 6) / (n|1)") + fun := expr.WithFun().(func(*fast.Env) int) + env := ir.PrepareEnv() + fun(env) + + b.ResetTimer() + total := 0 + for i := 0; i < b.N; i++ { + total += fun(env) + } + if verbose { + println(total) + } +} + + +func BenchmarkArithFastConst2(b *testing.B) { + ir := fast.New() + ir.Eval("var i, total int") + // "cheat" a bit and declare n as a constant. checks if constant propagation works :) + ir.DeclConst("n", nil, int(b.N)) + total := ir.AddressOfVar("total").Interface().(*int) + + // interpreted code performs iteration and arithmetic + fun := ir.Compile("for i = 0; i < n; i++ { total += ((n*2+3)&4 | 5 ^ 6) / (n|1) }").AsX() + env := ir.PrepareEnv() + fun(env) + + b.ResetTimer() + + *total = 0 + fun(env) + + if verbose { + println(*total) + } +} + +func BenchmarkArithFastCompileLoop(b *testing.B) { + ir := fast.New() + ir.Eval("var i, n, total int") + + b.ResetTimer() + for i := 0; i < b.N; i++ { + ir.Compile("total = 0; for i = 0; i < n; i++ { total += ((n*2+3)&4 | 5 ^ 6) / (n|1) }; total") + } +} + +func BenchmarkArithClassic(b *testing.B) { + ir := classic.New() + ir.Eval("n:=0") + + form := ir.Parse("((n*2+3)&4 | 5 ^ 6) / (n|1)") + + value := ir.ValueOf("n") + var ret r.Value + ir.EvalAst(form) + + // interpreted code performs only arithmetic - iteration performed here + b.ResetTimer() + total := 0 + for i := 0; i < b.N; i++ { + value.SetInt(int64(b.N)) + ret, _ = ir.EvalAst(form) + total += int(ret.Int()) + } + if verbose { + println(total) + } +} + +func BenchmarkArithClassic2(b *testing.B) { + ir := classic.New() + ir.Eval("var n, total int") + + // interpreted code performs iteration and arithmetic + form := ir.Parse("total = 0; for i:= 0; i < n; i++ { total += ((n*2+3)&4 | 5 ^ 6) / (n|1) }; total") + + value := ir.ValueOf("n") + ir.EvalAst(form) + + b.ResetTimer() + value.SetInt(int64(b.N)) + ret, _ := ir.EvalAst(form) + + if verbose { + println(ret.Int()) + } +} + +// ---------------- collatz conjecture -------------------- + +func collatz(n uint) { + for n > 1 { + if n&1 != 0 { + n = ((n * 3) + 1) >> 1 + } else { + n >>= 1 + } + } +} + +func BenchmarkCollatzCompiler(b *testing.B) { + var n uint = collatz_n + for i := 0; i < b.N; i++ { + collatz(n) + } +} + +func BenchmarkCollatzFast(b *testing.B) { + ir := fast.New() + ir.DeclVar("n", nil, uint(0)) + addr := ir.AddressOfVar("n").Interface().(*uint) + + fun := ir.Compile("for n > 1 { if n&1 != 0 { n = ((n * 3) + 1) >> 1 } else { n >>= 1 } }").AsX() + env := ir.PrepareEnv() + fun(env) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + *addr = collatz_n + fun(env) + } +} + +func BenchmarkCollatzClassic(b *testing.B) { + ir := classic.New() + ir.EvalAst(ir.Parse("var n uint")) + addr := ir.ValueOf("n").Addr().Interface().(*uint) + + form := ir.Parse("for n > 1 { if n&1 != 0 { n = ((n * 3) + 1) >> 1 } else { n >>= 1 } }") + ir.EvalAst(form) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + *addr = collatz_n + ir.EvalAst(form) + } +} + +func BenchmarkCollatzBytecodeInterfaces(b *testing.B) { + coll := bytecode_interfaces.BytecodeCollatz() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + coll.Vars[0] = collatz_n + coll.Exec(0) + } +} + +func BenchmarkCollatzClosureValues(b *testing.B) { + env := closure_values.NewEnv(nil) + coll := closure_values.DeclCollatz(env, 0) + n := r.ValueOf(collatz_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += coll(n) + } +} + +// ------------- looping: sum the integers from 1 to N ------------------- + +func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total +} + +func BenchmarkSumCompiler(b *testing.B) { + var total int + for i := 0; i < b.N; i++ { + total += sum(sum_n) + } + if verbose { + println(total) + } +} + +func BenchmarkSumFast(b *testing.B) { + ir := fast.New() + ir.Eval("var i, total uint") + ir.DeclConst("n", nil, uint(sum_n)) + + expr := ir.Compile("total = 0; for i = 1; i <= n; i++ { total += i }; total") + fun := expr.Fun.(func(*fast.Env) uint) + env := ir.PrepareEnv() + fun(env) + + var total uint + b.ResetTimer() + for i := 0; i < b.N; i++ { + total += fun(env) + } + if verbose { + println(total) + } +} + +func BenchmarkSumFast2(b *testing.B) { + ir := fast.New() + ir.Eval("var i, total uint") + ir.DeclConst("n", nil, uint(sum_n)) + + fun := ir.Compile("for i = 1; i <= n; i++ { total += i }").AsX() + env := ir.PrepareEnv() + fun(env) + total := ir.AddressOfVar("total").Interface().(*uint) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + *total = 0 + fun(env) + } + if verbose { + println(*total) + } +} + +func BenchmarkSumClassic(b *testing.B) { + ir := classic.New() + ir.Eval("var i, n, total int") + ir.ValueOf("n").SetInt(sum_n) + form := ir.Parse("total = 0; for i = 1; i <= n; i++ { total += i }; total") + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += int(ir.EvalAst1(form).Int()) + } +} + +func BenchmarkSumBytecodeValues(b *testing.B) { + sum := bytecode_values.BytecodeSum(sum_n) + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += int(sum.Exec(0)[0].Int()) + } +} + +func BenchmarkSumBytecodeInterfaces(b *testing.B) { + p := bytecode_interfaces.BytecodeSum(sum_n) + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += p.Exec(0)[0].(int) + } +} + +func BenchmarkSumClosureValues(b *testing.B) { + env := closure_values.NewEnv(nil) + sum := closure_values.DeclSum(env, 0) + n := r.ValueOf(sum_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += sum(n) + } +} + +func BenchmarkSumClosureInterfaces(b *testing.B) { + env := closure_interfaces.NewEnv(nil) + sum := closure_interfaces.DeclSum(env, 0) + var n interface{} = sum_n + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += sum(n) + } +} + +func BenchmarkSumClosureMaps(b *testing.B) { + env := closure_maps.NewEnv(nil) + sum := closure_maps.DeclSum(env, "sum") + n := r.ValueOf(sum_n) + + b.ResetTimer() + var total int + for i := 0; i < b.N; i++ { + total += sum(n) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/assignment.go b/vendor/github.com/cosmos72/gomacro/classic/assignment.go new file mode 100644 index 0000000..2756d6c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/assignment.go @@ -0,0 +1,204 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * assignment.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +type placeType struct { + obj r.Value // the map to modify, or a settable r.Value + mapkey r.Value // the map key to set, or Nil +} + +// dummy place for assignment to _ +var _Place = placeType{ + obj: r.ValueOf(struct{}{}), +} + +func (env *Env) evalAssignments(node *ast.AssignStmt) (r.Value, []r.Value) { + left := node.Lhs + right := node.Rhs + op := node.Tok + nleft := len(left) + nright := len(right) + + if nright != 1 && nleft != nright { + return env.Errorf("value count mismatch: cannot assign %d values to %d places: %v", nright, nleft, node) + } + + // side effects happen left to right, with some unspecified cases, + // so first Eval() all node.Lhs, then Eval() all node.Rhs + // https://golang.org/ref/spec#Order_of_evaluation + + if op == token.DEFINE { + names := make([]string, nleft) + for i := 0; i < nleft; i++ { + ident, ok := left[i].(*ast.Ident) + if !ok { + return env.Errorf("variable declaration: invalid identifier: %v", left[i]) + } + names[i] = ident.Name + } + values := env.evalExprsMultipleValues(right, nleft) + return env.defineConstsVarsOrFuncs(names, nil, values, false) + + } else { + places := env.evalPlaces(left) + values := env.evalExprsMultipleValues(right, nleft) + return env.assignPlaces(places, op, values) + } +} + +func (env *Env) evalPlaces(node []ast.Expr) []placeType { + n := len(node) + places := make([]placeType, n) + for i := 0; i < n; i++ { + places[i] = env.evalPlace(node[i]) + } + return places +} + +func (env *Env) evalPlace(node ast.Expr) placeType { + obj := Nil + // ignore parenthesis: (expr) = value is the same as expr = value + for { + if paren, ok := node.(*ast.ParenExpr); ok { + node = paren.X + } else { + break + } + } + switch node := node.(type) { + case *ast.IndexExpr: + obj = env.evalExpr1(node.X) + index := env.evalExpr1(node.Index) + + switch obj.Kind() { + case r.Map: + // make a copy of obj and index, to protect against "evil assignment" m, i, m[i] = nil, 1, 2 where m is a map + if obj != Nil && obj.CanSet() { + obj = obj.Convert(obj.Type()) + } + if index != Nil && index.CanSet() { + index = index.Convert(index.Type()) + } + return placeType{obj, index} + default: + if obj.Kind() != r.Ptr || obj.Elem().Kind() != r.Array { + env.Errorf("unsupported index operation: %v [ %v ]. not an array, map, slice or string: %v <%v>", + node.X, index, obj, typeOf(obj)) + return placeType{} + } + obj = obj.Elem() + fallthrough + case r.Array, r.Slice, r.String: + i, ok := env.toInt(index) + if !ok { + env.Errorf("invalid index, expecting an int: %v <%v>", index, typeOf(index)) + return placeType{} + } + obj = obj.Index(int(i)) + } + case *ast.Ident: + if node.Name == "_" { + return _Place + } + obj = env.evalExpr1(node) + + default: + obj = env.evalExpr1(node) + } + if !obj.CanSet() { + env.Errorf("cannot assign to read-only location: %v", node) + return placeType{} + } + return placeType{obj, Nil} +} + +func (env *Env) assignPlaces(places []placeType, op token.Token, values []r.Value) (r.Value, []r.Value) { + n := len(places) + if n == 1 { + return env.assignPlace(places[0], op, values[0]), nil + } + // the naive loop + // for i := range places { env.assignPlace(places[i], op, values[i]) } + // is bugged. It breaks, among others, the common Go idiom to swap two values: a,b = b,a + // + // More in general, Go guarantees that all assignments happen *as if* + // the rhs values, and all lhs operands of indexing, dereferencing and struct field access, + // were copied to temporary locations before the assignments. + // That's exactly what we must do. + for i := 0; i < n; i++ { + p := &places[i] + v := p.mapkey + if v != Nil && v.CanSet() { + p.mapkey = v.Convert(v.Type()) // r.Value.Convert() makes a copy + } + v = values[i] + if v != Nil && v.CanSet() { + values[i] = v.Convert(v.Type()) // r.Value.Convert() makes a copy + } + } + for i := 0; i < n; i++ { + values[i] = env.assignPlace(places[i], op, values[i]) + } + return UnpackValues(values) +} + +func (env *Env) assignPlace(place placeType, op token.Token, value r.Value) r.Value { + obj := place.obj + if obj == _Place.obj { + return value + } + key := place.mapkey + if key == Nil { + t := typeOf(obj) + value = env.valueToType(value, t) + if op != token.ASSIGN { + value = env.evalBinaryExpr(obj, op, value) + } + obj.Set(value) + return value + } + // map[key] OP value + key = env.valueToType(key, obj.Type().Key()) + + // env.Debugf("setting map[key]: %v <%v> [%v <%v>] %s %v <%v>", obj, TypeOf(obj), key, TypeOf(key), op, value, TypeOf(value)) + + currValue, _, t := env.mapIndex(obj, key) + value = env.valueToType(value, t) + if op != token.ASSIGN { + value = env.evalBinaryExpr(currValue, op, value) + value = env.valueToType(value, t) // in case evalBinaryExpr() converted it + } + obj.SetMapIndex(key, value) + return value +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/binaryexpr.go b/vendor/github.com/cosmos72/gomacro/classic/binaryexpr.go new file mode 100644 index 0000000..ad2edd1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/binaryexpr.go @@ -0,0 +1,401 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binaryexpr.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (env *Env) unsupportedBinaryExpr(xv r.Value, op token.Token, yv r.Value) r.Value { + opstr := mt.String(op) + ret, _ := env.Errorf("unsupported binary operation %s between <%v> and <%v>: %v %s %v", opstr, typeOf(xv), typeOf(yv), xv, opstr, yv) + return ret +} + +func (env *Env) evalBinaryExpr(xv r.Value, op token.Token, yv r.Value) r.Value { + switch xv.Kind() { + case r.Bool: + switch yv.Kind() { + case r.Bool: + return env.evalBinaryExprBoolBool(xv, op, yv) + } + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + x := xv.Int() + switch yv.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + return env.evalBinaryExprIntInt(xv, op, yv) + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return env.evalBinaryExprIntInt(xv, op, r.ValueOf(int64(yv.Uint()))) + case r.Float32, r.Float64: + xv = r.ValueOf(float64(x)).Convert(yv.Type()) + return env.evalBinaryExprFloat(xv, op, yv) + case r.Complex64, r.Complex128: + xv = r.ValueOf(complex(float64(x), 0.0)).Convert(yv.Type()) + return env.evalBinaryExprComplex(xv, op, yv) + } + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + x := xv.Uint() + switch yv.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + if yv.Int() < 0 { + return env.evalBinaryExprIntInt(r.ValueOf(int64(x)), op, yv) + } else { + return env.evalBinaryExprUintUint(xv, op, r.ValueOf(uint64(yv.Int()))) + } + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return env.evalBinaryExprUintUint(xv, op, yv) + case r.Float32, r.Float64: + xv = r.ValueOf(float64(x)).Convert(yv.Type()) + return env.evalBinaryExprFloat(xv, op, yv) + case r.Complex64, r.Complex128: + xv = r.ValueOf(complex(float64(x), 0.0)).Convert(yv.Type()) + return env.evalBinaryExprComplex(xv, op, yv) + } + case r.Float32, r.Float64: + return env.evalBinaryExprFloat(xv, op, yv) + case r.Complex64, r.Complex128: + return env.evalBinaryExprComplex(xv, op, yv) + case r.String: + return env.evalBinaryExprString(xv, op, yv) + default: + return r.ValueOf(env.evalBinaryExprMisc(xv, op, yv)) + } + return env.unsupportedBinaryExpr(xv, op, yv) +} + +func (env *Env) evalBinaryExprBoolBool(xv r.Value, op token.Token, yv r.Value) r.Value { + x := xv.Bool() + y := yv.Bool() + var b bool + switch op { + case token.LAND: // for a short-circuit implementation, see evalExpr + b = x && y + case token.LOR: // for a short-circuit implementation, see evalExpr + b = x || y + case token.EQL: + b = x == y + case token.NEQ: + b = x != y + default: + return env.unsupportedBinaryExpr(xv, op, yv) + } + return r.ValueOf(b) +} + +func (env *Env) evalBinaryExprIntInt(xv r.Value, op token.Token, yv r.Value) r.Value { + x := xv.Int() + y := yv.Int() + var ret int64 + var t r.Type + switch op { + case token.ADD, token.ADD_ASSIGN: + ret = x + y + case token.SUB, token.SUB_ASSIGN: + ret = x - y + case token.MUL, token.MUL_ASSIGN: + ret = x * y + case token.QUO, token.QUO_ASSIGN: + ret = x / y + case token.REM, token.REM_ASSIGN: + ret = x % y + case token.AND, token.AND_ASSIGN: + ret = x & y + case token.OR, token.OR_ASSIGN: + ret = x | y + case token.XOR, token.XOR_ASSIGN: + ret = x ^ y + case token.SHL, token.SHL_ASSIGN: + // in Go, x << y and x >> y require y to be unsigned + ret = x << uint64(y) + t = xv.Type() + case token.SHR, token.SHR_ASSIGN: + ret = x >> uint64(y) + t = xv.Type() + case token.AND_NOT, token.AND_NOT_ASSIGN: + ret = x &^ y + default: + goto PART2 + } + if t == nil { + t = binaryResultType(xv.Type(), yv.Type()) + } + return env.valueToType(r.ValueOf(ret), t) + +PART2: + var b bool + switch op { + case token.EQL: + b = x == y + case token.LSS: + b = x < y + case token.GTR: + b = x > y + case token.NEQ: + b = x != y + case token.LEQ: + b = x <= y + case token.GEQ: + b = x >= y + default: + return env.unsupportedBinaryExpr(r.ValueOf(x), op, r.ValueOf(y)) + } + return r.ValueOf(b) +} + +func (env *Env) evalBinaryExprUintUint(xv r.Value, op token.Token, yv r.Value) r.Value { + x := xv.Uint() + y := yv.Uint() + var ret uint64 + var t r.Type + + switch op { + case token.ADD, token.ADD_ASSIGN: + ret = x + y + case token.SUB, token.SUB_ASSIGN: + ret = x - y + case token.MUL, token.MUL_ASSIGN: + ret = x * y + case token.QUO, token.QUO_ASSIGN: + ret = x / y + case token.REM, token.REM_ASSIGN: + ret = x % y + case token.AND, token.AND_ASSIGN: + ret = x & y + case token.OR, token.OR_ASSIGN: + ret = x | y + case token.XOR, token.XOR_ASSIGN: + ret = x ^ y + case token.SHL, token.SHL_ASSIGN: + ret = x << y + t = xv.Type() + case token.SHR, token.SHR_ASSIGN: + ret = x >> y + t = xv.Type() + case token.AND_NOT, token.AND_NOT_ASSIGN: + ret = x &^ y + default: + goto PART2 + } + if t == nil { + t = binaryResultType(xv.Type(), yv.Type()) + } + return env.valueToType(r.ValueOf(ret), t) + +PART2: + var b bool + switch op { + case token.EQL: + b = x == y + case token.LSS: + b = x < y + case token.GTR: + b = x > y + case token.NEQ: + b = x != y + case token.LEQ: + b = x <= y + case token.GEQ: + b = x >= y + default: + return env.unsupportedBinaryExpr(xv, op, yv) + } + return r.ValueOf(b) +} + +func binaryResultType(xt, yt r.Type) r.Type { + if xt == yt { + return xt + } + // int and uint are used to approximate untyped constants, + // avoid them if possible + if xt == TypeOfInt || xt == TypeOfUint { + return yt + } + if yt == TypeOfInt || yt == TypeOfUint { + return xt + } + // prefer larger types + xs, ys := xt.Size(), yt.Size() + if xs > ys { + return xt + } else if xs < ys { + return yt + } + // prefer named types + xk, yk := xt.Kind(), yt.Kind() + if KindToType(xk) == xt { + return yt + } else if KindToType(yk) == yt { + return xt + } + // prefer types appearing later in reflect.Kind list + if xk >= yk { + return xt + } else { + return yt + } +} + +func (env *Env) evalBinaryExprFloat(xv r.Value, op token.Token, yv r.Value) r.Value { + x := xv.Float() + y, ok := env.toFloat(yv) + if ok { + var ret float64 + switch op { + case token.ADD, token.ADD_ASSIGN: + ret = x + y + case token.SUB, token.SUB_ASSIGN: + ret = x - y + case token.MUL, token.MUL_ASSIGN: + ret = x * y + case token.QUO, token.QUO_ASSIGN: + ret = x / y + default: + goto PART2 + } + if xv.Kind() == r.Float32 { + return r.ValueOf(float32(ret)) + } + return r.ValueOf(ret) + PART2: + var b bool + switch op { + case token.EQL: + b = x == y + case token.LSS: + b = x < y + case token.GTR: + b = x > y + case token.NEQ: + b = x != y + case token.LEQ: + b = x <= y + case token.GEQ: + b = x >= y + default: + return env.unsupportedBinaryExpr(xv, op, yv) + } + return r.ValueOf(b) + } + if yv.Kind() == r.Complex64 || yv.Kind() == r.Complex128 { + xv = r.ValueOf(complex(x, 0.0)).Convert(yv.Type()) + return env.evalBinaryExprComplex(xv, op, yv) + } + return env.unsupportedBinaryExpr(xv, op, yv) +} + +func (env *Env) evalBinaryExprComplex(xv r.Value, op token.Token, yv r.Value) r.Value { + x := xv.Complex() + y, ok := env.toComplex(yv) + if ok { + var ret complex128 + switch op { + case token.ADD, token.ADD_ASSIGN: + ret = x + y + case token.SUB, token.SUB_ASSIGN: + ret = x - y + case token.MUL, token.MUL_ASSIGN: + ret = x * y + case token.QUO, token.QUO_ASSIGN: + ret = x / y + default: + goto PART2 + } + if xv.Kind() == r.Complex64 { + return r.ValueOf(complex64(ret)) + } + return r.ValueOf(ret) + PART2: + var b bool + switch op { + case token.EQL: + b = x == y + case token.NEQ: + b = x != y + default: + return env.unsupportedBinaryExpr(xv, op, yv) + } + return r.ValueOf(b) + } + return env.unsupportedBinaryExpr(xv, op, yv) +} + +func (env *Env) evalBinaryExprString(xv r.Value, op token.Token, yv r.Value) r.Value { + if xv.Kind() != r.String || yv.Kind() != r.String { + return env.unsupportedBinaryExpr(xv, op, yv) + } + x, y := xv.String(), yv.String() + if op == token.ADD || op == token.ADD_ASSIGN { + return r.ValueOf(x + y) + } + var b bool + switch op { + case token.EQL: + b = x == y + case token.LSS: + b = x < y + case token.GTR: + b = x > y + case token.NEQ: + b = x != y + case token.LEQ: + b = x <= y + case token.GEQ: + b = x >= y + default: + return env.unsupportedBinaryExpr(xv, op, yv) + } + if b { + return True + } else { + return False + } +} + +func (env *Env) evalBinaryExprMisc(xv r.Value, op token.Token, yv r.Value) bool { + eql := true + switch op { + case token.EQL: + case token.NEQ: + eql = false + default: + env.unsupportedBinaryExpr(xv, op, yv) + return false + } + if xv == yv { + return eql + } + xnil := xv == Nil || IsNillableKind(xv.Kind()) && xv.IsNil() + ynil := yv == Nil || IsNillableKind(yv.Kind()) && yv.IsNil() + if xnil || ynil { + return eql == (xnil == ynil) + } + return eql == (xv.Interface() == yv.Interface()) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/builtin.go b/vendor/github.com/cosmos72/gomacro/classic/builtin.go new file mode 100644 index 0000000..17e774e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/builtin.go @@ -0,0 +1,462 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * builtin.go + * + * Created on: Feb 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + "io/ioutil" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" +) + +func funcAppend(env *Env, args []r.Value) (r.Value, []r.Value) { + n := len(args) + if n < 1 { + return env.Errorf("builtin append() expects at least one argument, found %d", n) + } + t := args[0].Type().Elem() + for i := 1; i < n; i++ { + args[i] = args[i].Convert(t) + } + return r.Append(args[0], args[1:]...), nil +} + +func callCap(arg interface{}) int { + obj := r.ValueOf(arg) + if obj.Kind() == r.Ptr { + // cap() of pointer-to-array returns cap() of array + obj = obj.Elem() + } + return obj.Cap() +} + +func callClose(channel interface{}) { + r.ValueOf(channel).Close() +} + +func funcComplex(env *Env, args []r.Value) (r.Value, []r.Value) { + rv, iv := args[0], args[1] + r_, rok := env.toFloat(rv) + i_, iok := env.toFloat(iv) + if !rok { + return env.Errorf("builtin complex(): not a float: %v <%v>", rv, typeOf(rv)) + } + if !iok { + return env.Errorf("builtin complex(): not a float: %v <%v>", iv, typeOf(iv)) + } + cplx := complex(r_, i_) + var ret interface{} + if rv.Kind() == r.Float32 && iv.Kind() == r.Float32 { + ret = complex64(cplx) + } else { + ret = cplx + } + return r.ValueOf(ret), nil +} + +func callCopy(dst, src interface{}) int { + if src, ok := src.(string); ok { + if dst, ok := dst.([]byte); ok { + // reflect.Copy does not support this case... use the compiler support + return copy(dst, src) + } + } + return r.Copy(r.ValueOf(dst), r.ValueOf(src)) +} + +func callDelete(m interface{}, key interface{}) { + vmap := r.ValueOf(m) + tkey := vmap.Type().Key() + vkey := r.ValueOf(key) + if key != nil && vkey.Type() != tkey { + vkey = vkey.Convert(tkey) + } + vmap.SetMapIndex(vkey, Nil) +} + +func funcEnv(env *Env, args []r.Value) (r.Value, []r.Value) { + return r.ValueOf(env), nil +} + +func funcEval(env *Env, args []r.Value) (r.Value, []r.Value) { + arg := args[0] + if arg == Nil || arg == None { + return arg, nil + } + x := toInterface(arg) + form := AnyToAst(x, "Eval") + return env.EvalAst(form) +} + +func funcEvalType(env *Env, args []r.Value) (r.Value, []r.Value) { + arg := args[0] + if arg == Nil || arg == None { + return arg, nil + } + x := toInterface(arg) + form := UnwrapTrivialAst(AnyToAst(x, "EvalType")) + + switch node := ToNode(form).(type) { + case ast.Expr: + // return nil for *ast.Ident{Name: "nil"} + t := env.evalTypeOrNil(node) + if t == nil { + return Nil, nil + } + // return as reflect.Type, not as the concrete struct *reflect.type + return r.ValueOf(&t).Elem(), nil + default: + return env.Errorf("EvalType: expecting , found: %v <%v>", node, r.TypeOf(node)) + } +} + +func funcImag(env *Env, args []r.Value) (r.Value, []r.Value) { + cv := args[0] + c_, ok := env.toComplex(cv) + if !ok { + return env.Errorf("builtin imag(): not a complex: %v <%v>", cv, typeOf(cv)) + } + i_ := imag(c_) + var ret interface{} + if cv.Kind() == r.Complex64 { + ret = float32(i_) + } else { + ret = i_ + } + return r.ValueOf(ret), nil +} + +func callLen(arg interface{}) int { + obj := r.ValueOf(arg) + if obj.Kind() == r.Ptr { + // len() of pointer-to-array returns len() of array + obj = obj.Elem() + } + return obj.Len() +} + +// +// --------- macroexpansion ---------- +// + +func funcMacroExpand(env *Env, args []r.Value) (r.Value, []r.Value) { + return callMacroExpand(env, args, CMacroExpand) +} + +func funcMacroExpand1(env *Env, args []r.Value) (r.Value, []r.Value) { + return callMacroExpand(env, args, CMacroExpand1) +} + +func funcMacroExpandCodewalk(env *Env, args []r.Value) (r.Value, []r.Value) { + return callMacroExpand(env, args, CMacroExpandCodewalk) +} + +func callMacroExpand(env *Env, args []r.Value, which WhichMacroExpand) (r.Value, []r.Value) { + n := len(args) + if n < 1 || n > 2 { + return env.Errorf("builtin %v() expects one or two arguments, found %d: %v", which, n, args) + } + val := args[0] + if val == Nil || val == None { + return val, nil + } + form := AnyToAst(val.Interface(), which.String()) + if n == 2 { + e := args[1] + if e != Nil && e != None { + env = e.Interface().(*Env) + } + } + var expanded bool + switch which { + case CMacroExpand1: + form, expanded = env.macroExpandAstOnce(form) + case CMacroExpandCodewalk: + form, expanded = env.MacroExpandAstCodewalk(form) + default: + form, expanded = env.macroExpandAst(form) + } + formv := r.ValueOf(form.Interface()) + return formv, []r.Value{formv, r.ValueOf(expanded)} +} + +func funcMake(env *Env, t r.Type, args []r.Value) (r.Value, []r.Value) { + n := len(args) + if n > 2 { + return env.Errorf("builtin make() expects one, two or three arguments, found %d", n+1) + } + ret := Nil + switch t.Kind() { + case r.Chan: + buffer := 0 + if n > 0 { + buffer = int(args[0].Int()) + } + ret = r.MakeChan(t, buffer) + case r.Map: + ret = r.MakeMap(t) + case r.Slice: + length := 0 + if n > 0 { + length = int(args[0].Int()) + } + capacity := length + if n > 1 { + capacity = int(args[1].Int()) + } + ret = r.MakeSlice(t, length, capacity) + } + return ret, nil +} + +func funcNew(env *Env, t r.Type, args []r.Value) (r.Value, []r.Value) { + return r.New(t), nil +} + +func funcParse(env *Env, args []r.Value) (r.Value, []r.Value) { + var in interface{} + if arg := args[0]; arg != Nil && arg != None { + in = arg.Interface() + } + out := env.Parse(in) + if out != nil { + return r.ValueOf(out.Interface()), nil + } + return Nil, nil +} + +func callPanic(arg interface{}) { + panic(arg) +} + +func funcReal(env *Env, args []r.Value) (r.Value, []r.Value) { + n := len(args) + if n != 1 { + return env.Errorf("builtin real() expects exactly one argument, found %d", n) + } + cv := args[0] + c_, ok := env.toComplex(cv) + if !ok { + return env.Errorf("builtin real(): not a complex: %v <%v>", cv, typeOf(cv)) + } + i_ := real(c_) + var ret interface{} + if cv.Kind() == r.Complex64 { + ret = float32(i_) + } else { + ret = i_ + } + return r.ValueOf(ret), nil +} + +func callReadFile(filename string) string { + bytes, err := ioutil.ReadFile(filename) + if err != nil { + callPanic(err) + } + return string(bytes) +} + +func callReadDir(dirname string) []string { + files, err := ioutil.ReadDir(dirname) + if err != nil { + callPanic(err) + } + n := len(files) + names := make([]string, n) + for i := 0; i < n; i++ { + names[i] = files[i].Name() + } + return names +} + +func funcRecover(env *Env, args []r.Value) (r.Value, []r.Value) { + // Go specs: "Executing a call to recover inside a deferred function + // (but not any function called by it) stops the panicking sequence + // by restoring normal execution and retrieves the error value passed to the call of panic" + // + // thus recover() is invoked inside deferred functions: find their caller's env + ret := Nil + + trace := env.Options&OptDebugPanicRecover != 0 + caller := env.CallerFrame() + if trace { + env.Debugf("recover(): env = %v, stack is:", env.Name) + env.showStack() + curr := env.CurrentFrame() + if curr != nil { + env.Debugf(" frame = %v, runningDefers = %v", curr.FuncEnv.Name, curr.runningDefers) + } else { + env.Debugf(" frame = nil") + } + if caller != nil { + env.Debugf(" caller = %v, runningDefers = %v", caller.FuncEnv.Name, caller.runningDefers) + } else { + env.Debugf(" caller = nil") + } + } + + if caller != nil { + if caller.runningDefers && caller.panicking { + // consume current panic + if trace { + env.Debugf(" consuming current panic = %#v", caller.panick) + } + ret = r.ValueOf(caller.panick) + caller.panick = nil + caller.panicking = false + } else if trace { + env.Debugf(" no panic to consume: caller.runningDefers = %q, caller.panicking = %q", + caller.runningDefers, caller.panicking) + } + } + return ret, nil +} + +func callSlice(args ...interface{}) []interface{} { + return args +} + +func funcValues(env *Env, args []r.Value) (r.Value, []r.Value) { + for i, arg := range args { + // go through interface{} to forget any "static" compile-time type information + if arg != None && arg != Nil { + args[i] = r.ValueOf(arg.Interface()) + } + } + return UnpackValues(args) +} + +func (top *Env) addIota() { + top.Binds.Set("iota", r.ValueOf(0)) +} + +func (top *Env) removeIota() { + top.Binds.Del("iota") +} + +func (top *Env) incrementIota() { + uIota := int(top.Binds.Get1("iota").Int()) + top.Binds.Set("iota", r.ValueOf(uIota+1)) +} + +func (env *Env) addBuiltins() { + binds := env.Binds.Ensure() + + binds.Set("Env", r.ValueOf(Function{funcEnv, 0})) + binds.Set("Eval", r.ValueOf(Function{funcEval, 1})) + binds.Set("EvalType", r.ValueOf(Function{funcEvalType, 1})) + binds.Set("MacroExpand", r.ValueOf(Function{funcMacroExpand, -1})) + binds.Set("MacroExpand1", r.ValueOf(Function{funcMacroExpand1, -1})) + binds.Set("MacroExpandCodewalk", r.ValueOf(Function{funcMacroExpandCodewalk, -1})) + binds.Set("Parse", r.ValueOf(Function{funcParse, 1})) + binds.Set("Read", r.ValueOf(ReadString)) + binds.Set("ReadDir", r.ValueOf(callReadDir)) + binds.Set("ReadFile", r.ValueOf(callReadFile)) + binds.Set("ReadMultiline", r.ValueOf(ReadMultiline)) + binds.Set("Slice", r.ValueOf(callSlice)) + binds.Set("String", r.ValueOf(func(args ...interface{}) string { + return env.ToString("", args...) + })) + // return multiple values, extracting the concrete type of each interface + binds.Set("Values", r.ValueOf(Function{funcValues, -1})) + + binds.Set("append", r.ValueOf(Function{funcAppend, -1})) + binds.Set("cap", r.ValueOf(callCap)) + binds.Set("close", r.ValueOf(callClose)) + binds.Set("complex", r.ValueOf(Function{funcComplex, 2})) + binds.Set("copy", r.ValueOf(callCopy)) + binds.Set("delete", r.ValueOf(callDelete)) + binds.Set("false", r.ValueOf(false)) + binds.Set("imag", r.ValueOf(Function{funcImag, 1})) + binds.Set("len", r.ValueOf(callLen)) + binds.Set("make", r.ValueOf(Constructor{funcMake, -1})) + binds.Set("new", r.ValueOf(Constructor{funcNew, 1})) + binds.Set("nil", Nil) + binds.Set("panic", r.ValueOf(callPanic)) + binds.Set("print", r.ValueOf(func(args ...interface{}) { + fmt.Fprint(env.Stdout, args...) + })) + binds.Set("println", r.ValueOf(func(args ...interface{}) { + fmt.Fprintln(env.Stdout, args...) + })) + binds.Set("real", r.ValueOf(Function{funcReal, 1})) + binds.Set("recover", r.ValueOf(Function{funcRecover, 0})) + binds.Set("true", r.ValueOf(true)) + + // --------- types --------- + types := env.Types.Ensure() + + types.Set("bool", r.TypeOf(false)) + types.Set("byte", r.TypeOf(byte(0))) + types.Set("complex64", r.TypeOf(complex64(0))) + types.Set("complex128", r.TypeOf(complex128(0))) + types.Set("error", r.TypeOf((*error)(nil)).Elem()) + types.Set("float32", r.TypeOf(float32(0))) + types.Set("float64", r.TypeOf(float64(0))) + types.Set("int", r.TypeOf(int(0))) + types.Set("int8", r.TypeOf(int8(0))) + types.Set("int16", r.TypeOf(int16(0))) + types.Set("int32", r.TypeOf(int32(0))) + types.Set("int64", r.TypeOf(int64(0))) + types.Set("rune", r.TypeOf(rune(0))) + types.Set("string", r.TypeOf("")) + types.Set("uint", r.TypeOf(uint(0))) + types.Set("uint8", r.TypeOf(uint8(0))) + types.Set("uint16", r.TypeOf(uint16(0))) + types.Set("uint32", r.TypeOf(uint32(0))) + types.Set("uint64", r.TypeOf(uint64(0))) + types.Set("uintptr", r.TypeOf(uintptr(0))) + + // --------- proxies --------- + proxies := env.Proxies.Ensure() + + proxies.Set("error", r.TypeOf((*Error_builtin)(nil)).Elem()) +} + +type Error_builtin struct { + Obj interface{} + Error_ func() string +} + +func (Proxy *Error_builtin) Error() string { + return Proxy.Error_() +} + +func (env *Env) addInterpretedBuiltins() { + if false { + line := "func not(flag bool) bool { if flag { return false } else { return true } }" + env.EvalAst(env.Parse(line)) + } + if false { + // Factorial(1000000): eval() elapsed time: 1.233714899 s + line := "func Factorial(n int) int { t := 1; for i := 2; i <= n; i=i+1 { t = t * i }; t }" + env.EvalAst(env.Parse(line)) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/call.go b/vendor/github.com/cosmos72/gomacro/classic/call.go new file mode 100644 index 0000000..493a9e2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/call.go @@ -0,0 +1,279 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call.go + * + * Created on: Mar 30, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +// eval an interpreted function +func (env *Env) evalFuncCall(envName string, body *ast.BlockStmt, t r.Type, argNames []string, args []r.Value, resultNames []string) (results []r.Value) { + if t.Kind() != r.Func { + env.Errorf("call of non-function type %v", t) + return nil + } + env = NewEnv(env, envName) + // register this function call in the call stack + env.CallStack.Frames = append(env.CallStack.Frames, CallFrame{FuncEnv: env}) + debugCall := env.Options&OptDebugCallStack != 0 + if debugCall { + env.Debugf("func starting: %s, args = %v, call stack is:", envName, args) + env.showStack() + } + + panicking := true // use a flag to distinguish non-panic from panic(nil) + defer func() { + if debugCall { + env.Debugf("func exiting: %s, panicking = %v, stack length = %d", + envName, panicking, len(env.CallStack.Frames)) + } + frame := env.CurrentFrame() + if panicking { + pan := recover() + switch p := pan.(type) { + case eReturn: + // return is implemented with a panic(eReturn{}) + results = env.convertFuncCallResults(t, p.results, true) + default: // some interpreted or compiled code invoked panic() + if env.Options&OptDebugPanicRecover != 0 { + env.Debugf("captured panic for defers: env = %v, panic = %#v", env.Name, p) + } + frame.panick = p + frame.panicking = true + } + } + if len(frame.defers) != 0 { + frame.runDefers(env) + } + stack := env.CallStack + stack.Frames = stack.Frames[0 : len(stack.Frames)-1] + + if debugCall { + str := "is" + if frame.panicking { + str = "=" + } + env.Debugf("func exited: %s, panic %s %v, stack length = %d", + envName, str, frame.panick, len(stack.Frames)) + } + + if frame.panicking { + panic(frame.panick) + } + }() + + for i, resultName := range resultNames { + env.DefineVar(resultName, t.Out(i), r.Zero(t.Out(i))) + } + for i, argName := range argNames { + env.DefineVar(argName, t.In(i), args[i]) + } + // use evalStatements(), not evalBlock(): in Go, the function arguments and body are in the same scope + rets := PackValues(env.evalStatements(body.List)) + results = env.convertFuncCallResults(t, rets, false) + panicking = false + return results +} + +func (env *Env) convertFuncCallResults(t r.Type, rets []r.Value, warn bool) []r.Value { + retsN := len(rets) + expectedN := t.NumOut() + if retsN < expectedN { + if warn { + env.Warnf("not enough return values: expecting %d, found %d: %v", expectedN, retsN, rets) + } + tmp := make([]r.Value, expectedN) + copy(tmp, rets) + rets = tmp + } else if retsN > expectedN { + if warn { + env.Warnf("too many return values: expecting %d, found %d: %v", expectedN, retsN, rets) + } + rets = rets[:expectedN] + } + for i, ret := range rets { + ti := t.Out(i) + if ret == Nil || ret == None { + rets[i] = r.Zero(ti) + } else { + rets[i] = ret.Convert(ti) + } + } + return rets +} + +func (frame *CallFrame) runDefers(env *Env) { + // execute defers last-to-first + frame.runningDefers = true + if env.Options&OptDebugCallStack != 0 { + str := "is" + if frame.panicking { + str = "=" + } + env.Debugf("func defers: %s, panic %s %v, stack length = %d", + env.Name, str, frame.panick, len(env.CallStack.Frames)) + } + defers := frame.defers + for i := len(defers) - 1; i >= 0; i-- { + frame.runDefer(defers[i]) + } +} + +func (frame *CallFrame) runDefer(deferred func()) { + // invoking panic() inside a deferred function exits it with a panic, + // but the previously-installed deferred functions are still executed + // and can recover() such panic + + panicking := true // use a flag to distinguish non-panic from panic(nil) + defer func() { + if panicking { + frame.panick = recover() + frame.panicking = true + } + }() + deferred() + panicking = false +} + +func (env *Env) evalCall(node *ast.CallExpr) (r.Value, []r.Value) { + var fun r.Value + var t r.Type + if len(node.Args) == 1 { + // may be a type conversion + fun, t = env.evalExpr1OrType(node.Fun) + } else { + fun = env.evalExpr1(node.Fun) + } + + if t != nil { + val := env.evalExpr1(node.Args[0]) + return env.valueToType(val, t), nil + } + + { + frames := env.CallStack.Frames + frame := &frames[len(frames)-1] + frame.CurrentCall = node + frame.InnerEnv = env // leaks a bit... should be cleared after the call + } + + switch fun.Kind() { + case r.Struct: + switch fun := fun.Interface().(type) { + case Constructor: + t, args := env.evalConstructorArgs(fun, node) + return fun.exec(env, t, args) + case Function: + args := env.evalFunctionArgs(fun, node) + return fun.exec(env, args) + } + case r.Func: + args := env.evalFuncArgs(fun, node) + var rets []r.Value + + if node.Ellipsis == token.NoPos { + rets = fun.Call(args) + } else { + rets = fun.CallSlice(args) + } + return UnpackValues(rets) + default: + break + } + return env.Errorf("call of non-function %v <%v>: %v", ValueInterface(fun), ValueType(fun), node) +} + +func (env *Env) evalConstructorArgs(fun Constructor, node *ast.CallExpr) (r.Type, []r.Value) { + args := node.Args + if fun.argNum >= 0 && fun.argNum != len(args) { + env.Errorf("builtin %v expects %d arguments, found %d", + node.Fun, fun.argNum, len(args)) + } else if len(args) == 0 { + env.Errorf("builtin %v expects at least one argument, found zero", node.Fun) + } + t := env.evalType(args[0]) + return t, env.evalExprs(args[1:]) +} + +func (env *Env) evalFunctionArgs(fun Function, node *ast.CallExpr) []r.Value { + args := node.Args + if fun.argNum >= 0 && fun.argNum != len(args) { + env.Errorf("function %v expects %d arguments, found %d", + node.Fun, fun.argNum, len(args)) + } + return env.evalExprs(args) +} + +func (env *Env) evalFuncArgs(fun r.Value, node *ast.CallExpr) []r.Value { + funt := fun.Type() + nin := funt.NumIn() + var args []r.Value + if len(node.Args) == 1 && nin > 1 { + // special case fooAcceptsMultipleArgs( barReturnsMultipleValues() ) + args = env.evalExprsMultipleValues(node.Args, nin) + } else { + args = env.evalExprs(node.Args) + } + if funt.IsVariadic() == (node.Ellipsis != token.NoPos) { + if len(args) != nin { + env.Errorf("function %v expects %d arguments, found %d: %v", node.Fun, nin, len(args), args) + return nil + } + for i, arg := range args { + args[i] = env.valueToType(arg, funt.In(i)) + } + } + return args +} + +func (env *Env) evalDefer(node *ast.CallExpr) (r.Value, []r.Value) { + frame := env.CurrentFrame() + if frame == nil { + return env.Errorf("defer outside function: %v", node) + } + fun := env.evalExpr1(node.Fun) + if fun.Kind() != r.Func { + return env.Errorf("defer of non-function: %v", node) + } + args := env.evalFuncArgs(fun, node) + closure := func() { + var rets []r.Value + if node.Ellipsis == token.NoPos { + rets = fun.Call(args) + } else { + rets = fun.CallSlice(args) + } + if len(rets) != 0 { + env.Warnf("call to deferred function %v returned %d values, expecting zero: %v", node, rets) + } + } + frame.defers = append(frame.defers, closure) + return None, nil +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/declaration.go b/vendor/github.com/cosmos72/gomacro/classic/declaration.go new file mode 100644 index 0000000..04f1b0e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/declaration.go @@ -0,0 +1,209 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * declaration.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalDecl(node ast.Decl) (r.Value, []r.Value) { + switch node := node.(type) { + case *ast.GenDecl: + return env.evalDeclGen(node) + case *ast.FuncDecl: + return env.evalDeclFunction(node, node.Type, node.Body) + default: + return env.Errorf("unimplemented declaration: %v", node) + } +} + +func (env *Env) evalDeclGen(node *ast.GenDecl) (r.Value, []r.Value) { + tok := node.Tok + var ret r.Value + var rets []r.Value + switch tok { + case token.IMPORT: + for _, decl := range node.Specs { + ret, rets = env.evalImport(decl) + } + case token.CONST: + var defaultType ast.Expr + var defaultExprs []ast.Expr + top := env.TopEnv() + top.addIota() + defer top.removeIota() + for _, decl := range node.Specs { + ret, rets = env.evalDeclConsts(decl, defaultType, defaultExprs) + if valueSpec, ok := decl.(*ast.ValueSpec); ok && valueSpec.Values != nil { + defaultType = valueSpec.Type + defaultExprs = valueSpec.Values + } + top.incrementIota() + } + case token.TYPE: + for _, decl := range node.Specs { + return env.evalDeclType(decl) + } + case token.VAR: + for _, decl := range node.Specs { + ret, rets = env.evalDeclVars(decl) + } + default: + return env.Errorf("unimplemented declaration: %v", node) + } + return ret, rets +} + +func (env *Env) evalDeclConsts(node ast.Spec, defaultType ast.Expr, defaultExprs []ast.Expr) (r.Value, []r.Value) { + switch node := node.(type) { + case *ast.ValueSpec: + if node.Type != nil || node.Values != nil { + defaultType = node.Type + defaultExprs = node.Values + } + return env.evalDeclConstsOrVars(node.Names, defaultType, defaultExprs, true) + default: + return env.Errorf("unexpected constant declaration: expecting *ast.ValueSpec, found: %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) evalDeclType(node ast.Spec) (r.Value, []r.Value) { + switch node := node.(type) { + case *ast.TypeSpec: + name := node.Name.Name + // PATCH: support type aliases + if unary, ok := node.Type.(*ast.UnaryExpr); ok && unary.Op == token.ASSIGN { + t := env.evalTypeAlias(name, unary.X) + return r.ValueOf(&t).Elem(), nil // return a reflect.Type, not the concrete type + } + + t := env.evalType(node.Type) + if name != "_" { + // never define bindings for "_" + if _, ok := env.Types.Get(name); ok { + env.Warnf("redefined type: %v", name) + } else { + env.Types.Ensure() + } + env.Types.Set(name, t) + if _, ok := env.NamedTypes[t]; !ok { + env.NamedTypes[t] = fmt.Sprintf("%s.%s", env.PackagePath, name) + } + } + return r.ValueOf(&t).Elem(), nil // return a reflect.Type, not the concrete type + + default: + return env.Errorf("unexpected type declaration: expecting *ast.TypeSpec, found: %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) evalDeclVars(node ast.Spec) (r.Value, []r.Value) { + switch node := node.(type) { + case *ast.ValueSpec: + return env.evalDeclConstsOrVars(node.Names, node.Type, node.Values, false) + default: + return env.Errorf("unexpected variable declaration: expecting *ast.ValueSpec, found: %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) evalDeclConstsOrVars(idents []*ast.Ident, typ ast.Expr, exprs []ast.Expr, constant bool) (r.Value, []r.Value) { + n := len(idents) + names := make([]string, n) + for i, ident := range idents { + names[i] = ident.Name + } + t := env.evalType(typ) + + var values []r.Value + if exprs != nil { + values = env.evalExprsMultipleValues(exprs, n) + } + return env.defineConstsVarsOrFuncs(names, t, values, constant) +} + +func (env *Env) defineConstsVarsOrFuncs(names []string, t r.Type, values []r.Value, constant bool) (r.Value, []r.Value) { + n := len(names) + if values == nil { + if t == nil { + return env.Errorf("no values and no type: cannot define %v", names) + } + values = make([]r.Value, n) + zero := r.Zero(t) + for i := 0; i < n; i++ { + values[i] = env.defineConstVarOrFunc(names[i], t, zero, constant) + } + } else { + for i := 0; i < n; i++ { + values[i] = env.defineConstVarOrFunc(names[i], t, values[i], constant) + } + } + return UnpackValues(values) +} + +func (env *Env) DefineConst(name string, t r.Type, value r.Value) r.Value { + return env.defineConstVarOrFunc(name, t, value, true) +} + +func (env *Env) DefineVar(name string, t r.Type, value r.Value) r.Value { + return env.defineConstVarOrFunc(name, t, value, false) +} + +func (env *Env) DefineFunc(name string, t r.Type, value r.Value) r.Value { + return env.defineConstVarOrFunc(name, t, value, true) +} + +func (env *Env) defineConstVarOrFunc(name string, t r.Type, value r.Value, constant bool) r.Value { + if name == "_" { + // never define bindings for "_" + if t != nil { + value = env.valueToType(value, t) + } + return value + } + if t == nil { + t = typeOf(value) + } + if _, found := env.Binds.Get(name); found { + env.Warnf("redefined identifier: %v", name) + } else { + env.Binds.Ensure() + } + if constant { + value = value.Convert(t) + env.Binds.Set(name, value) + } else { + addr := r.New(t) + value = env.assignPlace(placeType{addr.Elem(), Nil}, token.ASSIGN, value) + env.Binds.Set(name, addr.Elem()) + } + // Debugf("defineConstVarOrFunc() added %#v to %#v", name, env.Binds) + return value +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/env.go b/vendor/github.com/cosmos72/gomacro/classic/env.go new file mode 100644 index 0000000..ada8e01 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/env.go @@ -0,0 +1,195 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * env.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "bufio" + "fmt" + "io" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/imports" +) + +type ThreadGlobals struct { + Globals + AllMethods map[r.Type]Methods // methods implemented by interpreted code + FastInterp interface{} // *fast.Interp // temporary... +} + +func NewThreadGlobals() *ThreadGlobals { + tg := &ThreadGlobals{ + AllMethods: make(map[r.Type]Methods), + } + tg.Globals.Init() + return tg +} + +type Env struct { + *ThreadGlobals + Binds BindMap + Types TypeMap + Proxies TypeMap + Outer *Env + CallStack *CallStack + iotaOffset int + Name, Path string +} + +func NewEnv(outer *Env, path string) *Env { + env := &Env{ + iotaOffset: 1, + Outer: outer, + Name: path, + Path: path, + } + if outer == nil { + env.ThreadGlobals = NewThreadGlobals() + env.CallStack = &CallStack{Frames: []CallFrame{CallFrame{}}} + env.addBuiltins() + env.addInterpretedBuiltins() + } else { + env.ThreadGlobals = outer.ThreadGlobals + env.CallStack = outer.CallStack + } + return env +} + +func (env *Env) TopEnv() *Env { + for ; env != nil; env = env.Outer { + if env.Outer == nil { + break + } + } + return env +} + +func (env *Env) FileEnv() *Env { + for ; env != nil; env = env.Outer { + outer := env.Outer + if outer == nil || outer.Outer == nil { + break + } + } + return env +} + +func (env *Env) AsPackage() imports.Package { + return imports.Package{ + Binds: env.Binds.AsMap(), + Types: env.Types.AsMap(), + Proxies: env.Proxies.AsMap(), + } +} + +func (env *Env) MergePackage(pkg imports.Package) { + env.Binds.Ensure().Merge(pkg.Binds) + env.Types.Ensure().Merge(pkg.Types) + env.Proxies.Ensure().Merge(pkg.Proxies) +} + +func (env *Env) ChangePackage(path string) *Env { + fenv := env.FileEnv() + currpath := fenv.ThreadGlobals.PackagePath + if path == currpath { + return env + } + fenv.AsPackage().SaveToPackages(currpath) + + nenv := NewEnv(fenv.TopEnv(), path) + nenv.MergePackage(imports.Packages[path]) + nenv.ThreadGlobals.PackagePath = path + + return nenv +} + +// CurrentFrame returns the CallFrame representing the current function call +func (env *Env) CurrentFrame() *CallFrame { + if env != nil { + frames := env.CallStack.Frames + if n := len(frames); n > 0 { + return &frames[n-1] + } + } + return nil +} + +// CallerFrame returns the CallFrame representing the caller's function. +// needed by recover() +func (env *Env) CallerFrame() *CallFrame { + if env != nil { + frames := env.CallStack.Frames + if n := len(frames); n > 1 { + return &frames[n-2] + } + } + return nil +} + +// ValueOf returns the value of a constant, function or variable. +// for variables, the returned reflect.Value is settable and addressable +// returns the zero reflect.Value if not found +func (env *Env) ValueOf(name string) (value r.Value) { + found := false + for e := env; e != nil; e = e.Outer { + if value, found = e.Binds.Get(name); found { + break + } + } + return +} + +func (env *Env) ReadMultiline(in *bufio.Reader, opts ReadOptions) (str string, firstToken int) { + str, firstToken, err := ReadMultiline(in, opts, env.Stdout, "gomacro> ") + if err != nil && err != io.EOF { + fmt.Fprintf(env.Stderr, "// read error: %s\n", err) + } + return str, firstToken +} + +// macroexpand + collect + eval +func (env *Env) classicEval(form Ast) (r.Value, []r.Value) { + // macroexpansion phase. + form, _ = env.MacroExpandAstCodewalk(form) + + if env.Options&OptShowMacroExpand != 0 { + env.Debugf("after macroexpansion: %v", form.Interface()) + } + + // collect phase + if env.Options&(OptCollectDeclarations|OptCollectStatements) != 0 { + env.CollectAst(form) + } + + // eval phase + if env.Options&OptMacroExpandOnly != 0 { + return r.ValueOf(form.Interface()), nil + } else { + return env.EvalAst(form) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/env_multithread.go b/vendor/github.com/cosmos72/gomacro/classic/env_multithread.go new file mode 100644 index 0000000..a47d2db --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/env_multithread.go @@ -0,0 +1,134 @@ +// +build !gomacro_classic_singlethread + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * env.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + r "reflect" + + "golang.org/x/sync/syncmap" +) + +const MultiThread = true + +type BindMap syncmap.Map + +// ALWAYS use pointers to syncmap.Map, because https://godoc.org/golang.org/x/sync/syncmap#Map +// states "A Map must not be copied after first use." +func (m *BindMap) Ensure() *BindMap { + return m +} + +func (m *BindMap) Clear() { + *m = BindMap{} +} + +func (m *BindMap) Merge(binds map[string]r.Value) { + for k, v := range binds { + (*syncmap.Map)(m).Store(k, v) + } +} + +func (m *BindMap) AsMap() map[string]r.Value { + ret := make(map[string]r.Value) + (*syncmap.Map)(m).Range(func(k, v interface{}) bool { + ret[k.(string)] = v.(r.Value) + return true + }) + return ret +} + +func (m *BindMap) Get(key string) (r.Value, bool) { + val, ok := (*syncmap.Map)(m).Load(key) + if !ok { + return r.Value{}, false + } + return val.(r.Value), ok +} + +func (m *BindMap) Get1(key string) r.Value { + val, _ := (*syncmap.Map)(m).Load(key) + return val.(r.Value) +} + +func (m *BindMap) Set(key string, val r.Value) { + (*syncmap.Map)(m).Store(key, val) +} + +func (m *BindMap) Del(key string) { + (*syncmap.Map)(m).Delete(key) +} + +// ----------------------------------------- + +type TypeMap syncmap.Map + +// ALWAYS use pointers to TypeMap, because https://godoc.org/golang.org/x/sync/syncmap#Map +// states "A Map must not be copied after first use." +func (m *TypeMap) Ensure() *TypeMap { + return m +} + +func (m *TypeMap) Clear() { + *m = TypeMap{} +} + +func (m *TypeMap) Merge(binds map[string]r.Type) { + for k, v := range binds { + (*syncmap.Map)(m).Store(k, v) + } +} + +func (m *TypeMap) AsMap() map[string]r.Type { + ret := make(map[string]r.Type) + (*syncmap.Map)(m).Range(func(k, v interface{}) bool { + ret[k.(string)] = v.(r.Type) + return true + }) + return ret +} + +func (m *TypeMap) Get(key string) (r.Type, bool) { + val, ok := (*syncmap.Map)(m).Load(key) + if !ok { + return nil, false + } + return val.(r.Type), ok +} + +func (m *TypeMap) Get1(key string) r.Type { + val, _ := (*syncmap.Map)(m).Load(key) + return val.(r.Type) +} + +func (m *TypeMap) Set(key string, val r.Type) { + (*syncmap.Map)(m).Store(key, val) +} + +func (m *TypeMap) Del(key string) { + (*syncmap.Map)(m).Delete(key) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/env_singlethread.go b/vendor/github.com/cosmos72/gomacro/classic/env_singlethread.go new file mode 100644 index 0000000..ec82b5a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/env_singlethread.go @@ -0,0 +1,114 @@ +// +build gomacro_classic_singlethread + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * env.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + r "reflect" +) + +const MultiThread = false + +type BindMap map[string]r.Value + +func (m *BindMap) Ensure() BindMap { + if *m == nil { + *m = make(map[string]r.Value) + } + return *m +} + +func (m *BindMap) Clear() { + *m = make(map[string]r.Value) +} + +func (m BindMap) Merge(binds map[string]r.Value) { + // make a copy. we do NOT want to modify binds! + for k, v := range binds { + m[k] = v + } +} + +func (m BindMap) AsMap() map[string]r.Value { + return m +} + +func (m BindMap) Get(key string) (r.Value, bool) { + val, ok := m[key] + return val, ok +} + +func (m BindMap) Get1(key string) r.Value { + return m[key] +} + +func (m BindMap) Set(key string, val r.Value) { + m[key] = val +} + +func (m BindMap) Del(key string) { + delete(m, key) +} + +// ----------------------------------------- + +type TypeMap map[string]r.Type + +func (m *TypeMap) Ensure() TypeMap { + if *m == nil { + *m = make(map[string]r.Type) + } + return *m +} + +func (m *TypeMap) Clear() { + *m = make(map[string]r.Type) +} + +func (m TypeMap) Merge(types map[string]r.Type) { + // make a copy. we do NOT want to modify types! + for k, v := range types { + m[k] = v + } +} + +func (m TypeMap) AsMap() map[string]r.Type { + return m +} + +func (m TypeMap) Get(key string) (r.Type, bool) { + val, ok := m[key] + return val, ok +} + +func (m TypeMap) Set(key string, val r.Type) { + m[key] = val +} + +func (m TypeMap) Del(key string) { + delete(m, key) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/eval.go b/vendor/github.com/cosmos72/gomacro/classic/eval.go new file mode 100644 index 0000000..c1bdbf1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/eval.go @@ -0,0 +1,141 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * eval.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) Eval(src interface{}) (r.Value, []r.Value) { + return env.EvalAst(env.Parse(src)) +} + +func (env *Env) Eval1(src interface{}) r.Value { + return env.EvalAst1(env.Parse(src)) +} + +func (env *Env) EvalAst1(in Ast) r.Value { + value, extraValues := env.EvalAst(in) + if len(extraValues) > 1 { + env.WarnExtraValues(extraValues) + } + return value +} + +func (env *Env) EvalAst(in Ast) (r.Value, []r.Value) { + switch in := in.(type) { + case AstWithNode: + if in != nil { + return env.EvalNode(ToNode(in)) + } + case AstWithSlice: + if in != nil { + var ret r.Value + var rets []r.Value + n := in.Size() + for i := 0; i < n; i++ { + ret, rets = env.EvalNode(ToNode(in.Get(i))) + } + return ret, rets + } + case nil: + return None, nil + default: + return env.Errorf("EvalAst(): expecting or , found: %v <%v>", + in, r.TypeOf(in)) + } + return env.Errorf("EvalAst(): expecting or , found: nil") +} + +func (env *Env) EvalNode(node ast.Node) (r.Value, []r.Value) { + switch node := node.(type) { + case ast.Decl: + return env.evalDecl(node) + case ast.Expr: + return env.evalExpr(node) + case ast.Stmt: + return env.evalStatement(node) + case *ast.File: + return env.evalFile(node) + default: + return env.Errorf("unimplemented Eval for %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) EvalNode1(node ast.Node) r.Value { + value, extraValues := env.EvalNode(node) + if len(extraValues) > 1 { + env.WarnExtraValues(extraValues) + } + return value +} + +// parse, without macroexpansion +func (env *Env) ParseOnly(src interface{}) Ast { + var form Ast + switch src := src.(type) { + case Ast: + form = src + case ast.Node: + form = ToAst(src) + default: + bytes := ReadBytes(src) + nodes := env.ParseBytes(bytes) + + if env.Options&OptShowParse != 0 { + env.Debugf("after parse: %v", nodes) + } + switch len(nodes) { + case 0: + form = nil + case 1: + form = ToAst(nodes[0]) + default: + form = NodeSlice{X: nodes} + } + } + return form +} + +// Parse, with macroexpansion +func (env *Env) Parse(src interface{}) Ast { + form := env.ParseOnly(src) + + // macroexpansion phase. + form, _ = env.MacroExpandAstCodewalk(form) + + if env.Options&OptShowMacroExpand != 0 { + env.Debugf("after macroexpansion: %v", form.Interface()) + } + if env.Options&(OptCollectDeclarations|OptCollectStatements) != 0 { + env.CollectAst(form) + } + return form +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/expr.go b/vendor/github.com/cosmos72/gomacro/classic/expr.go new file mode 100644 index 0000000..abb6088 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/expr.go @@ -0,0 +1,345 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * expr.go + * + * Created on: Feb 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (env *Env) evalExprsMultipleValues(nodes []ast.Expr, expectedValuesN int) []r.Value { + n := len(nodes) + var values []r.Value + if n != expectedValuesN { + if n != 1 { + env.Errorf("value count mismatch: cannot assign %d values to %d places: %v", + n, expectedValuesN, nodes) + return nil + } + node := nodes[0] + // collect multiple values + values = PackValues(env.EvalNode(node)) + n = len(values) + if n < expectedValuesN { + env.Errorf("value count mismatch: expression returned %d values, cannot assign them to %d places: %v returned %v", + n, expectedValuesN, node, values) + return nil + } else if n > expectedValuesN { + env.Warnf("expression returned %d values, using only %d of them: %v returned %v", + n, expectedValuesN, node, values) + } + } else { + values = env.evalExprs(nodes) + } + return values +} + +func (env *Env) evalExprs(nodes []ast.Expr) []r.Value { + switch n := len(nodes); n { + case 0: + return nil + case 1: + ret := env.evalExpr1(nodes[0]) + return []r.Value{ret} + default: + rets := make([]r.Value, n) + for i := range nodes { + rets[i] = env.evalExpr1(nodes[i]) + } + return rets + } +} + +func (env *Env) evalExpr1(node ast.Expr) r.Value { + // treat failed type assertions specially: in compiled Go, they panic in single-value context + for { + switch expr := node.(type) { + case *ast.ParenExpr: + node = expr.X + continue + case *ast.TypeAssertExpr: + value, _ := env.evalTypeAssertExpr(expr, true) + return value + } + break + } + value, extraValues := env.evalExpr(node) + if len(extraValues) > 1 { + env.WarnExtraValues(extraValues) + } + return value +} + +func (env *Env) evalExpr(in ast.Expr) (r.Value, []r.Value) { + for { + if in != nil { + env.Pos = in.Pos() + } + // env.Debugf("evalExpr() %v", node) + switch node := in.(type) { + case *ast.BasicLit: + ret := env.evalLiteral0(node) + return r.ValueOf(ret), nil + + case *ast.BinaryExpr: + xv := env.evalExpr1(node.X) + switch op := node.Op; op { + case token.LAND, token.LOR: + if xv.Kind() != r.Bool { + return env.unsupportedLogicalOperand(op, xv) + } + // implement short-circuit logic + if (op == token.LOR) == xv.Bool() { + // env.Debugf("evalExpr() %v: %v = %v, skipping %v...", node, node.X, xv, node.Y) + return xv, nil + } + // env.Debugf("evalExpr() %v: %v = %v, evaluating %v...", node, node.X, xv, node.Y) + yv := env.evalExpr1(node.Y) + if yv.Kind() != r.Bool { + return env.unsupportedLogicalOperand(op, yv) + } + return yv, nil + default: + yv := env.evalExpr1(node.Y) + return env.evalBinaryExpr(xv, node.Op, yv), nil + } + + case *ast.CallExpr: + return env.evalCall(node) + + case *ast.CompositeLit: + return env.evalCompositeLiteral(node) + + case *ast.FuncLit: + return env.evalDeclFunction(nil, node.Type, node.Body) + + case *ast.Ident: + return env.evalIdentifier(node), nil + + case *ast.IndexExpr: + return env.evalIndexExpr(node) + + case *ast.ParenExpr: + in = node.X + continue + + case *ast.UnaryExpr: + return env.evalUnaryExpr(node) + + case *ast.SelectorExpr: + return env.evalSelectorExpr(node) + + case *ast.SliceExpr: + return env.evalSliceExpr(node) + + case *ast.StarExpr: + val := env.evalExpr1(node.X) + if val.Kind() != r.Ptr { + return env.Errorf("dereference of non-pointer: %v <%v>", val, typeOf(val)) + } + return val.Elem(), nil + + case *ast.TypeAssertExpr: + return env.evalTypeAssertExpr(node, false) + + // case *ast.KeyValueExpr: + } + return env.Errorf("unimplemented Eval() for: %v <%v>", in, r.TypeOf(in)) + } +} + +func (env *Env) unsupportedLogicalOperand(op token.Token, xv r.Value) (r.Value, []r.Value) { + return env.Errorf("unsupported type in logical operation %s: expecting bool, found %v <%v>", mt.String(op), xv, typeOf(xv)) +} + +func (env *Env) evalSliceExpr(node *ast.SliceExpr) (r.Value, []r.Value) { + obj := env.evalExpr1(node.X) + if obj.Kind() == r.Ptr { + obj = obj.Elem() + } + switch obj.Kind() { + case r.Array, r.Slice, r.String: + // ok + default: + return env.Errorf("slice operation %v expects array, slice or string. found: %v <%v>", node, obj, typeOf(obj)) + } + lo, hi := 0, obj.Len() + if node.Low != nil { + lo = int(env.valueToType(env.evalExpr1(node.Low), TypeOfInt).Int()) + } + if node.High != nil { + hi = int(env.valueToType(env.evalExpr1(node.High), TypeOfInt).Int()) + } + if node.Slice3 { + max := hi + if node.Max != nil { + max = int(env.valueToType(env.evalExpr1(node.Max), TypeOfInt).Int()) + } + return obj.Slice3(lo, hi, max), nil + } else { + return obj.Slice(lo, hi), nil + } +} + +func (env *Env) evalIndexExpr(node *ast.IndexExpr) (r.Value, []r.Value) { + // respect left-to-right order of evaluation + obj := env.evalExpr1(node.X) + index := env.evalExpr1(node.Index) + if obj.Kind() == r.Ptr { + obj = obj.Elem() + } + switch obj.Kind() { + + case r.Map: + index = env.valueToType(index, obj.Type().Key()) + + ret, present, _ := env.mapIndex(obj, index) + return ret, []r.Value{ret, r.ValueOf(present)} + + case r.Array, r.Slice, r.String: + i, ok := env.toInt(index) + if !ok { + return env.Errorf("invalid index, expecting an int: %v <%v>", index, typeOf(index)) + } + return obj.Index(int(i)), nil + + default: + return env.Errorf("unsupported index operation: %v [ %v ]. not an array, map, slice or string: %v <%v>", node.X, index, obj, typeOf(obj)) + } +} + +// mapIndex reproduces the exact behaviour of the map[key] builtin. given: +// var x = map[ktype]vtype +// x[key] does the following: +// 1. if key is present, return (the value associated to key, true, value.Type()) +// 2. otherwise, return (the zero value of vtype, false, vtype) +// note: converting key to ktype is caller's responsibility +func (env *Env) mapIndex(obj r.Value, key r.Value) (r.Value, bool, r.Type) { + value := obj.MapIndex(key) + present := value != Nil + var t r.Type + if present { + t = value.Type() + } else { + t = obj.Type().Elem() + value = r.Zero(t) + } + return value, present, t +} + +func (env *Env) evalSelectorExpr(node *ast.SelectorExpr) (r.Value, []r.Value) { + obj := env.evalExpr1(node.X) + name := node.Sel.Name + var val r.Value + + switch obj.Kind() { + case r.Ptr: + if pkg, ok := obj.Interface().(*PackageRef); ok { + // access symbol from imported package, for example fmt.Printf + if bind, ok := pkg.Binds[name]; ok { + return bind, nil + } + return env.Errorf("package %v %#v has no symbol %s", pkg.Name, pkg.Path, name) + } + elem := obj.Elem() + if elem.Kind() == r.Struct { + if val = elem.FieldByName(name); val != Nil { + break + } + } + // search for methods with pointer receiver first + if val = env.ObjMethodByName(obj, name); val != Nil { + break + } + if val = env.ObjMethodByName(elem, name); val != Nil { + break + } + return env.Errorf("pointer to struct <%v> has no field or method %s", typeOf(obj), name) + + case r.Interface: + val = obj.MethodByName(name) + if val != Nil { + break + } + return env.Errorf("interface <%v> has no method %s", typeOf(obj), name) + + case r.Struct: + if val = obj.FieldByName(name); val != Nil { + break + } + fallthrough + default: + // search for methods with pointer receiver first + if obj.CanAddr() { + if val = env.ObjMethodByName(obj.Addr(), name); val != Nil { + break + } + } + if val = env.ObjMethodByName(obj, name); val != Nil { + break + } + if obj.Kind() == r.Struct { + return env.Errorf("struct <%v> has no field or method %s", typeOf(obj), name) + } else { + return env.Errorf("value <%v> has no method %s", typeOf(obj), name) + } + } + return val, nil +} + +func (env *Env) evalTypeAssertExpr(node *ast.TypeAssertExpr, panicOnFail bool) (r.Value, []r.Value) { + val := env.evalExpr1(node.X) + t2 := env.evalType(node.Type) + if val == None || val == Nil { + if panicOnFail { + return env.Errorf("type assertion failed: %v <%v> is not a <%v>", val, nil, t2) + } + } else if t2 == TypeOfInterface { + val = val.Convert(t2) + return val, []r.Value{val, True} + } else { + t0 := val.Type() + fval := val.Interface() + t1 := r.TypeOf(fval) // extract the actual runtime type of fval + + if t1 != nil && t1.AssignableTo(t2) { + val = r.ValueOf(fval).Convert(t2) + return val, []r.Value{val, True} + } else if panicOnFail { + if t1 == nil { + return env.Errorf("type assertion failed: %v <%v> is nil, not a <%v>", fval, t0, t2) + } else { + return env.Errorf("type assertion failed: %v <%v> is a <%v>, not a <%v>", fval, t0, t1, t2) + } + } + } + zero := r.Zero(t2) + return zero, []r.Value{zero, False} +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/fast.go b/vendor/github.com/cosmos72/gomacro/classic/fast.go new file mode 100644 index 0000000..ae0717e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/fast.go @@ -0,0 +1,81 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * fast.go + * + * Created on: Apr 02, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/ast2" + "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/fast" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// temporary helper to invoke the new fast interpreter. +// executes macroexpand + collect + compile + eval +func (env *Env) fastEval(form ast2.Ast) (r.Value, []r.Value, xr.Type, []xr.Type) { + var f *fast.Interp + if env.FastInterp == nil { + f = fast.New() + f.Comp.CompileOptions |= fast.OptKeepUntyped + env.FastInterp = f + } else { + f = env.FastInterp.(*fast.Interp) + } + f.Comp.Stringer.Copy(&env.Stringer) // sync Fileset, Pos, Line + f.Comp.Options = env.Options // sync Options + + // macroexpand phase. + // must be performed manually, because we used classic.Env.ParseOnly() + // instead of fast.Comp.Parse() + form, _ = f.Comp.MacroExpandCodewalk(form) + if env.Options&base.OptShowMacroExpand != 0 { + env.Debugf("after macroexpansion: %v", form.Interface()) + } + + // collect phase + if env.Options&(base.OptCollectDeclarations|base.OptCollectStatements) != 0 { + env.CollectAst(form) + } + + if env.Options&base.OptMacroExpandOnly != 0 { + x := form.Interface() + return r.ValueOf(x), nil, f.Comp.TypeOf(x), nil + } + + // compile phase + expr := f.Comp.Compile(form) + if env.Options&base.OptShowCompile != 0 { + env.Fprintf(env.Stdout, "%v\n", expr) + } + + // eval phase + if expr == nil { + return base.None, nil, nil, nil + } + value, values := f.RunExpr(expr) + return value, values, expr.Type, expr.Types +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/file.go b/vendor/github.com/cosmos72/gomacro/classic/file.go new file mode 100644 index 0000000..6378ecf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/file.go @@ -0,0 +1,44 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * file.go + * + * Created on: Feb 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" +) + +func (env *Env) evalFile(node *ast.File) (r.Value, []r.Value) { + env.PackagePath = node.Name.Name + + // TODO eval node.Imports + var ret r.Value + var rets []r.Value + + for _, decl := range node.Decls { + ret, rets = env.evalDecl(decl) + } + return ret, rets +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/for.go b/vendor/github.com/cosmos72/gomacro/classic/for.go new file mode 100644 index 0000000..1b31641 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/for.go @@ -0,0 +1,303 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * for.go + * + * Created on: Feb 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalFor(node *ast.ForStmt) (r.Value, []r.Value) { + // Debugf("evalFor() init = %#v, cond = %#v, post = %#v, body = %#v", node.Init, node.Cond, node.Post, node.Body) + + if node.Init != nil { + env = NewEnv(env, "for {}") + env.evalStatement(node.Init) + } + for { + if node.Cond != nil { + cond := env.evalExpr1(node.Cond) + if cond.Kind() != r.Bool { + cf := cond.Interface() + return env.Errorf("for: invalid condition type <%T> %#v, expecting ", cf, cf) + } + if !cond.Bool() { + break + } + } + if !env.evalForBodyOnce(node.Body) { + break + } + if node.Post != nil { + env.evalStatement(node.Post) + } + } + return None, nil +} + +func (env *Env) evalForRange(node *ast.RangeStmt) (r.Value, []r.Value) { + // Debugf("evalForRange() init = %#v, cond = %#v, post = %#v, body = %#v", node.Init, node.Cond, node.Post, node.Body) + + container := env.evalExpr1(node.X) + if container == Nil || container == None { + return env.Errorf("invalid for range: cannot iterate on nil: %v evaluated to %v", node.X, container) + } + + switch container.Kind() { + case r.Chan: + return env.evalForRangeChannel(container, node) + case r.Map: + return env.evalForRangeMap(container, node) + case r.Slice, r.Array: + return env.evalForRangeSlice(container, node) + case r.String: + // Golang specs https://golang.org/ref/spec#RangeClause + // "For a string value, the "range" clause iterates over the Unicode code points in the string" + return env.evalForRangeString(container.String(), node) + case r.Ptr: + if container.Elem().Kind() == r.Array { + return env.evalForRangeSlice(container.Elem(), node) + } + } + return env.Errorf("invalid for range: expecting array, channel, map, slice, string, or pointer to array, found: %v <%v>", + container, typeOf(container)) +} + +func (env *Env) evalForRangeMap(obj r.Value, node *ast.RangeStmt) (r.Value, []r.Value) { + knode := nilIfIdentUnderscore(node.Key) + vnode := nilIfIdentUnderscore(node.Value) + tok := node.Tok + switch tok { + case token.DEFINE: + env = NewEnv(env, "range map {}") + t := obj.Type() + k := env.defineForIterVar(knode, t.Key()) + v := env.defineForIterVar(vnode, t.Elem()) + + for _, key := range obj.MapKeys() { + if k != Nil { + k.Set(key) + } + if v != Nil { + v.Set(obj.MapIndex(key)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + case token.ASSIGN: + for _, key := range obj.MapKeys() { + // Golang specs https://golang.org/ref/spec#RangeClause + // "Function calls on the left are evaluated once per iteration" + // + // we actually evaluate once per iteration the full expressions on the left + if knode != nil { + kplace := env.evalPlace(knode) + env.assignPlace(kplace, tok, key) + } + if vnode != nil { + vplace := env.evalPlace(vnode) + env.assignPlace(vplace, tok, obj.MapIndex(key)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + } + return None, nil +} + +func (env *Env) evalForRangeChannel(obj r.Value, node *ast.RangeStmt) (r.Value, []r.Value) { + knode := nilIfIdentUnderscore(node.Key) + if node.Value != nil { + return env.Errorf("range expression is a channel: expecting at most one iteration variable, found two: %v %v", node.Key, node.Value) + } + + tok := node.Tok + switch tok { + case token.DEFINE: + env = NewEnv(env, "range channel {}") + k := env.defineForIterVar(knode, obj.Type().Elem()) + + for { + recv, ok := obj.Recv() + if !ok { + break + } + if k != Nil { + k.Set(recv) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + case token.ASSIGN: + for { + recv, ok := obj.Recv() + if !ok { + break + } + // Golang specs https://golang.org/ref/spec#RangeClause + // "Function calls on the left are evaluated once per iteration" + // + // we actually evaluate once per iteration the full expressions on the left + if knode != nil { + kplace := env.evalPlace(knode) + env.assignPlace(kplace, tok, recv) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + } + return None, nil +} + +func (env *Env) evalForRangeString(str string, node *ast.RangeStmt) (r.Value, []r.Value) { + knode := nilIfIdentUnderscore(node.Key) + vnode := nilIfIdentUnderscore(node.Value) + tok := node.Tok + switch tok { + case token.DEFINE: + env = NewEnv(env, "range string {}") + k := env.defineForIterVar(knode, TypeOfInt) + v := env.defineForIterVar(vnode, TypeOfRune) + + for i, rune := range str { + if k != Nil { + k.Set(r.ValueOf(i)) + } + if v != Nil { + v.Set(r.ValueOf(rune)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + case token.ASSIGN: + for i, rune := range str { + // Golang specs https://golang.org/ref/spec#RangeClause + // "Function calls on the left are evaluated once per iteration" + // + // we actually evaluate once per iteration the full expressions on the left + if knode != nil { + kplace := env.evalPlace(knode) + env.assignPlace(kplace, tok, r.ValueOf(i)) + } + if vnode != nil { + vplace := env.evalPlace(vnode) + env.assignPlace(vplace, tok, r.ValueOf(rune)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + } + return None, nil +} + +func (env *Env) evalForRangeSlice(obj r.Value, node *ast.RangeStmt) (r.Value, []r.Value) { + knode := nilIfIdentUnderscore(node.Key) + vnode := nilIfIdentUnderscore(node.Value) + tok := node.Tok + switch tok { + case token.DEFINE: + env = NewEnv(env, "range slice/array {}") + k := env.defineForIterVar(knode, TypeOfInt) + v := env.defineForIterVar(vnode, obj.Type().Elem()) + + n := obj.Len() + for i := 0; i < n; i++ { + if k != Nil { + k.Set(r.ValueOf(i)) + } + if v != Nil { + v.Set(obj.Index(i)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + case token.ASSIGN: + n := obj.Len() + for i := 0; i < n; i++ { + // Golang specs https://golang.org/ref/spec#RangeClause + // "Function calls on the left are evaluated once per iteration" + // + // we actually evaluate once per iteration the full expressions on the left + if knode != nil { + kplace := env.evalPlace(knode) + env.assignPlace(kplace, tok, r.ValueOf(i)) + } + if vnode != nil { + vplace := env.evalPlace(vnode) + env.assignPlace(vplace, tok, obj.Index(i)) + } + if !env.evalForBodyOnce(node.Body) { + break + } + } + } + return None, nil +} + +func (env *Env) evalForBodyOnce(node *ast.BlockStmt) (cont bool) { + defer func() { + if rec := recover(); rec != nil { + switch rec := rec.(type) { + case eBreak: + cont = false + case eContinue: + cont = true + default: + panic(rec) + } + } + }() + env.evalBlock(node) + return true +} + +func (env *Env) defineForIterVar(node ast.Expr, t r.Type) r.Value { + if node == nil || t == nil { + return Nil + } + name := node.(*ast.Ident).Name + env.DefineVar(name, t, r.Zero(t)) + return env.Binds.Get1(name) +} + +func nilIfIdentUnderscore(node ast.Expr) ast.Expr { + if ident, ok := node.(*ast.Ident); ok { + if ident.Name == "_" { + return nil + } + } + return node +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/function.go b/vendor/github.com/cosmos72/gomacro/classic/function.go new file mode 100644 index 0000000..16d254c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/function.go @@ -0,0 +1,90 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * function.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + r "reflect" +) + +func (env *Env) evalDeclFunction(decl *ast.FuncDecl, funcType *ast.FuncType, body *ast.BlockStmt) (r.Value, []r.Value) { + isMacro := false + var recv *ast.Field + + if decl != nil && decl.Recv != nil { + recvList := decl.Recv.List + if recvList != nil && len(recvList) == 0 { + isMacro = true + } else { + recv = recvList[0] + } + } + tFunc, tFuncOrMethod, argNames, resultNames := env.evalTypeFunctionOrMethod(recv, funcType) + tret := tFuncOrMethod + + var funcName string + if decl == nil { + funcName = makeFuncNameForEnv(decl, isMacro) + } else { + funcName = decl.Name.Name + } + + closure := func(args []r.Value) (results []r.Value) { + return env.evalFuncCall(funcName, body, tFuncOrMethod, argNames, args, resultNames) + } + var ret r.Value + if isMacro { + // env.Debugf("defined macro %v, type %v, args (%v), returns (%v)", decl.Name.Name, t, strings.Join(argNames, ", "), strings.Join(resultNames, ", ")) + ret = r.ValueOf(Macro{closure: closure, argNum: len(argNames)}) + tret = ret.Type() + } else { + ret = r.MakeFunc(tFuncOrMethod, closure) + + if decl != nil && recv != nil { + recvType := tFuncOrMethod.In(0) + // register tFunc, i.e. without the receiver, to allow comparison with Interface methods + env.registerMethod(recvType, funcName, tFunc, ret) + } + } + if decl != nil && recv == nil { + // register named functions and macros (NOT methods) in the current environment + ret = env.DefineFunc(funcName, tret, ret) + } + return ret, nil +} + +func makeFuncNameForEnv(decl *ast.FuncDecl, isMacro bool) string { + var prefix, space, suffix string = "func", "", "" + if isMacro { + prefix = "macro" + } + if decl != nil { + space = " " + suffix = decl.Name.Name + } + return fmt.Sprintf("%s%s%s()", prefix, space, suffix) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/global.go b/vendor/github.com/cosmos72/gomacro/classic/global.go new file mode 100644 index 0000000..4bfa5ea --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/global.go @@ -0,0 +1,83 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * global.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" +) + +type CallStack struct { + Frames []CallFrame +} + +type CallFrame struct { + FuncEnv *Env + InnerEnv *Env // innermost Env + CurrentCall *ast.CallExpr // call currently in progress + defers []func() + panick interface{} // current panic + panicking bool + runningDefers bool +} + +type Constructor struct { + exec func(env *Env, arg0 r.Type, args []r.Value) (r.Value, []r.Value) + argNum int // if negative, do not check +} + +type Function struct { + exec func(env *Env, args []r.Value) (r.Value, []r.Value) + argNum int // if negative, do not check +} + +type Macro struct { + closure func(args []r.Value) (results []r.Value) + argNum int +} + +type TypedValue struct { + typ r.Type + val r.Value +} + +/** + * inside Methods, each string is the method name + * and each TypedValue is { + * Type: the method signature, i.e. the type of a func() *without* the receiver (to allow comparison with Interface methods) + * Value: the method implementation, i.e. a func() whose first argument is the receiver, + * } + */ +type Methods map[string]TypedValue + +/** + * Interface is the interpreted version of Golang interface values. + * Each Interface contains { + * Type: the interface type. returned by Env.evalInterface(), i.e. the type of a struct { € interface{}; functions... } + * Value: the datum implementing the interface. Value.Type() must be its concrete type, i.e. == r.TypeOf(Value.Interface()) + * } + */ +type Interface TypedValue diff --git a/vendor/github.com/cosmos72/gomacro/classic/identifier.go b/vendor/github.com/cosmos72/gomacro/classic/identifier.go new file mode 100644 index 0000000..b881876 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/identifier.go @@ -0,0 +1,54 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * identifier.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalIdentifier(ident *ast.Ident) r.Value { + value, found := env.resolveIdentifier(ident) + if !found { + env.Errorf("undefined identifier: %s", ident.Name) + } + return value +} + +func (env *Env) resolveIdentifier(ident *ast.Ident) (r.Value, bool) { + name := ident.Name + value := Nil + found := false + for e := env; e != nil; e = e.Outer { + // Debugf("evalIdentifier() looking up %#v in %#v", name, env.Binds) + if value, found = e.Binds.Get(name); found { + break + } + } + return value, found +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/import.go b/vendor/github.com/cosmos72/gomacro/classic/import.go new file mode 100644 index 0000000..c556b33 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/import.go @@ -0,0 +1,69 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * declaration.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" + "strings" + + . "github.com/cosmos72/gomacro/base" +) + +// eval a single import +func (env *Env) evalImport(node ast.Spec) (r.Value, []r.Value) { + switch node := node.(type) { + case *ast.ImportSpec: + path := UnescapeString(node.Path.Value) + path = env.sanitizeImportPath(path) + var name string + if node.Name != nil { + name = node.Name.Name + } else { + name = path[1+strings.LastIndexByte(path, '/'):] + } + pkg := env.ImportPackage(name, path) + if pkg != nil { + fileEnv := env.FileEnv() + fileEnv.DefineConst(name, r.TypeOf(pkg), r.ValueOf(pkg)) + } + return r.ValueOf(path), nil + default: + return env.Errorf("unimplemented import: %v", node) + } +} + +func (ir *ThreadGlobals) sanitizeImportPath(path string) string { + path = strings.Replace(path, "\\", "/", -1) + l := len(path) + if path == ".." || l >= 3 && (path[:3] == "../" || path[l-3:] == "/..") || strings.Contains(path, "/../") { + ir.Errorf("invalid import %q: contains \"..\"", path) + } + if path == "." || l >= 2 && (path[:2] == "./" || path[l-2:] == "/.") || strings.Contains(path, "/./") { + ir.Errorf("invalid import %q: contains \".\"", path) + } + return path +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/inspect.go b/vendor/github.com/cosmos72/gomacro/classic/inspect.go new file mode 100644 index 0000000..7e6bc5c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/inspect.go @@ -0,0 +1,278 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * inspect.go + * + * Created on: Feb 11, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "bufio" + "errors" + "fmt" + r "reflect" + "strconv" + "strings" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type Inspector struct { + names []string + vs []r.Value + ts []r.Type + xts []xr.Type + in *bufio.Reader + env *Env +} + +func (env *Env) Inspect(in *bufio.Reader, str string, fastInterpreter bool) { + form := env.Parse(str) + var v r.Value + var xt xr.Type + if fastInterpreter { + v, _, xt, _ = env.fastEval(form) + } else { + v = env.EvalAst1(form) + } + var t r.Type + if v != Nil && v != None { + t = r.TypeOf(v.Interface()) // show concrete type + } + switch dereferenceValue(v).Kind() { + case r.Array, r.Slice, r.String, r.Struct: + break + default: + env.showVar(str, v, t) + env.showMethods(t, xt) + return + } + stack := Inspector{names: []string{str}, vs: []r.Value{v}, ts: []r.Type{t}, xts: []xr.Type{xt}, in: in, env: env} + stack.Show() + stack.Repl() +} + +func (env *Env) showMethods(t r.Type, xt xr.Type) { + switch { + case xt != nil: + if xt.Kind() == r.Ptr { + xt = xt.Elem() + } + n := xt.NumMethod() + if n == 0 { + env.Fprintf(env.Stdout, "no methods of %v\n", xt) + return + } + env.Fprintf(env.Stdout, "methods of %v:\n", xt) + for i := 0; i < n; i++ { + env.Fprintf(env.Stdout, " m%d. %v\n", i, xt.Method(i).GoFun) + } + + case t != nil: + n := t.NumMethod() + if n == 0 { + env.Fprintf(env.Stdout, "no methods of %v\n", t) + return + } + env.Fprintf(env.Stdout, "methods of %v:\n", t) + for i := 0; i < n; i++ { + m := t.Method(i) + env.Fprintf(env.Stdout, " m%d. %s\t%v\n", i, m.Name, m.Type) + } + } +} + +func (env *Env) showVar(str string, v r.Value, t r.Type) { + env.Fprintf(env.Stdout, "%s\t= %v\t// %v\n", str, v, t) +} + +func (ip *Inspector) Help() { + fmt.Fprint(ip.env.Stdout, "// inspect commands: help methods quit top up\n") +} + +func (ip *Inspector) Show() { + depth := len(ip.names) + name := strings.Join(ip.names, ".") + v := ip.vs[depth-1] + t := ip.ts[depth-1] + ip.env.showVar(name, v, t) + + v = dereferenceValue(v) // dereference pointers on-the-fly + switch v.Kind() { + case r.Array, r.Slice, r.String: + ip.showIndexes(v) + case r.Struct: + ip.showFields(v) + } +} + +func (ip *Inspector) Repl() error { + for len(ip.names) > 0 { + fmt.Fprintf(ip.env.Stdout, "goinspect %s> ", strings.Join(ip.names, ".")) + cmd, err := ip.in.ReadString('\n') + if err != nil { + return err + } + cmd = strings.TrimSpace(cmd) + err = ip.Eval(cmd) + if err != nil { + return err + } + } + return nil +} + +func (ip *Inspector) Eval(cmd string) error { + switch { + case cmd == "?", strings.HasPrefix("help", cmd): + ip.Help() + case strings.HasPrefix("methods", cmd): + t := ip.ts[len(ip.ts)-1] + xt := ip.xts[len(ip.xts)-1] + ip.env.showMethods(t, xt) + case strings.HasPrefix("quit", cmd): + return errors.New("user quit") + case strings.HasPrefix("top", cmd): + ip.Top() + ip.Show() + case cmd == "", cmd == ".": + ip.Show() + case cmd == "-", strings.HasPrefix("up", cmd): + ip.Leave() + default: + ip.Enter(cmd) + } + return nil +} + +func (ip *Inspector) Top() { + ip.names = ip.names[0:1] + ip.vs = ip.vs[0:1] + ip.ts = ip.ts[0:1] +} + +func (ip *Inspector) Leave() { + depth := len(ip.names) + if depth <= 0 { + return + } + depth-- + ip.names = ip.names[:depth] + ip.vs = ip.vs[:depth] + ip.ts = ip.ts[:depth] + if depth > 0 { + ip.Show() + } +} + +func (ip *Inspector) showFields(v r.Value) { + n := v.NumField() + for i := 0; i < n; i++ { + f := v.Field(i) + t := typeOf(f) + f = dereferenceValue(f) + fmt.Fprintf(ip.env.Stdout, " %d. ", i) + ip.env.showVar(v.Type().Field(i).Name, f, t) + } +} + +func (ip *Inspector) showIndexes(v r.Value) { + n := v.Len() + for i := 0; i < n; i++ { + f := v.Index(i) + t := typeOf(f) + f = dereferenceValue(f) + fmt.Fprintf(ip.env.Stdout, " %d. ", i) + ip.env.showVar("", f, t) + } +} + +func (ip *Inspector) Enter(cmd string) { + i, err := strconv.Atoi(cmd) + if err != nil { + fmt.Fprintf(ip.env.Stdout, "unknown inspect command \"%s\". Type ? for help\n", cmd) + return + } + depth := len(ip.names) + v := dereferenceValue(ip.vs[depth-1]) + var n int + var fname string + var f r.Value + switch v.Kind() { + case r.Array, r.Slice, r.String: + n = v.Len() + if !ip.validRange(i, n) { + return + } + fname = fmt.Sprintf("[%s]", cmd) + f = v.Index(i) + case r.Struct: + n = v.NumField() + if !ip.validRange(i, n) { + return + } + fname = v.Type().Field(i).Name + f = v.Field(i) + default: + fmt.Fprintf(ip.env.Stdout, "cannot enter <%v>: expecting array, slice, string or struct\n", typeOf(v)) + return + } + var t r.Type + if f != Nil && f != None { + t = r.TypeOf(f.Interface()) // concrete type + } + + switch dereferenceValue(f).Kind() { // dereference pointers on-the-fly + case r.Array, r.Slice, r.String, r.Struct: + ip.names = append(ip.names, fname) + ip.vs = append(ip.vs, f) + ip.ts = append(ip.ts, t) + ip.Show() + default: + ip.env.showVar(fname, f, t) + } +} + +func dereferenceValue(v r.Value) r.Value { + for { + switch v.Kind() { + case r.Ptr: + v = v.Elem() + continue + case r.Interface: + v = r.ValueOf(v.Interface()) + continue + } + break + } + return v +} + +func (ip *Inspector) validRange(i, n int) bool { + if i < 0 || i >= n { + fmt.Fprintf(ip.env.Stdout, "%s contains %d elements, cannot inspect element %d\n", + strings.Join(ip.names, "."), n, i) + return false + } + return true +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/interface.go b/vendor/github.com/cosmos72/gomacro/classic/interface.go new file mode 100644 index 0000000..876c24f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/interface.go @@ -0,0 +1,58 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * interface.go + * + * Created on: Mar 29, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +// "\u0080" is Unicode codepoint: Padding Character. +// reflect.StructOf() allows it as field name, while go/scanner forbids it in Go source code +const nameOfInterfaceObject = "\u0080" + +func (env *Env) evalTypeInterface(node *ast.InterfaceType) r.Type { + if node.Methods == nil || len(node.Methods.List) == 0 { + return TypeOfInterface + } + types, names := env.evalTypeFields(node.Methods) + + types = append([]r.Type{TypeOfInterface}, types...) + names = append([]string{nameOfInterfaceObject}, names...) + + fields := makeStructFields(env.FileEnv().Path, names, types) + return r.StructOf(fields) +} + +func isInterfaceType(t r.Type) bool { + if t.Kind() == r.Struct && t.NumField() > 0 { + field := t.Field(0) + return field.Name == nameOfInterfaceObject && field.Type == TypeOfInterface + } + return false +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/interpreter.go b/vendor/github.com/cosmos72/gomacro/classic/interpreter.go new file mode 100644 index 0000000..fe6da7f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/interpreter.go @@ -0,0 +1,311 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * interp.go + * + * Created on: Jun 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "bufio" + "fmt" + "os" + r "reflect" + "runtime/debug" + "strings" + "time" + + . "github.com/cosmos72/gomacro/base" +) + +type Interp struct { + *Env +} + +func New() *Interp { + top := NewEnv(nil, "builtin") + env := NewEnv(top, "main") + return &Interp{env} +} + +func (ir *Interp) ChangePackage(path string) { + ir.Env = ir.Env.ChangePackage(path) +} + +// cmd is expected to start with 'package' +func (ir *Interp) cmdPackage(cmd string) { + cmd = strings.TrimSpace(cmd) + space := strings.IndexByte(cmd, ' ') + var arg string + if space >= 0 { + arg = strings.TrimSpace(cmd[1+space:]) + } + n := len(arg) + env := ir.Env + switch { + case n == 0: + fmt.Fprintf(env.Stdout, "// current package: %s %q\n", env.Filename, env.PackagePath) + case arg[0] == '"' && arg[n-1] == '"': + arg := arg[1 : n-1] + ir.Env = env.ChangePackage(arg) + default: + env.Filename = arg + } +} + +func (ir *Interp) ReplStdin() { + if ir.Options&OptShowPrompt != 0 { + fmt.Fprint(ir.Stdout, `// GOMACRO, an interactive Go interpreter with macros +// Copyright (C) 2017 Massimiliano Ghilardi +// License LGPL v3+: GNU Lesser GPL version 3 or later +// This is free software with ABSOLUTELY NO WARRANTY. +// +// Type :help for help +`) + } + in := bufio.NewReader(os.Stdin) + + ir.Line = 0 + for ir.ReadParseEvalPrint(in) { + ir.Line = 0 + } +} + +func (ir *Interp) Repl(in *bufio.Reader) { + for ir.ReadParseEvalPrint(in) { + } +} + +func (ir *Interp) ReadParseEvalPrint(in *bufio.Reader) (callAgain bool) { + var opts ReadOptions + if ir.Options&OptShowPrompt != 0 { + opts |= ReadOptShowPrompt + } + str, firstToken := ir.ReadMultiline(in, opts) + if firstToken < 0 { + // skip comments and continue, but fail on EOF or other errors + ir.IncLine(str) + return len(str) > 0 + } else if firstToken > 0 { + ir.IncLine(str[0:firstToken]) + } + return ir.ParseEvalPrint(str[firstToken:], in) +} + +func (ir *Interp) ParseEvalPrint(str string, in *bufio.Reader) (callAgain bool) { + var t1 time.Time + trap := ir.Options&OptTrapPanic != 0 + duration := ir.Options&OptShowTime != 0 + if duration { + t1 = time.Now() + } + defer func() { + ir.IncLine(str) + if trap { + rec := recover() + if ir.Options&OptPanicStackTrace != 0 { + fmt.Fprintf(ir.Stderr, "%v\n%s", rec, debug.Stack()) + } else { + fmt.Fprintf(ir.Stderr, "%v\n", rec) + } + callAgain = true + } + if duration { + delta := time.Now().Sub(t1) + ir.Debugf("eval time %.6f s", float32(delta)/float32(time.Second)) + } + }() + callAgain = ir.parseEvalPrint(str, in) + trap = false // no panic happened + return callAgain +} + +func (ir *Interp) parseEvalPrint(src string, in *bufio.Reader) (callAgain bool) { + + src = strings.TrimSpace(src) + n := len(src) + if n == 0 { + return true // no input. don't print anything + } + env := ir.Env + fast := env.Options&OptFastInterpreter != 0 // use the fast interpreter? + + if n > 0 && src[0] == ':' { + args := strings.SplitN(src, " ", 2) + cmd := args[0] + switch { + case strings.HasPrefix(":classic", cmd): + if len(args) <= 1 { + if env.Options&OptFastInterpreter != 0 { + env.Debugf("switched to classic interpreter") + } + env.Options &^= OptFastInterpreter + return true + } + // temporary override + src = strings.TrimSpace(args[1]) + fast = false + case strings.HasPrefix(":env", cmd): + if len(args) <= 1 { + env.ShowPackage("") + } else { + env.ShowPackage(args[1]) + } + return true + case strings.HasPrefix(":fast", cmd): + if len(args) <= 1 { + if env.Options&OptFastInterpreter == 0 { + env.Debugf("switched to fast interpreter") + } + env.Options |= OptFastInterpreter + return true + } + // temporary override + src = strings.TrimSpace(args[1]) + fast = true + case strings.HasPrefix(":help", cmd): + env.ShowHelp(env.Stdout) + return true + case strings.HasPrefix(":inspect", cmd): + if in == nil { + fmt.Fprint(env.Stdout, "// not connected to user input, cannot :inspect\n") + } else if len(args) == 1 { + fmt.Fprint(env.Stdout, "// inspect: missing argument\n") + } else { + env.Inspect(in, args[1], fast) + } + return true + case strings.HasPrefix(":options", cmd): + if len(args) > 1 { + env.Options ^= ParseOptions(args[1]) + } + fmt.Fprintf(env.Stdout, "// current options: %v\n", env.Options) + fmt.Fprintf(env.Stdout, "// unset options: %v\n", ^env.Options) + return true + case strings.HasPrefix(":quit", cmd): + return false + case strings.HasPrefix(":write", cmd): + if len(args) <= 1 { + env.WriteDeclsToStream(env.Stdout) + } else { + env.WriteDeclsToFile(args[1]) + } + return true + default: + // temporarily disable collection of declarations and statements, + // and temporarily disable macroexpandonly (i.e. re-enable eval) + saved := env.Options + todisable := OptMacroExpandOnly | OptCollectDeclarations | OptCollectStatements + if saved&todisable != 0 { + env.Options &^= todisable + defer func() { + env.Options = saved + }() + } + src = " " + src[1:] // slower than src = src[1:], but gives accurate column positions in error messages + } + } + if !fast { + if src == "package" || src == " package" || strings.HasPrefix(src, "package ") || strings.HasPrefix(src, " package ") { + ir.cmdPackage(src) + return true + } + } + + // parse phase. no macroexpansion/collect yet + form := env.ParseOnly(src) + + var value r.Value + var values []r.Value + var typ interface{} + var types []interface{} + + // eval phase + if form != nil { + if fast { + // macroexpand + collect + eval + xvalue, xvalues, xtype, xtypes := env.fastEval(form) + value, values, typ = xvalue, xvalues, xtype + types := make([]interface{}, len(xtypes)) + for i, xt := range xtypes { + types[i] = xt + } + } else { + // macroexpand + collect + eval + value, values = env.classicEval(form) + } + } + // print phase + opts := env.Options + if opts&OptShowEval != 0 { + if len(values) != 0 { + if opts&OptShowEvalType != 0 { + for i, vi := range values { + var ti interface{} + if types != nil && len(types) > i { + ti = types[i] + } else { + ti = ValueType(vi) + } + env.Fprintf(env.Stdout, "%v\t// %v\n", vi, ti) + } + } else { + for _, vi := range values { + env.Fprintf(env.Stdout, "%v\n", vi) + } + } + } else if value != None { + if opts&OptShowEvalType != 0 { + if typ == nil { + typ = ValueType(value) + } + env.Fprintf(env.Stdout, "%v\t// %v\n", value, typ) + } else { + env.Fprintf(env.Stdout, "%v\n", value) + } + } + } + return true +} + +func (ir *Interp) EvalFile(filePath string, pkgPath string) { + file, err := os.Open(filePath) + if err != nil { + ir.Errorf("error opening file '%s': %v", filePath, err) + return + } + defer file.Close() + + savePath := ir.Env.ThreadGlobals.PackagePath + saveOpts := ir.Env.Options + + ir.ChangePackage(pkgPath) + ir.Env.Options &^= OptShowEval + + defer func() { + ir.ChangePackage(savePath) + ir.Env.Options = saveOpts + }() + + in := bufio.NewReader(file) + ir.Repl(in) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/literal.go b/vendor/github.com/cosmos72/gomacro/classic/literal.go new file mode 100644 index 0000000..4384231 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/literal.go @@ -0,0 +1,214 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * literal.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + "strconv" + "strings" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalLiteral0(node *ast.BasicLit) interface{} { + kind := node.Kind + str := node.Value + var ret interface{} + + switch kind { + + case token.INT: + if strings.HasPrefix(str, "-") { + i64, err := strconv.ParseInt(str, 0, 64) + if err != nil { + return env.Error(err) + } + // prefer int to int64. reason: in compiled Go, + // type inference deduces int for all constants representable by an int + i := int(i64) + if int64(i) == i64 { + return i + } + return i64 + } else { + u64, err := strconv.ParseUint(str, 0, 64) + if err != nil { + return env.Error(err) + } + // prefer, in order: int, int64, uint, uint64. reason: in compiled Go, + // type inference deduces int for all constants representable by an int + i := int(u64) + if i >= 0 && uint64(i) == u64 { + return i + } + i64 := int64(u64) + if i64 >= 0 && uint64(i64) == u64 { + return i64 + } + u := uint(u64) + if uint64(u) == u64 { + return u + } + return u64 + } + + case token.FLOAT: + f, err := strconv.ParseFloat(str, 64) + if err != nil { + return env.Error(err) + } + ret = f + + case token.IMAG: + if strings.HasSuffix(str, "i") { + str = str[:len(str)-1] + } + im, err := strconv.ParseFloat(str, 64) + if err != nil { + return env.Error(err) + } + ret = complex(0.0, im) + // env.Debugf("evalLiteral(): parsed IMAG %s -> %T %#v -> %T %#v", str, im, im, ret, ret) + + case token.CHAR: + ch, err := UnescapeChar(str) + if err != nil { + env.Errorf("%v: invalid char literal: %s", err, str) + return nil + } + return ch + + case token.STRING: + return UnescapeString(str) + + default: + env.Errorf("unimplemented basic literal: %v", node) + ret = nil + } + return ret +} + +func (env *Env) evalCompositeLiteral(node *ast.CompositeLit) (r.Value, []r.Value) { + t, ellipsis := env.evalType2(node.Type, false) + obj := Nil + switch t.Kind() { + case r.Map: + obj = r.MakeMap(t) + kt := t.Key() + vt := t.Elem() + for _, elt := range node.Elts { + switch elt := elt.(type) { + case *ast.KeyValueExpr: + key := env.valueToType(env.evalExpr1(elt.Key), kt) + val := env.valueToType(env.evalExpr1(elt.Value), vt) + obj.SetMapIndex(key, val) + default: + env.Errorf("map literal: invalid element, expecting <*ast.KeyValueExpr>, found: %v <%v>", elt, r.TypeOf(elt)) + } + } + // in compiled Go, map literals are addressable + place := r.New(t).Elem() + place.Set(obj) + obj = place + case r.Array, r.Slice: + vt := t.Elem() + idx := -1 + val := Nil + zero := Nil + if t.Kind() == r.Array { + obj = r.New(t).Elem() + } else { + zero = r.Zero(vt) + obj = r.MakeSlice(t, 0, len(node.Elts)) + } + for _, elt := range node.Elts { + switch elt := elt.(type) { + case *ast.KeyValueExpr: + idx = int(env.valueToType(env.evalExpr1(elt.Key), TypeOfInt).Int()) + val = env.valueToType(env.evalExpr1(elt.Value), vt) + default: + // golang specs: + // "An element without a key uses the previous element's index plus one. + // If the first element has no key, its index is zero." + idx++ + val = env.valueToType(env.evalExpr1(elt), vt) + } + if zero != Nil { // is slice, or array with unknown size [...]T{} + for obj.Len() <= idx { + obj = r.Append(obj, zero) + } + } + obj.Index(idx).Set(val) + } + if ellipsis { + // we can finally compute the actual array length... + // too bad we have to copy the elements + n := obj.Len() + t = r.ArrayOf(n, vt) + array := r.New(t).Elem() + for i := 0; i < n; i++ { + array.Index(i).Set(obj.Index(i)) + } + obj = array + } else if t.Kind() == r.Slice { + // in compiled Go, slice literals are addressable + place := r.New(t).Elem() + place.Set(obj) + obj = place + } + case r.Struct: + obj = r.New(t).Elem() + var pairs, elts bool + var field r.Value + var expr ast.Expr + for idx, elt := range node.Elts { + switch elt := elt.(type) { + case *ast.KeyValueExpr: + if elts { + return env.Errorf("cannot mix keyed and non-keyed initializers in struct composite literal: %v", node) + } + pairs = true + name := elt.Key.(*ast.Ident).Name + field = obj.FieldByName(name) + expr = elt.Value + default: + if pairs { + return env.Errorf("cannot mix keyed and non-keyed initializers in struct composite literal: %v", node) + } + elts = true + field = obj.Field(idx) + expr = elt + } + val := env.valueToType(env.evalExpr1(expr), field.Type()) + field.Set(val) + } + default: + env.Errorf("unexpected composite literal: %v", node) + } + return obj, nil +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/macroexpand.go b/vendor/github.com/cosmos72/gomacro/classic/macroexpand.go new file mode 100644 index 0000000..6d67856 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/macroexpand.go @@ -0,0 +1,287 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * macroexpand.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +type macroExpandCtx struct { + env *Env +} + +// MacroExpandCodewalk traverses the whole AST tree using pre-order traversal, +// and replaces each node with the result of MacroExpand(node). +// It implements the macroexpansion phase +func (env *Env) MacroExpandCodewalk(in ast.Node) (out ast.Node, anythingExpanded bool) { + if in == nil { + return nil, false + } + var form Ast = ToAst(in) + form, anythingExpanded = env.MacroExpandAstCodewalk(form) + out = ToNode(form) + // if !anythingExpanded { + // env.Debugf("MacroExpand1() nothing to expand: %v <%v>", out, r.TypeOf(out)) + //} + return out, anythingExpanded +} + +func (env *Env) MacroExpandAstCodewalk(in Ast) (out Ast, anythingExpanded bool) { + return env.macroExpandAstCodewalk(in, 0) +} + +func (env *Env) macroExpandAstCodewalk(in Ast, quasiquoteDepth int) (out Ast, anythingExpanded bool) { + if in == nil || in.Size() == 0 { + return in, false + } + if quasiquoteDepth <= 0 { + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpandCodewalk: qq = %d, macroexpanding %v", quasiquoteDepth, in.Interface()) + } + in, anythingExpanded = env.macroExpandAst(in) + } + if in != nil { + in = UnwrapTrivialAst(in) + } + if in == nil { + return in, anythingExpanded + } + saved := in + + if expr, ok := in.(UnaryExpr); ok { + isBlockWithinExpr := false + switch expr.X.Op { + case mt.MACRO: + isBlockWithinExpr = true + case mt.QUOTE: + // QUOTE prevents macroexpansion only if found outside any QUASIQUOTE + if quasiquoteDepth == 0 { + return saved, anythingExpanded + } + case mt.QUASIQUOTE: + // extract the body of QUASIQUOTE + quasiquoteDepth++ + case mt.UNQUOTE, mt.UNQUOTE_SPLICE: + // extract the body of UNQUOTE or UNQUOTE_SPLICE + quasiquoteDepth-- + default: + goto Recurse + } + inChild := UnwrapTrivialAst(in.Get(0).Get(1)) + outChild, expanded := env.macroExpandAstCodewalk(inChild, quasiquoteDepth) + if isBlockWithinExpr { + return outChild, expanded + } else { + out := in + if expanded { + out = MakeQuote2(expr, outChild.(AstWithNode)) + } + return out, expanded + } + } +Recurse: + if in == nil { + return saved, anythingExpanded + } + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpandCodewalk: qq = %d, recursing on %v", quasiquoteDepth, in) + } + out = in.New() + n := in.Size() + if outSlice, canAppend := out.(AstWithSlice); canAppend { + // New() returns zero-length slice... resize it + for i := 0; i < n; i++ { + outSlice = outSlice.Append(nil) + } + out = outSlice + } + for i := 0; i < n; i++ { + child := UnwrapTrivialAst(in.Get(i)) + if child != nil { + expanded := false + if child.Size() != 0 { + child, expanded = env.macroExpandAstCodewalk(child, quasiquoteDepth) + } + if expanded { + anythingExpanded = true + } + } + out.Set(i, child) + } + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpandCodewalk: qq = %d, expanded to %v", quasiquoteDepth, out) + } + return out, anythingExpanded +} + +// MacroExpand repeatedly invokes MacroExpand1 +// as long as the node represents a macro call. +// it returns the resulting node. +func (env *Env) MacroExpand(in ast.Node) (out ast.Node, everExpanded bool) { + if in == nil { + return nil, false + } + inAst := ToAst(in) + outAst, everExpanded := env.macroExpandAst(inAst) + out = ToNode(outAst) + // if !everExpanded { + // env.Debugf("MacroExpand1() not a macro: %v <%v>", out, r.TypeOf(out)) + //} + return out, everExpanded +} + +func (env *Env) macroExpandAst(form Ast) (out Ast, everExpanded bool) { + var expanded bool + for { + form, expanded = env.macroExpandAstOnce(form) + if !expanded { + return form, everExpanded + } + everExpanded = true + } +} + +// if node represents a macro call, MacroExpand1 executes it +// and returns the resulting node. +// Otherwise returns the node argument unchanged +func (env *Env) MacroExpand1(in ast.Node) (out ast.Node, expanded bool) { + if in == nil { + return nil, false + } + var form Ast = ToAst(in) + form, expanded = env.macroExpandAstOnce(form) + out = ToNode(form) + // if !expanded { + // env.Debugf("MacroExpand1: not a macro: %v <%v>", out, r.TypeOf(out)) + //} + return out, expanded +} + +// +func (env *Env) extractMacroCall(form Ast) Macro { + form = UnwrapTrivialAst(form) + switch form := form.(type) { + case Ident: + bind, found := env.resolveIdentifier(form.X) + if found && bind.Kind() == r.Struct { + switch value := bind.Interface().(type) { + case Macro: + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpand1: found macro: %v", form.X.Name) + } + return value + } + } + } + return Macro{} +} + +func (env *Env) macroExpandAstOnce(in Ast) (out Ast, expanded bool) { + if in == nil { + return nil, false + } + // unwrap trivial nodes: DeclStmt, ParenExpr, ExprStmt + in = UnwrapTrivialAstKeepBlocks(in) + ins, ok := in.(AstWithSlice) + if !ok { + return in, false + } + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpand1: found list: %v", ins.Interface()) + } + outs := ins.New().(AstWithSlice) + n := ins.Size() + + // since macro calls are sequences of statements, + // we must scan the whole list, + // consume it as needed by the macros we find, + // and build a new list accumulating the results of macroexpansion + for i := 0; i < n; i++ { + elt := ins.Get(i) + macro := env.extractMacroCall(elt) + if macro.closure == nil { + outs = outs.Append(elt) + continue + } + argn := macro.argNum + leftn := n - i - 1 + var args []r.Value + if argn > leftn { + args := make([]r.Value, leftn+1) // include the macro itself + for j := 0; j <= leftn; j++ { + args[j] = r.ValueOf(ins.Get(i + j).Interface()) + } + env.Errorf("not enough arguments for macroexpansion of %v: expecting %d, found %d", args, macro.argNum, leftn) + return in, false + } + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpand1: found macro call %v at %d-th position of %v", elt.Interface(), i, ins.Interface()) + } + // wrap each ast.Node into a reflect.Value + args = make([]r.Value, argn) + for j := 0; j < argn; j++ { + args[j] = r.ValueOf(ToNode(ins.Get(i + j + 1))) + } + // invoke the macro + results := macro.closure(args) + if env.Options&OptDebugMacroExpand != 0 { + env.Debugf("MacroExpand1: macro expanded to: %v", results) + } + var out Ast + switch len(results) { + default: + args = append([]r.Value{r.ValueOf(elt.Interface())}, args...) + env.Warnf("macroexpansion returned %d values, using only the first one: %v %v returned %v", + len(results), args, results) + fallthrough + case 1: + any := results[0].Interface() + if any != nil { + out = AnyToAst(any, "macroexpansion") + break + } + fallthrough + case 0: + // do not insert nil nodes... they would wreak havok, convert them to the identifier nil + out = Ident{&ast.Ident{Name: "nil"}} + } + outs = outs.Append(out) + i += argn + expanded = true + } + if !expanded { + return in, false + } + if outs.Size() == 0 { + return EmptyStmt{&ast.EmptyStmt{}}, true + } + return UnwrapTrivialAst(outs), true +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/method.go b/vendor/github.com/cosmos72/gomacro/classic/method.go new file mode 100644 index 0000000..9feecf4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/method.go @@ -0,0 +1,82 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * method.go + * + * Created on: Mar 30, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +// registerMethod registers a function value for the given receiver type recvType and method name. +// The type typ of the function must not include a receiver, +// while the function value val must include a receiver as first argument +// in particular, the equality recvType == val.Type().In(0) must be true +func (ir *ThreadGlobals) registerMethod(recvType r.Type, name string, typ r.Type, val r.Value) { + if _, ok := ir.AllMethods[recvType][name]; ok { + ir.Warnf("redefined method %s for <%v>", name, recvType) + } else { + // do not allow duplicate methods, one with pointer receiver and one with value receiver + var altType r.Type + if recvType.Kind() == r.Ptr { + altType = recvType.Elem() + } else { + altType = r.PtrTo(recvType) + } + if _, ok := ir.AllMethods[altType][name]; ok { + ir.Warnf("redefined method %s for <%v>", name, recvType) + delete(ir.AllMethods[altType], name) + } + } + + methods, ok := ir.AllMethods[recvType] + if !ok { + methods = make(map[string]TypedValue) + ir.AllMethods[recvType] = methods + } + methods[name] = TypedValue{typ: typ, val: val} +} + +// ObjMethodByName returns a function value corresponding to the method +// of obj with the given name. +// The arguments to a Call on the returned function should not include +// a receiver; the returned function will always use obj as the receiver. +// It returns the zero Value if no method was found. +func (ir *ThreadGlobals) ObjMethodByName(obj r.Value, name string) r.Value { + // search for methods known to the compiler + val := obj.MethodByName(name) + if val == Nil { + // search for methods known to the intepreter + t := obj.Type() + if method, ok := ir.AllMethods[t][name]; ok { + // cumbersome... we must create a closure on-the-fly + val = r.MakeFunc(method.typ, func(args []r.Value) []r.Value { + return method.val.Call(append([]r.Value{obj}, args...)) + }) + } + } + return val +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/number.go b/vendor/github.com/cosmos72/gomacro/classic/number.go new file mode 100644 index 0000000..725602f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/number.go @@ -0,0 +1,69 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * number.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + r "reflect" +) + +func (env *Env) toInt(xv r.Value) (int64, bool) { + switch xv.Kind() { + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + u := xv.Uint() + i := int64(u) + if uint64(i) != u { + env.Warnf("value %d overflows int64, truncated to %d", u, i) + } + return i, true + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + return xv.Int(), true + default: + return 0, false + } +} + +func (env *Env) toFloat(xv r.Value) (float64, bool) { + switch xv.Kind() { + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return float64(xv.Uint()), true + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + return float64(xv.Int()), true + case r.Float32, r.Float64: + return xv.Float(), true + default: + return 0.0, false + } +} + +func (env *Env) toComplex(xv r.Value) (complex128, bool) { + switch xv.Kind() { + case r.Complex64, r.Complex128: + return xv.Complex(), true + default: + f, ok := env.toFloat(xv) + return complex(f, 0.0), ok + } +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/output.go b/vendor/github.com/cosmos72/gomacro/classic/output.go new file mode 100644 index 0000000..91d53ed --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/output.go @@ -0,0 +1,151 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * output.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + "io" + r "reflect" + "sort" + + . "github.com/cosmos72/gomacro/base" +) + +var ( + nilEnv *Env + NilEnv = []r.Value{r.ValueOf(nilEnv)} +) + +func (ir *ThreadGlobals) ShowHelp(out io.Writer) { + fmt.Fprint(out, `// type Go code to execute it. example: func add(x, y int) int { return x + y } + +// interpreter commands: +:classic CODE execute CODE using the classic interpreter +:env [name] show available functions, variables and constants + in current package, or from imported package "name" +:fast CODE execute CODE using the fast interpreter (default) +:help show this help +:inspect EXPR inspect expression interactively +:options [OPTS] show or toggle interpreter options +:quit quit the interpreter +:write [FILE] write collected declarations and/or statements to standard output or to FILE + use :o Declarations and/or :o Statements to start collecting them +`) +} + +func (env *Env) showStack() { + frames := env.CallStack.Frames + n := len(frames) + for i := 1; i < n; i++ { + frame := &frames[i] + name := "" + if frame.FuncEnv != nil { + name = frame.FuncEnv.Name + } + if frame.panicking { + env.Debugf("%d:\t %v, runningDefers = %v, panic = %v", i, name, frame.runningDefers, frame.panick) + } else { + env.Debugf("%d:\t %v, runningDefers = %v, panic is nil", i, name, frame.runningDefers) + } + } +} + +func (env *Env) ShowPackage(packageName string) { + out := env.Stdout + e := env + path := env.Path + pkg := env.AsPackage() + if len(packageName) != 0 { + bind := env.evalIdentifier(&ast.Ident{Name: packageName}) + if bind == None || bind == Nil { + env.Warnf("not an imported package: %q", packageName) + return + } + switch val := bind.Interface().(type) { + case *PackageRef: + e = nil + pkg = val.Package + path = packageName + default: + env.Warnf("not an imported package: %q = %v <%v>", packageName, val, typeOf(bind)) + return + } + } + spaces15 := " " +Loop: + binds := pkg.Binds + if len(binds) > 0 { + fmt.Fprintf(out, "// ----- %s binds -----\n", path) + + keys := make([]string, len(binds)) + i := 0 + for k := range binds { + keys[i] = k + i++ + } + sort.Strings(keys) + for _, k := range keys { + n := len(k) & 15 + fmt.Fprintf(out, "%s%s = ", k, spaces15[n:]) + bind := binds[k] + if bind != Nil { + switch bind := bind.Interface().(type) { + case *Env: + fmt.Fprintf(out, "%p // %v\n", bind, r.TypeOf(bind)) + continue + } + } + env.Fprintf(out, "%v // %v\n", bind, r.TypeOf(bind)) + } + fmt.Fprintln(out) + } + types := pkg.Types + if len(types) > 0 { + fmt.Fprintf(out, "// ----- %s types -----\n", path) + + keys := make([]string, len(types)) + i := 0 + for k := range types { + keys[i] = k + i++ + } + sort.Strings(keys) + for _, k := range keys { + n := len(k) & 15 + t := types[k] + fmt.Fprintf(out, "%s%s %v <%v>\n", k, spaces15[n:], t.Kind(), t) + } + fmt.Fprintln(out) + } + if e != nil { + if e = e.Outer; e != nil { + path = e.Path + pkg = e.AsPackage() + goto Loop + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/quasiquote.go b/vendor/github.com/cosmos72/gomacro/classic/quasiquote.go new file mode 100644 index 0000000..d7a20ed --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/quasiquote.go @@ -0,0 +1,207 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * quasiquote.go + * + * Created on: Feb 19, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (env *Env) evalQuote(node *ast.BlockStmt) ast.Node { + return SimplifyNodeForQuote(node, true) +} + +// evalQuasiquote evaluates the body of a quasiquote{} represented as ast.Node +func (env *Env) evalQuasiquote(node *ast.BlockStmt) ast.Node { + // we invoke SimplifyNodeForQuote() at the end, not at the beginning. + // reason: to support quasiquote{unquote_splice ...} + toUnwrap := node != SimplifyNodeForQuote(node, true) + + in := ToAst(node) + out := env.evalQuasiquoteAst(in, 1) + ret := ToNode(out) + return SimplifyNodeForQuote(ret, toUnwrap) +} + +// evalQuasiquoteAst evaluates the body of a quasiquote{} represented as Ast +// use unified API to traverse ast.Node... every other solution is a nightmare +func (env *Env) evalQuasiquoteAst(in Ast, depth int) (out Ast) { + if in == nil { + return nil + } + inSlice, canSplice := in.(AstWithSlice) + env.debugQuasiQuote("evaluating", depth, canSplice, in.Interface()) + if !canSplice { + in = UnwrapTrivialAst(in) // drill through DeclStmt, ExprStmt, ParenExpr, one-element BlockStmt + } + if in == nil || in.Size() == 0 { + return in + } + + if !canSplice { + if in, ok := in.(UnaryExpr); ok { + switch in.Op() { + case mt.QUASIQUOTE: + // equivalent to ToAst(form.p.X.(*ast.FuncLit).Body) + toexpand := in.Get(0).Get(1) + env.debugQuasiQuote("recursing inside QUASIQUOTE", depth+1, canSplice, toexpand.Interface()) + expansion := env.evalQuasiquoteAst(toexpand, depth+1) + return MakeQuote2(in, expansion.(AstWithNode)) + case mt.UNQUOTE: + if depth <= 1 { + y := env.evalUnquote(in) + return AnyToAst(y, "unquote") + } else { + // equivalent to ToAst(form.p.X.(*ast.FuncLit).Body) + toexpand := in.Get(0).Get(1) + env.debugQuasiQuote("recursing inside UNQUOTE", depth-1, canSplice, toexpand.Interface()) + expansion := env.evalQuasiquoteAst(toexpand, depth-1) + return MakeQuote2(in, expansion.(AstWithNode)) + } + case mt.UNQUOTE_SPLICE: + y := in.Interface() + env.Errorf("quasiquote: cannot splice in single-statement context: %v <%v>", y, r.TypeOf(y)) + return nil + } + } + + out := in.New() + ni := in.Size() + for i := 0; i < ni; i++ { + child := in.Get(i) + if child == nil { + env.debugQuasiQuote("child is nil", depth, canSplice, child) + } else { + env.debugQuasiQuote("general case: recurse on child", depth, canSplice, child.Interface()) + child = env.evalQuasiquoteAst(child, depth) + } + out.Set(i, child) + } + return out + } + + outSlice := inSlice.New().(AstWithSlice) + ni := inSlice.Size() + for i := 0; i < ni; i++ { + // drill through DeclStmt, ExprStmt, ParenExpr + child := UnwrapTrivialAstKeepBlocks(inSlice.Get(i)) + switch child := child.(type) { + case UnaryExpr: + switch child.Op() { + case mt.QUASIQUOTE: + // equivalent to ToAst(form.p.X.(*ast.FuncLit).Body) + toexpand := child.Get(0).Get(1) + env.debugQuasiQuote("recursing inside QUASIQUOTE", depth+1, canSplice, toexpand.Interface()) + expansion := env.evalQuasiquoteAst(toexpand, depth+1) + child = MakeQuote2(child, expansion.(AstWithNode)) + outSlice = outSlice.Append(child) + goto Next + case mt.UNQUOTE, mt.UNQUOTE_SPLICE: + // complication: in Common Lisp, the right-most unquote pairs with the left-most comma! + // we implement the same mechanics, so we must drill down to the last unquote/unquote_splice + // and, for unquote_splice, create a copy of the unquote/unquote_splice stack for each result. + // Example: + // x:=quote{7; 8} + // quasiquote{quasiquote{1; unquote{2}; unquote{unquote_splice{x}}}} + // must return + // quasiquote{1; unquote{2}; unquote{7}; unquote{8}} + lastUnquote, unquoteDepth := DescendNestedUnquotes(child) + + op := lastUnquote.Op() + + env.debugQuasiQuote(fmt.Sprintf("inside %s, lastUnquote is %s (unquoteDepth = %d)", + mt.String(child.Op()), mt.String(op), unquoteDepth), depth, canSplice, child) + + if unquoteDepth > depth { + env.Errorf("%s not inside quasiquote: %v <%v>", mt.String(op), lastUnquote, r.TypeOf(lastUnquote)) + return nil + } else if unquoteDepth < depth { + toexpand := child.Get(0).Get(1) + env.debugQuasiQuote(fmt.Sprintf("recursing inside %s, lastUnquote is %s", mt.String(child.Op()), mt.String(op)), + depth-1, canSplice, toexpand.Interface()) + expansion := env.evalQuasiquoteAst(toexpand, depth-1) + child = MakeQuote2(child, expansion.(AstWithNode)) + outSlice = outSlice.Append(child) + } else { + env.debugQuasiQuote("calling unquote on", depth-unquoteDepth, canSplice, lastUnquote.Interface()) + toInsert := AnyToAst(env.evalUnquote(lastUnquote), mt.String(op)) + if toInsert == nil { + env.debugQuasiQuote("unquote returned", depth-unquoteDepth, canSplice, toInsert) + } else { + env.debugQuasiQuote("unquote returned", depth-unquoteDepth, canSplice, toInsert.Interface()) + } + if op == mt.UNQUOTE { + stack := DuplicateNestedUnquotes(child, unquoteDepth-1, toInsert) + outSlice = outSlice.Append(stack) + } else if toInsert != nil { + toSplice := ToAstWithSlice(toInsert, "unquote_splice") + nj := toSplice.Size() + for j := 0; j < nj; j++ { + stack := DuplicateNestedUnquotes(child, unquoteDepth-1, toSplice.Get(j)) + outSlice = outSlice.Append(stack) + } + } + } + goto Next + } + } + if child == nil { + env.debugQuasiQuote("child is nil", depth, canSplice, child) + } else { + env.debugQuasiQuote("general case: recurse on child", depth, canSplice, child.Interface()) + child = env.evalQuasiquoteAst(child, depth) + } + outSlice = outSlice.Append(child) + Next: + env.debugQuasiQuote("accumulated", depth, canSplice, outSlice.Interface()) + } + return outSlice +} + +func (env *Env) debugQuasiQuote(msg string, depth int, canSplice bool, x interface{}) { + if env.Options&OptDebugQuasiquote != 0 { + env.Debugf("quasiquote: %s (depth = %d, canSplice = %v)\n%v <%v>", msg, depth, canSplice, x, r.TypeOf(x)) + } +} + +// evalUnquote performs expansion inside a QUASIQUOTE +func (env *Env) evalUnquote(inout UnaryExpr) interface{} { + block := inout.X.X.(*ast.FuncLit).Body + + ret, extraValues := env.evalBlock(block) + if len(extraValues) > 1 { + env.Warnf("unquote returned %d values, only the first one will be used: %v", len(extraValues), block) + } + if ret == None || ret == Nil { + return nil + } + return ret.Interface() +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/select.go b/vendor/github.com/cosmos72/gomacro/classic/select.go new file mode 100644 index 0000000..3b3b292 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/select.go @@ -0,0 +1,179 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * select.go + * + * Created on: Mar 25, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +type selectLhsExpr struct { + lhs [2]ast.Expr + tok token.Token +} + +func (env *Env) evalSelect(node *ast.SelectStmt) (ret r.Value, rets []r.Value) { + if node.Body == nil || len(node.Body.List) == 0 { + return None, nil + } + list := node.Body.List + n := len(list) + lhs := make([]selectLhsExpr, n) + ops := make([]r.SelectCase, n) + + for i, stmt := range list { + case_ := stmt.(*ast.CommClause) + comm := case_.Comm + if comm == nil { + // default + ops[i].Dir = r.SelectDefault + } else { + env.mustBeSelectStatement(comm, &lhs[i], &ops[i]) + } + } + i, recv, recvOk := r.Select(ops) + case_ := list[i].(*ast.CommClause) + return env.evalSelectBody(lhs[i], [2]r.Value{recv, r.ValueOf(recvOk)}, case_) +} + +func (env *Env) mustBeSelectStatement(stmt ast.Stmt, lhs *selectLhsExpr, op *r.SelectCase) { + switch node := stmt.(type) { + case *ast.ExprStmt: + // <-ch + op.Dir = r.SelectRecv + op.Chan = env.mustBeSelectRecv(stmt, node.X) + return + case *ast.AssignStmt: + // v := <-ch or v = <-ch + llist := node.Lhs + lnum := len(llist) + if (lnum == 1 || lnum == 2) && len(node.Rhs) == 1 { + l0 := llist[0] + var l1 ast.Expr + if lnum == 2 { + l1 = llist[1] + } + r0 := node.Rhs[0] + switch node.Tok { + case token.DEFINE: + if _, ok := l0.(*ast.Ident); ok || l0 == nil { + if _, ok := l1.(*ast.Ident); ok || l1 == nil { + op.Dir = r.SelectRecv + op.Chan = env.mustBeSelectRecv(node, r0) + lhs.lhs[0] = l0 + lhs.lhs[1] = l1 + lhs.tok = node.Tok + return + } + } + case token.ASSIGN: + op.Dir = r.SelectRecv + op.Chan = env.mustBeSelectRecv(node, r0) + lhs.lhs[0] = l0 + lhs.lhs[1] = l1 + lhs.tok = node.Tok + return + } + } + case *ast.SendStmt: + // ch <- v + op.Dir = r.SelectSend + op.Chan = env.evalExpr1(node.Chan) + op.Send = env.evalExpr1(node.Value) + return + } + env.badSelectStatement(stmt) +} + +func (env *Env) mustBeSelectRecv(stmt ast.Stmt, node ast.Expr) r.Value { + for { + switch expr := node.(type) { + case *ast.ParenExpr: + node = expr.X + continue + case *ast.UnaryExpr: + if expr.Op == token.ARROW { + return env.evalExpr1(expr.X) + } + } + break + } + return env.badSelectStatement(stmt) +} + +func (env *Env) badSelectStatement(stmt ast.Stmt) r.Value { + env.Errorf("invalid select case, expecting [ch <- val] or [<-ch] or [var := <-ch] or [place = <-ch], found: %v <%v>", + stmt, r.TypeOf(stmt)) + return None +} + +func (env *Env) evalSelectBody(lhs selectLhsExpr, val [2]r.Value, case_ *ast.CommClause) (ret r.Value, rets []r.Value) { + if case_ == nil || len(case_.Body) == 0 { + // apply lhs side effects even without body + if lhs.tok == token.ASSIGN { + for i := 0; i < 2; i++ { + if expr := lhs.lhs[i]; expr != nil { + place := env.evalPlace(expr) + env.assignPlace(place, token.ASSIGN, val[i]) + } + } + } + return None, nil + } + panicking := true + defer func() { + if panicking { + switch pan := recover().(type) { + case eBreak: + ret, rets = None, nil + default: + panic(pan) + } + } + }() + // each case body has its own environment + label := "case:" + if case_.Comm == nil { + label = "default:" + } + env2 := NewEnv(env, label) + for i := 0; i < 2; i++ { + if expr := lhs.lhs[i]; expr != nil { + if lhs.tok == token.DEFINE { + env2.DefineVar(expr.(*ast.Ident).Name, nil, val[i]) + } else { + place := env.evalPlace(expr) + env.assignPlace(place, token.ASSIGN, val[i]) + } + } + } + ret, rets = env2.evalStatements(case_.Body) + panicking = false + return +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/statement.go b/vendor/github.com/cosmos72/gomacro/classic/statement.go new file mode 100644 index 0000000..16b3231 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/statement.go @@ -0,0 +1,232 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * statement.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +type eBreak struct { + label string +} + +type eContinue struct { + label string +} + +func (_ eBreak) Error() string { + return "break outside for or switch" +} + +func (_ eContinue) Error() string { + return "continue outside for" +} + +type eReturn struct { + results []r.Value +} + +func (_ eReturn) Error() string { + return "return outside function" +} + +func (env *Env) evalBlock(block *ast.BlockStmt) (r.Value, []r.Value) { + if block == nil || len(block.List) == 0 { + return None, nil + } + env = NewEnv(env, "{}") + + return env.evalStatements(block.List) +} + +func (env *Env) evalStatements(list []ast.Stmt) (r.Value, []r.Value) { + ret := None + var rets []r.Value + + for i := range list { + ret, rets = env.evalStatement(list[i]) + } + return ret, rets +} + +func (env *Env) evalStatement(stmt ast.Stmt) (r.Value, []r.Value) { +again: + if stmt != nil { + env.Pos = stmt.Pos() + } + switch node := stmt.(type) { + case *ast.AssignStmt: + return env.evalAssignments(node) + case *ast.BlockStmt: + return env.evalBlock(node) + case *ast.BranchStmt: + return env.evalBranch(node) + case *ast.CaseClause, *ast.CommClause: + return env.Errorf("misplaced case: not inside switch or select: %v <%v>", node, r.TypeOf(node)) + case *ast.DeclStmt: + return env.evalDecl(node.Decl) + case *ast.DeferStmt: + return env.evalDefer(node.Call) + case *ast.EmptyStmt: + return None, nil + case *ast.ExprStmt: + return env.evalExpr(node.X) + case *ast.ForStmt: + return env.evalFor(node) + case *ast.GoStmt: + return env.evalGo(node) + case *ast.IfStmt: + return env.evalIf(node) + case *ast.IncDecStmt: + return env.evalIncDec(node) + case *ast.LabeledStmt: + stmt = node + goto again + case *ast.RangeStmt: + return env.evalForRange(node) + case *ast.ReturnStmt: + return env.evalReturn(node) + case *ast.SelectStmt: + return env.evalSelect(node) + case *ast.SendStmt: + return env.evalSend(node) + case *ast.SwitchStmt: + return env.evalSwitch(node) + case *ast.TypeSwitchStmt: + return env.evalTypeSwitch(node) + default: + return env.Errorf("unimplemented statement: %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) evalBranch(node *ast.BranchStmt) (r.Value, []r.Value) { + var label string + if node.Label != nil { + label = node.Label.Name + } + switch node.Tok { + case token.BREAK: + panic(eBreak{label}) + case token.CONTINUE: + panic(eContinue{label}) + case token.GOTO: + return env.Errorf("unimplemented: goto") + case token.FALLTHROUGH: + return env.Errorf("invalid fallthrough: not the last statement in a case") + default: + return env.Errorf("unimplemented branch: %v <%v>", node, r.TypeOf(node)) + } +} + +func (env *Env) evalGo(stmt *ast.GoStmt) (r.Value, []r.Value) { + if !MultiThread { + env.Errorf("cannot create goroutine: %v\n\treason: this copy of gomacro was compiled with build tag 'gomacro_singlethread'", stmt) + } + + node := stmt.Call + fun := env.evalExpr1(node.Fun) + + switch fun.Kind() { + case r.Struct: + switch fun := fun.Interface().(type) { + case Constructor: + // evaluate args in the caller's goroutine + t, args := env.evalConstructorArgs(fun, node) + go fun.exec(env, t, args) + case Function: + // evaluate args in the caller's goroutine + args := env.evalFunctionArgs(fun, node) + go fun.exec(env, args) + } + case r.Func: + // evaluate args in the caller's goroutine + args := env.evalFuncArgs(fun, node) + if node.Ellipsis == token.NoPos { + go fun.Call(args) + } else { + go fun.CallSlice(args) + } + } + return None, nil +} + +func (env *Env) evalIf(node *ast.IfStmt) (r.Value, []r.Value) { + if node.Init != nil { + env = NewEnv(env, "if {}") + _, _ = env.evalStatement(node.Init) + } + cond, _ := env.EvalNode(node.Cond) + if cond.Kind() != r.Bool { + cf := cond.Interface() + return env.Errorf("if: invalid condition type <%T> %#v, expecting ", cf, cf) + } + if cond.Bool() { + return env.evalBlock(node.Body) + } else if node.Else != nil { + return env.evalStatement(node.Else) + } else { + return Nil, nil + } +} + +func (env *Env) evalIncDec(node *ast.IncDecStmt) (r.Value, []r.Value) { + var op token.Token + switch node.Tok { + case token.INC: + op = token.ADD_ASSIGN + case token.DEC: + op = token.SUB_ASSIGN + default: + return env.Errorf("unsupported *ast.IncDecStmt operation, expecting ++ or -- : %v <%v>", node, r.TypeOf(node)) + } + place := env.evalPlace(node.X) + return env.assignPlace(place, op, One), nil +} + +func (env *Env) evalSend(node *ast.SendStmt) (r.Value, []r.Value) { + channel := env.evalExpr1(node.Chan) + if channel.Kind() != r.Chan { + return env.Errorf("<- invoked on non-channel: %v evaluated to %v <%v>", node.Chan, channel, typeOf(channel)) + } + value := env.evalExpr1(node.Value) + channel.Send(value) + return None, nil +} + +func (env *Env) evalReturn(node *ast.ReturnStmt) (r.Value, []r.Value) { + var rets []r.Value + if len(node.Results) == 1 { + // return foo() returns *all* the values returned by foo, not just the first one + rets = PackValues(env.evalExpr(node.Results[0])) + } else { + rets = env.evalExprs(node.Results) + } + panic(eReturn{rets}) +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/switch.go b/vendor/github.com/cosmos72/gomacro/classic/switch.go new file mode 100644 index 0000000..a90070e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/switch.go @@ -0,0 +1,138 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * for.go + * + * Created on: Feb 15, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalSwitch(node *ast.SwitchStmt) (ret r.Value, rets []r.Value) { + if node.Init != nil { + // the scope of variables defined in the init statement of a switch + // is the switch itself + env = NewEnv(env, "switch") + env.evalStatement(node.Init) + } + var tag r.Value + if node.Tag == nil { + tag = True + } else { + tag = env.evalExpr1(node.Tag) + } + if node.Body == nil || len(node.Body.List) == 0 { + return None, nil + } + isFallthrough := false + cases := node.Body.List + n := len(cases) + default_i := n + for i := 0; i < n; i++ { + case_ := cases[i].(*ast.CaseClause) + if !isFallthrough && case_.List == nil { + // default will be executed later, if no case matches + default_i = i + } else if isFallthrough || env.caseMatches(tag, case_.List) { + ret, rets, isFallthrough = env.evalCaseBody(i == default_i, case_) + if !isFallthrough { + return ret, rets + } + } + } + // even "default:" can end with fallthrough... + for i := default_i; i < n; i++ { + case_ := cases[i].(*ast.CaseClause) + ret, rets, isFallthrough = env.evalCaseBody(i == default_i, case_) + if !isFallthrough { + return ret, rets + } + } + return None, nil +} + +func (env *Env) caseMatches(tag r.Value, list []ast.Expr) bool { + var i interface{} + var t r.Type = nil + if tag != None && tag != Nil { + i = tag.Interface() + t = tag.Type() + } + for _, expr := range list { + v := env.evalExpr1(expr) + if t == nil { + if v == Nil || v == None { + return true + } + } else { + v = env.valueToType(v, t) + // https://golang.org/pkg/reflect + // "To compare two Values, compare the results of the Interface method" + if v.Interface() == i { + return true + } + } + } + return false +} + +func (env *Env) evalCaseBody(isDefault bool, case_ *ast.CaseClause) (ret r.Value, rets []r.Value, isFallthrough bool) { + if case_ == nil || len(case_.Body) == 0 { + return None, nil, false + } + body := case_.Body + n := len(body) + // implement fallthrough + if last, ok := body[n-1].(*ast.BranchStmt); ok { + if last.Tok == token.FALLTHROUGH { + isFallthrough = true + body = body[0 : n-1] + } + } + + // each case body has its own environment + label := "case:" + if isDefault { + label = "default:" + } + panicking := true + defer func() { + if panicking { + switch pan := recover().(type) { + case eBreak: + ret, rets, isFallthrough = None, nil, false + default: + panic(pan) + } + } + }() + env = NewEnv(env, label) + ret, rets = env.evalStatements(body) + panicking = false + return +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/switch_type.go b/vendor/github.com/cosmos72/gomacro/classic/switch_type.go new file mode 100644 index 0000000..786505c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/switch_type.go @@ -0,0 +1,147 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * switch_type.go + * + * Created on: Mar 25, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (env *Env) evalTypeSwitch(node *ast.TypeSwitchStmt) (ret r.Value, rets []r.Value) { + // the scope of variables defined in the init and assign statements of a type switch + // is the type switch itself + if node.Init != nil { + env = NewEnv(env, "type switch") + env.evalStatement(node.Init) + } + varname, expr := env.mustBeTypeSwitchStatement(node.Assign) + v := env.evalExpr1(expr) + if node.Body == nil || len(node.Body.List) == 0 { + return None, nil + } + var vt r.Type = nil + if v != None && v != Nil { + // go through interface{} to obtain actual concrete type + val := v.Interface() + v = r.ValueOf(val) + if val != nil { + vt = v.Type() + } + } + var default_ *ast.CaseClause + for _, stmt := range node.Body.List { + case_ := stmt.(*ast.CaseClause) + if case_.List == nil { + // default will be executed later, if no case matches + default_ = case_ + } else if t, ok := env.typecaseMatches(vt, case_.List); ok { + return env.evalTypecaseBody(varname, t, v, case_, false) + } + } + if default_ != nil { + return env.evalTypecaseBody(varname, TypeOfInterface, v, default_, true) + } + return None, nil +} + +func (env *Env) mustBeTypeSwitchStatement(node ast.Stmt) (*ast.Ident, ast.Expr) { + switch stmt := node.(type) { + case *ast.ExprStmt: + // x.(type) + return env.mustBeTypeSwitchAssert(node, stmt.X) + case *ast.AssignStmt: + // v := x.(type) + if len(stmt.Lhs) == 1 && len(stmt.Rhs) == 1 && stmt.Tok == token.DEFINE { + l := stmt.Lhs[0] + if lhs, ok := l.(*ast.Ident); ok { + r := stmt.Rhs[0] + _, rhs := env.mustBeTypeSwitchAssert(node, r) + return lhs, rhs + } + } + } + return env.badTypeSwitchStatement(node) +} + +func (env *Env) mustBeTypeSwitchAssert(s ast.Stmt, x ast.Expr) (*ast.Ident, ast.Expr) { + e, ok := x.(*ast.TypeAssertExpr) + if !ok || e.Type != nil { + return env.badTypeSwitchStatement(s) + } + return nil, e.X +} + +func (env *Env) badTypeSwitchStatement(s ast.Stmt) (*ast.Ident, ast.Expr) { + env.Errorf("invalid type switch expression, expecting x.(type) or v := x.(type), found: %v <%v>", + s, r.TypeOf(s)) + return nil, nil +} + +func (env *Env) typecaseMatches(vt r.Type, list []ast.Expr) (r.Type, bool) { + for _, expr := range list { + t := env.evalTypeOrNil(expr) + if t == nil { + if vt == nil { + return TypeOfInterface, true + } + } else if vt.AssignableTo(t) { + return t, true + } + } + return nil, false +} + +func (env *Env) evalTypecaseBody(varname *ast.Ident, t r.Type, val r.Value, case_ *ast.CaseClause, isDefault bool) (ret r.Value, rets []r.Value) { + if case_ == nil || len(case_.Body) == 0 { + return None, nil + } + panicking := true + defer func() { + if panicking { + switch pan := recover().(type) { + case eBreak: + ret, rets = None, nil + default: + panic(pan) + } + } + }() + // each case body has its own environment + label := "case:" + if isDefault { + label = "default:" + } + env = NewEnv(env, label) + if varname != nil { + env.DefineVar(varname.Name, t, val) + } + ret, rets = env.evalStatements(case_.Body) + panicking = false + return +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/type.go b/vendor/github.com/cosmos72/gomacro/classic/type.go new file mode 100644 index 0000000..7c678f7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/type.go @@ -0,0 +1,371 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * type.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func typeOf(value r.Value) r.Type { + if value == None || value == Nil { + return TypeOfInterface + } + return value.Type() +} + +func (env *Env) evalExpr1OrType(node ast.Expr) (val r.Value, t r.Type) { + defer func() { + if r := recover(); r != nil { + switch r.(type) { + case RuntimeError: + t = env.evalType(node) + default: + panic(r) + } + } + }() + val = env.evalExpr1(node) + return val, nil +} + +// evalTypeAlias evaluates a type alias declaration, i.e. type Foo = /*...*/ +func (env *Env) evalTypeAlias(name string, node ast.Expr) r.Type { + t := env.evalType(node) + // never define bindings for "_" + if name != "_" { + if _, ok := env.Types.Get(name); ok { + env.Warnf("redefined type alias: %v", name) + } else { + env.Types.Ensure() + } + env.Types.Set(name, t) + } + return t +} + +// evalType evaluates a type +func (env *Env) evalType(node ast.Expr) r.Type { + t, _ := env.evalType2(node, false) + return t +} + +// evalTypeOrNil evaluates a type. as a special case used by type switch, evaluates *ast.Ident{Name:"nil"} to nil +func (env *Env) evalTypeOrNil(node ast.Expr) r.Type { + for { + switch expr := node.(type) { + case *ast.ParenExpr: + node = expr.X + continue + case *ast.Ident: + if expr.Name == "nil" { + val, found := env.resolveIdentifier(expr) + if found && val == Nil { + return nil + } + } + } + break + } + t, _ := env.evalType2(node, false) + return t +} + +// evalType0 evaluates a type expression. +// if allowEllipsis is true, it supports the special case &ast.Ellipsis{/*expression*/} +// that represents ellipsis in the last argument of a function declaration. +// The second return value is true both in the case above, and for array types whose length is [...] +func (env *Env) evalType2(node ast.Expr, allowEllipsis bool) (t r.Type, ellipsis bool) { + stars := 0 + for { + switch expr := node.(type) { + case *ast.StarExpr: + stars++ + node = expr.X + continue + case *ast.ParenExpr: + node = expr.X + continue + case *ast.Ellipsis: + if allowEllipsis { + node = expr.Elt + ellipsis = true + continue + } + } + break + } + if node != nil { + env.Pos = node.Pos() + } + + switch node := node.(type) { + case *ast.ArrayType: // also for slices + var ellipsis2 bool + t, ellipsis2 = env.evalTypeArray(node) + if !ellipsis { + ellipsis = ellipsis2 + } + case *ast.ChanType: + t = env.evalType(node.Value) + dir := r.BothDir + if node.Dir == ast.SEND { + dir = r.SendDir + } else if node.Dir == ast.RECV { + dir = r.RecvDir + } + t = r.ChanOf(dir, t) + case *ast.FuncType: + t, _, _ = env.evalTypeFunction(node) + case *ast.Ident: + t = env.evalTypeIdentifier(node.Name) + case *ast.InterfaceType: + t = env.evalTypeInterface(node) + case *ast.MapType: + kt := env.evalType(node.Key) + vt := env.evalType(node.Value) + t = r.MapOf(kt, vt) + case *ast.SelectorExpr: + if pkgIdent, ok := node.X.(*ast.Ident); ok { + pkgv := env.evalIdentifier(pkgIdent) + if pkg, ok := pkgv.Interface().(*PackageRef); ok { + name := node.Sel.Name + if t, ok = pkg.Types[name]; !ok { + env.Errorf("not a type: %v <%v>", node, r.TypeOf(node)) + } + } else { + env.Errorf("not a package: %v = %v <%v>", pkgIdent, pkgv, typeOf(pkgv)) + } + } else { + env.Errorf("unimplemented qualified type, expecting packageName.identifier: %v <%v>", node, r.TypeOf(node)) + } + case *ast.StructType: + // env.Debugf("evalType() struct declaration: %v <%v>", node, r.TypeOf(node)) + types, names := env.evalTypeFields(node.Fields) + // env.Debugf("evalType() struct names and types: %v %v", types, names) + fields := makeStructFields(env.FileEnv().Path, names, types) + // env.Debugf("evalType() struct fields: %#v", fields) + t = r.StructOf(fields) + case nil: + // type can be omitted in many case - then we must perform type inference + break + default: + // TODO which types are still missing? + env.Errorf("unimplemented type: %v <%v>", node, r.TypeOf(node)) + } + for i := 0; i < stars; i++ { + t = r.PtrTo(t) + } + if allowEllipsis && ellipsis { + t = r.SliceOf(t) + } + return t, ellipsis +} + +func (env *Env) evalTypeArray(node *ast.ArrayType) (t r.Type, ellipsis bool) { + t = env.evalType(node.Elt) + n := node.Len + switch n := n.(type) { + case *ast.Ellipsis: + t = r.SliceOf(t) + ellipsis = true + case nil: + t = r.SliceOf(t) + default: + count := env.evalExpr1(n).Int() + t = r.ArrayOf(int(count), t) + } + return t, ellipsis +} + +func (env *Env) evalTypeFunction(node *ast.FuncType) (t r.Type, argNames []string, resultNames []string) { + tFunc, _, argNames, resultNames := env.evalTypeFunctionOrMethod(nil, node) + return tFunc, argNames, resultNames +} + +func (env *Env) evalTypeFunctionOrMethod(recv *ast.Field, node *ast.FuncType) (tFunc r.Type, tFuncOrMethod r.Type, argNames []string, resultNames []string) { + argTypes, argNames, variadic := env.evalTypeFieldOrParamList(node.Params, true) + resultTypes, resultNames := env.evalTypeFields(node.Results) + tFunc = r.FuncOf(argTypes, resultTypes, variadic) + + if recv != nil { + recvTypes, recvNames, _ := env.evalTypeFieldsOrParams([]*ast.Field{recv}, false) + argTypes = append(recvTypes, argTypes...) + argNames = append(recvNames, argNames...) + tFuncOrMethod = r.FuncOf(argTypes, resultTypes, variadic) + } else { + tFuncOrMethod = tFunc + } + return tFunc, tFuncOrMethod, argNames, resultNames +} + +func (env *Env) evalTypeFields(fields *ast.FieldList) (types []r.Type, names []string) { + types, names, _ = env.evalTypeFieldOrParamList(fields, false) + return types, names +} + +func (env *Env) evalTypeFieldOrParamList(fields *ast.FieldList, allowEllipsis bool) (types []r.Type, names []string, ellipsis bool) { + var list []*ast.Field + if fields != nil { + list = fields.List + } + return env.evalTypeFieldsOrParams(list, allowEllipsis) +} + +func (env *Env) evalTypeFieldsOrParams(list []*ast.Field, allowEllipsis bool) (types []r.Type, names []string, ellipsis bool) { + types = make([]r.Type, 0) + names = ZeroStrings + n := len(list) + if n == 0 { + return types, names, ellipsis + } + var t r.Type + for i, f := range list { + t, ellipsis = env.evalType2(f.Type, i == n-1) + if len(f.Names) == 0 { + types = append(types, t) + names = append(names, "_") + // env.Debugf("evalTypeFields() %v -> %v", f.Type, t) + } else { + for _, ident := range f.Names { + types = append(types, t) + names = append(names, ident.Name) + // Debugf("evalTypeFields() %v %v -> %v", ident.Name, f.Type, t) + } + } + } + return types, names, ellipsis +} + +func (env *Env) evalTypeIdentifier(name string) r.Type { + for e := env; e != nil; e = e.Outer { + if t, ok := e.Types.Get(name); ok { + return t + } + } + env.Errorf("undefined identifier: %v", name) + return nil +} + +func makeStructFields(pkgPath string, names []string, types []r.Type) []r.StructField { + // pkgIdentifier := sanitizeIdentifier(pkgPath) + fields := make([]r.StructField, len(names)) + for i, name := range names { + fields[i] = r.StructField{ + Name: toExportedName(name), // Go 1.8 reflect.StructOf() supports *only* exported fields + Type: types[i], + Tag: "", + Anonymous: false, + } + } + return fields +} + +func toExportedName(name string) string { + if len(name) == 0 { + return name + } + ch := name[0] + if ch >= 'a' && ch <= 'z' { + ch -= 'a' - 'A' + } else if ch == '_' { + ch = 'X' + } else { + return name + } + return fmt.Sprintf("%c%s", ch, name[1:]) +} + +func (env *Env) valueToType(value r.Value, t r.Type) r.Value { + if value == None || value == Nil { + switch t.Kind() { + case r.Chan, r.Func, r.Interface, r.Map, r.Ptr, r.Slice: + return r.Zero(t) + } + } + newValue := ConvertValue(value, t) + if differentIntegerValues(value, newValue) { + env.Warnf("value %d overflows <%v>, truncated to %d", value, t, newValue) + } + return newValue +} + +func differentIntegerValues(v1 r.Value, v2 r.Value) bool { + k1, k2 := v1.Kind(), v2.Kind() + switch k1 { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + n1 := v1.Int() + switch k2 { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + return n1 != v2.Int() + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return n1 < 0 || uint64(n1) != v2.Uint() + default: + return false + } + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + n1 := v1.Uint() + switch k2 { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + n2 := v2.Int() + return n2 < 0 || uint64(n2) != n1 + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + return n1 != v2.Uint() + default: + return false + } + default: + return false + } +} + +func toValues(args []interface{}) []r.Value { + n := len(args) + values := make([]r.Value, n) + for i := 0; i < n; i++ { + values[i] = r.ValueOf(args[i]) + } + return values +} + +func toInterfaces(values []r.Value) []interface{} { + n := len(values) + rets := make([]interface{}, n) + for i := 0; i < n; i++ { + rets[i] = toInterface(values[i]) + } + return rets +} + +func toInterface(value r.Value) interface{} { + if value != Nil && value != None { + return value.Interface() + } + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/unaryexpr.go b/vendor/github.com/cosmos72/gomacro/classic/unaryexpr.go new file mode 100644 index 0000000..6d44819 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/unaryexpr.go @@ -0,0 +1,267 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * unaryexpr.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package classic + +import ( + "fmt" + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (env *Env) unsupportedUnaryExpr(xv r.Value, op token.Token) (r.Value, []r.Value) { + opstr := mt.String(op) + return env.Errorf("unsupported unary expression %s on <%v>: %s %v", opstr, typeOf(xv), opstr, xv) +} + +func (env *Env) warnOverflowSignedMinus(x interface{}, ret interface{}) { + str := fmt.Sprintf("%d", x) + if len(str) > 0 && str[0] == '-' { + str = str[1:] + } + env.Warnf("value %s overflows <%v>, result truncated to %d", str, r.TypeOf(x), ret) +} + +func (env *Env) warnUnderflowUnsignedMinus(x interface{}, ret interface{}) { + env.Warnf("value -%d underflows <%v>, result truncated to %d", x, r.TypeOf(x), ret) +} + +func (env *Env) evalUnaryExpr(node *ast.UnaryExpr) (r.Value, []r.Value) { + op := node.Op + switch op { + case token.AND: + place := env.evalExpr1(node.X) + if place == Nil || !place.CanAddr() { + return env.Errorf("cannot take the address of: %v = %v <%v>", node.X, place, typeOf(place)) + } + return place.Addr(), nil + + // the various QUOTE special forms, the result of macroexpansion, + // and our extension "block statement inside expression" are: + // a block statements, wrapped in a closure, wrapped in a unary expression "MACRO", i.e.: + // MACRO func() { /*block*/ } + case mt.MACRO: + block := node.X.(*ast.FuncLit).Body + return env.evalBlock(block) + + case mt.QUOTE: + block := node.X.(*ast.FuncLit).Body + ret := env.evalQuote(block) + return r.ValueOf(ret), nil + + case mt.QUASIQUOTE: + block := node.X.(*ast.FuncLit).Body + ret := env.evalQuasiquote(block) + return r.ValueOf(ret), nil + + case mt.UNQUOTE, mt.UNQUOTE_SPLICE: + return env.Errorf("%s not inside quasiquote: %v <%v>", mt.String(op), node, r.TypeOf(node)) + } + + xv, _ := env.EvalNode(node.X) + + if op == token.ADD { + switch xv.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64, + r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr, + r.Float32, r.Float64, r.Complex64, r.Complex128: + return xv, nil + default: + return env.unsupportedUnaryExpr(xv, op) + } + } + var ret interface{} + + switch xv.Kind() { + case r.Bool: + if op == token.NOT { + ret = !xv.Bool() + } + case r.Int: + x := int(xv.Int()) + switch op { + case token.SUB: + ret = -x + if x == -x && x != 0 { + env.warnOverflowSignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Int8: + x := int8(xv.Int()) + switch op { + case token.SUB: + ret = -x + if x == -x && x != 0 { + env.warnOverflowSignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Int16: + x := int16(xv.Int()) + switch op { + case token.SUB: + ret = -x + if x == -x && x != 0 { + env.warnOverflowSignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Int32: + x := int32(xv.Int()) + switch op { + case token.SUB: + ret = -x + if x == -x && x != 0 { + env.warnOverflowSignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Int64: + x := xv.Int() + switch op { + case token.SUB: + ret = -x + if x == -x && x != 0 { + env.warnOverflowSignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uint: + x := uint(xv.Uint()) + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uint8: + x := uint8(xv.Uint()) + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uint16: + x := uint16(xv.Uint()) + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uint32: + x := uint32(xv.Uint()) + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uint64: + x := xv.Uint() + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Uintptr: + x := uintptr(xv.Uint()) + switch op { + case token.SUB: + ret = -x + if x != 0 { + env.warnUnderflowUnsignedMinus(x, ret) + } + case token.XOR: + ret = ^x + } + case r.Float32: + x := float32(xv.Float()) + switch op { + case token.SUB: + ret = -x + } + case r.Float64: + x := xv.Float() + switch op { + case token.SUB: + ret = -x + } + case r.Complex64: + x := complex64(xv.Complex()) + switch op { + case token.SUB: + ret = -x + } + case r.Complex128: + x := xv.Complex() + switch op { + case token.SUB: + ret = -x + } + case r.Chan: + switch op { + case token.ARROW: + ret, ok := xv.Recv() + return ret, []r.Value{ret, r.ValueOf(ok)} + } + } + if ret == nil { + return env.unsupportedUnaryExpr(xv, op) + } + retv := r.ValueOf(ret) + xt := xv.Type() + if retv.Type() != xt { + retv = retv.Convert(xt) + } + return retv, nil +} diff --git a/vendor/github.com/cosmos72/gomacro/classic/x_package.go b/vendor/github.com/cosmos72/gomacro/classic/x_package.go new file mode 100644 index 0000000..c8961b5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/classic/x_package.go @@ -0,0 +1,45 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/classic" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package classic + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/classic" +func init() { + imports.Packages["github.com/cosmos72/gomacro/classic"] = imports.Package{ + Binds: map[string]r.Value{ + "MultiThread": r.ValueOf(MultiThread), + "New": r.ValueOf(New), + "NewEnv": r.ValueOf(NewEnv), + "NewThreadGlobals": r.ValueOf(NewThreadGlobals), + "NilEnv": r.ValueOf(&NilEnv).Elem(), + }, Types: map[string]r.Type{ + "BindMap": r.TypeOf((*BindMap)(nil)).Elem(), + "CallFrame": r.TypeOf((*CallFrame)(nil)).Elem(), + "CallStack": r.TypeOf((*CallStack)(nil)).Elem(), + "Constructor": r.TypeOf((*Constructor)(nil)).Elem(), + "Env": r.TypeOf((*Env)(nil)).Elem(), + "Error_builtin": r.TypeOf((*Error_builtin)(nil)).Elem(), + "Function": r.TypeOf((*Function)(nil)).Elem(), + "Inspector": r.TypeOf((*Inspector)(nil)).Elem(), + "Interface": r.TypeOf((*Interface)(nil)).Elem(), + "Interp": r.TypeOf((*Interp)(nil)).Elem(), + "Macro": r.TypeOf((*Macro)(nil)).Elem(), + "Methods": r.TypeOf((*Methods)(nil)).Elem(), + "ThreadGlobals": r.TypeOf((*ThreadGlobals)(nil)).Elem(), + "TypeMap": r.TypeOf((*TypeMap)(nil)).Elem(), + "TypedValue": r.TypeOf((*TypedValue)(nil)).Elem(), + }, Untypeds: map[string]string{ + "MultiThread": "bool:true", + }, Wrappers: map[string][]string{ + "Env": []string{"CollectAst", "CollectNode", "CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "ImportPackage", "IncLine", "IncLineBytes", "Init", "LookupPackage", "ObjMethodByName", "ParseBytes", "Position", "ShowHelp", "Sprintf", "ToString", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + "Interp": []string{"AsPackage", "CallerFrame", "ChangePackage", "ClassicEval", "CollectAst", "CollectNode", "CollectPackageImports", "Copy", "CurrentFrame", "Debugf", "DefineConst", "DefineFunc", "DefineVar", "Error", "Errorf", "Eval", "Eval1", "EvalAst", "EvalAst1", "EvalNode", "EvalNode1", "FastEval", "FileEnv", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "ImportPackage", "IncLine", "IncLineBytes", "Init", "Inspect", "LookupPackage", "MacroExpand", "MacroExpand1", "MacroExpandAstCodewalk", "MacroExpandCodewalk", "MergePackage", "ObjMethodByName", "Parse", "ParseBytes", "ParseOnly", "Position", "ReadMultiline", "ShowHelp", "ShowPackage", "Sprintf", "ToString", "TopEnv", "ValueOf", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + "ThreadGlobals": []string{"CollectAst", "CollectNode", "CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "ImportPackage", "IncLine", "IncLineBytes", "Init", "LookupPackage", "ParseBytes", "Position", "Sprintf", "ToString", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/cmd.go b/vendor/github.com/cosmos72/gomacro/cmd.go new file mode 100644 index 0000000..b1ac41f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/cmd.go @@ -0,0 +1,300 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * cmd.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package main + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "strings" + + . "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/classic" +) + +type Cmd struct { + *classic.Interp + WriteDeclsAndStmtsToFile, OverwriteFiles bool +} + +func (cmd *Cmd) Init() { + cmd.Interp = classic.New() + cmd.ParserMode = 0 + cmd.Options = OptTrapPanic | OptShowPrompt | OptShowEval | OptShowEvalType // | OptShowAfterMacroExpansion // | OptDebugMacroExpand // | OptDebugQuasiquote // | OptShowEvalDuration // | OptShowAfterParse + cmd.WriteDeclsAndStmtsToFile = false + cmd.OverwriteFiles = false +} + +func (cmd *Cmd) Main(args []string) (err error) { + if cmd.Interp == nil { + cmd.Init() + } + ir := cmd.Interp + env := cmd.Env + + var set, clear Options + var repl = true + cmd.WriteDeclsAndStmtsToFile = false + cmd.OverwriteFiles = false + + for len(args) > 0 { + switch args[0] { + case "-c", "--collect": + env.Options |= OptCollectDeclarations | OptCollectStatements + case "-e", "--expr": + if len(args) > 1 { + repl = false + buf := bytes.NewBufferString(args[1]) + buf.WriteByte('\n') // because ReadMultiLine() needs a final '\n' + env.Options |= OptShowEval // set by default, overridden by -s, -v and -vv + env.Options = (env.Options | set) &^ clear + _, err := cmd.EvalReader(buf) + if err != nil { + return err + } + args = args[1:] + } + case "-f", "--force-overwrite": + cmd.OverwriteFiles = true + case "-h", "--help": + return cmd.Usage() + case "-i", "--repl": + repl = false + env.Options |= OptShowPrompt | OptShowEval | OptShowEvalType // set by default, overridden by -s, -v and -vv + env.Options = (env.Options | set) &^ clear + ir.ReplStdin() + + case "-m", "--macro-only": + set |= OptMacroExpandOnly + clear &^= OptMacroExpandOnly + case "-n", "--no-trap": + set &^= OptTrapPanic | OptPanicStackTrace + clear |= OptTrapPanic | OptPanicStackTrace + case "-t", "--trap": + set |= OptTrapPanic | OptPanicStackTrace + clear &= OptTrapPanic | OptPanicStackTrace + case "-s", "--silent": + set &^= OptShowEval | OptShowEvalType + clear |= OptShowEval | OptShowEvalType + case "-v", "--verbose": + set = (set | OptShowEval) &^ OptShowEvalType + clear = (clear &^ OptShowEval) | OptShowEvalType + case "-vv", "--very-verbose": + set |= OptShowEval | OptShowEvalType + clear &^= OptShowEval | OptShowEvalType + case "-w", "--write-decls": + cmd.WriteDeclsAndStmtsToFile = true + case "-x", "--exec": + clear |= OptMacroExpandOnly + set &^= OptMacroExpandOnly + default: + arg := args[0] + if len(arg) > 0 && arg[0] == '-' { + fmt.Fprintf(env.Stderr, "gomacro: unrecognized option '%s'.\nTry 'gomacro --help' for more information\n", arg) + return nil + } + repl = false + if cmd.WriteDeclsAndStmtsToFile { + env.Options |= OptCollectDeclarations | OptCollectStatements + } + env.Options &^= OptShowPrompt | OptShowEval | OptShowEvalType // cleared by default, overridden by -s, -v and -vv + env.Options = (env.Options | set) &^ clear + cmd.EvalFileOrDir(arg) + + env.Imports, env.Declarations, env.Statements = nil, nil, nil + } + args = args[1:] + } + if repl { + env.Options |= OptShowPrompt | OptShowEval | OptShowEvalType // set by default, overridden by -s, -v and -vv + env.Options = (env.Options | set) &^ clear + ir.ReplStdin() + } + return nil +} + +func (cmd *Cmd) Usage() error { + fmt.Fprint(cmd.Env.Stdout, `usage: gomacro [OPTIONS] [files-and-dirs] + + Recognized options: + -c, --collect collect declarations and statements, to print them later + -e, --expr EXPR evaluate expression + -f, --force-overwrite option -w will overwrite existing files + -h, --help show this help and exit + -i, --repl interactive. start a REPL after evaluating expression, files and dirs. + default: start a REPL only if no expressions, files or dirs are specified + -m, --macro-only do not execute code, only parse and macroexpand it. + useful to run gomacro as a Go preprocessor + -n, --no-trap do not trap panics in the interpreter + -t, --trap trap panics in the interpreter (default) + -s, --silent silent. do NOT show startup message, prompt, and expressions results. + default when executing files and dirs. + -v, --verbose verbose. show startup message, prompt, and expressions results. + default when executing an expression. + -vv, --very-verbose as -v, and in addition show the type of expressions results. + default when executing a REPL + -w, --write-decls write collected declarations and statements to *.go files. + implies -c + -x, --exec execute parsed code (default). disabled by -m + + Options are processed in order, except for -i that is always processed as last. + + Collected declarations and statements can be also written to standard output + or to a file with the REPL command :write +`) + return nil +} + +func (cmd *Cmd) EvalFilesAndDirs(filesAndDirs ...string) error { + for _, fileOrDir := range filesAndDirs { + err := cmd.EvalFileOrDir(fileOrDir) + if err != nil { + return err + } + } + return nil +} + +func (cmd *Cmd) EvalFileOrDir(fileOrDir string) error { + info, err := os.Stat(fileOrDir) + if err != nil { + return err + } + if info.IsDir() { + return cmd.EvalDir(fileOrDir) + } else { + return cmd.EvalFile(fileOrDir) + } +} + +func (cmd *Cmd) EvalDir(dirname string) error { + files, err := ioutil.ReadDir(dirname) + if err != nil { + return err + } + for _, file := range files { + filename := file.Name() + if !file.IsDir() && strings.HasSuffix(filename, ".gomacro") { + filename = fmt.Sprintf("%s%c%s", dirname, os.PathSeparator, filename) + err := cmd.EvalFile(filename) + if err != nil { + return err + } + } + } + return nil +} + +// use line comments for disclaimer: block comments prevent Go build tags from working +const disclaimer = `// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +` + +func (cmd *Cmd) EvalFile(filename string) (err error) { + env := cmd.Env + env.Declarations = nil + env.Statements = nil + saveFilename := env.Filename + + f, err := os.Open(filename) + if err != nil { + return err + } + defer func() { + f.Close() + env.Filename = saveFilename + }() + env.Filename = filename + var comments string + comments, err = cmd.EvalReader(f) + if err != nil { + return err + } + + if cmd.WriteDeclsAndStmtsToFile { + outname := filename + if dot := strings.LastIndexByte(outname, '.'); dot >= 0 { + // sanity check: dot must be in the file name, NOT in its path + if slash := strings.LastIndexByte(outname, os.PathSeparator); slash < dot { + outname = outname[0:dot] + } + } + outname += ".go" + if !cmd.OverwriteFiles { + _, err := os.Stat(outname) + if err == nil { + env.Warnf("file exists already, use -f to force overwriting: %v", outname) + return nil + } + } + env.WriteDeclsToFile(outname, disclaimer, comments) + + if env.Options&OptShowEval != 0 { + fmt.Fprintf(env.Stdout, "// processed file: %v\t-> %v\n", filename, outname) + } + } + return nil +} + +func (cmd *Cmd) EvalReader(src io.Reader) (comments string, err error) { + defer func() { + if rec := recover(); rec != nil { + switch rec := rec.(type) { + case error: + err = rec + default: + err = errors.New(fmt.Sprint(rec)) + } + } + }() + in := bufio.NewReader(src) + ir := cmd.Interp + env := ir.Env + env.Options &^= OptShowPrompt // parsing a file: suppress prompt + env.Line = 0 + + // perform the first iteration manually, to collect comments + str, firstToken := env.ReadMultiline(in, ReadOptCollectAllComments) + if firstToken >= 0 { + comments = str[0:firstToken] + if firstToken > 0 { + str = str[firstToken:] + env.IncLine(comments) + } + } + if ir.ParseEvalPrint(str, in) { + for ir.ReadParseEvalPrint(in) { + } + } + return comments, nil +} diff --git a/vendor/github.com/cosmos72/gomacro/doc/quasiquote.md b/vendor/github.com/cosmos72/gomacro/doc/quasiquote.md new file mode 100644 index 0000000..f81c99a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/doc/quasiquote.md @@ -0,0 +1,268 @@ +Quasiquote +========== + +implementing quasiquote, unquote and unquote_splice in Go +-------------------------------------------------------- + +One of the main motivations behind the creation of Go interpreter `gomacro` +was to add Lisp-like macros to Go. + +This includes implementing Common Lisp `quote`, `quasiquote` and, more crucially, +`unquote` and `unquote_splice` i.e. Common Lisp macro characters `'` `` ` `` `,` and `,@` + +Since Go language is not homoiconic, i.e. (source) code and (program) data +are not represented identically, this is a challenge. + +### Parser ### + +The first (moderate) difficulty is adding support for `'` `` ` `` `,` and `,@` to Go parser. +It was solved by forking Go standard packages https://golang.org/pkg/go/scanner/ +and https://golang.org/pkg/go/parser/ and patching them. + +Characters `'` `` ` `` and `,` are already reserved in Go, +so the author decided to replace them as follows: +* quote `'` must be written `~'` +* quasiquote `` ` `` must be written `~"` (not ``~` `` because the latter messes up syntax hilighting in Go-aware editors and IDEs - starts a multiline raw string) +* unquote `,` must be written `~,` +* unquote_splice `,@` must be written `~,@` + +the prefix `~` is configurabile when manually instantiating the modified parser. + +Go parser produces as output an abstract syntax tree (AST) represented as a tree of `ast.Node`, +from the standard package https://golang.org/pkg/go/ast/ + +Defining new node types is deliberately impossible (`ast.Node` is an interface with unexported methods), +luckily the existing types are flexible enough to accommodate the new syntax. + +The chosen representation is somewhat cumbersome but fully general: newly created constants `token.QUOTE`, `token.QUASIQUOTE`, +`token.UNQUOTE` and `token.UNQUOTE_SPLICE` are used as unary operators on a fictitious closure containing the quoted code. +Examples: +* `'x` must be written `~'x` and is parsed as if written `~' func() { x }` +* `` `{x = y}`` must be written `~"{x = y}` and is parsed as if written `~" func() { x = y }` +* `,{1 + 2}` must be written `~,{1 + 2}` and is parsed as if written `~, func() { 1 + 2 }` +* `,@{foo()}` must be written `~,@{foo()}` and is parsed as if written `~,@ func() { foo() }` + +The fictitious closures are necessary because `ast.UnaryExpr` only allows an expression as its operand - not arbitrary +statements or declarations. +In Go, the only expression that can contain arbitrary statements and declarations is a closure (in Go terms, a "function literal") + +### Classic interpreter ### + +`gomacro` contains two interpreters: "classic" and "fast". + +The classic interpreter is compact (about 5k LOC) and directly executes the AST, producing `reflect.Value` objects as output. +It is also quite slow (1000-3000 times slower than compiled Go), due to the overhead of continuously dispatching on the type +and contents of `ast.Node` and working with `reflect.Value` instead of native Go types. + +One significant advantage of directly executing the AST is the simplicity of quasiquote implementation: +it visits depth-first the whole AST, looking for `ast.UnaryExpr` whose operator is `token.QUOTE`, `token.QUASIQUOTE`, +`token.UNQUOTE` or `token.UNQUOTE_SPLICE`, and performs the corresponding operation (either return the quoted code literally or evaluate it) +while keeping track of the current quasiquotation depth (the number of entered `~"` minus the number of entered `~,` and `~,@`) + +### Fast interpreter ### + +#### Architecture #### + +The second, "fast" interpreter included in `gomacro` is more sophisticated. Instead of directly executing the AST, +it splits the execution in two phases: +1. visits the AST depth-first and "compiles" i.e. transforms it into tree of closures - one for each expression to be executed. + For example, `a + b` causes the interpreter to execute something like: + ``` + var a = compile("a").(func(env *Env) int) + var b = compile("b").(func(env *Env) int) + var sum_ab = func(env *Env) int { + return a(env) + b(env) + } + ``` + which creates a closure that, when later executed, computes `a + b`. + The fast interpreter also performs type checking and type inference while "compiling" this tree of closures. + + Statements (including declarations) are "compiled", i.e. transformed, a bit differently: each one becomes + a closure executing the statement in the interpreter, and returning the next closure to be executed. + For example, `if x { foo() } else { bar() }` causes the interpreter to execute something like: + ``` + var x = compile("x").(func(env *Env) bool) + var foo = compile("foo").(func(env *Env) func()) + var bar = compile("bar").(func(env *Env) func()) + var ip_then, ip_else, ip_finish int // will be set below + Code.Append(func(env *Env) (Stmt, *Env) { + var ip int + if x(env) { + ip = ip_then // goto ip_then + } else { + ip = ip_else // goto ip_else + } + env.Code.IP = ip + return env.Code[ip], env + }) + ip_then = Code.Len() + Code.Append(func(env *Env) (Stmt, *Env) { + foo(env)() + env.Code.IP = ip_finish // goto ip_finish i.e. skip else branch + return env.Code[ip_finish], env + }) + ip_else = Code.Len() + Code.Append(func(env *Env) (Stmt, *Env) { + bar(env)() + env.Code.IP = ip_finish // can also be written env.Code.IP++ + return env.Code[ip_finish], env + }) + ip_finish = Code.Len() + ``` + which creates a list of closures that, when later executed, computes `if x { foo() } else { bar() }`. + + Note the extensive use of closures, i.e. anonymous functions that access **mutable** variables + of the surrounding scope: in this case, `x` `foo` `bar` `ip_then` `ip_else` and `ip_finish`. + +2) executes the "compiled" code, i.e. calls the created closures + +"fast" interpreter also uses native Go types where possible, to further speed up execution +and reduce the reliance on `reflect.Value` and the overhead it imposes. + +The result is a much larger interpreter: +* 20k LOC written manually +* plus further 80k LOC, generated from 8k LOC of macros, by using the "classic" interpreter and its quote, + quasiquote and macros as a code generation tool + +It is also significantly faster than the "classic" interpreter: +on most microbenchmarks, "fast" interpreter is 10-100 times slower than compiled code, instead of 1000-3000 times slower. + +Interestingly, the "fast" interpreter appears to be faster than [python](https://www.python.org/) at least +on the fibonacci and collatz microbenchmarks - see [examples](../examples/) + +#### Quasiquotation difficulties #### + +The main difficulty in implementing quasiquotation in the "fast" interpreter is the "compile" phase: +code containing quasiquote must be type checked, and code fragments that must be evaluated should be transformed +into closures returning the result of evaluation. This is a problem similar to what Common Lisp compilers face +when compiling quasiquotations, with the difference that Go is not homoiconic. + +In practice, the lack of homoiconicity means that standard textbook quasiquotation algorithms for Common Lisp +are not directly applicable to Go. Some examples will clarify this last statement: + +In Common Lisp the textbook quasiquotation algorithms, as for example http://www.lispworks.com/documentation/HyperSpec/Body/02_df.htm +recursively visit the input AST, producing an output AST that does **not** contain `` ` `` `,` or `,@` +at the price of typically producing output significantly different from the input. Examples: + +* `` `(+ x ,y)`` is typically expanded to the equivalent source code: `(list '+ 'x y)` - to verify it, try ``(macroexpand '`(+ x ,y))`` in a Common Lisp REPL +* `` `(x ,y)`` is typically expanded to the equivalent `(list 'x y)` +* `` `(x ,@y)`` is typically expanded to the equivalent `(list* 'x y)` +* `` `(x ,@y ,@z)`` is typically expanded to the equivalent `(list* 'x (append y z))` +* and so on... + +#### First approach: quasiquotation is source transformation #### + +Any attempt to translate (almost) one-to-one the same algorithm in Go, and thus also the resulting examples, +would create an algorithm able to perform the following expansions: + +* `~"{x + ,y}` would be expanded to the equivalent source code: `&ast.BinaryExpr{Op: token.ADD, X: &ast.BasicLit{Name: "x"}, Y: y}` + i.e. an ast.Node representing addition between a literal "x" and an ast.Expr equal to the result of evaluating y +* `~"{x; ,y}` would be expanded to the source code: `[]ast.Stmt{&ast.ExprStmt{X: &ast.BasicLit{Name: "x"}}, y}` + i.e. a list of two ast.Stmt: a literal "x" wrapped in a statement, and an ast.Stmt equal to the result of evaluating y. +* `~"{x; ,@y}` would be expanded to the source code: `append([]ast.Stmt{&ast.ExprStmt{X: &ast.BasicLit{Name: "x"}}}, y...)` + where y must be an expression that, once type-checked and transformed into a closure, will return a []ast.Stmt +* `~"{x; ,@y; ,@z}` would be expanded to the source code: `append(append([]ast.Stmt{&ast.ExprStmt{X: &ast.BasicLit{Name: "x"}}}, y...), z...)` + where x and y must be expressions that, once type-checked and transformed into closures, will return []ast.Stmt + +Note the differences between the various expansions, and the dependency on "go/ast" package of the expanded source code. + +Some possible simplifications are: +1. allow `~'` in the expanded source code +2. work on `ast2.Ast` instead of `ast.Node` and the dozens of concrete types + implementing `ast.Node`: the formers is an `ast.Node` wrapper with an uniform API that greatly simplifies + manipulating Go abstract syntax trees. +3. implement dedicated functions and methods operating on `ast2.Ast`: `Quote`, `Unquote`, `Init`, `Concat` + and whatever else is needed to simplify the expansion + +* `~"{x + ~,y}` would be expanded to the equivalent source code: `in.New().Init(~'x, y)` + where `in` is an `ast2.Ast` containing `~"{x + ~,y}` +* `~"{x; ~,y}` would be expanded to the source code: `in.New().Init(~'x, y)` + where `in` is an `ast2.Ast` containing `~"{x; ~,y}` +* `~"{x; ~,@y}` would be expanded to the source code: `in.New().Init(~'x).Concat(y)` + where `in` is an `ast2.Ast` containing `~"{x; ~,@y}` +* `~"{x; ~,@y; ~,@z}` would be expanded to the source code: `in.New().Init(~'x).Concat(y).Concat(z)` + where `in` is an `ast2.Ast` containing `~"{x; ~,@y; ~,@z}` + +Even with such simplifications, this first approach looks tricky to implement correctly in all cases, +and also fragile: expanded source code depends on external libraries, which could be shadowed or unavailable. + +#### Second approach: quasiquotation merged with compile #### + +Since quasiquotation must be executed on the output of macroexpansion (quasiquote could be even considered a macro), +it is the last phase before "compile" i.e. before transformation of source code to a tree of closures. + +Thus an alternative approach is to merge quasiquotation with the compile phase: +while transforming AST nodes to closures, the "fast" interpreter could detect quasiquotes +and expand them - possibly not to source code, but directly to a tree of closures. + +In other words, quasiquotation could directly produce executable code, without going through +the intermediate phase of expanding it to source code. + +Is it easier to implement and/or more robust? Let's see. + +* `~"{x + ~,y}` would be transformed into a closure, by executing something like (`node` is an `ast.Node` + containing `~"{x + ~,y}`): + ``` + var x = quasiquote(node.X).(func(*Env) reflect.Value) // compile to a closure that returns a copy of the &ast.BasicLit wrapped in reflect.Value + var y = compile("y").(func (*Env) reflect.Value) // compile to a closure that returns an ast.Node wrapped in reflect.Value + var in = ToAst(node) // wrap into ast2.Ast + var form = in.New() // empty ast2.Ast with same type, operator and source position as 'in' + + var closure = func(env *Env) ast.Node { + var out = form.New() // create a new, empty ast2.Ast at each invokation + var xform = ToAst(x(env).Interface()) + var yform = ToAst(y(env).Interface()) + + out.Set(0, xform) + out.Set(1, yform) + return ToNode(out) + } + ``` +* `~"{x; ~,y}` would be transformed into a closure, by executing something like (`node` is an `ast.Node` + containing `~"{x; ~,y}`): + ``` + var x = quasiquote(node.X).(func(*Env) reflect.Value) // compile to a closure that returns a copy of the &ast.BasicLit wrapped in reflect.Value + var y = compile("y").(func (env *Env) reflect.Value) // compile to a closure that returns ast.Node wrapped in reflect.Value + var in = ToAst(node) // wrap into ast2.Ast + var form = in.New() // empty ast2.Ast with same type, operator and source position as 'in' + + var closure = func(env *Env) ast.Node { + var out = form.New() // create a new, empty ast2.Ast at each invokation + var xform = ToAst(x(env).Interface()) + var yform = ToAst(y(env).Interface()) + + out.Append(xform) + out.Append(yform) + return ToNode(out) + } + ``` +* `~"{x; ~,@y}` would be transformed into a closure, by executing something like (`node` is an `ast.Node` + containing `~"{x; ~,@y}`): + ``` + var x = quasiquote(node.X).(func(*Env) reflect.Value) // compile to a closure that returns a copy of the &ast.BasicLit wrapped in reflect.Value + var y = compile("y").(func (env *Env) reflect.Value) // compile to a closure that returns ast.Node wrapped in reflect.Value + var in = ToAst(node) // wrap into ast2.Ast + var form = in.New() // empty ast2.Ast with same type, operator and source position as 'in' + + var closure = func(env *Env) ast.Node { + var out = form.New() // create a new, empty ast2.Ast at each invokation + var xform = ToAst(x(env).Interface()) + var yform = ToAst(y(env).Interface()) + + out.Append(xform) + for i := 0; i < y.Len(); i++ { + out.Append(y.Get(i)) + } + return ToNode(out) + } + ``` + +While the above looks somewhat complicated, it changes very little from one case to the other, +and it is actually the **implementation** of quasiquote, not its output! + +Such implementation depends on `ast2.Ast` and related functions, but it will be part of the interpreter +itself - which already has such dependency - while macroexpanded source code would remain free of such dependencies. + +It seems this second approach only has advantages... the only evident disadvantage is the lack +of user-available mechanisms to expand quasiquotations, i.e. an eventual "Macroexpand" function +available at the REPL and to interpreted code, would **not** expand quasiquotes. diff --git a/vendor/github.com/cosmos72/gomacro/example/arith.gomacro b/vendor/github.com/cosmos72/gomacro/example/arith.gomacro new file mode 100755 index 0000000..de9bf48 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/arith.gomacro @@ -0,0 +1,11 @@ +#!/usr/bin/env gomacro + +func BenchmarkArith(n int) int { + total := 0 + for i := 0; i < n; i++ { + total += ((n*2+3)&4 | 5 ^ 6) / (n | 1) + } + return total +} + +println(BenchmarkArith(1000000)) diff --git a/vendor/github.com/cosmos72/gomacro/example/bag.go.easyjson b/vendor/github.com/cosmos72/gomacro/example/bag.go.easyjson new file mode 100644 index 0000000..feeddac --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/bag.go.easyjson @@ -0,0 +1,830 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package main + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples(in *jlexer.Lexer, out *Box) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "B": + if in.IsNull() { + in.Skip() + out.B = nil + } else { + in.Delim('[') + if out.B == nil { + if !in.IsDelim(']') { + out.B = make([]bool, 0, 64) + } else { + out.B = []bool{} + } + } else { + out.B = (out.B)[:0] + } + for !in.IsDelim(']') { + var v1 bool + v1 = bool(in.Bool()) + out.B = append(out.B, v1) + in.WantComma() + } + in.Delim(']') + } + case "I": + if in.IsNull() { + in.Skip() + out.I = nil + } else { + in.Delim('[') + if out.I == nil { + if !in.IsDelim(']') { + out.I = make([]int, 0, 8) + } else { + out.I = []int{} + } + } else { + out.I = (out.I)[:0] + } + for !in.IsDelim(']') { + var v2 int + v2 = int(in.Int()) + out.I = append(out.I, v2) + in.WantComma() + } + in.Delim(']') + } + case "I8": + if in.IsNull() { + in.Skip() + out.I8 = nil + } else { + in.Delim('[') + if out.I8 == nil { + if !in.IsDelim(']') { + out.I8 = make([]int8, 0, 64) + } else { + out.I8 = []int8{} + } + } else { + out.I8 = (out.I8)[:0] + } + for !in.IsDelim(']') { + var v3 int8 + v3 = int8(in.Int8()) + out.I8 = append(out.I8, v3) + in.WantComma() + } + in.Delim(']') + } + case "I16": + if in.IsNull() { + in.Skip() + out.I16 = nil + } else { + in.Delim('[') + if out.I16 == nil { + if !in.IsDelim(']') { + out.I16 = make([]int16, 0, 32) + } else { + out.I16 = []int16{} + } + } else { + out.I16 = (out.I16)[:0] + } + for !in.IsDelim(']') { + var v4 int16 + v4 = int16(in.Int16()) + out.I16 = append(out.I16, v4) + in.WantComma() + } + in.Delim(']') + } + case "I32": + if in.IsNull() { + in.Skip() + out.I32 = nil + } else { + in.Delim('[') + if out.I32 == nil { + if !in.IsDelim(']') { + out.I32 = make([]int32, 0, 16) + } else { + out.I32 = []int32{} + } + } else { + out.I32 = (out.I32)[:0] + } + for !in.IsDelim(']') { + var v5 int32 + v5 = int32(in.Int32()) + out.I32 = append(out.I32, v5) + in.WantComma() + } + in.Delim(']') + } + case "I64": + if in.IsNull() { + in.Skip() + out.I64 = nil + } else { + in.Delim('[') + if out.I64 == nil { + if !in.IsDelim(']') { + out.I64 = make([]int64, 0, 8) + } else { + out.I64 = []int64{} + } + } else { + out.I64 = (out.I64)[:0] + } + for !in.IsDelim(']') { + var v6 int64 + v6 = int64(in.Int64()) + out.I64 = append(out.I64, v6) + in.WantComma() + } + in.Delim(']') + } + case "U": + if in.IsNull() { + in.Skip() + out.U = nil + } else { + in.Delim('[') + if out.U == nil { + if !in.IsDelim(']') { + out.U = make([]uint, 0, 8) + } else { + out.U = []uint{} + } + } else { + out.U = (out.U)[:0] + } + for !in.IsDelim(']') { + var v7 uint + v7 = uint(in.Uint()) + out.U = append(out.U, v7) + in.WantComma() + } + in.Delim(']') + } + case "U8": + if in.IsNull() { + in.Skip() + out.U8 = nil + } else { + out.U8 = in.Bytes() + } + case "U16": + if in.IsNull() { + in.Skip() + out.U16 = nil + } else { + in.Delim('[') + if out.U16 == nil { + if !in.IsDelim(']') { + out.U16 = make([]uint16, 0, 32) + } else { + out.U16 = []uint16{} + } + } else { + out.U16 = (out.U16)[:0] + } + for !in.IsDelim(']') { + var v9 uint16 + v9 = uint16(in.Uint16()) + out.U16 = append(out.U16, v9) + in.WantComma() + } + in.Delim(']') + } + case "U32": + if in.IsNull() { + in.Skip() + out.U32 = nil + } else { + in.Delim('[') + if out.U32 == nil { + if !in.IsDelim(']') { + out.U32 = make([]uint32, 0, 16) + } else { + out.U32 = []uint32{} + } + } else { + out.U32 = (out.U32)[:0] + } + for !in.IsDelim(']') { + var v10 uint32 + v10 = uint32(in.Uint32()) + out.U32 = append(out.U32, v10) + in.WantComma() + } + in.Delim(']') + } + case "U64": + if in.IsNull() { + in.Skip() + out.U64 = nil + } else { + in.Delim('[') + if out.U64 == nil { + if !in.IsDelim(']') { + out.U64 = make([]uint64, 0, 8) + } else { + out.U64 = []uint64{} + } + } else { + out.U64 = (out.U64)[:0] + } + for !in.IsDelim(']') { + var v11 uint64 + v11 = uint64(in.Uint64()) + out.U64 = append(out.U64, v11) + in.WantComma() + } + in.Delim(']') + } + case "S": + if in.IsNull() { + in.Skip() + out.S = nil + } else { + in.Delim('[') + if out.S == nil { + if !in.IsDelim(']') { + out.S = make([]string, 0, 4) + } else { + out.S = []string{} + } + } else { + out.S = (out.S)[:0] + } + for !in.IsDelim(']') { + var v12 string + v12 = string(in.String()) + out.S = append(out.S, v12) + in.WantComma() + } + in.Delim(']') + } + case "Any": + if in.IsNull() { + in.Skip() + out.Any = nil + } else { + in.Delim('[') + if out.Any == nil { + if !in.IsDelim(']') { + out.Any = make([]interface{}, 0, 4) + } else { + out.Any = []interface{}{} + } + } else { + out.Any = (out.Any)[:0] + } + for !in.IsDelim(']') { + var v13 interface{} + if m, ok := v13.(easyjson.Unmarshaler); ok { + m.UnmarshalEasyJSON(in) + } else if m, ok := v13.(json.Unmarshaler); ok { + m.UnmarshalJSON(in.Raw()) + } else { + v13 = in.Interface() + } + out.Any = append(out.Any, v13) + in.WantComma() + } + in.Delim(']') + } + case "Bag": + if in.IsNull() { + in.Skip() + out.Bag = nil + } else { + in.Delim('[') + if out.Bag == nil { + if !in.IsDelim(']') { + out.Bag = make([]*Bag, 0, 8) + } else { + out.Bag = []*Bag{} + } + } else { + out.Bag = (out.Bag)[:0] + } + for !in.IsDelim(']') { + var v14 *Bag + if in.IsNull() { + in.Skip() + v14 = nil + } else { + if v14 == nil { + v14 = new(Bag) + } + (*v14).UnmarshalEasyJSON(in) + } + out.Bag = append(out.Bag, v14) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples(out *jwriter.Writer, in Box) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"B\":") + if in.B == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v15, v16 := range in.B { + if v15 > 0 { + out.RawByte(',') + } + out.Bool(bool(v16)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I\":") + if in.I == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v17, v18 := range in.I { + if v17 > 0 { + out.RawByte(',') + } + out.Int(int(v18)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I8\":") + if in.I8 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v19, v20 := range in.I8 { + if v19 > 0 { + out.RawByte(',') + } + out.Int8(int8(v20)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I16\":") + if in.I16 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v21, v22 := range in.I16 { + if v21 > 0 { + out.RawByte(',') + } + out.Int16(int16(v22)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I32\":") + if in.I32 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v23, v24 := range in.I32 { + if v23 > 0 { + out.RawByte(',') + } + out.Int32(int32(v24)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I64\":") + if in.I64 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v25, v26 := range in.I64 { + if v25 > 0 { + out.RawByte(',') + } + out.Int64(int64(v26)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U\":") + if in.U == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v27, v28 := range in.U { + if v27 > 0 { + out.RawByte(',') + } + out.Uint(uint(v28)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U8\":") + out.Base64Bytes(in.U8) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U16\":") + if in.U16 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v31, v32 := range in.U16 { + if v31 > 0 { + out.RawByte(',') + } + out.Uint16(uint16(v32)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U32\":") + if in.U32 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v33, v34 := range in.U32 { + if v33 > 0 { + out.RawByte(',') + } + out.Uint32(uint32(v34)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U64\":") + if in.U64 == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v35, v36 := range in.U64 { + if v35 > 0 { + out.RawByte(',') + } + out.Uint64(uint64(v36)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"S\":") + if in.S == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v37, v38 := range in.S { + if v37 > 0 { + out.RawByte(',') + } + out.String(string(v38)) + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"Any\":") + if in.Any == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v39, v40 := range in.Any { + if v39 > 0 { + out.RawByte(',') + } + if m, ok := v40.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := v40.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(v40)) + } + } + out.RawByte(']') + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"Bag\":") + if in.Bag == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v41, v42 := range in.Bag { + if v41 > 0 { + out.RawByte(',') + } + if v42 == nil { + out.RawString("null") + } else { + (*v42).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Box) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Box) MarshalEasyJSON(w *jwriter.Writer) { + easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Box) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Box) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples(l, v) +} +func easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples1(in *jlexer.Lexer, out *Bag) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "B": + out.B = bool(in.Bool()) + case "I": + out.I = int(in.Int()) + case "I8": + out.I8 = int8(in.Int8()) + case "I16": + out.I16 = int16(in.Int16()) + case "I32": + out.I32 = int32(in.Int32()) + case "I64": + out.I64 = int64(in.Int64()) + case "U": + out.U = uint(in.Uint()) + case "U8": + out.U8 = uint8(in.Uint8()) + case "U16": + out.U16 = uint16(in.Uint16()) + case "U32": + out.U32 = uint32(in.Uint32()) + case "U64": + out.U64 = uint64(in.Uint64()) + case "S": + out.S = string(in.String()) + case "Any": + if m, ok := out.Any.(easyjson.Unmarshaler); ok { + m.UnmarshalEasyJSON(in) + } else if m, ok := out.Any.(json.Unmarshaler); ok { + m.UnmarshalJSON(in.Raw()) + } else { + out.Any = in.Interface() + } + case "Box": + if in.IsNull() { + in.Skip() + out.Box = nil + } else { + if out.Box == nil { + out.Box = new(Box) + } + (*out.Box).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples1(out *jwriter.Writer, in Bag) { + out.RawByte('{') + first := true + _ = first + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"B\":") + out.Bool(bool(in.B)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I\":") + out.Int(int(in.I)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I8\":") + out.Int8(int8(in.I8)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I16\":") + out.Int16(int16(in.I16)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I32\":") + out.Int32(int32(in.I32)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"I64\":") + out.Int64(int64(in.I64)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U\":") + out.Uint(uint(in.U)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U8\":") + out.Uint8(uint8(in.U8)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U16\":") + out.Uint16(uint16(in.U16)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U32\":") + out.Uint32(uint32(in.U32)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"U64\":") + out.Uint64(uint64(in.U64)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"S\":") + out.String(string(in.S)) + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"Any\":") + if m, ok := in.Any.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := in.Any.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(in.Any)) + } + if !first { + out.RawByte(',') + } + first = false + out.RawString("\"Box\":") + if in.Box == nil { + out.RawString("null") + } else { + (*in.Box).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Bag) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Bag) MarshalEasyJSON(w *jwriter.Writer) { + easyjson9d2dde3aEncodeGithubComCosmos72GomacroExamples1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Bag) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Bag) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson9d2dde3aDecodeGithubComCosmos72GomacroExamples1(l, v) +} diff --git a/vendor/github.com/cosmos72/gomacro/example/bag.go.save b/vendor/github.com/cosmos72/gomacro/example/bag.go.save new file mode 100644 index 0000000..981d7a2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/bag.go.save @@ -0,0 +1,45 @@ +// empty file. stops "go build" from complaining that +// no buildable files are in the directory "examples" + +package main + +type Bag struct { + B bool + I int + I8 int8 + I16 int16 + I32 int32 + I64 int64 + U uint + U8 uint8 + U16 uint16 + U32 uint32 + U64 uint64 + // Uptr uintptr + S string + // E error + Any interface{} + Box *Box +} + +type Box struct { + B []bool + I []int + I8 []int8 + I16 []int16 + I32 []int32 + I64 []int64 + U []uint + U8 []uint8 + U16 []uint16 + U32 []uint32 + U64 []uint64 + // Uptr []uintptr + S []string + // E []error + Any []interface{} + Bag []*Bag +} + +func main() { +} diff --git a/vendor/github.com/cosmos72/gomacro/example/channel.gomacro b/vendor/github.com/cosmos72/gomacro/example/channel.gomacro new file mode 100755 index 0000000..a64eaa5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/channel.gomacro @@ -0,0 +1,8 @@ +package main + +func channelTest() { + j := 0; cx := make(chan int, 2) + cs := (chan<- int)(cx); cr := (<-chan int)(cx) + + for i := 0; i < 1000000; i++ { cs <- i; j = <-cr } +} diff --git a/vendor/github.com/cosmos72/gomacro/example/collatz.gomacro b/vendor/github.com/cosmos72/gomacro/example/collatz.gomacro new file mode 100755 index 0000000..479fd0d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/collatz.gomacro @@ -0,0 +1,16 @@ +#!/usr/bin/env gomacro + +func collatz(n int) { + for n > 1 { + if n&1 != 0 { + n = ((n * 3) + 1) / 2 + } else { + n = n / 2 + } + } +} + + +for i := 0; i < 100000; i++ { + collatz(837799) +} diff --git a/vendor/github.com/cosmos72/gomacro/example/collatz.igo b/vendor/github.com/cosmos72/gomacro/example/collatz.igo new file mode 100644 index 0000000..3ad1900 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/collatz.igo @@ -0,0 +1,7 @@ + +collatz := func(n int) { for n > 1 { if n&1 != 0 { n = ((n * 3) + 1) / 2 } else { n = n / 2 } } } + + +collatz_loop := func() { for i := 0; i < 100000; i++ { collatz(837799) } } + +collatz_loop() diff --git a/vendor/github.com/cosmos72/gomacro/example/collatz.py b/vendor/github.com/cosmos72/gomacro/example/collatz.py new file mode 100644 index 0000000..61fd058 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/collatz.py @@ -0,0 +1,12 @@ +# collatz conjecture +def collatz(n): + while n > 1: + if n&1 != 0: + n = ((n * 3) + 1) / 2 + else: + n = n / 2 + +i = 0 +while i < 100000: + collatz(837799) + i+=1 diff --git a/vendor/github.com/cosmos72/gomacro/example/earljwagner1/earljwagner1.go b/vendor/github.com/cosmos72/gomacro/example/earljwagner1/earljwagner1.go new file mode 100644 index 0000000..bbcfd14 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/earljwagner1/earljwagner1.go @@ -0,0 +1,62 @@ +package main + +import ( + "fmt" + "reflect" + + "github.com/cosmos72/gomacro/classic" + "github.com/cosmos72/gomacro/imports" +) + +// example from Earl J Wagner use case: +// interactively replace a (bugged) compiled function with a (corrected) interpreted one +func main() { + // 1. allocate the classic interpreter. Reason: the fast interpreter cannot yet switch package + ir := classic.New() + + // 2. tell the interpreter about our compiled function Cube() in package "github.com/cosmos72/gomacro/example/earljwagner1" + // An alternative solution is to run the interpreter interactively, and at its REPL enter the command: + // import _i "package/to/generate/imports/for" + // (note: the _i is fundamental) + // This will create a file x_package.go in the imported package - just recompile and rerun you program: + // the interpreter will now be able to 'import "package/to/generate/imports/for"' + // without the need to dynamically compile and load a plugin + imports.Packages["github.com/cosmos72/gomacro/example/earljwagner1"] = imports.Package{ + Binds: map[string]reflect.Value{ + "Cube": reflect.ValueOf(Cube), + }, + } + + // 3. tell the interpreter to import the package containing our Cube() + ir.Eval(`import "github.com/cosmos72/gomacro/example/earljwagner1"`) + + // 4. execute compiled Cube() - and realise it's bugged + xcube, _ := ir.Eval("earljwagner1.Cube(3.0)") + fmt.Printf("compiled earljwagner1.Cube(3.0) = %f\n", xcube.Interface().(float64)) + + // 5. tell the interpreter to switch to package "github.com/cosmos72/gomacro/example/earljwagner1" + // at REPL, one would instead type the following (note the quotes): + // package "github.com/cosmos72/gomacro/example/earljwagner1" + ir.ChangePackage("github.com/cosmos72/gomacro/example/earljwagner1") + + // 6. the compiled function Cube() can now be invoked without package prefix + xcube, _ = ir.Eval("Cube(4.0)") + fmt.Printf("compiled Cube(4.0) = %f\n", xcube.Interface().(float64)) + + // 7. define an interpreted function Cube(), replacing the compiled one + ir.Eval("func Cube(x float64) float64 { return x*x*x }") + + // 8. invoke the interpreted function Cube() - the bug is solved :) + xcube, _ = ir.Eval("Cube(4.0)") + fmt.Printf("interpreted Cube(4.0) = %f\n", xcube.Interface().(float64)) + + // 9. note: compiled code will *NOT* automatically know about the bug-fixed Cube() living inside the interpreter. + // One solution is to stay inside the interpreter REPL and use interpreted functions. + // Another solution is to extract the bug-fixed function from the interpreter and use it, + // for example by storing it inside imports.Packages + imports.Packages["github.com/cosmos72/gomacro/example/earljwagner1"].Binds["Cube"] = ir.ValueOf("Cube") +} + +func Cube(x float64) float64 { + return x*x*x - 1 // intentionally bugged +} diff --git a/vendor/github.com/cosmos72/gomacro/example/earljwagner2/cube.go b/vendor/github.com/cosmos72/gomacro/example/earljwagner2/cube.go new file mode 100644 index 0000000..d5ae529 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/earljwagner2/cube.go @@ -0,0 +1,5 @@ +package main + +func Cube(x float64) float64 { + return x*x*x - 1 // intentionally bugged +} diff --git a/vendor/github.com/cosmos72/gomacro/example/earljwagner2/earljwagner2.go b/vendor/github.com/cosmos72/gomacro/example/earljwagner2/earljwagner2.go new file mode 100644 index 0000000..80b431c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/earljwagner2/earljwagner2.go @@ -0,0 +1,54 @@ +package main + +import ( + "errors" + "fmt" + + "github.com/cosmos72/gomacro/classic" + "github.com/cosmos72/gomacro/imports" +) + +func fail(format string, args ...interface{}) { + panic(errors.New(fmt.Sprintf(format, args...))) +} + +// example from Earl J Wagner use case: load a file in the interpreter, +// then interactively replace a (bugged) interpreted function +// with another (corrected) interpreted function, +// without losing the packages already loaded in the intepreter +func main() { + // 1. allocate the classic interpreter. Reason: the fast interpreter cannot yet switch package + ir := classic.New() + + // 2. tell the interpreter to load the file "cube.go" into the package "github.com/cosmos72/gomacro/example/earljwagner2" + ir.EvalFile("cube.go", "github.com/cosmos72/gomacro/example/earljwagner2") + + // 3. tell the interpreter to import the package containing the interpreted function Cube() loaded from file + ir.Eval(`import "github.com/cosmos72/gomacro/example/earljwagner2"`) + + // 4. execute interpreted Cube() loaded from file - and realise it's bugged + xcube, _ := ir.Eval("earljwagner2.Cube(3.0)") + fmt.Printf("interpreted earljwagner2.Cube(3.0) = %f\n", xcube.Interface().(float64)) + + // 5. tell the interpreter to switch to package "github.com/cosmos72/gomacro/example/earljwagner2" + // at REPL, one would instead type the following (note the quotes): + // package "github.com/cosmos72/gomacro/example/earljwagner2" + ir.ChangePackage("github.com/cosmos72/gomacro/example/earljwagner2") + + // 6. the interpreted function Cube() can now be invoked without package prefix + xcube, _ = ir.Eval("Cube(4.0)") + fmt.Printf("interpreted Cube(4.0) = %f\n", xcube.Interface().(float64)) + + // 7. redefine the interpreted function Cube(), replacing the loaded one + ir.Eval("func Cube(x float64) float64 { return x*x*x }") + + // 8. invoke the redefined function Cube() - the bug is solved :) + xcube, _ = ir.Eval("Cube(4.0)") + fmt.Printf("interpreted Cube(4.0) = %f\n", xcube.Interface().(float64)) + + // 9. note: compiled code will *NOT* automatically know about the bug-fixed Cube() living inside the interpreter. + // One solution is to stay inside the interpreter REPL and use interpreted functions. + // Another solution is to extract the bug-fixed function from the interpreter and use it, + // for example by storing it inside imports.Packages + imports.Packages["github.com/cosmos72/gomacro/example/earljwagner2"].Binds["Cube"] = ir.ValueOf("Cube") +} diff --git a/vendor/github.com/cosmos72/gomacro/example/embedded_field.go b/vendor/github.com/cosmos72/gomacro/example/embedded_field.go new file mode 100644 index 0000000..0a9781a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/embedded_field.go @@ -0,0 +1,111 @@ +package main + +import ( + "fmt" + "reflect" + _ "reflect" + "unsafe" +) + +type Pair struct{ A, B int } + +func pair(a, b int) Pair { var p Pair; p.A = a; p.B = b; return p } + +type Triple struct { + Pair + C int +} + +func (p Pair) First() int { + return p.A +} + +func (p Pair) Last() int { + return p.B +} + +func (t Triple) Last() int { + return t.C +} + +func embedded_field() { + printChars() + inspectTriple() +} + +func printChars() { + for i := 128; i <= 255; i++ { + fmt.Printf("%x %c\n", i, i) + } +} + +func inspectTriple() { + t := Triple{Pair{1, 2}, 3} + inspect("declared: ", t.Pair.First) + inspect("declared2: ", t.Pair.First) + inspect("wrapped: ", t.First) + inspect("wrapped2: ", t.First) + inspect("declared (reflect):", reflect.ValueOf(t.Pair).MethodByName("First").Interface().(func() int)) + inspect("declared2 (reflect):", reflect.ValueOf(t.Pair).MethodByName("First").Interface().(func() int)) + inspect("wrapped (reflect):", reflect.ValueOf(t).MethodByName("First").Interface().(func() int)) + inspect("wrapped2 (reflect):", reflect.ValueOf(t).MethodByName("First").Interface().(func() int)) + fmt.Println() + inspect("declared: ", t.Pair.Last) + inspect("declared2: ", t.Pair.Last) + inspect("overridden: ", t.Last) + inspect("overridden2: ", t.Last) + inspect("declared (reflect):", reflect.ValueOf(t.Pair).MethodByName("Last").Interface().(func() int)) + inspect("declared2 (reflect):", reflect.ValueOf(t.Pair).MethodByName("Last").Interface().(func() int)) + inspect("overridden (reflect):", reflect.ValueOf(t).MethodByName("Last").Interface().(func() int)) + inspect("overridden2 (reflect):", reflect.ValueOf(t).MethodByName("Last").Interface().(func() int)) + fmt.Println() + /* + inspectMethod1(t, "First") + inspectMethod1(t.Pair, "First") + inspectMethod1(t, "Last") + inspectMethod1(t.Pair, "Last") + */ +} + +func inspect(name string, x func() int) { + u := *(**uintptr)(unsafe.Pointer(&x)) + u4 := *(**[16]uintptr)(unsafe.Pointer(&x)) + fmt.Printf("%s %#v %#v %#v\n", name, x, u, *u4) +} + +type UnsafeValue struct { + typ *uintptr + ptr unsafe.Pointer + flag uintptr +} +type UnsafeInterface struct { + typ *uintptr + ptr unsafe.Pointer +} + +func inspectMethod(x interface{}, y interface{}, name string) { + mtd1 := reflect.ValueOf(x).MethodByName(name).Interface() + mtd2 := reflect.ValueOf(y).MethodByName(name).Interface() + + inspectMethod1(mtd1, name) + inspectMethod1(mtd2, name) +} + +func inspectMethod1(mtd interface{}, name string) { + fmt.Printf("%s:\t%#v\n", name, mtd) + uf := *(*UnsafeInterface)(unsafe.Pointer(&mtd)) + fmt.Printf("%s:\tInterface = %#v\n", name, uf) + fptr := (**uintptr)(uf.ptr) + fmt.Printf("%s:\tInterface.ptr = %#v %#v\n", name, fptr, *fptr) +} + +func inspectMethod2(x interface{}, name string) { + t := reflect.TypeOf(x) + mtd, _ := t.MethodByName(name) + fmt.Printf("%s:\t%v\n", name, mtd) + var f reflect.Value = mtd.Func + uf := *(*UnsafeValue)(unsafe.Pointer(&f)) + fmt.Printf("%s:\tFunc = %#v\n", name, uf) + fptr := (**uintptr)(uf.ptr) + fmt.Printf("%s:\tFunc.ptr = %#v %#v %#v\n", name, fptr, *fptr, **fptr) +} diff --git a/vendor/github.com/cosmos72/gomacro/example/embedded_field.gomacro b/vendor/github.com/cosmos72/gomacro/example/embedded_field.gomacro new file mode 100755 index 0000000..0f7a600 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/embedded_field.gomacro @@ -0,0 +1,8 @@ +#!/usr/bin/env gomacro + +type Pair struct{ a, b int } +type Triple struct {Pair; c int} + +var t Triple + +println(t) diff --git a/vendor/github.com/cosmos72/gomacro/example/fibonacci.gomacro b/vendor/github.com/cosmos72/gomacro/example/fibonacci.gomacro new file mode 100755 index 0000000..bfa5f37 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/fibonacci.gomacro @@ -0,0 +1,11 @@ +#!/usr/bin/env gomacro + +func fibonacci(n uint) uint { + if n <= 2 { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) +} + +println(fibonacci(30)) + diff --git a/vendor/github.com/cosmos72/gomacro/example/fibonacci.igo b/vendor/github.com/cosmos72/gomacro/example/fibonacci.igo new file mode 100644 index 0000000..d53f202 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/fibonacci.igo @@ -0,0 +1,6 @@ +fibonacci:=func(n int) int { return n }; + +fibonacci=func(n int) int { if n <= 2 { return 1 }; return fibonacci(n-1) + fibonacci(n-2) }; + +println(fibonacci(30)); + diff --git a/vendor/github.com/cosmos72/gomacro/example/fibonacci.py b/vendor/github.com/cosmos72/gomacro/example/fibonacci.py new file mode 100644 index 0000000..1a31f75 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/fibonacci.py @@ -0,0 +1,6 @@ +def fib(n): + if n <= 2: + return 1 + return fib(n-1) + fib(n-2) + +print(fib(30)) diff --git a/vendor/github.com/cosmos72/gomacro/example/for_range.gomacro b/vendor/github.com/cosmos72/gomacro/example/for_range.gomacro new file mode 100755 index 0000000..3253b89 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/for_range.gomacro @@ -0,0 +1,29 @@ +#!/usr/bin/env gomacro + +import "fmt" + +type Entry struct { + Key int + Value string +} + +func mapEntries(m map[int]string) []Entry { + entries := make([]Entry, len(m)) + i := 0 + for k, v := range m { + entries[i] = Entry{k, v} + i++ + } + return entries +} + +func printEntries(entries []Entry) { + for i, e := range entries { + fmt.Println(i, ":", e) + } +} + +m := map[int]string{1: "foo", 2: "bar", 3: "baz"} +entries := mapEntries(m) +printEntries(entries) + diff --git a/vendor/github.com/cosmos72/gomacro/example/interface.go b/vendor/github.com/cosmos72/gomacro/example/interface.go new file mode 100644 index 0000000..cdd298a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/interface.go @@ -0,0 +1,57 @@ +// #!/usr/bin/env gomacro + +package main + +import "fmt" + +type Person struct { + Name, Surname string +} + +type Driver struct { + CanDrive []string + Person +} + +func (p Person) String() string { + return fmt.Sprintf("%s %s", p.Name, p.Surname) +} + +var p = Person{"John", "Smith"} +var d = Driver{nil, p} + +func pd() (Person, Driver) { return p, d } + +type FmtPair struct{ a, b fmt.Stringer } + +func fmtpair(a, b fmt.Stringer) FmtPair { return FmtPair{a, b} } + +func conv() { + fmt.Printf("%v\n", p) + fmt.Printf("%v\n", d) + + fmtpair(pd()) + + var s fmt.Stringer + var ch = make(chan fmt.Stringer, 2) + + s = p + ch <- s + fmt.Printf("%v\n", <-ch) + + s = d + ch <- s + fmt.Printf("%v\n", <-ch) + + ch <- p + fmt.Printf("%v\n", <-ch) + + ch <- d + fmt.Printf("%v\n", <-ch) + + fp := func() fmt.Stringer { return p } + fmt.Printf("%v\n", fp()) + + fd := func() fmt.Stringer { return d } + fmt.Printf("%v\n", fd()) +} diff --git a/vendor/github.com/cosmos72/gomacro/example/main.go b/vendor/github.com/cosmos72/gomacro/example/main.go new file mode 100644 index 0000000..bc5674e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/main.go @@ -0,0 +1,47 @@ +// empty file. stops "go build" from complaining that +// no buildable files are in the directory "examples" + +package main + +import ( + "fmt" + "io" + "os" + r "reflect" +) + +func main() { + conv() +} + +func main2() { + var TypeOfInterface = r.TypeOf((*interface{})(nil)).Elem() + p := r.ValueOf(new(interface{})) + i := p.Elem() + c := i.Convert(TypeOfInterface) + fmt.Printf("%v %v\n", p, p.Type()) + fmt.Printf("%v %v\n", i, i.Type()) + fmt.Printf("%v %v\n", c, c.Type()) + /* + defer func() { + fmt.Println(recover()) + }() + defer func() { + fmt.Println("foo") + }() + panic("test panic") + */ + // m := [...]int{0x7ffffff: 3} + // fmt.Println(m) + // p := Pair{A: 1, B: true} + // Pair{1, 2} = Pair{} + // var f os.file + // _ = bytes.Buffer{nil, 0} +} + +func main1() { + var x io.ReadWriteCloser = os.Stdin + f := io.ReadWriteCloser.Close + f(x) + fmt.Printf("%T\n", f) +} diff --git a/vendor/github.com/cosmos72/gomacro/example/make_fibonacci.gomacro b/vendor/github.com/cosmos72/gomacro/example/make_fibonacci.gomacro new file mode 100644 index 0000000..9453baf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/example/make_fibonacci.gomacro @@ -0,0 +1,21 @@ + +// run "gomacro -m -w make_fibonacci.gomacro" +// to preprocess this file and generate make_fibonacci.go + +package main + +:import "go/ast" + +:macro makefib(typ ast.Node) ast.Node { + return ~"{ + ~func fibonacci(n ~,typ) ~,typ { + if n <= 2 { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) + } + } +} + +makefib; int64 + diff --git a/vendor/github.com/cosmos72/gomacro/experiments/bytecode_interfaces/bytecode_interfaces.go b/vendor/github.com/cosmos72/gomacro/experiments/bytecode_interfaces/bytecode_interfaces.go new file mode 100644 index 0000000..91ab4ab --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/bytecode_interfaces/bytecode_interfaces.go @@ -0,0 +1,212 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * bytecode_interfaces.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package bytecode_interfaces + +import ( + "time" +) + +type Op uint8 + +const ( + storeInt16 Op = iota + addIntInt + subIntInt + mulIntInt + andIntInt + rshiftIntInt + jmp + jmpIfGtrInt + jmpIfLeqInt + jmpIfEqlInt + ret +) + +type Inst struct { + Op Op + Dst, Lhs, Rhs uint8 +} + +func Uint8(n int8) uint8 { + return uint8(n) +} + +func Int(n uint8) int { + return int(int8(n)) +} + +func (i Inst) Src() int { + return int(uint16(i.Lhs) | uint16(i.Rhs)<<8) +} + +func Inst16(op Op, dst uint8, src int16) Inst { + return Inst{ + Op: op, + Dst: dst, + Lhs: uint8(src), + Rhs: uint8(src >> 8), + } +} + +type Prog struct { + IP int + Code []Inst + Vars []interface{} + Outer *Prog +} + +func (p *Prog) Exec(IP int) []interface{} { + if IP < 0 { + IP = p.IP + } + code := p.Code + vars := p.Vars + for { + if false { + // Debugf("fetching IP=%v\n", IP) + } + i := code[IP] + if false { + // Debugf("IP=%v,\tinst=%v\tStack=%v\n", IP, i, vars) + time.Sleep(time.Second) + } + IP++ + switch i.Op { + + case storeInt16: + vars[i.Dst] = i.Src() + case addIntInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + vars[i.Dst] = lhs + rhs + case subIntInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + vars[i.Dst] = lhs - rhs + case mulIntInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + vars[i.Dst] = lhs * rhs + case andIntInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + vars[i.Dst] = lhs & rhs + case rshiftIntInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + vars[i.Dst] = lhs >> uint(rhs) + case jmp: + IP += Int(i.Dst) + case jmpIfGtrInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + if lhs > rhs { + IP += Int(i.Dst) + } + case jmpIfLeqInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + if lhs <= rhs { + IP += Int(i.Dst) + } + case jmpIfEqlInt: + lhs := vars[i.Lhs].(int) + rhs := vars[i.Rhs].(int) + if lhs == rhs { + IP += Int(i.Dst) + } + case ret: + return vars[i.Lhs:i.Rhs] + } + } +} + +/* + interpreted version of: + + func collatz(n int) { + for n > 1 { + if n&1 != 0 { + n = ((n * 3) + 1) / 2 + } else { + n = n / 2 + } + } + } +*/ +func BytecodeCollatz() *Prog { + const ( + n = iota + tmp + _0 + _1 + _3 + ) + return &Prog{Vars: []interface{}{n: 0, _0: 0, _1: 1, _3: 3}, + Code: []Inst{ + {jmpIfLeqInt, 6, n, _1}, + {andIntInt, tmp, n, _1}, + {jmpIfEqlInt, 2, tmp, _0}, + + {mulIntInt, tmp, n, _3}, + {addIntInt, n, tmp, _1}, + + {rshiftIntInt, n, n, _1}, + {jmp, Uint8(-7), 0, 0}, + + {ret, 0, 0, 0}, + }} +} + +/* + bytecode version of: + + func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total + } +*/ +func BytecodeSum(N int) *Prog { + const ( + i = iota + n + total + _1 + ) + return &Prog{Vars: []interface{}{n: N, _1: 1}, + Code: []Inst{ + Inst16(storeInt16, i, 1), + Inst16(storeInt16, total, 0), + {jmpIfGtrInt, 3, i, n}, + {addIntInt, total, total, i}, + {addIntInt, i, i, _1}, + {jmp, Uint8(-4), 0, 0}, + {ret, 0, total, total + 1}, + }} +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/bytecode_values/bytecode_values.go b/vendor/github.com/cosmos72/gomacro/experiments/bytecode_values/bytecode_values.go new file mode 100644 index 0000000..4f9c538 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/bytecode_values/bytecode_values.go @@ -0,0 +1,161 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * bytecode_values.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package bytecode_values + +import ( + r "reflect" + "time" +) + +type Op uint8 + +const ( + storeInt16 Op = iota + addIntInt + subIntInt + jmp + jmpIfGtrInt + ret +) + +type Inst struct { + Op Op + Dst, Lhs, Rhs uint8 +} + +func Uint8(n int8) uint8 { + return uint8(n) +} + +func Int(n uint8) int { + return int(int8(n)) +} + +func (i Inst) Src() int { + return int(uint16(i.Lhs) | uint16(i.Rhs)<<8) +} + +func Inst16(op Op, dst uint8, src int16) Inst { + return Inst{ + Op: op, + Dst: dst, + Lhs: uint8(src), + Rhs: uint8(src >> 8), + } +} + +type Prog struct { + IP int + Code []Inst + Vars []r.Value + Outer *Prog +} + +func (p *Prog) Exec(IP int) []r.Value { + if IP < 0 { + IP = p.IP + } + code := p.Code + vars := p.Vars + for { + if false { + // Debugf("fetching IP=%v\n", IP) + } + i := code[IP] + if false { + // Debugf("IP=%v,\tinst=%v\tStack=%v\n", IP, i, vars) + time.Sleep(time.Second) + } + IP++ + switch i.Op { + + case storeInt16: + vars[i.Dst] = r.ValueOf(i.Src()) + case addIntInt: + lhs := int(vars[i.Lhs].Int()) + rhs := int(vars[i.Rhs].Int()) + vars[i.Dst] = r.ValueOf(lhs + rhs) + case subIntInt: + lhs := int(vars[i.Lhs].Int()) + rhs := int(vars[i.Rhs].Int()) + vars[i.Dst] = r.ValueOf(lhs - rhs) + case jmp: + IP += Int(i.Dst) + case jmpIfGtrInt: + lhs := int(vars[i.Lhs].Int()) + rhs := int(vars[i.Rhs].Int()) + if lhs > rhs { + IP += Int(i.Dst) + } + case ret: + return vars[i.Lhs:i.Rhs] + } + } +} + +/* + interpreted version of: + + func collatz(n int) { + for n > 1 { + if n&1 != 0 { + n = (n + 3) >> 1 + } else { + n = n >> 1 + } + } +} +*/ + +/* + bytecode version of: + + func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total + } +*/ +func BytecodeSum(N int) *Prog { + const ( + i = iota + n + total + _1 + ) + return &Prog{Vars: []r.Value{n: r.ValueOf(N), _1: r.ValueOf(1)}, + Code: []Inst{ + Inst16(storeInt16, i, 1), + Inst16(storeInt16, total, 0), + {jmpIfGtrInt, 3, i, n}, + {addIntInt, total, total, i}, + {addIntInt, i, i, _1}, + {jmp, Uint8(-4), 0, 0}, + {ret, 0, total, total + 1}, + }} +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/closure_interfaces/closure_interfaces.go b/vendor/github.com/cosmos72/gomacro/experiments/closure_interfaces/closure_interfaces.go new file mode 100644 index 0000000..33e5313 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/closure_interfaces/closure_interfaces.go @@ -0,0 +1,362 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * closure_interfaces.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package closure_interfaces + +import ( + _ "errors" + _ "fmt" + + "github.com/cosmos72/gomacro/base" +) + +type Env struct { + Binds []interface{} + Outer *Env +} + +func NewEnv(outer *Env) *Env { + return &Env{ + Binds: make([]interface{}, 10), + Outer: outer, + } +} + +type SParam struct { + Name string + // Type r.Type +} + +type SReturn struct { + result0 interface{} + results []interface{} +} + +type X func(*Env) (interface{}, []interface{}) +type X1 func(*Env) interface{} +type XInt func(*Env) int +type XBool func(*Env) bool + +type Func func(args ...interface{}) (interface{}, []interface{}) +type FuncInt func(args ...interface{}) int + +type XFunc func(env *Env) Func +type XFuncInt func(env *Env) FuncInt + +func IntToX(f XInt) X { + return func(env *Env) (interface{}, []interface{}) { + return f(env), nil + } +} + +func Const(value interface{}) X { + return func(env *Env) (interface{}, []interface{}) { + return value, nil + } +} + +func Int(n int) XInt { + return func(env *Env) int { + return n + } +} + +func Var(upn, idx int) X { + return func(env *Env) (interface{}, []interface{}) { + for i := 0; i < upn; i++ { + env = env.Outer + } + return env.Binds[idx], nil + } +} + +func VarInt0(env *Env) int { + return env.Binds[0].(int) +} + +func VarInt(idx int) XInt { + return func(env *Env) int { + return env.Binds[idx].(int) + /* + switch v := env.Binds[idx].(type) { + case int: + return v + default: + panic(errors.New(fmt.Sprintf("Binds[%v] = %#v <%T> is not an ", idx, v, v))) + } + */ + } +} + +func VarSetInt(idx int, expr XInt) X { + return func(env *Env) (interface{}, []interface{}) { + val := expr(env) + env.Binds[idx] = val + return base.None, nil + } +} + +func VarIncInt(idx int) X { + return func(env *Env) (interface{}, []interface{}) { + v := env.Binds[idx] + env.Binds[idx] = v.(int) + 1 + return base.None, nil + } +} + +func AddIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) + rhs(env) + } +} + +func SubIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) - rhs(env) + } +} + +func LessIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) < rhs(env) + } +} + +func LesseqIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) <= rhs(env) + } +} + +func If(pred XBool, then, els X) X { + return func(env *Env) (interface{}, []interface{}) { + if pred(env) { + return then(env) + } else { + return els(env) + } + } +} + +func For(init X, pred XBool, post X, body X) X { + if init == nil && post == nil { + return func(env *Env) (interface{}, []interface{}) { + for pred(env) { + body(env) + } + return base.None, nil + } + + } else { + if init == nil || post == nil { + panic("invalid for(): init and post must be both present, or both omitted") + } + return func(env *Env) (interface{}, []interface{}) { + for init(env); pred(env); post(env) { + body(env) + } + return base.None, nil + } + } +} + +func Nop(env *Env) (interface{}, []interface{}) { + return base.None, nil +} + +func Block(list ...X) X { + switch len(list) { + case 0: + return Nop + case 1: + return list[0] + case 2: + return func(env *Env) (interface{}, []interface{}) { + list[0](env) + return list[1](env) + } + default: + return func(env *Env) (interface{}, []interface{}) { + n_1 := len(list) - 1 + for i := 0; i < n_1; i++ { + list[i](env) + } + return list[n_1](env) + } + } +} + +func Return(exprs ...X) X { + switch n := len(exprs); n { + case 0: + return Nop + case 1: + expr0 := exprs[0] + // return foo() returns *all* the values returned by foo, not just the first one + return func(env *Env) (interface{}, []interface{}) { + ret, rets := expr0(env) + panic(SReturn{ret, rets}) + } + default: + return func(env *Env) (interface{}, []interface{}) { + n := len(exprs) + rets := make([]interface{}, n) + for i, value := range exprs { + rets[i], _ = value(env) + } + var ret0 interface{} + if len(rets) > 0 { + ret0 = rets[0] + } + panic(SReturn{ret0, rets}) + } + } +} + +func ReturnInt(expr XInt) X { + return func(env *Env) (interface{}, []interface{}) { + ret := expr(env) + panic(SReturn{ret, nil}) + } +} + +func DeclVar(idx int, expr X) X { + return func(env *Env) (interface{}, []interface{}) { + value, _ := expr(env) + env.Binds[idx] = value + return value, nil + } +} + +func DeclFuncInt(idx int, params []SParam, body X) XFuncInt { + xf := MakeFuncInt(params, body) + return func(env *Env) FuncInt { + f := xf(env) + env.Binds[idx] = f + return f + } +} + +func MakeFuncInt(params []SParam, body X) XFuncInt { + return func(env *Env) FuncInt { + return func(args ...interface{}) (ret int) { + fenv := NewEnv(env) + panicking := true // use a flag to distinguish non-panic from panic(nil) + defer func() { + if panicking { + pan := recover() + switch p := pan.(type) { + case SReturn: + // return is implemented with a panic(cReturn{}) + ret = p.result0.(int) + default: + panic(pan) + } + } + }() + for i, _ := range params { + fenv.Binds[i] = args[i] + } + ret0, _ := body(fenv) + panicking = false + return ret0.(int) + } + } +} + +func CallInt(fun X, args ...X) XInt { + return func(env *Env) int { + fvalue, _ := fun(env) + f := fvalue.(FuncInt) + n := len(args) + values := make([]interface{}, n) + for i, arg := range args { + values[i], _ = arg(env) + } + return f(values...) + } +} + +// var typeOfInt = r.TypeOf(int(0)) + +/* + interpreted version of: + + func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total + } +*/ +func DeclSum(env *Env, idx int) FuncInt { + const ( + n = 0 + total = 1 + i = 2 + ) + return DeclFuncInt( + idx, []SParam{{"n" /*typeOfInt*/}}, + Block( + DeclVar(total, Const(0)), + For(DeclVar(i, Const(1)), LesseqIntInt(VarInt(i), VarInt(n)), VarIncInt(i), + VarSetInt(total, + AddIntInt( + VarInt(total), VarInt(i), + ), + ), + ), + ReturnInt(VarInt(total)), + ), + )(env) +} + +/* + interpreted version of: + + func fibonacci(n int) int { + if (n <= 2) { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) + } +*/ +func DeclFibonacci(env *Env, idx int) FuncInt { + return DeclFuncInt( + idx, []SParam{{"n" /*typeOfInt*/}}, + Block( + If(LessIntInt(VarInt0, Int(2)), + ReturnInt(Int(1)), + ReturnInt( + AddIntInt( + CallInt(Var(1, idx), IntToX(SubIntInt(VarInt0, Int(1)))), + CallInt(Var(1, idx), IntToX(SubIntInt(VarInt0, Int(2)))), + ), + ), + ), + ), + )(env) +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/closure_maps/closure_maps.go b/vendor/github.com/cosmos72/gomacro/experiments/closure_maps/closure_maps.go new file mode 100644 index 0000000..7d8a9ed --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/closure_maps/closure_maps.go @@ -0,0 +1,417 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * closure_maps.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package closure_maps + +import ( + "errors" + "fmt" + r "reflect" + + "github.com/cosmos72/gomacro/base" +) + +type Env struct { + Binds map[string]r.Value + Outer *Env +} + +type SParam struct { + Name string + Type r.Type +} + +type SReturn struct { + result0 r.Value + results []r.Value +} + +type X func(*Env) (r.Value, []r.Value) +type X1 func(*Env) r.Value +type XInt func(*Env) int +type XBool func(*Env) bool + +type Func func(args ...r.Value) (r.Value, []r.Value) +type FuncInt func(args ...r.Value) int + +type XFunc func(env *Env) Func +type XFuncInt func(env *Env) FuncInt + +var typeOfInt = r.TypeOf(int(0)) + +func errorf(format string, args ...interface{}) (r.Value, []r.Value) { + panic(errors.New(fmt.Sprintf(format, args...))) +} + +func warnExtraValues(extraValues []r.Value) { + fmt.Printf("// warning: expression returned %d values, using only the first one: %v", + len(extraValues), extraValues) +} + +func NewEnv(outer *Env) *Env { + return &Env{Outer: outer} +} + +func (env *Env) DefineVar(name string, t r.Type, value r.Value) r.Value { + if env.Binds == nil { + env.Binds = make(map[string]r.Value) + } + if t == nil { + t = value.Type() + } else { + value = value.Convert(t) + } + place := r.New(t).Elem() + place.Set(value) + env.Binds[name] = place + return value +} + +func (env *Env) DefineFunc(name string, t r.Type, value r.Value) r.Value { + if env.Binds == nil { + env.Binds = make(map[string]r.Value) + } + if t == nil { + t = value.Type() + } else { + value = value.Convert(t) + } + env.Binds[name] = value + return value +} + +func IntToX(f XInt) X { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(f(env)), nil + } +} + +func Const(value interface{}) X { + v := r.ValueOf(value) + return func(env *Env) (r.Value, []r.Value) { + return v, nil + } +} + +func Int(n int) XInt { + return func(env *Env) int { + return n + } +} + +func Var(name string) X { + return func(env *Env) (r.Value, []r.Value) { + for e := env; e != nil; e = e.Outer { + if v, ok := e.Binds[name]; ok { + return v, nil + } + } + return errorf("undefined identifier: %v", name) + } +} + +func VarInt(name string) XInt { + return func(env *Env) int { + return int(env.Binds[name].Int()) + } +} + +func VarSetInt(name string, expr XInt) X { + return func(env *Env) (r.Value, []r.Value) { + val := expr(env) + for e := env; e != nil; e = e.Outer { + if v, ok := env.Binds[name]; ok { + v.SetInt(int64(val)) + return base.None, nil + } + } + return errorf("undefined identifier: %v", name) + } +} + +func VarIncInt(name string) X { + return func(env *Env) (r.Value, []r.Value) { + for e := env; e != nil; e = e.Outer { + if v, ok := env.Binds[name]; ok { + v.SetInt(v.Int() + 1) + return base.None, nil + } + } + return errorf("undefined identifier: %v", name) + } +} + +func AddIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) + rhs(env) + } +} + +func SubIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) - rhs(env) + } +} + +func LessIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) < rhs(env) + } +} + +func LesseqIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) <= rhs(env) + } +} + +func If(pred XBool, then, els X) X { + return func(env *Env) (r.Value, []r.Value) { + if pred(env) { + return then(env) + } else { + return els(env) + } + } +} + +func For(init X, pred XBool, post X, body X) X { + if init == nil && post == nil { + return func(env *Env) (r.Value, []r.Value) { + for pred(env) { + body(env) + } + return base.None, nil + } + + } else { + if init == nil || post == nil { + panic("invalid for(): init and post must be both present, or both omitted") + } + return func(env *Env) (r.Value, []r.Value) { + for init(env); pred(env); post(env) { + body(env) + } + return base.None, nil + } + } +} + +func Nop(env *Env) (r.Value, []r.Value) { + return base.None, nil +} + +func Block(list ...X) X { + switch len(list) { + case 0: + return Nop + case 1: + return list[0] + case 2: + return func(env *Env) (r.Value, []r.Value) { + list[0](env) + return list[1](env) + } + default: + return func(env *Env) (r.Value, []r.Value) { + n_1 := len(list) - 1 + for i := 0; i < n_1; i++ { + list[i](env) + } + return list[n_1](env) + } + } +} + +func Return(exprs ...X) X { + switch n := len(exprs); n { + case 0: + return Nop + case 1: + expr := exprs[0] + // return foo() returns *all* the values returned by foo, not just the first one + return func(env *Env) (r.Value, []r.Value) { + ret, rets := expr(env) + panic(SReturn{ret, rets}) + } + default: + return func(env *Env) (r.Value, []r.Value) { + n := len(exprs) + rets := make([]r.Value, n) + var extra []r.Value + for i, value := range exprs { + rets[i], extra = value(env) + if len(extra) > 1 { + warnExtraValues(extra) + } + } + ret0 := base.None + if len(rets) > 0 { + ret0 = rets[0] + } + panic(SReturn{ret0, rets}) + } + } +} + +func ReturnInt(expr XInt) X { + return func(env *Env) (r.Value, []r.Value) { + ret := expr(env) + panic(SReturn{r.ValueOf(ret), nil}) + } +} + +func DeclVar(name string, expr X) X { + return func(env *Env) (r.Value, []r.Value) { + value, extra := expr(env) + if len(extra) > 1 { + warnExtraValues(extra) + } + value = env.DefineVar(name, nil, value) + return value, nil + } +} + +func DeclFuncInt(name string, params []SParam, body X) XFuncInt { + xf := MakeFuncInt(name, params, body) + return func(env *Env) FuncInt { + f := xf(env) + env.DefineFunc(name, nil, r.ValueOf(f)) + return f + } +} + +func MakeFuncInt(name string, params []SParam, body X) XFuncInt { + return func(env *Env) FuncInt { + return func(args ...r.Value) (ret int) { + fenv := NewEnv(env) + panicking := true // use a flag to distinguish non-panic from panic(nil) + defer func() { + if panicking { + pan := recover() + switch p := pan.(type) { + case SReturn: + // return is implemented with a panic(cReturn{}) + ret = int(p.result0.Int()) + default: + panic(pan) + } + } + }() + for i, param := range params { + fenv.DefineVar(param.Name, param.Type, args[i]) + } + ret0, extra := body(fenv) + if len(extra) > 1 { + warnExtraValues(extra) + } + panicking = false + return int(ret0.Int()) + } + } +} + +func CallInt(fun X, args ...X) XInt { + return func(env *Env) int { + var extra []r.Value + fvalue, extra := fun(env) + if len(extra) > 1 { + warnExtraValues(extra) + } + if fvalue == base.Nil || fvalue == base.None { + errorf("undefined identifier: %v", fun) + } + f := fvalue.Interface().(FuncInt) + n := len(args) + values := make([]r.Value, n) + for i, arg := range args { + values[i], extra = arg(env) + if len(extra) > 1 { + warnExtraValues(extra) + } + } + return f(values...) + } +} + +/* + interpreted version of: + + func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total + } +*/ +func DeclSum(env *Env, funcName string) FuncInt { + const ( + n = "n" + total = "total" + i = "i" + ) + return DeclFuncInt( + funcName, []SParam{{"n", typeOfInt}}, + Block( + DeclVar(total, Const(0)), + For(DeclVar(i, Const(1)), LesseqIntInt(VarInt(i), VarInt(n)), VarIncInt(i), + VarSetInt(total, + AddIntInt( + VarInt(total), VarInt(i), + ), + ), + ), + ReturnInt(VarInt(total)), + ), + )(env) +} + +/* + interpreted version of: + + func fibonacci(n int) int { + if (n <= 2) { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) + } +*/ +func DeclFibonacci(env *Env, funcName string) FuncInt { + return DeclFuncInt( + funcName, []SParam{{"n", typeOfInt}}, + Block( + If(LessIntInt(VarInt("n"), Int(2)), + ReturnInt(Int(1)), + ReturnInt( + AddIntInt( + CallInt(Var(funcName), IntToX(SubIntInt(VarInt("n"), Int(1)))), + CallInt(Var(funcName), IntToX(SubIntInt(VarInt("n"), Int(2)))), + ), + ), + ), + ), + )(env) +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/closure_values/closure_values.go b/vendor/github.com/cosmos72/gomacro/experiments/closure_values/closure_values.go new file mode 100644 index 0000000..38e4025 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/closure_values/closure_values.go @@ -0,0 +1,447 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * closure_values.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package closure_values + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/base" +) + +type Env struct { + Binds []r.Value + Outer *Env +} + +func NewEnv(outer *Env) *Env { + return &Env{ + Binds: make([]r.Value, 10), + Outer: outer, + } +} + +type SParam struct { + Type r.Type +} + +type SReturn struct { + result0 r.Value + results []r.Value +} + +type X func(*Env) (r.Value, []r.Value) +type X1 func(*Env) r.Value +type XInt func(*Env) int +type XBool func(*Env) bool + +type Func func(args ...r.Value) (r.Value, []r.Value) +type FuncInt func(args ...r.Value) int + +type XFunc func(env *Env) Func +type XFuncInt func(env *Env) FuncInt + +func IntToX(f XInt) X { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(f(env)), nil + } +} + +func Const(value interface{}) X { + v := r.ValueOf(value) + return func(env *Env) (r.Value, []r.Value) { + return v, nil + } +} + +func Int(n int) XInt { + return func(env *Env) int { + return n + } +} + +func Var(upn, idx int) X { + return func(env *Env) (r.Value, []r.Value) { + for i := 0; i < upn; i++ { + env = env.Outer + } + return env.Binds[idx], nil + } +} + +func VarInt0(env *Env) int { + return int(env.Binds[0].Int()) +} + +func VarInt(idx int) XInt { + return func(env *Env) int { + return int(env.Binds[idx].Int()) + } +} + +func VarSetInt(idx int, expr XInt) X { + return func(env *Env) (r.Value, []r.Value) { + val := expr(env) + env.Binds[idx].SetInt(int64(val)) + return base.None, nil + } +} + +func VarIncInt(idx int) X { + return func(env *Env) (r.Value, []r.Value) { + v := env.Binds[idx] + v.SetInt(v.Int() + 1) + return base.None, nil + } +} + +func BitandIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) & rhs(env) + } +} + +func AddIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) + rhs(env) + } +} + +func SubIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) - rhs(env) + } +} + +func MulIntInt(lhs, rhs XInt) XInt { + return func(env *Env) int { + return lhs(env) * rhs(env) + } +} + +func RshiftIntInt(lhs, rhs XInt) XInt { + if false { + return func(env *Env) int { + l, r := lhs(env), rhs(env) + // Debugf("rshift: lhs=%v, rhs=%v\n", l, r) + // time.Sleep(time.Second) + return l >> uint(r) + } + } else { + return func(env *Env) int { + return lhs(env) >> uint(rhs(env)) + } + } +} + +func LessIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) < rhs(env) + } +} + +func LesseqIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) <= rhs(env) + } +} + +func NoteqIntInt(lhs, rhs XInt) XBool { + return func(env *Env) bool { + return lhs(env) != rhs(env) + } +} + +func If(pred XBool, then, els X) X { + if els != nil { + return func(env *Env) (r.Value, []r.Value) { + if pred(env) { + return then(env) + } else { + return els(env) + } + } + } else { + return func(env *Env) (r.Value, []r.Value) { + if pred(env) { + return then(env) + } else { + return base.None, nil + } + } + } +} + +func For(init X, pred XBool, post X, body X) X { + if init == nil && post == nil { + return func(env *Env) (r.Value, []r.Value) { + for pred(env) { + body(env) + } + return base.None, nil + } + + } else { + if init == nil || post == nil { + panic("invalid for(): init and post must be both present, or both omitted") + } + return func(env *Env) (r.Value, []r.Value) { + for init(env); pred(env); post(env) { + body(env) + } + return base.None, nil + } + } +} + +func Nop(env *Env) (r.Value, []r.Value) { + return base.None, nil +} + +func Block(list ...X) X { + switch len(list) { + case 0: + return Nop + case 1: + return list[0] + case 2: + return func(env *Env) (r.Value, []r.Value) { + list[0](env) + return list[1](env) + } + default: + return func(env *Env) (r.Value, []r.Value) { + n_1 := len(list) - 1 + for i := 0; i < n_1; i++ { + list[i](env) + } + return list[n_1](env) + } + } +} + +func Return(exprs ...X) X { + switch n := len(exprs); n { + case 0: + return Nop + case 1: + expr0 := exprs[0] + // return foo() returns *all* the values returned by foo, not just the first one + return func(env *Env) (r.Value, []r.Value) { + ret, rets := expr0(env) + panic(SReturn{ret, rets}) + } + default: + return func(env *Env) (r.Value, []r.Value) { + n := len(exprs) + rets := make([]r.Value, n) + for i, value := range exprs { + rets[i], _ = value(env) + } + ret0 := base.None + if len(rets) > 0 { + ret0 = rets[0] + } + panic(SReturn{ret0, rets}) + } + } +} + +func ReturnInt(expr XInt) X { + return func(env *Env) (r.Value, []r.Value) { + ret := expr(env) + panic(SReturn{r.ValueOf(ret), nil}) + } +} + +func DeclVar(idx int, expr X) X { + return func(env *Env) (r.Value, []r.Value) { + value, _ := expr(env) + place := r.New(value.Type()).Elem() + place.Set(value) + env.Binds[idx] = place + return value, nil + } +} + +func DeclFuncInt(idx int, paramTypes []r.Type, body X) XFuncInt { + xf := MakeFuncInt(paramTypes, body) + return func(env *Env) FuncInt { + f := xf(env) + env.Binds[idx] = r.ValueOf(f) + return f + } +} + +func MakeFuncInt(paramTypes []r.Type, body X) XFuncInt { + return func(env *Env) FuncInt { + return func(args ...r.Value) (ret int) { + fenv := NewEnv(env) + panicking := true // use a flag to distinguish non-panic from panic(nil) + defer func() { + if panicking { + pan := recover() + switch p := pan.(type) { + case SReturn: + // return is implemented with a panic(cReturn{}) + ret = int(p.result0.Int()) + default: + panic(pan) + } + } + }() + for i, paramType := range paramTypes { + place := r.New(paramType).Elem() + place.Set(args[i]) + fenv.Binds[i] = place + } + ret0, _ := body(fenv) + panicking = false + return int(ret0.Int()) + } + } +} + +func CallInt(fun X, args ...X) XInt { + return func(env *Env) int { + fvalue, _ := fun(env) + f := fvalue.Interface().(FuncInt) + n := len(args) + values := make([]r.Value, n) + for i, arg := range args { + values[i], _ = arg(env) + } + return f(values...) + } +} + +var typeOfInt = r.TypeOf(int(0)) + +/* + interpreted version of: + + func collatz(n int) { + for n > 1 { + if n&1 != 0 { + n = ((n * 3) + 1) / 2 + } else { + n = n / 2 + } + } + } +*/ +func DeclCollatz(env *Env, idx int) FuncInt { + const ( + n = 0 + ) + return DeclFuncInt( + idx, []r.Type{typeOfInt}, + Block( + For(nil, LessIntInt(Int(1), VarInt(n)), nil, + If(NoteqIntInt(BitandIntInt(VarInt(n), Int(1)), Int(0)), + VarSetInt(n, + RshiftIntInt( + AddIntInt( + MulIntInt(VarInt(n), Int(3)), + Int(1), + ), + Int(1), + ), + ), + VarSetInt(n, + RshiftIntInt( + VarInt(n), + Int(1), + ), + ), + ), + ), + ReturnInt(Int(0)), + ), + )(env) +} + +/* + interpreted version of: + + func sum(n int) int { + total := 0 + for i := 1; i <= n; i++ { + total += i + } + return total + } +*/ +func DeclSum(env *Env, idx int) FuncInt { + const ( + n = 0 + total = 1 + i = 2 + ) + return DeclFuncInt( + idx, []r.Type{typeOfInt}, + Block( + DeclVar(total, Const(0)), + For(DeclVar(i, Const(1)), LesseqIntInt(VarInt(i), VarInt(n)), VarIncInt(i), + VarSetInt(total, + AddIntInt( + VarInt(total), VarInt(i), + ), + ), + ), + ReturnInt(VarInt(total)), + ), + )(env) +} + +/* + interpreted version of: + + func fibonacci(n int) int { + if (n <= 2) { + return 1 + } + return fibonacci(n-1) + fibonacci(n-2) + } +*/ +func DeclFibonacci(env *Env, idx int) FuncInt { + const ( + n = 0 + ) + return DeclFuncInt( + idx, []r.Type{typeOfInt}, + Block( + If(LessIntInt(VarInt0, Int(2)), + ReturnInt(Int(1)), + ReturnInt( + AddIntInt( + CallInt(Var(1, idx), IntToX(SubIntInt(VarInt0, Int(1)))), + CallInt(Var(1, idx), IntToX(SubIntInt(VarInt0, Int(2)))), + ), + ), + ), + ), + )(env) +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/dummy.go b/vendor/github.com/cosmos72/gomacro/experiments/dummy.go new file mode 100644 index 0000000..db983c5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/dummy.go @@ -0,0 +1,4 @@ +// empty file. stops "go build" from complaining that +// no buildable files are in the directory "experiments" + +package experiments diff --git a/vendor/github.com/cosmos72/gomacro/experiments/stmt_new_test.go b/vendor/github.com/cosmos72/gomacro/experiments/stmt_new_test.go new file mode 100644 index 0000000..5a63fbf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/stmt_new_test.go @@ -0,0 +1,611 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * stmt_test.go + * + * Created on Apr 04, 2017 + * Author Massimiliano Ghilardi + */ + +package experiments + +import ( + r "reflect" + "testing" + "unsafe" +) + +const ( + n int = 1000 +) + +/* + benchmark results on Intel Core2 Duo P8400 @2.26GHz, Ubuntu 16.04.1 amd64, Linux 4.4.0-31-generic amd64, Go 1.8.1 linux/amd64 + + -------- n = 10 -------- + BenchmarkThreadedStmtFunc6-2 20000000 64.6 ns/op + BenchmarkThreadedStmtFunc6Unroll-2 20000000 59.8 ns/op + BenchmarkThreadedStmtFunc6Terminate-2 20000000 98.5 ns/op + BenchmarkThreadedStmtFunc6Adaptive-2 20000000 60.7 ns/op + BenchmarkThreadedStmtStruct6-2 20000000 63.5 ns/op + BenchmarkThreadedStmtStruct6Unroll-2 30000000 57.5 ns/op + BenchmarkThreadedStmtStruct6Terminate-2 20000000 78.1 ns/op + BenchmarkThreadedStmtStruct6Adaptive-2 30000000 52.4 ns/op + BenchmarkThreadedStmtFunc0-2 20000000 76.3 ns/op + BenchmarkThreadedStmtFunc1-2 20000000 80.0 ns/op + BenchmarkThreadedStmtFunc2-2 20000000 70.4 ns/op + BenchmarkThreadedStmtFunc3-2 20000000 70.4 ns/op + BenchmarkThreadedStmtFunc4-2 20000000 66.3 ns/op + BenchmarkThreadedStmtFunc4Unroll-2 20000000 59.9 ns/op + BenchmarkThreadedStmtFunc4Terminate-2 20000000 83.1 ns/op + BenchmarkThreadedStmtFunc4Adaptive-2 20000000 63.9 ns/op + BenchmarkThreadedStmtFunc4Panic-2 5000000 332 ns/op + BenchmarkThreadedStmtFunc5-2 20000000 72.7 ns/op + + -------- n = 100 -------- + BenchmarkThreadedStmtFunc6-2 2000000 665 ns/op + BenchmarkThreadedStmtFunc6Unroll-2 2000000 600 ns/op + BenchmarkThreadedStmtFunc6Terminate-2 2000000 634 ns/op + BenchmarkThreadedStmtFunc6Adaptive-2 2000000 631 ns/op + BenchmarkThreadedStmtStruct6-2 2000000 636 ns/op + BenchmarkThreadedStmtStruct6Unroll-2 3000000 581 ns/op + BenchmarkThreadedStmtStruct6Terminate-2 2000000 597 ns/op + BenchmarkThreadedStmtStruct6Adaptive-2 3000000 543 ns/op + BenchmarkThreadedStmtFunc0-2 2000000 777 ns/op + BenchmarkThreadedStmtFunc1-2 2000000 818 ns/op + BenchmarkThreadedStmtFunc2-2 2000000 701 ns/op + BenchmarkThreadedStmtFunc3-2 2000000 701 ns/op + BenchmarkThreadedStmtFunc4-2 2000000 654 ns/op + BenchmarkThreadedStmtFunc4Unroll-2 3000000 642 ns/op + BenchmarkThreadedStmtFunc4Terminate-2 2000000 643 ns/op + BenchmarkThreadedStmtFunc4Adaptive-2 2000000 606 ns/op + BenchmarkThreadedStmtFunc4Panic-2 2000000 902 ns/op + BenchmarkThreadedStmtFunc5-2 2000000 749 ns/op + + -------- n = 1000 -------- + BenchmarkThreadedStmtFunc6-2 200000 6228 ns/op + BenchmarkThreadedStmtFunc6Unroll-2 300000 5896 ns/op + BenchmarkThreadedStmtFunc6Terminate-2 200000 5719 ns/op + BenchmarkThreadedStmtFunc6Adaptive-2 300000 5538 ns/op + BenchmarkThreadedStmtStruct6-2 200000 6227 ns/op + BenchmarkThreadedStmtStruct6Unroll-2 200000 5668 ns/op + BenchmarkThreadedStmtStruct6Terminate-2 300000 6068 ns/op + BenchmarkThreadedStmtStruct6Adaptive-2 300000 5584 ns/op + BenchmarkThreadedStmtFunc0-2 200000 7535 ns/op + BenchmarkThreadedStmtFunc1-2 200000 8109 ns/op + BenchmarkThreadedStmtFunc2-2 200000 7023 ns/op + BenchmarkThreadedStmtFunc3-2 200000 7078 ns/op + BenchmarkThreadedStmtFunc4-2 200000 6480 ns/op + BenchmarkThreadedStmtFunc4Unroll-2 200000 5987 ns/op + BenchmarkThreadedStmtFunc4Terminate-2 200000 5892 ns/op + BenchmarkThreadedStmtFunc4Adaptive-2 200000 5906 ns/op + BenchmarkThreadedStmtFunc4Panic-2 200000 6004 ns/op + BenchmarkThreadedStmtFunc5-2 200000 7016 ns/op +*/ +type ( + Env6 struct { + Binds []r.Value + Outer *Env6 + IP int + Code []Stmt6 + Interrupt Stmt6 + } + Stmt6 func(*Env6) (Stmt6, *Env6) + X6 func(*Env6) +) + +func BenchmarkThreadedFuncX6(b *testing.B) { + + var nop X6 = func(env *Env6) { + } + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]X6, n) + for i := 0; i < n; i++ { + all[i] = nop + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + for _, x := range all { + x(env) + } + } +} + +func BenchmarkThreadedStmtFuncX6(b *testing.B) { + + var xnop X6 = func(env *Env6) { + } + var nop Stmt6 = func(env *Env6) (Stmt6, *Env6) { + xnop(env) + env.IP++ + return env.Code[env.IP], env + } + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + stmt, env = stmt(env) + } + } +} + +func BenchmarkThreadedStmtFunc6(b *testing.B) { + + var nop Stmt6 = func(env *Env6) (Stmt6, *Env6) { + env.IP++ + return env.Code[env.IP], env + } + + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + stmt, env = stmt(env) + } + } +} + +func BenchmarkThreadedStmtFunc6Unroll(b *testing.B) { + var nop Stmt6 = func(env *Env6) (Stmt6, *Env6) { + env.IP++ + return env.Code[env.IP], env + } + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + stmt, env = stmt(env) + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +func BenchmarkThreadedStmtFunc6Terminate(b *testing.B) { + var interrupt Stmt6 + interrupt = func(env *Env6) (Stmt6, *Env6) { + return interrupt, env + } + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + + var nop Stmt6 = func(env *Env6) (Stmt6, *Env6) { + env.IP++ + return env.Code[env.IP], env + } + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = interrupt + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for { + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + break + } + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + } + } +} + +func BenchmarkThreadedStmtFunc6Adaptive(b *testing.B) { + var nop Stmt6 = func(env *Env6) (Stmt6, *Env6) { + env.IP++ + return env.Code[env.IP], env + } + var interrupt Stmt6 = func(env *Env6) (Stmt6, *Env6) { + return env.Interrupt, env + } + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + + env := &Env6{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() +outer: + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + if stmt == nil { + continue outer + } + for j := 0; j < 5; j++ { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + continue + } + } + } + } + } + } + } + } + } + } + } + } + } + } + continue outer + } + + all[n] = interrupt + env.Interrupt = interrupt + for { + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + continue outer + } + } + } +} + +type ( + EnvS6 struct { + Binds []r.Value + Outer *EnvS6 + IP int + Code []StmtS6 + Interrupt StmtS6 + } + StmtS6 struct { + Exec func(env *EnvS6) (StmtS6, *EnvS6) + } +) + +func init() { + println("sizeof(*uintptr) =", unsafe.Sizeof((*uintptr)(nil))) + println("sizeof(Stmt6) =", unsafe.Sizeof(func(env *Env6) (Stmt6, *Env6) { return nil, env })) + println("sizeof(StmtS6) =", unsafe.Sizeof(StmtS6{})) +} + +func BenchmarkThreadedStmtStruct6(b *testing.B) { + + var nop StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + env.IP++ + return env.Code[env.IP], env + }} + env := &EnvS6{ + Binds: make([]r.Value, 10), + } + all := make([]StmtS6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = StmtS6{} + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt.Exec != nil { + stmt, env = stmt.Exec(env) + } + } +} + +func BenchmarkThreadedStmtStruct6Unroll(b *testing.B) { + + var nop StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + env.IP++ + return env.Code[env.IP], env + }} + env := &EnvS6{ + Binds: make([]r.Value, 10), + } + all := make([]StmtS6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = StmtS6{} + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + stmt, env = stmt.Exec(env) + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +func BenchmarkThreadedStmtStruct6Terminate(b *testing.B) { + + var nop StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + env.IP++ + return env.Code[env.IP], env + }} + var interrupt StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + return env.Interrupt, env + }} + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + + env := &EnvS6{ + Binds: make([]r.Value, 10), + } + all := make([]StmtS6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = interrupt + env.Code = all + env.Interrupt = interrupt + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for { + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + break + } + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + } + } +} + +func BenchmarkThreadedStmtStruct6Adaptive(b *testing.B) { + + var nop StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + env.IP++ + return env.Code[env.IP], env + }} + var interrupt StmtS6 = StmtS6{func(env *EnvS6) (StmtS6, *EnvS6) { + return env.Interrupt, env + }} + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + + env := &EnvS6{ + Binds: make([]r.Value, 10), + } + all := make([]StmtS6, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = StmtS6{} + env.Code = all + + b.ResetTimer() +outer: + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + if stmt.Exec == nil { + continue outer + } + for j := 0; j < 5; j++ { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + if stmt, env = stmt.Exec(env); stmt.Exec != nil { + continue + } + } + } + } + } + } + } + } + } + } + } + } + } + } + continue outer + } + + all[n] = interrupt + env.Interrupt = interrupt + for { + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + stmt, env = stmt.Exec(env) + + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + continue outer + } + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/experiments/stmt_old_test.go b/vendor/github.com/cosmos72/gomacro/experiments/stmt_old_test.go new file mode 100644 index 0000000..f487e36 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/experiments/stmt_old_test.go @@ -0,0 +1,481 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * stmt_test.go + * + * Created on Apr 04, 2017 + * Author Massimiliano Ghilardi + */ + +package experiments + +import ( + r "reflect" + "testing" + "unsafe" +) + +type ( + Env0 struct { + Binds []r.Value + Outer *Env0 + } + Stmt0 func(env *Env0, code []Stmt0) (Stmt0, *Env0) +) + +func BenchmarkThreadedStmtFunc0(b *testing.B) { + + env := &Env0{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt0, n+1) + for i := 0; i < n; i++ { + i := i + all[i] = func(env *Env0, code []Stmt0) (Stmt0, *Env0) { + return code[i+1], env + } + } + all[n] = nil + + b.ResetTimer() + for i := 0; i < b.N; i++ { + stmt := all[0] + for stmt != nil { + stmt, env = stmt(env, all) + } + } +} + +type ( + Env1 struct { + Binds []r.Value + Outer *Env1 + IP int + } + Stmt1 func(env *Env1, all []Stmt1) (Stmt1, *Env1) +) + +func BenchmarkThreadedStmtFunc1(b *testing.B) { + + var nop Stmt1 = func(env *Env1, code []Stmt1) (Stmt1, *Env1) { + env.IP++ + return code[env.IP], env + } + + env := &Env1{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt1, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + stmt, env = stmt(env, all) + } + } +} + +type ( + Env2 struct { + Binds []r.Value + Outer *Env2 + Code []Stmt2 + } + Stmt2 func(env *Env2, ip int) (Stmt2, *Env2, int) +) + +func BenchmarkThreadedStmtFunc2(b *testing.B) { + + var nop Stmt2 = func(env *Env2, ip int) (Stmt2, *Env2, int) { + ip++ + return env.Code[ip], env, ip + } + + env := &Env2{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt2, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + ip := 0 + stmt := all[ip] + for stmt != nil { + stmt, env, ip = stmt(env, ip) + } + } +} + +type ( + Env3 struct { + Binds []r.Value + Outer *Env0 + Code []Stmt3 + } + Stmt3 func(env *Env3, ip int) (Stmt3, int) +) + +func BenchmarkThreadedStmtFunc3(b *testing.B) { + + var nop Stmt3 = func(env *Env3, ip int) (Stmt3, int) { + ip++ + return env.Code[ip], ip + } + env := &Env3{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt3, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + ip := 0 + stmt := all[ip] + for stmt != nil { + stmt, ip = stmt(env, ip) + } + } +} + +type ( + Env4 struct { + Binds []r.Value + Outer *Env4 + IP int + Code []Stmt4 + Interrupt Stmt4 + } + Stmt4 func(env *Env4) Stmt4 +) + +func BenchmarkThreadedStmtFunc4(b *testing.B) { + var nop Stmt4 = func(env *Env4) Stmt4 { + env.IP++ + return env.Code[env.IP] + } + env := &Env4{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt4, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + stmt = stmt(env) + } + } +} + +func BenchmarkThreadedStmtFunc4Unroll(b *testing.B) { + var nop Stmt4 = func(env *Env4) Stmt4 { + env.IP++ + return env.Code[env.IP] + } + env := &Env4{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt4, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + stmt = stmt(env) + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +func BenchmarkThreadedStmtFunc4Terminate(b *testing.B) { + var interrupt Stmt4 + interrupt = func(env *Env4) Stmt4 { + return interrupt + } + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + + var nop Stmt4 = func(env *Env4) Stmt4 { + env.IP++ + return env.Code[env.IP] + } + env := &Env4{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt4, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = interrupt + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for { + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + break + } + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + } + } +} + +func BenchmarkThreadedStmtFunc4Adaptive(b *testing.B) { + var nop Stmt4 = func(env *Env4) Stmt4 { + env.IP++ + return env.Code[env.IP] + } + var interrupt Stmt4 = func(env *Env4) Stmt4 { + return env.Interrupt + } + unsafeInterrupt := *(**uintptr)(unsafe.Pointer(&interrupt)) + _ = unsafeInterrupt + env := &Env4{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt4, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() +outer: + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + if stmt == nil { + continue outer + } + for j := 0; j < 5; j++ { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + if stmt = stmt(env); stmt != nil { + continue + } + } + } + } + } + } + } + } + } + } + } + } + } + } + continue outer + } + all[n] = interrupt + env.Interrupt = interrupt + for { + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + + if x := stmt; *(**uintptr)(unsafe.Pointer(&x)) == unsafeInterrupt { + continue outer + } + } + } +} + +func BenchmarkThreadedStmtFunc4Panic(b *testing.B) { + var terminate Stmt4 = func(env *Env4) Stmt4 { + panic("end of code") + } + + var nop Stmt4 = func(env *Env4) Stmt4 { + env.IP++ + return env.Code[env.IP] + } + env := &Env4{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt4, n+1) + for i := 0; i < n; i++ { + all[i] = nop + } + all[n] = terminate + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + runThreadedStmtFunc4Panic(env) + } +} + +func runThreadedStmtFunc4Panic(env *Env4) { + env.IP = 0 + stmt := env.Code[0] + defer func() { + recover() + }() + for { + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + stmt = stmt(env) + } +} + +type ( + Env5 struct { + Binds []r.Value + IP int + Code []Stmt5 + Outer *Env5 + } + Stmt5 func(**Env5) Stmt5 +) + +func BenchmarkThreadedStmtFunc5(b *testing.B) { + + var nop Stmt5 = func(penv **Env5) Stmt5 { + env := *penv + env.IP++ + return env.Code[env.IP] + } + + env := &Env5{ + Binds: make([]r.Value, 10), + } + all := make([]Stmt5, n+1) + for i := 0; i < n; i++ { + i := i + all[i] = nop + } + all[n] = nil + env.Code = all + + b.ResetTimer() + for i := 0; i < b.N; i++ { + env.IP = 0 + stmt := all[0] + for stmt != nil { + stmt = stmt(&env) + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/README.md b/vendor/github.com/cosmos72/gomacro/fast/README.md new file mode 100644 index 0000000..6dc82b2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/README.md @@ -0,0 +1,103 @@ +## gomacro - A Go interpreter with Lisp-like macros + +The package `fast` contains a faster reimplementation of gomacro interpreter. + +To learn about gomacro, download, compile and use it, please refer to the original implementation [README.md](../README.md) + +If you want to help with the reimplementation, or you are simply curious, read on :) + +## Current Status + +STABLE. + +The fast interpreter supports: +* multiline input - shared with the classic interpreter +* line comments starting with #! in addition to // - shared with the classic interpreter +* basic types: booleans, integers, floats, complex numbers, strings (and iota) +* the empty interface, i.e. interface{} - other interfaces not implemented yet +* constant, variable and type declarations (including untyped constants) +* Go 1.9 type aliases (experimental) +* unary and binary operators +* assignment, i.e. operators := = += -= *= /= %= &= |= ^= <<= >>= &^= +* composite types: arrays, channels, maps, pointers, slices, strings, structs (including composite literals) +* accessing struct fields, including embedded fields +* slicing +* type assertions and type conversions +* interface declarations (**only** declarations. interfaces cannot be implemented or used yet) +* importing and using interfaces declared (and implemented) by compiled code +* function declarations and calls, including variadic functions +* method declarations and calls, including wrapper methods for embedded fields +* closures +* Type.Method i.e. converting methods to functions (examples: time.Duration.Hours, fmt.Stringer.String) +* seamless invocation of compiled functions from interpreter, and vice-versa +* if, for, range, select, switch, type switch, break, continue, fallthrough, return (unimplemented: goto) +* all builtins: append, cap, close, complex, defer, delete, imag, len, make, new, panic, print, println, real, recover +* go i.e. goroutines +* imports + * Go standard packages "just work" + * importing other packages requires the "plugin" package (available only on Linux with Go 1.8+) +* ~quote, ~quasiquote, ~unquote, ~unquote_splice +* macro declarations, for example `macro foo(a, b, c interface{}) interface{} { return b }` +* macro calls, for example `foo; x; y; z` + +Missing features - you are welcome to contribute: +* goto +* interfaces. They can be declared, but nothing more: there is no way to implement them or call their methods + (interfaces declared in compiled code can be used, but not yet implemented by interpreted code) +* conversion from/to interpreted interfaces + +Current limitations: +* named types declared by interpreted code are approximated. + Inside the interpreter they look and behave correctly, but if you pass them to compiled code, + the type is actually unnamed. + + For example, if interpreted code declares `type Pair struct { A, B int }`, + then passes a `Pair` to compiled code, it will be received as `struct { A, B int }` + + The reason for such limitation is simple: the function `reflect.NamedOf()` does not exist, + so the interpreter uses `reflect.StructOf()` to define new types, + which can only create unnamed types. + +* recursive types declared by interpreted code are approximated. + Inside the interpreter they look and behave correctly, but if you pass them to compiled code, + the type is unnamed (as above) and self-references are actually interface{}. + + For example, if interpreted code declares `type List struct { First int; Rest *List }` + then passes a `List` to compiled code, it will be received as `struct { First int; Rest *interface{} }` + + The reason is the same as above: the interpreter uses `reflect.StructOf()` to define new types, + which cannot create recursive types. + + Interestingly, this means the interpreter also accepts the following declaration, + which is rejected by Go compiler: `type List2 struct { First int; Rest List2 }` + Note that `Rest` is a `List2` **not** a pointer to `List2` + +* interfaces declared by interpreted code are emulated. + Inside the interpreter they look and behave correctly, but if you pass them to compiled code, + the type is actually a pointer to a struct containing a header and a lot of functions. + + The reason is: the function `reflect.InterfaceOf()` does not exist, + so the interpreter has to emulate interfaces with `reflect.StructOf()` and a lot of bookkeeping + +* operators << and >> on untyped constants do not follow the exact type deduction rules. + The implemented behavior is: + * an untyped constant shifted by a non-constant expression always returns an int + * an untyped floating point constant shifted by a constant expression returns an untyped integer constant. + the interpreter signals an error during the precompile phase + if the left operand has a non-zero fractional or imaginary part, + or it overflows both int64 and uint64. + See [Go Language Specification](https://golang.org/ref/spec#Operators) for the correct behavior + +* recover() does not support mixing interpreted and compiled code: + if an interpreted function invokes as defer a compiled function, + or a compiled function invokes as defer an interpreted function, + then, inside that defer, recover() will not work: + it will return nil and will **not** stop panics. + + recover() works normally if the function and its defer are either + **both interpreted** or **both compiled**. + +Misc TODO notes: +* when importing a package, reuse compiled .so if exists already +* gomacro FILE: execute main() if (re)defined and package == "main" +* try to run Go compiler tests diff --git a/vendor/github.com/cosmos72/gomacro/fast/address.go b/vendor/github.com/cosmos72/gomacro/fast/address.go new file mode 100644 index 0000000..342af20 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/address.go @@ -0,0 +1,1699 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * address.go + * + * Created on Apr 05, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + "unsafe" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) AddressOf(node *ast.UnaryExpr) *Expr { return c.addressOf(node.X) } +func (c *Comp) addressOf(expr ast.Expr) *Expr { + for { + switch e := expr.(type) { + case *ast.ParenExpr: + expr = e.X + continue + case *ast.StarExpr: + + ret := c.Expr1(e.X) + if ret.Type.Kind() != r.Ptr { + c.Errorf("unary operation * on non-pointer <%v>: %v", ret.Type, e) + } + + } + break + } + place := c.placeOrAddress(expr, PlaceAddress) + + if place.IsVar() { + va := place.Var + return va.Address(c.Depth) + } else if place.Addr == nil { + c.Errorf("cannot take the address of %v <%v>", expr, place.Type) + return nil + } else { + + t := c.Universe.PtrTo(place.Type) + return exprX1(t, place.Addr) + } +} +func (c *Comp) AddressOfVar(name string) *Expr { + sym := c.Resolve(name) + va := sym.AsVar(PlaceAddress) + return va.Address(c.Depth) +} +func (va *Var) Address(maxdepth int) *Expr { + upn := va.Upn + k := va.Type.Kind() + index := va.Desc.Index() + if index == NoIndex { + base.Errorf("cannot take the address of %s: _", va.Desc.Class()) + return nil + } + var ret I + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + return env.Binds[index].Addr() + } + } + case 1: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env = env. + Outer + + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env = env. + Outer + + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env = env. + Outer + + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env = env. + Outer + + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env = env. + Outer + + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env = env. + Outer + + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env = env. + Outer + + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env = env. + Outer + + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env = env. + Outer + + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env = env. + Outer + + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env = env. + Outer + + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env = env. + Outer + + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env = env. + Outer + + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env = env. + Outer + + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env = env. + Outer + + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + env = env. + Outer + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + env = env. + Outer + return env.Binds[index].Addr() + + } + } + case 2: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env = env. + Outer.Outer + + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env = env. + Outer.Outer + + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + env = env. + Outer.Outer + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + env = env. + Outer.Outer + return env.Binds[index].Addr() + + } + } + default: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Binds[index].Addr() + + } + } + case maxdepth - 1: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env = env.ThreadGlobals.FileEnv + + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + env = env.ThreadGlobals.FileEnv + return env.Binds[index].Addr() + + } + } + case maxdepth: + switch k { + case r.Bool: + + if intbinds { + ret = func(env *Env) *bool { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*bool)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *bool { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*bool) + } + } + case r.Int: + + if intbinds { + ret = func(env *Env) *int { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*int)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*int) + } + } + case r.Int8: + + if intbinds { + ret = func(env *Env) *int8 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int8 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*int8) + } + } + case r.Int16: + + if intbinds { + ret = func(env *Env) *int16 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int16 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*int16) + } + } + case r.Int32: + + if intbinds { + ret = func(env *Env) *int32 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int32 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*int32) + } + } + case r.Int64: + + if intbinds { + ret = func(env *Env) *int64 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *int64 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*int64) + } + } + case r.Uint: + + if intbinds { + ret = func(env *Env) *uint { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*uint)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uint) + } + } + case r.Uint8: + + if intbinds { + ret = func(env *Env) *uint8 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*uint8)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint8 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uint8) + } + } + case r.Uint16: + + if intbinds { + ret = func(env *Env) *uint16 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*uint16)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint16 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uint16) + } + } + case r.Uint32: + + if intbinds { + ret = func(env *Env) *uint32 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*uint32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uint32 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uint32) + } + } + case r.Uint64: + + if intbinds { + ret = func(env *Env) *uint64 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return &env.IntBinds[index] + + } + } else { + ret = func(env *Env) *uint64 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uint64) + } + } + case r.Uintptr: + + if intbinds { + ret = func(env *Env) *uintptr { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*uintptr)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *uintptr { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*uintptr) + } + } + case r.Float32: + + if intbinds { + ret = func(env *Env) *float32 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*float32)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float32 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*float32) + } + } + case r.Float64: + + if intbinds { + ret = func(env *Env) *float64 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*float64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *float64 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*float64) + } + } + case r.Complex64: + + if intbinds { + ret = func(env *Env) *complex64 { + env = env.ThreadGlobals.TopEnv + + env.AddressTaken = true + return (*complex64)(unsafe.Pointer(&env.IntBinds[index])) + + } + } else { + ret = func(env *Env) *complex64 { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr().Interface().(*complex64) + } + } + default: + + ret = func(env *Env) r.Value { + env = env.ThreadGlobals.TopEnv + return env.Binds[index].Addr() + + } + } + } + return &Expr{Lit: Lit{Type: xr.PtrTo(va.Type)}, Fun: ret} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/address.gomacro b/vendor/github.com/cosmos72/gomacro/fast/address.gomacro new file mode 100644 index 0000000..6d4424c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/address.gomacro @@ -0,0 +1,202 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * address.go + * + * Created on Apr 05, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + "unsafe" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + "go/ast" + r "reflect" +) + +:const ( + // conventional values + AnyDepth = -1 + FileDepth = -2 + TopDepth = -3 +) + +:func faddress(upn int, typ ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + var decls, addresstaken, bind, rettype ast.Node + + if upn == 0 { + decls = ~'{{ }} + } else if upn > 0 { + decls = ~'env + for i := 0; i < upn; i++ { + decls = ~"{~,decls. Outer} + } + decls = ~"{{ + env = ~,decls + }} + } else if upn == FileDepth { + decls = ~'{{env = env.ThreadGlobals.FileEnv}} + } else if upn == TopDepth { + decls = ~'{{env = env.ThreadGlobals.TopEnv}} + } else { + decls = ~'{ + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + } + } + if t == nil { + // no need to set env.AddressTaken = true + // because env.Binds[index] actually contains a pointer to the variable + bind = ~'{env .Binds[index].Addr()} + rettype = ~'{r.Value} + return ~"{ + ret = func(env *Env) (~,rettype) { + ~,@decls + return ~,bind + } + } + } + + addresstaken = ~"{{env.AddressTaken = true}} + rettype = ~"{* ~,typ} + if t.Kind() == r.Uint64 { + bind = ~'{&env.IntBinds[index]} + } else { + bind = ~"{(*~,typ)(unsafe.Pointer(&env.IntBinds[index]))} + } + + return ~"{ + if intbinds { + ret = func(env *Env) (~,rettype) { + ~,@decls + ~,addresstaken + return ~,bind + } + } else { + ret = func(env *Env) (~,rettype) { + ~,@decls + return env.Binds[index].Addr().Interface().(~,rettype) + } + } + } +} + +:macro address(depth ast.Node, typ ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var upn int = Eval(depth).(int) + + return faddress(upn, typ) +} + +:macro addresses(depth ast.Node) ast.Node { + return ~"{ + switch k { + case r.Bool: address; ~,depth; bool + case r.Int: address; ~,depth; int + case r.Int8: address; ~,depth; int8 + case r.Int16: address; ~,depth; int16 + case r.Int32: address; ~,depth; int32 + case r.Int64: address; ~,depth; int64 + case r.Uint: address; ~,depth; uint + case r.Uint8: address; ~,depth; uint8 + case r.Uint16: address; ~,depth; uint16 + case r.Uint32: address; ~,depth; uint32 + case r.Uint64: address; ~,depth; uint64 + case r.Uintptr: address; ~,depth; uintptr + case r.Float32: address; ~,depth; float32 + case r.Float64: address; ~,depth; float64 + case r.Complex64: address; ~,depth; complex64 + default: address; ~,depth; nil + } + } +} + +func (c *Comp) AddressOf(node *ast.UnaryExpr) *Expr { + return c.addressOf(node.X) +} + +func (c *Comp) addressOf(expr ast.Expr) *Expr { + for { + switch e := expr.(type) { + case *ast.ParenExpr: + expr = e.X + continue + case *ast.StarExpr: + // optimize & * x -> x, but check that x is a pointer + ret := c.Expr1(e.X) + if ret.Type.Kind() != r.Ptr { + c.Errorf("unary operation * on non-pointer <%v>: %v", ret.Type, e) + } + } + break + } + place := c.placeOrAddress(expr, PlaceAddress) + // c.Debugf("AddressOf: place %v has type %v, taking its address", expr, place.Type) + if place.IsVar() { + va := place.Var // make a copy of place.Var, do not alter the original's type + return va.Address(c.Depth) + } else if place.Addr == nil { + c.Errorf("cannot take the address of %v <%v>", expr, place.Type) + return nil + } else { + // placeOrAddress returns the dereferenced type... fix it + t := c.Universe.PtrTo(place.Type) + return exprX1(t, place.Addr) + } +} + +func (c *Comp) AddressOfVar(name string) *Expr { + sym := c.Resolve(name) + va := sym.AsVar(PlaceAddress) + return va.Address(c.Depth) +} + +func (va *Var) Address(maxdepth int) *Expr { + upn := va.Upn + k := va.Type.Kind() + index := va.Desc.Index() + if index == NoIndex { + base.Errorf("cannot take the address of %s: _", va.Desc.Class()) + return nil + } + var ret I + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: addresses; 0 + case 1: addresses; 1 + case 2: addresses; 2 + default: addresses; -1 + case maxdepth-1: addresses; -2 + case maxdepth: addresses; -3 + } + return &Expr{Lit: Lit{Type: xr.PtrTo(va.Type)}, Fun: ret} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/assignment.go b/vendor/github.com/cosmos72/gomacro/fast/assignment.go new file mode 100644 index 0000000..c8246dd --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/assignment.go @@ -0,0 +1,426 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * declaration.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" +) + +type Assign struct { + placefun func(*Env) r.Value + placekey func(*Env) r.Value + setvar func(*Env, r.Value) + setplace func(r.Value, r.Value, r.Value) +} + +func (a *Assign) init(c *Comp, place *Place) { + if place.IsVar() { + a.setvar = c.varSetValue(&place.Var) + } else { + a.placefun = place.Fun + a.placekey = place.MapKey + a.setplace = c.placeSetValue(place) + } +} + +// Assign compiles an *ast.AssignStmt into an assignment to one or more place +func (c *Comp) Assign(node *ast.AssignStmt) { + c.Pos = node.Pos() + + lhs, rhs := node.Lhs, node.Rhs + if node.Tok == token.DEFINE { + c.DeclVarsShort(lhs, rhs) + return + } + ln, rn := len(lhs), len(rhs) + if node.Tok == token.ASSIGN { + if ln < 1 || (rn != 1 && ln != rn) { + c.Errorf("invalid assignment, cannot assign %d values to %d places: %v", rn, ln, node) + } + } else if ln != 1 || rn != 1 { + c.Errorf("invalid assignment, operator %s does not support multiple parallel assignments: %v", node.Tok, node) + } + + // the naive loop + // for i := range lhs { c.assign1(lhs[i], node.Tok, rhs[i]) } + // is bugged. It breaks, among others, the common Go idiom to swap two values: a,b = b,a + // + // More accurately, Go states at: https://golang.org/ref/spec#Assignments + // + // "The assignment proceeds in two phases. First, the operands of index expressions + // and pointer indirections (including implicit pointer indirections in selectors) + // on the left and the expressions on the right are all evaluated in the usual order. + // Second, the assignments are carried out in left-to-right order." + // + // A solution is to evaluate left-to-right all places on the left, + // then all expressions on the right, then perform all the assignments + + places := make([]*Place, ln) + exprs := make([]*Expr, rn) + canreorder := true + for i, li := range lhs { + places[i] = c.Place(li) + canreorder = canreorder && places[i].IsVar() // ach, needed. see for example i := 0; i, x[i] = 1, 2 // set i = 1, x[0] = 2 + } + if rn == 1 && ln > 1 { + exprs[0] = c.Expr(rhs[0]) + canreorder = false + } else { + for i, ri := range rhs { + exprs[i] = c.Expr1(ri) + canreorder = canreorder && exprs[i].Const() + } + } + if ln == rn && (ln <= 1 || canreorder) { + for i := range lhs { + c.assign1(lhs[i], node.Tok, rhs[i], places[i], exprs[i]) + } + return + } + // problem: we need to create temporary copies of the evaluations + // before performing the assignments. Such temporary copies must be per-goroutine! + // + // so a technique like the following is bugged, + // because it creates a *single* global location for the temporary copy: + // var tmp r.Value + // func set(env *Env) { tmp = places[i].Fun(env) } + // func get(env *Env) r.Value { return tmp } + + assign := make([]Assign, ln) + for i, place := range places { + assign[i].init(c, place) + } + + exprfuns, exprxv := c.assignPrepareRhs(node, places, exprs) + + c.Pos = node.Pos() + if ln == 2 && rn == 2 && assign[0].placekey == nil && assign[1].placekey == nil { + c.assign2(assign, exprfuns) + } else { + c.assignMulti(assign, exprfuns, exprxv) + } +} + +func (c *Comp) assignPrepareRhs(node *ast.AssignStmt, places []*Place, exprs []*Expr) ([]func(*Env) r.Value, func(*Env) (r.Value, []r.Value)) { + lhs, rhs := node.Lhs, node.Rhs + ln, rn := len(lhs), len(rhs) + if ln == rn { + exprfuns := make([]func(*Env) r.Value, rn) + for i, expr := range exprs { + tplace := places[i].Type + if expr.Const() { + expr.ConstTo(tplace) + } else if expr.Type.AssignableTo(tplace) { + expr.To(c, tplace) + } else { + c.Pos = rhs[i].Pos() + c.Errorf("cannot use <%v> as <%v> in assignment: %v %v %v", expr.Type, tplace, lhs[i], node.Tok, rhs[i]) + } + exprfuns[i] = expr.AsX1() + } + return exprfuns, nil + } + if rn == 1 { + expr := exprs[0] + nexpr := expr.NumOut() + if nexpr != ln { + c.Pos = node.Pos() + c.Errorf("invalid assignment: expression returns %d values, cannot assign them to %d places: %v", nexpr, ln, node) + } + convs := make([]func(r.Value, r.Type) r.Value, nexpr) + rtypes := make([]r.Type, nexpr) + needconvs := false + for i := 0; i < nexpr; i++ { + texpr := expr.Out(i) + tplace := places[i].Type + if !texpr.AssignableTo(tplace) { + c.Pos = lhs[i].Pos() + c.Errorf("cannot assign <%v> to %v <%v> in multiple assignment", texpr, lhs[i], tplace) + } else if conv := c.Converter(texpr, tplace); conv != nil { + convs[i] = conv + rtypes[i] = tplace.ReflectType() + needconvs = true + } + } + f := expr.AsXV(OptDefaults) + if needconvs { + return nil, func(env *Env) (r.Value, []r.Value) { + _, vs := f(env) + for i, conv := range convs { + if conv != nil { + vs[i] = conv(vs[i], rtypes[i]) + } + } + return vs[0], vs + } + } + return nil, f + } + c.Pos = node.Pos() + c.Errorf("invalid assignment, cannot assign %d values to %d places: %v", rn, ln, node) + return nil, nil +} + +// assign2 compiles multiple assignment to two places +func (c *Comp) assign2(assign []Assign, exprfuns []func(*Env) r.Value) { + efuns := [2]func(*Env) r.Value{exprfuns[0], exprfuns[1]} + var stmt Stmt + if assign[0].placefun == nil { + if assign[1].placefun == nil { + setvars := [2]func(*Env, r.Value){assign[0].setvar, assign[1].setvar} + stmt = func(env *Env) (Stmt, *Env) { + val0 := efuns[0](env) + val1 := efuns[1](env) + setvars[0](env, val0) + setvars[1](env, val1) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + obj1 := assign[1].placefun(env) + val0 := efuns[0](env) + val1 := efuns[1](env) + assign[0].setvar(env, val0) + assign[1].setplace(obj1, obj1, val1) + env.IP++ + return env.Code[env.IP], env + } + } + } else { + if assign[1].placefun == nil { + stmt = func(env *Env) (Stmt, *Env) { + obj0 := assign[0].placefun(env) + val0 := efuns[0](env) + val1 := efuns[1](env) + assign[0].setplace(obj0, obj0, val0) + assign[1].setvar(env, val1) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + obj0 := assign[0].placefun(env) + obj1 := assign[1].placefun(env) + val0 := efuns[0](env) + val1 := efuns[1](env) + assign[0].setplace(obj0, obj0, val0) + assign[1].setplace(obj1, obj1, val1) + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(stmt) +} + +// assignMulti compiles multiple assignment to places +func (c *Comp) assignMulti(assign []Assign, exprfuns []func(*Env) r.Value, exprxv func(*Env) (r.Value, []r.Value)) { + stmt := func(env *Env) (Stmt, *Env) { + n := len(assign) + // these buffers must be allocated at runtime, per goroutine! + objs := make([]r.Value, n) + keys := make([]r.Value, n) + var tmp r.Value + var a *Assign + // evaluate all lhs + for i := range assign { + if a = &assign[i]; a.placefun == nil { + continue + } + objs[i] = a.placefun(env) + if a.placekey == nil { + continue + } + // assigning to obj[key] where obj is a map: + // obj and key do NOT need to be settable, + // and actually Go spec tell to make a copy of their values + if tmp = objs[i]; tmp.CanSet() { + objs[i] = tmp.Convert(tmp.Type()) + } + if tmp = a.placekey(env); tmp.CanSet() { + tmp = tmp.Convert(tmp.Type()) + } + keys[i] = tmp + } + // evaluate all rhs + var vals []r.Value + if exprxv != nil { + _, vals = exprxv(env) + } else { + vals = make([]r.Value, n) + for i, exprfun := range exprfuns { + vals[i] = exprfun(env) + } + } + // execute assignments + for i := range assign { + a := &assign[i] + if a.setvar != nil { + a.setvar(env, vals[i]) + } else { + a.setplace(objs[i], keys[i], vals[i]) + } + } + env.IP++ + return env.Code[env.IP], env + } + c.append(stmt) +} + +// assign1 compiles a single assignment to a place +func (c *Comp) assign1(lhs ast.Expr, op token.Token, rhs ast.Expr, place *Place, init *Expr) { + panicking := true + defer func() { + if !panicking { + return + } + rec := recover() + node := &ast.AssignStmt{Lhs: []ast.Expr{lhs}, Tok: op, Rhs: []ast.Expr{rhs}} // for nice error messages + c.Errorf("error compiling assignment: %v\n\t%v", node, rec) + }() + if place.IsVar() { + c.SetVar(&place.Var, op, init) + } else { + c.SetPlace(place, op, init) + } + panicking = false +} + +// LookupVar compiles the left-hand-side of an assignment, in case it's an identifier (i.e. a variable name) +func (c *Comp) LookupVar(name string) *Var { + if name == "_" { + return &Var{} + } + sym := c.Resolve(name) + return sym.AsVar(PlaceSettable) +} + +// Place compiles the left-hand-side of an assignment +func (c *Comp) Place(node ast.Expr) *Place { + return c.placeOrAddress(node, false) +} + +// PlaceOrAddress compiles the left-hand-side of an assignment or the location of an address-of +func (c *Comp) placeOrAddress(in ast.Expr, opt PlaceOption) *Place { + for { + if in != nil { + c.Pos = in.Pos() + } + switch node := in.(type) { + case *ast.CompositeLit: + // composite literals are addressable but not settable + if opt == PlaceSettable { + c.Errorf("%s composite literal", opt) + } + e := c.Expr1(node) + fun := e.AsX1() + var addr func(*Env) r.Value + switch e.Type.Kind() { + case r.Array, r.Struct: + // array and struct composite literals are directly addressable + // because they are created with reflect.New(t).Elem() + addr = func(env *Env) r.Value { + return fun(env).Addr() + } + default: + // other composite literals (maps, slices) are not directly addressable: + // the result of reflect.MakeMap and reflect.MakeSlice is not addressable, + // so implement a workaround to behave as compiled Go. + // + // 'addr' below creates a new pointer-to-t at each execution, + // but since the map or slice is freshly created each time + // and 'addr' below is the only one code accessing it, + // it's not a problem + addr = func(env *Env) r.Value { + obj := fun(env) + place := r.New(obj.Type()) + place.Elem().Set(obj) + return place + } + } + return &Place{Var: Var{Type: e.Type}, Fun: fun, Addr: addr} + case *ast.Ident: + return c.IdentPlace(node.Name, opt) + case *ast.IndexExpr: + return c.IndexPlace(node, opt) + case *ast.ParenExpr: + in = node.X + continue + case *ast.StarExpr: + e := c.Expr1(node.X) + if e.Const() { + c.Errorf("%s a constant: %v <%v>", opt, node, e.Type) + return nil + } + // we cannot optimize the case "node.X is a variable" because we are compiling *variable, not variable + // e.Fun is already the address we want, dereference its type + t := e.Type.Elem() + // c.Debugf("placeOrAddress: %v has type %v, transformed into: %v has type %v", node.X, e.Type, node, t) + addr := e.AsX1() + fun := func(env *Env) r.Value { + return addr(env).Elem() + } + return &Place{Var: Var{Type: t}, Fun: fun, Addr: addr} + case *ast.SelectorExpr: + return c.SelectorPlace(node, opt) + default: + c.Errorf("%s: %v", opt, in) + return nil + } + } +} + +// placeForSideEffects compiles the left-hand-side of a do-nothing assignment, +// as for example *addressOfInt() += 0, in order to apply its side effects +func (c *Comp) placeForSideEffects(place *Place) { + if place.IsVar() { + return + } + var ret Stmt + fun := place.Fun + if mapkey := place.MapKey; mapkey != nil { + ret = func(env *Env) (Stmt, *Env) { + fun(env) + mapkey(env) + // no need to call obj.MapIndex(key): it has no side effects and cannot panic. + // obj := fun(env) + // key := mapkey(env) + // obj.MapIndex(key) + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + } + c.append(ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary.go b/vendor/github.com/cosmos72/gomacro/fast/binary.go new file mode 100644 index 0000000..cfc7eb8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary.go @@ -0,0 +1,397 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/constant" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (c *Comp) BinaryExpr(node *ast.BinaryExpr) *Expr { + x := c.Expr(node.X) + y := c.Expr(node.Y) + if x.NumOut() == 0 { + c.Errorf("operand returns no values, cannot use in binary expression: %v", node.X) + } else if y.NumOut() == 0 { + c.Errorf("operand returns no values, cannot use in binary expression: %v", node.Y) + } + return c.BinaryExpr1(node, x, y) +} + +func (c *Comp) BinaryExpr1(node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + if x.Untyped() && y.Untyped() { + return c.BinaryExprUntyped(node, x.Value.(UntypedLit), y.Value.(UntypedLit)) + } + bothConst := x.Const() && y.Const() + var z *Expr + + switch node.Op { + case token.ADD, token.ADD_ASSIGN: + z = c.Add(node, x, y) + case token.SUB, token.SUB_ASSIGN: + z = c.Sub(node, x, y) + case token.MUL, token.MUL_ASSIGN: + z = c.Mul(node, x, y) + case token.QUO, token.QUO_ASSIGN: + z = c.Quo(node, x, y) + case token.REM, token.REM_ASSIGN: + z = c.Rem(node, x, y) + case token.AND, token.AND_ASSIGN: + z = c.And(node, x, y) + case token.OR, token.OR_ASSIGN: + z = c.Or(node, x, y) + case token.XOR, token.XOR_ASSIGN: + z = c.Xor(node, x, y) + case token.SHL, token.SHL_ASSIGN: + z = c.Shl(node, x, y) + case token.SHR, token.SHR_ASSIGN: + z = c.Shr(node, x, y) + case token.AND_NOT, token.AND_NOT_ASSIGN: + z = c.Andnot(node, x, y) + case token.LAND: + z = c.Land(node, x, y) + case token.LOR: + z = c.Lor(node, x, y) + case token.EQL: + z = c.Eql(node, x, y) + case token.LSS: + z = c.Lss(node, x, y) + case token.GTR: + z = c.Gtr(node, x, y) + case token.NEQ: + z = c.Neq(node, x, y) + case token.LEQ: + z = c.Leq(node, x, y) + case token.GEQ: + z = c.Geq(node, x, y) + default: + return c.unimplementedBinaryExpr(node, x, y) + } + if bothConst { + // constant propagation + z.EvalConst(OptKeepUntyped) + } + return z +} + +func (c *Comp) BinaryExprUntyped(node *ast.BinaryExpr, x UntypedLit, y UntypedLit) *Expr { + op := node.Op + switch op { + case token.LAND, token.LOR: + xb, yb := x.ConstTo(c.TypeOfBool()).(bool), y.ConstTo(c.TypeOfBool()).(bool) + var flag bool + if op == token.LAND { + flag = xb && yb + } else { + flag = xb || yb + } + return c.exprUntypedLit(r.Bool, constant.MakeBool(flag)) + case token.EQL, token.LSS, token.GTR, token.NEQ, token.LEQ, token.GEQ: + // comparison gives an untyped bool + flag := constant.Compare(x.Obj, op, y.Obj) + return c.exprUntypedLit(r.Bool, constant.MakeBool(flag)) + case token.SHL, token.SHL_ASSIGN: + return c.ShiftUntyped(node, token.SHL, x, y) + case token.SHR, token.SHR_ASSIGN: + return c.ShiftUntyped(node, token.SHR, x, y) + default: + op2 := tokenWithoutAssign(op) + xint := base.KindToCategory(x.Kind) == r.Int + yint := base.KindToCategory(y.Kind) == r.Int + if op2 == token.QUO && xint && yint { + // untyped integer division + op2 = token.QUO_ASSIGN + } + zobj := constant.BinaryOp(x.Obj, op2, y.Obj) + zkind := constantKindToUntypedLitKind(zobj.Kind()) + // c.Debugf("untyped binary expression %v %s %v returned {%v %v}", x, op2, y, zkind, zobj) + // reflect.Int32 (i.e. rune) has precedence over reflect.Int + if zobj.Kind() == constant.Int { + if xint && x.Kind != r.Int { + zkind = x.Kind + } else if yint && y.Kind != r.Int { + zkind = y.Kind + } + } + if zkind == r.Invalid { + c.Errorf("invalid binary operation: %v %v %v", x.Obj, op, y.Obj) + } + return c.exprUntypedLit(zkind, zobj) + } +} + +func tokenWithoutAssign(op token.Token) token.Token { + switch op { + case token.ADD_ASSIGN: + op = token.ADD + case token.SUB_ASSIGN: + op = token.SUB + case token.MUL_ASSIGN: + op = token.MUL + case token.QUO_ASSIGN: + op = token.QUO + case token.REM_ASSIGN: + op = token.REM + case token.AND_ASSIGN: + op = token.AND + case token.OR_ASSIGN: + op = token.OR + case token.XOR_ASSIGN: + op = token.XOR + case token.SHL_ASSIGN: + op = token.SHL + case token.SHR, token.SHR_ASSIGN: + op = token.SHR + case token.AND_NOT_ASSIGN: + op = token.AND_NOT + } + return op +} + +var warnUntypedShift, warnUntypedShift2 = true, true + +func (c *Comp) ShiftUntyped(node *ast.BinaryExpr, op token.Token, x UntypedLit, y UntypedLit) *Expr { + if y.Obj.Kind() != constant.Int { + c.Errorf("invalid shift: %v %v %v", x.Obj, op, y.Obj) + } + yn64, exact := constant.Uint64Val(y.Obj) + yn := uint(yn64) + if !exact || uint64(yn) != yn64 { + c.Errorf("invalid shift: %v %v %v", x.Obj, op, y.Obj) + } + xn := x.Obj + xkind := x.Kind + switch xkind { + case r.Int, r.Int32: + // nothing to do + case r.Float64, r.Complex128: + if warnUntypedShift { + c.Warnf("known limitation (warned only once): untyped floating point constant shifted by untyped constant. returning untyped integer instead of deducing the type from the surrounding context: %v", + node) + warnUntypedShift = false + } + sign := constant.Sign(xn) + if xkind == r.Complex128 { + sign = constant.Sign(constant.Real(xn)) + } + if sign >= 0 { + xn = constant.MakeUint64(x.ConstTo(c.TypeOfUint64()).(uint64)) + } else { + xn = constant.MakeInt64(x.ConstTo(c.TypeOfInt64()).(int64)) + } + xkind = r.Int + default: + c.Errorf("invalid shift: %v %v %v", x.Obj, op, y.Obj) + } + zobj := constant.Shift(xn, op, yn) + if zobj.Kind() == constant.Unknown { + c.Errorf("invalid shift: %v %v %v", x.Obj, op, y.Obj) + } + return c.exprUntypedLit(xkind, zobj) +} + +// prepareShift panics if the types of xe and ye are not valid for shifts i.e. << or >> +// returns non-nil expression if it computes the shift operation itself +func (c *Comp) prepareShift(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if xe.Untyped() && ye.Untyped() { + // untyped << untyped should not happen here, it's handled in Comp.BinaryExpr... but let's be safe + return c.ShiftUntyped(node, node.Op, xe.Value.(UntypedLit), ye.Value.(UntypedLit)) + } + xet, yet := xe.DefaultType(), ye.DefaultType() + if xet == nil || !base.IsCategory(xet.Kind(), r.Int, r.Uint) { + return c.invalidBinaryExpr(node, xe, ye) + } + if xe.Untyped() { + xuntyp := xe.Value.(UntypedLit) + if ye.Const() { + // untyped << typed + yuntyp := UntypedLit{r.Int, constant.MakeUint64(r.ValueOf(ye.Value).Uint()), c.Universe} + return c.ShiftUntyped(node, node.Op, xuntyp, yuntyp) + } + // untyped << expression + // BUG! we should deduce left operand type from its context, instead of assuming int + // see https://golang.org/ref/spec#Operators + // + // "If the left operand of a non-constant shift expression is an untyped constant, + // "it is first converted to the type it would assume if the shift expression + // "were replaced by its left operand alone." + if warnUntypedShift2 { + c.Warnf("known limitation (warned only once): untyped constant shifted by a non-constant expression. returning int instead of deducing the type from the surrounding context: %v", + node) + warnUntypedShift2 = false + } + xe.ConstTo(c.TypeOfInt()) + } + if ye.Untyped() { + // untyped constants do not distinguish between int and uint + if yet == nil || !base.IsCategory(yet.Kind(), r.Int) { + return c.invalidBinaryExpr(node, xe, ye) + } + ye.ConstTo(c.TypeOfUint64()) + } else { + if yet == nil || !base.IsCategory(yet.Kind(), r.Uint) { + return c.invalidBinaryExpr(node, xe, ye) + } + } + xe.WithFun() + ye.WithFun() + return nil +} + +func (c *Comp) Land(node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + xval, xfun, xerr := x.TryAsPred() + yval, yfun, yerr := y.TryAsPred() + if xerr || yerr { + return c.invalidBinaryExpr(node, x, y) + } + // optimize short-circuit logic + if xfun == nil { + if xval { + return y + } + return c.exprValue(nil, false) + } + if yfun == nil { + if yval { + return x + } + return c.exprBool(func(env *Env) bool { + return xfun(env) && false + }) + } + return c.exprBool(func(env *Env) bool { + return xfun(env) && yfun(env) + }) +} + +func (c *Comp) Lor(node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + xval, xfun, xerr := x.TryAsPred() + yval, yfun, yerr := y.TryAsPred() + if xerr || yerr { + return c.invalidBinaryExpr(node, x, y) + } + // optimize short-circuit logic + if xfun == nil { + if xval { + return c.exprValue(nil, true) + } + return y + } + if yfun == nil { + if yval { + return c.exprBool(func(env *Env) bool { + return xfun(env) || true + }) + } + return x + } + return c.exprBool(func(env *Env) bool { + return xfun(env) || yfun(env) + }) +} + +func (c *Comp) invalidBinaryExpr(node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + return c.badBinaryExpr("invalid", node, x, y) +} + +func (c *Comp) unimplementedBinaryExpr(node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + return c.badBinaryExpr("unimplemented", node, x, y) +} + +func (c *Comp) badBinaryExpr(reason string, node *ast.BinaryExpr, x *Expr, y *Expr) *Expr { + opstr := mt.String(node.Op) + var xstr, ystr string + if x.Const() { + xstr = x.String() + " " + } + if y.Const() { + ystr = y.String() + " " + } + c.Errorf("%s binary operation %s between %s<%v> and %s<%v>: %v %s %v", + reason, opstr, xstr, x.Type, ystr, y.Type, node.X, opstr, node.Y) + return nil +} + +// convert x and y to the same single-valued expression type. needed to convert untyped constants to regular Go types +func (c *Comp) toSameFuncType(node ast.Expr, xe *Expr, ye *Expr) { + xe.CheckX1() + ye.CheckX1() + xconst, yconst := xe.Const(), ye.Const() + if yconst { + if xconst { + c.constsToSameType(node, xe, ye) + xe.WithFun() + ye.WithFun() + } else { + ye.ConstTo(xe.Type) + } + } else if xconst { + xe.ConstTo(ye.Type) + } else if xe.Type.ReflectType() != ye.Type.ReflectType() { + c.mismatchedTypes(node, xe, ye) + } +} + +func (c *Comp) constsToSameType(node ast.Expr, xe *Expr, ye *Expr) { + x, y := xe.Value, ye.Value + if x == nil { + if y == nil { + return + } else { + switch node := node.(type) { + case *ast.BinaryExpr: + c.invalidBinaryExpr(node, xe, ye) + default: + c.Errorf("invalid operation between %v <%v> and %v <%v>: %v", x, xe.Type, y, ye.Type, node) + } + } + } + xu, yu := xe.Untyped(), ye.Untyped() + if xu && yu { + c.Errorf("internal error, operation between untyped constants %v and %v not optimized away: %v", + xe.Lit, ye.Lit, node) + } else if xu { + xe.ConstTo(ye.Type) + } else if yu { + ye.ConstTo(xe.Type) + } else if xe.Type.ReflectType() != ye.Type.ReflectType() { + c.mismatchedTypes(node, xe, ye) + } +} + +func (c *Comp) mismatchedTypes(node ast.Expr, xe *Expr, ye *Expr) { + switch node := node.(type) { + case *ast.BinaryExpr: + c.badBinaryExpr("mismatched types in", node, xe, ye) + default: + c.Errorf("mismatched types %v and %v in: %v", xe.Type, ye.Type, node) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.go b/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.go new file mode 100644 index 0000000..1d5a3e9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.go @@ -0,0 +1,1185 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_eql.go + * + * Created on Apr 02, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) Eql(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if xe.IsNil { + if ye.IsNil { + return c.invalidBinaryExpr(node, xe, ye) + } else { + return c.eqlneqNil(node, xe, ye) + } + } else if ye.IsNil { + return c.eqlneqNil(node, xe, ye) + } + + if !xe.Type.Comparable() || !xe.Type.Comparable() { + return c.invalidBinaryExpr(node, xe, ye) + } + + xc, yc := xe.Const(), ye.Const() + if xe.Type.Kind() != r.Interface && ye.Type.Kind() != r.Interface { + c.toSameFuncType(node, xe, ye) + } + + k := xe.Type.Kind() + yk := ye.Type.Kind() + + var fun func(env *Env) bool + if k != yk { + + } else if xc == yc { + x, y := xe.Fun, ye.Fun + switch k { + case r.Bool: + { + x := x.(func(*Env) bool) + y := y.(func(*Env) bool) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) == y(env) } + + } + + } + + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + if k == r.Bool && yv.Bool() { + return xe + } + switch k { + case r.Bool: + + { + x := x.(func(*Env) bool) + y := yv.Bool() + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Float32: + + { + x := x.(func(*Env) float32) + y := + + float32(yv.Float()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Float64: + + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Complex64: + + { + x := x.(func(*Env) complex64) + y := + + complex64(yv.Complex()) + fun = func(env *Env) bool { return x(env) == y } + + } + case r.Complex128: + + { + x := x.(func(*Env) complex128) + y := yv.Complex() + fun = func(env *Env) bool { return x(env) == y } + + } + case r.String: + + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) == y } + + } + } + + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + if k == r.Bool && xv.Bool() { + return ye + } + switch k { + case r.Bool: + + { + x := xv.Bool() + + y := y.(func(*Env) bool) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Float32: + + { + x := + + float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Complex64: + + { + x := + + complex64( + + xv.Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.Complex128: + + { + x := xv.Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) bool { return x == y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x == y(env) } + + } + } + + } + if fun != nil { + return c.exprBool(fun) + } + return c.eqlneqMisc(node, xe, ye) +} +func (c *Comp) Neq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if xe.IsNil { + if ye.IsNil { + return c.invalidBinaryExpr(node, xe, ye) + } else { + return c.eqlneqNil(node, xe, ye) + } + } else if ye.IsNil { + return c.eqlneqNil(node, xe, ye) + } + + if !xe.Type.Comparable() || !xe.Type.Comparable() { + return c.invalidBinaryExpr(node, xe, ye) + } + + xc, yc := xe.Const(), ye.Const() + if xe.Type.Kind() != r.Interface && ye.Type.Kind() != r.Interface { + c.toSameFuncType(node, xe, ye) + } + + k := xe.Type.Kind() + yk := ye.Type.Kind() + + var fun func(env *Env) bool + if k != yk { + + } else if xc == yc { + x, y := xe.Fun, ye.Fun + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) != y(env) } + + } + + } + + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + if k == r.Bool && !yv.Bool() { + return xe + } + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Float32: + + { + x := x.(func(*Env) float32) + y := + + float32(yv.Float()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Float64: + + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Complex64: + + { + x := x.(func(*Env) complex64) + y := + + complex64(yv.Complex()) + fun = func(env *Env) bool { return x(env) != y } + + } + case r.Complex128: + + { + x := x.(func(*Env) complex128) + y := yv.Complex() + fun = func(env *Env) bool { return x(env) != y } + + } + case r.String: + + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) != y } + + } + } + + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + if k == r.Bool && !xv.Bool() { + return ye + } + switch k { + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Float32: + + { + x := + + float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Complex64: + + { + x := + + complex64( + + xv.Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.Complex128: + + { + x := xv.Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) bool { return x != y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x != y(env) } + + } + } + + } + if fun != nil { + return c.exprBool(fun) + } + return c.eqlneqMisc(node, xe, ye) +} +func (c *Comp) eqlneqMisc(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + var fun func(*Env) bool + + if xe.Type.Kind() == r.Interface || ye.Type.Kind() == r.Interface { + + xe.CheckX1() + ye.CheckX1() + } + + switch x := xe.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + switch y := ye.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1, _ := x(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + + } + } else { + fun = func(env *Env) bool { + v1, _ := x(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + + } + } + + default: + y1 := ye.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1, _ := x(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + + } + } else { + fun = func(env *Env) bool { + v1, _ := x(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + + } + } + + } + default: + x1 := xe.AsX1() + + switch y := ye.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1 := x1(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + + } + } else { + fun = func(env *Env) bool { + v1 := x1(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + + } + } + + default: + y1 := ye.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1 := x1(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + + } + } else { + fun = func(env *Env) bool { + v1 := x1(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + + } + } + + } + } + return c.exprBool(fun) +} +func (c *Comp) eqlneqNil(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + var e *Expr + if ye.IsNil { + e = xe + } else { + e = ye + } + + if !IsNillableKind(e.Type.Kind()) { + return c.invalidBinaryExpr(node, xe, ye) + } + + var fun func(env *Env) bool + if f, ok := e.Fun.(func(env *Env) (r.Value, []r.Value)); ok { + e.CheckX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v, _ := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return vnil + } + } else { + fun = func(env *Env) bool { + v, _ := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return !vnil + } + } + + } else { + f := e.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return vnil + } + } else { + fun = func(env *Env) bool { + v := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return !vnil + } + } + + } + return c.exprBool(fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.gomacro b/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.gomacro new file mode 100644 index 0000000..d77abbd --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_eqlneq.gomacro @@ -0,0 +1,432 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_eql.go + * + * Created on Apr 02, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro eqlneq(opnode, xconst, yconst, typ ast.Node) ast.Node { + + // the return type of Eval() and EvalType() varies. better check early. + xc, yc := Eval(xconst).(bool), Eval(yconst).(bool) + optoken := Eval(opnode).(token.Token) + + if xc == yc { + var expr *ast.BinaryExpr = ~"{x(env) && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + return ~"{ + x := x.(func(*Env) ~,typ) + y := y.(func(*Env) ~,typ) + fun = func(env *Env) bool { + return ~,expr + } + } + } else if yc { + var expr *ast.BinaryExpr = ~"{x(env) && y} // quasiquote, we modify it destructively + expr.Op = optoken + + yconv := convertvalue1(typ, ~'yv) + return ~"{ + x := x.(func(*Env) ~,typ) + y := ~,yconv + fun = func(env *Env) bool { + return ~,expr + } + } + } else { + var expr *ast.BinaryExpr = ~"{x && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + xconv := convertvalue1(typ, ~'xv) + return ~"{ + x := ~,xconv + y := y.(func(*Env) ~,typ) + fun = func(env *Env) bool { + return ~,expr + } + } + } +} + +:macro eqlneqs(opnode, xconst, yconst, types ast.Node) ast.Node { + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(typelist)) + for _, typ := range typelist { + t := EvalType(typ) + if t.Kind() == r.Int { + // shortcut for all int* types + for _, typ := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: eqlneq; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, typ := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: eqlneq; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: eqlneq; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } + return ~"{ switch k { ~,@caselist } } +} + +func (c *Comp) Eql(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if xe.IsNil { + if ye.IsNil { + return c.invalidBinaryExpr(node, xe, ye) + } else { + // nil == expr + return c.eqlneqNil(node, xe, ye) + } + } else if ye.IsNil { + // expr == nil + return c.eqlneqNil(node, xe, ye) + } + if !xe.Type.Comparable() || !xe.Type.Comparable() { + return c.invalidBinaryExpr(node, xe, ye) + } + xc, yc := xe.Const(), ye.Const() + if xe.Type.Kind() != r.Interface && ye.Type.Kind() != r.Interface { + // comparison between different types is allowed only if at least one is an interface + c.toSameFuncType(node, xe, ye) + } + k := xe.Type.Kind() + yk := ye.Type.Kind() // may differ from k + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func(env *Env) bool + if k != yk { + // call c.eqlneqMisc() below + } else if xc == yc { + x, y := xe.Fun, ye.Fun + {eqlneqs; token.EQL; false; false; { bool; int; uint; float32; float64; complex64; complex128; string } } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + if k == r.Bool && yv.Bool() { + // xe == true is the same as xe + return xe + } + {eqlneqs; token.EQL; false; true; { bool; int; uint; float32; float64; complex64; complex128; string } } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + if k == r.Bool && xv.Bool() { + // true == ye is the same as ye + return ye + } + {eqlneqs; token.EQL; true; false; { bool; int; uint; float32; float64; complex64; complex128; string } } + } + if fun != nil { + return c.exprBool(fun) + } + return c.eqlneqMisc(node, xe, ye) +} + +func (c *Comp) Neq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if xe.IsNil { + if ye.IsNil { + return c.invalidBinaryExpr(node, xe, ye) + } else { + // nil == expr + return c.eqlneqNil(node, xe, ye) + } + } else if ye.IsNil { + // expr == nil + return c.eqlneqNil(node, xe, ye) + } + if !xe.Type.Comparable() || !xe.Type.Comparable() { + return c.invalidBinaryExpr(node, xe, ye) + } + xc, yc := xe.Const(), ye.Const() + if xe.Type.Kind() != r.Interface && ye.Type.Kind() != r.Interface { + // comparison between different types is allowed only if at least one is an interface + c.toSameFuncType(node, xe, ye) + } + k := xe.Type.Kind() + yk := ye.Type.Kind() // may differ from k + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func(env *Env) bool + if k != yk { + // call c.eqlneqMisc() below + } else if xc == yc { + x, y := xe.Fun, ye.Fun + {eqlneqs; token.NEQ; false; false; { int; uint; float32; float64; complex64; complex128; string } } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + if k == r.Bool && !yv.Bool() { + // xe != false is the same as xe + return xe + } + {eqlneqs; token.NEQ; false; true; { int; uint; float32; float64; complex64; complex128; string } } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + if k == r.Bool && !xv.Bool() { + // false != ye is the same as ye + return ye + } + {eqlneqs; token.NEQ; true; false; { int; uint; float32; float64; complex64; complex128; string } } + } + if fun != nil { + return c.exprBool(fun) + } + return c.eqlneqMisc(node, xe, ye) +} + +// compare arrays, interfaces, pointers, structs +func (c *Comp) eqlneqMisc(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + var fun func(*Env) bool + + if xe.Type.Kind() == r.Interface || ye.Type.Kind() == r.Interface { + // not checked yet that xe and ye return at least one value... check now + xe.CheckX1() + ye.CheckX1() + } + + switch x := xe.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + switch y := ye.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1, _ := x(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + } + } else { + fun = func(env *Env) bool { + v1, _ := x(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + } + } + default: + y1 := ye.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1, _ := x(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + } + } else { + fun = func(env *Env) bool { + v1, _ := x(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + } + } + } + default: + x1 := xe.AsX1() + + switch y := ye.Fun.(type) { + case func(*Env) (r.Value, []r.Value): + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1 := x1(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + } + } else { + fun = func(env *Env) bool { + v1 := x1(env) + v2, _ := y(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + } + } + default: + y1 := ye.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v1 := x1(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 == v2 + } else { + return v1.Interface() == v2.Interface() + } + } + } else { + fun = func(env *Env) bool { + v1 := x1(env) + v2 := y1(env) + if v1 == Nil || v2 == Nil { + return v1 != v2 + } else { + return v1.Interface() != v2.Interface() + } + } + } + } + } + return c.exprBool(fun) +} + +func (c *Comp) eqlneqNil(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + var e *Expr + if ye.IsNil { + e = xe + } else { + e = ye + } + // e can be a constant... for example nil == nil + if !IsNillableKind(e.Type.Kind()) { + return c.invalidBinaryExpr(node, xe, ye) + } + + var fun func(env *Env) bool + if f, ok := e.Fun.(func(env *Env) (r.Value, []r.Value)); ok { + e.CheckX1() // to warn or error as appropriate + if node.Op == token.EQL { + fun = func(env *Env) bool { + v, _ := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return vnil + } + } else { + fun = func(env *Env) bool { + v, _ := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return !vnil + } + } + } else { + f := e.AsX1() + if node.Op == token.EQL { + fun = func(env *Env) bool { + v := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return vnil + } + } else { + fun = func(env *Env) bool { + v := f(env) + vnil := v == Nil || IsNillableKind(v.Kind()) && v.IsNil() + return !vnil + } + } + } + return c.exprBool(fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_ops.go b/vendor/github.com/cosmos72/gomacro/fast/binary_ops.go new file mode 100644 index 0000000..679dc39 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_ops.go @@ -0,0 +1,5132 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_ops.go + * + * Created on Apr 12, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) Add(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) + y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) + y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) + y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) + y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) + y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) + y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) + y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) + y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) + y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) + y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) + y(env) + } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x(env) + y(env) + } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x(env) + y(env) + } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x(env) + y(env) + } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x(env) + y(env) + } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) string { + return x(env) + y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) || y == "" { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) + y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) + y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) + y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) + y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) + y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) + y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) + y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) + y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) + y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) + y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) + y + } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(r.ValueOf(y).Float()) + fun = func(env *Env) float32 { + return x(env) + y + } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := r.ValueOf(y).Float() + fun = func(env *Env) float64 { + return x(env) + y + } + + } + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := complex64(r.ValueOf(y).Complex()) + fun = func(env *Env) complex64 { + return x(env) + y + } + + } + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := r.ValueOf(y).Complex() + fun = func(env *Env) complex128 { + return x(env) + y + } + + } + case r.String: + { + x := x.(func(*Env) string) + y := r.ValueOf(y).String() + fun = func(env *Env) string { + return x(env) + y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) || x == "" { + return ye + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x + y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x + y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x + y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x + y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x + y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x + y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x + y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x + y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x + y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x + y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x + y(env) + } + + } + case r.Float32: + + { + x := float32( + + r.ValueOf(x).Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x + y(env) + } + + } + case r.Float64: + + { + x := r.ValueOf(x).Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x + y(env) + } + + } + case r.Complex64: + + { + x := complex64( + + r.ValueOf(x).Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x + y(env) + } + + } + case r.Complex128: + + { + x := r.ValueOf(x).Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x + y(env) + } + + } + case r.String: + + { + x := r.ValueOf(x).String() + + y := y.(func(*Env) string) + fun = func(env *Env) string { + return x + y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Sub(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) - y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) - y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) - y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) - y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) - y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) - y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) - y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) - y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) - y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) - y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) - y(env) + } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x(env) - y(env) + } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x(env) - y(env) + } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x(env) - y(env) + } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x(env) - y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) - y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) - y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) - y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) - y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) - y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) - y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) - y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) - y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) - y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) - y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) - y + } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(r.ValueOf(y).Float()) + fun = func(env *Env) float32 { + return x(env) - y + } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := r.ValueOf(y).Float() + fun = func(env *Env) float64 { + return x(env) - y + } + + } + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := complex64(r.ValueOf(y).Complex()) + fun = func(env *Env) complex64 { + return x(env) - y + } + + } + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := r.ValueOf(y).Complex() + fun = func(env *Env) complex128 { + return x(env) - y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x - y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x - y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x - y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x - y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x - y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x - y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x - y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x - y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x - y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x - y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x - y(env) + } + + } + case r.Float32: + + { + x := float32( + + r.ValueOf(x).Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x - y(env) + } + + } + case r.Float64: + + { + x := r.ValueOf(x).Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x - y(env) + } + + } + case r.Complex64: + + { + x := complex64( + + r.ValueOf(x).Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x - y(env) + } + + } + case r.Complex128: + + { + x := r.ValueOf(x).Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x - y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Mul(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) * y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) * y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) * y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) * y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) * y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) * y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) * y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) * y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) * y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) * y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) * y(env) + } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x(env) * y(env) + } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x(env) * y(env) + } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x(env) * y(env) + } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x(env) * y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if ze := c.mulPow2(node, xe, ye); ze != nil { + return ze + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) * y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) * y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) * y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) * y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) * y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) * y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) * y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) * y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) * y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) * y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) * y + } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(r.ValueOf(y).Float()) + fun = func(env *Env) float32 { + return x(env) * y + } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := r.ValueOf(y).Float() + fun = func(env *Env) float64 { + return x(env) * y + } + + } + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := complex64(r.ValueOf(y).Complex()) + fun = func(env *Env) complex64 { + return x(env) * y + } + + } + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := r.ValueOf(y).Complex() + fun = func(env *Env) complex128 { + return x(env) * y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + if ze := c.mulPow2(node, xe, ye); ze != nil { + return ze + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x * y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x * y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x * y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x * y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x * y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x * y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x * y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x * y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x * y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x * y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x * y(env) + } + + } + case r.Float32: + + { + x := float32( + + r.ValueOf(x).Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x * y(env) + } + + } + case r.Float64: + + { + x := r.ValueOf(x).Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x * y(env) + } + + } + case r.Complex64: + + { + x := complex64( + + r.ValueOf(x).Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x * y(env) + } + + } + case r.Complex128: + + { + x := r.ValueOf(x).Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x * y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Quo(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) / y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) / y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) / y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) / y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) / y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) / y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) / y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) / y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) / y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) / y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) / y(env) + } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x(env) / y(env) + } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x(env) / y(env) + } + + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x(env) / y(env) + } + + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x(env) / y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + c.Errorf("division by zero") + return nil + } else if ze := c.quoPow2(node, xe, ye); ze != nil { + return ze + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) / y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) / y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) / y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) / y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) / y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) / y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) / y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) / y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) / y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) / y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) / y + } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(r.ValueOf(y).Float()) + fun = func(env *Env) float32 { + return x(env) / y + } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := r.ValueOf(y).Float() + fun = func(env *Env) float64 { + return x(env) / y + } + + } + case r.Complex64: + { + x := x.(func(*Env) complex64) + y := complex64(r.ValueOf(y).Complex()) + fun = func(env *Env) complex64 { + return x(env) / y + } + + } + case r.Complex128: + { + x := x.(func(*Env) complex128) + y := r.ValueOf(y).Complex() + fun = func(env *Env) complex128 { + return x(env) / y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x / y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x / y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x / y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x / y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x / y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x / y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x / y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x / y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x / y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x / y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x / y(env) + } + + } + case r.Float32: + + { + x := float32( + + r.ValueOf(x).Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) float32 { + return x / y(env) + } + + } + case r.Float64: + + { + x := r.ValueOf(x).Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) float64 { + return x / y(env) + } + + } + case r.Complex64: + + { + x := complex64( + + r.ValueOf(x).Complex()) + + y := y.(func(*Env) complex64) + fun = func(env *Env) complex64 { + return x / y(env) + } + + } + case r.Complex128: + + { + x := r.ValueOf(x).Complex() + + y := y.(func(*Env) complex128) + fun = func(env *Env) complex128 { + return x / y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Rem(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) % y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) % y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) % y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) % y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) % y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) % y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) % y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) % y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) % y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) % y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) % y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + + if isLiteralNumber(y, 0) { + c.Errorf("division by zero") + return nil + } else if ze := c.remPow2(node, xe, ye); ze != nil { + return ze + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) % y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) % y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) % y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) % y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) % y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) % y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) % y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) % y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) % y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) % y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) % y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x % y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x % y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x % y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x % y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x % y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x % y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x % y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x % y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x % y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x % y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x % y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) mulPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + + if xe.Const() == ye.Const() { + return nil + } + + if xe.Const() { + xe, ye = ye, xe + } + + if isLiteralNumber(ye.Value, 0) { + return c.exprZero(xe) + } else if isLiteralNumber(ye.Value, 1) { + return xe + } else if isLiteralNumber(ye.Value, -1) { + node1 := &ast.UnaryExpr{OpPos: node.OpPos, Op: token.SUB, X: node.X} + return c.UnaryMinus(node1, xe) + } + ypositive := true + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + + case r.Uint: + y = yv.Uint() + default: + return nil + } + if !isPowerOfTwo(y) { + return nil + } + + shift := integerLen(y) - 1 + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: + { + x := x.(func(*Env) int) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) int { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) int { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) int { + return x(env) << 8 + } + + default: + fun = func(env *Env) int { + return x(env) << shift + } + + } + } else { + fun = func(env *Env) int { + return -(x(env) << shift) + } + } + + } + + case r.Int8: + { + x := x.(func(*Env) int8) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) int8 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) int8 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) int8 { + return x(env) << 8 + } + + default: + fun = func(env *Env) int8 { + return x(env) << shift + } + + } + } else { + fun = func(env *Env) int8 { + return -(x(env) << shift) + } + } + + } + + case r.Int16: + { + x := x.(func(*Env) int16) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) int16 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) int16 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) int16 { + return x(env) << 8 + } + + default: + fun = func(env *Env) int16 { + return x(env) << shift + } + + } + } else { + fun = func(env *Env) int16 { + return -(x(env) << shift) + } + } + + } + + case r.Int32: + { + x := x.(func(*Env) int32) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) int32 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) int32 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) int32 { + return x(env) << 8 + } + + default: + fun = func(env *Env) int32 { + return x(env) << shift + } + + } + } else { + fun = func(env *Env) int32 { + return -(x(env) << shift) + } + } + + } + + case r.Int64: + { + x := x.(func(*Env) int64) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) int64 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) int64 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) int64 { + return x(env) << 8 + } + + default: + fun = func(env *Env) int64 { + return x(env) << shift + } + + } + } else { + fun = func(env *Env) int64 { + return -(x(env) << shift) + } + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + switch shift { + case 1: + fun = func(env *Env) uint { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uint { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uint { + return x(env) << 8 + } + + default: + fun = func(env *Env) uint { + return x(env) << shift + } + + } + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + switch shift { + case 1: + fun = func(env *Env) uint8 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uint8 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uint8 { + return x(env) << 8 + } + + default: + fun = func(env *Env) uint8 { + return x(env) << shift + } + + } + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + switch shift { + case 1: + fun = func(env *Env) uint16 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uint16 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uint16 { + return x(env) << 8 + } + + default: + fun = func(env *Env) uint16 { + return x(env) << shift + } + + } + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + switch shift { + case 1: + fun = func(env *Env) uint32 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uint32 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uint32 { + return x(env) << 8 + } + + default: + fun = func(env *Env) uint32 { + return x(env) << shift + } + + } + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + switch shift { + case 1: + fun = func(env *Env) uint64 { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uint64 { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uint64 { + return x(env) << 8 + } + + default: + fun = func(env *Env) uint64 { + return x(env) << shift + } + + } + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + switch shift { + case 1: + fun = func(env *Env) uintptr { + return x(env) << 1 + } + + case 2: + fun = func(env *Env) uintptr { + return x(env) << 2 + } + + case 8: + fun = func(env *Env) uintptr { + return x(env) << 8 + } + + default: + fun = func(env *Env) uintptr { + return x(env) << shift + } + + } + } + + default: + return nil + } + return exprFun(xe.Type, fun) +} +func (c *Comp) quoPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + + if xe.Const() || !ye.Const() { + return nil + } + + if isLiteralNumber(ye.Value, 0) { + c.Errorf("division by zero") + return nil + } else if isLiteralNumber(ye.Value, 1) { + return xe + } else if isLiteralNumber(ye.Value, -1) { + node1 := &ast.UnaryExpr{OpPos: node.OpPos, Op: token.SUB, X: node.X} + return c.UnaryMinus(node1, xe) + } + ypositive := true + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + + case r.Uint: + y = yv.Uint() + default: + return nil + } + if !isPowerOfTwo(y) { + return nil + } + + shift := integerLen(y) - 1 + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: + { + x := x.(func(*Env) int) + y_1 := + + int(y - 1) + if ypositive { + fun = func(env *Env) int { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) int { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + + } + + case r.Int8: + { + x := x.(func(*Env) int8) + y_1 := + + int8(y - 1) + if ypositive { + fun = func(env *Env) int8 { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) int8 { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + + } + + case r.Int16: + { + x := x.(func(*Env) int16) + y_1 := + + int16(y - 1) + if ypositive { + fun = func(env *Env) int16 { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) int16 { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + + } + + case r.Int32: + { + x := x.(func(*Env) int32) + y_1 := + + int32(y - 1) + if ypositive { + fun = func(env *Env) int32 { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) int32 { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + + } + + case r.Int64: + { + x := x.(func(*Env) int64) + y_1 := + + int64(y - 1) + if ypositive { + fun = func(env *Env) int64 { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) int64 { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) >> shift + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) >> shift + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) >> shift + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) >> shift + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) >> shift + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) >> shift + } + + } + + default: + return nil + } + return exprFun(xe.Type, fun) +} +func (c *Comp) remPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + + if xe.Const() || !ye.Const() { + return nil + } + + if isLiteralNumber(ye.Value, 0) { + c.Errorf("division by zero") + return nil + } else if isLiteralNumber(ye.Value, 1) { + return c.exprZero(xe) + } + + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + y = uint64(-sy) + } else { + y = uint64(sy) + } + + case r.Uint: + y = yv.Uint() + default: + return nil + } + if !isPowerOfTwo(y) { + return nil + } + + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: + { + x := x.(func(*Env) int) + y_1 := + + int(y - 1) + fun = func(env *Env) int { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } + + case r.Int8: + { + x := x.(func(*Env) int8) + y_1 := + + int8(y - 1) + fun = func(env *Env) int8 { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } + + case r.Int16: + { + x := x.(func(*Env) int16) + y_1 := + + int16(y - 1) + fun = func(env *Env) int16 { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } + + case r.Int32: + { + x := x.(func(*Env) int32) + y_1 := + + int32(y - 1) + fun = func(env *Env) int32 { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } + + case r.Int64: + { + x := x.(func(*Env) int64) + y_1 := + + int64(y - 1) + fun = func(env *Env) int64 { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y_1 := + + uint(y - 1) + fun = func(env *Env) uint { + return x(env) & y_1 + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y_1 := + + uint8(y - 1) + fun = func(env *Env) uint8 { + return x(env) & y_1 + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y_1 := + + uint16(y - 1) + fun = func(env *Env) uint16 { + return x(env) & y_1 + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y_1 := + + uint32(y - 1) + fun = func(env *Env) uint32 { + return x(env) & y_1 + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y_1 := + + uint64(y - 1) + fun = func(env *Env) uint64 { + return x(env) & y_1 + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y_1 := + + uintptr(y - 1) + fun = func(env *Env) uintptr { + return x(env) & y_1 + } + + } + + default: + return nil + } + return exprFun(xe.Type, fun) +} +func isPowerOfTwo(n uint64) bool { return n != 0 && n&(n-1) == 0 } +func integerLen(n uint64) uint8 { + var l uint8 + for n > 0xff { + l += 8 + n >>= 8 + } + for n != 0 { + l++ + n >>= 1 + } + return l +} +func (c *Comp) And(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) & y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) & y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) & y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) & y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) & y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) & y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) & y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) & y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) & y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) & y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) & y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return c.exprZero(xe) + } else if isLiteralNumber(y, -1) { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) & y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) & y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) & y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) & y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) & y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) & y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) & y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) & y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) & y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) & y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) & y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return c.exprZero(ye) + } else if isLiteralNumber(x, -1) { + return ye + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x & y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x & y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x & y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x & y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x & y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x & y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x & y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x & y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x & y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x & y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x & y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Or(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) | y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) | y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) | y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) | y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) | y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) | y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) | y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) | y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) | y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) | y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) | y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + + if isLiteralNumber(y, 0) { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) | y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) | y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) | y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) | y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) | y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) | y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) | y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) | y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) | y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) | y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) | y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + + if isLiteralNumber(x, 0) { + return ye + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x | y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x | y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x | y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x | y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x | y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x | y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x | y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x | y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x | y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x | y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x | y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Xor(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) ^ y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) ^ y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) ^ y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) ^ y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) ^ y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) ^ y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) ^ y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) ^ y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) ^ y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) ^ y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) ^ y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) ^ y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) ^ y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) ^ y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) ^ y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) ^ y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) ^ y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) ^ y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) ^ y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) ^ y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) ^ y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) ^ y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return ye + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x ^ y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x ^ y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x ^ y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x ^ y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x ^ y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x ^ y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x ^ y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x ^ y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x ^ y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x ^ y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x ^ y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Andnot(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x(env) &^ y(env) + } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x(env) &^ y(env) + } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x(env) &^ y(env) + } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x(env) &^ y(env) + } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x(env) &^ y(env) + } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) &^ y(env) + } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) &^ y(env) + } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) &^ y(env) + } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) &^ y(env) + } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) &^ y(env) + } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) &^ y(env) + } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, -1) { + return c.exprZero(xe) + } else if isLiteralNumber(y, 0) { + return xe + } + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(r.ValueOf(y).Int()) + fun = func(env *Env) int { + return x(env) &^ y + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(r.ValueOf(y).Int()) + fun = func(env *Env) int8 { + return x(env) &^ y + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(r.ValueOf(y).Int()) + fun = func(env *Env) int16 { + return x(env) &^ y + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(r.ValueOf(y).Int()) + fun = func(env *Env) int32 { + return x(env) &^ y + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := r.ValueOf(y).Int() + fun = func(env *Env) int64 { + return x(env) &^ y + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(r.ValueOf(y).Uint()) + fun = func(env *Env) uint { + return x(env) &^ y + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(r.ValueOf(y).Uint()) + fun = func(env *Env) uint8 { + return x(env) &^ y + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(r.ValueOf(y).Uint()) + fun = func(env *Env) uint16 { + return x(env) &^ y + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(r.ValueOf(y).Uint()) + fun = func(env *Env) uint32 { + return x(env) &^ y + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := r.ValueOf(y).Uint() + fun = func(env *Env) uint64 { + return x(env) &^ y + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(r.ValueOf(y).Uint()) + fun = func(env *Env) uintptr { + return x(env) &^ y + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return c.exprZero(ye) + } + + switch k { + case r.Int: + + { + x := int( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) int { + return x &^ y(env) + } + + } + case r.Int8: + + { + x := int8( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) int8 { + return x &^ y(env) + } + + } + case r.Int16: + + { + x := int16( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) int16 { + return x &^ y(env) + } + + } + case r.Int32: + + { + x := int32( + + r.ValueOf(x).Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) int32 { + return x &^ y(env) + } + + } + case r.Int64: + + { + x := r.ValueOf(x).Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) int64 { + return x &^ y(env) + } + + } + case r.Uint: + + { + x := uint( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x &^ y(env) + } + + } + case r.Uint8: + + { + x := uint8( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x &^ y(env) + } + + } + case r.Uint16: + + { + x := uint16( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x &^ y(env) + } + + } + case r.Uint32: + + { + x := uint32( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x &^ y(env) + } + + } + case r.Uint64: + + { + x := r.ValueOf(x).Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x &^ y(env) + } + + } + case r.Uintptr: + + { + x := uintptr( + + r.ValueOf(x).Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x &^ y(env) + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) exprZero(xe *Expr) *Expr { + if xe.Const() { + xe.ConstTo(xe.DefaultType()) + return c.exprValue(xe.Type, xr.Zero(xe.Type).Interface()) + } + t := xe.Type + k := t.Kind() + x := xe.Fun + var fun I + + switch k { + case r.Bool: + { + x := x.(func(*Env) bool) + fun = func(env *Env) (zero bool) { + x(env) + return + + } + } + case r.Int: + { + x := x.(func(*Env) int) + fun = func(env *Env) (zero int) { + x(env) + return + + } + } + case r.Int8: + { + x := x.(func(*Env) int8) + fun = func(env *Env) (zero int8) { + x(env) + return + + } + } + case r.Int16: + { + x := x.(func(*Env) int16) + fun = func(env *Env) (zero int16) { + x(env) + return + + } + } + case r.Int32: + { + x := x.(func(*Env) int32) + fun = func(env *Env) (zero int32) { + x(env) + return + + } + } + case r.Int64: + { + x := x.(func(*Env) int64) + fun = func(env *Env) (zero int64) { + x(env) + return + + } + } + case r.Uint: + { + x := x.(func(*Env) uint) + fun = func(env *Env) (zero uint) { + x(env) + return + + } + } + case r.Uint8: + { + x := x.(func(*Env) uint8) + fun = func(env *Env) (zero uint8) { + x(env) + return + + } + } + case r.Uint16: + { + x := x.(func(*Env) uint16) + fun = func(env *Env) (zero uint16) { + x(env) + return + + } + } + case r.Uint32: + { + x := x.(func(*Env) uint32) + fun = func(env *Env) (zero uint32) { + x(env) + return + + } + } + case r.Uint64: + { + x := x.(func(*Env) uint64) + fun = func(env *Env) (zero uint64) { + x(env) + return + + } + } + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + fun = func(env *Env) (zero uintptr) { + x(env) + return + + } + } + + case r.Float32: + { + x := x.(func(*Env) float32) + fun = func(env *Env) (zero float32) { + x(env) + return + + } + } + + case r.Float64: + { + x := x.(func(*Env) float64) + fun = func(env *Env) (zero float64) { + x(env) + return + + } + } + + case r.Complex64: + { + x := x.(func(*Env) complex64) + fun = func(env *Env) (zero complex64) { + x(env) + return + + } + } + + case r.Complex128: + { + x := x.(func(*Env) complex128) + fun = func(env *Env) (zero complex128) { + x(env) + return + + } + } + + case r.String: + { + x := x.(func(*Env) string) + fun = func(env *Env) (zero string) { + x(env) + return + + } + } + + default: + { + zero := xr.Zero(t) + x := funAsX1(x, nil) + fun = func(env *Env) r.Value { + x(env) + return zero + } + } + + } + return exprFun(t, fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_ops.gomacro b/vendor/github.com/cosmos72/gomacro/fast/binary_ops.gomacro new file mode 100644 index 0000000..2ca3cf0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_ops.gomacro @@ -0,0 +1,845 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_ops.go + * + * Created on Apr 12, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro binaryop(opnode, xconst, yconst, typ ast.Node) ast.Node { + + // the return type of Eval() and EvalType() varies. better check early. + xc, yc := Eval(xconst).(bool), Eval(yconst).(bool) + optoken := Eval(opnode).(token.Token) + + if xc == yc { + var expr *ast.BinaryExpr = ~"{x(env) && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + return ~"{ + x := x.(func(*Env) ~,typ) + y := y.(func(*Env) ~,typ) + fun = func(env *Env) ~,typ { + return ~,expr + } + } + } else if yc { + var expr *ast.BinaryExpr = ~"{x(env) && y} // quasiquote, we modify it destructively + expr.Op = optoken + + converty := convertvalue1(typ, ~'{r.ValueOf(y)}) + return ~"{ + x := x.(func(*Env) ~,typ) + y := ~,converty + fun = func(env *Env) ~,typ { + return ~,expr + } + } + } else { + var expr *ast.BinaryExpr = ~"{x && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + convertx := convertvalue1(typ, ~'{r.ValueOf(x)}) + return ~"{ + x := ~,convertx + y := y.(func(*Env) ~,typ) + fun = func(env *Env) ~,typ { + return ~,expr + } + } + } +} + +:macro binaryops(opnode, xconst, yconst, types ast.Node) ast.Node { + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(typelist)) + foundnil := false + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + caselist = append(caselist, ~"{default: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + foundnil = true + + } else if t.Kind() == r.Int { + // shortcut for all int* types + for _, typ := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, typ := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } + + if !foundnil { + caselist = append(caselist, ~'{default: return c.invalidBinaryExpr(node, xe, ye)}) + } + return ~"{ switch k { ~,@caselist } } +} + +func (c *Comp) Add(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.ADD; false; false; { int; uint; float32; float64; complex64; complex128; string }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) || y == "" { + return xe + } + {binaryops; token.ADD; false; true; { int; uint; float32; float64; complex64; complex128; string }} + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) || x == "" { + return ye + } + {binaryops; token.ADD; true; false; { int; uint; float32; float64; complex64; complex128; string }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Sub(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.SUB; false; false; { int; uint; float32; float64; complex64; complex128 }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + {binaryops; token.SUB; false; true; { int; uint; float32; float64; complex64; complex128 }} + } else { + x := xe.Value + y := ye.Fun + {binaryops; token.SUB; true; false; { int; uint; float32; float64; complex64; complex128 }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Mul(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.MUL; false; false; { int; uint; float32; float64; complex64; complex128 }} + } else if yc { + x := xe.Fun + y := ye.Value + if ze := c.mulPow2(node, xe, ye); ze != nil { + return ze + } + {binaryops; token.MUL; false; true; { int; uint; float32; float64; complex64; complex128 }} + } else { + x := xe.Value + y := ye.Fun + if ze := c.mulPow2(node, xe, ye); ze != nil { + return ze + } + {binaryops; token.MUL; true; false; { int; uint; float32; float64; complex64; complex128 }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Quo(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.QUO; false; false; { int; uint; float32; float64; complex64; complex128 }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + c.Errorf("division by zero") + return nil + } else if ze := c.quoPow2(node, xe, ye); ze != nil { + return ze + } + {binaryops; token.QUO; false; true; { int; uint; float32; float64; complex64; complex128 }} + } else { + x := xe.Value + y := ye.Fun + {binaryops; token.QUO; true; false; { int; uint; float32; float64; complex64; complex128 }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Rem(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.REM; false; false; { int; uint }} + } else if yc { + x := xe.Fun + y := ye.Value + // cannot optimize x % 1 to 0 because x may have side effects + if isLiteralNumber(y, 0) { + c.Errorf("division by zero") + return nil + } else if ze := c.remPow2(node, xe, ye); ze != nil { + return ze + } + {binaryops; token.REM; false; true; { int; uint }} + } else { + x := xe.Value + y := ye.Fun + {binaryops; token.REM; true; false; { int; uint }} + } + return exprFun(xe.Type, fun) +} + +:macro mulpow2(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + if ypositive { + switch shift { + case 1: + fun = func(env *Env) ~,typ { + return x(env) << 1 + } + case 2: + fun = func(env *Env) ~,typ { + return x(env) << 2 + } + case 8: + fun = func(env *Env) ~,typ { + return x(env) << 8 + } + default: + fun = func(env *Env) ~,typ { + return x(env) << shift + } + } + } else { + fun = func(env *Env) ~,typ { + return -(x(env) << shift) + } + } + } +} + +:macro mulpow2_u(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + switch shift { + case 1: + fun = func(env *Env) ~,typ { + return x(env) << 1 + } + case 2: + fun = func(env *Env) ~,typ { + return x(env) << 2 + } + case 8: + fun = func(env *Env) ~,typ { + return x(env) << 8 + } + default: + fun = func(env *Env) ~,typ { + return x(env) << shift + } + } + } +} + +// mulPow2 tries to optimize multiplications by a constant power-of-two. +// returns nil if no optimized version could be compiled. +func (c *Comp) mulPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + // no need to optimize if both xe and ye are constant: + // multiplication will be computed only once by EvalConst() + if xe.Const() == ye.Const() { + return nil + } + if xe.Const() { + // swap xe and ye. no side effects, xe is a constant + xe, ye = ye, xe + } + if isLiteralNumber(ye.Value, 0) { + return c.exprZero(xe) + } else if isLiteralNumber(ye.Value, 1) { + return xe + } else if isLiteralNumber(ye.Value, -1) { + node1 := &ast.UnaryExpr{OpPos: node.OpPos, Op: token.SUB, X: node.X} + return c.UnaryMinus(node1, xe) + } + ypositive := true + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + case r.Uint: + y = yv.Uint() + default: + // floating point or complex multiplication + return nil + } + if !isPowerOfTwo(y) { + // multiplication by shift and add not implemented... + return nil + } + shift := integerLen(y) - 1 + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: {mulpow2; int} + case r.Int8: {mulpow2; int8} + case r.Int16: {mulpow2; int16} + case r.Int32: {mulpow2; int32} + case r.Int64: {mulpow2; int64} + case r.Uint: {mulpow2_u; uint} + case r.Uint8: {mulpow2_u; uint8} + case r.Uint16: {mulpow2_u; uint16} + case r.Uint32: {mulpow2_u; uint32} + case r.Uint64: {mulpow2_u; uint64} + case r.Uintptr: {mulpow2_u; uintptr} + default: return nil + } + return exprFun(xe.Type, fun) +} + +:macro quopow2(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + y_1 := ~,typ(y - 1) // cannot overflow, y was originally a ~,typ + if ypositive { + fun = func(env *Env) ~,typ { + n := x(env) + if n < 0 { + n += y_1 + } + return n >> shift + } + } else { + fun = func(env *Env) ~,typ { + n := x(env) + if n < 0 { + n += y_1 + } + return -(n >> shift) + } + } + } +} + +:macro quopow2_u(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + fun = func(env *Env) ~,typ { + return x(env) >> shift + } + } +} + +// quoPow2 tries to optimize divisions by a constant power-of-two. +// returns nil if no optimized version could be compiled. +func (c *Comp) quoPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + // no need to optimize if both xe and ye are constant: + // division will be computed only once by EvalConst() + if xe.Const() || !ye.Const() { + return nil + } + if isLiteralNumber(ye.Value, 0) { + c.Errorf("division by zero") + return nil + } else if isLiteralNumber(ye.Value, 1) { + return xe + } else if isLiteralNumber(ye.Value, -1) { + node1 := &ast.UnaryExpr{OpPos: node.OpPos, Op: token.SUB, X: node.X} + return c.UnaryMinus(node1, xe) + } + ypositive := true + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + case r.Uint: + y = yv.Uint() + default: + // floating point or complex division + return nil + } + if !isPowerOfTwo(y) { + // division by multiplication and shift not implemented... + return nil + } + // attention: xe / (2**n) and xe >> n have different truncation rules for negative xe: + // quotient / truncates toward zero + // right shift >> truncates toward negative infinity + // examples: + // 11 / 2 = 5, 11 >> 1 = 5 // same result + // -11 / 2 = -5, -11 >> 1 = -6 // different result + // 63 / 8 = 7, 63 >> 3 = 7 // same result + // -63 / 8 = -7, -63 >> 3 = -8 // different result + // + // -11 / -2 = 5, -(-11 >> 1) = 6 // different result + // -63 / -8 = 7, -(-63 >> 3) = 8 // different result + // + // to fix this, when xe is negative we must add abs(y)-1 to it: + // -11 / 2 = -5, (-11 + 1) >> 1 = -10 >> 1 = -5 // same result + // -63 / 8 = -7, (-63 + 7) >> 3 = -56 >> 3 = -7 // same result + // + // -11 / -2 = 5, -((-11 + 1) >> 1) = -(-10 >> 1) = 5 // same result + // -63 / -8 = 7, -((-63 + 7) >> 3) = -(-56 >> 3) = 7 // same result + + shift := integerLen(y) - 1 + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: {quopow2; int} + case r.Int8: {quopow2; int8} + case r.Int16: {quopow2; int16} + case r.Int32: {quopow2; int32} + case r.Int64: {quopow2; int64} + case r.Uint: {quopow2_u; uint} + case r.Uint8: {quopow2_u; uint8} + case r.Uint16: {quopow2_u; uint16} + case r.Uint32: {quopow2_u; uint32} + case r.Uint64: {quopow2_u; uint64} + case r.Uintptr: {quopow2_u; uintptr} + default: return nil + } + return exprFun(xe.Type, fun) +} + +:macro rempow2(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + y_1 := ~,typ(y - 1) // cannot overflow, y was originally a ~,typ + fun = func(env *Env) ~,typ { + n := x(env) + if n >= 0 { + return n & y_1 + } + return -(-n & y_1) + } + } +} + +:macro rempow2_u(typ ast.Node) ast.Node { + return ~"{ + x := x.(func(*Env) ~,typ) + y_1 := ~,typ(y - 1) // cannot overflow, y was originally a ~,typ + fun = func(env *Env) ~,typ { + return x(env) & y_1 + } + } +} + +// remPow2 tries to optimize remainders by a constant power-of-two. +// returns nil if no optimized version could be compiled. +func (c *Comp) remPow2(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + // no need to optimize if both xe and ye are constant: + // remainder will be computed only once by EvalConst() + if xe.Const() || !ye.Const() { + return nil + } + if isLiteralNumber(ye.Value, 0) { + c.Errorf("division by zero") + return nil + } else if isLiteralNumber(ye.Value, 1) { + return c.exprZero(xe) + } + yv := r.ValueOf(ye.Value) + var y uint64 + switch base.KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + y = uint64(-sy) + } else { + y = uint64(sy) + } + case r.Uint: + y = yv.Uint() + default: + // floating point or complex division + return nil + } + if !isPowerOfTwo(y) { + // remainder by multiplication and shift not implemented... + return nil + } + // attention: % (2**n) and & (2**n - 1) have different behaviours for negative xe: + // remainder % has the same sign as xe + // bitwise-and & is always >= 0 (for non-negative right operand) + // luckily, in Go x % y and x % -y always give the same result, so we can assume y >= 0 + // examples: + // 11 % 2 = 1, 11 & 1 = 1 // same result + // -11 % 2 = -1, -11 & 1 = 1 // different result + // -11 % -2 = -1, -11 & 1 = 1 // different result + // 63 % 8 = 7, 63 & 7 = 7 // same result + // -63 % 8 = -7, -63 & 7 = 1 // different result + // -63 % -8 = -7, -63 & 7 = 1 // different result + // + // to fix this, when xe is negative, we flip its sign, perform the bitwise-and with (abs(y)-1), then flip again the sign: + // -11 % 2 = -1, -(11 & 1) = -1 // same result + // -11 % -2 = -1, -(11 & 1) = -1 // same result + // -63 % 8 = -7, -(63 & 7) = -7 // same result + // -63 % -8 = -7, -(63 & 7) = -7 // same result + + x := xe.Fun + var fun I + switch xe.Type.Kind() { + case r.Int: {rempow2; int} + case r.Int8: {rempow2; int8} + case r.Int16: {rempow2; int16} + case r.Int32: {rempow2; int32} + case r.Int64: {rempow2; int64} + case r.Uint: {rempow2_u; uint} + case r.Uint8: {rempow2_u; uint8} + case r.Uint16: {rempow2_u; uint16} + case r.Uint32: {rempow2_u; uint32} + case r.Uint64: {rempow2_u; uint64} + case r.Uintptr: {rempow2_u; uintptr} + default: return nil + } + return exprFun(xe.Type, fun) +} + +func isPowerOfTwo(n uint64) bool { + return n != 0 && (n&(n-1)) == 0 +} + +// integerLen returns the number of bits needed to represent n +func integerLen(n uint64) uint8 { + var l uint8 + for n > 0xff { + l += 8 + n >>= 8 + } + for n != 0 { + l++ + n >>= 1 + } + return l +} + +func (c *Comp) And(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.AND; false; false; { int; uint }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return c.exprZero(xe) + } else if isLiteralNumber(y, -1) { + return xe + } + {binaryops; token.AND; false; true; { int; uint }} + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return c.exprZero(ye) + } else if isLiteralNumber(x, -1) { + return ye + } + {binaryops; token.AND; true; false; { int; uint }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Or(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.OR; false; false; { int; uint }} + } else if yc { + x := xe.Fun + y := ye.Value + // cannot optimize x | -1 to -1 because x may have side effects + if isLiteralNumber(y, 0) { + return xe + } + {binaryops; token.OR; false; true; { int; uint }} + } else { + x := xe.Value + y := ye.Fun + // cannot optimize -1 & y to -1 because x may have side effects + if isLiteralNumber(x, 0) { + return ye + } + {binaryops; token.OR; true; false; { int; uint }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Xor(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.XOR; false; false; { int; uint }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + {binaryops; token.XOR; false; true; { int; uint }} + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return ye + } + {binaryops; token.XOR; true; false; { int; uint }} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Andnot(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.AND_NOT; false; false; { int; uint }} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, -1) { + return c.exprZero(xe) + } else if isLiteralNumber(y, 0) { + return xe + } + {binaryops; token.AND_NOT; false; true; { int; uint }} + } else { + x := xe.Value + y := ye.Fun + if isLiteralNumber(x, 0) { + return c.exprZero(ye) + } + {binaryops; token.AND_NOT; true; false; { int; uint }} + } + return exprFun(xe.Type, fun) +} + +:macro exprzero(typ ast.Node) ast.Node { + if EvalType(typ) == nil { + return ~"{ + zero := xr.Zero(t) + x := funAsX1(x, nil) + fun = func(env *Env) r.Value { + x(env) + return zero + } + } + } + return ~"{ + x := x.(func(*Env) ~,typ) + fun = func(env *Env) (zero ~,typ) { + x(env) + return + } + } +} + +:macro exprzeros(types ast.Node) ast.Node { + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(typelist)) + foundnil := false + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + continue + } else if t.Kind() == r.Int { + // shortcut for all int* types + for _, typ := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: exprzero; ~,typ}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, typ := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: exprzero; ~,typ}) + } + } else { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: exprzero; ~,typ}) + } + } + + caselist = append(caselist, ~"{default: exprzero; nil}) + + return ~"{ switch k { ~,@caselist } } +} + +// exprZero compiles a function that evaluates xe, +// then discards the result and always returns zero +func (c *Comp) exprZero(xe *Expr) *Expr { + if xe.Const() { + xe.ConstTo(xe.DefaultType()) + return c.exprValue(xe.Type, xr.Zero(xe.Type).Interface()) + } + t := xe.Type + k := t.Kind() + x := xe.Fun + var fun I + {exprzeros; {bool; int; uint; float32; float64; complex64; complex128; string} } + return exprFun(t, fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_relops.go b/vendor/github.com/cosmos72/gomacro/fast/binary_relops.go new file mode 100644 index 0000000..36a0d18 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_relops.go @@ -0,0 +1,1629 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_relops.go + * + * Created on Apr 12, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" +) + +func (c *Comp) Lss(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun func(*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) < y(env) } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(yv.Float()) + fun = func(env *Env) bool { return x(env) < y } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) < y } + + } + case r.String: + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) < y } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Float32: + + { + x := float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x < y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x < y(env) } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return c.exprBool(fun) +} +func (c *Comp) Gtr(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun func(*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) > y(env) } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(yv.Float()) + fun = func(env *Env) bool { return x(env) > y } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) > y } + + } + case r.String: + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) > y } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Float32: + + { + x := float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x > y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x > y(env) } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return c.exprBool(fun) +} +func (c *Comp) Leq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun func(*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) <= y(env) } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(yv.Float()) + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) <= y } + + } + case r.String: + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) <= y } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Float32: + + { + x := float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x <= y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x <= y(env) } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return c.exprBool(fun) +} +func (c *Comp) Geq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + var fun func(*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch k { + case r.Int: + { + x := x.(func(*Env) int) + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + case r.Int8: + { + x := x.(func(*Env) int8) + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + case r.Int16: + { + x := x.(func(*Env) int16) + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + case r.Int32: + { + x := x.(func(*Env) int32) + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + case r.Int64: + { + x := x.(func(*Env) int64) + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uint: + { + x := x.(func(*Env) uint) + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uint8: + { + x := x.(func(*Env) uint8) + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uint16: + { + x := x.(func(*Env) uint16) + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uint32: + { + x := x.(func(*Env) uint32) + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uint64: + { + x := x.(func(*Env) uint64) + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Uintptr: + { + x := x.(func(*Env) uintptr) + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Float32: + { + x := x.(func(*Env) float32) + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.Float64: + { + x := x.(func(*Env) float64) + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + case r.String: + { + x := x.(func(*Env) string) + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x(env) >= y(env) } + + } + + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + + switch k { + case r.Int: + + { + x := x.(func(*Env) int) + y := int(yv.Int()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + y := int8(yv.Int()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + y := int16(yv.Int()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + y := int32(yv.Int()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + y := yv.Int() + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + y := uint(yv.Uint()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + y := uint8(yv.Uint()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + y := uint16(yv.Uint()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + y := uint32(yv.Uint()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + y := yv.Uint() + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + y := uintptr(yv.Uint()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Float32: + { + x := x.(func(*Env) float32) + y := float32(yv.Float()) + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.Float64: + { + x := x.(func(*Env) float64) + y := yv.Float() + fun = func(env *Env) bool { return x(env) >= y } + + } + case r.String: + { + x := x.(func(*Env) string) + y := yv.String() + fun = func(env *Env) bool { return x(env) >= y } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch k { + case r.Int: + + { + x := int( + + xv.Int()) + + y := y.(func(*Env) int) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Int8: + + { + x := int8( + + xv.Int()) + + y := y.(func(*Env) int8) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Int16: + + { + x := int16( + + xv.Int()) + + y := y.(func(*Env) int16) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Int32: + + { + x := int32( + + xv.Int()) + + y := y.(func(*Env) int32) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Int64: + + { + x := xv.Int() + + y := y.(func(*Env) int64) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uint: + + { + x := uint( + + xv.Uint()) + + y := y.(func(*Env) uint) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uint8: + + { + x := uint8( + + xv.Uint()) + + y := y.(func(*Env) uint8) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uint16: + + { + x := uint16( + + xv.Uint()) + + y := y.(func(*Env) uint16) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uint32: + + { + x := uint32( + + xv.Uint()) + + y := y.(func(*Env) uint32) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uint64: + + { + x := xv.Uint() + + y := y.(func(*Env) uint64) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Uintptr: + + { + x := uintptr( + + xv.Uint()) + + y := y.(func(*Env) uintptr) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Float32: + + { + x := float32( + + xv.Float()) + + y := y.(func(*Env) float32) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.Float64: + + { + x := xv.Float() + + y := y.(func(*Env) float64) + fun = func(env *Env) bool { return x >= y(env) } + + } + case r.String: + + { + x := xv.String() + + y := y.(func(*Env) string) + fun = func(env *Env) bool { return x >= y(env) } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return c.exprBool(fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_relops.gomacro b/vendor/github.com/cosmos72/gomacro/fast/binary_relops.gomacro new file mode 100644 index 0000000..5b02a6b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_relops.gomacro @@ -0,0 +1,263 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_relops.go + * + * Created on Apr 12, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + // . "github.com/cosmos72/gomacro/base" +) + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro binaryop(opnode, xconst, yconst, typ ast.Node) ast.Node { + + // the return type of Eval() and EvalType() varies. better check early. + xc, yc := Eval(xconst).(bool), Eval(yconst).(bool) + optoken := Eval(opnode).(token.Token) + + if xc == yc { + var expr *ast.BinaryExpr = ~"{x(env) && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + return ~"{ + x := x.(func(*Env) ~,typ) + y := y.(func(*Env) ~,typ) + fun = func(env *Env) bool { + return ~,expr + } + } + } else if yc { + var expr *ast.BinaryExpr = ~"{x(env) && y} // quasiquote, we modify it destructively + expr.Op = optoken + + yconv := convertvalue1(typ, ~'yv) + return ~"{ + x := x.(func(*Env) ~,typ) + y := ~,yconv + fun = func(env *Env) bool { + return ~,expr + } + } + } else { + var expr *ast.BinaryExpr = ~"{x && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + xconv := convertvalue1(typ, ~'xv) + return ~"{ + x := ~,xconv + y := y.(func(*Env) ~,typ) + fun = func(env *Env) bool { + return ~,expr + } + } + } +} + +:macro binaryops(opnode, xconst, yconst, types ast.Node) ast.Node { + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(typelist)) + foundnil := false + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + caselist = append(caselist, ~"{default: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + foundnil = true + + } else if t.Kind() == r.Int { + // shortcut for all int* types + for _, typ := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, typ := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } else { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: binaryop; ~,opnode; ~,xconst; ~,yconst; ~,typ}) + } + } + + if !foundnil { + caselist = append(caselist, ~'{default: return c.invalidBinaryExpr(node, xe, ye)}) + } + return ~"{ switch k { ~,@caselist } } +} + +func (c *Comp) Lss(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func (*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.LSS; false; false; { int; uint; float32; float64; string }} + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + {binaryops; token.LSS; false; true; { int; uint; float32; float64; string }} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {binaryops; token.LSS; true; false; { int; uint; float32; float64; string }} + } + return c.exprBool(fun) +} + +func (c *Comp) Gtr(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func (*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.GTR; false; false; { int; uint; float32; float64; string }} + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + {binaryops; token.GTR; false; true; { int; uint; float32; float64; string }} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {binaryops; token.GTR; true; false; { int; uint; float32; float64; string }} + } + return c.exprBool(fun) +} + +func (c *Comp) Leq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func (*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.LEQ; false; false; { int; uint; float32; float64; string }} + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + {binaryops; token.LEQ; false; true; { int; uint; float32; float64; string }} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {binaryops; token.LEQ; true; false; { int; uint; float32; float64; string }} + } + return c.exprBool(fun) +} + +func (c *Comp) Geq(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + xc, yc := xe.Const(), ye.Const() + c.toSameFuncType(node, xe, ye) + k := xe.Type.Kind() + + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun func (*Env) bool + if xc == yc { + x, y := xe.Fun, ye.Fun + {binaryops; token.GEQ; false; false; { int; uint; float32; float64; string }} + } else if yc { + x := xe.Fun + yv := r.ValueOf(ye.Value) + {binaryops; token.GEQ; false; true; { int; uint; float32; float64; string }} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {binaryops; token.GEQ; true; false; { int; uint; float32; float64; string }} + } + return c.exprBool(fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.go b/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.go new file mode 100644 index 0000000..a3faff4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.go @@ -0,0 +1,4117 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_shifts.go + * + * Created on Apr 08, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" +) + +func (c *Comp) Shl(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if ze := c.prepareShift(node, xe, ye); ze != nil { + return ze + } + + xc, yc := xe.Const(), ye.Const() + xk, yk := xe.Type.Kind(), ye.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch xk { + case r.Int: + + { + x := x.(func(*Env) int) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int { return x(env) << y(env) } + + } + + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int8 { return x(env) << y(env) } + + } + + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int16 { return x(env) << y(env) } + + } + + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int32 { return x(env) << y(env) } + + } + + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int64 { return x(env) << y(env) } + + } + + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint { + return x(env) << y(env) + } + + } + + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint8 { + return x(env) << y(env) + } + + } + + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint16 { + return x(env) << y(env) + } + + } + + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint32 { + return x(env) << y(env) + } + + } + + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint64 { + return x(env) << y(env) + } + + } + + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) << y(env) + } + + } + + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + + yv := r.ValueOf(y) + + switch xk { + case r.Int: + + { + x := x.(func(*Env) int) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int { + return x(env) << y + } + + } + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int8 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) << y + } + + } + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int16 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) << y + } + + } + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int32 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) << y + } + + } + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int64 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) << y + } + + } + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint { + return x(env) << y + } + + } + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) << y + } + + } + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) << y + } + + } + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) << y + } + + } + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) << y + } + + } + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) << y + } + + } + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch xk { + case r.Int: + + { + x := int(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int { + return x << y(env) + } + + } + } + + } + case r.Int8: + + { + x := int8(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int8 { + return x << y(env) + } + + } + } + + } + case r.Int16: + + { + x := int16(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int16 { + return x << y(env) + } + + } + } + + } + case r.Int32: + + { + x := int32(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int32 { + return x << y(env) + } + + } + } + + } + case r.Int64: + + { + x := xv.Int() + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int64 { + return x << y(env) + } + + } + } + + } + case r.Uint: + + { + x := uint(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint { + return x << y(env) + } + + } + } + + } + case r.Uint8: + + { + x := uint8(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint8 { + return x << y(env) + } + + } + } + + } + case r.Uint16: + + { + x := uint16(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint16 { + return x << y(env) + } + + } + } + + } + case r.Uint32: + + { + x := uint32(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint32 { + return x << y(env) + } + + } + } + + } + case r.Uint64: + + { + x := xv.Uint() + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint64 { + return x << y(env) + } + + } + } + + } + case r.Uintptr: + + { + x := uintptr(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x << y(env) + } + + } + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} +func (c *Comp) Shr(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if ze := c.prepareShift(node, xe, ye); ze != nil { + return ze + } + + xc, yc := xe.Const(), ye.Const() + xk, yk := xe.Type.Kind(), ye.Type.Kind() + + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + + switch xk { + case r.Int: + + { + x := x.(func(*Env) int) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int { return x(env) >> y(env) } + + } + + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int8 { return x(env) >> y(env) } + + } + + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int16 { return x(env) >> y(env) } + + } + + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int32 { return x(env) >> y(env) } + + } + + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int64 { return x(env) >> y(env) } + + } + + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint { + return x(env) >> y(env) + } + + } + + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint8 { + return x(env) >> y(env) + } + + } + + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint16 { + return x(env) >> y(env) + } + + } + + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint32 { + return x(env) >> y(env) + } + + } + + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint64 { + return x(env) >> y(env) + } + + } + + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + switch yk { + case r.Uint: + { + y := y.(func(*Env) uint) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + case r.Uint8: + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + case r.Uint16: + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + case r.Uint32: + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + case r.Uint64: + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + case r.Uintptr: + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x(env) >> y(env) + } + + } + + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + + yv := r.ValueOf(y) + + switch xk { + case r.Int: + + { + x := x.(func(*Env) int) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int { + return x(env) >> y + } + + } + } + + } + case r.Int8: + + { + x := x.(func(*Env) int8) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int8 { + return x(env) >> y + } + + } + } + + } + case r.Int16: + + { + x := x.(func(*Env) int16) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int16 { + return x(env) >> y + } + + } + } + + } + case r.Int32: + + { + x := x.(func(*Env) int32) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int32 { + return x(env) >> y + } + + } + } + + } + case r.Int64: + + { + x := x.(func(*Env) int64) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) int64 { + return x(env) >> y + } + + } + } + + } + case r.Uint: + + { + x := x.(func(*Env) uint) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint { + return x(env) >> y + } + + } + } + + } + case r.Uint8: + + { + x := x.(func(*Env) uint8) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint8 { + return x(env) >> y + } + + } + } + + } + case r.Uint16: + + { + x := x.(func(*Env) uint16) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint16 { + return x(env) >> y + } + + } + } + + } + case r.Uint32: + + { + x := x.(func(*Env) uint32) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint32 { + return x(env) >> y + } + + } + } + + } + case r.Uint64: + + { + x := x.(func(*Env) uint64) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uint64 { + return x(env) >> y + } + + } + } + + } + case r.Uintptr: + + { + x := x.(func(*Env) uintptr) + switch yk { + case r.Uint: + + { + y := uint(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + case r.Uint8: + + { + y := uint8(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + case r.Uint16: + + { + y := uint16(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + case r.Uint32: + + { + y := uint32(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + case r.Uint64: + + { + y := yv.Uint() + + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + case r.Uintptr: + + { + y := uintptr(yv.Uint()) + fun = func(env *Env) uintptr { + return x(env) >> y + } + + } + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + + switch xk { + case r.Int: + + { + x := int(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int { + return x >> y(env) + } + + } + } + + } + case r.Int8: + + { + x := int8(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int8 { + return x >> y(env) + } + + } + } + + } + case r.Int16: + + { + x := int16(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int16 { + return x >> y(env) + } + + } + } + + } + case r.Int32: + + { + x := int32(xv.Int()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int32 { + return x >> y(env) + } + + } + } + + } + case r.Int64: + + { + x := xv.Int() + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) int64 { + return x >> y(env) + } + + } + } + + } + case r.Uint: + + { + x := uint(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint { + return x >> y(env) + } + + } + } + + } + case r.Uint8: + + { + x := uint8(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint8 { + return x >> y(env) + } + + } + } + + } + case r.Uint16: + + { + x := uint16(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint16 { + return x >> y(env) + } + + } + } + + } + case r.Uint32: + + { + x := uint32(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint32 { + return x >> y(env) + } + + } + } + + } + case r.Uint64: + + { + x := xv.Uint() + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uint64 { + return x >> y(env) + } + + } + } + + } + case r.Uintptr: + + { + x := uintptr(xv.Uint()) + switch yk { + case r.Uint: + + { + y := y.(func(*Env) uint) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + case r.Uint8: + + { + y := y.(func(*Env) uint8) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + case r.Uint16: + + { + y := y.(func(*Env) uint16) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + case r.Uint32: + + { + y := y.(func(*Env) uint32) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + case r.Uint64: + + { + y := y.(func(*Env) uint64) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + case r.Uintptr: + + { + y := y.(func(*Env) uintptr) + fun = func(env *Env) uintptr { + return x >> y(env) + } + + } + } + + } + default: + return c.invalidBinaryExpr(node, xe, ye) + + } + } + return exprFun(xe.Type, fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.gomacro b/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.gomacro new file mode 100644 index 0000000..bb2ce26 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/binary_shifts.gomacro @@ -0,0 +1,264 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * binary_shifts.go + * + * Created on Apr 08, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +// shift, x type and y type are fixed +:macro shift(opnode, xconst, yconst, xtyp, ytyp ast.Node) ast.Node { + + // the return type of Eval() and EvalType() varies. better check early. + xc, yc := Eval(xconst).(bool), Eval(yconst).(bool) + optoken := Eval(opnode).(token.Token) + + if xc == yc { + var expr *ast.BinaryExpr = ~"{x(env) && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + return ~"{ + y := y.(func(*Env) ~,ytyp) + fun = func(env *Env) ~,xtyp { + return ~,expr + } + } + } else if yc { + var expr *ast.BinaryExpr = ~"{x(env) && y} // quasiquote, we modify it destructively + expr.Op = optoken + + yconvert := ~'{{}} + if EvalType(ytyp) != nil { + yconv1 := convertvalue1(ytyp, ~'yv) + yconvert = ~"{{y := ~,yconv1}} + } + + return ~"{ + ~,@yconvert + fun = func(env *Env) ~,xtyp { + return ~,expr + } + } + } else { + var expr *ast.BinaryExpr = ~"{x && y(env)} // quasiquote, we modify it destructively + expr.Op = optoken + + return ~"{ + y := y.(func(*Env) ~,ytyp) + fun = func(env *Env) ~,xtyp { + return ~,expr + } + } + } +} + +// shift, x type is fixed. dispatch on y type +:macro shifts(opnode, xconst, yconst, xtyp, ytypes ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + xc, yc := Eval(xconst).(bool), Eval(yconst).(bool) + + ytypelist := ytypes.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(ytypelist)) + for _, ytyp := range ytypelist { + t := EvalType(ytyp) + if t.Kind() == r.Int { + // shortcut for all int* types + for _, ytyp := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(ytyp) + caselist = append(caselist, ~"{case ~,kind: shift; ~,opnode; ~,xconst; ~,yconst; ~,xtyp; ~,ytyp}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, ytyp := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(ytyp) + caselist = append(caselist, ~"{case ~,kind: shift; ~,opnode; ~,xconst; ~,yconst; ~,xtyp; ~,ytyp}) + } + } else { + kind := makekind(ytyp) + caselist = append(caselist, ~"{case ~,kind: shift; ~,opnode; ~,xconst; ~,yconst; ~,xtyp; ~,ytyp}) + } + } + + swtch := ~"{ switch yk { ~,@caselist } } + if xc { + xconv1 := convertvalue1(xtyp, ~'xv) + return ~"{x := ~,xconv1; ~,swtch } + } else { + return ~"{x := x.(func(*Env) ~,xtyp); ~,swtch } + } +} + +// general shift - dispatch on x type, then on y type +:macro shiftss(opnode, xconst, yconst, xtypes ast.Node, ytypes ast.Node) ast.Node { + xtypelist := xtypes.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, 0, len(xtypelist)) + foundnil := false + for _, typ := range xtypelist { + t := EvalType(typ) + if t == nil { + caselist = append(caselist, ~"{default: shifts; ~,opnode; ~,xconst; ~,yconst; ~,typ; ~,ytypes}) + foundnil = true + + } else if t.Kind() == r.Int { + // shortcut for all int* types + for _, typ := range []ast.Expr{~'int, ~'int8, ~'int16, ~'int32, ~'int64} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: shifts; ~,opnode; ~,xconst; ~,yconst; ~,typ; ~,ytypes}) + } + } else if t.Kind() == r.Uint { + // shortcut for all uint* types + for _, typ := range []ast.Expr{~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr} { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: shifts; ~,opnode; ~,xconst; ~,yconst; ~,typ; ~,ytypes}) + } + } else { + kind := makekind(typ) + caselist = append(caselist, ~"{case ~,kind: shifts; ~,opnode; ~,xconst; ~,yconst; ~,typ; ~,ytypes}) + } + } + + if !foundnil { + caselist = append(caselist, ~'{default: return c.invalidBinaryExpr(node, xe, ye)}) + } + return ~"{ switch xk { ~,@caselist } } +} + + +func (c *Comp) Shl(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if ze := c.prepareShift(node, xe, ye); ze != nil { + return ze + } + xc, yc := xe.Const(), ye.Const() + xk, yk := xe.Type.Kind(), ye.Type.Kind() + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {shiftss; token.SHL; false; false; {int; uint}; {uint}} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + yv := r.ValueOf(y) + {shiftss; token.SHL; false; true; {int; uint}; {uint}} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {shiftss; token.SHL; true; false; {int; uint}; {uint}} + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) Shr(node *ast.BinaryExpr, xe *Expr, ye *Expr) *Expr { + if ze := c.prepareShift(node, xe, ye); ze != nil { + return ze + } + xc, yc := xe.Const(), ye.Const() + xk, yk := xe.Type.Kind(), ye.Type.Kind() + // if both x and y are constants, BinaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + var fun I + if xc == yc { + x, y := xe.Fun, ye.Fun + {shiftss; token.SHR; false; false; {int; uint}; {uint}} + } else if yc { + x := xe.Fun + y := ye.Value + if isLiteralNumber(y, 0) { + return xe + } + yv := r.ValueOf(y) + {shiftss; token.SHR; false; true; {int; uint}; {uint}} + } else { + xv := r.ValueOf(xe.Value) + y := ye.Fun + {shiftss; token.SHR; true; false; {int; uint}; {uint}} + } + return exprFun(xe.Type, fun) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/builtin.go b/vendor/github.com/cosmos72/gomacro/fast/builtin.go new file mode 100644 index 0000000..ef31d10 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/builtin.go @@ -0,0 +1,1173 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * builtin.go + * + * Created on: Apr 02, 2017 + * Author: Massimiliano Ghilardi + */ + +package fast + +import ( + "fmt" + "go/ast" + "go/constant" + "go/token" + "io" + r "reflect" + + "github.com/cosmos72/gomacro/ast2" + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +var ( + zeroTypes = []xr.Type{} + rtypeOfSliceOfByte = r.TypeOf([]byte{}) + +/* + typeOfPtrBool = xr.PtrTo(xr.TypeOfBool) + typeOfPtrInt = xr.PtrTo(xr.TypeOfInt) + typeOfPtrInt8 = xr.PtrTo(xr.TypeOfInt) + typeOfPtrInt16 = xr.PtrTo(xr.TypeOfInt16) + typeOfPtrInt32 = xr.PtrTo(xr.TypeOfInt32) + typeOfPtrInt64 = xr.PtrTo(xr.TypeOfInt64) + typeOfPtrUint = xr.PtrTo(xr.TypeOfUint) + typeOfPtrUint8 = xr.PtrTo(xr.TypeOfUint) + typeOfPtrUint16 = xr.PtrTo(xr.TypeOfUint16) + typeOfPtrUint32 = xr.PtrTo(xr.TypeOfUint32) + typeOfPtrUint64 = xr.PtrTo(xr.TypeOfUint64) + typeOfPtrUintptr = xr.PtrTo(xr.TypeOfUintptr) + typeOfPtrFloat32 = xr.PtrTo(xr.TypeOfFloat32) + typeOfPtrFloat64 = xr.PtrTo(xr.TypeOfFloat64) + typeOfPtrComplex64 = xr.PtrTo(xr.TypeOfComplex64) + typeOfPtrComplex128 = xr.PtrTo(xr.TypeOfComplex128) + typeOfPtrString = xr.PtrTo(xr.TypeOfString) +*/ +) + +// =================================== iota =================================== + +func (top *Comp) addIota() { + // https://golang.org/ref/spec#Constants + // "Literal constants, true, false, iota, and certain constant expressions containing only untyped constant operands are untyped." + top.Binds["iota"] = top.BindUntyped(untypedZero) +} + +func (top *Comp) removeIota() { + delete(top.Binds, "iota") +} + +func (top *Comp) incrementIota() { + iota := top.Binds["iota"].Lit.Value.(UntypedLit).Obj + iota = constant.BinaryOp(iota, token.ADD, untypedOne.Obj) + top.Binds["iota"] = top.BindUntyped(UntypedLit{Kind: r.Int, Obj: iota}) +} + +// ============================== initialization =============================== + +func (ce *Interp) addBuiltins() { + universe := ce.Comp.Universe + + // https://golang.org/ref/spec#Constants + // "Literal constants, true, false, iota, and certain constant expressions containing only untyped constant operands are untyped." + ce.DeclConst("false", nil, UntypedLit{r.Bool, constant.MakeBool(false), universe}) + ce.DeclConst("true", nil, UntypedLit{r.Bool, constant.MakeBool(true), universe}) + + // https://golang.org/ref/spec#Variables : "[...] the predeclared identifier nil, which has no type" + ce.DeclConst("nil", nil, nil) + + ce.DeclBuiltin("append", Builtin{compileAppend, 1, base.MaxUint16}) + ce.DeclBuiltin("cap", Builtin{compileCap, 1, 1}) + ce.DeclBuiltin("close", Builtin{compileClose, 1, 1}) + ce.DeclBuiltin("copy", Builtin{compileCopy, 2, 2}) + ce.DeclBuiltin("complex", Builtin{compileComplex, 2, 2}) + ce.DeclBuiltin("delete", Builtin{compileDelete, 2, 2}) + ce.DeclBuiltin("imag", Builtin{compileRealImag, 1, 1}) + ce.DeclBuiltin("len", Builtin{compileLen, 1, 1}) + ce.DeclBuiltin("make", Builtin{compileMake, 1, 3}) + ce.DeclBuiltin("new", Builtin{compileNew, 1, 1}) + ce.DeclBuiltin("panic", Builtin{compilePanic, 1, 1}) + ce.DeclBuiltin("print", Builtin{compilePrint, 0, base.MaxUint16}) + ce.DeclBuiltin("println", Builtin{compilePrint, 0, base.MaxUint16}) + ce.DeclBuiltin("real", Builtin{compileRealImag, 1, 1}) + ce.DeclBuiltin("recover", Builtin{compileRecover, 0, 0}) + // ce.DeclBuiltin("recover", Function{callRecover, ce.Comp.TypeOf((*func() interface{})(nil)).Elem()}) + + tfunI2_Nb := ce.Comp.TypeOf(funI2_Nb) + + ce.DeclEnvFunc("Env", Function{callIdentity, ce.Comp.TypeOf(funI_I)}) + ce.DeclEnvFunc("Eval", Function{callEval, ce.Comp.TypeOf(funI2_I)}) + ce.DeclEnvFunc("EvalType", Function{callEvalType, ce.Comp.TypeOf(funI2_T)}) + ce.DeclEnvFunc("MacroExpand", Function{callMacroExpand, tfunI2_Nb}) + ce.DeclEnvFunc("MacroExpand1", Function{callMacroExpand1, tfunI2_Nb}) + ce.DeclEnvFunc("MacroExpandCodeWalk", Function{callMacroExpandCodeWalk, tfunI2_Nb}) + /* + binds["Parse"] = r.ValueOf(Function{funcParse, 1}) + binds["Read"] = r.ValueOf(ReadString) + binds["ReadDir"] = r.ValueOf(callReadDir) + binds["ReadFile"] = r.ValueOf(callReadFile) + binds["ReadMultiline"] = r.ValueOf(ReadMultiline) + binds["Slice"] = r.ValueOf(callSlice) + binds["String"] = r.ValueOf(func(args ...interface{}) string { + return env.toString("", args...) + }) + // return multiple values, extracting the concrete type of each interface + binds["Values"] = r.ValueOf(Function{funcValues, -1}) + */ + + // --------- types --------- + c := ce.Comp + for _, t := range c.Universe.BasicTypes { + ce.DeclType(t) + } + ce.DeclTypeAlias("byte", c.TypeOfUint8()) + ce.DeclTypeAlias("rune", c.TypeOfInt32()) + ce.DeclType(c.TypeOfError()) + + /* + // --------- proxies --------- + if env.Proxies == nil { + env.Proxies = make(map[string]Type) + } + proxies := env.Proxies + + proxies["error", TypeOf(*Error_builtin)(nil)).Elem() + */ +} + +// ============================= builtin functions ============================= + +// --- append() --- + +func compileAppend(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + n := len(node.Args) + args := make([]*Expr, n) + + args[0] = c.Expr1(node.Args[0]) + t0 := args[0].Type + if t0.Kind() != r.Slice { + c.Errorf("first argument to %s must be slice; have <%s>", sym.Name, t0) + return nil + } + telem := t0.Elem() + + if node.Ellipsis != token.NoPos { + if n != 2 { + return c.badBuiltinCallArgNum(sym.Name+"(arg1, arg2...)", 2, 2, node.Args) + } + telem = t0 // second argument is a slice too + } + for i := 1; i < n; i++ { + argi := c.Expr1(node.Args[i]) + if argi.Const() { + argi.ConstTo(telem) + } else if ti := argi.Type; ti == nil || !ti.AssignableTo(telem) { + return c.badBuiltinCallArgType(sym.Name, node.Args[i], ti, telem) + } + args[i] = argi + } + t := xr.FuncOf([]xr.Type{t0, t0}, []xr.Type{t0}, true) // compile as reflect.Append(), which is variadic + sym.Type = t + fun := exprLit(Lit{Type: t, Value: r.Append}, &sym) + return &Call{ + Fun: fun, + Args: args, + OutTypes: []xr.Type{t0}, + Const: false, + Ellipsis: node.Ellipsis != token.NoPos, + } +} + +// --- cap() --- + +func callCap(val r.Value) int { + return val.Cap() +} + +func compileCap(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + // argument of builtin cap() cannot be a literal + arg := c.Expr1(node.Args[0]) + tin := arg.Type + tout := c.TypeOfInt() + switch tin.Kind() { + // no cap() on r.Map, see + // https://golang.org/ref/spec#Length_and_capacity + // and https://golang.org/pkg/reflect/#Value.Cap + case r.Array, r.Chan, r.Slice: + // ok + case r.Ptr: + if tin.Elem().Kind() == r.Array { + // cap() on pointer to array + arg = c.Deref(arg) + tin = arg.Type + break + } + fallthrough + default: + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "array, channel, slice, pointer to array") + } + t := xr.FuncOf([]xr.Type{tin}, []xr.Type{tout}, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callCap}, &sym) + // capacity of arrays is part of their type: cannot change at runtime, we could optimize it. + // TODO https://golang.org/ref/spec#Length_and_capacity specifies + // when the array passed to cap() is evaluated and when is not... + return newCall1(fun, arg, arg.Const(), tout) +} + +// --- close() --- + +func callClose(val r.Value) { + val.Close() +} + +func compileClose(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + arg := c.Expr1(node.Args[0]) + tin := arg.Type + if tin.Kind() != r.Chan { + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "channel") + } + t := xr.FuncOf([]xr.Type{tin}, zeroTypes, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callClose}, &sym) + return newCall1(fun, arg, false) +} + +// --- complex() --- + +func callComplex64(re float32, im float32) complex64 { + return complex(re, im) +} + +func callComplex128(re float64, im float64) complex128 { + return complex(re, im) +} + +func compileComplex(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + re := c.Expr1(node.Args[0]) + im := c.Expr1(node.Args[1]) + if re.Untyped() { + if im.Untyped() { + re.ConstTo(c.TypeOfFloat64()) + im.ConstTo(c.TypeOfFloat64()) + } else { + re.ConstTo(im.Type) + } + } else if im.Untyped() { + im.ConstTo(re.Type) + } + c.toSameFuncType(node, re, im) + kre := base.KindToCategory(re.Type.Kind()) + if re.Const() && kre != r.Float64 { + re.ConstTo(c.TypeOfFloat64()) + kre = r.Float64 + } + kim := base.KindToCategory(im.Type.Kind()) + if im.Const() && kim != r.Float64 { + im.ConstTo(c.TypeOfFloat64()) + kim = r.Float64 + } + if kre != r.Float64 { + c.Errorf("invalid operation: %v (arguments have type %v, expected floating-point)", + node, re.Type) + } + if kim != r.Float64 { + c.Errorf("invalid operation: %v (arguments have type %v, expected floating-point)", + node, im.Type) + } + tin := re.Type + k := re.Type.Kind() + var tout xr.Type + var call I + switch k { + case r.Float32: + tout = c.TypeOfComplex64() + call = callComplex64 + case r.Float64: + tout = c.TypeOfComplex128() + call = callComplex128 + default: + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "floating point") + } + touts := []xr.Type{tout} + t := xr.FuncOf([]xr.Type{tin}, touts, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: call}, &sym) + // complex() of two constants is constant: it can be computed at compile time + return &Call{Fun: fun, Args: []*Expr{re, im}, Const: re.Const() && im.Const(), OutTypes: touts} +} + +// --- copy() --- + +func copyStringToBytes(dst []byte, src string) int { + // reflect.Copy does not support this case... use the compiler support + return copy(dst, src) +} + +func compileCopy(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + args := []*Expr{ + c.Expr1(node.Args[0]), + c.Expr1(node.Args[1]), + } + if args[1].Const() { + // we also accept a string literal as second argument + args[1].ConstTo(args[1].DefaultType()) + } + t0, t1 := args[0].Type, args[1].Type + var funCopy I = r.Copy + if t0 == nil || t0.Kind() != r.Slice || !t0.AssignableTo(xr.SliceOf(t0.Elem())) { + // https://golang.org/ref/spec#Appending_and_copying_slices + // copy [...] arguments must have identical element type T and must be assignable to a slice of type []T. + c.Errorf("first argument to copy should be slice; have %v <%v>", node.Args[0], t0) + return nil + } else if t0.Elem().Kind() == r.Uint8 && t1.Kind() == r.String { + // [...] As a special case, copy also accepts a destination argument assignable to type []byte + // with a source argument of a string type. This form copies the bytes from the string into the byte slice. + funCopy = copyStringToBytes + } else if t1 == nil || t1.Kind() != r.Slice || !t1.AssignableTo(xr.SliceOf(t1.Elem())) { + c.Errorf("second argument to copy should be slice or string; have %v <%v>", node.Args[1], t1) + return nil + } else if !xr.SameType(t0.Elem(), t1.Elem()) { + c.Errorf("arguments to copy have different element types: <%v> and <%v>", t0.Elem(), t1.Elem()) + } + outtypes := []xr.Type{c.TypeOfInt()} + t := xr.FuncOf([]xr.Type{t0, t1}, outtypes, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: funCopy}, &sym) + return &Call{Fun: fun, Args: args, OutTypes: outtypes, Const: false} +} + +// --- delete() --- + +// use whatever calling convention is convenient: reflect.Values, interface{}s, primitive types... +// as long as call_builtin supports it, we're fine +func callDelete(vmap r.Value, vkey r.Value) { + vmap.SetMapIndex(vkey, base.Nil) +} + +func compileDelete(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + emap := c.Expr1(node.Args[0]) + ekey := c.Expr1(node.Args[1]) + tmap := emap.Type + if tmap.Kind() != r.Map { + c.Errorf("first argument to delete must be map; have %v", tmap) + return nil + } + tkey := tmap.Key() + if ekey.Const() { + ekey.ConstTo(tkey) + } else if ekey.Type == nil || !ekey.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as type <%v> in delete", node.Args[1], ekey.Type, tkey) + } + t := xr.FuncOf([]xr.Type{tmap, tkey}, zeroTypes, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callDelete}, &sym) + return &Call{Fun: fun, Args: []*Expr{emap, ekey}, OutTypes: zeroTypes, Const: false} +} + +// --- Env() --- + +func funI_I(interface{}) interface{} { + return nil +} + +// we can use whatever signature we want, as long as call_builtin supports it +func callIdentity(v r.Value) r.Value { + return v +} + +// --- Eval() --- + +func funI2_I(interface{}, interface{}) interface{} { + return nil +} + +func callEval(argv r.Value, interpv r.Value) r.Value { + if !argv.IsValid() { + return argv + } + form := ast2.AnyToAst(argv.Interface(), "Eval") + form = base.SimplifyAstForQuote(form, true) + + interp := interpv.Interface().(*Interp) + e := interp.CompileAst(form) + return interp.RunExpr1(e) +} + +// --- EvalType() --- + +func funI2_T(interface{}, interface{}) r.Type { + return nil +} + +func callEvalType(argv r.Value, interpv r.Value) r.Value { + if !argv.IsValid() { + return zeroOfReflectType + } + form := ast2.AnyToAst(argv.Interface(), "EvalType") + form = base.UnwrapTrivialAst(form) + node := form.Interface().(ast.Expr) + + interp := interpv.Interface().(*Interp) + t := interp.Comp.compileTypeOrNil(node) + if t == nil { + return zeroOfReflectType + } + return r.ValueOf(t.ReflectType()) +} + +// --- len() --- + +func callLenValue(val r.Value) int { + return val.Len() +} + +func callLenString(val string) int { + return len(val) +} + +func compileLen(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + arg := c.Expr1(node.Args[0]) + if arg.Const() { + arg.ConstTo(arg.DefaultType()) + } + tin := arg.Type + tout := c.TypeOfInt() + switch tin.Kind() { + case r.Array, r.Chan, r.Map, r.Slice, r.String: + // ok + case r.Ptr: + if tin.Elem().Kind() == r.Array { + // len() on pointer to array + arg = c.Deref(arg) + tin = arg.Type + break + } + fallthrough + default: + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "array, channel, map, slice, string, pointer to array") + } + t := xr.FuncOf([]xr.Type{tin}, []xr.Type{tout}, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callLenValue}, &sym) + if tin.Kind() == r.String { + fun.Value = callLenString // optimization + } + // length of arrays is part of their type: cannot change at runtime, we could optimize it. + // TODO https://golang.org/ref/spec#Length_and_capacity specifies + // when the array passed to len() is evaluated and when is not... + return newCall1(fun, arg, arg.Const(), tout) +} + +// --- MacroExpand(), MacroExpand1(), MacroExpandCodeWalk() --- + +func funI2_Nb(interface{}, interface{}) (ast.Node, bool) { + return nil, false +} + +func callMacroExpand(argv r.Value, interpv r.Value) (r.Value, r.Value) { + return callMacroExpandDispatch(argv, interpv, "MacroExpand") +} + +func callMacroExpand1(argv r.Value, interpv r.Value) (r.Value, r.Value) { + return callMacroExpandDispatch(argv, interpv, "MacroExpand1") +} + +func callMacroExpandCodeWalk(argv r.Value, interpv r.Value) (r.Value, r.Value) { + return callMacroExpandDispatch(argv, interpv, "MacroExpandCodeWalk") +} + +func callMacroExpandDispatch(argv r.Value, interpv r.Value, caller string) (r.Value, r.Value) { + if !argv.IsValid() { + return r.Zero(rtypeOfNode), base.False + } + form := ast2.AnyToAst(argv.Interface(), caller) + form = base.SimplifyAstForQuote(form, true) + + interp := interpv.Interface().(*Interp) + c := interp.Comp + + var flag bool + switch caller { + default: + form, flag = c.MacroExpand(form) + case "MacroExpand1": + form, flag = c.MacroExpand1(form) + case "MacroExpandCodeWalk": + form, flag = c.MacroExpandCodewalk(form) + } + flagv := base.False + if flag { + flagv = base.True + } + return r.ValueOf(form.Interface()).Convert(rtypeOfNode), flagv +} + +// --- make() --- + +func makeChan1(t r.Type) r.Value { + return r.MakeChan(t, 0) +} + +func makeMap2(t r.Type, n int) r.Value { + // reflect.MakeMap cannot specify initial capacity + return r.MakeMap(t) +} + +func makeSlice2(t r.Type, n int) r.Value { + // reflect.MakeSlice requires capacity + return r.MakeSlice(t, n, n) +} + +func compileMake(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + nargs := len(node.Args) + var nmin, nmax uint16 = 1, 2 + tin := c.Type(node.Args[0]) + var funMakes [4]I + switch tin.Kind() { + case r.Chan: + funMakes[1] = makeChan1 + funMakes[2] = r.MakeChan + case r.Map: + funMakes[1] = r.MakeMap + funMakes[2] = makeMap2 + case r.Slice: + nmin, nmax = 2, 3 + funMakes[2] = makeSlice2 + funMakes[3] = r.MakeSlice + default: + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "channel, map, slice") + } + if nargs < int(nmin) || nargs > int(nmax) { + return c.badBuiltinCallArgNum(sym.Name+"()", nmin, nmax, node.Args) + } + args := make([]*Expr, nargs) + argtypes := make([]xr.Type, nargs) + argtypes[0] = c.TypeOfInterface() + args[0] = c.exprValue(argtypes[0], tin.ReflectType()) // no need to build TypeOfReflectType + te := c.TypeOfInt() + for i := 1; i < nargs; i++ { + argi := c.Expr1(node.Args[i]) + if argi.Const() { + argi.ConstTo(te) + } else if ti := argi.Type; ti == nil || (!xr.SameType(ti, te) && !ti.AssignableTo(te)) { + return c.badBuiltinCallArgType(sym.Name, node.Args[i], ti, te) + } + args[i] = argi + argtypes[i] = te + } + outtypes := []xr.Type{tin} + t := xr.FuncOf(argtypes, outtypes, false) + sym.Type = t + funMake := funMakes[nargs] + if funMake == nil { + c.Errorf("internal error: no make() alternative to call for %v with %d arguments", tin, nargs) + return nil + } + fun := exprLit(Lit{Type: t, Value: funMake}, &sym) + return &Call{Fun: fun, Args: args, OutTypes: outtypes, Const: false} +} + +// --- new() --- + +func compileNew(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + tin := c.Type(node.Args[0]) + tout := xr.PtrTo(tin) + t := xr.FuncOf([]xr.Type{c.TypeOfInterface()}, []xr.Type{tout}, false) // no need to build TypeOfReflectType + sym.Type = t + fun := exprLit(Lit{Type: t, Value: r.New}, &sym) + arg := c.exprValue(c.TypeOfInterface(), tin.ReflectType()) + return newCall1(fun, arg, false, tout) +} + +// --- panic() --- + +func callPanic(arg interface{}) { + panic(arg) +} + +func compilePanic(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + arg := c.Expr1(node.Args[0]) + arg.To(c, c.TypeOfInterface()) + t := c.TypeOf(callPanic) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callPanic}, &sym) + return newCall1(fun, arg, false) +} + +// --- print(), println() --- + +func callPrint(out interface{}, args ...interface{}) { + fmt.Fprint(out.(io.Writer), args...) +} + +func callPrintln(out interface{}, args ...interface{}) { + fmt.Fprintln(out.(io.Writer), args...) +} + +func getStdout(env *Env) r.Value { + return r.ValueOf(env.ThreadGlobals.Stdout) +} + +func compilePrint(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + args := c.Exprs(node.Args) + for _, arg := range args { + arg.To(c, c.TypeOfInterface()) + } + arg0 := exprFun(c.TypeOfInterface(), getStdout) // no need to build TypeOfIoWriter + args = append([]*Expr{arg0}, args...) + + t := c.TypeOf(callPrint) + sym.Type = t + call := callPrint + if sym.Name == "println" { + call = callPrintln + } + fun := exprLit(Lit{Type: t, Value: call}, &sym) + return &Call{Fun: fun, Args: args, OutTypes: zeroTypes, Const: false, Ellipsis: node.Ellipsis != token.NoPos} +} + +// --- real() and imag() --- + +func callReal32(val complex64) float32 { + return real(val) +} + +func callReal64(val complex128) float64 { + return real(val) +} + +func callImag32(val complex64) float32 { + return imag(val) +} + +func callImag64(val complex128) float64 { + return imag(val) +} + +func compileRealImag(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + arg := c.Expr1(node.Args[0]) + if arg.Const() { + arg.ConstTo(arg.DefaultType()) + } + tin := arg.Type + var tout xr.Type + var call I + switch tin.Kind() { + case r.Complex64: + tout = c.TypeOfFloat32() + if sym.Name == "real" { + call = callReal32 + } else { + call = callImag32 + } + case r.Complex128: + tout = c.TypeOfFloat64() + if sym.Name == "real" { + call = callReal64 + } else { + call = callImag64 + } + default: + return c.badBuiltinCallArgType(sym.Name, node.Args[0], tin, "complex") + } + t := xr.FuncOf([]xr.Type{tin}, []xr.Type{tout}, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: call}, &sym) + // real() and imag() of a constant are constants: they can be computed at compile time + return newCall1(fun, arg, arg.Const(), tout) +} + +var nilInterface = r.Zero(base.TypeOfInterface) + +// we can use whatever signature we want, as long as call_builtin supports it +func callRecover(v r.Value) r.Value { + env := v.Interface().(*Env) + g := env.ThreadGlobals + debug := g.Options&base.OptDebugPanicRecover != 0 + if !g.IsDefer { + if debug { + base.Debugf("recover() not directly inside a defer") + } + return nilInterface + } + if g.PanicFun == nil { + if debug { + base.Debugf("recover() no panic") + } + return nilInterface + } + if g.DeferOfFun != g.PanicFun { + if debug { + base.Debugf("recover() inside defer of function %p, not defer of the current panicking function %p", g.DeferOfFun, g.PanicFun) + } + return nilInterface + } + rec := g.Panic + if rec == nil { + if debug { + base.Debugf("recover() consuming current panic: nil") + } + v = nilInterface + } else { + if debug { + base.Debugf("recover() consuming current panic: %v <%v>", rec, r.TypeOf(rec)) + } + v = r.ValueOf(rec).Convert(base.TypeOfInterface) // keep the interface{} type + } + // consume the current panic + g.Panic = nil + g.PanicFun = nil + return v +} + +func argEnv(env *Env) r.Value { + return r.ValueOf(env) +} + +func compileRecover(c *Comp, sym Symbol, node *ast.CallExpr) *Call { + ti := c.TypeOfInterface() + t := xr.FuncOf([]xr.Type{ti}, []xr.Type{ti}, false) + sym.Type = t + fun := exprLit(Lit{Type: t, Value: callRecover}, &sym) + arg := exprX1(ti, argEnv) + return newCall1(fun, arg, false, ti) +} + +// ============================ support functions ============================= + +// call_builtin compiles a call to a builtin function: append, cap, copy, delete, len, make, new... +func (c *Comp) call_builtin(call *Call) I { + // builtin functions are always literals, i.e. funindex == NoIndex thus not stored in Env.Binds[] + // we must retrieve them directly from c.Fun.Value + if !call.Fun.Const() { + base.Errorf("internal error: call_builtin() invoked for non-constant function %#v. use one of the callXretY() instead", call.Fun) + } + var name string + if call.Fun.Sym != nil { + name = call.Fun.Sym.Name + } + args := call.Args + argfuns := make([]I, len(args)) + for i, arg := range args { + argfuns[i] = arg.WithFun() + } + if false { + argtypes := make([]xr.Type, len(args)) + for i, arg := range args { + argtypes[i] = arg.Type + } + // Debugf("compiling builtin %s() <%v> with arg types %v", name, TypeOf(c.Fun.Value), argtypes) + } + var ret I + switch fun := call.Fun.Value.(type) { + case func(float32, float32) complex64: // complex + arg0fun := argfuns[0].(func(*Env) float32) + arg1fun := argfuns[1].(func(*Env) float32) + if name == "complex" { + if args[0].Const() { + arg0 := args[0].Value.(float32) + ret = func(env *Env) complex64 { + arg1 := arg1fun(env) + return complex(arg0, arg1) + } + } else if args[1].Const() { + arg1 := args[1].Value.(float32) + ret = func(env *Env) complex64 { + arg0 := arg0fun(env) + return complex(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return complex(arg0, arg1) + } + } + } else { + ret = func(env *Env) complex64 { + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + case func(float64, float64) complex128: // complex + arg0fun := argfuns[0].(func(*Env) float64) + arg1fun := argfuns[1].(func(*Env) float64) + if name == "complex" { + if args[0].Const() { + arg0 := args[0].Value.(float64) + ret = func(env *Env) complex128 { + arg1 := arg1fun(env) + return complex(arg0, arg1) + } + } else if args[1].Const() { + arg1 := args[1].Value.(float64) + ret = func(env *Env) complex128 { + arg0 := arg0fun(env) + return complex(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return complex(arg0, arg1) + } + } + } else { + ret = func(env *Env) complex128 { + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + case func(complex64) float32: // real(), imag() + argfun := argfuns[0].(func(*Env) complex64) + if name == "real" { + ret = func(env *Env) float32 { + arg := argfun(env) + return real(arg) + } + } else if name == "imag" { + ret = func(env *Env) float32 { + arg := argfun(env) + return imag(arg) + } + } else { + ret = func(env *Env) float32 { + arg := argfun(env) + return fun(arg) + } + } + case func(complex128) float64: // real(), imag() + argfun := argfuns[0].(func(*Env) complex128) + if name == "real" { + ret = func(env *Env) float64 { + arg := argfun(env) + return real(arg) + } + } else if name == "imag" { + ret = func(env *Env) float64 { + arg := argfun(env) + return imag(arg) + } + } else { + ret = func(env *Env) float64 { + arg := argfun(env) + return fun(arg) + } + } + case func(string) int: // len(string) + argfun := argfuns[0].(func(*Env) string) + if name == "len" { + ret = func(env *Env) int { + arg := argfun(env) + return len(arg) + } + } else { + ret = func(env *Env) int { + arg := argfun(env) + return fun(arg) + } + } + case func([]byte, string) int: // copy([]byte, string) + arg0fun := args[0].AsX1() + if args[1].Const() { + // string is a literal + arg1const := args[1].Value.(string) + ret = func(env *Env) int { + // arg0 is "assignable to []byte" + arg0 := arg0fun(env) + if arg0.Type() != rtypeOfSliceOfByte { + arg0 = arg0.Convert(rtypeOfSliceOfByte) + } + return fun(arg0.Interface().([]byte), arg1const) + } + } else { + arg1fun := args[1].Fun.(func(*Env) string) + ret = func(env *Env) int { + // arg0 is "assignable to []byte" + arg0 := arg0fun(env) + if arg0.Type() != rtypeOfSliceOfByte { + arg0 = arg0.Convert(rtypeOfSliceOfByte) + } + arg1 := arg1fun(env) + return fun(arg0.Interface().([]byte), arg1) + } + } + case func(interface{}): // panic() + argfunsX1 := call.MakeArgfunsX1() + argfun := argfunsX1[0] + if name == "panic" { + ret = func(env *Env) { + arg := argfun(env).Interface() + panic(arg) + } + } else { + ret = func(env *Env) { + arg := argfun(env).Interface() + fun(arg) + } + } + case func(interface{}, ...interface{}): // print, println() + argfunsX1 := call.MakeArgfunsX1() + if call.Ellipsis { + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) { + arg := argfuns[0](env).Interface() + argslice := argfuns[1](env).Interface().([]interface{}) + fun(arg, argslice...) + } + } else { + ret = func(env *Env) { + args := make([]interface{}, len(argfunsX1)) + for i, argfun := range argfunsX1 { + args[i] = argfun(env).Interface() + } + fun(args[0], args[1:]...) + } + } + case func(r.Value): // close() + argfun := call.MakeArgfunsX1()[0] + if name == "close" { + ret = func(env *Env) { + arg := argfun(env) + arg.Close() + } + } else { + ret = func(env *Env) { + arg := argfun(env) + fun(arg) + } + } + case func(r.Value) int: // cap(), len() + argfun := call.MakeArgfunsX1()[0] + ret = func(env *Env) int { + arg := argfun(env) + return fun(arg) + } + case func(r.Value) r.Value: // Env() + argfun := call.MakeArgfunsX1()[0] + if name == "Env" { + ret = func(env *Env) r.Value { + return argfun(env) + } + } else { + ret = func(env *Env) r.Value { + arg0 := argfun(env) + return fun(arg0) + } + } + case func(r.Value, r.Value): // delete() + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + fun(arg0, arg1) + } + case func(r.Value, r.Value) int: // copy() + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) int { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + return fun(arg0, arg1) + } + case func(r.Value, r.Value) r.Value: // Eval(), EvalType() + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) r.Value { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + return fun(arg0, arg1) + } + case func(r.Value, r.Value) (r.Value, r.Value): // MacroExpand*() + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) (r.Value, []r.Value) { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + ret0, ret1 := fun(arg0, arg1) + return ret0, []r.Value{ret0, ret1} + } + case func(r.Value, ...r.Value) r.Value: // append() + argfunsX1 := call.MakeArgfunsX1() + if call.Ellipsis { + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + if name == "append" { + ret = func(env *Env) r.Value { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + argslice := unwrapSlice(arg1) + return r.Append(arg0, argslice...) + } + } else { + ret = func(env *Env) r.Value { + arg0 := argfuns[0](env) + arg1 := argfuns[1](env) + argslice := unwrapSlice(arg1) + return fun(arg0, argslice...) + } + } + } else { + if name == "append" { + ret = func(env *Env) r.Value { + args := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + args[i] = argfun(env) + } + return r.Append(args[0], args[1:]...) + } + } else { + ret = func(env *Env) r.Value { + args := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + args[i] = argfun(env) + } + return fun(args[0], args[1:]...) + } + } + } + case func(r.Type) r.Value: // new(), make() + arg0 := args[0].Value.(r.Type) + if name == "new" { + ret = func(env *Env) r.Value { + return r.New(arg0) + } + } else { + ret = func(env *Env) r.Value { + return fun(arg0) + } + } + case func(r.Type, int) r.Value: // make() + arg0 := args[0].Value.(r.Type) + arg1fun := argfuns[1].(func(*Env) int) + ret = func(env *Env) r.Value { + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + case func(r.Type, int, int) r.Value: // make() + arg0 := args[0].Value.(r.Type) + arg1fun := argfuns[1].(func(*Env) int) + arg2fun := argfuns[2].(func(*Env) int) + ret = func(env *Env) r.Value { + arg1 := arg1fun(env) + arg2 := arg2fun(env) + return fun(arg0, arg1, arg2) + } + default: + base.Errorf("unimplemented call_builtin() for function type %v", r.TypeOf(fun)) + } + return ret +} + +// unwrapSlice accepts a reflect.Value with kind == reflect.Array, Slice or String +// and returns slice of its elements, each wrapped in a reflect.Value +func unwrapSlice(arg r.Value) []r.Value { + n := arg.Len() + slice := make([]r.Value, n) + for i := range slice { + slice[i] = arg.Index(i) + } + return slice +} + +// callBuiltin invokes the appropriate compiler for a call to a builtin function: cap, copy, len, make, new... +func (c *Comp) callBuiltin(node *ast.CallExpr, fun *Expr) *Call { + builtin := fun.Value.(Builtin) + if fun.Sym == nil { + c.Errorf("invalid call to non-name builtin: %v", node) + return nil + } + nmin := builtin.ArgMin + nmax := builtin.ArgMax + n := len(node.Args) + if n < int(nmin) || n > int(nmax) { + return c.badBuiltinCallArgNum(fun.Sym.Name+"()", nmin, nmax, node.Args) + } + call := builtin.Compile(c, *fun.Sym, node) + if call != nil { + call.Builtin = true + } + return call +} + +// callFunction compiles a call to a function that accesses interpreter's *CompEnv +func (c *Comp) callFunction(node *ast.CallExpr, fun *Expr) (newfun *Expr, lastarg *Expr) { + function := fun.Value.(Function) + t := function.Type + var sym *Symbol + if fun.Sym != nil { + symcopy := *fun.Sym + symcopy.Type = t + sym = &symcopy + } + newfun = exprLit(Lit{Type: t, Value: function.Fun}, sym) + if len(node.Args) < t.NumIn() { + lastarg = exprX1(c.TypeOfInterface(), func(env *Env) r.Value { + return r.ValueOf(&Interp{Comp: c, env: env}) + }) + } + return newfun, lastarg +} + +func (c *Comp) badBuiltinCallArgNum(name interface{}, nmin uint16, nmax uint16, args []ast.Expr) *Call { + prefix := "not enough" + nargs := len(args) + if nargs > int(nmax) { + prefix = "too many" + } + str := fmt.Sprintf("%d", nmin) + if nmax <= nmin { + } else if nmax == nmin+1 { + str = fmt.Sprintf("%s or %d", str, nmax) + } else if nmax < base.MaxUint16 { + str = fmt.Sprintf("%s to %d", str, nmax) + } else { + str = fmt.Sprintf("%s or more", str) + } + c.Errorf("%s arguments in call to builtin %v: expecting %s, found %d: %v", prefix, name, str, nargs, args) + return nil +} + +func (c *Comp) badBuiltinCallArgType(name string, arg ast.Expr, tactual xr.Type, texpected interface{}) *Call { + c.Errorf("cannot use %v <%v> as %v in builtin %s()", arg, tactual, texpected, name) + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call.go b/vendor/github.com/cosmos72/gomacro/fast/call.go new file mode 100644 index 0000000..a2afd73 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call.go @@ -0,0 +1,412 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "bytes" + "fmt" + "go/ast" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type Call struct { + Fun *Expr + Args []*Expr + OutTypes []xr.Type + Builtin bool // if true, call is a builtin function + Const bool // if true, call has no side effects and always returns the same result => it can be invoked at compile time + Ellipsis bool // if true, must use reflect.Value.CallSlice or equivalent to invoke the function +} + +func newCall1(fun *Expr, arg *Expr, isconst bool, outtypes ...xr.Type) *Call { + return &Call{ + Fun: fun, + Args: []*Expr{arg}, + OutTypes: outtypes, + Const: isconst, + } +} + +func (call *Call) MakeArgfunsX1() []func(*Env) r.Value { + args := call.Args + argfuns := make([]func(*Env) r.Value, len(args)) + for i, arg := range args { + argfuns[i] = arg.AsX1() + } + return argfuns +} + +// CallExpr compiles a function call or a type conversion +func (c *Comp) CallExpr(node *ast.CallExpr) *Expr { + var fun *Expr + if len(node.Args) == 1 { + var t xr.Type + fun, t = c.Expr1OrType(node.Fun) + if t != nil { + return c.Convert(node.Args[0], t) + } + } + call := c.prepareCall(node, fun) + return c.call_any(call) +} + +// callExpr compiles the common part between CallExpr and Go statement +func (c *Comp) prepareCall(node *ast.CallExpr, fun *Expr) *Call { + if fun == nil { + fun = c.Expr1(node.Fun) + } + t := fun.Type + var builtin bool + var lastarg *Expr + if xr.SameType(t, c.TypeOfBuiltin()) { + return c.callBuiltin(node, fun) + } else if xr.SameType(t, c.TypeOfFunction()) { + fun, lastarg = c.callFunction(node, fun) + t = fun.Type + builtin = true + } + if t.Kind() != r.Func { + c.Errorf("call of non-function: %v <%v>", node.Fun, t) + return nil + } + var args []*Expr + if len(node.Args) == 1 { + // support foo(bar()) where bar() returns multiple values + arg := c.Expr(node.Args[0]) + if arg.NumOut() == 0 { + c.Errorf("function argument returns zero values: %v ", node.Args[0]) + } + args = []*Expr{arg} + } else { + args = c.Exprs(node.Args) + } + if lastarg != nil { + args = append(args, lastarg) + } + ellipsis := node.Ellipsis != token.NoPos + c.checkCallArgs(node, t, args, ellipsis) + + outn := t.NumOut() + outtypes := make([]xr.Type, outn) + for i := 0; i < outn; i++ { + outtypes[i] = t.Out(i) + } + return &Call{Fun: fun, Args: args, OutTypes: outtypes, Builtin: builtin, Ellipsis: ellipsis} +} + +// call_any emits a compiled function call +func (c *Comp) call_any(call *Call) *Expr { + expr := &Expr{} + tout := call.OutTypes + nout := len(tout) + expr.SetTypes(tout) + + maxdepth := c.Depth + // functions imported from other packages are constant too... + // but call_builtin does not know about them + if call.Fun.Const() { + if call.Builtin { + expr.Fun = c.call_builtin(call) + } else { + // normal calls do not expect function to be a constant. + call.Fun.WithFun() + } + } + + if expr.Fun != nil { + // done already + } else if len(call.Args) == 1 && call.Fun.Type.NumIn() > 1 { + // support foo(bar()) where bar() returns multiple values + expr.Fun = call_multivalue(call, maxdepth) + } else if nout == 0 { + expr.Fun = c.call_ret0(call, maxdepth) + } else if nout == 1 { + expr.Fun = c.call_ret1(call, maxdepth) + } else { + expr.Fun = c.call_ret2plus(call, maxdepth) + } + // constant propagation - only if function returns a single value + if call.Const && len(call.OutTypes) == 1 { + expr.EvalConst(OptDefaults) + // c.Debugf("pre-computed result of constant call %v: %v <%v>", call, expr.Value, TypeOf(expr.Value)) + } + return expr +} + +func (c *Comp) checkCallArgs(node *ast.CallExpr, t xr.Type, args []*Expr, ellipsis bool) { + variadic := t.IsVariadic() + if ellipsis { + if variadic { + // a variadic function invoked as fun(x, y...) + // behaves exactly as a non-variadic function call: + // number and type of arguments must match + variadic = false + } else { + c.Errorf("invalid use of ... in call to non-variadic function <%v>: %v", t, node) + return + } + } + n := t.NumIn() + narg := len(args) + if narg == 1 { + // support foo(bar()) where bar() returns multiple values + narg = args[0].NumOut() + } + if narg < n-1 || (!variadic && narg != n) { + c.badCallArgNum(node.Fun, t, args) + return + } + var ti, tlast xr.Type + if variadic { + tlast = t.In(n - 1).Elem() + } + var convs []func(r.Value, r.Type) r.Value + var rtypes []r.Type + needconvs := false + multivalue := len(args) != narg + if multivalue { + convs = make([]func(r.Value, r.Type) r.Value, narg) + rtypes = make([]r.Type, narg) + } + for i := 0; i < narg; i++ { + if variadic && i >= n-1 { + ti = tlast + } else { + ti = t.In(i) + } + if multivalue { + // support foo(bar()) where bar() returns multiple values + targ := args[0].Out(i) + if targ == nil || !targ.AssignableTo(ti) { + c.Errorf("cannot use <%v> as <%v> in argument to %v", targ, ti, node.Fun) + } else if conv := c.Converter(targ, ti); conv != nil { + convs[i] = conv + rtypes[i] = ti.ReflectType() + args[0].Types[i] = ti + needconvs = true + } + continue + } + // one argument per parameter: foo(arg1, arg2 /*...*/) + arg := args[i] + if arg.Const() { + arg.ConstTo(ti) + } else if arg.Type == nil || !arg.Type.AssignableTo(ti) { + c.Errorf("cannot use <%v> as <%v> in argument to %v", arg.Type, ti, node.Fun) + } else { + arg.To(c, ti) + } + } + if !multivalue || !needconvs { + return + } + f := args[0].AsXV(OptDefaults) + args[0].Fun = func(env *Env) (r.Value, []r.Value) { + _, vs := f(env) + for i, conv := range convs { + if conv != nil { + vs[i] = conv(vs[i], rtypes[i]) + } + } + return vs[0], vs + } +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func (c *Comp) call_ret0(call *Call, maxdepth int) func(env *Env) { + if call.Ellipsis { + return call_ellipsis_ret0(call, maxdepth) + } else if call.Fun.Type.IsVariadic() { + return call_variadic_ret0(call, maxdepth) + } + // optimize fun(t1, t2) + exprfun := call.Fun.AsX1() + var ret func(*Env) + switch len(call.Args) { + case 0: + ret = c.call0ret0(call, maxdepth) + case 1: + ret = c.call1ret0(call, maxdepth) + case 2: + ret = c.call2ret0(call, maxdepth) + case 3: + argfunsX1 := call.MakeArgfunsX1() + argfuns := [3]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + argfunsX1[2], + } + ret = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + argfuns[2](env), + } + funv.Call(argv) + } + } + if ret == nil { + argfunsX1 := call.MakeArgfunsX1() + ret = func(env *Env) { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + funv.Call(argv) + } + } + return ret +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func (c *Comp) call_ret1(call *Call, maxdepth int) I { + if call.Ellipsis { + return call_ellipsis_ret1(call, maxdepth) + } else if call.Fun.Type.IsVariadic() { + return call_variadic_ret1(call, maxdepth) + } + var ret I + switch len(call.Args) { + case 0: + ret = c.call0ret1(call, maxdepth) + case 1: + ret = c.call1ret1(call, maxdepth) + case 2: + ret = c.call2ret1(call, maxdepth) + default: + ret = c.callnret1(call, maxdepth) + } + return ret +} + +// cannot optimize much here... fast_interpreter ASSUMES that expressions +// returning multiple values actually return (reflect.Value, []reflect.Value) +func (c *Comp) call_ret2plus(call *Call, maxdepth int) func(env *Env) (r.Value, []r.Value) { + if call.Ellipsis { + return call_ellipsis_ret2plus(call, maxdepth) + } + // no need to special case variadic functions here + expr := call.Fun + exprfun := expr.AsX1() + argfunsX1 := call.MakeArgfunsX1() + var ret func(*Env) (r.Value, []r.Value) + // slightly optimize fun() (tret0, tret1) + switch len(call.Args) { + case 0: + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + retv := funv.Call(base.ZeroValues) + return retv[0], retv + } + case 1: + argfun := argfunsX1[0] + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv) + return retv[0], retv + } + case 2: + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv) + return retv[0], retv + } + case 3: + argfuns := [3]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + argfunsX1[2], + } + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + argfuns[2](env), + } + retv := funv.Call(argv) + return retv[0], retv + } + default: + // general case + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv) + return retv[0], retv + } + } + return ret +} + +func (c *Comp) badCallArgNum(fun ast.Expr, t xr.Type, args []*Expr) *Call { + prefix := "not enough" + n := t.NumIn() + nargs := len(args) + if nargs > n { + prefix = "too many" + } + have := bytes.Buffer{} + for i, arg := range args { + if i == 0 { + fmt.Fprintf(&have, "%v", arg.Type) + } else { + fmt.Fprintf(&have, ", %v", arg.Type) + } + } + want := bytes.Buffer{} + for i := 0; i < n; i++ { + if i == 0 { + fmt.Fprintf(&want, "%v", t.In(i)) + } else { + fmt.Fprintf(&want, ", %v", t.In(i)) + } + } + c.Errorf("%s arguments in call to %v:\n\thave (%s)\n\twant (%s)", prefix, fun, have.Bytes(), want.Bytes()) + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call0ret1.go b/vendor/github.com/cosmos72/gomacro/fast/call0ret1.go new file mode 100644 index 0000000..51c7d7f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call0ret1.go @@ -0,0 +1,907 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call0ret1.go + * + * Created on Apr 20, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) call0ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + base.Errorf("internal error: call0ret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + + } + tret := expr.Type.Out(0) + kret := tret.Kind() + var cachedfunv r.Value + var ret I + switch kret { + case r.Bool: + + { + if !xr.SameType(tret, c.TypeOfBool(), + ) { + ret = func(env *Env) bool { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.Bool() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() bool) + } + return cachedfun() + } + case 0: + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func() bool) + return fun() + } + case 1: + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func() bool) + return fun() + } + case 2: + ret = func(env *Env) bool { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() bool) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func() bool) + return fun() + } + } + + } + case r.Int: + + { + if !xr.SameType(tret, c.TypeOfInt(), + ) { + ret = func(env *Env) int { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return int(ret.Int()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() int) + } + return cachedfun() + } + case 0: + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func() int) + return fun() + } + case 1: + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func() int) + return fun() + } + case 2: + ret = func(env *Env) int { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() int) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func() int) + return fun() + } + } + + } + case r.Int8: + + { + if !xr.SameType(tret, c.TypeOfInt8(), + ) { + ret = func(env *Env) int8 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return int8(ret.Int()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() int8) + } + return cachedfun() + } + case 0: + ret = func(env *Env) int8 { + fun := env.Binds[funindex].Interface().(func() int8) + return fun() + } + case 1: + ret = func(env *Env) int8 { + fun := env.Outer.Binds[funindex].Interface().(func() int8) + return fun() + } + case 2: + ret = func(env *Env) int8 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() int8) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func() int8) + return fun() + } + } + + } + case r.Int16: + { + if !xr.SameType(tret, c.TypeOfInt16(), + ) { + ret = func(env *Env) int16 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return int16(ret.Int()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() int16) + } + return cachedfun() + } + case 0: + ret = func(env *Env) int16 { + fun := env.Binds[funindex].Interface().(func() int16) + return fun() + } + case 1: + ret = func(env *Env) int16 { + fun := env.Outer.Binds[funindex].Interface().(func() int16) + return fun() + } + case 2: + ret = func(env *Env) int16 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() int16) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func() int16) + return fun() + } + } + + } + case r.Int32: + { + if !xr.SameType(tret, c.TypeOfInt32(), + ) { + ret = func(env *Env) int32 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return int32(ret.Int()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() int32) + } + return cachedfun() + } + case 0: + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func() int32) + return fun() + } + case 1: + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func() int32) + return fun() + } + case 2: + ret = func(env *Env) int32 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() int32) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func() int32) + return fun() + } + } + + } + case r.Int64: + { + if !xr.SameType(tret, c.TypeOfInt64(), + ) { + ret = func(env *Env) int64 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.Int() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() int64) + } + return cachedfun() + } + case 0: + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func() int64) + return fun() + } + case 1: + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func() int64) + return fun() + } + case 2: + ret = func(env *Env) int64 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() int64) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func() int64) + return fun() + } + } + + } + case r.Uint: + { + if !xr.SameType(tret, c.TypeOfUint(), + ) { + ret = func(env *Env) uint { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return uint(ret.Uint()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uint) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func() uint) + return fun() + } + case 1: + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func() uint) + return fun() + } + case 2: + ret = func(env *Env) uint { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uint) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func() uint) + return fun() + } + } + + } + case r.Uint8: + { + if !xr.SameType(tret, c.TypeOfUint8(), + ) { + ret = func(env *Env) uint8 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return uint8(ret.Uint()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uint8) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uint8 { + fun := env.Binds[funindex].Interface().(func() uint8) + return fun() + } + case 1: + ret = func(env *Env) uint8 { + fun := env.Outer.Binds[funindex].Interface().(func() uint8) + return fun() + } + case 2: + ret = func(env *Env) uint8 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uint8) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func() uint8) + return fun() + } + } + + } + case r.Uint16: + { + if !xr.SameType(tret, c.TypeOfUint16(), + ) { + ret = func(env *Env) uint16 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return uint16(ret.Uint()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uint16) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uint16 { + fun := env.Binds[funindex].Interface().(func() uint16) + return fun() + } + case 1: + ret = func(env *Env) uint16 { + fun := env.Outer.Binds[funindex].Interface().(func() uint16) + return fun() + } + case 2: + ret = func(env *Env) uint16 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uint16) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func() uint16) + return fun() + } + } + + } + case r.Uint32: + { + if !xr.SameType(tret, c.TypeOfUint32(), + ) { + ret = func(env *Env) uint32 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return uint32(ret.Uint()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uint32) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uint32 { + fun := env.Binds[funindex].Interface().(func() uint32) + return fun() + } + case 1: + ret = func(env *Env) uint32 { + fun := env.Outer.Binds[funindex].Interface().(func() uint32) + return fun() + } + case 2: + ret = func(env *Env) uint32 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uint32) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func() uint32) + return fun() + } + } + + } + case r.Uint64: + { + if !xr.SameType(tret, c.TypeOfUint64(), + ) { + ret = func(env *Env) uint64 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.Uint() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uint64) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func() uint64) + return fun() + } + case 1: + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func() uint64) + return fun() + } + case 2: + ret = func(env *Env) uint64 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uint64) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func() uint64) + return fun() + } + } + + } + case r.Uintptr: + { + if !xr.SameType(tret, c.TypeOfUintptr(), + ) { + ret = func(env *Env) uintptr { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return uintptr(ret.Uint()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() uintptr) + } + return cachedfun() + } + case 0: + ret = func(env *Env) uintptr { + fun := env.Binds[funindex].Interface().(func() uintptr) + return fun() + } + case 1: + ret = func(env *Env) uintptr { + fun := env.Outer.Binds[funindex].Interface().(func() uintptr) + return fun() + } + case 2: + ret = func(env *Env) uintptr { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() uintptr) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func() uintptr) + return fun() + } + } + + } + case r.Float32: + { + if !xr.SameType(tret, c.TypeOfFloat32(), + ) { + ret = func(env *Env) float32 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return float32(ret.Float()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() float32) + } + return cachedfun() + } + case 0: + ret = func(env *Env) float32 { + fun := env.Binds[funindex].Interface().(func() float32) + return fun() + } + case 1: + ret = func(env *Env) float32 { + fun := env.Outer.Binds[funindex].Interface().(func() float32) + return fun() + } + case 2: + ret = func(env *Env) float32 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() float32) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func() float32) + return fun() + } + } + + } + case r.Float64: + { + if !xr.SameType(tret, c.TypeOfFloat64(), + ) { + ret = func(env *Env) float64 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.Float() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() float64) + } + return cachedfun() + } + case 0: + ret = func(env *Env) float64 { + fun := env.Binds[funindex].Interface().(func() float64) + return fun() + } + case 1: + ret = func(env *Env) float64 { + fun := env.Outer.Binds[funindex].Interface().(func() float64) + return fun() + } + case 2: + ret = func(env *Env) float64 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() float64) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func() float64) + return fun() + } + } + + } + case r.Complex64: + { + if !xr.SameType(tret, c.TypeOfComplex64(), + ) { + ret = func(env *Env) complex64 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return complex64(ret.Complex()) + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() complex64) + } + return cachedfun() + } + case 0: + ret = func(env *Env) complex64 { + fun := env.Binds[funindex].Interface().(func() complex64) + return fun() + } + case 1: + ret = func(env *Env) complex64 { + fun := env.Outer.Binds[funindex].Interface().(func() complex64) + return fun() + } + case 2: + ret = func(env *Env) complex64 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() complex64) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func() complex64) + return fun() + } + } + + } + case r.Complex128: + { + if !xr.SameType(tret, c.TypeOfComplex128(), + ) { + ret = func(env *Env) complex128 { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.Complex() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() complex128 + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() complex128) + } + return cachedfun() + } + case 0: + ret = func(env *Env) complex128 { + fun := env.Binds[funindex].Interface().(func() complex128) + return fun() + } + case 1: + ret = func(env *Env) complex128 { + fun := env.Outer.Binds[funindex].Interface().(func() complex128) + return fun() + } + case 2: + ret = func(env *Env) complex128 { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() complex128) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func() complex128) + return fun() + } + } + + } + case r.String: + { + if !xr.SameType(tret, c.TypeOfString(), + ) { + ret = func(env *Env) string { + fun := exprfun(env) + + ret := fun.Call(base.ZeroValues)[0] + return ret.String() + + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() string + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() string) + } + return cachedfun() + } + case 0: + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func() string) + return fun() + } + case 1: + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func() string) + return fun() + } + case 2: + ret = func(env *Env) string { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() string) + return fun() + } + } + } + + if ret == nil { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func() string) + return fun() + } + } + + } + default: + ret = func(env *Env) r.Value { + funv := exprfun(env) + return funv.Call(base.ZeroValues)[0] + } + + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call0ret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/call0ret1.gomacro new file mode 100644 index 0000000..1ef9ce6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call0ret1.gomacro @@ -0,0 +1,200 @@ +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call0ret1.go + * + * Created on Apr 20, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func maketypevar(typ ast.Node) ast.Node { + t := EvalType(typ) + sel := &ast.SelectorExpr{ + X: &ast.Ident{Name: "c"}, + Sel: &ast.Ident{Name: "TypeOf" + upcasefirstbyte(t.Name())}, + } + return ~"{~,sel ()} +} + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro mcall0ret1(rettyp ast.Node) ast.Node { + if EvalType(rettyp) == nil { + // keep the result wrapped in a reflect.Value + return ~"{ + ret = func(env *Env) r.Value { + funv := exprfun(env) + return funv.Call(base.ZeroValues)[0] + } + } + } + + cachefun := ~"{ + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func() ~,rettyp) + } + } + + typevar := maketypevar(rettyp) + retconv := convertvalue1(rettyp, ~'ret) + + return ~"{ + if !xr.SameType(tret, ~,typevar) { + ret = func(env *Env) ~,rettyp { + fun := exprfun(env) + // Debugf("calling %v with args []", fun.Type()) + ret := fun.Call(base.ZeroValues)[0] + return ~,retconv + } + } else if funsym != nil { + switch funupn { + case maxdepth - 1: + var cachedfun func() ~,rettyp + ret = func(env *Env) ~,rettyp { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + // Debugf("calling %v with args []", r.TypeOf(cachedfun)) + return cachedfun() + } + case 0: + ret = func(env *Env) ~,rettyp { + fun := env.Binds[funindex].Interface().(func() ~,rettyp) + // Debugf("calling %v with args []", r.TypeOf(fun)) + return fun() + } + case 1: + ret = func(env *Env) ~,rettyp { + fun := env.Outer.Binds[funindex].Interface().(func() ~,rettyp) + // Debugf("calling %v with args []", r.TypeOf(fun)) + return fun() + } + case 2: + ret = func(env *Env) ~,rettyp { + fun := env.Outer.Outer.Binds[funindex].Interface().(func() ~,rettyp) + // Debugf("calling %v with args []", r.TypeOf(fun)) + return fun() + } + } + } + if ret == nil { + ret = func(env *Env) ~,rettyp { + fun := exprfun(env).Interface().(func() ~,rettyp) + // Debugf("calling %v with args []", r.TypeOf(fun)) + return fun() + } + } + } +} + +func (c *Comp) call0ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + base.Errorf("internal error: call0ret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + } + tret := expr.Type.Out(0) + kret := tret.Kind() + var cachedfunv r.Value + var ret I + switch kret { + case r.Bool: {mcall0ret1; bool} + case r.Int: {mcall0ret1; int} + case r.Int8: {mcall0ret1; int8} + case r.Int16: {mcall0ret1; int16} + case r.Int32: {mcall0ret1; int32} + case r.Int64: {mcall0ret1; int64} + case r.Uint: {mcall0ret1; uint} + case r.Uint8: {mcall0ret1; uint8} + case r.Uint16: {mcall0ret1; uint16} + case r.Uint32: {mcall0ret1; uint32} + case r.Uint64: {mcall0ret1; uint64} + case r.Uintptr: {mcall0ret1; uintptr} + case r.Float32: {mcall0ret1; float32} + case r.Float64: {mcall0ret1; float64} + case r.Complex64: {mcall0ret1; complex64} + case r.Complex128:{mcall0ret1; complex128} + case r.String: {mcall0ret1; string} + default: {mcall0ret1; nil} + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call0ret1compact.go b/vendor/github.com/cosmos72/gomacro/fast/call0ret1compact.go new file mode 100644 index 0000000..8f40ec2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call0ret1compact.go @@ -0,0 +1,119 @@ +// +build gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call0ret1compact.go + * + * Created on Jun 14, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) call0ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + + tret := expr.Type.Out(0) + kret := tret.Kind() + var ret I + + switch kret { + case r.Bool: + ret = func(env *Env) bool { + return exprfun(env).Call(base.ZeroValues)[0].Bool() + } + case r.Int: + ret = func(env *Env) int { + return int(exprfun(env).Call(base.ZeroValues)[0].Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + return int8(exprfun(env).Call(base.ZeroValues)[0].Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + return int16(exprfun(env).Call(base.ZeroValues)[0].Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + return int32(exprfun(env).Call(base.ZeroValues)[0].Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + return exprfun(env).Call(base.ZeroValues)[0].Int() + } + case r.Uint: + ret = func(env *Env) uint { + return uint(exprfun(env).Call(base.ZeroValues)[0].Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + return uint8(exprfun(env).Call(base.ZeroValues)[0].Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + return uint16(exprfun(env).Call(base.ZeroValues)[0].Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + return uint32(exprfun(env).Call(base.ZeroValues)[0].Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + return exprfun(env).Call(base.ZeroValues)[0].Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + return uintptr(exprfun(env).Call(base.ZeroValues)[0].Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + return float32(exprfun(env).Call(base.ZeroValues)[0].Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + return exprfun(env).Call(base.ZeroValues)[0].Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + return complex64(exprfun(env).Call(base.ZeroValues)[0].Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + return exprfun(env).Call(base.ZeroValues)[0].Complex() + } + case r.String: + ret = func(env *Env) string { + return exprfun(env).Call(base.ZeroValues)[0].String() + } + default: + ret = func(env *Env) r.Value { + return exprfun(env).Call(base.ZeroValues)[0] + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call1ret1.go b/vendor/github.com/cosmos72/gomacro/fast/call1ret1.go new file mode 100644 index 0000000..7f87eb7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call1ret1.go @@ -0,0 +1,8977 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call1ret1.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) call1ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call1ret1() invoked for constant function %v. use call_builtin() instead", expr) + } + + } + t := expr.Type + targ, tret := t.In(0), t.Out(0) + karg, kret := targ.Kind(), tret.Kind() + var ret I + if KindToType(karg) != targ.ReflectType() || KindToType(kret) != tret.ReflectType() { + return c.call1ret1namedtype(call, maxdepth) + } + + arg := call.Args[0] + argfun := arg.AsX1() + var cachedfunv r.Value + + switch kret { + + case r.Bool: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(bool) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(bool) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(bool) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) bool + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(int) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(int) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) bool + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(int8) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(int8) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int8) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) bool + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(int16) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(int16) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int16) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) bool + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(int32) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(int32) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int32) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(int64) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(int64) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int64) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) bool + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uint) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uint) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) bool + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uint8) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint8) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) bool + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uint16) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint16) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) bool + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uint32) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint32) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uint64) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint64) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) bool + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(uintptr) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uintptr) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) bool + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(float32) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(float32) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(float32) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(float64) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(float64) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(float64) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) bool + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(complex64) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(complex64) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(complex128) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(complex128) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) bool + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) bool) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) bool) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) bool { + fun := env.Binds[funindex].Interface().(func(string) bool) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) bool { + fun := env.Outer.Binds[funindex].Interface().(func(string) bool) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(string) bool) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Bool() + } + } + + case r.Int: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(bool) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(bool) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(bool) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) int + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(int) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(int) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) int + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(int8) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(int8) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int8) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) int + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(int16) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(int16) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int16) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) int + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(int32) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(int32) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int32) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(int64) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(int64) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int64) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) int + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uint) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uint) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) int + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uint8) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint8) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) int + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uint16) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint16) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) int + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uint32) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint32) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uint64) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint64) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) int + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(uintptr) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uintptr) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) int + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(float32) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(float32) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(float32) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(float64) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(float64) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(float64) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) int + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(complex64) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(complex64) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(complex128) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(complex128) int) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) int + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int { + fun := env.Binds[funindex].Interface().(func(string) int) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int { + fun := env.Outer.Binds[funindex].Interface().(func(string) int) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(string) int) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return int(ret0.Int()) + } + } + + case r.Int8: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) int8 + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int8) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int8) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int8 { + fun := env.Binds[funindex].Interface().(func(int8) int8) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int8 { + fun := env.Outer.Binds[funindex].Interface().(func(int8) int8) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int8) int8) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(bool) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int8) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int16) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int32) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int64) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint8) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint16) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint32) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint64) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uintptr) int8) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(float32) int8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(float64) int8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(complex64) int8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(complex128) int8) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(string) int8) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return int8(ret0.Int()) + } + } + } + + case r.Int16: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) int16 + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int16) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int16) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int16 { + fun := env.Binds[funindex].Interface().(func(int16) int16) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int16 { + fun := env.Outer.Binds[funindex].Interface().(func(int16) int16) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int16) int16) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(bool) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int8) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int16) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int32) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int64) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint8) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint16) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint32) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint64) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uintptr) int16) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(float32) int16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(float64) int16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(complex64) int16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(complex128) int16) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(string) int16) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return int16(ret0.Int()) + } + } + } + + case r.Int32: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(bool) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(bool) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(bool) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) int32 + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(int) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(int) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) int32 + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(int8) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(int8) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int8) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) int32 + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(int16) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(int16) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int16) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) int32 + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(int32) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(int32) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int32) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(int64) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(int64) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int64) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) int32 + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uint) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) int32 + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uint8) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint8) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) int32 + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uint16) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint16) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) int32 + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uint32) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint32) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uint64) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint64) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) int32 + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(uintptr) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uintptr) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) int32 + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(float32) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(float32) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(float32) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(float64) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(float64) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(float64) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) int32 + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(complex64) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(complex64) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(complex128) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(complex128) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) int32 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int32 { + fun := env.Binds[funindex].Interface().(func(string) int32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int32 { + fun := env.Outer.Binds[funindex].Interface().(func(string) int32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(string) int32) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return int32(ret0.Int()) + } + } + + case r.Int64: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(bool) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(bool) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(bool) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) int64 + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(int) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(int) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) int64 + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(int8) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(int8) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int8) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) int64 + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(int16) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(int16) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int16) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) int64 + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(int32) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(int32) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int32) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(int64) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(int64) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int64) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) int64 + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uint) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) int64 + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uint8) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint8) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) int64 + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uint16) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint16) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) int64 + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uint32) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint32) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uint64) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint64) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) int64 + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(uintptr) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uintptr) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) int64 + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(float32) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(float32) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(float32) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(float64) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(float64) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(float64) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) int64 + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(complex64) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(complex64) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(complex128) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(complex128) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) int64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) int64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) int64 { + fun := env.Binds[funindex].Interface().(func(string) int64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) int64 { + fun := env.Outer.Binds[funindex].Interface().(func(string) int64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(string) int64) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Int() + } + } + + case r.Uint: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(bool) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(bool) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(bool) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) uint + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(int) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(int) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) uint + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(int8) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(int8) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int8) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) uint + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(int16) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(int16) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int16) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) uint + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(int32) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(int32) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int32) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(int64) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(int64) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int64) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) uint + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uint) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uint) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) uint + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uint8) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint8) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) uint + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uint16) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint16) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) uint + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uint32) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint32) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uint64) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint64) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) uint + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(uintptr) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uintptr) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) uint + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(float32) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(float32) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(float32) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(float64) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(float64) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(float64) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) uint + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(complex64) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(complex64) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(complex128) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(complex128) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) uint + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) uint) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) uint) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint { + fun := env.Binds[funindex].Interface().(func(string) uint) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint { + fun := env.Outer.Binds[funindex].Interface().(func(string) uint) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(string) uint) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return uint(ret0.Uint()) + } + } + + case r.Uint8: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) uint8 + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint8) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint8) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint8 { + fun := env.Binds[funindex].Interface().(func(uint8) uint8) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint8 { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) uint8) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint8) uint8) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(bool) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int8) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int16) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int32) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int64) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint8) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint16) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint32) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint64) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uintptr) uint8) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(float32) uint8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(float64) uint8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(complex64) uint8) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(complex128) uint8) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(string) uint8) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return uint8(ret0.Uint()) + } + } + } + + case r.Uint16: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) uint16 + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint16) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint16) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint16 { + fun := env.Binds[funindex].Interface().(func(uint16) uint16) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint16 { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) uint16) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint16) uint16) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(bool) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int8) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int16) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int32) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int64) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint8) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint16) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint32) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint64) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uintptr) uint16) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(float32) uint16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(float64) uint16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(complex64) uint16) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(complex128) uint16) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(string) uint16) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return uint16(ret0.Uint()) + } + } + } + + case r.Uint32: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) uint32 + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint32 { + fun := env.Binds[funindex].Interface().(func(uint32) uint32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint32 { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) uint32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint32) uint32) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(bool) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int8) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int16) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int32) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int64) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint8) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint16) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint32) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint64) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uintptr) uint32) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(float32) uint32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(float64) uint32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(complex64) uint32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(complex128) uint32) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(string) uint32) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return uint32(ret0.Uint()) + } + } + } + + case r.Uint64: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(bool) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(bool) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(bool) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) uint64 + + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(int) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(int) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) uint64 + + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(int8) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(int8) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int8) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) uint64 + + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(int16) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(int16) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int16) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) uint64 + + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(int32) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(int32) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int32) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(int64) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(int64) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int64) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) uint64 + + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uint) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) uint64 + + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uint8) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint8) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) uint64 + + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uint16) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint16) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) uint64 + + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uint32) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint32) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uint64) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint64) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) uint64 + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(uintptr) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uintptr) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) uint64 + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(float32) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(float32) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(float32) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(float64) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(float64) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(float64) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) uint64 + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(complex64) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(complex64) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(complex128) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(complex128) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) uint64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) uint64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) uint64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uint64 { + fun := env.Binds[funindex].Interface().(func(string) uint64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uint64 { + fun := env.Outer.Binds[funindex].Interface().(func(string) uint64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(string) uint64) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Uint() + } + } + + case r.Uintptr: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) uintptr + + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uintptr) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) uintptr) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) uintptr { + fun := env.Binds[funindex].Interface().(func(uintptr) uintptr) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) uintptr { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) uintptr) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uintptr) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(bool) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int8) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int16) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int32) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int64) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint8) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint16) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint32) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint64) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uintptr) uintptr) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(float32) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(float64) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(complex64) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(complex128) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(string) uintptr) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return uintptr(ret0.Uint()) + } + } + } + + case r.Float32: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) float32 + + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) float32) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) float32) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) float32 { + fun := env.Binds[funindex].Interface().(func(float32) float32) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) float32 { + fun := env.Outer.Binds[funindex].Interface().(func(float32) float32) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(float32) float32) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(bool) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int8) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int16) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int32) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int64) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint8) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint16) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint32) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint64) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uintptr) float32) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(float32) float32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(float64) float32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(complex64) float32) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(complex128) float32) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(string) float32) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return float32(ret0.Float()) + } + } + } + + case r.Float64: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) float64 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) float64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) float64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) float64 { + fun := env.Binds[funindex].Interface().(func(float64) float64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) float64 { + fun := env.Outer.Binds[funindex].Interface().(func(float64) float64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(float64) float64) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(bool) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int8) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int16) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int32) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int64) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint8) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint16) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint32) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint64) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uintptr) float64) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(float32) float64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(float64) float64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(complex64) float64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(complex128) float64) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(string) float64) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Float() + } + } + } + + case r.Complex64: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) complex64 + + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) complex64) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) complex64) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) complex64 { + fun := env.Binds[funindex].Interface().(func(complex64) complex64) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) complex64 { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) complex64) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(complex64) complex64) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(bool) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int8) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int16) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int32) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int64) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint8) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint16) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint32) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint64) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uintptr) complex64) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(float32) complex64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(float64) complex64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(complex64) complex64) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(complex128) complex64) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(string) complex64) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return complex64(ret0.Complex()) + } + } + } + + case r.Complex128: + if karg == kret { + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) complex128 + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) complex128) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) complex128) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) complex128 { + fun := env.Binds[funindex].Interface().(func(complex128) complex128) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) complex128 { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) complex128) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(complex128) complex128) + arg := argfun(env) + return fun(arg) + } + } + + } + } else { + switch karg { + case r.Bool: + + { + argfun := arg.WithFun().(func(env *Env) bool) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(bool) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Int: + + { + argfun := arg.WithFun().(func(env *Env) int) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Int8: + { + argfun := arg.WithFun().(func(env *Env) int8) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int8) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Int16: + { + argfun := arg.WithFun().(func(env *Env) int16) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int16) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Int32: + { + argfun := arg.WithFun().(func(env *Env) int32) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int32) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Int64: + { + argfun := arg.WithFun().(func(env *Env) int64) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int64) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint: + { + argfun := arg.WithFun().(func(env *Env) uint) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint8: + { + argfun := arg.WithFun().(func(env *Env) uint8) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint8) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint16: + { + argfun := arg.WithFun().(func(env *Env) uint16) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint16) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint32: + { + argfun := arg.WithFun().(func(env *Env) uint32) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint32) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uint64: + { + argfun := arg.WithFun().(func(env *Env) uint64) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint64) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Uintptr: + { + argfun := arg.WithFun().(func(env *Env) uintptr) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uintptr) complex128) + arg := argfun(env) + return fun(arg) + } + } + case r.Float32: + { + argfun := arg.WithFun().(func(env *Env) float32) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(float32) complex128) + arg := argfun(env) + return fun(arg) + } + } + + case r.Float64: + { + argfun := arg.WithFun().(func(env *Env) float64) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(float64) complex128) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex64: + { + argfun := arg.WithFun().(func(env *Env) complex64) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(complex64) complex128) + arg := argfun(env) + return fun(arg) + } + } + + case r.Complex128: + { + argfun := arg.WithFun().(func(env *Env) complex128) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(complex128) complex128) + arg := argfun(env) + return fun(arg) + } + } + + case r.String: + { + argfun := arg.WithFun().(func(env *Env) string) + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(string) complex128) + arg := argfun(env) + return fun(arg) + } + } + + default: + ret = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Complex() + } + } + } + + case r.String: + switch karg { + case r.Bool: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) bool) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) bool) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(bool) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(bool) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(bool) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) string + if arg.Const() { + argconst := int( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(int) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(int) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) string + if arg.Const() { + argconst := int8( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int8) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(int8) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(int8) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int8) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) string + if arg.Const() { + argconst := int16( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int16) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(int16) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(int16) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int16) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) string + if arg.Const() { + argconst := int32( + + r.ValueOf(arg.Value).Int()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int32) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(int32) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(int32) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int32) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Int64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) int64) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) int64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(int64) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(int64) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int64) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) string + if arg.Const() { + argconst := uint( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uint) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uint) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint8: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) string + if arg.Const() { + argconst := uint8( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint8) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uint8) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uint8) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint8) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint16: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) string + if arg.Const() { + argconst := uint16( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint16) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uint16) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uint16) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint16) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) string + if arg.Const() { + argconst := uint32( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint32) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uint32) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uint32) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint32) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uint64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uint64) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uint64) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uint64) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint64) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Uintptr: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) string + if arg.Const() { + argconst := uintptr( + + r.ValueOf(arg.Value).Uint()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(uintptr) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(uintptr) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uintptr) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float32: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) string + if arg.Const() { + argconst := float32( + + r.ValueOf(arg.Value).Float()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float32) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float32) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(float32) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(float32) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(float32) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Float64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) float64) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) float64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(float64) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(float64) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(float64) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex64: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) string + if arg.Const() { + argconst := complex64( + + r.ValueOf(arg.Value).Complex()) + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex64) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(complex64) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(complex64) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(complex64) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.Complex128: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) complex128) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(complex128) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(complex128) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(complex128) string) + arg := argfun(env) + return fun(arg) + } + } + + } + case r.String: + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) string + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) string) + } + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) string) + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string) string) + } + + arg := argfun(env) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) string) + if funsym != nil && funupn == 0 { + ret = func(env *Env) string { + fun := env.Binds[funindex].Interface().(func(string) string) + arg := argfun(env) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) string { + fun := env.Outer.Binds[funindex].Interface().(func(string) string) + arg := argfun(env) + return fun(arg) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(string) string) + arg := argfun(env) + return fun(arg) + } + } + + } + default: + ret = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + + ret0 := funv.Call(argv)[0] + return ret0.String() + } + } + + } + if ret == nil { + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.Call(argv)[0] + } + } + return ret +} +func (c *Comp) call1ret1namedtype(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + t := expr.Type + kret := t.Out(0).Kind() + + argfun := call.Args[0].AsX1() + var ret I + + switch kret { + case r.Bool: + ret = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Bool() + } + case r.Int: + ret = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + + case r.Int16: + ret = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + + case r.Int32: + ret = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + + case r.Int64: + ret = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Int() + } + + case r.Uint: + ret = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + + case r.Uint8: + ret = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + + case r.Uint16: + ret = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + + case r.Uint32: + ret = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + + case r.Uint64: + ret = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Uint() + } + + case r.Uintptr: + ret = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + + case r.Float32: + ret = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + + case r.Float64: + ret = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Float() + } + + case r.Complex64: + ret = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + + case r.Complex128: + ret = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Complex() + } + + case r.String: + ret = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.String() + } + + } + if ret == nil { + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.Call(argv)[0] + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call1ret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/call1ret1.gomacro new file mode 100644 index 0000000..7b6aa7a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call1ret1.gomacro @@ -0,0 +1,341 @@ +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call1ret1.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func maketypevar(typ ast.Node) ast.Node { + t := EvalType(typ) + return &ast.Ident{Name: "TypeOf" + upcasefirstbyte(t.Name())} +} + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro mcall1ret1(argtyp, rettyp ast.Node) ast.Node { + if EvalType(rettyp) == nil { + // keep the arguments and result wrapped in a reflect.Value + return ~"{ + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.Call(argv)[0] + } + } + } + if EvalType(argtyp) == nil { + ret0 := convertvalue1(rettyp, ~'ret0) + + return ~"{ + ret = func(env *Env) ~,rettyp { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + // Debugf("calling %v with args [%v]", r.TypeOf(funv), argv) + ret0 := funv.Call(argv)[0] + return ~,ret0 + } + } + } + + cachefun := ~"{ + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(~,argtyp) ~,rettyp) + } + } + + argconv := convertvalue1(argtyp, ~'{r.ValueOf(arg.Value)}) + + return ~"{ + // Debugf("compiling call to %v, funsym=%p, funupn=%v, maxdepth=%v", r.TypeOf((func(~,argtyp) ~,rettyp)(nil)), funsym, funupn, maxdepth) + if funsym != nil && funupn == maxdepth - 1 { + var cachedfun func(~,argtyp) ~,rettyp + if arg.Const() { + argconst := ~,argconv + ret = func(env *Env) ~,rettyp { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + // Debugf("calling %v with args [%v]", r.TypeOf(cachedfun), argconst) + return cachedfun(argconst) + } + } else { + argfun := arg.Fun.(func(env *Env) ~,argtyp) + ret = func(env *Env) ~,rettyp { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), arg) + return cachedfun(arg) + } + } + } else { + argfun := arg.WithFun().(func(env *Env) ~,argtyp) + if funsym != nil && funupn == 0 { + ret = func(env *Env) ~,rettyp { + fun := env.Binds[funindex].Interface().(func(~,argtyp) ~,rettyp) + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), arg) + return fun(arg) + } + } else if funsym != nil && funupn == 1 { + ret = func(env *Env) ~,rettyp { + fun := env.Outer.Binds[funindex].Interface().(func(~,argtyp) ~,rettyp) + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), arg) + return fun(arg) + } + } else { + ret = func(env *Env) ~,rettyp { + fun := exprfun(env).Interface().(func(~,argtyp) ~,rettyp) + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), arg) + return fun(arg) + } + } + } + } +} + +:macro mcall1ret1compact(argtyp, rettyp ast.Node) ast.Node { + if EvalType(rettyp) == nil || EvalType(argtyp) == nil { + // nothing to optimize... + return ~"{mcall1ret1; ~,argtyp; ~,rettyp} + } + + return ~"{ + argfun := arg.WithFun().(func(env *Env) ~,argtyp) + ret = func(env *Env) ~,rettyp { + fun := exprfun(env).Interface().(func(~,argtyp) ~,rettyp) + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), argconst) + return fun(arg) + } + } +} + +:macro mcallx1ret1(rettyp ast.Node) ast.Node { + return ~"{ + switch karg { + case r.Bool: {mcall1ret1; bool; ~,rettyp} + case r.Int: {mcall1ret1; int; ~,rettyp} + case r.Int8: {mcall1ret1; int8; ~,rettyp} + case r.Int16: {mcall1ret1; int16; ~,rettyp} + case r.Int32: {mcall1ret1; int32; ~,rettyp} + case r.Int64: {mcall1ret1; int64; ~,rettyp} + case r.Uint: {mcall1ret1; uint; ~,rettyp} + case r.Uint8: {mcall1ret1; uint8; ~,rettyp} + case r.Uint16: {mcall1ret1; uint16; ~,rettyp} + case r.Uint32: {mcall1ret1; uint32; ~,rettyp} + case r.Uint64: {mcall1ret1; uint64; ~,rettyp} + case r.Uintptr: {mcall1ret1; uintptr; ~,rettyp} + case r.Float32: {mcall1ret1; float32; ~,rettyp} + case r.Float64: {mcall1ret1; float64; ~,rettyp} + case r.Complex64: {mcall1ret1; complex64; ~,rettyp} + case r.Complex128:{mcall1ret1; complex128; ~,rettyp} + case r.String: {mcall1ret1; string; ~,rettyp} + default: {mcall1ret1; nil; ~,rettyp} + } + } +} + +:macro mcallx1ret1compact(rettyp ast.Node) ast.Node { + return ~"{ + switch karg { + case r.Bool: {mcall1ret1compact; bool; ~,rettyp} + case r.Int: {mcall1ret1compact; int; ~,rettyp} + case r.Int8: {mcall1ret1compact; int8; ~,rettyp} + case r.Int16: {mcall1ret1compact; int16; ~,rettyp} + case r.Int32: {mcall1ret1compact; int32; ~,rettyp} + case r.Int64: {mcall1ret1compact; int64; ~,rettyp} + case r.Uint: {mcall1ret1compact; uint; ~,rettyp} + case r.Uint8: {mcall1ret1compact; uint8; ~,rettyp} + case r.Uint16: {mcall1ret1compact; uint16; ~,rettyp} + case r.Uint32: {mcall1ret1compact; uint32; ~,rettyp} + case r.Uint64: {mcall1ret1compact; uint64; ~,rettyp} + case r.Uintptr: {mcall1ret1compact; uintptr; ~,rettyp} + case r.Float32: {mcall1ret1compact; float32; ~,rettyp} + case r.Float64: {mcall1ret1compact; float64; ~,rettyp} + case r.Complex64: {mcall1ret1compact; complex64; ~,rettyp} + case r.Complex128:{mcall1ret1compact; complex128; ~,rettyp} + case r.String: {mcall1ret1compact; string; ~,rettyp} + default: {mcall1ret1compact; nil; ~,rettyp} + } + } +} + +func (c *Comp) call1ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call1ret1() invoked for constant function %v. use call_builtin() instead", expr) + } + } + t := expr.Type + targ, tret := t.In(0), t.Out(0) + karg, kret := targ.Kind(), tret.Kind() + var ret I + if KindToType(karg) != targ.ReflectType() || KindToType(kret) != tret.ReflectType() { + return c.call1ret1namedtype(call, maxdepth) + } + arg := call.Args[0] + argfun := arg.AsX1() + var cachedfunv r.Value + + switch kret { + // do NOT optimize all cases... too many combinations + case r.Bool: {mcallx1ret1; bool} + case r.Int: {mcallx1ret1; int} + case r.Int8: if karg == kret {mcall1ret1; int8; int8} else {mcallx1ret1compact; int8} + case r.Int16: if karg == kret {mcall1ret1; int16; int16} else {mcallx1ret1compact; int16} + case r.Int32: {mcallx1ret1; int32} + case r.Int64: {mcallx1ret1; int64} + case r.Uint: {mcallx1ret1; uint} + case r.Uint8: if karg == kret {mcall1ret1; uint8; uint8} else {mcallx1ret1compact; uint8} + case r.Uint16: if karg == kret {mcall1ret1; uint16; uint16} else {mcallx1ret1compact; uint16} + case r.Uint32: if karg == kret {mcall1ret1; uint32; uint32} else {mcallx1ret1compact; uint32} + case r.Uint64: {mcallx1ret1; uint64} + case r.Uintptr: if karg == kret {mcall1ret1; uintptr; uintptr} else {mcallx1ret1compact; uintptr} + case r.Float32: if karg == kret {mcall1ret1; float32; float32} else {mcallx1ret1compact; float32} + case r.Float64: if karg == kret {mcall1ret1; float64; float64} else {mcallx1ret1compact; float64} + case r.Complex64: if karg == kret {mcall1ret1; complex64; complex64} else {mcallx1ret1compact; complex64} + case r.Complex128:if karg == kret {mcall1ret1; complex128; complex128} else {mcallx1ret1compact; complex128} + case r.String: {mcallx1ret1; string} + } + if ret == nil { + {mcall1ret1; nil; nil} // cannot optimize more this one... + } + return ret +} + +:macro mcallx1ret1namedtype(rettyp ast.Node) ast.Node { + retconv := convertvalue1(rettyp, ~'retv) + + return ~"{ + ret = func(env *Env) ~,rettyp { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return ~,retconv + } + } +} + +func (c *Comp) call1ret1namedtype(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + t := expr.Type + kret := t.Out(0).Kind() + + argfun := call.Args[0].AsX1() + var ret I + + switch kret { + case r.Bool: {mcallx1ret1namedtype; bool} + case r.Int: {mcallx1ret1namedtype; int} + case r.Int8: {mcallx1ret1namedtype; int8} + case r.Int16: {mcallx1ret1namedtype; int16} + case r.Int32: {mcallx1ret1namedtype; int32} + case r.Int64: {mcallx1ret1namedtype; int64} + case r.Uint: {mcallx1ret1namedtype; uint} + case r.Uint8: {mcallx1ret1namedtype; uint8} + case r.Uint16: {mcallx1ret1namedtype; uint16} + case r.Uint32: {mcallx1ret1namedtype; uint32} + case r.Uint64: {mcallx1ret1namedtype; uint64} + case r.Uintptr: {mcallx1ret1namedtype; uintptr} + case r.Float32: {mcallx1ret1namedtype; float32} + case r.Float64: {mcallx1ret1namedtype; float64} + case r.Complex64: {mcallx1ret1namedtype; complex64} + case r.Complex128:{mcallx1ret1namedtype; complex128} + case r.String: {mcallx1ret1namedtype; string} + } + if ret == nil { + {mcall1ret1; nil; nil} // cannot optimize more this one... + } + return ret +} + diff --git a/vendor/github.com/cosmos72/gomacro/fast/call1ret1compact.go b/vendor/github.com/cosmos72/gomacro/fast/call1ret1compact.go new file mode 100644 index 0000000..5d3c91d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call1ret1compact.go @@ -0,0 +1,222 @@ +// +build gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call1ret1compact.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +func (c *Comp) call1ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + + arg := call.Args[0] + argfun := arg.AsX1() + var ret I + + switch expr.Type.Out(0).Kind() { + case r.Bool: + ret = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Bool() + } + + case r.Int: + ret = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + + case r.Int8: + ret = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + + case r.Int16: + ret = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + + case r.Int32: + ret = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + + case r.Int64: + ret = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Int() + } + + case r.Uint: + ret = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + + case r.Uint8: + ret = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + + case r.Uint16: + ret = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + + case r.Uint32: + ret = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + + case r.Uint64: + ret = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Uint() + } + + case r.Uintptr: + ret = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + + case r.Float32: + ret = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + + case r.Float64: + ret = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Float() + } + + case r.Complex64: + ret = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + + case r.Complex128: + ret = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Complex() + } + + case r.String: + ret = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.String() + } + default: + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.Call(argv)[0] + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call2ret1.go b/vendor/github.com/cosmos72/gomacro/fast/call2ret1.go new file mode 100644 index 0000000..0ad68bd --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call2ret1.go @@ -0,0 +1,8828 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call_ret1.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) call2ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call2ret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + + } + t := expr.Type + rtarg0, rtarg1, rtret := t.In(0).ReflectType(), t.In(1).ReflectType(), t.Out(0).ReflectType() + karg0, kret := rtarg0.Kind(), rtret.Kind() + args := call.Args + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + var cachedfunv r.Value + var ret I + if KindToType(kret) == rtret { + switch kret { + case r.Bool: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(bool, bool) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int, int) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int8, int8) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int16, int16) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int32, int32) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(int64, int64) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint, uint) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint8, uint8) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint16, uint16) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint32, uint32) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uint64, uint64) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(uintptr, uintptr) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(float32, float32) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(float64, float64) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(complex64, complex64) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(complex128, complex128) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) bool + + ret = func(env *Env) bool { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) bool) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) bool { + fun := exprfun(env).Interface().(func(string, string) bool) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Bool() + } + } + + } + case r.Int: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(bool, bool) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int, int) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int8, int8) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int16, int16) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int32, int32) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(int64, int64) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint, uint) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint8, uint8) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint16, uint16) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint32, uint32) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uint64, uint64) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(uintptr, uintptr) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(float32, float32) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(float64, float64) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(complex64, complex64) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(complex128, complex128) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) int + + ret = func(env *Env) int { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) int) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int { + fun := exprfun(env).Interface().(func(string, string) int) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return int(ret0.Int()) + } + } + + } + case r.Int8: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(bool, bool) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int, int) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int8, int8) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int16, int16) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int32, int32) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(int64, int64) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint, uint) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint8, uint8) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint16, uint16) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint32, uint32) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uint64, uint64) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(float32, float32) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(float64, float64) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(complex64, complex64) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(complex128, complex128) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) int8 + + ret = func(env *Env) int8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) int8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int8 { + fun := exprfun(env).Interface().(func(string, string) int8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return int8(ret0.Int()) + } + } + + } + case r.Int16: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(bool, bool) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int, int) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int8, int8) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int16, int16) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int32, int32) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(int64, int64) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint, uint) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint8, uint8) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint16, uint16) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint32, uint32) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uint64, uint64) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(float32, float32) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(float64, float64) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(complex64, complex64) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(complex128, complex128) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) int16 + + ret = func(env *Env) int16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) int16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int16 { + fun := exprfun(env).Interface().(func(string, string) int16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return int16(ret0.Int()) + } + } + + } + case r.Int32: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(bool, bool) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int, int) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int8, int8) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int16, int16) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int32, int32) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(int64, int64) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint, uint) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint8, uint8) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint16, uint16) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint32, uint32) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uint64, uint64) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(float32, float32) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(float64, float64) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(complex64, complex64) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(complex128, complex128) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) int32 + + ret = func(env *Env) int32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) int32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int32 { + fun := exprfun(env).Interface().(func(string, string) int32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return int32(ret0.Int()) + } + } + + } + case r.Int64: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(bool, bool) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int, int) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int8, int8) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int16, int16) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int32, int32) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(int64, int64) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint, uint) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint8, uint8) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint16, uint16) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint32, uint32) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uint64, uint64) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(float32, float32) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(float64, float64) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(complex64, complex64) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(complex128, complex128) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) int64 + + ret = func(env *Env) int64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) int64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) int64 { + fun := exprfun(env).Interface().(func(string, string) int64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Int() + } + } + + } + case r.Uint: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(bool, bool) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int, int) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int8, int8) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int16, int16) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int32, int32) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(int64, int64) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint, uint) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint8, uint8) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint16, uint16) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint32, uint32) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uint64, uint64) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(float32, float32) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(float64, float64) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(complex64, complex64) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(complex128, complex128) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uint + + ret = func(env *Env) uint { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uint) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint { + fun := exprfun(env).Interface().(func(string, string) uint) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return uint(ret0.Uint()) + } + } + + } + case r.Uint8: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(bool, bool) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int, int) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int8, int8) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int16, int16) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int32, int32) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(int64, int64) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint, uint) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint8, uint8) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint16, uint16) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint32, uint32) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uint64, uint64) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(float32, float32) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(float64, float64) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(complex64, complex64) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(complex128, complex128) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uint8 + + ret = func(env *Env) uint8 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uint8) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint8 { + fun := exprfun(env).Interface().(func(string, string) uint8) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return uint8(ret0.Uint()) + } + } + + } + + case r.Uint16: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(bool, bool) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int, int) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int8, int8) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int16, int16) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int32, int32) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(int64, int64) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint, uint) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint8, uint8) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint16, uint16) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint32, uint32) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uint64, uint64) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(float32, float32) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(float64, float64) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(complex64, complex64) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(complex128, complex128) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uint16 + + ret = func(env *Env) uint16 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uint16) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint16 { + fun := exprfun(env).Interface().(func(string, string) uint16) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return uint16(ret0.Uint()) + } + } + + } + + case r.Uint32: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(bool, bool) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int, int) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int8, int8) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int16, int16) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int32, int32) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(int64, int64) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint, uint) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint8, uint8) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint16, uint16) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint32, uint32) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uint64, uint64) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(float32, float32) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(float64, float64) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(complex64, complex64) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(complex128, complex128) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uint32 + + ret = func(env *Env) uint32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uint32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint32 { + fun := exprfun(env).Interface().(func(string, string) uint32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return uint32(ret0.Uint()) + } + } + + } + + case r.Uint64: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(bool, bool) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int, int) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int8, int8) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int16, int16) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int32, int32) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(int64, int64) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint, uint) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint8, uint8) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint16, uint16) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint32, uint32) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uint64, uint64) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(float32, float32) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(float64, float64) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(complex64, complex64) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(complex128, complex128) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uint64 + + ret = func(env *Env) uint64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uint64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uint64 { + fun := exprfun(env).Interface().(func(string, string) uint64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Uint() + } + } + + } + + case r.Uintptr: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(bool, bool) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int, int) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int8, int8) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int16, int16) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int32, int32) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(int64, int64) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint, uint) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint8, uint8) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint16, uint16) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint32, uint32) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uint64, uint64) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(uintptr, uintptr) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(float32, float32) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(float64, float64) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(complex64, complex64) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(complex128, complex128) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) uintptr + + ret = func(env *Env) uintptr { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) uintptr) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) uintptr { + fun := exprfun(env).Interface().(func(string, string) uintptr) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return uintptr(ret0.Uint()) + } + } + + } + + case r.Float32: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(bool, bool) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int, int) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int8, int8) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int16, int16) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int32, int32) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(int64, int64) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint, uint) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint8, uint8) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint16, uint16) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint32, uint32) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uint64, uint64) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(float32, float32) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(float64, float64) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(complex64, complex64) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(complex128, complex128) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) float32 + + ret = func(env *Env) float32 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) float32) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float32 { + fun := exprfun(env).Interface().(func(string, string) float32) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return float32(ret0.Float()) + } + } + + } + + case r.Float64: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(bool, bool) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int, int) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int8, int8) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int16, int16) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int32, int32) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(int64, int64) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint, uint) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint8, uint8) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint16, uint16) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint32, uint32) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uint64, uint64) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(float32, float32) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(float64, float64) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(complex64, complex64) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(complex128, complex128) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) float64 + + ret = func(env *Env) float64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) float64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) float64 { + fun := exprfun(env).Interface().(func(string, string) float64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Float() + } + } + + } + + case r.Complex64: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(bool, bool) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int, int) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int8, int8) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int16, int16) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int32, int32) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(int64, int64) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint, uint) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint8, uint8) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint16, uint16) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint32, uint32) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uint64, uint64) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(float32, float32) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(float64, float64) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(complex64, complex64) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(complex128, complex128) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) complex64 + + ret = func(env *Env) complex64 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) complex64) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex64 { + fun := exprfun(env).Interface().(func(string, string) complex64) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return complex64(ret0.Complex()) + } + } + + } + + case r.Complex128: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(bool, bool) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int, int) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int8, int8) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int16, int16) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int32, int32) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(int64, int64) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint, uint) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint8, uint8) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint16, uint16) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint32, uint32) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uint64, uint64) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(uintptr, uintptr) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(float32, float32) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(float64, float64) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(complex64, complex64) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(complex128, complex128) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) complex128 + + ret = func(env *Env) complex128 { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) complex128) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) complex128 { + fun := exprfun(env).Interface().(func(string, string) complex128) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.Complex() + } + } + + } + + case r.String: + { + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: + + { + arg0fun := args[0].WithFun().(func(env *Env) bool) + arg1fun := args[1].WithFun().(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(bool, bool) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int: + + { + arg0fun := args[0].WithFun().(func(env *Env) int) + arg1fun := args[1].WithFun().(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int, int) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int8: + + { + arg0fun := args[0].WithFun().(func(env *Env) int8) + arg1fun := args[1].WithFun().(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int8, int8) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int16: + + { + arg0fun := args[0].WithFun().(func(env *Env) int16) + arg1fun := args[1].WithFun().(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int16, int16) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int32: + + { + arg0fun := args[0].WithFun().(func(env *Env) int32) + arg1fun := args[1].WithFun().(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int32, int32) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Int64: + + { + arg0fun := args[0].WithFun().(func(env *Env) int64) + arg1fun := args[1].WithFun().(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(int64, int64) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint) + arg1fun := args[1].WithFun().(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint, uint) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint8: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint8) + arg1fun := args[1].WithFun().(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint8, uint8) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint16: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint16) + arg1fun := args[1].WithFun().(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint16, uint16) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint32: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint32) + arg1fun := args[1].WithFun().(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint32, uint32) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uint64: + + { + arg0fun := args[0].WithFun().(func(env *Env) uint64) + arg1fun := args[1].WithFun().(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uint64, uint64) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Uintptr: + + { + arg0fun := args[0].WithFun().(func(env *Env) uintptr) + arg1fun := args[1].WithFun().(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(uintptr, uintptr) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float32: + + { + arg0fun := args[0].WithFun().(func(env *Env) float32) + arg1fun := args[1].WithFun().(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(float32, float32) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Float64: + + { + arg0fun := args[0].WithFun().(func(env *Env) float64) + arg1fun := args[1].WithFun().(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(float64, float64) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex64: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex64) + arg1fun := args[1].WithFun().(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(complex64, complex64) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.Complex128: + + { + arg0fun := args[0].WithFun().(func(env *Env) complex128) + arg1fun := args[1].WithFun().(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(complex128, complex128) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + case r.String: + + { + arg0fun := args[0].WithFun().(func(env *Env) string) + arg1fun := args[1].WithFun().(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) string + + ret = func(env *Env) string { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string) string) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) string { + fun := exprfun(env).Interface().(func(string, string) string) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + return fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + + ret0 := funv.Call(argv)[0] + return ret0.String() + } + } + + } + + } + } + + if ret == nil { + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + return funv.Call(argv)[0] + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call2ret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/call2ret1.gomacro new file mode 100644 index 0000000..30476dc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call2ret1.gomacro @@ -0,0 +1,258 @@ +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call_ret1.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func convertret0(typ ast.Node) (ast.Node, ast.Node) { + var t r.Type = EvalType(typ) + var ret0 ast.Node = ~'{ret0} // set type ast.Node: classic interpreter is too clever and deduces *ast.Ident + if t == nil { + // keep the result wrapped in a reflect.Value + typ = ~'{r.Value} + } else { + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,ret0 . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + ret0 = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + ret0 = ~"{~,typ ( ~,sel () )} + } + } + return typ, ret0 +} + +:macro mcall2ret1(arg0typ, arg1typ, rettyp ast.Node) ast.Node { + if EvalType(rettyp) == nil { + // keep the arguments and result wrapped in a reflect.Value + return ~"{ + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + return funv.Call(argv)[0] + } + } + } + var ret0 ast.Node // unused + rettyp, ret0 = convertret0(rettyp) + + if EvalType(arg0typ) == nil || EvalType(arg1typ) == nil { + return ~"{ + ret = func(env *Env) ~,rettyp { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + // Debugf("calling %v with args [%v]", r.TypeOf(funv), argv) + ret0 := funv.Call(argv)[0] + return ~,ret0 + } + } + } + + cachefun := ~"{ + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(~,arg0typ , ~,arg1typ) ~,rettyp) + } + } + + return ~"{ + arg0fun := args[0].WithFun().(func(env *Env) ~,arg0typ) + arg1fun := args[1].WithFun().(func(env *Env) ~,arg1typ) + if funsym != nil && funupn == maxdepth - 1 { + var cachedfun func(~,arg0typ, ~,arg1typ) ~,rettyp + ret = func(env *Env) ~,rettyp { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + arg0 := arg0fun(env) + arg1 := arg1fun(env) + // Debugf("calling %v with args [%v %v]", r.TypeOf(fun), arg0, arg1) + return cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) ~,rettyp { + fun := exprfun(env).Interface().(func(~,arg0typ , ~,arg1typ) ~,rettyp) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + // Debugf("calling %v with args [%v %v]", r.TypeOf(fun), arg0, arg1) + return fun(arg0, arg1) + } + } + } +} + +// not used, see comment below in mcallxy2ret1 +:macro __mcallx2ret1(arg1typ, rettyp ast.Node) ast.Node { + return ~"{ + switch karg0 { + case r.Bool: {mcall2ret1; bool; ~,arg1typ; ~,rettyp} + case r.Int: {mcall2ret1; int; ~,arg1typ; ~,rettyp} + case r.Int8: {mcall2ret1; int8; ~,arg1typ; ~,rettyp} + case r.Int16: {mcall2ret1; int16; ~,arg1typ; ~,rettyp} + case r.Int32: {mcall2ret1; int32; ~,arg1typ; ~,rettyp} + case r.Int64: {mcall2ret1; int64; ~,arg1typ; ~,rettyp} + case r.Uint: {mcall2ret1; uint; ~,arg1typ; ~,rettyp} + case r.Uint8: {mcall2ret1; uint8; ~,arg1typ; ~,rettyp} + case r.Uint16: {mcall2ret1; uint16; ~,arg1typ; ~,rettyp} + case r.Uint32: {mcall2ret1; uint32; ~,arg1typ; ~,rettyp} + case r.Uint64: {mcall2ret1; uint64; ~,arg1typ; ~,rettyp} + case r.Uintptr: {mcall2ret1; uintptr; ~,arg1typ; ~,rettyp} + case r.Float32: {mcall2ret1; float32; ~,arg1typ; ~,rettyp} + case r.Float64: {mcall2ret1; float64; ~,arg1typ; ~,rettyp} + case r.Complex64: {mcall2ret1; complex64; ~,arg1typ; ~,rettyp} + case r.Complex128:{mcall2ret1; complex128; ~,arg1typ; ~,rettyp} + case r.String: {mcall2ret1; string; ~,arg1typ; ~,rettyp} + default: {mcall2ret1; nil; ~,arg1typ; ~,rettyp} + } + } +} + +:macro mcallxy2ret1(rettyp ast.Node) ast.Node { + // generating all combinations func(targ0,targ1) tret + // produces a 6MB source file... definitely too much + // + // Only optimize func(targ0,targ0) tret + // i.e. if the two args have the same type - still produces a 240kB source file + return ~"{ + if rtarg0 == rtarg1 && KindToType(karg0) == rtarg0 { + switch karg0 { + case r.Bool: {mcall2ret1; bool; bool; ~,rettyp} + case r.Int: {mcall2ret1; int; int; ~,rettyp} + case r.Int8: {mcall2ret1; int8; int8; ~,rettyp} + case r.Int16: {mcall2ret1; int16; int16; ~,rettyp} + case r.Int32: {mcall2ret1; int32; int32; ~,rettyp} + case r.Int64: {mcall2ret1; int64; int64; ~,rettyp} + case r.Uint: {mcall2ret1; uint; uint; ~,rettyp} + case r.Uint8: {mcall2ret1; uint8; uint8; ~,rettyp} + case r.Uint16: {mcall2ret1; uint16; uint16; ~,rettyp} + case r.Uint32: {mcall2ret1; uint32; uint32; ~,rettyp} + case r.Uint64: {mcall2ret1; uint64; uint64; ~,rettyp} + case r.Uintptr: {mcall2ret1; uintptr; uintptr; ~,rettyp} + case r.Float32: {mcall2ret1; float32; float32; ~,rettyp} + case r.Float64: {mcall2ret1; float64; float64; ~,rettyp} + case r.Complex64: {mcall2ret1; complex64; complex64; ~,rettyp} + case r.Complex128:{mcall2ret1; complex128; complex128; ~,rettyp} + case r.String: {mcall2ret1; string; string; ~,rettyp} + } + } + if ret == nil { + {mcall2ret1; nil; nil; ~,rettyp} + } + } +} + +func (c *Comp) call2ret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call2ret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + } + t := expr.Type + rtarg0, rtarg1, rtret := t.In(0).ReflectType(), t.In(1).ReflectType(), t.Out(0).ReflectType() + karg0, kret := rtarg0.Kind(), rtret.Kind() + args := call.Args + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(*Env) r.Value { + argfunsX1[0], + argfunsX1[1], + } + var cachedfunv r.Value + var ret I + if KindToType(kret) == rtret { + switch kret { + case r.Bool: {mcallxy2ret1; bool} + case r.Int: {mcallxy2ret1; int} + case r.Int8: {mcallxy2ret1; int8} + case r.Int16: {mcallxy2ret1; int16} + case r.Int32: {mcallxy2ret1; int32} + case r.Int64: {mcallxy2ret1; int64} + case r.Uint: {mcallxy2ret1; uint} + case r.Uint8: {mcallxy2ret1; uint8} + case r.Uint16: {mcallxy2ret1; uint16} + case r.Uint32: {mcallxy2ret1; uint32} + case r.Uint64: {mcallxy2ret1; uint64} + case r.Uintptr: {mcallxy2ret1; uintptr} + case r.Float32: {mcallxy2ret1; float32} + case r.Float64: {mcallxy2ret1; float64} + case r.Complex64: {mcallxy2ret1; complex64} + case r.Complex128:{mcallxy2ret1; complex128} + case r.String: {mcallxy2ret1; string} + } + } + if ret == nil { + {mcall2ret1; nil; nil; nil} // cannot optimize more this one... + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call2ret1compact.go b/vendor/github.com/cosmos72/gomacro/fast/call2ret1compact.go new file mode 100644 index 0000000..e1663ba --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call2ret1compact.go @@ -0,0 +1,32 @@ +// +build gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call1ret1compact.go + * + * Created on Jun 14, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +func (c *Comp) call2ret1(call *Call, maxdepth int) I { + return c.callnret1(call, maxdepth) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call_ellipsis.go b/vendor/github.com/cosmos72/gomacro/fast/call_ellipsis.go new file mode 100644 index 0000000..f0bc691 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call_ellipsis.go @@ -0,0 +1,697 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call_ellipsis.go + * + * Created on May 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +// call a variadic function, when arguments CONTAIN '...' +func call_ellipsis_ret0(c *Call, maxdepth int) func(env *Env) { + exprfun := c.Fun.AsX1() + argfunsX1 := c.MakeArgfunsX1() + var call func(*Env) + switch c.Fun.Type.NumIn() { + case 1: + argfun := argfunsX1[0] + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + funv.CallSlice(argv) + } + case 2: + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + funv.CallSlice(argv) + } + case 3: + argfuns := [3]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + argfunsX1[2], + } + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + argfuns[2](env), + } + funv.CallSlice(argv) + } + } + if call == nil { + call = func(env *Env) { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + funv.CallSlice(argv) + } + } + return call +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func call_ellipsis_ret1(c *Call, maxdepth int) I { + exprfun := c.Fun.AsX1() + argfunsX1 := c.MakeArgfunsX1() + kout := c.Fun.Type.Out(0).Kind() + var call I + switch c.Fun.Type.NumIn() { + case 1: + argfun := argfunsX1[0] + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.CallSlice(argv)[0] + } + } + case 2: + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + return funv.CallSlice(argv)[0] + } + } + default: + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + return funv.CallSlice(argv)[0] + } + } + + } + return call +} + +// cannot optimize much here... fast_interpreter ASSUMES that expressions +// returning multiple values actually return (reflect.Value, []reflect.Value) +func call_ellipsis_ret2plus(callexpr *Call, maxdepth int) func(env *Env) (r.Value, []r.Value) { + expr := callexpr.Fun + exprfun := expr.AsX1() + argfunsX1 := callexpr.MakeArgfunsX1() + var call func(*Env) (r.Value, []r.Value) + + switch expr.Type.NumIn() { + case 1: + argfun := argfunsX1[0] + call = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.CallSlice(argv) + return retv[0], retv + } + case 2: + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + call = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.CallSlice(argv) + return retv[0], retv + } + case 3: + argfuns := [3]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + argfunsX1[2], + } + call = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + argfuns[2](env), + } + retv := funv.CallSlice(argv) + return retv[0], retv + } + default: + // general case + call = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.CallSlice(argv) + return retv[0], retv + } + } + return call +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call_multivalue.go b/vendor/github.com/cosmos72/gomacro/fast/call_multivalue.go new file mode 100644 index 0000000..d706bde --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call_multivalue.go @@ -0,0 +1,353 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call_multivalue.go + * + * Created on May 29, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +// call_multivalue compiles foo(bar()) where bar() returns multiple values +func call_multivalue(call *Call, maxdepth int) I { + // no need to special case variadic functions here + expr := call.Fun + exprfun := expr.AsX1() + argfun := call.Args[0].AsXV(OptDefaults) + nout := len(call.OutTypes) + var ret I + switch nout { + case 0: + if call.Ellipsis { + ret = func(env *Env) { + funv := exprfun(env) + _, argv := argfun(env) + funv.CallSlice(argv) + } + } else { + ret = func(env *Env) { + funv := exprfun(env) + _, argv := argfun(env) + funv.Call(argv) + } + } + case 1: + if call.Ellipsis { + ret = call_multivalue_ellipsis_ret1(call, maxdepth) + } else { + ret = call_multivalue_ret1(call, maxdepth) + } + default: + if call.Ellipsis { + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + _, argv := argfun(env) + rets := funv.CallSlice(argv) + return rets[0], rets + } + } else { + ret = func(env *Env) (r.Value, []r.Value) { + funv := exprfun(env) + _, argv := argfun(env) + rets := funv.Call(argv) + return rets[0], rets + } + } + } + return ret +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func call_multivalue_ret1(call *Call, maxdepth int) I { + exprfun := call.Fun.AsX1() + argfun := call.Args[0].AsXV(OptDefaults) + kout := call.OutTypes[0].Kind() + var ret I + switch kout { + case r.Bool: + ret = func(env *Env) bool { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.Bool() + } + case r.Int: + ret = func(env *Env) int { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.Int() + } + case r.Uint: + ret = func(env *Env) uint { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.Complex() + } + case r.String: + ret = func(env *Env) string { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.Call(argv)[0] + return retv.String() + } + default: + ret = func(env *Env) r.Value { + funv := exprfun(env) + _, argv := argfun(env) + return funv.Call(argv)[0] + } + } + return ret +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func call_multivalue_ellipsis_ret1(call *Call, maxdepth int) I { + exprfun := call.Fun.AsX1() + argfun := call.Args[0].AsXV(OptDefaults) + kout := call.OutTypes[0].Kind() + var ret I + switch kout { + case r.Bool: + ret = func(env *Env) bool { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.Bool() + } + case r.Int: + ret = func(env *Env) int { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return int(retv.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.Int() + } + case r.Uint: + ret = func(env *Env) uint { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.Complex() + } + case r.String: + ret = func(env *Env) string { + funv := exprfun(env) + _, argv := argfun(env) + retv := funv.CallSlice(argv)[0] + return retv.String() + } + default: + ret = func(env *Env) r.Value { + funv := exprfun(env) + _, argv := argfun(env) + return funv.CallSlice(argv)[0] + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/call_variadic.go b/vendor/github.com/cosmos72/gomacro/fast/call_variadic.go new file mode 100644 index 0000000..c123965 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/call_variadic.go @@ -0,0 +1,633 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * call_variadic.go + * + * Created on May 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +// call a variadic function, when arguments DO NOT contain '...' +func call_variadic_ret0(c *Call, maxdepth int) func(env *Env) { + exprfun := c.Fun.AsX1() + argfunsX1 := c.MakeArgfunsX1() + var call func(*Env) + switch len(argfunsX1) { + case 1: + argfun := argfunsX1[0] + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + funv.Call(argv) + } + case 2: + argfuns := [2]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + funv.Call(argv) + } + case 3: + argfuns := [3]func(env *Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + argfunsX1[2], + } + call = func(env *Env) { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + argfuns[2](env), + } + funv.Call(argv) + } + } + if call == nil { + call = func(env *Env) { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + funv.Call(argv) + } + } + return call +} + +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func call_variadic_ret1(c *Call, maxdepth int) I { + exprfun := c.Fun.AsX1() + argfunsX1 := c.MakeArgfunsX1() + kout := c.Fun.Type.Out(0).Kind() + var call I + switch len(argfunsX1) { + case 1: + argfun := argfunsX1[0] + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + retv := funv.Call(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfun(env), + } + return funv.Call(argv)[0] + } + } + case 2: + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + retv := funv.Call(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + return funv.Call(argv)[0] + } + } + default: + switch kout { + case r.Bool: + call = func(env *Env) bool { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.Bool() + } + case r.Int: + call = func(env *Env) int { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return int(retv.Int()) + } + case r.Int8: + call = func(env *Env) int8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return int8(retv.Int()) + } + case r.Int16: + call = func(env *Env) int16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return int16(retv.Int()) + } + case r.Int32: + call = func(env *Env) int32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return int32(retv.Int()) + } + case r.Int64: + call = func(env *Env) int64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.Int() + } + case r.Uint: + call = func(env *Env) uint { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return uint(retv.Uint()) + } + case r.Uint8: + call = func(env *Env) uint8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return uint8(retv.Uint()) + } + case r.Uint16: + call = func(env *Env) uint16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return uint16(retv.Uint()) + } + case r.Uint32: + call = func(env *Env) uint32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return uint32(retv.Uint()) + } + case r.Uint64: + call = func(env *Env) uint64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.Uint() + } + case r.Uintptr: + call = func(env *Env) uintptr { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return uintptr(retv.Uint()) + } + case r.Float32: + call = func(env *Env) float32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return float32(retv.Float()) + } + case r.Float64: + call = func(env *Env) float64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.Float() + } + case r.Complex64: + call = func(env *Env) complex64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return complex64(retv.Complex()) + } + case r.Complex128: + call = func(env *Env) complex128 { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.Complex() + } + case r.String: + call = func(env *Env) string { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + retv := funv.Call(argv)[0] + return retv.String() + } + default: + call = func(env *Env) r.Value { + funv := exprfun(env) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env) + } + return funv.Call(argv)[0] + } + } + + } + return call +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/callnret0.go b/vendor/github.com/cosmos72/gomacro/fast/callnret0.go new file mode 100644 index 0000000..365193c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/callnret0.go @@ -0,0 +1,1489 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * callnret0.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) call0ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + funsym := expr.Sym + if funsym == nil { + exprfun := expr.AsX1() + return func(env *Env) { + fun := exprfun(env).Interface().(func()) + fun() + } + } + + var cachedfunv r.Value + var cachedfun func() + + funupn := funsym.Upn + funindex := funsym.Desc.Index() + switch funupn { + case maxdepth - 1: + return func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func()) + } + cachedfun() + } + case 0: + return func(env *Env) { + fun := env.Binds[funindex].Interface().(func()) + fun() + } + case 1: + return func(env *Env) { + fun := env.Outer.Binds[funindex].Interface().(func()) + fun() + } + case 2: + return func(env *Env) { + fun := env.Outer.Outer.Binds[funindex].Interface().(func()) + fun() + } + default: + return func(env *Env) { + env = env.Outer.Outer.Outer.Outer + for i := 3; i < funupn; i++ { + env = env.Outer + } + + fun := env.Binds[funindex].Interface().(func()) + fun() + } + } +} +func (c *Comp) call1ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call1ret0() invoked for constant function %#v. use call_builtin() instead", expr) + } + + } + arg := call.Args[0] + argfun := call.MakeArgfunsX1()[0] + + var cachedfunv r.Value + var ret func(env *Env) + + t := expr.Type.In(0) + k := t.Kind() + if KindToType(k) == t.ReflectType() { + switch k { + case r.Bool: + + if arg.Const() { + argconst := r.ValueOf(arg.Value).Bool() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(bool)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) bool) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(bool)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Int: + + if arg.Const() { + argconst := int(r.ValueOf(arg.Value).Int()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) int) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Int8: + if arg.Const() { + argconst := int8(r.ValueOf(arg.Value).Int()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int8)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) int8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int8)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Int16: + if arg.Const() { + argconst := int16(r.ValueOf(arg.Value).Int()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int16)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) int16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int16)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Int32: + if arg.Const() { + argconst := int32(r.ValueOf(arg.Value).Int()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int32)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) int32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int32)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Int64: + if arg.Const() { + argconst := r.ValueOf(arg.Value).Int() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int64)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) int64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int64)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uint: + if arg.Const() { + argconst := + + uint(r.ValueOf(arg.Value).Uint()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uint) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uint8: + if arg.Const() { + argconst := + + uint8(r.ValueOf(arg.Value).Uint()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint8)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uint8) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint8)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uint16: + if arg.Const() { + argconst := + + uint16(r.ValueOf(arg.Value).Uint()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint16)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uint16) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint16)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uint32: + if arg.Const() { + argconst := + + uint32(r.ValueOf(arg.Value).Uint()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint32)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uint32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint32)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uint64: + if arg.Const() { + argconst := r.ValueOf(arg.Value).Uint() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint64)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uint64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint64)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Uintptr: + if arg.Const() { + argconst := + + uintptr(r.ValueOf(arg.Value).Uint()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uintptr)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) uintptr) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uintptr)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Float32: + if arg.Const() { + argconst := + + float32(r.ValueOf(arg.Value).Float()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float32)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) float32) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float32)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Float64: + if arg.Const() { + argconst := r.ValueOf(arg.Value).Float() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float64)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) float64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float64)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Complex64: + if arg.Const() { + argconst := + + complex64(r.ValueOf(arg.Value).Complex()) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex64)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) complex64) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex64)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.Complex128: + if arg.Const() { + argconst := r.ValueOf(arg.Value).Complex() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex128)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) complex128) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex128)) + arg := argfun(env) + + fun(arg) + } + } + + } + case r.String: + if arg.Const() { + argconst := r.ValueOf(arg.Value).String() + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string)) + } + + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(string)) + + fun(argconst) + } + } + + } else { + argfun := arg.Fun.(func(env *Env) string) + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string)) + } + + arg := argfun(env) + + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(string)) + arg := argfun(env) + + fun(arg) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) { + funv := exprfun(env) + + argv := []r.Value{ + argfun(env), + } + funv.Call(argv) + } + } + return ret +} +func (c *Comp) call2ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call2ret0() invoked for constant function %#v. use call_builtin() instead", expr) + } + + } + args := call.Args + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + var cachedfunv r.Value + var ret func(env *Env) + + t := expr.Type.In(0) + rt := t.ReflectType() + k := t.Kind() + if KindToType(k) == rt && expr.Type.In(1).ReflectType() == rt { + switch k { + case r.Bool: + { + arg0fun := args[0].WithFun().(func(*Env) bool) + arg1fun := args[1].WithFun().(func(*Env) bool) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(bool, bool) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(bool, bool)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(bool, bool)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Int: + { + arg0fun := args[0].WithFun().(func(*Env) int) + arg1fun := args[1].WithFun().(func(*Env) int) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int, int) + + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int, int)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int, int)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Int8: + { + arg0fun := args[0].WithFun().(func(*Env) int8) + arg1fun := args[1].WithFun().(func(*Env) int8) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int8, int8) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int8, int8)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int8, int8)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Int16: + { + arg0fun := args[0].WithFun().(func(*Env) int16) + arg1fun := args[1].WithFun().(func(*Env) int16) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int16, int16) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int16, int16)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int16, int16)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Int32: + { + arg0fun := args[0].WithFun().(func(*Env) int32) + arg1fun := args[1].WithFun().(func(*Env) int32) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int32, int32) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int32, int32)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int32, int32)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Int64: + { + arg0fun := args[0].WithFun().(func(*Env) int64) + arg1fun := args[1].WithFun().(func(*Env) int64) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(int64, int64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(int64, int64)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(int64, int64)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uint: + { + arg0fun := args[0].WithFun().(func(*Env) uint) + arg1fun := args[1].WithFun().(func(*Env) uint) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint, uint) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint, uint)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint, uint)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uint8: + { + arg0fun := args[0].WithFun().(func(*Env) uint8) + arg1fun := args[1].WithFun().(func(*Env) uint8) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint8, uint8) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint8, uint8)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint8, uint8)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uint16: + { + arg0fun := args[0].WithFun().(func(*Env) uint16) + arg1fun := args[1].WithFun().(func(*Env) uint16) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint16, uint16) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint16, uint16)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint16, uint16)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uint32: + { + arg0fun := args[0].WithFun().(func(*Env) uint32) + arg1fun := args[1].WithFun().(func(*Env) uint32) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint32, uint32) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint32, uint32)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint32, uint32)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uint64: + { + arg0fun := args[0].WithFun().(func(*Env) uint64) + arg1fun := args[1].WithFun().(func(*Env) uint64) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uint64, uint64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uint64, uint64)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uint64, uint64)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Uintptr: + { + arg0fun := args[0].WithFun().(func(*Env) uintptr) + arg1fun := args[1].WithFun().(func(*Env) uintptr) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(uintptr, uintptr) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(uintptr, uintptr)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(uintptr, uintptr)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Float32: + { + arg0fun := args[0].WithFun().(func(*Env) float32) + arg1fun := args[1].WithFun().(func(*Env) float32) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float32, float32) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float32, float32)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float32, float32)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Float64: + { + arg0fun := args[0].WithFun().(func(*Env) float64) + arg1fun := args[1].WithFun().(func(*Env) float64) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(float64, float64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(float64, float64)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(float64, float64)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Complex64: + { + arg0fun := args[0].WithFun().(func(*Env) complex64) + arg1fun := args[1].WithFun().(func(*Env) complex64) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex64, complex64) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex64, complex64)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex64, complex64)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.Complex128: + { + arg0fun := args[0].WithFun().(func(*Env) complex128) + arg1fun := args[1].WithFun().(func(*Env) complex128) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(complex128, complex128) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(complex128, complex128)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(complex128, complex128)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + case r.String: + { + arg0fun := args[0].WithFun().(func(*Env) string) + arg1fun := args[1].WithFun().(func(*Env) string) + + if funsym != nil && funupn == maxdepth-1 { + var cachedfun func(string, string) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(string, string)) + } + + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(string, string)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + + } + } + } + + if ret == nil { + ret = func(env *Env) { + funv := exprfun(env) + + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + funv.Call(argv) + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/callnret0.gomacro b/vendor/github.com/cosmos72/gomacro/fast/callnret0.gomacro new file mode 100644 index 0000000..b0c8180 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/callnret0.gomacro @@ -0,0 +1,357 @@ +// +build !gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * callnret0.go + * + * Created on Apr 15, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +func (c *Comp) call0ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + funsym := expr.Sym + if funsym == nil { + exprfun := expr.AsX1() + return func(env *Env) { + fun := exprfun(env).Interface().(func()) + fun() + } + } + + var cachedfunv r.Value + var cachedfun func() + + funupn := funsym.Upn + funindex := funsym.Desc.Index() + switch funupn { + case maxdepth - 1: + return func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func()) + } + cachedfun() + } + case 0: + return func(env *Env) { + fun := env.Binds[funindex].Interface().(func()) + fun() + } + case 1: + return func(env *Env) { + fun := env.Outer.Binds[funindex].Interface().(func()) + fun() + } + case 2: + return func(env *Env) { + fun := env.Outer.Outer.Binds[funindex].Interface().(func()) + fun() + } + default: + return func(env *Env) { + env = env.Outer.Outer.Outer.Outer + for i := 3; i < funupn; i++ { + env = env.Outer + } + fun := env.Binds[funindex].Interface().(func()) + fun() + } + } +} + +:macro mcall1ret0(argtyp ast.Node) ast.Node { + + if EvalType(argtyp) == nil { + return ~"{ + ret = func(env *Env) { + funv := exprfun(env) + // keep the argument wrapped in a reflect.Value + argv := []r.Value{ + argfun(env), + } + funv.Call(argv) + } + } + } + + cachefun := ~"{ + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(~,argtyp)) + } + } + + argconv := convertvalue1(argtyp, ~'{r.ValueOf(arg.Value)}) + + return ~"{ + if arg.Const() { + argconst := ~,argconv + if funsym != nil && funupn == maxdepth - 1 { + var cachedfun func(~,argtyp) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + // Debugf("calling %v with args [%v]", r.TypeOf(cachedfun), argconst) + cachedfun(argconst) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(~,argtyp)) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), argconst) + fun(argconst) + } + } + } else { + argfun := arg.Fun.(func(env *Env) ~,argtyp) + if funsym != nil && funupn == maxdepth - 1 { + var cachedfun func(~,argtyp) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(cachedfun), arg) + cachedfun(arg) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(~,argtyp)) + arg := argfun(env) + // Debugf("calling %v with args [%v]", r.TypeOf(fun), arg) + fun(arg) + } + } + } + } +} + + + +func (c *Comp) call1ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call1ret0() invoked for constant function %#v. use call_builtin() instead", expr) + } + } + arg := call.Args[0] + argfun := call.MakeArgfunsX1()[0] + + var cachedfunv r.Value + var ret func(env *Env) + + t := expr.Type.In(0) + k := t.Kind() + if KindToType(k) == t.ReflectType() { + switch k { + case r.Bool: {mcall1ret0; bool} + case r.Int: {mcall1ret0; int} + case r.Int8: {mcall1ret0; int8} + case r.Int16: {mcall1ret0; int16} + case r.Int32: {mcall1ret0; int32} + case r.Int64: {mcall1ret0; int64} + case r.Uint: {mcall1ret0; uint} + case r.Uint8: {mcall1ret0; uint8} + case r.Uint16: {mcall1ret0; uint16} + case r.Uint32: {mcall1ret0; uint32} + case r.Uint64: {mcall1ret0; uint64} + case r.Uintptr: {mcall1ret0; uintptr} + case r.Float32: {mcall1ret0; float32} + case r.Float64: {mcall1ret0; float64} + case r.Complex64: {mcall1ret0; complex64} + case r.Complex128:{mcall1ret0; complex128} + case r.String: {mcall1ret0; string} + } + } + if ret == nil { + {mcall1ret0; nil} + } + return ret +} + +:macro mcall2ret0(arg0typ, arg1typ ast.Node) ast.Node { + + if EvalType(arg0typ) == nil || EvalType(arg1typ) == nil { + return ~"{ + ret = func(env *Env) { + funv := exprfun(env) + // keep the arguments wrapped in a reflect.Value + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + funv.Call(argv) + } + } + } + + cachefun := ~"{ + if cachedfunv != funv { + cachedfunv = funv + cachedfun = funv.Interface().(func(~,arg0typ, ~,arg1typ)) + } + } + + return ~"{ + arg0fun := args[0].WithFun().(func(*Env) ~,arg0typ) + arg1fun := args[1].WithFun().(func(*Env) ~,arg0typ) + + if funsym != nil && funupn == maxdepth - 1 { + var cachedfun func(~,arg0typ, ~,arg1typ) + ret = func(env *Env) { + funv := env.ThreadGlobals.FileEnv.Binds[funindex] + ~,cachefun + arg0 := arg0fun(env) + arg1 := arg1fun(env) + cachedfun(arg0, arg1) + } + } else { + ret = func(env *Env) { + fun := exprfun(env).Interface().(func(~,arg0typ, ~,arg1typ)) + arg0 := arg0fun(env) + arg1 := arg1fun(env) + fun(arg0, arg1) + } + } + } +} + + +func (c *Comp) call2ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + funsym := expr.Sym + funupn, funindex := -1, -1 + if funsym != nil { + funupn = funsym.Upn + funindex = funsym.Desc.Index() + if funindex == NoIndex { + Errorf("internal error: call2ret0() invoked for constant function %#v. use call_builtin() instead", expr) + } + } + args := call.Args + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(*Env)r.Value { + argfunsX1[0], + argfunsX1[1], + } + var cachedfunv r.Value + var ret func(env *Env) + + t := expr.Type.In(0) + rt := t.ReflectType() + k := t.Kind() + if KindToType(k) == rt && expr.Type.In(1).ReflectType() == rt { + switch k { + case r.Bool: {mcall2ret0; bool; bool} + case r.Int: {mcall2ret0; int; int} + case r.Int8: {mcall2ret0; int8; int8} + case r.Int16: {mcall2ret0; int16; int16} + case r.Int32: {mcall2ret0; int32; int32} + case r.Int64: {mcall2ret0; int64; int64} + case r.Uint: {mcall2ret0; uint; uint} + case r.Uint8: {mcall2ret0; uint8; uint8} + case r.Uint16: {mcall2ret0; uint16; uint16} + case r.Uint32: {mcall2ret0; uint32; uint32} + case r.Uint64: {mcall2ret0; uint64; uint64} + case r.Uintptr: {mcall2ret0; uintptr; uintptr} + case r.Float32: {mcall2ret0; float32; float32} + case r.Float64: {mcall2ret0; float64; float64} + case r.Complex64: {mcall2ret0; complex64; complex64} + case r.Complex128:{mcall2ret0; complex128; complex128} + case r.String: {mcall2ret0; string; string} + } + } + if ret == nil { + {mcall2ret0; nil; nil} + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/callnret0compact.go b/vendor/github.com/cosmos72/gomacro/fast/callnret0compact.go new file mode 100644 index 0000000..238c196 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/callnret0compact.go @@ -0,0 +1,76 @@ +// +build gomacro_fast_compact + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * callnret0compact.go + * + * Created on Jun 14, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +func (c *Comp) call0ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + return func(env *Env) { + fun := exprfun(env).Interface().(func()) + fun() + } +} + +func (c *Comp) call1ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + + argfun := call.MakeArgfunsX1()[0] + + return func(env *Env) { + funv := exprfun(env) + argv := []r.Value{argfun(env)} + + funv.Call(argv) + } +} + +func (c *Comp) call2ret0(call *Call, maxdepth int) func(env *Env) { + expr := call.Fun + exprfun := expr.AsX1() + + argfunsX1 := call.MakeArgfunsX1() + argfuns := [2]func(*Env) r.Value{ + argfunsX1[0], + argfunsX1[1], + } + + return func(env *Env) { + funv := exprfun(env) + + argv := []r.Value{ + argfuns[0](env), + argfuns[1](env), + } + funv.Call(argv) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/callnret1.go b/vendor/github.com/cosmos72/gomacro/fast/callnret1.go new file mode 100644 index 0000000..bffd2fb --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/callnret1.go @@ -0,0 +1,263 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * callnret1.go + * + * Created on Apr 20, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) callnret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + if expr.Sym != nil && expr.Sym.Desc.Index() == NoIndex { + Errorf("internal error: callnret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + + kret := expr.Type.Out(0).Kind() + argfuns := call.MakeArgfunsX1() + var ret I + switch kret { + case r.Bool: + ret = func(env *Env) bool { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.Bool() + } + case r.Int: + ret = func(env *Env) int { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return int(ret0.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return int8(ret0.Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return int16(ret0.Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return int32(ret0.Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.Int() + } + + case r.Uint: + ret = func(env *Env) uint { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return uint(ret0.Uint()) + } + + case r.Uint8: + ret = func(env *Env) uint8 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return uint8(ret0.Uint()) + } + + case r.Uint16: + ret = func(env *Env) uint16 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return uint16(ret0.Uint()) + } + + case r.Uint32: + ret = func(env *Env) uint32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return uint32(ret0.Uint()) + } + + case r.Uint64: + ret = func(env *Env) uint64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.Uint() + } + + case r.Uintptr: + ret = func(env *Env) uintptr { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return uintptr(ret0.Uint()) + } + + case r.Float32: + ret = func(env *Env) float32 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return float32(ret0.Float()) + } + + case r.Float64: + ret = func(env *Env) float64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.Float() + } + + case r.Complex64: + ret = func(env *Env) complex64 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return complex64(ret0.Complex()) + } + + case r.Complex128: + ret = func(env *Env) complex128 { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.Complex() + } + + case r.String: + ret = func(env *Env) string { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0.String() + } + + default: + ret = func(env *Env) r.Value { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + + ret0 := funv.Call(argv)[0] + return ret0 + + } + + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/callnret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/callnret1.gomacro new file mode 100644 index 0000000..12d094b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/callnret1.gomacro @@ -0,0 +1,133 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * callnret1.go + * + * Created on Apr 20, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + "go/token" + r "reflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func convertret0(typ ast.Node) (ast.Node, ast.Node) { + var t r.Type = EvalType(typ) + var ret0 ast.Node = ~'{ret0} // set type ast.Node: classic interpreter is too clever and deduces *ast.Ident + if t == nil { + // keep the result wrapped in a reflect.Value + typ = ~'{r.Value} + } else { + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,ret0 . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + ret0 = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + ret0 = ~"{~,typ ( ~,sel () )} + } + } + return typ, ret0 +} + +:macro mcallnret1(rettyp ast.Node) ast.Node { + var ret0 ast.Node + rettyp, ret0 = convertret0(rettyp) + + return ~"{ + ret = func(env *Env) ~,rettyp { + funv := exprfun(env) + argv := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + argv[i] = argfun(env) + } + // Debugf("calling %v with args %v", funv.Type(), argv) + ret0 := funv.Call(argv)[0] + return ~,ret0 + } + } +} + +func (c *Comp) callnret1(call *Call, maxdepth int) I { + expr := call.Fun + exprfun := expr.AsX1() + if expr.Sym != nil && expr.Sym.Desc.Index() == NoIndex { + Errorf("internal error: callnret1() invoked for constant function %#v. use call_builtin() instead", expr) + } + kret := expr.Type.Out(0).Kind() + argfuns := call.MakeArgfunsX1() + var ret I + switch kret { + case r.Bool: {mcallnret1; bool} + case r.Int: {mcallnret1; int} + case r.Int8: {mcallnret1; int8} + case r.Int16: {mcallnret1; int16} + case r.Int32: {mcallnret1; int32} + case r.Int64: {mcallnret1; int64} + case r.Uint: {mcallnret1; uint} + case r.Uint8: {mcallnret1; uint8} + case r.Uint16: {mcallnret1; uint16} + case r.Uint32: {mcallnret1; uint32} + case r.Uint64: {mcallnret1; uint64} + case r.Uintptr: {mcallnret1; uintptr} + case r.Float32: {mcallnret1; float32} + case r.Float64: {mcallnret1; float64} + case r.Complex64: {mcallnret1; complex64} + case r.Complex128:{mcallnret1; complex128} + case r.String: {mcallnret1; string} + default: {mcallnret1; nil} + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/channel.go b/vendor/github.com/cosmos72/gomacro/fast/channel.go new file mode 100644 index 0000000..a04afcc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/channel.go @@ -0,0 +1,1276 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * channel.go + * + * Created on May 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) Recv(node *ast.UnaryExpr, xe *Expr) *Expr { + t := xe.Type + if t.Kind() != r.Chan { + return c.badUnaryExpr("expecting channel, found", node, xe) + } + + if t.ChanDir()&r.RecvDir == 0 { + return c.badUnaryExpr("cannot receive from send-only channel", node, xe) + } + + var fun func(env *Env) (r.Value, []r.Value) + switch x := xe.Fun.(type) { + case func(env *Env) (r.Value, []r.Value): + channelfun := x + fun = func(env *Env) (r.Value, []r.Value) { + channel, _ := channelfun(env) + retv, ok := channel.Recv() + var okv r.Value + if ok { + okv = True + } else { + okv = False + } + return retv, []r.Value{retv, okv} + } + default: + channelfun := xe.AsX1() + fun = func(env *Env) (r.Value, []r.Value) { + retv, ok := channelfun(env).Recv() + var okv r.Value + if ok { + okv = True + } else { + okv = False + } + return retv, []r.Value{retv, okv} + } + } + types := []xr.Type{t.Elem(), c.TypeOfBool()} + return exprXV(types, fun) +} +func (c *Comp) Recv1(node *ast.UnaryExpr, xe *Expr) *Expr { + t := xe.Type + if t.Kind() != r.Chan { + return c.badUnaryExpr("expecting channel, found", node, xe) + } + + if t.ChanDir()&r.RecvDir == 0 { + return c.badUnaryExpr("cannot receive from send-only channel", node, xe) + } + + telem := t.Elem() + var fun I + switch x := xe.Fun.(type) { + case func(env *Env) (r.Value, []r.Value): + channelfun := x + switch telem.Kind() { + case r.Bool: + fun = func(env *Env) bool { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.Bool() + } + case r.Int: + fun = func(env *Env) int { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return int(retv.Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return int8(retv.Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return int16(retv.Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return int32(retv.Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.Int() + } + case r.Uint: + fun = func(env *Env) uint { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return uint(retv.Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return uint8(retv.Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return uint16(retv.Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return uint32(retv.Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return uintptr(retv.Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return float32(retv.Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return complex64(retv.Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.Complex() + } + case r.String: + fun = func(env *Env) string { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv.String() + } + default: + fun = func(env *Env) r.Value { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv + } + + } + default: + recvonly := t.ChanDir() == r.RecvDir + channelfun := xe.AsX1() + switch telem.Kind() { + case r.Bool: + if telem.ReflectType() != KindToType(r.Bool, + ) { + fun = func(env *Env) bool { + retv, _ := channelfun(env).Recv() + return retv.Bool() + } + } else if recvonly { + fun = func(env *Env) bool { + channel := channelfun(env).Interface().(<-chan bool) + return <-channel + } + } else { + fun = func(env *Env) bool { + channel := channelfun(env).Interface().(chan bool) + return <-channel + } + } + case r.Int: + if telem.ReflectType() != KindToType(r.Int, + ) { + fun = func(env *Env) int { + retv, _ := channelfun(env).Recv() + return int(retv.Int()) + } + } else if recvonly { + fun = func(env *Env) int { + channel := channelfun(env).Interface().(<-chan int) + return <-channel + } + } else { + fun = func(env *Env) int { + channel := channelfun(env).Interface().(chan int) + return <-channel + } + } + case r.Int8: + if telem.ReflectType() != KindToType(r.Int8, + ) { + fun = func(env *Env) int8 { + retv, _ := channelfun(env).Recv() + return int8(retv.Int()) + } + } else if recvonly { + fun = func(env *Env) int8 { + channel := channelfun(env).Interface().(<-chan int8) + return <-channel + } + } else { + fun = func(env *Env) int8 { + channel := channelfun(env).Interface().(chan int8) + return <-channel + } + } + case r.Int16: + if telem.ReflectType() != KindToType(r.Int16, + ) { + fun = func(env *Env) int16 { + retv, _ := channelfun(env).Recv() + return int16(retv.Int()) + } + } else if recvonly { + fun = func(env *Env) int16 { + channel := channelfun(env).Interface().(<-chan int16) + return <-channel + } + } else { + fun = func(env *Env) int16 { + channel := channelfun(env).Interface().(chan int16) + return <-channel + } + } + case r.Int32: + if telem.ReflectType() != KindToType(r.Int32, + ) { + fun = func(env *Env) int32 { + retv, _ := channelfun(env).Recv() + return int32(retv.Int()) + } + } else if recvonly { + fun = func(env *Env) int32 { + channel := channelfun(env).Interface().(<-chan int32) + return <-channel + } + } else { + fun = func(env *Env) int32 { + channel := channelfun(env).Interface().(chan int32) + return <-channel + } + } + case r.Int64: + if telem.ReflectType() != KindToType(r.Int64, + ) { + fun = func(env *Env) int64 { + retv, _ := channelfun(env).Recv() + return retv.Int() + } + } else if recvonly { + fun = func(env *Env) int64 { + channel := channelfun(env).Interface().(<-chan int64) + return <-channel + } + } else { + fun = func(env *Env) int64 { + channel := channelfun(env).Interface().(chan int64) + return <-channel + } + } + case r.Uint: + if telem.ReflectType() != KindToType(r.Uint, + ) { + fun = func(env *Env) uint { + retv, _ := channelfun(env).Recv() + return uint(retv.Uint()) + } + } else if recvonly { + fun = func(env *Env) uint { + channel := channelfun(env).Interface().(<-chan uint) + return <-channel + } + } else { + fun = func(env *Env) uint { + channel := channelfun(env).Interface().(chan uint) + return <-channel + } + } + case r.Uint8: + if telem.ReflectType() != KindToType(r.Uint8, + ) { + fun = func(env *Env) uint8 { + retv, _ := channelfun(env).Recv() + return uint8(retv.Uint()) + } + } else if recvonly { + fun = func(env *Env) uint8 { + channel := channelfun(env).Interface().(<-chan uint8) + return <-channel + } + } else { + fun = func(env *Env) uint8 { + channel := channelfun(env).Interface().(chan uint8) + return <-channel + } + } + case r.Uint16: + if telem.ReflectType() != KindToType(r.Uint16, + ) { + fun = func(env *Env) uint16 { + retv, _ := channelfun(env).Recv() + return uint16(retv.Uint()) + } + } else if recvonly { + fun = func(env *Env) uint16 { + channel := channelfun(env).Interface().(<-chan uint16) + return <-channel + } + } else { + fun = func(env *Env) uint16 { + channel := channelfun(env).Interface().(chan uint16) + return <-channel + } + } + case r.Uint32: + if telem.ReflectType() != KindToType(r.Uint32, + ) { + fun = func(env *Env) uint32 { + retv, _ := channelfun(env).Recv() + return uint32(retv.Uint()) + } + } else if recvonly { + fun = func(env *Env) uint32 { + channel := channelfun(env).Interface().(<-chan uint32) + return <-channel + } + } else { + fun = func(env *Env) uint32 { + channel := channelfun(env).Interface().(chan uint32) + return <-channel + } + } + case r.Uint64: + if telem.ReflectType() != KindToType(r.Uint64, + ) { + fun = func(env *Env) uint64 { + retv, _ := channelfun(env).Recv() + return retv.Uint() + } + } else if recvonly { + fun = func(env *Env) uint64 { + channel := channelfun(env).Interface().(<-chan uint64) + return <-channel + } + } else { + fun = func(env *Env) uint64 { + channel := channelfun(env).Interface().(chan uint64) + return <-channel + } + } + case r.Uintptr: + if telem.ReflectType() != KindToType(r.Uintptr, + ) { + fun = func(env *Env) uintptr { + retv, _ := channelfun(env).Recv() + return uintptr(retv.Uint()) + } + } else if recvonly { + fun = func(env *Env) uintptr { + channel := channelfun(env).Interface().(<-chan uintptr) + return <-channel + } + } else { + fun = func(env *Env) uintptr { + channel := channelfun(env).Interface().(chan uintptr) + return <-channel + } + } + case r.Float32: + if telem.ReflectType() != KindToType(r.Float32, + ) { + fun = func(env *Env) float32 { + retv, _ := channelfun(env).Recv() + return float32(retv.Float()) + } + } else if recvonly { + fun = func(env *Env) float32 { + channel := channelfun(env).Interface().(<-chan float32) + return <-channel + } + } else { + fun = func(env *Env) float32 { + channel := channelfun(env).Interface().(chan float32) + return <-channel + } + } + case r.Float64: + if telem.ReflectType() != KindToType(r.Float64, + ) { + fun = func(env *Env) float64 { + retv, _ := channelfun(env).Recv() + return retv.Float() + } + } else if recvonly { + fun = func(env *Env) float64 { + channel := channelfun(env).Interface().(<-chan float64) + return <-channel + } + } else { + fun = func(env *Env) float64 { + channel := channelfun(env).Interface().(chan float64) + return <-channel + } + } + case r.Complex64: + if telem.ReflectType() != KindToType(r.Complex64, + ) { + fun = func(env *Env) complex64 { + retv, _ := channelfun(env).Recv() + return complex64(retv.Complex()) + } + } else if recvonly { + fun = func(env *Env) complex64 { + channel := channelfun(env).Interface().(<-chan complex64) + return <-channel + } + } else { + fun = func(env *Env) complex64 { + channel := channelfun(env).Interface().(chan complex64) + return <-channel + } + } + case r.Complex128: + if telem.ReflectType() != KindToType(r.Complex128, + ) { + fun = func(env *Env) complex128 { + retv, _ := channelfun(env).Recv() + return retv.Complex() + } + } else if recvonly { + fun = func(env *Env) complex128 { + channel := channelfun(env).Interface().(<-chan complex128) + return <-channel + } + } else { + fun = func(env *Env) complex128 { + channel := channelfun(env).Interface().(chan complex128) + return <-channel + } + } + case r.String: + if telem.ReflectType() != KindToType(r.String, + ) { + fun = func(env *Env) string { + retv, _ := channelfun(env).Recv() + return retv.String() + } + } else if recvonly { + fun = func(env *Env) string { + channel := channelfun(env).Interface().(<-chan string) + return <-channel + } + } else { + fun = func(env *Env) string { + channel := channelfun(env).Interface().(chan string) + return <-channel + } + } + default: + fun = func(env *Env) r.Value { + retv, _ := channelfun(env).Recv() + return retv + } + + } + } + return exprFun(telem, fun) +} +func (c *Comp) Send(node *ast.SendStmt) { + channel := c.Expr1(node.Chan) + t := channel.Type + if t.Kind() != r.Chan { + c.Errorf("cannot send to non-channel type %v: %v", t, node) + return + } + if t.ChanDir()&r.SendDir == 0 { + c.Errorf("cannot send to receive-only channel type %v: %v", t, node) + return + } + telem := t.Elem() + rtelem := telem.ReflectType() + kelem := rtelem.Kind() + expr := c.Expr1(node.Value) + if expr.Const() { + expr.ConstTo(telem) + } else if expr.Type == nil || !expr.Type.AssignableTo(telem) { + c.Errorf("cannot use %v <%v> as type %v in send", node.Value, expr.Type, telem) + return + } else { + expr.To(c, telem) + } + + channelfun := channel.AsX1() + sendonly := t.ChanDir() == r.SendDir + var stmt Stmt + if expr.Const() { + v := r.ValueOf(expr.Value) + if KindToType(kelem) == rtelem { + switch kelem { + case + + r.Bool: + value := v.Bool() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- bool) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan bool) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int: + value := + + int(v.Int()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int8: + value := + + int8(v.Int()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int8) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int8) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int16: + value := + + int16(v.Int()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int16) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int16) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int32: + value := + + int32(v.Int()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int64: + value := v.Int() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint: + value := + + uint(v.Uint()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint8: + value := + + uint8(v.Uint()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint8) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint8) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint16: + value := + + uint16(v.Uint()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint16) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint16) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint32: + value := + + uint32(v.Uint()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint64: + value := v.Uint() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uintptr: + value := + + uintptr(v.Uint()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uintptr) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uintptr) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Float32: + value := + + float32(v.Float()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- float32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan float32) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Float64: + value := v.Float() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- float64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan float64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Complex64: + value := + + complex64(v.Complex()) + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- complex64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan complex64) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Complex128: + value := v.Complex() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- complex128) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan complex128) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.String: + value := v.String() + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- string) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan string) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + if stmt == nil { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env) + channel.Send(v) + env.IP++ + return env.Code[env.IP], env + } + } + + } else { + if KindToType(kelem) == rtelem { + switch kelem { + case + + r.Bool: + if exprfun, ok := expr.Fun.(func(*Env) bool); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- bool) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan bool) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int: + if exprfun, ok := expr.Fun.(func(*Env) int); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int8: + if exprfun, ok := expr.Fun.(func(*Env) int8); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int8) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int8) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int16: + if exprfun, ok := expr.Fun.(func(*Env) int16); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int16) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int16) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int32: + if exprfun, ok := expr.Fun.(func(*Env) int32); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Int64: + if exprfun, ok := expr.Fun.(func(*Env) int64); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- int64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan int64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint: + if exprfun, ok := expr.Fun.(func(*Env) uint); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint8: + if exprfun, ok := expr.Fun.(func(*Env) uint8); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint8) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint8) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint16: + if exprfun, ok := expr.Fun.(func(*Env) uint16); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint16) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint16) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint32: + if exprfun, ok := expr.Fun.(func(*Env) uint32); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uint64: + if exprfun, ok := expr.Fun.(func(*Env) uint64); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uint64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uint64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Uintptr: + if exprfun, ok := expr.Fun.(func(*Env) uintptr); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- uintptr) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan uintptr) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Float32: + if exprfun, ok := expr.Fun.(func(*Env) float32); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- float32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan float32) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Float64: + if exprfun, ok := expr.Fun.(func(*Env) float64); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- float64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan float64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Complex64: + if exprfun, ok := expr.Fun.(func(*Env) complex64); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- complex64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan complex64) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.Complex128: + if exprfun, ok := expr.Fun.(func(*Env) complex128); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- complex128) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan complex128) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + case + + r.String: + if exprfun, ok := expr.Fun.(func(*Env) string); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- string) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan string) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + if stmt == nil { + exprfun := expr.AsX1() + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env) + value := exprfun(env) + channel.Send(value) + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(stmt) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/channel.gomacro b/vendor/github.com/cosmos72/gomacro/fast/channel.gomacro new file mode 100644 index 0000000..4914fa6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/channel.gomacro @@ -0,0 +1,406 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * channel.go + * + * Created on May 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +:import ( + "go/ast" + r "reflect" +) + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + if t == nil { + return nil + } + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + +:func maketypevar(typ ast.Node) ast.Node { + t := EvalType(typ) + sel := &ast.SelectorExpr{ + X: &ast.Ident{Name: "c"}, + Sel: &ast.Ident{Name: "TypeOf" + upcasefirstbyte(t.Name())}, + } + return ~"{~,sel ()} +} + + +:func convertvalue(typ, val ast.Node) (ast.Node, ast.Node) { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + typ = ~'{r.Value} + } else { + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + } + return typ, val +} + +// Recv compiles <-channel (returns two values: the received value and an 'ok' flag) +func (c *Comp) Recv(node *ast.UnaryExpr, xe *Expr) *Expr { + t := xe.Type + if t.Kind() != r.Chan { + return c.badUnaryExpr("expecting channel, found", node, xe) + } + if t.ChanDir()&r.RecvDir == 0 { + return c.badUnaryExpr("cannot receive from send-only channel", node, xe) + } + var fun func(env *Env) (r.Value, []r.Value) + switch x := xe.Fun.(type) { + case func(env *Env) (r.Value, []r.Value): + channelfun := x + fun = func(env *Env) (r.Value, []r.Value) { + channel, _ := channelfun(env) + retv, ok := channel.Recv() + var okv r.Value + if ok { + okv = True + } else { + okv = False + } + return retv, []r.Value{retv, okv} + } + default: + channelfun := xe.AsX1() + fun = func(env *Env) (r.Value, []r.Value) { + retv, ok := channelfun(env).Recv() + var okv r.Value + if ok { + okv = True + } else { + okv = False + } + return retv, []r.Value{retv, okv} + } + } + types := []xr.Type{t.Elem(), c.TypeOfBool()} + return exprXV(types, fun) +} + +:macro recv1_xv(typ ast.Node) ast.Node { + if EvalType(typ) == nil { + return ~"{ + default: + fun = func(env *Env) r.Value { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return retv + } + } + } + kind := makekind(typ) + typ2, ret := convertvalue(typ, ~'retv) + return ~"{ + case ~,kind: + fun = func(env *Env) ~,typ2 { + channel, _ := channelfun(env) + retv, _ := channel.Recv() + return ~,ret + } + } +} + +:macro recv1(typ ast.Node) ast.Node { + if EvalType(typ) == nil { + return ~"{ + default: + fun = func(env *Env) r.Value { + retv, _ := channelfun(env).Recv() + return retv + } + } + } + kind := makekind(typ) + typ2, ret := convertvalue(typ, ~'retv) + return ~"{ + case ~,kind: + if telem.ReflectType() != KindToType(~,kind) { + fun = func(env *Env) ~,typ { + retv, _ := channelfun(env).Recv() + return ~,ret + } + } else if recvonly { + fun = func(env *Env) ~,typ { + channel := channelfun(env).Interface().(<-chan ~,typ) + return <-channel + } + } else { + fun = func(env *Env) ~,typ { + channel := channelfun(env).Interface().(chan ~,typ) + return <-channel + } + } + } +} + +// Recv1 compiles <-channel (returns a single value: the received value) +// mandatory optimization: fast_interpreter ASSUMES that expressions +// returning bool, int, uint, float, complex, string do NOT wrap them in reflect.Value +func (c *Comp) Recv1(node *ast.UnaryExpr, xe *Expr) *Expr { + t := xe.Type + if t.Kind() != r.Chan { + return c.badUnaryExpr("expecting channel, found", node, xe) + } + if t.ChanDir()&r.RecvDir == 0 { + return c.badUnaryExpr("cannot receive from send-only channel", node, xe) + } + telem := t.Elem() + var fun I + switch x := xe.Fun.(type) { + case func(env *Env) (r.Value, []r.Value): + channelfun := x + switch telem.Kind() { + {recv1_xv; bool} + {recv1_xv; int} + {recv1_xv; int8} + {recv1_xv; int16} + {recv1_xv; int32} + {recv1_xv; int64} + {recv1_xv; uint} + {recv1_xv; uint8} + {recv1_xv; uint16} + {recv1_xv; uint32} + {recv1_xv; uint64} + {recv1_xv; uintptr} + {recv1_xv; float32} + {recv1_xv; float64} + {recv1_xv; complex64} + {recv1_xv; complex128} + {recv1_xv; string} + {recv1_xv; nil} + } + default: + recvonly := t.ChanDir() == r.RecvDir + channelfun := xe.AsX1() + switch telem.Kind() { + {recv1; bool} + {recv1; int} + {recv1; int8} + {recv1; int16} + {recv1; int32} + {recv1; int64} + {recv1; uint} + {recv1; uint8} + {recv1; uint16} + {recv1; uint32} + {recv1; uint64} + {recv1; uintptr} + {recv1; float32} + {recv1; float64} + {recv1; complex64} + {recv1; complex128} + {recv1; string} + {recv1; nil} + } + } + return exprFun(telem, fun) +} + +:macro send_c(typ ast.Node) ast.Node { + kind := makekind(typ) + typ2, conv := convertvalue(typ, ~'v) + return ~"{ + case ~,kind: + value := ~,conv + if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- ~,typ) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan ~,typ) + channel <- value + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:macro send_e(typ ast.Node) ast.Node { + kind := makekind(typ) + return ~"{ + case ~,kind: + if exprfun, ok := expr.Fun.(func (*Env) ~,typ); !ok { + break + } else if sendonly { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan<- ~,typ) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env).Interface().(chan ~,typ) + channel <- exprfun(env) + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +func (c *Comp) Send(node *ast.SendStmt) { + channel := c.Expr1(node.Chan) + t := channel.Type + if t.Kind() != r.Chan { + c.Errorf("cannot send to non-channel type %v: %v", t, node) + return + } + if t.ChanDir()&r.SendDir == 0 { + c.Errorf("cannot send to receive-only channel type %v: %v", t, node) + return + } + telem := t.Elem() + rtelem := telem.ReflectType() + kelem := rtelem.Kind() + expr := c.Expr1(node.Value) + if expr.Const() { + expr.ConstTo(telem) + } else if expr.Type == nil || !expr.Type.AssignableTo(telem) { + c.Errorf("cannot use %v <%v> as type %v in send", node.Value, expr.Type, telem) + return + } else { + expr.To(c, telem) + } + channelfun := channel.AsX1() + sendonly := t.ChanDir() == r.SendDir + var stmt Stmt + if expr.Const() { + v := r.ValueOf(expr.Value) + if KindToType(kelem) == rtelem { + switch kelem { + {send_c; bool} + {send_c; int} + {send_c; int8} + {send_c; int16} + {send_c; int32} + {send_c; int64} + {send_c; uint} + {send_c; uint8} + {send_c; uint16} + {send_c; uint32} + {send_c; uint64} + {send_c; uintptr} + {send_c; float32} + {send_c; float64} + {send_c; complex64} + {send_c; complex128} + {send_c; string} + } + } + if stmt == nil { + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env) + channel.Send(v) + env.IP++ + return env.Code[env.IP], env + } + } + } else { + if KindToType(kelem) == rtelem { + switch kelem { + {send_e; bool} + {send_e; int} + {send_e; int8} + {send_e; int16} + {send_e; int32} + {send_e; int64} + {send_e; uint} + {send_e; uint8} + {send_e; uint16} + {send_e; uint32} + {send_e; uint64} + {send_e; uintptr} + {send_e; float32} + {send_e; float64} + {send_e; complex64} + {send_e; complex128} + {send_e; string} + } + } + if stmt == nil { + exprfun := expr.AsX1() + stmt = func(env *Env) (Stmt, *Env) { + channel := channelfun(env) + value := exprfun(env) + channel.Send(value) + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(stmt) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/code.go b/vendor/github.com/cosmos72/gomacro/fast/code.go new file mode 100644 index 0000000..cb58e79 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/code.go @@ -0,0 +1,313 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * code.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + "unsafe" +) + +func (code *Code) Clear() { + code.List = nil + code.DebugPos = nil + code.WithDefers = false +} + +func (code *Code) Len() int { + return len(code.List) +} + +func (code *Code) Append(stmt Stmt, pos token.Pos) { + if stmt != nil { + code.List = append(code.List, stmt) + code.DebugPos = append(code.DebugPos, pos) + } +} + +func (code *Code) AsExpr() *Expr { + fun := code.Exec() + if fun == nil { + return nil + } + return expr0(fun) +} + +// declare a var instead of function: Code.Exec() needs the address of Interrupt +var Interrupt Stmt = func(env *Env) (Stmt, *Env) { + return env.ThreadGlobals.Interrupt, env +} + +func pushDefer(g *ThreadGlobals, deferOf *Env, panicking bool) (retg *ThreadGlobals, deferOf_ *Env, isDefer bool) { + deferOf_ = g.DeferOfFun + if panicking { + g.PanicFun = deferOf + } + g.DeferOfFun = deferOf + g.StartDefer = true + return g, deferOf_, g.IsDefer +} + +func popDefer(g *ThreadGlobals, deferOf *Env, isDefer bool) { + g.DeferOfFun = deferOf + g.StartDefer = false + g.IsDefer = isDefer +} + +func restore(g *ThreadGlobals, flag bool, interrupt Stmt) { + g.IsDefer = flag + g.Signal = SigNone + g.Interrupt = interrupt +} + +func maybeRepanic(g *ThreadGlobals) bool { + if g.PanicFun != nil { + panic(g.Panic) + } + // either not panicking or recover() invoked, no longer panicking + return false +} + +// Exec returns a func(*Env) that will execute the compiled code +func (code *Code) Exec() func(*Env) { + all := code.List + pos := code.DebugPos + defers := code.WithDefers + + code.Clear() + if len(all) == 0 { + return nil + } + all = append(all, Interrupt) + + if defers { + // code to support defer is slower... isolate it in a separate function + return func(env *Env) { + execWithDefers(env, all, pos) + } + } else { + return exec(all, pos) + } +} + +func exec(all []Stmt, pos []token.Pos) func(*Env) { + return func(env *Env) { + g := env.ThreadGlobals + if g.IsDefer || g.StartDefer { + // code to support defer is slower... isolate it in a separate function + execWithDefers(env, all, pos) + return + } + stmt := all[0] + env.IP = 0 + env.Code = all + env.DebugPos = pos + + interrupt := g.Interrupt + g.Interrupt = nil + var unsafeInterrupt *uintptr + g.Signal = SigNone + + for j := 0; j < 5; j++ { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + continue + } + } + } + } + } + } + } + } + } + } + } + } + } + } + goto finish + } + + unsafeInterrupt = *(**uintptr)(unsafe.Pointer(&Interrupt)) + env.ThreadGlobals.Interrupt = Interrupt + for { + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + + if *(**uintptr)(unsafe.Pointer(&stmt)) == unsafeInterrupt { + break + } + } + finish: + // restore env.ThreadGlobals.Interrupt and Signal before returning + g.Interrupt = interrupt + g.Signal = SigNone + return + } +} + +// execWithDefers executes the given compiled code, including support for defer() +func execWithDefers(env *Env, all []Stmt, pos []token.Pos) { + funenv := env + stmt := all[0] + env.IP = 0 + env.Code = all + env.DebugPos = pos + + g := env.ThreadGlobals + interrupt := g.Interrupt + g.Interrupt = nil + var unsafeInterrupt *uintptr + + defer restore(g, g.IsDefer, interrupt) // restore g.IsDefer, g.Signal and g.Interrupt on return + g.Signal = SigNone + g.IsDefer = g.StartDefer + g.StartDefer = false + panicking := true + panicking2 := false + + rundefer := func(fun func()) { + if panicking || panicking2 { + panicking = true + panicking2 = false + g.Panic = recover() + } + defer popDefer(pushDefer(g, funenv, panicking)) + panicking2 = true // detect panics inside defer + fun() + panicking2 = false + if panicking { + panicking = maybeRepanic(g) + } + } + + for j := 0; j < 5; j++ { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + if stmt, env = stmt(env); stmt != nil { + continue + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if g.Signal != SigDefer { + goto finish + } + fun := g.InstallDefer + g.Signal = SigNone + g.InstallDefer = nil + defer rundefer(fun) + stmt = env.Code[env.IP] + if stmt != nil { + continue + } + break + } + + unsafeInterrupt = *(**uintptr)(unsafe.Pointer(&Interrupt)) + env.ThreadGlobals.Interrupt = Interrupt + for { + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + stmt, env = stmt(env) + + if *(**uintptr)(unsafe.Pointer(&stmt)) == unsafeInterrupt { + if g.Signal != SigDefer { + goto finish + } + fun := g.InstallDefer + g.Signal = SigNone + g.InstallDefer = nil + defer rundefer(fun) + stmt = env.Code[env.IP] + if *(**uintptr)(unsafe.Pointer(&stmt)) != unsafeInterrupt { + continue + } + break + } + } +finish: + panicking = false + return +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/compile.go b/vendor/github.com/cosmos72/gomacro/fast/compile.go new file mode 100644 index 0000000..9e601e9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/compile.go @@ -0,0 +1,370 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * compile.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + "go/types" + r "reflect" + "strings" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func NewThreadGlobals() *ThreadGlobals { + return &ThreadGlobals{ + Globals: NewGlobals(), + } +} + +func New() *Interp { + top := NewCompEnvTop("builtin") + top.env.UsedByClosure = true // do not free this *Env + file := NewCompEnv(top, "main") + file.env.UsedByClosure = true // do not free this *Env + return file +} + +func NewCompEnvTop(path string) *Interp { + name := path[1+strings.LastIndexByte(path, '/'):] + + globals := NewGlobals() + universe := xr.NewUniverse() + + compGlobals := &CompThreadGlobals{ + Universe: universe, + interf2proxy: make(map[r.Type]r.Type), + proxy2interf: make(map[r.Type]xr.Type), + Globals: globals, + } + envGlobals := &ThreadGlobals{Globals: globals} + ce := &Interp{ + Comp: &Comp{ + UpCost: 1, + Depth: 0, + Outer: nil, + Name: name, + Path: path, + CompThreadGlobals: compGlobals, + }, + env: &Env{ + Outer: nil, + ThreadGlobals: envGlobals, + }, + } + // tell xreflect about our packages "fast" and "main" + compGlobals.Universe.CachePackage(types.NewPackage("fast", "fast")) + compGlobals.Universe.CachePackage(types.NewPackage("main", "main")) + + // no need to scavenge for Builtin, Function, Import, Macro and UntypedLit fields and methods. + // actually, making them opaque helps securing against malicious interpreted code. + for _, rtype := range []r.Type{rtypeOfBuiltin, rtypeOfFunction, rtypeOfImport, rtypeOfMacro, rtypeOfUntypedLit} { + compGlobals.opaqueType(rtype) + } + + envGlobals.TopEnv = ce.env + ce.addBuiltins() + return ce +} + +func NewCompEnv(outer *Interp, path string) *Interp { + name := path[1+strings.LastIndexByte(path, '/'):] + + compGlobals := outer.Comp.CompThreadGlobals + envGlobals := outer.env.ThreadGlobals + c := &Interp{ + Comp: &Comp{ + UpCost: 1, + Depth: outer.Comp.Depth + 1, + Outer: outer.Comp, + Name: name, + Path: path, + CompThreadGlobals: compGlobals, + }, + env: &Env{ + Outer: outer.env, + ThreadGlobals: envGlobals, + }, + } + if outer.env.Outer == nil { + envGlobals.FileEnv = c.env + } + return c +} + +func NewComp(outer *Comp, code *Code) *Comp { + if outer == nil { + return &Comp{UpCost: 1} + } + c := Comp{ + UpCost: 1, + Depth: outer.Depth + 1, + Outer: outer, + CompileOptions: outer.CompileOptions, + CompThreadGlobals: outer.CompThreadGlobals, + } + // Debugf("NewComp(%p->%p) %s", outer, &c, debug.Stack()) + if code != nil { + c.Code = *code + } + return &c +} + +func (c *Comp) TopComp() *Comp { + for ; c != nil; c = c.Outer { + if c.Outer == nil { + break + } + } + return c +} + +func (c *Comp) FileComp() *Comp { + for ; c != nil; c = c.Outer { + outer := c.Outer + if outer == nil || outer.Outer == nil { + break + } + } + return c +} + +// if a function Env only declares ignored binds, it gets this scratch buffers +var ignoredBinds = []r.Value{Nil} +var ignoredIntBinds = []uint64{0} + +func NewEnv(outer *Env, nbinds int, nintbinds int) *Env { + tg := outer.ThreadGlobals + pool := &tg.Pool // pool is an array, do NOT copy it! + index := tg.PoolSize - 1 + var env *Env + if index >= 0 { + tg.PoolSize = index + env = pool[index] + pool[index] = nil + } else { + env = &Env{} + } + if nbinds <= 1 { + env.Binds = ignoredBinds + } else if cap(env.Binds) < nbinds { + env.Binds = make([]r.Value, nbinds) + } else { + env.Binds = env.Binds[0:nbinds] + } + if nintbinds <= 1 { + env.IntBinds = ignoredIntBinds + } else if cap(env.IntBinds) < nintbinds { + env.IntBinds = make([]uint64, nintbinds) + } else { + env.IntBinds = env.IntBinds[0:nintbinds] + } + env.Outer = outer + env.IP = outer.IP + env.Code = outer.Code + env.ThreadGlobals = tg + return env +} + +func NewEnv4Func(outer *Env, nbinds int, nintbinds int) *Env { + tg := outer.ThreadGlobals + pool := &tg.Pool // pool is an array, do NOT copy it! + index := tg.PoolSize - 1 + var env *Env + if index >= 0 { + tg.PoolSize = index + env = pool[index] + pool[index] = nil + } else { + env = &Env{} + } + if nbinds <= 1 { + env.Binds = ignoredBinds + } else if cap(env.Binds) < nbinds { + env.Binds = make([]r.Value, nbinds) + } else { + env.Binds = env.Binds[0:nbinds] + } + if nintbinds <= 1 { + env.IntBinds = ignoredIntBinds + } else if cap(env.IntBinds) < nintbinds { + env.IntBinds = make([]uint64, nintbinds) + } else { + env.IntBinds = env.IntBinds[0:nintbinds] + } + env.Outer = outer + env.ThreadGlobals = tg + // Debugf("NewEnv4Func(%p->%p) binds=%d intbinds=%d", outer, env, nbinds, nintbinds) + return env +} + +func (env *Env) MarkUsedByClosure() { + for ; env != nil && !env.UsedByClosure; env = env.Outer { + env.UsedByClosure = true + } +} + +// FreeEnv tells the interpreter that given Env is no longer needed. +func (env *Env) FreeEnv() { + // Debugf("FreeEnv(%p->%p), IP = %d of %d", env, env.Outer, env.Outer.IP, len(env.Outer.Code)) + if env.UsedByClosure { + // in use, cannot recycle + return + } + common := env.ThreadGlobals + n := common.PoolSize + if n >= PoolCapacity { + return + } + if env.AddressTaken { + env.IntBinds = nil + env.AddressTaken = false + } + env.Outer = nil + env.Code = nil + env.ThreadGlobals = nil + common.Pool[n] = env // pool is an array, be careful NOT to copy it! + common.PoolSize = n + 1 +} + +func (c *Comp) IsCompiled() bool { + return c.CompileOptions.IsCompiled() +} + +func (c *Comp) ErrorIfCompiled(x interface{}) { + if c.IsCompiled() { + c.Errorf("internal error: compiler for %v has flag OptIsCompiled set. this should not happen!", x) + } +} + +func (env *Env) Top() *Env { + for ; env != nil; env = env.Outer { + if env.Outer == nil { + break + } + } + return env +} + +func (env *Env) File() *Env { + for ; env != nil; env = env.Outer { + outer := env.Outer + if outer == nil || outer.Outer == nil { + break + } + } + return env +} + +// combined Parse + MacroExpandCodeWalk +func (c *Comp) Parse(src string) Ast { + c.Line = 0 + nodes := c.ParseBytes([]byte(src)) + forms := AnyToAst(nodes, "Parse") + + forms, _ = c.MacroExpandCodewalk(forms) + if c.Options&OptShowMacroExpand != 0 { + c.Debugf("after macroexpansion: %v", forms.Interface()) + } + return forms +} + +func (c *Comp) Compile(in Ast) *Expr { + switch form := in.(type) { + case nil: + return nil + case AstWithNode: + return c.CompileNode(form.Node()) + case AstWithSlice: + n := form.Size() + var list []*Expr + for i := 0; i < n; i++ { + e := c.Compile(form.Get(i)) + if e != nil { + list = append(list, e) + } + } + return exprList(list, c.CompileOptions) + } + c.Errorf("Compile: unsupported value, expecting or , found %v <%v>", in, r.TypeOf(in)) + return nil +} + +// compileExpr is a wrapper for Compile +// that guarantees Code does not get clobbered/cleared. +// Used by Comp.Quasiquote +func (c *Comp) compileExpr(in Ast) *Expr { + cf := NewComp(c, nil) + cf.UpCost = 0 + cf.Depth-- + return cf.Compile(in) +} + +func (c *Comp) CompileNode(node ast.Node) *Expr { + if n := c.Code.Len(); n != 0 { + c.Warnf("Compile: discarding %d previously compiled statements from code buffer", n) + } + c.Code.Clear() + if node == nil { + return nil + } + c.Pos = node.Pos() + switch node := node.(type) { + case ast.Decl: + c.Decl(node) + case ast.Expr: + return c.Expr(node) + case *ast.ExprStmt: + // special case of statement + return c.Expr(node.X) + case ast.Stmt: + c.Stmt(node) + case *ast.File: + c.File(node) + default: + c.Errorf("Compile: unsupported expression, expecting , , or <*ast.File>, found %v <%v>", node, r.TypeOf(node)) + return nil + } + return c.Code.AsExpr() +} + +func (c *Comp) File(node *ast.File) { + c.Name = node.Name.Name + for _, decl := range node.Decls { + c.Decl(decl) + } +} + +func (c *Comp) Append(stmt Stmt, pos token.Pos) { + c.Code.Append(stmt, pos) +} + +func (c *Comp) append(stmt Stmt) { + c.Code.Append(stmt, c.Pos) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/compositelit.go b/vendor/github.com/cosmos72/gomacro/fast/compositelit.go new file mode 100644 index 0000000..7f7cb0b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/compositelit.go @@ -0,0 +1,338 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * compositelit.go + * + * Created on May 28, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) CompositeLit(node *ast.CompositeLit) *Expr { + t, ellipsis := c.compileType2(node.Type, false) + switch t.Kind() { + case r.Array: + return c.compositeLitArray(t, ellipsis, node) + case r.Map: + return c.compositeLitMap(t, node) + case r.Slice: + return c.compositeLitSlice(t, node) + case r.Struct: + return c.compositeLitStruct(t, node) + default: + c.Errorf("invalid type for composite literal: <%v> %v", t, node.Type) + return nil + } +} + +func (c *Comp) compositeLitArray(t xr.Type, ellipsis bool, node *ast.CompositeLit) *Expr { + rtype := t.ReflectType() + n := len(node.Elts) + if n == 0 { + return exprX1(t, func(env *Env) r.Value { + // array len is already encoded in its type + return r.New(rtype).Elem() + }) + } + size, keys, funvals := c.compositeLitElements(t, ellipsis, node) + if ellipsis { + // rebuild type with correct length + t = xr.ArrayOf(size, t.Elem()) + rtype = t.ReflectType() + } + + rtval := rtype.Elem() + zeroval := r.Zero(rtval) + + return exprX1(t, func(env *Env) r.Value { + obj := r.New(rtype).Elem() + var val r.Value + for i, funval := range funvals { + val = funval(env) + if val == Nil || val == None { + val = zeroval + } else if val.Type() != rtval { + val = val.Convert(rtval) + } + obj.Index(keys[i]).Set(val) + } + return obj + }) +} + +func (c *Comp) compositeLitSlice(t xr.Type, node *ast.CompositeLit) *Expr { + rtype := t.ReflectType() + n := len(node.Elts) + if n == 0 { + return exprX1(t, func(env *Env) r.Value { + return r.MakeSlice(rtype, 0, 0) + }) + } + size, keys, funvals := c.compositeLitElements(t, false, node) + + rtval := rtype.Elem() + zeroval := r.Zero(rtval) + return exprX1(t, func(env *Env) r.Value { + obj := r.MakeSlice(rtype, size, size) + var val r.Value + for i, funval := range funvals { + val = funval(env) + if val == Nil || val == None { + val = zeroval + } else if val.Type() != rtval { + val = val.Convert(rtval) + } + obj.Index(keys[i]).Set(val) + } + return obj + }) +} + +func (c *Comp) compositeLitElements(t xr.Type, ellipsis bool, node *ast.CompositeLit) (size int, keys []int, funvals []func(*Env) r.Value) { + n := len(node.Elts) + tval := t.Elem() + seen := make(map[int]bool) // indexes already seen + keys = make([]int, n) + funvals = make([]func(*Env) r.Value, n) + size = 0 + key, lastkey := 0, -1 + + for i, el := range node.Elts { + elv := el + switch elkv := el.(type) { + case *ast.KeyValueExpr: + ekey := c.Expr1(elkv.Key) + if !ekey.Const() { + c.Errorf("literal %s index must be non-negative integer constant: %v", t.Kind(), elkv.Key) + } else if ekey.Untyped() { + key = ekey.ConstTo(c.TypeOfInt()).(int) + } else { + key = convertLiteralCheckOverflow(ekey.Value, c.TypeOfInt()).(int) + } + lastkey = key + elv = elkv.Value + default: + lastkey++ + } + if lastkey < 0 { + c.Errorf("literal %s index must be non-negative integer constant: %v", t.Kind(), lastkey) + } else if !ellipsis && t.Kind() == r.Array && lastkey >= t.Len() { + c.Errorf("%s index %d out of bounds [0:%d]", t.Kind(), lastkey, t.Len()) + } else if seen[lastkey] { + c.Errorf("duplicate index in %s literal: %d", t.Kind(), lastkey) + } + seen[lastkey] = true + if size <= lastkey { + if lastkey == MaxInt { + c.Errorf("literal %s too large: found index == MaxInt", t.Kind()) + } + size = lastkey + 1 + } + keys[i] = lastkey + + eval := c.Expr1(elv) + if eval.Const() { + eval.ConstTo(tval) + } else if !eval.Type.AssignableTo(tval) { + c.Errorf("cannot use %v <%v> as type <%v> in %s value", elv, eval.Type, tval, t.Kind()) + } else { + eval.To(c, tval) + } + funvals[i] = eval.AsX1() + } + return size, keys, funvals +} + +func (c *Comp) compositeLitMap(t xr.Type, node *ast.CompositeLit) *Expr { + rtype := t.ReflectType() + n := len(node.Elts) + if n == 0 { + return exprX1(t, func(env *Env) r.Value { + return r.MakeMap(rtype) + }) + } + tkey := t.Key() + tval := t.Elem() + + seen := make(map[interface{}]bool) // constant keys already seen + funkeys := make([]func(*Env) r.Value, n) + funvals := make([]func(*Env) r.Value, n) + + for i, el := range node.Elts { + switch elkv := el.(type) { + case *ast.KeyValueExpr: + ekey := c.Expr1(elkv.Key) + if ekey.Const() { + ekey.ConstTo(tkey) + if seen[ekey.Value] { + c.Errorf("duplicate key %v in map literal", elkv.Key) + } + seen[ekey.Value] = true + } else if !ekey.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as type <%v> in map key", elkv.Key, ekey.Type, tkey) + } else { + ekey.To(c, tkey) + } + eval := c.Expr1(elkv.Value) + if eval.Const() { + eval.ConstTo(tval) + } else if !eval.Type.AssignableTo(tval) { + c.Errorf("cannot use %v <%v> as type <%v> in map value", elkv.Value, eval.Type, tval) + } else { + eval.To(c, tval) + } + funkeys[i] = ekey.AsX1() + funvals[i] = eval.AsX1() + + default: + c.Errorf("missing key in map literal: %v", el) + } + } + return exprX1(t, func(env *Env) r.Value { + obj := r.MakeMap(rtype) + var key, val r.Value + for i, funkey := range funkeys { + key = funkey(env) + val = funvals[i](env) + obj.SetMapIndex(key, val) + } + return obj + }) +} + +func (c *Comp) compositeLitStruct(t xr.Type, node *ast.CompositeLit) *Expr { + rtype := t.ReflectType() + n := len(node.Elts) + if n == 0 { + return exprX1(t, func(env *Env) r.Value { + return r.New(rtype).Elem() + }) + } + + var seen map[string]bool + var all map[string]xr.StructField + inits := make([]func(*Env) r.Value, n) + indexes := make([]int, n) + var flagkv, flagv bool + + for i, el := range node.Elts { + switch elkv := el.(type) { + case *ast.KeyValueExpr: + flagkv = true + if flagv { + c.Errorf("mixture of field:value and value in struct literal: %v", node) + } + switch k := elkv.Key.(type) { + case *ast.Ident: + name := k.Name + if seen[name] { + c.Errorf("duplicate field name in struct literal: %v", name) + } else if seen == nil { + seen = make(map[string]bool) + all = listStructFields(t, c.FileComp().Path) + } + field, ok := all[name] + if !ok { + c.Errorf("unknown field '%v' in struct literal of type %v", name, t) + } + expr := c.Expr1(elkv.Value) + if expr.Const() { + expr.ConstTo(field.Type) + } else if !expr.Type.AssignableTo(field.Type) { + c.Errorf("cannot use %v <%v> as type <%v> in field value", elkv.Value, expr.Type, field.Type) + } else { + expr.To(c, field.Type) + } + inits[i] = expr.AsX1() + indexes[i] = field.Index[0] + default: + c.Errorf("invalid field name '%v' in struct literal", k) + } + default: + flagv = true + if flagkv { + c.Errorf("mixture of field:value and value in struct literal: %v", node) + } + field := t.Field(i) + expr := c.Expr1(el) + if expr.Const() { + expr.ConstTo(field.Type) + } else if !expr.Type.AssignableTo(field.Type) { + c.Errorf("cannot use %v <%v> as type <%v> in field value", el, expr.Type, field.Type) + } else { + expr.To(c, field.Type) + } + if !ast.IsExported(field.Name) && field.Pkg.Path() != c.FileComp().Path { + c.Errorf("implicit assignment of unexported field '%v' in struct literal <%v>", field.Name, t) + } + inits[i] = expr.AsX1() + indexes[i] = field.Index[0] + } + } + if nfield := t.NumField(); flagv && n != nfield { + var label, plural = "few", "s" + if n > nfield { + label = "many" + } else if n == 1 { + plural = "" + } + c.Errorf("too %s values in struct initializer: <%v> has %d fields, found %d initializer%s", + label, t, nfield, n, plural) + } + return exprX1(t, func(env *Env) r.Value { + obj := r.New(rtype).Elem() + var val, field r.Value + var tfield r.Type + for i, init := range inits { + val = init(env) + if val == Nil || val == None { + continue + } + field = obj.Field(indexes[i]) + tfield = field.Type() + if val.Type() != tfield { + val = val.Convert(tfield) + } + field.Set(val) + } + return obj + }) +} + +// listStructFields lists the field names of a struct. It ignores embedded fields. +// Unexported fields are listed only if their package's path matches given pkgpath +func listStructFields(t xr.Type, pkgpath string) map[string]xr.StructField { + list := make(map[string]xr.StructField) + for i, n := 0, t.NumField(); i < n; i++ { + f := t.Field(i) + if ast.IsExported(f.Name) || f.Pkg.Path() == pkgpath { + list[f.Name] = f + } + } + return list +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/convert.go b/vendor/github.com/cosmos72/gomacro/fast/convert.go new file mode 100644 index 0000000..37fd61f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/convert.go @@ -0,0 +1,181 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * convert.go + * + * Created on Apr 30, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// Convert compiles a type conversion expression +func (c *Comp) Convert(node ast.Expr, t xr.Type) *Expr { + e := c.Expr1(node) + if e.Untyped() { + e.ConstTo(e.DefaultType()) + } + + if xr.SameType(e.Type, t) { + return e + } else if e.Type == nil && IsNillableKind(t.Kind()) { + e.Type = t + e.Value = xr.Zero(t).Interface() + } else if e.Type != nil && e.Type.ConvertibleTo(t) { + } else { + c.Errorf("cannot convert %v to %v: %v", e.Type, t, node) + return nil + } + rtype := t.ReflectType() + if e.Const() { + val := r.ValueOf(e.Value).Convert(rtype).Interface() + return c.exprValue(t, val) + } + fun := e.AsX1() + var ret I + switch t.Kind() { + case r.Bool: + ret = func(env *Env) bool { + val := fun(env).Convert(rtype) + return val.Bool() + } + case r.Int: + ret = func(env *Env) int { + val := fun(env).Convert(rtype) + return int(val.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + val := fun(env).Convert(rtype) + return int8(val.Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + val := fun(env).Convert(rtype) + return int16(val.Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + val := fun(env).Convert(rtype) + return int32(val.Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + val := fun(env).Convert(rtype) + return val.Int() + } + case r.Uint: + ret = func(env *Env) uint { + val := fun(env).Convert(rtype) + return uint(val.Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + val := fun(env).Convert(rtype) + return uint8(val.Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + val := fun(env).Convert(rtype) + return uint16(val.Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + val := fun(env).Convert(rtype) + return uint32(val.Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + val := fun(env).Convert(rtype) + return val.Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + val := fun(env).Convert(rtype) + return uintptr(val.Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + val := fun(env).Convert(rtype) + return float32(val.Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + val := fun(env).Convert(rtype) + return val.Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + val := fun(env).Convert(rtype) + return complex64(val.Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + val := fun(env).Convert(rtype) + return val.Complex() + } + case r.String: + ret = func(env *Env) string { + val := fun(env).Convert(rtype) + return val.String() + } + default: + if conv := c.Converter(e.Type, t); conv != nil { + ret = func(env *Env) r.Value { + return conv(fun(env), rtype) + } + } else { + ret = func(env *Env) r.Value { + return fun(env) + } + } + } + return exprFun(t, ret) +} + +// Converter returns a function that converts reflect.Value from tin to tout +// also supports conversion from interpreted types to interfaces +func (c *Comp) Converter(tin, tout xr.Type) func(val r.Value, rtout r.Type) r.Value { + if !tin.ConvertibleTo(tout) { + c.Errorf("cannot convert from <%v> to <%v>", tin, tout) + } + rtin := tin.ReflectType() + rtout := tout.ReflectType() + switch { + case rtin == rtout: + return nil + case rtin.ConvertibleTo(rtout): + // most conversions, including from compiled type to compiled interface + return r.Value.Convert + case tin.Kind() != r.Interface && rtout.Kind() == r.Interface: + // conversion from interpreted type to compiled interface + return c.converterToInterface(tin, tout) + default: + c.Errorf("unimplemented conversion from <%v> to <%v>", tin, tout) + return nil + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/declaration.go b/vendor/github.com/cosmos72/gomacro/fast/declaration.go new file mode 100644 index 0000000..c042243 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/declaration.go @@ -0,0 +1,586 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * declaration.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// Decl compiles a constant, variable, function or type declaration - or an import +func (c *Comp) Decl(node ast.Decl) { + if node != nil { + c.Pos = node.Pos() + } + switch node := node.(type) { + case *ast.GenDecl: + c.GenDecl(node) + case *ast.FuncDecl: + c.FuncDecl(node) + default: + c.Errorf("Compile: unsupported declaration, expecting <*ast.GenDecl> or <*ast.FuncDecl>, found: %v <%v>", node, r.TypeOf(node)) + } +} + +// GenDecl compiles a constant, variable or type declaration - or an import +func (c *Comp) GenDecl(node *ast.GenDecl) { + switch node.Tok { + case token.IMPORT: + for _, decl := range node.Specs { + c.Import(decl) + } + /* + case token.PACKAGE: + // modified parser converts 'package foo' to ast.GenDecl{Tok: token.Package} + for _, decl := range node.Specs { + c.changePackage(decl) + } + */ + case token.CONST: + var defaultType ast.Expr + var defaultExprs []ast.Expr + top := c.TopComp() + top.addIota() + defer top.removeIota() + for _, decl := range node.Specs { + c.DeclConsts(decl, defaultType, defaultExprs) + if valueSpec, ok := decl.(*ast.ValueSpec); ok && valueSpec.Values != nil { + defaultType = valueSpec.Type + defaultExprs = valueSpec.Values + } + top.incrementIota() + } + case token.TYPE: + for _, decl := range node.Specs { + c.DeclType(decl) + } + case token.VAR: + for _, decl := range node.Specs { + c.DeclVars(decl) + } + default: + c.Errorf("Compile: unsupported declaration kind, expecting token.IMPORT, token.CONST, token.TYPE or token.VAR, found %v: %v <%v>", + node.Tok, node, r.TypeOf(node)) + } +} + +// DeclConsts compiles a set of constant declarations +func (c *Comp) DeclConsts(node ast.Spec, defaultType ast.Expr, defaultExprs []ast.Expr) { + c.Pos = node.Pos() + switch node := node.(type) { + case *ast.ValueSpec: + if node.Type != nil || node.Values != nil { + defaultType = node.Type + defaultExprs = node.Values + } + names, t, inits := c.prepareDeclConstsOrVars(tostrings(node.Names), defaultType, defaultExprs) + c.DeclConsts0(names, t, inits) + default: + c.Errorf("Compile: unsupported constant declaration: expecting <*ast.ValueSpec>, found: %v <%v>", node, r.TypeOf(node)) + } +} + +// DeclVars compiles a set of variable declarations i.e. "var x1, x2... [type] = expr1, expr2..." +func (c *Comp) DeclVars(node ast.Spec) { + c.Pos = node.Pos() + switch node := node.(type) { + case *ast.ValueSpec: + names, t, inits := c.prepareDeclConstsOrVars(tostrings(node.Names), node.Type, node.Values) + c.DeclVars0(names, t, inits) + default: + c.Errorf("Compile: unsupported variable declaration: expecting <*ast.ValueSpec>, found: %v <%v>", node, r.TypeOf(node)) + } +} + +// DeclVarsShort compiles a set of variable short declarations i.e. "x1, x2... := expr1, expr2..." +func (c *Comp) DeclVarsShort(lhs []ast.Expr, rhs []ast.Expr) { + n := len(lhs) + names := make([]string, n) + for i := range lhs { + if ident, ok := lhs[i].(*ast.Ident); ok { + names[i] = ident.Name + } else { + c.Errorf("non-name %v on left side of :=", lhs[i]) + } + } + _, t, inits := c.prepareDeclConstsOrVars(names, nil, rhs) + c.DeclVars0(names, t, inits) +} + +func tostrings(idents []*ast.Ident) []string { + n := len(idents) + names := make([]string, n) + for i, ident := range idents { + names[i] = ident.Name + } + return names +} + +func (c *Comp) prepareDeclConstsOrVars(names []string, typ ast.Expr, exprs []ast.Expr) (names_out []string, t xr.Type, inits []*Expr) { + n := len(names) + if typ != nil { + t = c.Type(typ) + } + if exprs != nil { + inits = c.ExprsMultipleValues(exprs, n) + } + return names, t, inits +} + +func (c *Comp) DeclConsts0(names []string, t xr.Type, inits []*Expr) { + n := len(names) + if inits == nil { + c.Errorf("constants without initialization: %v", names) + } else if len(inits) != n { + c.Errorf("cannot declare %d constants with %d initializers: %v", n, len(inits), names) + } + for i, name := range names { + init := inits[i] + if !init.Const() { + c.Errorf("const initializer for %q is not a constant", name) + } + c.DeclConst0(name, t, init.Value) + } +} + +// DeclVars0 compiles a set of variable declarations +func (c *Comp) DeclVars0(names []string, t xr.Type, inits []*Expr) { + n := len(names) + ni := len(inits) + if ni == 0 { + for i := 0; i < n; i++ { + c.DeclVar0(names[i], t, nil) + } + } else if ni == n { + for i := 0; i < n; i++ { + c.DeclVar0(names[i], t, inits[i]) + } + } else if ni == 1 && n > 1 { + c.DeclMultiVar0(names, t, inits[0]) + } else { + c.Errorf("cannot declare %d variables from %d expressions: %v", n, ni, names) + } +} + +// DeclConst0 compiles a constant declaration +func (c *Comp) DeclConst0(name string, t xr.Type, value I) { + if !isLiteral(value) { + c.Errorf("const initializer for %q is not a constant: %v <%T>", name, value, value) + return + } + lit := c.litValue(value) + if t == nil { + t = lit.Type + } else { + value = lit.ConstTo(t) + } + bind := c.AddBind(name, ConstBind, t) + bind.Value = value // c.Binds[] is a map[string]*Bind => changes to *Bind propagate to the map +} + +// AddFuncBind reserves space for a subsequent function declaration +func (c *Comp) AddFuncBind(name string, t xr.Type) *Bind { + bind := c.AddBind(name, FuncBind, t) + if bind.Desc.Class() != FuncBind { + c.Errorf("internal error! Comp.AddBind(name=%q, class=FuncBind, type=%v) returned class=%v, expecting FuncBind", + name, t, bind.Desc.Class()) + } + return bind +} + +// AddBind reserves space for a subsequent constant, function or variable declaration +func (c *Comp) AddBind(name string, class BindClass, t xr.Type) *Bind { + if class == IntBind || class == VarBind { + if !c.IsCompiled() && (base.IsCategory(t.Kind(), r.Bool, r.Int, r.Uint, r.Float64) || t.Kind() == r.Complex64) { + class = IntBind + } else { + class = VarBind + } + } + var index = NoIndex + if name == "_" { + // never store bindings for "_" in c.Binds + desc := MakeBindDescriptor(class, index) + bind := &Bind{Lit: Lit{Type: t}, Desc: desc, Name: name} + return bind + } + if c.Binds == nil { + c.Binds = make(map[string]*Bind) + } + if len(name) == 0 { + // unnamed function result, or unnamed switch/range/... expression + } else if bind := c.Binds[name]; bind != nil { + c.Warnf("redefined identifier: %v", name) + oldclass := bind.Desc.Class() + if (oldclass == IntBind) == (class == IntBind) { + // both are IntBind, or neither is. + // we can reuse the bind index + index = bind.Desc.Index() + } + } + // allocate a slot either in Binds or in IntBinds + switch class { + case ConstBind: + index = NoIndex + default: // case FuncBind, VarBind: + if index == NoIndex { + if c.BindNum == NoIndex { + c.BindNum++ + } + index = c.BindNum + c.BindNum++ + } + case IntBind: + if index == NoIndex { + if c.IntBindNum == NoIndex { + c.IntBindNum++ + } + index = c.IntBindNum + c.IntBindNum++ + } + } + desc := MakeBindDescriptor(class, index) + bind := &Bind{Lit: Lit{Type: t}, Desc: desc, Name: name} + if len(name) != 0 { + // skip unnamed function results, and unnamed switch/range/... expression + c.Binds[name] = bind + } + return bind +} + +func (c *Comp) declUnnamedBind(init *Expr, o *Comp, upn int) *Symbol { + t := init.Type + bind := o.AddBind("", VarBind, t) + // c.Debugf("declUnnamedBind: allocated bind %v, upn = %d", bind, upn) + switch bind.Desc.Class() { + case IntBind: + // no difference between declaration and assignment for this class + va := bind.AsVar(upn, PlaceSettable) + c.SetVar(va, token.ASSIGN, init) + case VarBind: + // cannot use c.DeclVar0 because the variable is declared in o + // cannot use o.DeclVar0 because the initializer must be evaluated in c + // so initialize the binding manually + index := bind.Desc.Index() + f := init.AsX1() + conv := c.Converter(init.Type, t) + rtype := t.ReflectType() + switch upn { + case 0: + c.append(func(env *Env) (Stmt, *Env) { + v := f(env) + if conv != nil { + v = conv(v, rtype) + } + // no need to create a settable reflect.Value + env.Binds[index] = v + env.IP++ + return env.Code[env.IP], env + }) + case 1: + c.append(func(env *Env) (Stmt, *Env) { + v := f(env) + if conv != nil { + v = conv(v, rtype) + } + // no need to create a settable reflect.Value + env.Outer.Binds[index] = v + env.IP++ + return env.Code[env.IP], env + }) + default: + c.append(func(env *Env) (Stmt, *Env) { + o := env + for i := 0; i < upn; i++ { + o = o.Outer + } + v := f(env) + if conv != nil { + v = conv(v, rtype) + } + // no need to create a settable reflect.Value + o.Binds[index] = v + env.IP++ + return env.Code[env.IP], env + }) + } + default: + c.Errorf("internal error! Comp.AddBind(name=%q, class=VarBind, type=%v) returned class=%v, expecting VarBind or IntBind", + "", t, bind.Desc.Class()) + return nil + } + return bind.AsSymbol(upn) +} + +// DeclVar0 compiles a variable declaration. For caller's convenience, returns allocated Bind +func (c *Comp) DeclVar0(name string, t xr.Type, init *Expr) *Bind { + if t == nil { + if init == nil { + c.Errorf("no value and no type, cannot declare : %v", name) + } + t = init.DefaultType() + if t == nil { + c.Errorf("cannot declare variable as untyped nil: %v", name) + } + n := init.NumOut() + if n == 0 { + c.Errorf("initializer returns no values, cannot declare variable: %v", name) + } else if n > 1 { + c.Warnf("initializer returns %d values, using only the first one to declare variable: %v", n, name) + } + } + bind := c.AddBind(name, VarBind, t) + desc := bind.Desc + switch desc.Class() { + default: + c.Errorf("internal error! Comp.AddBind(name=%q, class=VarBind, type=%v) returned class=%v, expecting VarBind or IntBind", + name, t, desc.Class()) + return bind + case IntBind: + // no difference between declaration and assignment for these classes + if init == nil { + // no initializer... use the zero-value of t + init = c.exprValue(t, xr.Zero(t).Interface()) + } + va := bind.AsVar(0, PlaceSettable) + c.SetVar(va, token.ASSIGN, init) + case VarBind: + index := desc.Index() + if index == NoIndex && init != nil { + // assigning a constant or expression to _ + // only keep the expression side effects + c.append(init.AsStmt()) + } + // declaring a variable in Env.Binds[], we must create a settable and addressable reflect.Value + if init == nil { + // no initializer... use the zero-value of t + rtype := t.ReflectType() + c.append(func(env *Env) (Stmt, *Env) { + // base.Debugf("declaring %v", bind) + env.Binds[index] = r.New(rtype).Elem() + env.IP++ + return env.Code[env.IP], env + }) + return bind + } + if init.Const() { + init.ConstTo(t) // convert untyped constants, check typed constants + } + fun := init.AsX1() // AsX1() panics if init.NumOut() == 0, warns if init.NumOut() > 1 + tfun := init.Out(0) + if tfun == nil || (!xr.SameType(tfun, t) && !tfun.AssignableTo(t)) { + c.Errorf("cannot assign <%v> to <%v> in variable declaration: %v <%v>", tfun, t, name, t) + return bind + } + var ret func(env *Env) (Stmt, *Env) + conv := c.Converter(init.Type, t) + rtype := t.ReflectType() + // optimization: no need to wrap multiple-valued function into a single-value function + if f, ok := init.Fun.(func(*Env) (r.Value, []r.Value)); ok { + if conv != nil { + ret = func(env *Env) (Stmt, *Env) { + ret, _ := f(env) + place := r.New(rtype).Elem() + place.Set(conv(ret, rtype)) + env.Binds[index] = place + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ret, _ := f(env) + place := r.New(rtype).Elem() + place.Set(ret) + env.Binds[index] = place + env.IP++ + return env.Code[env.IP], env + } + } + } else { + if conv != nil { + ret = func(env *Env) (Stmt, *Env) { + ret := fun(env) + place := r.New(rtype).Elem() + place.Set(conv(ret, rtype)) + env.Binds[index] = place + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ret := fun(env) + place := r.New(rtype).Elem() + place.Set(ret) + env.Binds[index] = place + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(ret) + } + return bind +} + +// DeclBindRuntimeValue compiles a variable, function or constant declaration with a reflect.Value passed at runtime +func (c *Comp) DeclBindRuntimeValue(bind *Bind) func(*Env, r.Value) { + desc := bind.Desc + index := desc.Index() + if index == NoIndex { + return nil + } + t := bind.Type + rtype := t.ReflectType() + switch desc.Class() { + default: + c.Errorf("cannot declare a %s with a value passed at runtime: %v <%v>", desc.Class(), bind.Name, t) + return nil + case FuncBind: + // declaring a function in Env.Binds[], the reflect.Value must not be addressable or settable + return func(env *Env, v r.Value) { + env.Binds[index] = v.Convert(rtype) + } + case VarBind: + // declaring a variable in Env.Binds[], we must create a settable and addressable reflect.Value + return func(env *Env, v r.Value) { + place := r.New(rtype).Elem() + if v.Type() != rtype { + v = v.Convert(rtype) + } + place.Set(v) + env.Binds[index] = place + } + case IntBind: + // no difference between declaration and assignment for IntBind + return c.varSetValue(bind.AsVar(0, PlaceSettable)) + } +} + +// DeclMultiVar0 compiles multiple variable declarations from a single multi-valued expression +func (c *Comp) DeclMultiVar0(names []string, t xr.Type, init *Expr) { + if t == nil { + if init == nil { + c.Errorf("no value and no type, cannot declare variables: %v", names) + } + } + n := len(names) + if n == 1 { + c.DeclVar0(names[0], t, init) + return + } + ni := init.NumOut() + if ni < n { + c.Errorf("cannot declare %d variables from expression returning %d values: %v", n, ni, names) + } else if ni > n { + c.Warnf("declaring %d variables from expression returning %d values: %v", n, ni, names) + } + decls := make([]func(*Env, r.Value), n) + for i, name := range names { + ti := init.Out(i) + if t != nil && !xr.SameType(t, ti) { + if ti != nil && !ti.AssignableTo(t) { + c.Errorf("cannot assign <%v> to <%v> in variable declaration: %v", ti, t, names) + return + } else { + ti = t // declared variable has type t, not the i-th type returned by multi-valued expression + } + } + bind := c.AddBind(name, VarBind, ti) + decls[i] = c.DeclBindRuntimeValue(bind) + } + fun := init.AsXV(0) + c.append(func(env *Env) (Stmt, *Env) { + // call the multi-valued function. we know ni > 1, so just use the []r.Value + _, rets := fun(env) + + // declare and assign the variables one by one. we know n <= ni + for i, decl := range decls { + if decl != nil { + decl(env, rets[i]) + } + } + env.IP++ + return env.Code[env.IP], env + }) +} + +// DeclFunc0 compiles a function declaration. For caller's convenience, returns allocated Bind +func (c *Comp) DeclFunc0(name string, fun I) *Bind { + funv := r.ValueOf(fun) + t := c.TypeOf(fun) + if t.Kind() != r.Func { + c.Errorf("DeclFunc0(%s): expecting a function, received %v <%v>", name, fun, t) + } + bind := c.AddFuncBind(name, t) + index := bind.Desc.Index() + ret := func(env *Env) (Stmt, *Env) { + env.Binds[index] = funv + env.IP++ + return env.Code[env.IP], env + } + c.append(ret) + return bind +} + +// DeclEnvFunc0 compiles a function declaration that accesses interpreter's Env. For caller's convenience, returns allocated Bind +func (c *Comp) DeclEnvFunc0(name string, envfun Function) *Bind { + t := c.TypeOfFunction() + bind := c.AddBind(name, ConstBind, t) // not a regular function... its type is not accurate + bind.Value = envfun // c.Binds[] is a map[string]*Bind => changes to *Bind propagate to the map + return bind +} + +// DeclBuiltin0 compiles a builtin function declaration. For caller's convenience, returns allocated Bind +func (c *Comp) DeclBuiltin0(name string, builtin Builtin) *Bind { + t := c.TypeOfBuiltin() + bind := c.AddBind(name, ConstBind, t) // not a regular function... its type is not accurate + bind.Value = builtin // c.Binds[] is a map[string]*Bind => changes to *Bind propagate to the map + return bind +} + +// replacement of reflect.TypeOf() that uses xreflect.TypeOf() +func (c *Comp) TypeOf(val interface{}) xr.Type { + v := c.Universe + v.TryResolve = c.tryResolveForXtype + + return v.TypeOf(val) +} + +func (c *Comp) tryResolveForXtype(name, pkgpath string) xr.Type { + if c.FileComp().Path != pkgpath { + return nil + } + var t xr.Type + for c != nil && t == nil { + t = c.Types[name] + c = c.Outer + } + return t +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/expr.go b/vendor/github.com/cosmos72/gomacro/fast/expr.go new file mode 100644 index 0000000..fd4340e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/expr.go @@ -0,0 +1,168 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * expr.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + + xr "github.com/cosmos72/gomacro/xreflect" +) + +// ExprsMultipleValues either a single expression returning multiple values, +// or multiple expressions each returning a value. +func (c *Comp) ExprsMultipleValues(nodes []ast.Expr, expectedValuesN int) (inits []*Expr) { + n := len(nodes) + if n != expectedValuesN { + if n != 1 { + c.Errorf("value count mismatch: cannot assign %d values to %d places: %v", + n, expectedValuesN, nodes) + return nil + } + e := c.Expr(nodes[0]) + if actualN := e.NumOut(); actualN != expectedValuesN { + var plural string + if actualN != 1 { + plural = "s" + } + c.Errorf("expression returns %d value%s, expecting %d: %v", actualN, plural, expectedValuesN, nodes[0]) + } + inits = []*Expr{e} + } else { + inits = c.Exprs(nodes) + } + return inits +} + +// Exprs compiles multiple expressions +func (c *Comp) Exprs(nodes []ast.Expr) []*Expr { + var inits []*Expr + if n := len(nodes); n != 0 { + inits = make([]*Expr, n) + for i := range nodes { + inits[i] = c.Expr1(nodes[i]) + } + } + return inits +} + +// Expr compiles an expression that returns a single value +func (c *Comp) Expr1(in ast.Expr) *Expr { + for { + if in != nil { + c.Pos = in.Pos() + } + // env.Debugf("Expr1() %v", node) + switch node := in.(type) { + case *ast.ParenExpr: + in = node.X + continue + case *ast.IndexExpr: + return c.IndexExpr1(node) + case *ast.TypeAssertExpr: + return c.TypeAssert1(node) + case *ast.UnaryExpr: + if node.Op == token.ARROW { + xe := c.Expr1(node.X) + return c.Recv1(node, xe) + } else { + return c.UnaryExpr(node) + } + } + break + } + e := c.Expr(in) + nout := e.NumOut() + switch nout { + case 0: + c.Errorf("expression returns no values, expecting one: %v", in) + return nil + default: + c.Warnf("expression returns %d values %v, using only the first one: %v", + len(e.Types), e.Types, in) + fallthrough + case 1: + return e + } +} + +// Expr compiles an expression +func (c *Comp) Expr(in ast.Expr) *Expr { + for { + if in != nil { + c.Pos = in.Pos() + } + // env.Debugf("Expr() %v", node) + switch node := in.(type) { + case *ast.BasicLit: + return c.BasicLit(node) + case *ast.BinaryExpr: + return c.BinaryExpr(node) + case *ast.CallExpr: + return c.CallExpr(node) + case *ast.CompositeLit: + return c.CompositeLit(node) + case *ast.FuncLit: + return c.FuncLit(node) + case *ast.Ident: + return c.Ident(node.Name) + case *ast.IndexExpr: + return c.IndexExpr(node) + case *ast.ParenExpr: + in = node.X + continue + case *ast.UnaryExpr: + return c.UnaryExpr(node) + case *ast.SelectorExpr: + return c.SelectorExpr(node) + case *ast.SliceExpr: + return c.SliceExpr(node) + case *ast.StarExpr: + return c.StarExpr(node) + case *ast.TypeAssertExpr: + return c.TypeAssert2(node) + default: + } + c.Errorf("unimplemented Compile() for: %v <%v>", in, r.TypeOf(in)) + return nil + } +} + +// Expr1OrType compiles an single-valued expression or a type +// FIXME lookup simultaneously for both types and expressions +func (c *Comp) Expr1OrType(node ast.Expr) (e *Expr, t xr.Type) { + panicking := true + defer func() { + if panicking { + recover() + t = c.Type(node) + } + }() + e = c.Expr1(node) + panicking = false + return +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/expr1.go b/vendor/github.com/cosmos72/gomacro/fast/expr1.go new file mode 100644 index 0000000..125199e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/expr1.go @@ -0,0 +1,114 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * expr1.go + * + * Created on Apr 03, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/constant" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) litValue(value I) Lit { + if untyp, ok := value.(UntypedLit); ok && untyp.Universe != c.Universe { + untyp.Universe = c.Universe + value = untyp + } + return Lit{Type: c.TypeOf(value), Value: value} +} + +func (c *Comp) exprUntypedLit(kind r.Kind, obj constant.Value) *Expr { + return &Expr{Lit: Lit{Type: c.TypeOfUntypedLit(), Value: UntypedLit{kind, obj, c.Universe}}} +} + +func (c *Comp) exprValue(t xr.Type, value I) *Expr { + if t == nil { + t = c.TypeOf(value) + } + return &Expr{Lit: Lit{Type: t, Value: value}, IsNil: value == nil} +} + +func exprLit(lit Lit, sym *Symbol) *Expr { + return &Expr{Lit: lit, Sym: sym, IsNil: lit.Value == nil} +} + +func exprFun(t xr.Type, fun I) *Expr { + return &Expr{Lit: Lit{Type: t}, Fun: fun} +} + +func exprX1(t xr.Type, fun func(env *Env) r.Value) *Expr { + return &Expr{Lit: Lit{Type: t}, Fun: fun} +} + +func exprXV(types []xr.Type, fun func(env *Env) (r.Value, []r.Value)) *Expr { + if len(types) == 1 { + return &Expr{Lit: Lit{Type: types[0]}, Fun: fun} + } else { + return &Expr{Lit: Lit{Type: types[0]}, Types: types, Fun: fun} + } +} + +func expr0(fun func(env *Env)) *Expr { + return &Expr{Types: zeroTypes, Fun: fun} +} + +func (c *Comp) exprBool(fun func(env *Env) bool) *Expr { + return &Expr{Lit: Lit{Type: c.TypeOfBool()}, Fun: fun} +} + +func (c *Comp) exprUint8(fun func(env *Env) uint8) *Expr { + return &Expr{Lit: Lit{Type: c.TypeOfUint8()}, Fun: fun} +} + +func (c *Comp) exprString(fun func(env *Env) string) *Expr { + return &Expr{Lit: Lit{Type: c.TypeOfString()}, Fun: fun} +} + +func (expr *Expr) EvalConst(opts CompileOptions) I { + if expr == nil { + return nil + } + if expr.Const() { + if opts == OptDefaults && expr.Untyped() { + return expr.ConstTo(expr.DefaultType()) + } + return expr.Value + } + ret := expr.AsX1()(nil) + if ret == base.None { + base.Errorf("constant should evaluate to a single value, found no values at all") + return nil + } + var value I + if ret != base.Nil { + value = ret.Interface() + } + expr.Value = value + expr.IsNil = value == nil + expr.Fun = nil // no longer needed, will be recreated if needed as a wrapper for the computed value + return value +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func0ret0.go b/vendor/github.com/cosmos72/gomacro/fast/func0ret0.go new file mode 100644 index 0000000..4ce1585 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func0ret0.go @@ -0,0 +1,55 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func0ret0.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) func0ret0(t xr.Type, m *funcMaker) func(env *Env) r.Value { + funcbody := m.funcbody + if funcbody == nil { + return func(env *Env) r.Value { + return valueOfNopFunc + } + } + + nbinds := m.nbinds + nintbinds := m.nintbinds + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.ValueOf(func() { + env := NewEnv4Func(env, nbinds, nintbinds) + // execute the body + funcbody(env) + + env.FreeEnv() + }) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func0ret1.go b/vendor/github.com/cosmos72/gomacro/fast/func0ret1.go new file mode 100644 index 0000000..50c2791 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func0ret1.go @@ -0,0 +1,507 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func0ret1.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) func0ret1(t xr.Type, m *funcMaker) func(*Env) r.Value { + + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + + tret0 := t.Out(0) + kret0 := tret0.Kind() + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 bool) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) bool) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 int) { return }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) int) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 int8) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) int8) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 int16) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) int16) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 int32) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) int32) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 int64) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) int64) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uint) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uint) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uint8) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uint8) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uint16) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uint16) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uint32) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uint32) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uint64) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uint64) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 uintptr) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) uintptr) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 float32) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) float32) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 float64) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) float64) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 complex64) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) complex64) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 complex128) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) complex128) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 string) { + return + }, + ) + } + } + + resultfun := m.resultfuns[0].(func(*Env) string) + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + funcbody(env) + + ret0 = resultfun(env) + env.FreeEnv() + return + + }) + } + } + default: + return nil + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func0ret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/func0ret1.gomacro new file mode 100644 index 0000000..22ce94a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func0ret1.gomacro @@ -0,0 +1,104 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func0ret1.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + r "reflect" + "go/ast" +) + + +// ----------------- func() t0 --------------------- + +:macro mfunc0ret1(ret0typ ast.Node) ast.Node { + if EvalType(ret0typ) == nil { + // not a well-known type + return ~"{ + return c.funcGeneric(t, m) + } + } + return ~"{ + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func() (ret0 ~,ret0typ) { + return + }) + } + } + resultfun := m.resultfuns[0].(func (*Env) ~,ret0typ) + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.ValueOf(func() (ret0 ~,ret0typ) { + env := NewEnv4Func(env, nbinds, nintbinds) + + // execute the body + funcbody(env) + + // extract result + ret0 = resultfun(env) + env.FreeEnv() + return + }) + } + } +} + +func (c *Comp) func0ret1(t xr.Type, m *funcMaker) func(*Env) r.Value { + // do NOT keep a reference to funcMaker + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + + tret0 := t.Out(0) + kret0 := tret0.Kind() + switch kret0 { + case r.Bool: {mfunc0ret1; bool} + case r.Int: {mfunc0ret1; int} + case r.Int8: {mfunc0ret1; int8} + case r.Int16: {mfunc0ret1; int16} + case r.Int32: {mfunc0ret1; int32} + case r.Int64: {mfunc0ret1; int64} + case r.Uint: {mfunc0ret1; uint} + case r.Uint8: {mfunc0ret1; uint8} + case r.Uint16: {mfunc0ret1; uint16} + case r.Uint32: {mfunc0ret1; uint32} + case r.Uint64: {mfunc0ret1; uint64} + case r.Uintptr: {mfunc0ret1; uintptr} + case r.Float32: {mfunc0ret1; float32} + case r.Float64: {mfunc0ret1; float64} + case r.Complex64: {mfunc0ret1; complex64} + case r.Complex128:{mfunc0ret1; complex128} + case r.String: {mfunc0ret1; string} + default: return nil + } +} + diff --git a/vendor/github.com/cosmos72/gomacro/fast/func1ret0.go b/vendor/github.com/cosmos72/gomacro/fast/func1ret0.go new file mode 100644 index 0000000..bbed054 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func1ret0.go @@ -0,0 +1,468 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func1ret0.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) func1ret0(t xr.Type, m *funcMaker) func(*Env) r.Value { + + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + param0index := m.parambinds[0].Desc.Index() + + targ0 := t.In(0) + karg0 := targ0.Kind() + switch karg0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[param0index] = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[param0index])) = arg0 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[param0index] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[param0index] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + + default: + { + rtype := t.ReflectType() + if funcbody == nil { + return func(env *Env) r.Value { + return r.MakeFunc(rtype, func([]r.Value) []r.Value { return ZeroValues }, + ) + } + } else { + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + rtarg0 := targ0.ReflectType() + return r.MakeFunc(rtype, func(args []r.Value) []r.Value { + env := NewEnv4Func(env, nbinds, nintbinds) + + if param0index != NoIndex { + place := r.New(rtarg0).Elem() + if arg0 := args[0]; arg0 != Nil && arg0 != None { + place.Set(arg0.Convert(rtarg0)) + } + + env.Binds[param0index] = place + } + + funcbody(env) + return ZeroValues + }) + } + } + + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func1ret0.gomacro b/vendor/github.com/cosmos72/gomacro/fast/func1ret0.gomacro new file mode 100644 index 0000000..7cfb591 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func1ret0.gomacro @@ -0,0 +1,180 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func1ret0.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + r "reflect" + "go/ast" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +// convert a well-known reflect.Type into one of the constants TypeOf* +:func maketypeident(t r.Type) *ast.Ident { + name := "TypeOf" + upcasefirstbyte(t.Name()) + return &ast.Ident{Name: name} +} + +:func fsetarg(typ, tident, name, index ast.Node) ast.Node { + var t r.Type = EvalType(typ) + var bind ast.Node + if t == nil { + bind = ~"{ + place := r.New(~,tident).Elem() + place.Set(r.ValueOf(~,name)) + env.Binds[~,index] = place + } + } else { + typeident := maketypeident(t) + switch t.Kind() { + case r.Complex128: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetComplex(~,name) + env.Binds[~,index] = place + } + case r.String: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetString(~,name) + env.Binds[~,index] = place + } + case r.Uint64: + bind = ~"{env.IntBinds[~,index] = ~,name} + default: + bind = ~"{*(*~,typ)(unsafe.Pointer(&env.IntBinds[~,index])) = ~,name} + } + } + return bind +} + +// fully optimized function declaration +:macro mfunc1ret0(arg0typ ast.Node) ast.Node { + var t r.Type = EvalType(arg0typ) + if t != nil { + arg0bind := fsetarg(arg0typ, ~'targ0, ~'arg0, ~'param0index) + return ~"{ + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(~,arg0typ) { + }) + } + } + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 ~,arg0typ) { + env := NewEnv4Func(env, nbinds, nintbinds) + // copy arg0 into allocated binds + ~,arg0bind + // execute the body + funcbody(env) + + env.FreeEnv() + }) + } + } + } + // not a well-known type... use reflect.MakeFunc() + return ~"{ + rtype := t.ReflectType() + if funcbody == nil { + return func(env *Env) r.Value { + return r.MakeFunc(rtype, func([]r.Value) []r.Value { + return ZeroValues + }) + } + } else { + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + rtarg0 := targ0.ReflectType() + return r.MakeFunc(rtype, func(args []r.Value) []r.Value { + env := NewEnv4Func(env, nbinds, nintbinds) + + // copy arg0 into allocated binds + if param0index != NoIndex { + place := r.New(rtarg0).Elem() + if arg0 := args[0]; arg0 != Nil && arg0 != None { + place.Set(arg0.Convert(rtarg0)) + } + env.Binds[param0index] = place + } + // execute the body + funcbody(env) + + return ZeroValues + }) + } + } + } +} + +func (c *Comp) func1ret0(t xr.Type, m *funcMaker) func(*Env) r.Value { + // do NOT keep a reference to funcMaker + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + param0index := m.parambinds[0].Desc.Index() + + targ0 := t.In(0) + karg0 := targ0.Kind() + switch karg0 { + case r.Bool: {mfunc1ret0; bool} + case r.Int: {mfunc1ret0; int} + case r.Int8: {mfunc1ret0; int8} + case r.Int16: {mfunc1ret0; int16} + case r.Int32: {mfunc1ret0; int32} + case r.Int64: {mfunc1ret0; int64} + case r.Uint: {mfunc1ret0; uint} + case r.Uint8: {mfunc1ret0; uint8} + case r.Uint16: {mfunc1ret0; uint16} + case r.Uint32: {mfunc1ret0; uint32} + case r.Uint64: {mfunc1ret0; uint64} + case r.Uintptr: {mfunc1ret0; uintptr} + case r.Float32: {mfunc1ret0; float32} + case r.Float64: {mfunc1ret0; float64} + case r.Complex64: {mfunc1ret0; complex64} + case r.Complex128:{mfunc1ret0; complex128} + case r.String: {mfunc1ret0; string} + default: {mfunc1ret0; nil} + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func1ret1.go b/vendor/github.com/cosmos72/gomacro/fast/func1ret1.go new file mode 100644 index 0000000..7f0589b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func1ret1.go @@ -0,0 +1,8303 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func_ret1.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) func1ret1(t xr.Type, m *funcMaker) func(*Env) r.Value { + + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + + targ0 := t.In(0) + karg0 := targ0.Kind() + kret0 := t.Out(0).Kind() + + indexes := [2]int{ + m.parambinds[0].Desc.Index(), + m.resultbinds[0].Desc.Index(), + } + switch karg0 { + case r.Bool: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Int: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Int8: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Int16: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Int32: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Int64: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uint: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uint8: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uint16: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uint32: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uint64: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Uintptr: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Float32: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Float64: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Complex64: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.Complex128: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + case r.String: + switch kret0 { + case r.Bool: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 bool) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 int) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 int8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 int16) { return }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 int32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 int64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uint) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uint8) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uint16) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uint32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uint64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.IntBinds[indexes[1]] + + env.FreeEnv() + return + + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 uintptr) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 float32) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 float64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 complex64) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) + + env.FreeEnv() + return + + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 complex128) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.Binds[indexes[1]].Complex() + + env.FreeEnv() + return + + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string) (ret0 string) { + return + }, + ) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string) (ret0 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + funcbody(env) + + ret0 = env.Binds[indexes[1]].String() + + env.FreeEnv() + return + + }) + } + } + } + } + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func1ret1.gomacro b/vendor/github.com/cosmos72/gomacro/fast/func1ret1.gomacro new file mode 100644 index 0000000..cd0653f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func1ret1.gomacro @@ -0,0 +1,206 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func_ret1.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + r "reflect" + "go/ast" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +// convert a well-known reflect.Type into one of the constants TypeOf* +:func maketypeident(t r.Type) *ast.Ident { + name := "TypeOf" + upcasefirstbyte(t.Name()) + return &ast.Ident{Name: name} +} + +:func fsetarg(typ, name, index ast.Node) ast.Node { + var t r.Type = EvalType(typ) + var bind ast.Node + typeident := maketypeident(t) + switch t.Kind() { + case r.Complex128: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetComplex(~,name) + env.Binds[~,index] = place + } + case r.String: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetString(~,name) + env.Binds[~,index] = place + } + case r.Uint64: + bind = ~"{env.IntBinds[~,index] = ~,name} + default: + bind = ~"{*(*~,typ)(unsafe.Pointer(&env.IntBinds[~,index])) = ~,name} + } + return bind +} + +:func fgetresult(typ, index ast.Node) ast.Node { + var t r.Type = EvalType(typ) + var bind ast.Node + if t == nil { + bind = ~"{env.Binds[~,index]} + } else { + typeident := maketypeident(t) + switch t.Kind() { + case r.Complex128: + bind = ~"{env.Binds[~,index].Complex()} + case r.String: + bind = ~"{env.Binds[~,index].String()} + case r.Uint64: + bind = ~"{env.IntBinds[~,index]} + default: + bind = ~"{*(*~,typ)(unsafe.Pointer(&env.IntBinds[~,index]))} + } + } + return bind +} + +// ----------------- func(t0) t1 --------------------- + +// generate fully optimized function implementation for func(arg0typ) ret0typ +:macro mfunc1ret1(arg0typ, ret0typ ast.Node) ast.Node { + arg0bind := fsetarg(arg0typ, ~'arg0, ~'{indexes[0]}) + ret0bind := fgetresult(ret0typ, ~'{indexes[1]}) + return ~"{ + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(~,arg0typ) (ret0 ~,ret0typ) { + return + }) + } + } + + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 ~,arg0typ) (ret0 ~,ret0typ) { + env := NewEnv4Func(env, nbinds, nintbinds) + + // copy arg into allocated binds + ~,arg0bind + + // execute the body + funcbody(env) + + // extract result + ret0 = ~,ret0bind + env.FreeEnv() + return + }) + } + } +} + +:macro mfunc1retx1(arg0typ ast.Node) ast.Node { + return ~"{ + switch kret0 { + case r.Bool: {mfunc1ret1; ~,arg0typ; bool} + case r.Int: {mfunc1ret1; ~,arg0typ; int} + case r.Int8: {mfunc1ret1; ~,arg0typ; int8} + case r.Int16: {mfunc1ret1; ~,arg0typ; int16} + case r.Int32: {mfunc1ret1; ~,arg0typ; int32} + case r.Int64: {mfunc1ret1; ~,arg0typ; int64} + case r.Uint: {mfunc1ret1; ~,arg0typ; uint} + case r.Uint8: {mfunc1ret1; ~,arg0typ; uint8} + case r.Uint16: {mfunc1ret1; ~,arg0typ; uint16} + case r.Uint32: {mfunc1ret1; ~,arg0typ; uint32} + case r.Uint64: {mfunc1ret1; ~,arg0typ; uint64} + case r.Uintptr: {mfunc1ret1; ~,arg0typ; uintptr} + case r.Float32: {mfunc1ret1; ~,arg0typ; float32} + case r.Float64: {mfunc1ret1; ~,arg0typ; float64} + case r.Complex64: {mfunc1ret1; ~,arg0typ; complex64} + case r.Complex128:{mfunc1ret1; ~,arg0typ; complex128} + case r.String: {mfunc1ret1; ~,arg0typ; string} + } + } +} + +:macro mfuncx1retx1(dummy ast.Node) ast.Node { + return ~"{ + switch karg0 { + case r.Bool: {mfunc1retx1; bool} + case r.Int: {mfunc1retx1; int} + case r.Int8: {mfunc1retx1; int8} + case r.Int16: {mfunc1retx1; int16} + case r.Int32: {mfunc1retx1; int32} + case r.Int64: {mfunc1retx1; int64} + case r.Uint: {mfunc1retx1; uint} + case r.Uint8: {mfunc1retx1; uint8} + case r.Uint16: {mfunc1retx1; uint16} + case r.Uint32: {mfunc1retx1; uint32} + case r.Uint64: {mfunc1retx1; uint64} + case r.Uintptr: {mfunc1retx1; uintptr} + case r.Float32: {mfunc1retx1; float32} + case r.Float64: {mfunc1retx1; float64} + case r.Complex64: {mfunc1retx1; complex64} + case r.Complex128:{mfunc1retx1; complex128} + case r.String: {mfunc1retx1; string} + } + } +} + +func (c *Comp) func1ret1(t xr.Type, m *funcMaker) func(*Env) r.Value { + // do NOT keep a reference to funcMaker + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + + targ0 := t.In(0) + karg0 := targ0.Kind() + kret0 := t.Out(0).Kind() + + indexes := [2]int{ + m.parambinds[0].Desc.Index(), + m.resultbinds[0].Desc.Index(), + } + + // if IsOptimizedKind(karg0) && IsOptimizedKind(kret0) + mfuncx1retx1; nil + + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func2ret0.go b/vendor/github.com/cosmos72/gomacro/fast/func2ret0.go new file mode 100644 index 0000000..6ce5d7d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func2ret0.go @@ -0,0 +1,7701 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func2ret0.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) func2ret0(t xr.Type, m *funcMaker) func(*Env) r.Value { + karg0 := t.In(0).Kind() + karg1 := t.In(1).Kind() + + if !IsOptimizedKind(karg0) || !IsOptimizedKind(karg1) { + return nil + } + + indexes := [2]int{ + m.parambinds[0].Desc.Index(), + m.parambinds[1].Desc.Index(), + } + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + { + argdecls := [2]func(*Env, r.Value){nil, nil} + for i, bind := range m.parambinds { + argdecls[i] = c.DeclBindRuntimeValue(bind) + if argdecls[i] == nil { + argdecls[i] = declBindRuntimeValueNop + } + + } + switch karg0 { + case r.Bool: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(bool, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 bool, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Int: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Int8: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int8, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int8, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Int16: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + + float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int16, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int16, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Int32: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, + float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, + + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int32, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int32, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Int64: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, + float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, + + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(int64, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 int64, + + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uint: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, + complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, + + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint, + arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uint8: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, + complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint8, + + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint8, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uint16: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint16, + string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint16, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uint32: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint32, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint32, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uint64: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uint64, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uint64, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + env.IntBinds[indexes[0]] = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + case r.Uintptr: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(uintptr, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 uintptr, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + case r.Float32: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float32, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float32, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + case r.Float64: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(float64, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 float64, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + case r.Complex64: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex64, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex64, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[0]])) = arg0 + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + case r.Complex128: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(complex128, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 complex128, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg0, + ) + env.Binds[indexes[0]] = place + } + + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + case r.String: + switch karg1 { + case r.Bool: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, bool) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 bool) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*bool)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, int) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 int) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int8: + + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, int8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 int8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, int16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 int16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, int32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 int32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Int64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, int64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 int64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*int64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uint) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uint) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint8: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uint8) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uint8) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint8)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint16: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uint16) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uint16) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint16)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uint32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uint32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uint32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uint64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uint64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uint64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + env.IntBinds[indexes[1]] = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Uintptr: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, uintptr) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 uintptr) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*uintptr)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float32: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, float32) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 float32) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*float32)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Float64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, float64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 float64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*float64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex64: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, complex64) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 complex64) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + + *(*complex64)(unsafe.Pointer(&env.IntBinds[indexes[1]])) = arg1 + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.Complex128: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, complex128) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 complex128) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + { + place := r.New(TypeOfComplex128).Elem() + place.SetComplex(arg1, + ) + env.Binds[indexes[1]] = place + } + + funcbody(env) + + env.FreeEnv() + }) + } + } + case r.String: + { + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(string, string) { + }) + } + } + return func(env *Env) r.Value { + + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 string, arg1 string) { + env := NewEnv4Func(env, nbinds, nintbinds) + { + place := r.New(TypeOfString).Elem() + place.SetString(arg0, + ) + env.Binds[indexes[0]] = place + } + { + place := r.New(TypeOfString).Elem() + place.SetString(arg1, + ) + env.Binds[indexes[1]] = place + } + funcbody(env) + + env.FreeEnv() + }) + } + } + } + + } + } + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/func2ret0.gomacro b/vendor/github.com/cosmos72/gomacro/fast/func2ret0.gomacro new file mode 100644 index 0000000..442c8e7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/func2ret0.gomacro @@ -0,0 +1,232 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * func2ret0.go + * + * Created on Apr 16, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + r "reflect" + "go/ast" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +// convert a well-known reflect.Type into one of the constants TypeOf* +:func maketypeident(t r.Type) *ast.Ident { + name := "TypeOf" + upcasefirstbyte(t.Name()) + return &ast.Ident{Name: name} +} + +:func fsetarg(typ, tident, name, index ast.Node) ast.Node { + var t r.Type = EvalType(typ) + var bind ast.Node + if t == nil { + bind = ~"{ + place := r.New(~,tident).Elem() + place.Set(r.ValueOf(~,name)) + env.Binds[~,index] = place + } + } else { + typeident := maketypeident(t) + switch t.Kind() { + case r.Complex128: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetComplex(~,name) + env.Binds[~,index] = place + } + case r.String: + bind = ~"{ + place := r.New(~,typeident).Elem() + place.SetString(~,name) + env.Binds[~,index] = place + } + case r.Uint64: + bind = ~"{env.IntBinds[~,index] = ~,name} + default: + bind = ~"{*(*~,typ)(unsafe.Pointer(&env.IntBinds[~,index])) = ~,name} + } + } + return bind +} + + +// fully optimized function implementation +:macro mfunc2ret0(arg0typ, arg1typ ast.Node) ast.Node { + var t0 r.Type = EvalType(arg0typ) + var t1 r.Type = EvalType(arg1typ) + + if t0 != nil && t1 != nil { + arg0bind := fsetarg(arg0typ, ~'targ0, ~'arg0, ~'{indexes[0]}) + arg1bind := fsetarg(arg1typ, ~'targ1, ~'arg1, ~'{indexes[1]}) + return ~"{ + if funcbody == nil { + return func(env *Env) r.Value { + return r.ValueOf(func(~,arg0typ, ~,arg1typ) { + }) + } + } + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.ValueOf(func(arg0 ~,arg0typ, arg1 ~,arg1typ) { + env := NewEnv4Func(env, nbinds, nintbinds) + // copy arg0, arg1 into allocated binds + ~,arg0bind + ~,arg1bind + // execute the body + funcbody(env) + + env.FreeEnv() + }) + } + } + } + // not well-known types... use reflect.MakeFunc() + return ~"{ + rtype := t.ReflectType() + if funcbody == nil { + return func(env *Env) r.Value { + return r.MakeFunc(rtype, func([]r.Value) []r.Value { + return ZeroValues + }) + } + } else { + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.MakeFunc(rtype, func(args []r.Value) []r.Value { + env := NewEnv4Func(env, nbinds, nintbinds) + + // copy args into allocated binds + for i := range rtargs { + if idx := indexes[i]; idx != NoIndex { + place := r.New(rtargs[i]).Elem() + if arg := args[i]; arg != Nil && arg != None { + place.Set(arg.Convert(rtargs[i])) + } + env.Binds[idx] = place + } + } + // execute the body + funcbody(env) + + return ZeroValues + }) + } + } + } +} + + +:macro mfuncy2ret0(arg0typ ast.Node) ast.Node { + return ~"{ + switch karg1 { + case r.Bool: {mfunc2ret0; ~,arg0typ; bool} + case r.Int: {mfunc2ret0; ~,arg0typ; int} + case r.Int8: {mfunc2ret0; ~,arg0typ; int8} + case r.Int16: {mfunc2ret0; ~,arg0typ; int16} + case r.Int32: {mfunc2ret0; ~,arg0typ; int32} + case r.Int64: {mfunc2ret0; ~,arg0typ; int64} + case r.Uint: {mfunc2ret0; ~,arg0typ; uint} + case r.Uint8: {mfunc2ret0; ~,arg0typ; uint8} + case r.Uint16: {mfunc2ret0; ~,arg0typ; uint16} + case r.Uint32: {mfunc2ret0; ~,arg0typ; uint32} + case r.Uint64: {mfunc2ret0; ~,arg0typ; uint64} + case r.Uintptr: {mfunc2ret0; ~,arg0typ; uintptr} + case r.Float32: {mfunc2ret0; ~,arg0typ; float32} + case r.Float64: {mfunc2ret0; ~,arg0typ; float64} + case r.Complex64: {mfunc2ret0; ~,arg0typ; complex64} + case r.Complex128:{mfunc2ret0; ~,arg0typ; complex128} + case r.String: {mfunc2ret0; ~,arg0typ; string} + } + } +} + +:macro mfuncxy2ret0(dummy ast.Node) ast.Node { + return ~"{ + argdecls := [2]func(*Env, r.Value){nil, nil} + for i, bind := range m.parambinds { + argdecls[i] = c.DeclBindRuntimeValue(bind) + if argdecls[i] == nil { + argdecls[i] = declBindRuntimeValueNop + } + } + switch karg0 { + case r.Bool: {mfuncy2ret0; bool} + case r.Int: {mfuncy2ret0; int} + case r.Int8: {mfuncy2ret0; int8} + case r.Int16: {mfuncy2ret0; int16} + case r.Int32: {mfuncy2ret0; int32} + case r.Int64: {mfuncy2ret0; int64} + case r.Uint: {mfuncy2ret0; uint} + case r.Uint8: {mfuncy2ret0; uint8} + case r.Uint16: {mfuncy2ret0; uint16} + case r.Uint32: {mfuncy2ret0; uint32} + case r.Uint64: {mfuncy2ret0; uint64} + case r.Uintptr: {mfuncy2ret0; uintptr} + case r.Float32: {mfuncy2ret0; float32} + case r.Float64: {mfuncy2ret0; float64} + case r.Complex64: {mfuncy2ret0; complex64} + case r.Complex128:{mfuncy2ret0; complex128} + case r.String: {mfuncy2ret0; string} + } + } +} + + +func (c *Comp) func2ret0(t xr.Type, m *funcMaker) func(*Env) r.Value { + karg0 := t.In(0).Kind() + karg1 := t.In(1).Kind() + + if !IsOptimizedKind(karg0) || !IsOptimizedKind(karg1) { + return nil + } + indexes := [2]int{ + m.parambinds[0].Desc.Index(), + m.parambinds[1].Desc.Index(), + } + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + + mfuncxy2ret0; nil + + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/function.go b/vendor/github.com/cosmos72/gomacro/fast/function.go new file mode 100644 index 0000000..1f6204e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/function.go @@ -0,0 +1,481 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * function.go + * + * Created on Apr 02, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type funcMaker struct { + nbinds int + nintbinds int + parambinds []*Bind + resultbinds []*Bind + resultfuns []I + funcbody func(*Env) +} + +// DeclFunc compiles a function, macro or method declaration +// For closure declarations, use FuncLit() +func (c *Comp) FuncDecl(funcdecl *ast.FuncDecl) { + var ismacro bool + if funcdecl.Recv != nil { + switch n := len(funcdecl.Recv.List); n { + case 0: + ismacro = true + case 1: + c.methodDecl(funcdecl) + return + default: + c.Errorf("invalid function/method declaration: found %d receivers, expecting at most one: %v", n, funcdecl) + return + } + } + functype := funcdecl.Type + t, paramnames, resultnames := c.TypeFunction(functype) + + // declare the function name and type before compiling its body: allows recursive functions/macros. + funcname := funcdecl.Name.Name + oldbind := c.Binds[funcname] + panicking := true + defer func() { + // On compile error, restore pre-existing declaration + if !panicking || c.Binds == nil { + // nothing to do + } else if oldbind != nil { + c.Binds[funcname] = oldbind + } else { + delete(c.Binds, funcname) + } + }() + var funcbind *Bind + if ismacro { + // use a ConstBind, as builtins do + funcbind = c.AddBind(funcname, ConstBind, c.TypeOfMacro()) + } else { + funcbind = c.AddBind(funcname, FuncBind, t) + } + cf := NewComp(c, nil) + info, resultfuns := cf.funcBinds(functype, t, paramnames, resultnames) + cf.Func = info + + if body := funcdecl.Body; body != nil { + // in Go, function arguments/results and function body are in the same scope + for _, node := range body.List { + cf.Stmt(node) + } + } + + funcindex := funcbind.Desc.Index() + if funcname == "_" || (!ismacro && funcindex == NoIndex) { + // function/macro named "_". still compile it (to check for compile errors) but discard the compiled code + panicking = false + return + } + // do NOT keep a reference to compile environment! + funcbody := cf.Code.Exec() + + var stmt Stmt + if ismacro { + // a macro declaration is a statement: + // executing it stores the macro function into Comp.Binds[funcname].Value + f := cf.macroCreate(t, info, resultfuns, funcbody) + + addr := &funcbind.Value + argnum := t.NumIn() + stmt = func(env *Env) (Stmt, *Env) { + fun := f(env) + *addr = Macro{fun, argnum} + env.IP++ + return env.Code[env.IP], env + } + } else { + // a function declaration is a statement: + // executing it creates the function in the runtime environment + f := cf.funcCreate(t, info, resultfuns, funcbody) + + stmt = func(env *Env) (Stmt, *Env) { + fun := f(env) + // Debugf("setting env.Binds[%d] = %v <%v>", funcindex, fun.Interface(), fun.Type()) + env.Binds[funcindex] = fun + env.IP++ + return env.Code[env.IP], env + } + } + c.Code.Append(stmt, funcdecl.Pos()) + panicking = false +} + +func (c *Comp) methodAdd(funcdecl *ast.FuncDecl, t xr.Type) (methodindex int, methods *[]r.Value) { + name := funcdecl.Name.Name + trecv := t.In(0) + if trecv.Kind() == r.Ptr && !trecv.Named() { + // receiver is an unnamed pointer type. add the method to its element type + trecv = trecv.Elem() + } + + panicking := true + defer func() { + if panicking { + rec := recover() + c.Errorf("error adding method %s <%v> to type <%v>\n\t%v", name, t, trecv, rec) + } + }() + n1 := trecv.NumMethod() + methodindex = trecv.AddMethod(name, t) + n2 := trecv.NumMethod() + if n1 == n2 { + c.Warnf("redefined method: %s.%s", trecv.Name(), name) + } + methods = trecv.GetMethods() + panicking = false + return +} + +// methodDecl compiles a method declaration +func (c *Comp) methodDecl(funcdecl *ast.FuncDecl) { + n := len(funcdecl.Recv.List) + if n != 1 { + c.Errorf("invalid function/method declaration: expecting one receiver or nil, found %d receivers: func %v %s(/*...*/)", + n, funcdecl.Recv, funcdecl.Name) + return + } + recvdecl := funcdecl.Recv.List[0] + + functype := funcdecl.Type + t, paramnames, resultnames := c.TypeFunctionOrMethod(recvdecl, functype) + + // gtype := t.GoType().Underlying().(*types.Signature) + // c.Debugf("declaring method (%v).%s%s %s\n\treflect.Type: <%v>", gtype.Recv().Type(), funcdecl.Name.Name, gtype.Params(), gtype.Results(), t.ReflectType()) + + // declare the method name and type before compiling its body: allows recursive methods + methodindex, methods := c.methodAdd(funcdecl, t) + + cf := NewComp(c, nil) + info, resultfuns := cf.funcBinds(functype, t, paramnames, resultnames) + cf.Func = info + + body := funcdecl.Body + if body != nil && len(body.List) != 0 { + // in Go, function arguments/results and function body are in the same scope + cf.List(body.List) + } + // do NOT keep a reference to compile environment! + funcbody := cf.Code.Exec() + f := cf.funcCreate(t, info, resultfuns, funcbody) + + // a method declaration is a statement: + // executing it sets the method value in the receiver type + var stmt Stmt + if c.Options&base.OptDebugMethod != 0 { + trecv := t.In(0) + tname := trecv.Name() + if len(tname) == 0 && trecv.Kind() == r.Ptr { + tname = trecv.Elem().Name() + } + methodname := funcdecl.Name + stmt = func(env *Env) (Stmt, *Env) { + (*methods)[methodindex] = f(env) + env.ThreadGlobals.Debugf("implemented method %s.%s", tname, methodname) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + (*methods)[methodindex] = f(env) + env.IP++ + return env.Code[env.IP], env + } + } + c.Code.Append(stmt, funcdecl.Pos()) +} + +// FuncLit compiles a function literal, i.e. a closure. +// For functions or methods declarations, use FuncDecl() +func (c *Comp) FuncLit(funclit *ast.FuncLit) *Expr { + functype := funclit.Type + t, paramnames, resultnames := c.TypeFunction(functype) + + cf := NewComp(c, nil) + info, resultfuns := cf.funcBinds(functype, t, paramnames, resultnames) + cf.Func = info + + body := funclit.Body + if body != nil && len(body.List) != 0 { + // in Go, function arguments/results and function body are in the same scope + cf.List(body.List) + } + // do NOT keep a reference to compile environment! + funcbody := cf.Code.Exec() + + f := cf.funcCreate(t, info, resultfuns, funcbody) + + // a function literal is an expression: + // executing it returns the function + return exprX1(t, f) +} + +// prepare the function parameter binds, result binds and FuncInfo +func (c *Comp) funcBinds(functype *ast.FuncType, t xr.Type, paramnames, resultnames []string) (info *FuncInfo, resultfuns []I) { + + parambinds := c.funcParamBinds(functype, t, paramnames) + + resultbinds, resultfuns := c.funcResultBinds(functype, t, resultnames) + namedresults := true + for _, resultname := range resultnames { + if len(resultname) == 0 { + namedresults = false + } + } + return &FuncInfo{ + Params: parambinds, + Results: resultbinds, + NamedResults: namedresults, + }, resultfuns +} + +// prepare the function parameter binds +func (c *Comp) funcParamBinds(functype *ast.FuncType, t xr.Type, names []string) []*Bind { + nin := t.NumIn() + binds := make([]*Bind, nin) + var namedparams, unnamedparams bool + ismethod := t.IsMethod() + for i := 0; i < nin; i++ { + // names[i] == "" means that argument is unnamed, and thus ignored inside the function. + // change to "_" so that AddBind will not allocate a bind for it - correct optimization... + // just remember to check for such case when creating the function + name := names[i] + if !ismethod || i != 0 { + // method receiver can be named or unnamed, independently from other input parameters + if name == "" { + name = "_" + unnamedparams = true + } else { + namedparams = true + } + } + if namedparams && unnamedparams { + c.Errorf("cannot mix named and unnamed parameters in function declaration: %v", functype) + } + bind := c.AddBind(name, VarBind, t.In(i)) + binds[i] = bind + } + return binds +} + +// prepare the function result binds +func (c *Comp) funcResultBinds(functype *ast.FuncType, t xr.Type, names []string) (binds []*Bind, funs []I) { + n := t.NumOut() + binds = make([]*Bind, n) + funs = make([]I, n) + var namedresults, unnamedresults bool + for i, n := 0, t.NumOut(); i < n; i++ { + // names[i] == "" means that result is unnamed. + // we must still allocate a bind for it. + name := names[i] + if name == "" { + unnamedresults = true + } else { + namedresults = true + } + if namedresults && unnamedresults { + c.Errorf("cannot mix named and unnamed results in function declaration: %v", functype) + } + c.Pos = functype.Pos() + bind := c.DeclVar0(name, t.Out(i), nil) + binds[i] = bind + // compile the extraction of results from runtime env + sym := bind.AsSymbol(0) + funs[i] = c.Symbol(sym).WithFun() + } + return +} + +func (c *Comp) funcMaker(info *FuncInfo, resultfuns []I, funcbody func(*Env)) *funcMaker { + return &funcMaker{ + nbinds: c.BindNum, + nintbinds: c.IntBindNum, + parambinds: info.Params, + resultbinds: info.Results, + resultfuns: resultfuns, + funcbody: funcbody, + } +} + +// actually create the function +func (c *Comp) funcCreate(t xr.Type, info *FuncInfo, resultfuns []I, funcbody func(*Env)) func(*Env) r.Value { + c.ErrorIfCompiled(t) + + m := c.funcMaker(info, resultfuns, funcbody) + + rtype := t.ReflectType() // has receiver as first parameter + nin := rtype.NumIn() + nout := rtype.NumOut() + + // do not create optimized functions if arguments or results are named types + optimize := true + for i := 0; optimize && i < nin; i++ { + rt := rtype.In(i) + k := rt.Kind() + optimize = base.IsOptimizedKind(k) && rt == c.Universe.BasicTypes[k].ReflectType() + } + for i := 0; optimize && i < nout; i++ { + rt := rtype.Out(i) + k := rt.Kind() + optimize = base.IsOptimizedKind(k) && rt == c.Universe.BasicTypes[k].ReflectType() + } + + var fun func(*Env) r.Value + if optimize { + switch nin { + case 0: + switch nout { + case 0: + fun = c.func0ret0(t, m) + case 1: + fun = c.func0ret1(t, m) + } + case 1: + switch nout { + case 0: + fun = c.func1ret0(t, m) + case 1: + fun = c.func1ret1(t, m) + } + case 2: + switch nout { + case 0: + fun = c.func2ret0(t, m) + } + } + } + if fun == nil { + fun = c.funcGeneric(t, m) + } + return fun +} + +// fallback: create a non-optimized function +func (c *Comp) funcGeneric(t xr.Type, m *funcMaker) func(*Env) r.Value { + + paramdecls := make([]func(*Env, r.Value), len(m.parambinds)) + for i, bind := range m.parambinds { + if bind.Desc.Index() != NoIndex { + paramdecls[i] = c.DeclBindRuntimeValue(bind) + } + } + resultexprs := make([]func(*Env) r.Value, len(m.resultfuns)) + for i, resultfun := range m.resultfuns { + resultexprs[i] = funAsX1(resultfun, m.resultbinds[i].Type) + } + + // do NOT keep a reference to funcMaker + nbinds := m.nbinds + nintbinds := m.nintbinds + funcbody := m.funcbody + rtype := t.ReflectType() + + return func(env *Env) r.Value { + // function is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return r.MakeFunc(rtype, func(args []r.Value) []r.Value { + env := NewEnv4Func(env, nbinds, nintbinds) + + if funcbody != nil { + // copy runtime arguments into allocated binds + for i, decl := range paramdecls { + if decl != nil { + // decl == nil means the argument is ignored inside the function + decl(env, args[i]) + } + } + // execute the body + funcbody(env) + } + // read results from allocated binds and return them + rets := make([]r.Value, len(resultexprs)) + for i, expr := range resultexprs { + rets[i] = expr(env) + } + env.FreeEnv() + return rets + }) + } +} + +// create a macro +func (c *Comp) macroCreate(t xr.Type, info *FuncInfo, resultfuns []I, funcbody func(*Env)) func(*Env) func(args []r.Value) []r.Value { + m := c.funcMaker(info, resultfuns, funcbody) + + paramdecls := make([]func(*Env, r.Value), len(m.parambinds)) + for i, bind := range m.parambinds { + if bind.Desc.Index() != NoIndex { + paramdecls[i] = c.DeclBindRuntimeValue(bind) + } + } + resultexprs := make([]func(*Env) r.Value, len(m.resultfuns)) + for i, resultfun := range m.resultfuns { + resultexprs[i] = funAsX1(resultfun, m.resultbinds[i].Type) + } + + // do NOT keep a reference to funcMaker + nbinds := m.nbinds + nintbinds := m.nintbinds + + return func(env *Env) func(args []r.Value) []r.Value { + // macro is closed over the env used to DECLARE it + env.MarkUsedByClosure() + return func(args []r.Value) []r.Value { + env := NewEnv4Func(env, nbinds, nintbinds) + + if funcbody != nil { + // copy runtime arguments into allocated binds + for i, decl := range paramdecls { + if decl != nil { + // decl == nil means the argument is ignored inside the function + decl(env, args[i]) + } + } + // execute the body + funcbody(env) + } + // read results from allocated binds and return them + rets := make([]r.Value, len(resultexprs)) + for i, expr := range resultexprs { + rets[i] = expr(env) + } + env.FreeEnv() + return rets + } + } +} + +func declBindRuntimeValueNop(*Env, r.Value) { +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/global.go b/vendor/github.com/cosmos72/gomacro/fast/global.go new file mode 100644 index 0000000..a7a7474 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/global.go @@ -0,0 +1,577 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * global.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "fmt" + "go/ast" + "go/constant" + "go/token" + r "reflect" + "sort" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// opaqueTypeOf returns an xr.Type with the same name and package as r.TypeOf(val) but without fields or methods +func (g *CompThreadGlobals) opaqueType(rtype r.Type) xr.Type { + if k := rtype.Kind(); k != r.Struct { + g.Errorf("internal error: unimplemented opaqueTypeOf for kind=%v, expecting kind=Struct", k) + } + v := g.Universe + t := v.NamedOf(rtype.Name(), "fast") + t.SetUnderlying(v.TypeOf(struct{}{})) + t.UnsafeForceReflectType(rtype) + v.ReflectTypes[rtype] = t // also cache Type in g.Universe.ReflectTypes + // g.Debugf("initialized opaque type %v <%v> <%v>", t.Kind(), t.GoType(), t.ReflectType()) + return t +} + +// ================================= Untyped ================================= + +// UntypedLit represents an untyped literal value, i.e. an untyped constant +type UntypedLit struct { + Kind r.Kind // default type. matches Obj.Kind() except for rune literals, where Kind == reflect.Int32 + Obj constant.Value + Universe *xr.Universe +} + +var ( + untypedZero = UntypedLit{Kind: r.Int, Obj: constant.MakeInt64(0)} + untypedOne = UntypedLit{Kind: r.Int, Obj: constant.MakeInt64(1)} +) + +// pretty-print untyped constants +func (untyp UntypedLit) String() string { + obj := untyp.Obj + var strkind, strobj interface{} = untyp.Kind, nil + if untyp.Kind == r.Int32 { + strkind = "rune" + if obj.Kind() == constant.Int { + if i, exact := constant.Int64Val(obj); exact { + if i >= 0 && i <= 0x10FFFF { + strobj = fmt.Sprintf("%q", i) + } + } + } + } + if strobj == nil { + strobj = obj.ExactString() + } + return fmt.Sprintf("{%v %v}", strkind, strobj) +} + +// ================================= Lit ================================= + +// Lit represents a literal value, i.e. a typed or untyped constant +type Lit struct { + + // Type is nil only for literal nils. + // for all other literals, it is reflect.TypeOf(Lit.Value) + // + // when Lit is embedded in other structs that represent non-constant expressions, + // Type is the first type returned by the expression (nil if returns no values) + Type xr.Type + + // Value is one of: + // nil, bool, int, int8, int16, int32, int64, + // uint, uint8, uint16, uint32, uint64, uintptr, + // float32, float64, complex64, complex128, string, + // UntypedLit + // + // when Lit is embedded in other structs that represent non-constant expressions, + // Value is usually nil + Value I +} + +// Untyped returns true if Lit is an untyped constant +func (lit *Lit) Untyped() bool { + _, ok := lit.Value.(UntypedLit) + return ok +} + +// UntypedKind returns the reflect.Kind of untyped constants, +// i.e. their "default type" +func (lit *Lit) UntypedKind() r.Kind { + if untyp, ok := lit.Value.(UntypedLit); ok { + return untyp.Kind + } else { + return r.Invalid + } +} + +func (lit *Lit) ReflectValue() r.Value { + if lit.Untyped() { + // do not modify original Lit type + tmp := *lit + lit = &tmp + lit.ConstTo(lit.DefaultType()) + } + v := r.ValueOf(lit.Value) + if lit.Type != nil { + rtype := lit.Type.ReflectType() + if !v.IsValid() { + v = r.Zero(rtype) + } else if v.Type() != rtype { + v = v.Convert(rtype) + } + } + return v +} + +func (lit Lit) String() string { + switch val := lit.Value.(type) { + case string, nil: + return fmt.Sprintf("%#v", val) + default: + return fmt.Sprintf("%v", val) + } +} + +// ================================= Expr ================================= + +// Expr represents an expression in the "compiler" +type Expr struct { + Lit + Types []xr.Type // in case the expression produces multiple values. if nil, use Lit.Type. + Fun I // function that evaluates the expression at runtime. + Sym *Symbol // in case the expression is a symbol + IsNil bool +} + +func (e *Expr) Const() bool { + return e.Value != nil || e.IsNil +} + +// NumOut returns the number of values that an expression will produce when evaluated +func (e *Expr) NumOut() int { + if e.Types == nil { + return 1 + } + return len(e.Types) +} + +// Out returns the i-th type that an expression will produce when evaluated +func (e *Expr) Out(i int) xr.Type { + if i == 0 && e.Types == nil { + return e.Type + } + return e.Types[i] +} + +// Outs returns the types that an expression will produce when evaluated +func (e *Expr) Outs() []xr.Type { + if e.Types == nil { + return []xr.Type{e.Type} + } + return e.Types +} + +func (e *Expr) String() string { + if e == nil { + return "nil" + } + var str string + if e.Const() { + str = fmt.Sprintf("Expr{Type: %v, Value: %v}", e.Type, e.Lit.String()) + } else if e.NumOut() == 1 { + str = fmt.Sprintf("Expr{Type: %v, Fun: %#v}", e.Type, e.Fun) + } else { + str = fmt.Sprintf("Expr{Types: %v, Fun: %#v}", e.Types, e.Fun) + } + return str +} + +// ================================= Stmt ================================= + +// Stmt represents a statement in the fast interpreter +type Stmt func(*Env) (Stmt, *Env) + +// ================================= Builtin ================================= + +// Builtin represents a builtin function in the fast interpreter +type Builtin struct { + // interpreted code should not access "compile": not exported. + // compile usually needs to modify Symbol: pass it by value. + Compile func(c *Comp, sym Symbol, node *ast.CallExpr) *Call + ArgMin uint16 + ArgMax uint16 +} + +// ================================= Function ================================= + +// Function represents a function that accesses *CompEnv in the fast interpreter +type Function struct { + Fun interface{} + Type xr.Type +} + +// ================================= Macro ================================= + +// Macro represents a macro in the fast interpreter +type Macro struct { + closure func(args []r.Value) (results []r.Value) + argNum int +} + +// ================================= BindClass ================================= + +type BindClass int + +const ( + ConstBind = BindClass(iota) + FuncBind + VarBind + IntBind +) + +func (class BindClass) String() string { + switch class { + case ConstBind: + return "const" + case FuncBind: + return "func" + default: + return "var" + } +} + +// ================================== BindDescriptor ================================= + +// the zero value of BindDescriptor is a valid descriptor for all constants +type BindDescriptor BindClass + +const ( + bindClassMask = BindClass(0x3) + bindIndexShift = 2 + + NoIndex = int(0) // index of constants, functions and variables named "_" + ConstBindDescriptor = BindDescriptor(ConstBind) // bind descriptor for all constants +) + +func MakeBindDescriptor(class BindClass, index int) BindDescriptor { + class &= bindClassMask + return BindDescriptor(index<> bindIndexShift) + // debugf("BindDescriptor=%v, class=%v, index=%v", desc, desc.Class(), index) + return index +} + +func (desc BindDescriptor) Settable() bool { + class := desc.Class() + return class == IntBind || class == VarBind +} + +func (desc BindDescriptor) String() string { + return fmt.Sprintf("%s index=%d", desc.Class(), desc.Index()) +} + +// ================================== Bind ================================= + +// Bind represents a constant, variable, function or builtin in the "compiler" +type Bind struct { + Lit + Desc BindDescriptor + Name string +} + +func (bind *Bind) String() string { + return fmt.Sprintf("{%s name=%q value=%v type=<%v>}", bind.Desc, bind.Name, bind.Lit.Value, bind.Lit.Type) +} + +func (bind *Bind) Const() bool { + return bind.Desc.Class() == ConstBind +} + +func (bind *Bind) ConstValue() r.Value { + if !bind.Const() { + return Nil + } + return bind.Lit.ReflectValue() +} + +func (c *Comp) BindUntyped(value UntypedLit) *Bind { + value.Universe = c.Universe + return &Bind{Lit: Lit{Type: c.TypeOfUntypedLit(), Value: value}, Desc: ConstBindDescriptor} +} + +func (bind *Bind) AsVar(upn int, opt PlaceOption) *Var { + class := bind.Desc.Class() + switch class { + case VarBind, IntBind: + return &Var{Upn: upn, Desc: bind.Desc, Type: bind.Type, Name: bind.Name} + default: + Errorf("%s a %s: %s <%v>", opt, class, bind.Name, bind.Type) + return nil + } +} + +func (bind *Bind) AsSymbol(upn int) *Symbol { + return &Symbol{Bind: *bind, Upn: upn} +} + +type NamedType struct { + Name, Path string +} + +// ================================== Symbol, Var, Place ================================= + +// Symbol represents a resolved constant, function, variable or builtin +type Symbol struct { + Bind + Upn int +} + +func (sym *Symbol) AsVar(opt PlaceOption) *Var { + return sym.Bind.AsVar(sym.Upn, opt) +} + +// Var represents a settable variable +type Var struct { + // when Var is embedded in other structs that represent non-identifiers, + // Upn and Desc are usually the zero values + Upn int + Desc BindDescriptor + Type xr.Type + Name string +} + +func (va *Var) AsSymbol() *Symbol { + return &Symbol{ + Bind: Bind{ + Lit: Lit{Type: va.Type}, + Desc: va.Desc, + Name: va.Name, + }, + Upn: va.Upn, + } +} + +func (va *Var) AsPlace() *Place { + return &Place{Var: *va} +} + +// Place represents a settable place or, equivalently, its address +type Place struct { + Var + // Fun is nil for variables. + // For non-variables, returns a settable and addressable reflect.Value: the place itself. + // For map[key], Fun returns the map itself (which may NOT be settable). + // Call Fun only once, it may have side effects! + Fun func(*Env) r.Value + // Fddr is nil for variables. + // For non-variables, it will return the address of the place. + // For map[key], it is nil since map[key] is not addressable + // Call Addr only once, it may have side effects! + Addr func(*Env) r.Value + // used only for map[key], returns key. call it only once, it may have side effects! + MapKey func(*Env) r.Value + MapType xr.Type +} + +func (place *Place) IsVar() bool { + return place.Fun == nil +} + +type PlaceOption bool // the reason why we want a place: either to write into it, or to take its address + +const ( + PlaceSettable PlaceOption = false + PlaceAddress PlaceOption = true +) + +func (opt PlaceOption) String() string { + if opt == PlaceAddress { + return "cannot take the address of" + } else { + return "cannot assign to" + } +} + +// ================================= Import ================================= + +// Import represents an imported package +type Import struct { + // no need to split compile-time bind descriptors map from runtime values slice, + // because an import is a singleton - cannot be "instantiated" multiple times. + // Instead function or block activation record (*Env) can: + // think about goroutines, recursive functions or even loops. + Binds map[string]r.Value + BindTypes map[string]xr.Type + Types map[string]xr.Type + Name, Path string +} + +// ================================== Comp, Env ================================= + +type CompileOptions int + +const ( + OptKeepUntyped CompileOptions = 1 << iota // if set, Compile() on expressions will keep all untyped constants as such (in expressions where Go compiler would compute an untyped constant too) + OptIsCompiled // if set, packages is at least partially compiled. Effect: variables may be pre-existing, so Comp.intBinds cannot be used + OptDefaults CompileOptions = 0 +) + +func (opts CompileOptions) IsCompiled() bool { + return opts&OptIsCompiled != 0 +} + +type Code struct { + List []Stmt + DebugPos []token.Pos // for debugging interpreted code: position of each statement + WithDefers bool // true if code contains some defers +} + +type LoopInfo struct { + Break *int + Continue *int + Labels map[string]*int + ThisLabels []string // sorted. for labeled "switch" and "for" +} + +func (l *LoopInfo) HasLabel(label string) bool { + i := sort.SearchStrings(l.ThisLabels, label) + return i >= 0 && i < len(l.ThisLabels) && l.ThisLabels[i] == label +} + +type FuncInfo struct { + Params []*Bind + Results []*Bind + NamedResults bool +} + +const ( + PoolCapacity = 32 +) + +// ThreadGlobals contains per-goroutine interpreter runtime bookeeping information +type ThreadGlobals struct { + FileEnv *Env + TopEnv *Env + Interrupt Stmt + Signal Signal // set by interrupts: Return, Defer... + PoolSize int + Pool [PoolCapacity]*Env + InstallDefer func() // defer function to be installed + Panic interface{} // current panic. needed for recover() + PanicFun *Env // the currently panicking function + DeferOfFun *Env // function whose defer are running + StartDefer bool // true if next executed function body is a defer + IsDefer bool // true if function body being executed is a defer + *Globals +} + +// CompGlobals contains per-goroutine interpreter compile bookeeping information +type CompThreadGlobals struct { + Universe *xr.Universe + interf2proxy map[r.Type]r.Type // interface -> proxy + proxy2interf map[r.Type]xr.Type // proxy -> interface + *Globals +} + +// Comp is a tree-of-closures builder: it transforms ast.Nodes into closures +// for faster execution. Consider it a poor man's compiler (hence the name) +type Comp struct { + Binds map[string]*Bind + BindNum int // len(Binds) == BindNum + IntBindNum + # of constants + IntBindNum int + // UpCost is the number of *Env.Outer hops to perform at runtime to reach the *Env corresponding to *Comp.Outer + // usually equals one. will be zero if this *Comp defines no local variables/functions. + UpCost int + Depth int + Types map[string]xr.Type + Code Code // "compiled" code + Loop *LoopInfo // != nil when compiling a for or switch + Func *FuncInfo // != nil when compiling a function + Outer *Comp + Name string // set by "package" directive + Path string + CompileOptions CompileOptions + *CompThreadGlobals +} + +const ( + // conventional values + AnyDepth = -1 + FileDepth = -2 + TopDepth = -3 +) + +type Signal int + +const ( + SigNone Signal = iota + SigReturn + SigDefer // request to install a defer function +) + +// Env is the interpreter's runtime environment +type Env struct { + Binds []r.Value + IntBinds []uint64 + Outer *Env + IP int + Code []Stmt + DebugPos []token.Pos // for debugging interpreted code: position of each statement + ThreadGlobals *ThreadGlobals + UsedByClosure bool // a bitfield would introduce more races among goroutines + AddressTaken bool // true if &Env.IntBinds[index] was executed... then we cannot reuse IntBinds +} + +type ( + I interface{} + /* + XBool func(*Env) bool + XInt func(*Env) int + XInt8 func(*Env) int8 + XInt16 func(*Env) int16 + XInt32 func(*Env) int32 + XInt64 func(*Env) int64 + XUint func(*Env) uint + XUint8 func(*Env) uint8 + XUint16 func(*Env) uint16 + XUint32 func(*Env) uint32 + XUint64 func(*Env) uint64 + XUintptr func(*Env) uintptr + XFloat32 func(*Env) float32 + XFloat64 func(*Env) float64 + XComplex64 func(*Env) complex64 + XComplex128 func(*Env) complex128 + XString func(*Env) string + XV func(*Env) (r.Value, []r.Value) + */ +) diff --git a/vendor/github.com/cosmos72/gomacro/fast/identifier.go b/vendor/github.com/cosmos72/gomacro/fast/identifier.go new file mode 100644 index 0000000..b655e3a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/identifier.go @@ -0,0 +1,937 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * identifier.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" +) + +func (c *Comp) IsCompiledOuter(upn int) bool { + for ; upn > 0; upn-- { + for c.UpCost == 0 { + c = c.Outer + } + c = c.Outer + } + for c.UpCost == 0 { + c = c.Outer + } + return c.IsCompiled() +} + +func (c *Comp) Resolve(name string) *Symbol { + sym := c.TryResolve(name) + if sym == nil { + c.Errorf("undefined identifier: %v", name) + } + return sym +} + +func (c *Comp) TryResolve(name string) *Symbol { + upn := 0 + for ; c != nil; c = c.Outer { + if bind, ok := c.Binds[name]; ok { + // c.Debugf("TryResolve: %s is upn=%d %v", name, upn, bind) + return bind.AsSymbol(upn) + } + upn += c.UpCost // c.UpCost is zero if *Comp has no local variables/functions so it will NOT have a corresponding *Env at runtime + } + return nil +} + +// Ident compiles a read operation on a constant, variable or function +func (c *Comp) Ident(name string) *Expr { + return c.Symbol(c.Resolve(name)) +} + +// IdentPlace compiles an assignment to a variable, or taking the address of a variable +func (c *Comp) IdentPlace(name string, opt PlaceOption) *Place { + if name == "_" { + if opt == PlaceAddress { + c.Errorf("%s _", opt) + return nil + } + // assignment to _ is allowed: it does nothing + bind := c.AddBind(name, VarBind, c.TypeOfInterface()) + return &Place{Var: *bind.AsVar(0, PlaceSettable)} + } + sym := c.Resolve(name) + return &Place{Var: *sym.AsVar(opt)} +} + +// Symbol compiles a read operation on a constant, variable or function +func (c *Comp) Symbol(sym *Symbol) *Expr { + switch sym.Desc.Class() { + case ConstBind: + return exprLit(sym.Lit, sym) + case VarBind, FuncBind: + return c.symbol(sym) + case IntBind: + if c.IsCompiledOuter(sym.Upn) { + return c.symbol(sym) + } else { + return c.intSymbol(sym) + } + default: + c.Errorf("unknown symbol class %s", sym.Desc.Class()) + } + return nil +} + +func (c *Comp) symbol(sym *Symbol) *Expr { + idx := sym.Desc.Index() + upn := sym.Upn + kind := sym.Type.Kind() + var fun I + switch upn { + case 0: + // if package is (partially) compiled, kind can also be one of Bool, Int*, Uint*, Float*, Complex64 + switch kind { + case r.Bool: + fun = func(env *Env) bool { + return env.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(env.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(env.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(env.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(env.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return env.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(env.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(env.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(env.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(env.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(env.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(env.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return env.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(env.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return env.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + return env.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + return env.Binds[idx] + } + } + case 1: + switch kind { + case r.Bool: + fun = func(env *Env) bool { + return env.Outer.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(env.Outer.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(env.Outer.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(env.Outer.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(env.Outer.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return env.Outer.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(env.Outer.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(env.Outer.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(env.Outer.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(env.Outer.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.Outer.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(env.Outer.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(env.Outer.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return env.Outer.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(env.Outer.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return env.Outer.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + return env.Outer.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + return env.Outer.Binds[idx] + } + } + case 2: + switch kind { + case r.Bool: + fun = func(env *Env) bool { + return env.Outer.Outer.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(env.Outer.Outer.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(env.Outer.Outer.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(env.Outer.Outer.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(env.Outer.Outer.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return env.Outer.Outer.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(env.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(env.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(env.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(env.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.Outer.Outer.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(env.Outer.Outer.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(env.Outer.Outer.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return env.Outer.Outer.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(env.Outer.Outer.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return env.Outer.Outer.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + return env.Outer.Outer.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + return env.Outer.Outer.Binds[idx] + } + } + default: + switch kind { + case r.Bool: + fun = func(env *Env) bool { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + for i := 3; i < upn; i++ { + env = env.Outer + } + return int(env.Outer.Outer.Outer.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return int8(env.Outer.Outer.Outer.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return int16(env.Outer.Outer.Outer.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return int32(env.Outer.Outer.Outer.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + for i := 3; i < upn; i++ { + env = env.Outer + } + return uint(env.Outer.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return uint8(env.Outer.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return uint16(env.Outer.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return uint32(env.Outer.Outer.Outer.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + for i := 3; i < upn; i++ { + env = env.Outer + } + return uintptr(env.Outer.Outer.Outer.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return float32(env.Outer.Outer.Outer.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return complex64(env.Outer.Outer.Outer.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.Outer.Binds[idx] + } + } + case c.Depth - 1: + switch kind { + case r.Bool: + fun = func(env *Env) bool { + return env.ThreadGlobals.FileEnv.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(env.ThreadGlobals.FileEnv.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(env.ThreadGlobals.FileEnv.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(env.ThreadGlobals.FileEnv.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(env.ThreadGlobals.FileEnv.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return env.ThreadGlobals.FileEnv.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(env.ThreadGlobals.FileEnv.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(env.ThreadGlobals.FileEnv.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(env.ThreadGlobals.FileEnv.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(env.ThreadGlobals.FileEnv.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.ThreadGlobals.FileEnv.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(env.ThreadGlobals.FileEnv.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(env.ThreadGlobals.FileEnv.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return env.ThreadGlobals.FileEnv.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(env.ThreadGlobals.FileEnv.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return env.ThreadGlobals.FileEnv.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + return env.ThreadGlobals.FileEnv.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + return env.ThreadGlobals.FileEnv.Binds[idx] + } + } + case c.Depth: // TopEnv should not contain variables or functions... but no harm + switch kind { + case r.Bool: + fun = func(env *Env) bool { + return env.ThreadGlobals.TopEnv.Binds[idx].Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(env.ThreadGlobals.TopEnv.Binds[idx].Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(env.ThreadGlobals.TopEnv.Binds[idx].Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(env.ThreadGlobals.TopEnv.Binds[idx].Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(env.ThreadGlobals.TopEnv.Binds[idx].Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return env.ThreadGlobals.TopEnv.Binds[idx].Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(env.ThreadGlobals.TopEnv.Binds[idx].Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(env.ThreadGlobals.TopEnv.Binds[idx].Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(env.ThreadGlobals.TopEnv.Binds[idx].Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(env.ThreadGlobals.TopEnv.Binds[idx].Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.ThreadGlobals.TopEnv.Binds[idx].Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(env.ThreadGlobals.TopEnv.Binds[idx].Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(env.ThreadGlobals.TopEnv.Binds[idx].Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return env.ThreadGlobals.TopEnv.Binds[idx].Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(env.ThreadGlobals.TopEnv.Binds[idx].Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return env.ThreadGlobals.TopEnv.Binds[idx].Complex() + } + case r.String: + fun = func(env *Env) string { + return env.ThreadGlobals.TopEnv.Binds[idx].String() + } + default: + fun = func(env *Env) r.Value { + return env.ThreadGlobals.TopEnv.Binds[idx] + } + } + } + return &Expr{Lit: Lit{Type: sym.Type}, Fun: fun, Sym: sym} +} + +func (c *Comp) intSymbol(sym *Symbol) *Expr { + k := sym.Type.Kind() + idx := sym.Desc.Index() + upn := sym.Upn + var fun I + switch upn { + case 0: + switch k { + case r.Bool: + fun = func(env *Env) bool { + return *(*bool)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Int: + fun = func(env *Env) int { + return *(*int)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Int8: + fun = func(env *Env) int8 { + return *(*int8)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Int16: + fun = func(env *Env) int16 { + return *(*int16)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Int32: + fun = func(env *Env) int32 { + return *(*int32)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Int64: + fun = func(env *Env) int64 { + return *(*int64)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Uint: + fun = func(env *Env) uint { + return *(*uint)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return *(*uint8)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return *(*uint16)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return *(*uint32)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.IntBinds[idx] + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return *(*uintptr)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Float32: + fun = func(env *Env) float32 { + return *(*float32)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Float64: + fun = func(env *Env) float64 { + return *(*float64)(unsafe.Pointer(&env.IntBinds[idx])) + } + case r.Complex64: + fun = func(env *Env) complex64 { + return *(*complex64)(unsafe.Pointer(&env.IntBinds[idx])) + } + default: + c.Errorf("unsupported symbol type, cannot use for optimized read: %s %s <%v>", sym.Desc.Class(), sym.Name, sym.Type) + return nil + } + case 1: + switch k { + case r.Bool: + fun = func(env *Env) bool { + return *(*bool)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Int: + fun = func(env *Env) int { + return *(*int)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Int8: + fun = func(env *Env) int8 { + return *(*int8)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Int16: + fun = func(env *Env) int16 { + return *(*int16)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Int32: + fun = func(env *Env) int32 { + return *(*int32)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Int64: + fun = func(env *Env) int64 { + return *(*int64)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Uint: + fun = func(env *Env) uint { + return *(*uint)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return *(*uint8)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return *(*uint16)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return *(*uint32)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.Outer.IntBinds[idx] + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return *(*uintptr)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Float32: + fun = func(env *Env) float32 { + return *(*float32)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Float64: + fun = func(env *Env) float64 { + return *(*float64)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + case r.Complex64: + fun = func(env *Env) complex64 { + return *(*complex64)(unsafe.Pointer(&env.Outer.IntBinds[idx])) + } + default: + c.Errorf("unsupported variable type, cannot use for optimized read: %s <%v>", sym.Name, sym.Type) + return nil + } + case 2: + switch k { + case r.Bool: + fun = func(env *Env) bool { + return *(*bool)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int: + fun = func(env *Env) int { + return *(*int)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int8: + fun = func(env *Env) int8 { + return *(*int8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int16: + fun = func(env *Env) int16 { + return *(*int16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int32: + fun = func(env *Env) int32 { + return *(*int32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int64: + fun = func(env *Env) int64 { + return *(*int64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint: + fun = func(env *Env) uint { + return *(*uint)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return *(*uint8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return *(*uint16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return *(*uint32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return env.Outer.Outer.IntBinds[idx] + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return *(*uintptr)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Float32: + fun = func(env *Env) float32 { + return *(*float32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Float64: + fun = func(env *Env) float64 { + return *(*float64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Complex64: + fun = func(env *Env) complex64 { + return *(*complex64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + default: + c.Errorf("unsupported variable type, cannot use for optimized read: %s <%v>", sym.Name, sym.Type) + return nil + } + default: + switch k { + case r.Bool: + fun = func(env *Env) bool { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*bool)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int: + fun = func(env *Env) int { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*int)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int8: + fun = func(env *Env) int8 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*int8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int16: + fun = func(env *Env) int16 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*int16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int32: + fun = func(env *Env) int32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*int32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Int64: + fun = func(env *Env) int64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*int64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint: + fun = func(env *Env) uint { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*uint)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint8: + fun = func(env *Env) uint8 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*uint8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint16: + fun = func(env *Env) uint16 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*uint16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint32: + fun = func(env *Env) uint32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*uint32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Uint64: + fun = func(env *Env) uint64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return env.Outer.Outer.IntBinds[idx] + } + case r.Uintptr: + fun = func(env *Env) uintptr { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*uintptr)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Float32: + fun = func(env *Env) float32 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*float32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Float64: + fun = func(env *Env) float64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*float64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + case r.Complex64: + fun = func(env *Env) complex64 { + for i := 3; i < upn; i++ { + env = env.Outer + } + return *(*complex64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[idx])) + } + default: + c.Errorf("unsupported variable type, cannot use for optimized read: %s <%v>", sym.Name, sym.Type) + return nil + } + } + return &Expr{Lit: Lit{Type: sym.Type}, Fun: fun, Sym: sym} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/import.go b/vendor/github.com/cosmos72/gomacro/fast/import.go new file mode 100644 index 0000000..28a8ac7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/import.go @@ -0,0 +1,252 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * import.go + * + * Created on Apr 02, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/types" + r "reflect" + "strconv" + "strings" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// Import compiles an import statement +func (c *Comp) Import(node ast.Spec) { + switch node := node.(type) { + case *ast.ImportSpec: + str := node.Path.Value + path, err := strconv.Unquote(str) + if err != nil { + c.Errorf("error unescaping import path %q: %v", str, err) + } + path = c.sanitizeImportPath(path) + var name string + if node.Name != nil { + name = node.Name.Name + } else { + name = path[1+strings.LastIndexByte(path, '/'):] + } + // yes, we support local imports + // i.e. a function or block can import packages + c.ImportPackage(name, path) + default: + c.Errorf("unimplemented import: %v", node) + } +} + +func (g *CompThreadGlobals) sanitizeImportPath(path string) string { + path = strings.Replace(path, "\\", "/", -1) + l := len(path) + if path == ".." || l >= 3 && (path[:3] == "../" || path[l-3:] == "/..") || strings.Contains(path, "/../") { + g.Errorf("invalid import %q: contains \"..\"", path) + } + if path == "." || l >= 2 && (path[:2] == "./" || path[l-2:] == "/.") || strings.Contains(path, "/./") { + g.Errorf("invalid import %q: contains \".\"", path) + } + return path +} + +// Import imports a package. Usually invoked as Comp.FileComp().ImportPackage(name, path) +// because imports are usually top-level statements in a source file. +// But we also support local imports, i.e. import statements inside a function or block. +func (c *Comp) ImportPackage(name, path string) *Import { + g := c.CompThreadGlobals + pkgref := g.ImportPackage(name, path) + if pkgref == nil { + return nil + } + binds, bindtypes := g.parseImportBinds(pkgref.Binds, pkgref.Untypeds) + + imp := Import{ + Binds: binds, + BindTypes: bindtypes, + Types: g.parseImportTypes(pkgref.Types, pkgref.Wrappers), + Name: name, + Path: path, + } + + g.loadProxies(pkgref.Proxies, imp.Types) + + c.declImport0(name, imp) + return &imp +} + +// declImport0 compiles an import declaration. +// Note: does not loads proxies, use ImportPackage for that +func (c *Comp) declImport0(name string, imp Import) { + // treat imported package as a constant, + // because to compile code we need the declarations it contains: + // importing them at runtime would be too late. + t := c.TypeOfImport() + bind := c.AddBind(name, ConstBind, t) + bind.Value = imp // cfile.Binds[] is a map[string]*Bind => changes to *Bind propagate to the map +} + +func (g *CompThreadGlobals) parseImportBinds(binds map[string]r.Value, untypeds map[string]string) (map[string]r.Value, map[string]xr.Type) { + retbinds := make(map[string]r.Value) + rettypes := make(map[string]xr.Type) + for name, bind := range binds { + if untyped, ok := untypeds[name]; ok { + value, typ, ok := g.parseImportUntyped(untyped) + if ok { + retbinds[name] = value + rettypes[name] = typ + continue + } + } + retbinds[name] = bind + rettypes[name] = g.Universe.FromReflectType(bind.Type()) + } + return retbinds, rettypes +} + +func (g *CompThreadGlobals) parseImportUntyped(untyped string) (r.Value, xr.Type, bool) { + gkind, value := UnmarshalUntyped(untyped) + if gkind == types.Invalid { + return Nil, nil, false + } + lit := UntypedLit{Kind: xr.ToReflectKind(gkind), Obj: value, Universe: g.Universe} + return r.ValueOf(lit), g.TypeOfUntypedLit(), true +} + +func (g *CompThreadGlobals) parseImportTypes(rtypes map[string]r.Type, wrappers map[string][]string) map[string]xr.Type { + v := g.Universe + xtypes := make(map[string]xr.Type) + for name, rtype := range rtypes { + // Universe.FromReflectType uses cached *types.Package if possible + t := v.FromReflectType(rtype) + if twrappers := wrappers[name]; len(twrappers) != 0 { + t.RemoveMethods(twrappers, "") + } + xtypes[name] = t + } + return xtypes +} + +// loadProxies adds to thread-global maps the proxies found in import +func (g *CompThreadGlobals) loadProxies(proxies map[string]r.Type, xtypes map[string]xr.Type) { + for name, proxy := range proxies { + xtype := xtypes[name] + if xtype == nil { + g.Warnf("import %q: type not found for proxy <%v>", proxy.PkgPath(), proxy) + continue + } + if xtype.Kind() != r.Interface { + g.Warnf("import %q: type for proxy <%v> is not an interface: %v", proxy.PkgPath(), proxy, xtype) + continue + } + rtype := xtype.ReflectType() + g.interf2proxy[rtype] = proxy + g.proxy2interf[proxy] = xtype + } +} + +// v is an imported variable. build a function that will return it. +// Do NOT expose its value while compiling, otherwise the fast interpreter +// will (incorrectly) assume that it's a constant and will perform constant propagation. +// +// mandatory optimization: for basic kinds, unwrap reflect.Value +func importedBindAsFun(t xr.Type, v r.Value) I { + var fun I + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + return v.Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(v.Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(v.Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(v.Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(v.Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return v.Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(v.Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(v.Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(v.Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(v.Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return v.Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(v.Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(v.Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return v.Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(v.Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return v.Complex() + } + case r.String: + fun = func(env *Env) string { + return v.String() + } + default: + fun = func(env *Env) r.Value { + return v + } + } + return fun +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/index.go b/vendor/github.com/cosmos72/gomacro/fast/index.go new file mode 100644 index 0000000..59ba864 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/index.go @@ -0,0 +1,998 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * index.go + * + * Created on Apr 23, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) IndexExpr(node *ast.IndexExpr) *Expr { return c.indexExpr(node, true) } +func (c *Comp) IndexExpr1(node *ast.IndexExpr) *Expr { return c.indexExpr(node, false) } +func (c *Comp) indexExpr(node *ast.IndexExpr, multivalued bool) *Expr { + obj := c.Expr1(node.X) + idx := c.Expr1(node.Index) + if obj.Untyped() { + obj.ConstTo(obj.DefaultType()) + } + + t := obj.Type + var ret *Expr + switch t.Kind() { + case r.Array, r.Slice, r.String: + ret = c.vectorIndex(node, obj, idx) + case r.Map: + if multivalued { + ret = c.mapIndex(node, obj, idx) + } else { + ret = c.mapIndex1(node, obj, idx) + } + + case r.Ptr: + if t.Elem().Kind() == r.Array { + objfun := obj.AsX1() + deref := exprFun(t.Elem(), func(env *Env) r.Value { return objfun(env).Elem() }, + ) + ret = c.vectorIndex(node, deref, idx) + break + } + fallthrough + default: + c.Errorf("invalid operation: %v (type %v does not support indexing)", node, t) + return nil + } + if obj.Const() && idx.Const() { + ret.EvalConst(OptKeepUntyped) + } + return ret +} +func (c *Comp) vectorIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + + t := obj.Type + if t.Kind() == r.String { + return c.stringIndex(node, obj, idx) + } + + t = t.Elem() + objfun := obj.AsX1() + var fun I + if idxconst { + i := idx.Value.(int) + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + objv := objfun(env) + return objv.Index(i).Bool() + } + + case r.Int: + fun = func(env *Env) int { + objv := objfun(env) + return int(objv.Index(i).Int()) + } + + case r.Int8: + fun = func(env *Env) int8 { + objv := objfun(env) + return int8(objv.Index(i).Int()) + } + + case r.Int16: + fun = func(env *Env) int16 { + objv := objfun(env) + return int16(objv.Index(i).Int()) + } + + case r.Int32: + fun = func(env *Env) int32 { + objv := objfun(env) + return int32(objv.Index(i).Int()) + } + + case r.Int64: + fun = func(env *Env) int64 { + objv := objfun(env) + return objv.Index(i).Int() + } + + case r.Uint: + fun = func(env *Env) uint { + objv := objfun(env) + return uint(objv.Index(i).Uint()) + } + + case r.Uint8: + fun = func(env *Env) uint8 { + objv := objfun(env) + return uint8(objv.Index(i).Uint()) + } + + case r.Uint16: + fun = func(env *Env) uint16 { + objv := objfun(env) + return uint16(objv.Index(i).Uint()) + } + + case r.Uint32: + fun = func(env *Env) uint32 { + objv := objfun(env) + return uint32(objv.Index(i).Uint()) + } + + case r.Uint64: + fun = func(env *Env) uint64 { + objv := objfun(env) + return objv.Index(i).Uint() + } + + case r.Uintptr: + fun = func(env *Env) uintptr { + objv := objfun(env) + return uintptr(objv.Index(i).Uint()) + } + + case r.Float32: + fun = func(env *Env) float32 { + objv := objfun(env) + return float32(objv.Index(i).Float()) + } + + case r.Float64: + fun = func(env *Env) float64 { + objv := objfun(env) + return objv.Index(i).Float() + } + + case r.Complex64: + fun = func(env *Env) complex64 { + objv := objfun(env) + return complex64(objv.Index(i).Complex()) + } + + case r.Complex128: + fun = func(env *Env) complex128 { + objv := objfun(env) + return objv.Index(i).Complex() + } + + case r.String: + fun = func(env *Env) string { + objv := objfun(env) + return objv.Index(i).String() + } + + default: + fun = func(env *Env) r.Value { + objv := objfun(env) + return objv.Index(i) + + } + + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Bool() + } + + case r.Int: + fun = func(env *Env) int { + objv := objfun(env) + i := idxfun(env) + return int(objv.Index(i).Int()) + } + + case r.Int8: + fun = func(env *Env) int8 { + objv := objfun(env) + i := idxfun(env) + return int8(objv.Index(i).Int()) + } + + case r.Int16: + fun = func(env *Env) int16 { + objv := objfun(env) + i := idxfun(env) + return int16(objv.Index(i).Int()) + } + + case r.Int32: + fun = func(env *Env) int32 { + objv := objfun(env) + i := idxfun(env) + return int32(objv.Index(i).Int()) + } + + case r.Int64: + fun = func(env *Env) int64 { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Int() + } + + case r.Uint: + fun = func(env *Env) uint { + objv := objfun(env) + i := idxfun(env) + return uint(objv.Index(i).Uint()) + } + + case r.Uint8: + fun = func(env *Env) uint8 { + objv := objfun(env) + i := idxfun(env) + return uint8(objv.Index(i).Uint()) + } + + case r.Uint16: + fun = func(env *Env) uint16 { + objv := objfun(env) + i := idxfun(env) + return uint16(objv.Index(i).Uint()) + } + + case r.Uint32: + fun = func(env *Env) uint32 { + objv := objfun(env) + i := idxfun(env) + return uint32(objv.Index(i).Uint()) + } + + case r.Uint64: + fun = func(env *Env) uint64 { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Uint() + } + + case r.Uintptr: + fun = func(env *Env) uintptr { + objv := objfun(env) + i := idxfun(env) + return uintptr(objv.Index(i).Uint()) + } + + case r.Float32: + fun = func(env *Env) float32 { + objv := objfun(env) + i := idxfun(env) + return float32(objv.Index(i).Float()) + } + + case r.Float64: + fun = func(env *Env) float64 { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Float() + } + + case r.Complex64: + fun = func(env *Env) complex64 { + objv := objfun(env) + i := idxfun(env) + return complex64(objv.Index(i).Complex()) + } + + case r.Complex128: + fun = func(env *Env) complex128 { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Complex() + } + + case r.String: + fun = func(env *Env) string { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).String() + } + + default: + fun = func(env *Env) r.Value { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i) + + } + + } + } + return exprFun(t, fun) +} +func (c *Comp) stringIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + idxfun := idx.WithFun().(func(*Env) int) + objfun := obj.WithFun().(func(*Env) string) + var fun func(env *Env) uint8 + if obj.Const() { + str := obj.Value.(string) + fun = func(env *Env) uint8 { + i := idxfun(env) + return str[i] + } + } else if idx.Const() { + i := idx.Value.(int) + fun = func(env *Env) uint8 { + str := objfun(env) + return str[i] + } + } else { + fun = func(env *Env) uint8 { + str := objfun(env) + i := idxfun(env) + return str[i] + } + } + return c.exprUint8(fun) +} +func (c *Comp) mapIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + t := obj.Type + tkey := t.Key() + tval := t.Elem() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as <%v> in map index", node.Index, idx.Type, tkey) + } + + objfun := obj.AsX1() + zero := xr.Zero(tval) + var fun func(env *Env) (r.Value, []r.Value) + if idxconst { + key := r.ValueOf(idx.Value) + fun = func(env *Env) (r.Value, []r.Value) { + obj := objfun(env) + val := obj.MapIndex(key) + var ok r.Value + if val == base.Nil { + val = zero + ok = base.False + } else { + ok = base.True + } + return val, []r.Value{val, ok} + } + } else { + keyfun := idx.AsX1() + fun = func(env *Env) (r.Value, []r.Value) { + obj := objfun(env) + key := keyfun(env) + val := obj.MapIndex(key) + var ok r.Value + if val == base.Nil { + val = zero + ok = base.False + } else { + ok = base.True + } + return val, []r.Value{val, ok} + } + } + return exprXV([]xr.Type{tval, c.TypeOfBool()}, fun) +} +func (c *Comp) mapIndex1(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + t := obj.Type + tkey := t.Key() + tval := t.Elem() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as <%v> in map index", node.Index, idx.Type, tkey) + } + + objfun := obj.AsX1() + var fun I + if idxconst { + key := r.ValueOf(idx.Value) + switch tval.Kind() { + case r.Bool: + fun = func(env *Env) bool { + obj := objfun(env) + v := obj.MapIndex(key) + var result bool + + if v != base.Nil { + result = v.Bool() + } + return result + } + case r.Int: + fun = func(env *Env) int { + obj := objfun(env) + v := obj.MapIndex(key) + var result int + + if v != base.Nil { + result = int(v.Int()) + } + return result + } + case r.Int8: + fun = func(env *Env) int8 { + obj := objfun(env) + v := obj.MapIndex(key) + var result int8 + + if v != base.Nil { + result = int8(v.Int()) + } + return result + } + case r.Int16: + fun = func(env *Env) int16 { + obj := objfun(env) + v := obj.MapIndex(key) + var result int16 + + if v != base.Nil { + result = int16(v.Int()) + } + return result + } + case r.Int32: + fun = func(env *Env) int32 { + obj := objfun(env) + v := obj.MapIndex(key) + var result int32 + if v != base.Nil { + result = int32(v.Int()) + } + return result + } + case r.Int64: + fun = func(env *Env) int64 { + obj := objfun(env) + v := obj.MapIndex(key) + var result int64 + if v != base.Nil { + result = v.Int() + } + return result + } + case r.Uint: + fun = func(env *Env) uint { + obj := objfun(env) + v := obj.MapIndex(key) + var result uint + if v != base.Nil { + result = uint(v.Uint()) + } + return result + } + case r.Uint8: + fun = func(env *Env) uint8 { + obj := objfun(env) + v := obj.MapIndex(key) + var result uint8 + if v != base.Nil { + result = + uint8(v.Uint()) + } + return result + } + case r.Uint16: + fun = func(env *Env) uint16 { + obj := objfun(env) + v := obj.MapIndex(key) + var result uint16 + if v != base.Nil { + result = + + uint16(v.Uint()) + } + return result + } + case r.Uint32: + fun = func(env *Env) uint32 { + obj := objfun(env) + v := obj.MapIndex(key) + var result uint32 + if v != base.Nil { + result = + + uint32(v.Uint()) + } + return result + } + case r.Uint64: + fun = func(env *Env) uint64 { + obj := objfun(env) + v := obj.MapIndex(key) + var result uint64 + if v != base.Nil { + result = v.Uint() + } + return result + } + + case r.Uintptr: + fun = func(env *Env) uintptr { + obj := objfun(env) + v := obj.MapIndex(key) + var result uintptr + if v != base.Nil { + result = + + uintptr(v.Uint()) + } + return result + } + + case r.Float32: + fun = func(env *Env) float32 { + obj := objfun(env) + v := obj.MapIndex(key) + var result float32 + if v != base.Nil { + result = + + float32(v.Float()) + } + return result + } + + case r.Float64: + fun = func(env *Env) float64 { + obj := objfun(env) + v := obj.MapIndex(key) + var result float64 + if v != base.Nil { + result = v.Float() + } + return result + } + + case r.Complex64: + fun = func(env *Env) complex64 { + obj := objfun(env) + v := obj.MapIndex(key) + var result complex64 + if v != base.Nil { + result = + + complex64(v.Complex()) + } + return result + } + + case r.Complex128: + fun = func(env *Env) complex128 { + obj := objfun(env) + v := obj.MapIndex(key) + var result complex128 + if v != base.Nil { + result = v.Complex() + } + return result + } + + case r.String: + fun = func(env *Env) string { + obj := objfun(env) + v := obj.MapIndex(key) + var result string + if v != base.Nil { + result = v.String() + } + return result + } + + default: + { + zero := xr.Zero(tval) + fun = func(env *Env) r.Value { + obj := objfun(env) + result := obj.MapIndex(key) + if result == base.Nil { + result = zero + } + return result + } + } + + } + } else { + keyfun := idx.AsX1() + switch tval.Kind() { + case r.Bool: + fun = func(env *Env) bool { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result bool + if v != base.Nil { + result = v.Bool() + } + return result + } + + case r.Int: + fun = func(env *Env) int { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result int + if v != base.Nil { + result = + + int(v.Int()) + } + return result + } + + case r.Int8: + fun = func(env *Env) int8 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result int8 + if v != base.Nil { + result = + + int8(v.Int()) + } + return result + } + + case r.Int16: + fun = func(env *Env) int16 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result int16 + if v != base.Nil { + result = + + int16(v.Int()) + } + return result + } + + case r.Int32: + fun = func(env *Env) int32 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result int32 + if v != base.Nil { + result = + + int32(v.Int()) + } + return result + } + + case r.Int64: + fun = func(env *Env) int64 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result int64 + if v != base.Nil { + result = v.Int() + } + return result + } + + case r.Uint: + fun = func(env *Env) uint { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uint + if v != base.Nil { + result = + + uint(v.Uint()) + } + return result + } + + case r.Uint8: + fun = func(env *Env) uint8 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uint8 + if v != base.Nil { + result = + + uint8(v.Uint()) + } + return result + } + + case r.Uint16: + fun = func(env *Env) uint16 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uint16 + if v != base.Nil { + result = + + uint16(v.Uint()) + } + return result + } + + case r.Uint32: + fun = func(env *Env) uint32 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uint32 + if v != base.Nil { + result = + + uint32(v.Uint()) + } + return result + } + + case r.Uint64: + fun = func(env *Env) uint64 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uint64 + if v != base.Nil { + result = v.Uint() + } + return result + } + + case r.Uintptr: + fun = func(env *Env) uintptr { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result uintptr + if v != base.Nil { + result = + + uintptr(v.Uint()) + } + return result + } + + case r.Float32: + fun = func(env *Env) float32 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result float32 + if v != base.Nil { + result = + + float32(v.Float()) + } + return result + } + + case r.Float64: + fun = func(env *Env) float64 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result float64 + if v != base.Nil { + result = v.Float() + } + return result + } + + case r.Complex64: + fun = func(env *Env) complex64 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result complex64 + if v != base.Nil { + result = + + complex64(v.Complex()) + } + return result + } + + case r.Complex128: + fun = func(env *Env) complex128 { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result complex128 + if v != base.Nil { + result = v.Complex() + } + return result + } + + case r.String: + fun = func(env *Env) string { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result string + if v != base.Nil { + result = v.String() + } + return result + } + + default: + { + zero := xr.Zero(tval) + fun = func(env *Env) r.Value { + obj := objfun(env) + key := keyfun(env) + result := obj.MapIndex(key) + if result == base.Nil { + result = zero + } + return result + } + } + + } + } + return exprFun(tval, fun) +} +func (c *Comp) IndexPlace(node *ast.IndexExpr, opt PlaceOption) *Place { + obj := c.Expr1(node.X) + idx := c.Expr1(node.Index) + if obj.Untyped() { + obj.ConstTo(obj.DefaultType()) + } + + t := obj.Type + switch t.Kind() { + case r.Array, r.Slice: + return c.vectorPlace(node, obj, idx) + case r.String: + + c.Errorf("%s a byte in a string: %v", opt, node) + return nil + case r.Map: + + if opt == PlaceAddress { + c.Errorf("%s a map element: %v", opt, node) + return nil + } + return c.mapPlace(node, obj, idx) + case r.Ptr: + if t.Elem().Kind() == r.Array { + return c.vectorPtrPlace(node, obj, idx) + } + + fallthrough + default: + c.Errorf("invalid operation: %v (type %v does not support indexing)", node, t) + return nil + } +} +func (c *Comp) mapPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + tmap := obj.Type + tkey := tmap.Key() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as type <%v> in map index: %v", node.Index, idx.Type, tkey, node) + } + return &Place{Var: Var{Type: tmap.Elem()}, Fun: obj.AsX1(), MapKey: idx.AsX1(), MapType: tmap} +} +func (c *Comp) vectorPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + + t := obj.Type.Elem() + objfun := obj.AsX1() + var fun, addr func(env *Env) r.Value + if idxconst { + i := idx.Value.(int) + fun = func(env *Env) r.Value { + objv := objfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env) + return objv.Index(i).Addr() + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Addr() + } + } + return &Place{Var: Var{Type: t}, Fun: fun, Addr: addr} +} +func (c *Comp) vectorPtrPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + + t := obj.Type.Elem().Elem() + objfun := obj.AsX1() + var fun, addr func(env *Env) r.Value + if idxconst { + i := idx.Value.(int) + fun = func(env *Env) r.Value { + objv := objfun(env).Elem() + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env).Elem() + return objv.Index(i).Addr() + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + objv := objfun(env).Elem() + i := idxfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env).Elem() + i := idxfun(env) + return objv.Index(i).Addr() + } + } + return &Place{Var: Var{Type: t}, Fun: fun, Addr: addr} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/index.gomacro b/vendor/github.com/cosmos72/gomacro/fast/index.gomacro new file mode 100644 index 0000000..8210cf8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/index.gomacro @@ -0,0 +1,552 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * index.go + * + * Created on Apr 23, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +:import ( + "go/ast" + r "reflect" +) + +import ( + "go/ast" + r "reflect" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// IndexExpr compiles a read operation on obj[idx] +func (c *Comp) IndexExpr(node *ast.IndexExpr) *Expr { + return c.indexExpr(node, true) +} + +// IndexExpr1 compiles a single-valued read operation on obj[idx] +func (c *Comp) IndexExpr1(node *ast.IndexExpr) *Expr { + return c.indexExpr(node, false) +} + +func (c *Comp) indexExpr(node *ast.IndexExpr, multivalued bool) *Expr { + obj := c.Expr1(node.X) + idx := c.Expr1(node.Index) + if obj.Untyped() { + obj.ConstTo(obj.DefaultType()) + } + t := obj.Type + var ret *Expr + switch t.Kind() { + case r.Array, r.Slice, r.String: + ret = c.vectorIndex(node, obj, idx) + case r.Map: + if multivalued { + ret = c.mapIndex(node, obj, idx) + } else { + ret = c.mapIndex1(node, obj, idx) + } + case r.Ptr: + if t.Elem().Kind() == r.Array { + objfun := obj.AsX1() + deref := exprFun(t.Elem(), func(env *Env) r.Value { + return objfun(env).Elem() + }) + ret = c.vectorIndex(node, deref, idx) + break + } + fallthrough + default: + c.Errorf("invalid operation: %v (type %v does not support indexing)", node, t) + return nil + } + if obj.Const() && idx.Const() { + // constant propagation + ret.EvalConst(CompileKeepUntyped) + } + return ret +} + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + if t == nil { + return nil + } + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue(typ, val ast.Node) (ast.Node, ast.Node) { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + typ = ~'{r.Value} + } else { + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + } + return typ, val +} + +:macro vec_index_c(typ ast.Node) ast.Node { + kind := makekind(typ) + typv, val := convertvalue(typ, ~'{objv.Index(i)}) + fun := ~"{ + fun = func(env *Env) ~,typv { + objv := objfun(env) + return ~,val + } + } + if kind == nil { + return ~"{ default: ~,fun } + } else { + return ~"{ case ~,kind: ~,fun } + } +} + +:macro vec_index_e(typ ast.Node) ast.Node { + kind := makekind(typ) + typv, val := convertvalue(typ, ~'{objv.Index(i)}) + fun := ~"{ + fun = func(env *Env) ~,typv { + objv := objfun(env) + i := idxfun(env) + return ~,val + } + } + if kind == nil { + return ~"{ default: ~,fun } + } else { + return ~"{ case ~,kind: ~,fun } + } +} + +// vectorIndex compiles obj[idx] where obj is an array or slice +func (c *Comp) vectorIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + t := obj.Type + if t.Kind() == r.String { + return c.stringIndex(node, obj, idx) + } + t = t.Elem() + objfun := obj.AsX1() + var fun I + if idxconst { + i := idx.Value.(int) + switch t.Kind() { + {vec_index_c; bool} + {vec_index_c; int} + {vec_index_c; int8} + {vec_index_c; int16} + {vec_index_c; int32} + {vec_index_c; int64} + {vec_index_c; uint} + {vec_index_c; uint8} + {vec_index_c; uint16} + {vec_index_c; uint32} + {vec_index_c; uint64} + {vec_index_c; uintptr} + {vec_index_c; float32} + {vec_index_c; float64} + {vec_index_c; complex64} + {vec_index_c; complex128} + {vec_index_c; string} + {vec_index_c; nil} + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + switch t.Kind() { + {vec_index_e; bool} + {vec_index_e; int} + {vec_index_e; int8} + {vec_index_e; int16} + {vec_index_e; int32} + {vec_index_e; int64} + {vec_index_e; uint} + {vec_index_e; uint8} + {vec_index_e; uint16} + {vec_index_e; uint32} + {vec_index_e; uint64} + {vec_index_e; uintptr} + {vec_index_e; float32} + {vec_index_e; float64} + {vec_index_e; complex64} + {vec_index_e; complex128} + {vec_index_e; string} + {vec_index_e; nil} + } + } + return exprFun(t, fun) +} + +// stringIndex compiles obj[idx] where obj is a string +func (c *Comp) stringIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + idxfun := idx.WithFun().(func(*Env) int) + objfun := obj.WithFun().(func(*Env) string) + var fun func(env *Env) uint8 + if obj.Const() { + str := obj.Value.(string) + fun = func(env *Env) uint8 { + i := idxfun(env) + return str[i] + } + } else if idx.Const() { + i := idx.Value.(int) + fun = func(env *Env) uint8 { + str := objfun(env) + return str[i] + } + } else { + fun = func(env *Env) uint8 { + str := objfun(env) + i := idxfun(env) + return str[i] + } + } + return c.exprUint8(fun) +} + +// mapIndex compiles obj[idx] where obj is a map +func (c *Comp) mapIndex(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + t := obj.Type + tkey := t.Key() + tval := t.Elem() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as <%v> in map index", node.Index, idx.Type, tkey) + } + objfun := obj.AsX1() + zero := xr.Zero(tval) + var fun func(env *Env) (r.Value, []r.Value) + if idxconst { + key := r.ValueOf(idx.Value) + fun = func(env *Env) (r.Value, []r.Value) { + obj := objfun(env) + val := obj.MapIndex(key) + var ok r.Value + if val == base.Nil { + val = zero // map[key] returns the zero value if key is not present + ok = base.False + } else { + ok = base.True + } + return val, []r.Value{val, ok} + } + } else { + keyfun := idx.AsX1() + fun = func(env *Env) (r.Value, []r.Value) { + obj := objfun(env) + key := keyfun(env) + val := obj.MapIndex(key) + var ok r.Value + if val == base.Nil { + val = zero // map[key] returns the zero value if key is not present + ok = base.False + } else { + ok = base.True + } + return val, []r.Value{val, ok} + } + } + return exprXV([]xr.Type{tval, c.TypeOfBool()}, fun) +} + +:macro mapindex1_c(typ ast.Node) ast.Node { + if EvalType(typ) == nil { + return ~'{ + zero := xr.Zero(tval) + fun = func(env *Env) r.Value { + obj := objfun(env) + result := obj.MapIndex(key) + if result == base.Nil { + result = zero + } + return result + } + } + } + _, unwrap := convertvalue(typ, ~'v) + return ~"{ + fun = func(env *Env) ~,typ { + obj := objfun(env) + v := obj.MapIndex(key) + var result ~,typ + if v != base.Nil { + result = ~,unwrap + } + return result + } + } +} + +:macro mapindex1_e(typ ast.Node) ast.Node { + if EvalType(typ) == nil { + return ~'{ + zero := xr.Zero(tval) + fun = func(env *Env) r.Value { + obj := objfun(env) + key := keyfun(env) + result := obj.MapIndex(key) + if result == base.Nil { + result = zero + } + return result + } + } + } + _, unwrap := convertvalue(typ, ~'v) + return ~"{ + fun = func(env *Env) ~,typ { + obj := objfun(env) + key := keyfun(env) + v := obj.MapIndex(key) + var result ~,typ + if v != base.Nil { + result = ~,unwrap + } + return result + } + } +} + +// mapIndex1 compiles obj[idx] where obj is a map, in single-value context +func (c *Comp) mapIndex1(node *ast.IndexExpr, obj *Expr, idx *Expr) *Expr { + t := obj.Type + tkey := t.Key() + tval := t.Elem() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as <%v> in map index", node.Index, idx.Type, tkey) + } + objfun := obj.AsX1() + var fun I + if idxconst { + key := r.ValueOf(idx.Value) + switch tval.Kind() { + case r.Bool: mapindex1_c; bool + case r.Int: mapindex1_c; int + case r.Int8: mapindex1_c; int8 + case r.Int16: mapindex1_c; int16 + case r.Int32: mapindex1_c; int32 + case r.Int64: mapindex1_c; int64 + case r.Uint: mapindex1_c; uint + case r.Uint8: mapindex1_c; uint8 + case r.Uint16: mapindex1_c; uint16 + case r.Uint32: mapindex1_c; uint32 + case r.Uint64: mapindex1_c; uint64 + case r.Uintptr: mapindex1_c; uintptr + case r.Float32: mapindex1_c; float32 + case r.Float64: mapindex1_c; float64 + case r.Complex64: mapindex1_c; complex64 + case r.Complex128: mapindex1_c; complex128 + case r.String: mapindex1_c; string + default: mapindex1_c; nil + } + } else { + keyfun := idx.AsX1() + switch tval.Kind() { + case r.Bool: mapindex1_e; bool + case r.Int: mapindex1_e; int + case r.Int8: mapindex1_e; int8 + case r.Int16: mapindex1_e; int16 + case r.Int32: mapindex1_e; int32 + case r.Int64: mapindex1_e; int64 + case r.Uint: mapindex1_e; uint + case r.Uint8: mapindex1_e; uint8 + case r.Uint16: mapindex1_e; uint16 + case r.Uint32: mapindex1_e; uint32 + case r.Uint64: mapindex1_e; uint64 + case r.Uintptr: mapindex1_e; uintptr + case r.Float32: mapindex1_e; float32 + case r.Float64: mapindex1_e; float64 + case r.Complex64: mapindex1_e; complex64 + case r.Complex128: mapindex1_e; complex128 + case r.String: mapindex1_e; string + default: mapindex1_e; nil + } + } + return exprFun(tval, fun) +} + +// IndexPlace compiles obj[idx] returning a Place, i.e. a settable (and addressable, if possible) reflect.Value +func (c *Comp) IndexPlace(node *ast.IndexExpr, opt PlaceOption) *Place { + obj := c.Expr1(node.X) + idx := c.Expr1(node.Index) + if obj.Untyped() { + obj.ConstTo(obj.DefaultType()) + } + t := obj.Type + switch t.Kind() { + case r.Array, r.Slice: + return c.vectorPlace(node, obj, idx) + case r.String: + // bytes in a string are not settable nor addressable + c.Errorf("%s a byte in a string: %v", opt, node) + return nil + case r.Map: + // elements in a map are settable but not addressable + if opt == PlaceAddress { + c.Errorf("%s a map element: %v", opt, node) + return nil + } + return c.mapPlace(node, obj, idx) + case r.Ptr: + if t.Elem().Kind() == r.Array { + return c.vectorPtrPlace(node, obj, idx) + } + fallthrough + default: + c.Errorf("invalid operation: %v (type %v does not support indexing)", node, t) + return nil + } +} + +// mapPlace compiles obj[idx] where obj is a map, returning a settable place +func (c *Comp) mapPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + tmap := obj.Type + tkey := tmap.Key() + idxconst := idx.Const() + if idxconst { + idx.ConstTo(tkey) + } else if idx.Type == nil || !idx.Type.AssignableTo(tkey) { + c.Errorf("cannot use %v <%v> as type <%v> in map index: %v", node.Index, idx.Type, tkey, node) + } + return &Place{Var: Var{Type: tmap.Elem()}, Fun: obj.AsX1(), MapKey: idx.AsX1(), MapType: tmap} +} + +// vectorPlace compiles obj[idx] where obj is an array or slice, returning a settable and addressable place +func (c *Comp) vectorPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + t := obj.Type.Elem() + objfun := obj.AsX1() + var fun, addr func(env *Env) r.Value + if idxconst { + i := idx.Value.(int) + fun = func(env *Env) r.Value { + objv := objfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env) + return objv.Index(i).Addr() + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env) + i := idxfun(env) + return objv.Index(i).Addr() + } + } + return &Place{Var: Var{Type: t}, Fun: fun, Addr: addr} +} + +// vectorPtrPlace compiles obj[idx] where obj is a pointer to an array, returning a settable and addressable reflect.Value +func (c *Comp) vectorPtrPlace(node *ast.IndexExpr, obj *Expr, idx *Expr) *Place { + idxconst := idx.Const() + if idxconst { + idx.ConstTo(c.TypeOfInt()) + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("non-integer %s index: %v <%v>", obj.Type.Kind(), node.Index, idx.Type) + } + t := obj.Type.Elem().Elem() // Elem() for the pointer to array, another Elem() for the array element type + objfun := obj.AsX1() + var fun, addr func(env *Env) r.Value + if idxconst { + i := idx.Value.(int) + fun = func(env *Env) r.Value { + objv := objfun(env).Elem() + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env).Elem() + return objv.Index(i).Addr() + } + } else { + idxfun := idx.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + objv := objfun(env).Elem() + i := idxfun(env) + return objv.Index(i) + } + addr = func(env *Env) r.Value { + objv := objfun(env).Elem() + i := idxfun(env) + return objv.Index(i).Addr() + } + } + return &Place{Var: Var{Type: t}, Fun: fun, Addr: addr} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/interface.go b/vendor/github.com/cosmos72/gomacro/fast/interface.go new file mode 100644 index 0000000..480f34c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/interface.go @@ -0,0 +1,96 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * interface.go + * + * Created on: Mar 29, 2017 + * Author: Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) TypeInterface(node *ast.InterfaceType) xr.Type { + if node.Methods == nil || len(node.Methods.List) == 0 { + return c.TypeOfInterface() + } + methodtypes, methodnames := c.TypeFields(node.Methods) + + // TODO embedded interfaces + return c.Universe.InterfaceOf(methodnames, methodtypes, nil) +} + +// InterfaceProxy returns the proxy struct that implements a compiled interface +func (c *Comp) InterfaceProxy(t xr.Type) r.Type { + ret := c.interf2proxy[t.ReflectType()] + if ret == nil { + c.Errorf("internal error: proxy not found for %s type <%v>", t.Kind(), t) + } + return ret +} + +// converterToInterface compiles a conversion from 'tin' into a proxy struct that implements the interface type 'tout' +// and returns a function that performs such conversion +func (c *Comp) converterToInterface(tin xr.Type, tout xr.Type) func(val r.Value, rtout r.Type) r.Value { + rtproxy := c.InterfaceProxy(tout) + rtout := tout.ReflectType() + + vtable := r.New(rtproxy).Elem() + n := rtout.NumMethod() + for i := 0; i < n; i++ { + imtd := rtout.Method(i) + xmtd, count := tin.MethodByName(imtd.Name, imtd.PkgPath) + if count == 0 { + c.Errorf("cannot convert type <%v> to interface <%v>: missing method %s %s", tin, rtout, imtd.PkgPath, imtd.Name) + } else if count > 1 { + c.Errorf("type <%v> has %d wrapper methods %s %s all at the same depth=%d - cannot convert to interface <%v>", + tin, count, imtd.PkgPath, imtd.Name, len(xmtd.FieldIndex), tout) + } + e := c.compileMethodAsFunc(tin, xmtd) + setProxyMethod(vtable.Field(i+1), r.ValueOf(e.Value)) + } + return func(val r.Value, rtout r.Type) r.Value { + vaddr := r.New(rtproxy) + vproxy := vaddr.Elem() + vproxy.Set(vtable) + vproxy.Field(0).Set(r.ValueOf(xr.MakeInterfaceHeader(val, tin))) + return vaddr.Convert(rtout) + } +} + +func setProxyMethod(place r.Value, mtd r.Value) { + rtin := mtd.Type() + rtout := place.Type() + if rtin == rtout { + place.Set(mtd) + } else if rtin.ConvertibleTo(rtout) { + place.Set(mtd.Convert(rtout)) + } else { + place.Set(r.MakeFunc(rtout, func(args []r.Value) []r.Value { + args[0] = args[0].Interface().(xr.InterfaceHeader).Value() + return mtd.Call(args) + })) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/interpreter.go b/vendor/github.com/cosmos72/gomacro/fast/interpreter.go new file mode 100644 index 0000000..c99ded4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/interpreter.go @@ -0,0 +1,252 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * interpreter.go + * + * Created on: Apr 02, 2017 + * Author: Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + "strings" + + "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// Interp is the fast interpreter. +// It contains both the tree-of-closures builder Comp +// and the interpreter's runtime environment Env +type Interp struct { + Comp *Comp + env *Env // not exported. to access it, call CompEnv.PrepareEnv() +} + +func (ir *Interp) RunExpr1(e *Expr) r.Value { + if e == nil { + return None + } + env := ir.PrepareEnv() + fun := e.AsX1() + return fun(env) +} + +func (ir *Interp) RunExpr(e *Expr) (r.Value, []r.Value) { + if e == nil { + return None, nil + } + env := ir.PrepareEnv() + fun := e.AsXV(ir.Comp.CompileOptions) + return fun(env) +} + +func (ir *Interp) Parse(src string) ast2.Ast { + return ir.Comp.Parse(src) +} + +// combined Parse + Compile +func (ir *Interp) Compile(src string) *Expr { + c := ir.Comp + return c.Compile(c.Parse(src)) +} + +func (ir *Interp) CompileNode(node ast.Node) *Expr { + return ir.Comp.CompileNode(node) +} + +func (ir *Interp) CompileAst(form ast2.Ast) *Expr { + return ir.Comp.Compile(form) +} + +// combined Parse + Compile + RunExpr +func (ir *Interp) Eval(src string) (r.Value, []r.Value) { + c := ir.Comp + return ir.RunExpr(c.Compile(c.Parse(src))) +} + +func (ir *Interp) ChangePackage(name, path string) { + if len(path) == 0 { + path = name + } else { + name = path[1+strings.LastIndexByte(path, '/'):] + } + c := ir.Comp + currpath := c.Path + if path == currpath { + return + } +} + +// DeclConst compiles a constant declaration +func (ir *Interp) DeclConst(name string, t xr.Type, value I) { + ir.Comp.DeclConst0(name, t, value) +} + +// DeclFunc compiles a function declaration +func (ir *Interp) DeclFunc(name string, fun I) { + ir.Comp.DeclFunc0(name, fun) + ir.apply() +} + +// DeclBuiltin compiles a builtin function declaration +func (ir *Interp) DeclBuiltin(name string, builtin Builtin) { + ir.Comp.DeclBuiltin0(name, builtin) +} + +// DeclEnvFunc compiles a function declaration that accesses interpreter's *CompEnv +func (ir *Interp) DeclEnvFunc(name string, function Function) { + ir.Comp.DeclEnvFunc0(name, function) + ir.apply() +} + +// DeclType declares a type +func (ir *Interp) DeclType(t xr.Type) { + ir.Comp.DeclType0(t) +} + +// DeclType declares a type alias +func (ir *Interp) DeclTypeAlias(alias string, t xr.Type) { + ir.Comp.DeclTypeAlias0(alias, t) +} + +// DeclVar compiles a variable declaration +func (ir *Interp) DeclVar(name string, t xr.Type, value I) { + if t == nil { + t = ir.Comp.TypeOf(value) + } + ir.Comp.DeclVar0(name, t, ir.Comp.exprValue(t, value)) + ir.apply() +} + +// apply executes the compiled declarations, statements and expressions, +// then clears the compiled buffer +func (ir *Interp) apply() { + exec := ir.Comp.Code.Exec() + if exec != nil { + exec(ir.PrepareEnv()) + } +} + +// AddressOfVar compiles the expression &name, then executes it +// returns the zero value if name is not found or is not addressable +func (ir *Interp) AddressOfVar(name string) (addr r.Value) { + c := ir.Comp + sym := c.TryResolve(name) + if sym != nil { + switch sym.Desc.Class() { + case VarBind, IntBind: + va := sym.AsVar(PlaceAddress) + expr := va.Address(c.Depth) + return ir.RunExpr1(expr) + } + } + return Nil +} + +// replacement of reflect.TypeOf() that uses xreflect.TypeOf() +func (ir *Interp) TypeOf(val interface{}) xr.Type { + return ir.Comp.TypeOf(val) +} + +// ValueOf retrieves the value of a constant, function or variable +// The returned value is settable and addressable only for variables +// returns the zero value if name is not found +func (ir *Interp) ValueOf(name string) (value r.Value) { + sym := ir.Comp.TryResolve(name) + if sym == nil { + return Nil + } + switch sym.Desc.Class() { + case ConstBind: + return sym.Bind.ConstValue() + case IntBind: + value = ir.AddressOfVar(name) + if value != Nil { + value = value.Elem() // dereference + } + return value + case VarBind: + env := ir.PrepareEnv() + for i := 0; i < sym.Upn; i++ { + env = env.Outer + } + return env.Binds[sym.Desc.Index()] + default: + expr := ir.Comp.Symbol(sym) + return ir.RunExpr1(expr) + } +} + +func (ir *Interp) PrepareEnv() *Env { + return ir.prepareEnv(128) +} + +func (ir *Interp) prepareEnv(minDelta int) *Env { + c := ir.Comp + env := ir.env + // usually we know at Env creation how many slots are needed in c.Env.Binds + // but here we are modifying an existing Env... + if minDelta < 0 { + minDelta = 0 + } + capacity, min := cap(env.Binds), c.BindNum + // c.Debugf("prepareEnv() before: c.BindNum = %v, minDelta = %v, len(env.Binds) = %v, cap(env.Binds) = %v, env = %p", c.BindNum, minDelta, len(env.Binds), cap(env.Binds), env) + + if capacity < min { + if capacity <= min/2 { + capacity = min + } else { + capacity *= 2 + } + if capacity-min < minDelta { + capacity = min + minDelta + } + binds := make([]r.Value, min, capacity) + copy(binds, env.Binds) + env.Binds = binds + } + if len(env.Binds) < min { + env.Binds = env.Binds[0:min:cap(env.Binds)] + } + // c.Debugf("prepareEnv() after: c.BindNum = %v, minDelta = %v, len(env.Binds) = %v, cap(env.Binds) = %v, env = %p", c.BindNum, minDelta, len(env.Binds), cap(env.Binds), env) + + capacity, min = cap(env.IntBinds), c.IntBindNum + if capacity < min { + if capacity <= min/2 { + capacity = min + } else { + capacity *= 2 + } + if capacity-min < minDelta { + capacity = min + minDelta + } + binds := make([]uint64, min, capacity) + copy(binds, env.IntBinds) + env.IntBinds = binds + } + if len(env.IntBinds) < min { + env.IntBinds = env.IntBinds[0:min:cap(env.IntBinds)] + } + return env +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/literal.go b/vendor/github.com/cosmos72/gomacro/fast/literal.go new file mode 100644 index 0000000..aa3fe2b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/literal.go @@ -0,0 +1,591 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * literal.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/constant" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) BasicLit(node *ast.BasicLit) *Expr { + str := node.Value + var kind r.Kind + var label string + switch node.Kind { + case token.INT: + kind, label = r.Int, "integer" + case token.FLOAT: + kind, label = r.Float64, "float" + case token.IMAG: + kind, label = r.Complex128, "complex" + case token.CHAR: + kind, label = r.Int32, "rune" + case token.STRING: + kind, label = r.String, "string" + default: + c.Errorf("unsupported basic literal: %v", node) + return nil + } + obj := constant.MakeFromLiteral(str, node.Kind, 0) + if obj.Kind() == constant.Unknown { + c.Errorf("invalid %s literal: %v", label, str) + return nil + } + return c.exprUntypedLit(kind, obj) +} + +func constantKindToUntypedLitKind(ckind constant.Kind) r.Kind { + ret := r.Invalid + switch ckind { + case constant.Bool: + ret = r.Bool + case constant.Int: + ret = r.Int // actually ambiguous, could be a rune - thus r.Int32 + case constant.Float: + ret = r.Float64 + case constant.Complex: + ret = r.Complex128 + case constant.String: + ret = r.String + } + return ret +} + +func isLiteral(x interface{}) bool { + if x == nil { + return true + } + rtype := r.TypeOf(x) + switch KindToCategory(rtype.Kind()) { + case r.Bool, r.Int, r.Uint, r.Float64, r.Complex128, r.String: + return true + } + _, ok := x.(UntypedLit) + return ok +} + +func isLiteralNumber(x I, n int64) bool { + if x == nil { + return false + } + v := r.ValueOf(x) + switch KindToCategory(v.Kind()) { + case r.Bool: + return false + case r.Int: + return v.Int() == n + case r.Uint: + u := v.Uint() + if n >= 0 { + return u == uint64(n) + } + // n == -1 means "unsigned integer equals its maximum value" + // similarly, n == -2 means "unsigned integer equals its maximum value minus 1" + // and so on... + un := r.ValueOf(n).Convert(v.Type()).Uint() + return u == un + case r.Float64: + return v.Float() == float64(n) + case r.Complex128: + return v.Complex() == complex(float64(n), 0) + case r.String: + return false + } + // no luck yet... try harder + switch x := x.(type) { + case r.Value: + return false + case UntypedLit: + return x.IsLiteralNumber(n) + } + Errorf("isLiteralNumber: unexpected literal type %v <%v>", x, r.TypeOf(x)) + return false +} + +func (untyp *UntypedLit) IsLiteralNumber(n int64) bool { + obj := untyp.Obj + switch obj.Kind() { + case constant.Int: + m, exact := constant.Int64Val(obj) + return exact && m == n + case constant.Float: + m, exact := constant.Float64Val(obj) + return exact && float64(int64(m)) == m && int64(m) == n + case constant.Complex: + m, exact := constant.Float64Val(constant.Imag(obj)) + if !exact || m != 0.0 { + return false + } + m, exact = constant.Float64Val(constant.Real(obj)) + return exact && float64(int64(m)) == m && int64(m) == n + default: + return false + } +} + +// ================================= ConstTo ================================= + +// ConstTo checks that a constant Expr can be used as the given type. +// panics if not constant, or if Expr is a typed constant of different type +// actually performs type conversion (and subsequent overflow checks) ONLY on untyped constants. +func (e *Expr) ConstTo(t xr.Type) I { + if !e.Const() { + Errorf("internal error: expression is not constant, use Expr.To() instead of Expr.ConstTo() to convert from <%v> to <%v>", e.Type, t) + } + val := e.Lit.ConstTo(t) + if e.Fun != nil { + // no longer valid, recompute it + e.Fun = nil + e.WithFun() + } + return val +} + +// ConstTo checks that a Lit can be used as the given type. +// panics if Lit is a typed constant of different type +// actually performs type conversion (and subsequent overflow checks) ONLY on untyped constants. +func (lit *Lit) ConstTo(t xr.Type) I { + value := lit.Value + // Debugf("Lit.ConstTo(): converting constant %v <%v> (stored as <%v>) to <%v>", value, TypeOf(value), lit.Type, t) + if t == nil { + // only literal nil has type nil + if value != nil { + Errorf("cannot convert constant %v <%v> to ", value, lit.Type) + } + return nil + } + // stricter than t == lit.Type + rfrom := r.TypeOf(value) + rto := t.ReflectType() + if rfrom == rto { + return value + } + switch x := value.(type) { + case UntypedLit: + lit.Type = t + lit.Value = x.ConstTo(t) + // Debugf("Lit.ConstTo(): converted untyped constant %v to %v <%v> (stored as <%v>)", x, lit.Value, TypeOf(lit.Value), t) + return lit.Value + case nil: + // literal nil can only be converted to nillable types + if IsNillableKind(t.Kind()) { + lit.Type = t + return nil + // lit.Value = r.Zero(t).Interface() + // return lit.Value + } + } + if rfrom != nil && rto != nil && (rfrom.AssignableTo(rto) || rfrom.Implements(rto)) { + lit.Type = t + lit.Value = r.ValueOf(value).Convert(rto).Interface() + return lit.Value + } + Errorf("cannot convert typed constant %v <%v> to <%v>", value, r.TypeOf(value), t) + return nil +} + +// ConstTo checks that an UntypedLit can be used as the given type. +// performs actual untyped -> typed conversion and subsequent overflow checks. +// returns the constant converted to given type +func (untyp *UntypedLit) ConstTo(t xr.Type) I { + obj := untyp.Obj + var val interface{} +again: + switch t.Kind() { + case r.Bool: + if obj.Kind() != constant.Bool { + Errorf("cannot convert untyped constant %v to <%v>", untyp, t) + } + val = constant.BoolVal(obj) + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64, + r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr, + r.Float32, r.Float64, r.Complex64, r.Complex128: + + n := untyp.extractNumber(obj, t) + return convertLiteralCheckOverflow(n, t) + case r.String: + if untyp.Obj.Kind() != constant.String { + Errorf("cannot convert untyped constant %v to <%v>", untyp, t) + } + val = UnescapeString(obj.ExactString()) + case r.Interface: + // this can happen too... for example in "var foo interface{} = 7" + // and it requites to convert the untyped constant to its default type. + // obviously, untyped constants can only implement empty interfaces + if t.NumMethod() == 0 { + t = untyp.DefaultType() + goto again + } + fallthrough + default: + Errorf("cannot convert untyped constant %v to <%v>", untyp, t) + return nil + } + v := r.ValueOf(val) + if v.Type() != t.ReflectType() { + val = v.Convert(t.ReflectType()) + } + return val +} + +// ================================= DefaultType ================================= + +// DefaultType returns the default type of an expression. +func (e *Expr) DefaultType() xr.Type { + if e.Untyped() { + return e.Lit.DefaultType() + } + return e.Type +} + +// DefaultType returns the default type of a constant. +func (lit *Lit) DefaultType() xr.Type { + switch x := lit.Value.(type) { + case UntypedLit: + return x.DefaultType() + default: + return lit.Type + } +} + +// DefaultType returns the default type of an untyped constant. +func (untyp *UntypedLit) DefaultType() xr.Type { + switch untyp.Kind { + case r.Bool, r.Int32, r.Int, r.Uint, r.Float64, r.Complex128, r.String: + if universe := untyp.Universe; universe == nil { + Errorf("UntypedLit.DefaultType(): malformed untyped constant %v, has nil Universe!", untyp) + return nil + } else { + return universe.BasicTypes[untyp.Kind] + } + + default: + Errorf("unexpected untyped constant %v, its default type is not known", untyp) + return nil + } +} + +// ======================= utilities for ConstTo and ConstToDefaultType ======================= + +// extractNumber converts the untyped constant src to an integer, float or complex. +// panics if src has different kind from constant.Int, constant.Float and constant.Complex +// the receiver (untyp UntypedLit) and the second argument (t reflect.Type) are only used to pretty-print the panic error message +func (untyp *UntypedLit) extractNumber(src constant.Value, t xr.Type) interface{} { + var n interface{} + var exact bool + switch src.Kind() { + case constant.Int: + n, exact = constant.Int64Val(src) + case constant.Float: + n, exact = constant.Float64Val(src) + case constant.Complex: + re := untyp.extractNumber(constant.Real(src), t) + im := untyp.extractNumber(constant.Imag(src), t) + rfloat := r.ValueOf(re).Convert(TypeOfFloat64).Float() + ifloat := r.ValueOf(im).Convert(TypeOfFloat64).Float() + n = complex(rfloat, ifloat) + exact = true + default: + Errorf("cannot convert untyped constant %v to <%v>", untyp, t) + return nil + } + // allow inexact conversions to float64 and complex128: + // floating point is intrinsically inexact, and Go compiler allows them too + if !exact && src.Kind() == constant.Int { + Errorf("untyped constant %v overflows <%v>", untyp, t) + return nil + } + return n +} + +// convertLiteralCheckOverflow converts a literal to type t and returns the converted value. +// panics if the conversion overflows the given type +func convertLiteralCheckOverflow(src interface{}, to xr.Type) interface{} { + v := r.ValueOf(src) + rto := to.ReflectType() + vto := ConvertValue(v, rto) + + k, kto := v.Kind(), vto.Kind() + if k == kto { + return vto.Interface() // no numeric conversion happened + } + c, cto := KindToCategory(k), KindToCategory(kto) + if cto == r.Int || cto == r.Uint { + if c == r.Float64 || c == r.Complex128 { + // float-to-integer conversion. check for truncation + t1 := ValueType(v) + vback := ConvertValue(vto, t1) + if src != vback.Interface() { + Errorf("constant %v truncated to %v", src, to) + return nil + } + } else { + // integer-to-integer conversion. convert back and compare the interfaces for overflows + t1 := ValueType(v) + vback := vto.Convert(t1) + if src != vback.Interface() { + Errorf("constant %v overflows %v", src, to) + return nil + } + } + } + return vto.Interface() +} + +// SetTypes sets the expression result types +func (e *Expr) SetTypes(tout []xr.Type) { + switch len(tout) { + case 0: + e.Type = nil + e.Types = tout + case 1: + e.Type = tout[0] + e.Types = nil + default: + e.Type = tout[0] + e.Types = tout + } +} + +/* used? + +// Set sets the expression value to the given (typed or untyped) constant +func (e *Expr) Set(x I) { + e.Lit.Set(x) + e.Types = nil + e.Fun = nil + e.IsNil = x == nil +} + +// Set sets the Lit to the given typed constant +func (lit *Lit) Set(x I) { + t := TypeOf(x) + if !isLiteral(x) { + Errorf("cannot set Lit to non-literal value %v <%v>", x, t) + } + lit.Type = t + lit.Value = x +} +*/ + +// To checks that an Expr can be used as (i.e. is assignable to) the given type, +// and converts Expr to the given type. +// panics if Expr has an incompatible type. +func (e *Expr) To(c *Comp, t xr.Type) { + if e.Const() { + e.ConstTo(t) + return + } + if xr.SameType(e.Type, t) { + return + } + if !e.Type.AssignableTo(t) { + c.Errorf("cannot use <%v> as <%v>", e.Type, t) + } + k := e.Type.Kind() + if IsOptimizedKind(k) { + if k == t.Kind() { + // same optimized representation + e.Type = t + return + } else if t.Kind() == r.Interface { + e.Fun = e.AsX1() + e.Type = t + return + } + c.Errorf("internal error: cannot use <%v> as <%v> (should not happen, <%v> is assignable to <%v>", e.Type, t, e.Type, t) + } + fun := e.AsX1() + rtype := t.ReflectType() + zero := r.Zero(rtype) + + if conv := c.Converter(e.Type, t); conv == nil { + e.Fun = func(env *Env) r.Value { + v := fun(env) + if !v.IsValid() { + v = zero + } + return v + } + } else { + e.Fun = func(env *Env) r.Value { + v := fun(env) + if !v.IsValid() { + v = zero + } else { + v = conv(v, rtype) + } + return v + } + } + e.Type = t +} + +// WithFun ensures that Expr.Fun is a closure that will return the expression result: +// +// if Expr is an untyped constant, WithFun converts the constant to its default type (panics on overflows), +// then sets Expr.Fun to a closure that will return such constant. +// if Expr is a typed constant, WithFun sets Expr.Fun to a closure that will return such constant. +// if Expr is not a constant, WithFun does nothing (Expr.Fun must be set already) +func (e *Expr) WithFun() I { + if !e.Const() { + return e.Fun + } + var fun I +again: + value := e.Value + v := r.ValueOf(value) + t := e.Type + if t == nil { + e.Fun = eNil + return eNil + } + if value == nil { + if !IsNillableKind(t.Kind()) { + Errorf("internal error: constant of type <%v> cannot be nil", t) + } + zero := r.Zero(t.ReflectType()) + fun = func(*Env) r.Value { + return zero + } + e.Fun = fun + return fun + } + rtactual := r.TypeOf(value) + rtexpected := t.ReflectType() + if rtexpected != rtactual { + if rtexpected.Kind() == r.Interface && rtactual.Implements(rtexpected) { + v = v.Convert(rtexpected) + } else { + Errorf("internal error: constant %v <%v> was assumed to have type <%v>", value, r.TypeOf(value), t.ReflectType()) + } + } + switch v.Kind() { + case r.Invalid: + fun = eNil + case r.Bool: + if v.Bool() { + fun = eTrue + } else { + fun = eFalse + } + case r.Int: + x := int(v.Int()) + fun = func(env *Env) int { + return x + } + case r.Int8: + x := int8(v.Int()) + fun = func(env *Env) int8 { + return x + } + case r.Int16: + x := int16(v.Int()) + fun = func(env *Env) int16 { + return x + } + case r.Int32: + x := int32(v.Int()) + fun = func(env *Env) int32 { + return x + } + case r.Int64: + x := v.Int() + fun = func(env *Env) int64 { + return x + } + case r.Uint: + x := uint(v.Uint()) + fun = func(env *Env) uint { + return x + } + case r.Uint8: + x := uint8(v.Uint()) + fun = func(env *Env) uint8 { + return x + } + case r.Uint16: + x := uint16(v.Uint()) + fun = func(env *Env) uint16 { + return x + } + case r.Uint32: + x := uint32(v.Uint()) + fun = func(env *Env) uint32 { + return x + } + case r.Uint64: + x := v.Uint() + fun = func(env *Env) uint64 { + return x + } + case r.Uintptr: + x := uintptr(v.Uint()) + fun = func(env *Env) uintptr { + return x + } + case r.Float32: + x := float32(v.Float()) + fun = func(env *Env) float32 { + return x + } + case r.Float64: + x := v.Float() + fun = func(env *Env) float64 { + return x + } + case r.Complex64: + x := complex64(v.Complex()) + fun = func(env *Env) complex64 { + return x + } + case r.Complex128: + x := v.Complex() + fun = func(env *Env) complex128 { + return x + } + case r.String: + x := v.String() + fun = func(env *Env) string { + return x + } + default: + if t.ReflectType() == rtypeOfUntypedLit { + e.ConstTo(e.DefaultType()) + goto again + } + fun = func(env *Env) r.Value { + return v + } + } + e.Fun = fun + return fun +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/macroexpand.go b/vendor/github.com/cosmos72/gomacro/fast/macroexpand.go new file mode 100644 index 0000000..f46bffa --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/macroexpand.go @@ -0,0 +1,293 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * macroexpand.go + * + * Created on Jun 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +// MacroExpandNodeCodewalk traverses the whole AST tree using pre-order traversal, +// and replaces each node with the result of MacroExpandNode(node). +// It implements the macroexpansion phase +func (c *Comp) MacroExpandNodeCodewalk(in ast.Node) (out ast.Node, anythingExpanded bool) { + if in == nil { + return nil, false + } + var form Ast = ToAst(in) + form, anythingExpanded = c.MacroExpandCodewalk(form) + out = ToNode(form) + // if !anythingExpanded { + // c.Debugf("MacroExpand1() nothing to expand: %v <%v>", out, r.TypeOf(out)) + //} + return out, anythingExpanded +} + +// MacroExpandCodewalk traverses the whole AST tree using pre-order traversal, +// and replaces each node with the result of MacroExpand(node). +// It implements the macroexpansion phase +func (c *Comp) MacroExpandCodewalk(in Ast) (out Ast, anythingExpanded bool) { + return c.macroExpandCodewalk(in, 0) +} + +func (c *Comp) macroExpandCodewalk(in Ast, quasiquoteDepth int) (out Ast, anythingExpanded bool) { + if in == nil || in.Size() == 0 { + return in, false + } + debug := c.Options&OptDebugMacroExpand != 0 + if quasiquoteDepth <= 0 { + if debug { + c.Debugf("MacroExpandCodewalk: qq = %d, macroexpanding %v", quasiquoteDepth, in.Interface()) + } + in, anythingExpanded = c.MacroExpand(in) + } + if in != nil { + in = UnwrapTrivialAst(in) + } + if in == nil { + return in, anythingExpanded + } + saved := in + + if expr, ok := in.(UnaryExpr); ok { + isBlockWithinExpr := false + switch expr.X.Op { + case mt.MACRO: + isBlockWithinExpr = true + case mt.QUOTE: + // QUOTE prevents macroexpansion only if found outside any QUASIQUOTE + if quasiquoteDepth == 0 { + return saved, anythingExpanded + } + case mt.QUASIQUOTE: + // extract the body of QUASIQUOTE + quasiquoteDepth++ + case mt.UNQUOTE, mt.UNQUOTE_SPLICE: + // extract the body of UNQUOTE or UNQUOTE_SPLICE + quasiquoteDepth-- + default: + goto Recurse + } + inChild := UnwrapTrivialAst(in.Get(0).Get(1)) + outChild, expanded := c.macroExpandCodewalk(inChild, quasiquoteDepth) + if isBlockWithinExpr { + return outChild, expanded + } else { + out := in + if expanded { + out = MakeQuote2(expr, outChild.(AstWithNode)) + } + return out, expanded + } + } +Recurse: + if in == nil { + return saved, anythingExpanded + } + if debug { + c.Debugf("MacroExpandCodewalk: qq = %d, recursing on %v", quasiquoteDepth, in) + } + out = in.New() + n := in.Size() + if outSlice, canAppend := out.(AstWithSlice); canAppend { + // New() returns zero-length slice... resize it + for i := 0; i < n; i++ { + outSlice = outSlice.Append(nil) + } + out = outSlice + } + for i := 0; i < n; i++ { + child := UnwrapTrivialAst(in.Get(i)) + if child != nil { + expanded := false + if child.Size() != 0 { + child, expanded = c.macroExpandCodewalk(child, quasiquoteDepth) + } + if expanded { + anythingExpanded = true + } + } + out.Set(i, child) + } + if debug { + c.Debugf("MacroExpandCodewalk: qq = %d, expanded to %v", quasiquoteDepth, out) + } + return out, anythingExpanded +} + +// MacroExpandNode repeatedly invokes MacroExpandNode1 +// as long as the node represents a macro call. +// it returns the resulting node. +func (c *Comp) MacroExpandNode(in ast.Node) (out ast.Node, everExpanded bool) { + if in == nil { + return nil, false + } + inAst := ToAst(in) + outAst, everExpanded := c.MacroExpand(inAst) + out = ToNode(outAst) + // if !everExpanded { + // c.Debugf("MacroExpand1() not a macro: %v <%v>", out, r.TypeOf(out)) + //} + return out, everExpanded +} + +// MacroExpand repeatedly invokes MacroExpand +// as long as the node represents a macro call. +// it returns the resulting node. +func (c *Comp) MacroExpand(form Ast) (out Ast, everExpanded bool) { + var expanded bool + for { + form, expanded = c.MacroExpand1(form) + if !expanded { + return form, everExpanded + } + everExpanded = true + } +} + +// if node represents a macro call, MacroExpandNode1 executes it +// and returns the resulting node. +// Otherwise returns the node argument unchanged +func (c *Comp) MacroExpandNode1(in ast.Node) (out ast.Node, expanded bool) { + if in == nil { + return nil, false + } + var form Ast = ToAst(in) + form, expanded = c.MacroExpand1(form) + out = ToNode(form) + // if !expanded { + // c.Debugf("MacroExpandNode1: not a macro: %v <%v>", out, r.TypeOf(out)) + //} + return out, expanded +} + +func (c *Comp) extractMacroCall(form Ast) Macro { + form = UnwrapTrivialAst(form) + switch form := form.(type) { + case Ident: + sym := c.TryResolve(form.X.Name) + if sym != nil && sym.Bind.Desc.Class() == ConstBind && sym.Type.Kind() == r.Struct { + switch value := sym.Value.(type) { + case Macro: + if c.Options&OptDebugMacroExpand != 0 { + c.Debugf("MacroExpand1: found macro: %v", form.X.Name) + } + return value + } + } + } + return Macro{} +} + +// if node represents a macro call, MacroExpandNode1 executes it +// and returns the resulting node. +// Otherwise returns the node argument unchanged +func (c *Comp) MacroExpand1(in Ast) (out Ast, expanded bool) { + if in == nil { + return nil, false + } + // unwrap trivial nodes: DeclStmt, ParenExpr, ExprStmt + in = UnwrapTrivialAstKeepBlocks(in) + ins, ok := in.(AstWithSlice) + if !ok { + return in, false + } + debug := c.Options&OptDebugMacroExpand != 0 + if debug { + c.Debugf("MacroExpand1: found list: %v", ins.Interface()) + } + outs := ins.New().(AstWithSlice) + n := ins.Size() + + // since macro calls are sequences of statements, + // we must scan the whole list, + // consume it as needed by the macros we find, + // and build a new list accumulating the results of macroexpansion + for i := 0; i < n; i++ { + elt := ins.Get(i) + macro := c.extractMacroCall(elt) + if macro.closure == nil { + outs = outs.Append(elt) + continue + } + argn := macro.argNum + leftn := n - i - 1 + var args []r.Value + if argn > leftn { + args := make([]r.Value, leftn+1) // include the macro itself + for j := 0; j <= leftn; j++ { + args[j] = r.ValueOf(ins.Get(i + j).Interface()) + } + c.Errorf("not enough arguments for macroexpansion of %v: expecting %d, found %d", args, macro.argNum, leftn) + return in, false + } + if debug { + c.Debugf("MacroExpand1: found macro call %v at %d-th position of %v", elt.Interface(), i, ins.Interface()) + } + // wrap each ast.Node into a reflect.Value + args = make([]r.Value, argn) + for j := 0; j < argn; j++ { + args[j] = r.ValueOf(ToNode(ins.Get(i + j + 1))) + } + // invoke the macro + results := macro.closure(args) + if debug { + c.Debugf("MacroExpand1: macro expanded to: %v", results) + } + var out Ast + switch len(results) { + default: + args = append([]r.Value{r.ValueOf(elt.Interface())}, args...) + c.Warnf("macroexpansion returned %d values, using only the first one: %v %v returned %v", + len(results), args, results) + fallthrough + case 1: + any := results[0].Interface() + if any != nil { + out = AnyToAst(any, "macroexpansion") + break + } + fallthrough + case 0: + // do not insert nil nodes... they would wreak havok, convert them to the identifier nil + out = Ident{&ast.Ident{Name: "nil"}} + } + outs = outs.Append(out) + i += argn + expanded = true + } + if !expanded { + return in, false + } + if outs.Size() == 0 { + return EmptyStmt{&ast.EmptyStmt{}}, true + } + return UnwrapTrivialAst(outs), true +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_get.go b/vendor/github.com/cosmos72/gomacro/fast/place_get.go new file mode 100644 index 0000000..e981c1a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_get.go @@ -0,0 +1,194 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_get.go + * + * Created on Apr 25, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" +) + +func (c *Comp) GetPlace(place *Place) *Expr { + if place.IsVar() { + return c.Symbol(place.Var.AsSymbol()) + } + lhs := place.Fun + mapkey := place.MapKey + var ret I + if mapkey == nil { + switch place.Type.Kind() { + case r.Bool: + ret = func(env *Env) bool { + return lhs(env).Bool() + } + case r.Int: + ret = func(env *Env) int { + return int(lhs(env).Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + return int8(lhs(env).Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + return int16(lhs(env).Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + return int32(lhs(env).Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + return lhs(env).Int() + } + case r.Uint: + ret = func(env *Env) uint { + return uint(lhs(env).Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + return uint8(lhs(env).Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + return uint16(lhs(env).Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + return uint32(lhs(env).Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + return lhs(env).Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + return uintptr(lhs(env).Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + return float32(lhs(env).Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + return lhs(env).Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + return complex64(lhs(env).Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + return lhs(env).Complex() + } + case r.String: + ret = func(env *Env) string { + return lhs(env).String() + } + default: + ret = lhs + } + } else { + switch place.Type.Kind() { + case r.Bool: + ret = func(env *Env) bool { + return lhs(env).MapIndex(mapkey(env)).Bool() + } + case r.Int: + ret = func(env *Env) int { + return int(lhs(env).MapIndex(mapkey(env)).Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + return int8(lhs(env).MapIndex(mapkey(env)).Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + return int16(lhs(env).MapIndex(mapkey(env)).Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + return int32(lhs(env).MapIndex(mapkey(env)).Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + return lhs(env).MapIndex(mapkey(env)).Int() + } + case r.Uint: + ret = func(env *Env) uint { + return uint(lhs(env).MapIndex(mapkey(env)).Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + return uint8(lhs(env).MapIndex(mapkey(env)).Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + return uint16(lhs(env).MapIndex(mapkey(env)).Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + return uint32(lhs(env).MapIndex(mapkey(env)).Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + return lhs(env).MapIndex(mapkey(env)).Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + return uintptr(lhs(env).MapIndex(mapkey(env)).Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + return float32(lhs(env).MapIndex(mapkey(env)).Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + return lhs(env).MapIndex(mapkey(env)).Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + return complex64(lhs(env).MapIndex(mapkey(env)).Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + return lhs(env).MapIndex(mapkey(env)).Complex() + } + case r.String: + ret = func(env *Env) string { + return lhs(env).MapIndex(mapkey(env)).String() + } + default: + ret = func(env *Env) r.Value { + return lhs(env).MapIndex(mapkey(env)) + } + } + } + return exprFun(place.Type, ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_ops.go b/vendor/github.com/cosmos72/gomacro/fast/place_ops.go new file mode 100644 index 0000000..83c1dd0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_ops.go @@ -0,0 +1,6004 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_ops.go + * + * Created on Apr 25, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) placeAddConst(place *Place, val I) { + if isLiteralNumber(val, 0) || val == "" { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := v.Float() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() + + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() + + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.String: + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetString(lhs.String() + + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.ADD, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float32: + val := float32(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := float64(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex64: + val := complex64(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := complex128(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.String: + val := string(v.String()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result string + + if v := lhs.MapIndex(key); v != Nil { + result = v.String() + } + result += val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.ADD, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeAddExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() + + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() + + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) string: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetString(lhs.String() + + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.ADD, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) string: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result string + + if v := lhs.MapIndex(key); v != Nil { + result = v.String() + } + result += fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.ADD, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeSubConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := v.Float() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() - + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() - + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.SUB, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float32: + val := float32(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := float64(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex64: + val := complex64(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := complex128(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result -= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.SUB, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeSubExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() - + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() - + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SUB, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result -= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SUB, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeMulConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + + c.placeSetZero(place) + return + } else if isLiteralNumber(val, 1) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := v.Float() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() * + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() * + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.MUL, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float32: + val := float32(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := float64(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex64: + val := complex64(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := complex128(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result *= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.MUL, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeMulExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() * + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() * + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.MUL, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result *= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.MUL, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeQuoConst(place *Place, val I) { + if c.placeQuoPow2(place, val) { + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := v.Float() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() / + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() / + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.QUO, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float32: + val := float32(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + val := float64(v.Float()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex64: + val := complex64(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Complex128: + val := complex128(v.Complex()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result /= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.QUO, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeQuoExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() / + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetFloat(lhs.Float() / + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.QUO, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float32 + + if v := lhs.MapIndex(key); v != Nil { + result = float32(v.Float()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result float64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Float() + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex64 + + if v := lhs.MapIndex(key); v != Nil { + result = complex64(v.Complex()) + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result complex128 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Complex() + } + result /= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.QUO, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeRemConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, place.Type) + return + } else if isLiteralNumber(val, 1) { + + c.placeSetZero(place) + return + } + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.REM, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result %= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.REM, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeRemExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() % + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.REM, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result %= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.REM, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeAndConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + c.placeForSideEffects(place) + return + } else if isLiteralNumber(val, 0) { + + c.placeSetZero(place) + return + } + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result &= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeAndExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() & + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.AND, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result &= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.AND, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeOrConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.OR, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result |= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.OR, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeOrExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() | + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.OR, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result |= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.OR, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeXorConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.XOR, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result ^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.XOR, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeXorExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() ^ + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.XOR, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result ^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.XOR, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) placeAndnotConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + + c.placeSetZero(place) + return + } else if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + case r.Int: + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND_NOT, place.Type) + + } + } else { + switch place.Type.Kind() { + case r.Int: + val := int(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + val := int8(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + val := int16(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + val := int32(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + val := int64(v.Int()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + val := uint(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + val := uint8(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + val := uint16(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + val := uint32(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + val := uint64(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + val := uintptr(v.Uint()) + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result &^= val + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND_NOT, place.Type) + + } + } + + c.append(ret) + } +} +func (c *Comp) placeAndnotExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetInt(lhs.Int() &^ + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.AND_NOT, place.Type, funTypeOut(fun)) + + } + } else { + switch fun := fun.(type) { + case func(*Env) int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int + + if v := lhs.MapIndex(key); v != Nil { + result = int(v.Int()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int8 + + if v := lhs.MapIndex(key); v != Nil { + result = int8(v.Int()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int16 + + if v := lhs.MapIndex(key); v != Nil { + result = int16(v.Int()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int32 + + if v := lhs.MapIndex(key); v != Nil { + result = int32(v.Int()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result int64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Int() + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint + + if v := lhs.MapIndex(key); v != Nil { + result = uint(v.Uint()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint8 + + if v := lhs.MapIndex(key); v != Nil { + result = uint8(v.Uint()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint16 + + if v := lhs.MapIndex(key); v != Nil { + result = uint16(v.Uint()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint32 + + if v := lhs.MapIndex(key); v != Nil { + result = uint32(v.Uint()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uint64 + + if v := lhs.MapIndex(key); v != Nil { + result = v.Uint() + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + var result uintptr + + if v := lhs.MapIndex(key); v != Nil { + result = uintptr(v.Uint()) + } + result &^= fun(env) + + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.AND_NOT, place.Type, funTypeOut(fun)) + + } + } + + c.append(ret) +} +func (c *Comp) SetPlace(place *Place, op token.Token, init *Expr) { + if place.IsVar() { + c.SetVar(&place.Var, op, init) + return + } + t := place.Type + if init.Const() { + init.ConstTo(t) + } else if init.Type == nil || !init.Type.AssignableTo(t) { + c.Errorf("incompatible types in assignment: <%v> %s <%v>", t, op, init.Type) + return + } + rt := t.ReflectType() + if init.Const() { + val := init.Value + v := r.ValueOf(val) + if v == None || v == Nil { + v = r.Zero(rt) + val = v.Interface() + } else if v.Type() != rt { + v = v.Convert(rt) + val = v.Interface() + } + switch op { + case token.ASSIGN: + c.placeSetConst(place, val) + case token.ADD, token.ADD_ASSIGN: + c.placeAddConst(place, val) + case token.SUB, token.SUB_ASSIGN: + c.placeSubConst(place, val) + case token.MUL, token.MUL_ASSIGN: + c.placeMulConst(place, val) + case token.QUO, token.QUO_ASSIGN: + c.placeQuoConst(place, val) + case token.REM, token.REM_ASSIGN: + c.placeRemConst(place, val) + case token.AND, token.AND_ASSIGN: + c.placeAndConst(place, val) + case token.OR, token.OR_ASSIGN: + c.placeOrConst(place, val) + case token.XOR, token.XOR_ASSIGN: + c.placeAndConst(place, val) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.placeAndnotConst(place, val) + default: + c.Errorf("operator %s is not implemented", op) + } + } else { + fun := init.Fun + switch op { + case token.ASSIGN: + c.placeSetExpr(place, fun) + case token.ADD, token.ADD_ASSIGN: + c.placeAddExpr(place, fun) + case token.SUB, token.SUB_ASSIGN: + c.placeSubExpr(place, fun) + case token.MUL, token.MUL_ASSIGN: + c.placeMulExpr(place, fun) + case token.QUO, token.QUO_ASSIGN: + c.placeQuoExpr(place, fun) + case token.REM, token.REM_ASSIGN: + c.placeRemExpr(place, fun) + case token.AND, token.AND_ASSIGN: + c.placeAndExpr(place, fun) + case token.OR, token.OR_ASSIGN: + c.placeOrExpr(place, fun) + case token.XOR, token.XOR_ASSIGN: + c.placeAndExpr(place, fun) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.placeAndnotExpr(place, fun) + default: + c.Errorf("operator %s is not implemented", op) + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_ops.gomacro b/vendor/github.com/cosmos72/gomacro/fast/place_ops.gomacro new file mode 100644 index 0000000..dc790cf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_ops.gomacro @@ -0,0 +1,566 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_ops.go + * + * Created on Apr 25, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makeupcase(node ast.Node, name string) ast.Node { + // go/ast.SelectorExpr requires the foo in x.foo to be an *ast.Ident, cannot unquote there + kind := ~"{~,node . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(name)} + return kind +} + +:func makekind(typ ast.Node) ast.Node { + name := EvalType(typ).Name() + return makeupcase(~'r, name) +} + +:func makeunwrapvalue(node ast.Node, typ ast.Node) ast.Node { + name := EvalType(typ).Name() + + // remove final digits from name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(name) != 0 { + ch := name[len(name)-1] + if ch < '0' || ch > '9' { + break + } + name = name[0:len(name)-1] + } + if name == "uintptr" { + name = "uint" // use reflect.Value.Uint() + } + + return makeupcase(node, name) +} + +:func op_to_assign(op token.Token) token.Token { + switch op { + case token.ADD: + op = token.ADD_ASSIGN + case token.SUB: + op = token.SUB_ASSIGN + case token.MUL: + op = token.MUL_ASSIGN + case token.QUO: + op = token.QUO_ASSIGN + case token.REM: + op = token.REM_ASSIGN + case token.AND: + op = token.AND_ASSIGN + case token.OR: + op = token.OR_ASSIGN + case token.XOR: + op = token.XOR_ASSIGN + case token.SHL: + op = token.SHL_ASSIGN + case token.SHR: + op = token.SHR_ASSIGN + case token.AND_NOT: + op = token.AND_NOT_ASSIGN + default: + panic(fmt.Sprintf("cannot convert token %s to assignment token", op)) + } + return op +} + +:func fsetplace(opnode, typ, expr ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + var bind ast.Node + var result *ast.BinaryExpr + op := Eval(opnode).(token.Token) + opset := op_to_assign(op) + + switch t.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32: + result = ~"{lhs.Int() + int64(~,expr)} + result.Op = op + bind = ~"{lhs.SetInt(~,result)} + case r.Int64: + result = ~"{lhs.Int() + ~,expr} + result.Op = op + bind = ~"{lhs.SetInt(~,result)} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uintptr: + result = ~"{lhs.Uint() + uint64(~,expr)} + result.Op = op + bind = ~"{lhs.SetUint(~,result)} + case r.Uint64: + result = ~"{lhs.Uint() + ~,expr} + result.Op = op + bind = ~"{lhs.SetUint(~,result)} + case r.Float32: + result = ~"{lhs.Float() + float64(~,expr)} + result.Op = op + bind = ~"{lhs.SetFloat(~,result)} + case r.Float64: + result = ~"{lhs.Float() + ~,expr} + result.Op = op + bind = ~"{lhs.SetFloat(~,result)} + case r.Complex64: + result = ~"{lhs.Complex() + complex128(~,expr)} + result.Op = op + bind = ~"{lhs.SetComplex(~,result)} + case r.Complex128: + result = ~"{lhs.Complex() + ~,expr} + result.Op = op + bind = ~"{lhs.SetComplex(~,result)} + case r.String: + result = ~"{lhs.String() + ~,expr} + result.Op = op + bind = ~"{lhs.SetString(~,result)} + default: + panic("unimplemented: <" + t.String() + "> " + opset.String() + " expression" ) + } + + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } +} + +:func fsetmap(opnode, typ, expr ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + var curr *ast.BlockStmt + var result *ast.AssignStmt = ~"{result += ~,expr} + op := Eval(opnode).(token.Token) + opset := op_to_assign(op) + result.Tok = opset + + switch t.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = ~,typ(v.Int()) }} + case r.Int64: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = v.Int() }} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uintptr: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = ~,typ(v.Uint()) }} + case r.Uint64: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = v.Uint() }} + case r.Float32: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = ~,typ(v.Float()) }} + case r.Float64: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = v.Float() }} + case r.Complex64: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = ~,typ(v.Complex()) }} + case r.Complex128: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = v.Complex() }} + case r.String: + curr = ~"{var result ~,typ; if v := lhs.MapIndex(key); v != Nil { result = v.String() }} + default: + panic("unimplemented: <" + t.String() + "> " + opset.String() + " expression" ) + } + + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + ~,@curr + ~,result + lhs.SetMapIndex(key, r.ValueOf(result)) + env.IP++ + return env.Code[env.IP], env + } + } +} + +:macro setplace_const(opnode, typ ast.Node) ast.Node { + return fsetplace(opnode, typ, ~'val) +} + +:macro setplace_expr(opnode, typ ast.Node) ast.Node { + return fsetplace(opnode, typ, ~'{fun(env)}) +} + +:macro setmap_const(opnode, typ ast.Node) ast.Node { + return fsetmap(opnode, typ, ~'val) +} + +:macro setmap_expr(opnode, typ ast.Node) ast.Node { + return fsetmap(opnode, typ, ~'{fun(env)}) +} + + +:func list_types(typelist []ast.Stmt) []ast.Node { + rets := make([]ast.Node, 0, len(typelist)) + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + rets = append(rets, ~'nil) + } else if t.Kind() == r.Int { + rets = append(rets, ~'int, ~'int8, ~'int16, ~'int32, ~'int64) + } else if t.Kind() == r.Uint { + rets = append(rets, ~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr) + } else if t.Kind() == r.Float64 { + rets = append(rets, ~'float32, ~'float64) + } else if t.Kind() == r.Complex128 { + rets = append(rets, ~'complex64, ~'complex128) + } else { + rets = append(rets, typ) + } + } + return rets +} + +:macro setplaces_const(opnode, types ast.Node) ast.Node { + // separate cases for int8, uint16... not needed + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= on <%v>`, ~,opnode, place.Type)} + } else { + kind := makekind(typ) + unwrap := makeunwrapvalue(~'v, typ) + caselist[i] = ~"{case ~,kind: + val := ~,unwrap () + setplace_const; ~,opnode; ~,typ + } + } + } + // separate cases for int8, uint16... are needed + maptypelist := list_types(types.(*ast.BlockStmt).List) + mapcaselist := make([]ast.Stmt, len(maptypelist)) + for i, typ := range maptypelist { + if EvalType(typ) == nil { + mapcaselist[i] = ~"{default: c.Errorf(`invalid operator %s= on <%v>`, ~,opnode, place.Type)} + } else { + kind := makekind(typ) + unwrap := makeunwrapvalue(~'v, typ) + mapcaselist[i] = ~"{case ~,kind: + val := ~,typ( ~,unwrap () ) + setmap_const; ~,opnode; ~,typ + } + } + } + return ~"{ + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + v := r.ValueOf(val) + + if keyfun == nil { + switch KindToCategory(place.Type.Kind()) { + ~,@caselist + } + } else { + switch place.Type.Kind() { + ~,@mapcaselist + } + } + c.append(ret) + } +} + +:macro setplaces_expr(opnode, types ast.Node) ast.Node { + typelist := list_types(types.(*ast.BlockStmt).List) + caselist := make([]ast.Stmt, len(typelist)) + mapcaselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= between <%v> and <%v>`, ~,opnode, place.Type, funTypeOut(fun))} + mapcaselist[i] = caselist[i] + } else { + caselist[i] = ~"{~typecase func(*Env) ~,typ: + setplace_expr; ~,opnode; ~,typ + } + mapcaselist[i] = ~"{~typecase func(*Env) ~,typ: + setmap_expr; ~,opnode; ~,typ + } + } + } + return ~"{ + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + if keyfun == nil { + switch fun := fun.(type) { + ~,@caselist + } + } else { + switch fun := fun.(type) { + ~,@mapcaselist + } + } + c.append(ret) + } +} + +// varAddConst compiles 'place += constant' +func (c *Comp) placeAddConst(place *Place, val I) { + if isLiteralNumber(val, 0) || val == "" { + c.placeForSideEffects(place) + return + } + setplaces_const; token.ADD; {int; uint; float64; complex128; string; nil} +} + +// varAddExpr compiles 'place += expression' +func (c *Comp) placeAddExpr(place *Place, fun I) { + setplaces_expr; token.ADD; {int; uint; float64; complex128; string; nil} +} + +// placeSubConst compiles 'place -= constant' +func (c *Comp) placeSubConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.SUB; {int; uint; float64; complex128; nil} +} + +// placeSubExpr compiles 'place -= expression' +func (c *Comp) placeSubExpr(place *Place, fun I) { + setplaces_expr; token.SUB; {int; uint; float64; complex128; nil} +} + +// placeMulConst compiles 'place *= constant' +func (c *Comp) placeMulConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + // placeiable *= 0 is equivalent to place = 0 + c.placeSetZero(place) + return + } else if isLiteralNumber(val, 1) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.MUL; {int; uint; float64; complex128; nil} +} + +// placeMulExpr compiles 'place *= expression' +func (c *Comp) placeMulExpr(place *Place, fun I) { + setplaces_expr; token.MUL; {int; uint; float64; complex128; nil} +} + +// placeQuoConst compiles 'place /= constant' +func (c *Comp) placeQuoConst(place *Place, val I) { + if c.placeQuoPow2(place, val) { + return + } + setplaces_const; token.QUO; {int; uint; float64; complex128; nil} +} + +// placeQuoExpr compiles 'place /= expression' +func (c *Comp) placeQuoExpr(place *Place, fun I) { + setplaces_expr; token.QUO; {int; uint; float64; complex128; nil} +} + +// placeRemConst compiles 'place %= constant' +func (c *Comp) placeRemConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, place.Type) + return + } else if isLiteralNumber(val, 1) { + // place %= 1 is equivalent to place = 0 + c.placeSetZero(place) + return + } + } + setplaces_const; token.REM; {int; uint; nil} +} + +// placeRemExpr compiles 'place %= expression' +func (c *Comp) placeRemExpr(place *Place, fun I) { + setplaces_expr; token.REM; {int; uint; nil} +} + +// placeAndConst compiles 'place &= constant' +func (c *Comp) placeAndConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + c.placeForSideEffects(place) + return + } else if isLiteralNumber(val, 0) { + // place &= 0 is equivalent to place = 0 + c.placeSetZero(place) + return + } + } + setplaces_const; token.AND; {int; uint; nil} +} + +// placeAndExpr compiles 'place &= expression' +func (c *Comp) placeAndExpr(place *Place, fun I) { + setplaces_expr; token.AND; {int; uint; nil} +} + +// placeOrConst compiles 'place |= constant' +func (c *Comp) placeOrConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.OR; {int; uint; nil} +} + +// placeOrExpr compiles 'place |= expression' +func (c *Comp) placeOrExpr(place *Place, fun I) { + setplaces_expr; token.OR; {int; uint; nil} +} + +// placeXorConst compiles 'place ^= constant' +func (c *Comp) placeXorConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.XOR; {int; uint; nil} +} + +// placeXorExpr compiles 'place ^= expression' +func (c *Comp) placeXorExpr(place *Place, fun I) { + setplaces_expr; token.XOR; {int; uint; nil} +} + +// placeAndnotConst compiles 'place &^= constant' +func (c *Comp) placeAndnotConst(place *Place, val I) { + if IsCategory(place.Type.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + // place &^= -1 is equivalent to place = 0 + c.placeSetZero(place) + return + } else if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + } + setplaces_const; token.AND_NOT; {int; uint; nil} +} + +// varAndnotExpr compiles 'place &^= expression' +func (c *Comp) placeAndnotExpr(place *Place, fun I) { + setplaces_expr; token.AND_NOT; {int; uint; nil} +} + + +// SetPlace compiles an assignment to a place: +// 'place op constant' and 'place op expression' +func (c *Comp) SetPlace(place *Place, op token.Token, init *Expr) { + if place.IsVar() { + c.SetVar(&place.Var, op, init) + return + } + t := place.Type + if init.Const() { + init.ConstTo(t) + } else if init.Type == nil || !init.Type.AssignableTo(t) { + c.Errorf("incompatible types in assignment: <%v> %s <%v>", t, op, init.Type) + return + } + rt := t.ReflectType() + if init.Const() { + val := init.Value + v := r.ValueOf(val) + if v == None || v == Nil { + v = r.Zero(rt) + val = v.Interface() + } else if v.Type() != rt { + v = v.Convert(rt) + val = v.Interface() + } + switch op { + case token.ASSIGN: + c.placeSetConst(place, val) + case token.ADD, token.ADD_ASSIGN: + c.placeAddConst(place, val) + case token.SUB, token.SUB_ASSIGN: + c.placeSubConst(place, val) + case token.MUL, token.MUL_ASSIGN: + c.placeMulConst(place, val) + case token.QUO, token.QUO_ASSIGN: + c.placeQuoConst(place, val) + case token.REM, token.REM_ASSIGN: + c.placeRemConst(place, val) + case token.AND, token.AND_ASSIGN: + c.placeAndConst(place, val) + case token.OR, token.OR_ASSIGN: + c.placeOrConst(place, val) + case token.XOR, token.XOR_ASSIGN: + c.placeAndConst(place, val) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.placeAndnotConst(place, val) + default: + c.Errorf("operator %s is not implemented", op) + } + } else { + fun := init.Fun + switch op { + case token.ASSIGN: + c.placeSetExpr(place, fun) + case token.ADD, token.ADD_ASSIGN: + c.placeAddExpr(place, fun) + case token.SUB, token.SUB_ASSIGN: + c.placeSubExpr(place, fun) + case token.MUL, token.MUL_ASSIGN: + c.placeMulExpr(place, fun) + case token.QUO, token.QUO_ASSIGN: + c.placeQuoExpr(place, fun) + case token.REM, token.REM_ASSIGN: + c.placeRemExpr(place, fun) + case token.AND, token.AND_ASSIGN: + c.placeAndExpr(place, fun) + case token.OR, token.OR_ASSIGN: + c.placeOrExpr(place, fun) + case token.XOR, token.XOR_ASSIGN: + c.placeAndExpr(place, fun) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.placeAndnotExpr(place, fun) + default: + c.Errorf("operator %s is not implemented", op) + } + } +} + + diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_set.go b/vendor/github.com/cosmos72/gomacro/fast/place_set.go new file mode 100644 index 0000000..a845a42 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_set.go @@ -0,0 +1,439 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_set.go + * + * Created on Apr 25, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) placeSetZero(place *Place) { + rt := place.Type.ReflectType() + zero := r.Zero(rt).Interface() + c.placeSetConst(place, zero) +} +func (c *Comp) placeSetConst(place *Place, val I) { + rt := place.Type.ReflectType() + v := r.ValueOf(val) + if ValueType(v) == nil { + v = r.Zero(rt) + } else { + v = v.Convert(rt) + } + + lhs := place.Fun + var ret Stmt + if mapkey := place.MapKey; mapkey != nil { + ret = func(env *Env) (Stmt, *Env) { + + obj := lhs(env) + key := mapkey(env) + obj.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + c.append(ret) + return + } + switch KindToCategory(rt.Kind()) { + case r.Bool: + + { + val := v.Bool() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetBool(val) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int: + + { + val := v.Int() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetInt(val) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + + { + val := v.Uint() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetUint(val) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Float64: + + { + val := v.Float() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetFloat(val) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Complex128: + + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetComplex(val) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.String: + + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).SetString(val) + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + { + val := v + + ret = func(env *Env) (Stmt, *Env) { + lhs(env).Set(val) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + c.append(ret) +} +func (c *Comp) placeSetExpr(place *Place, fun I) { + rt := place.Type.ReflectType() + lhs := place.Fun + var ret Stmt + if mapkey := place.MapKey; mapkey != nil { + rhs := funAsX1(fun, nil) + ret = func(env *Env) (Stmt, *Env) { + + obj := lhs(env) + key := mapkey(env) + val := rhs(env) + if val.Type() != rt { + val = val.Convert(rt) + } + + obj.SetMapIndex(key, val) + env.IP++ + return env.Code[env.IP], env + } + c.append(ret) + return + } + switch rt.Kind() { + case r.Bool: + + { + rhs := fun.(func(*Env) bool) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetBool(value) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int: + + { + rhs := fun.(func(*Env) int) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int8: + + { + rhs := fun.(func(*Env) int8) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int16: + + { + rhs := fun.(func(*Env) int16) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int32: + + { + rhs := fun.(func(*Env) int32) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Int64: + + { + rhs := fun.(func(*Env) int64) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + + { + rhs := fun.(func(*Env) uint) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint8: + + { + rhs := fun.(func(*Env) uint8) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint16: + + { + rhs := fun.(func(*Env) uint16) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint32: + + { + rhs := fun.(func(*Env) uint32) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint64: + + { + rhs := fun.(func(*Env) uint64) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uintptr: + + { + rhs := fun.(func(*Env) uintptr) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Float32: + + { + rhs := fun.(func(*Env) float32) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetFloat(float64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Float64: + + { + rhs := fun.(func(*Env) float64) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetFloat(float64(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Complex64: + + { + rhs := fun.(func(*Env) complex64) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetComplex(complex128(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Complex128: + + { + rhs := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetComplex(complex128(value)) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.String: + + { + rhs := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + place.SetString(value) + + env.IP++ + return env.Code[env.IP], env + } + } + default: + { + rhs := funAsX1(fun, nil) + + zero := r.Zero(rt) + ret = func(env *Env) (Stmt, *Env) { + place := lhs(env) + value := rhs(env) + if value == Nil || value == None { + value = zero + } else if value.Type() != rt { + value = value.Convert(rt) + } + + place.Set(value) + + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_set.gomacro b/vendor/github.com/cosmos72/gomacro/fast/place_set.gomacro new file mode 100644 index 0000000..49491b6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_set.gomacro @@ -0,0 +1,269 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_set.go + * + * Created on Apr 25, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + r "reflect" +) + +:func fsetplace_const(typ ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + + var decl, bind, mapbind ast.Node + + if t == nil { + decl = ~'{val := v} + bind = ~'{lhs(env).Set(val)} + } else { + switch t.Kind() { + case r.Bool: + decl = ~'{val := v.Bool()} + bind = ~'{lhs(env).SetBool(val)} + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + decl = ~'{val := v.Int()} + bind = ~'{lhs(env).SetInt(val)} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + decl = ~'{val := v.Uint()} + bind = ~'{lhs(env).SetUint(val)} + case r.Float32, r.Float64: + decl = ~'{val := v.Float()} + bind = ~'{lhs(env).SetFloat(val)} + case r.Complex64, r.Complex128: + decl = ~'{val := v.Complex()} + bind = ~'{lhs(env).SetComplex(val)} + case r.String: + decl = ~'{val := v.String()} + bind = ~'{lhs(env).SetString(val)} + default: + panic("fsetplace_const unimplemented for type " + t.String()) + } + } + + return ~"{ + ~,decl + ret = func(env *Env) (Stmt, *Env) { + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } +} + +:func fsetplace_expr(typ ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + + var decl, bind ast.Node + + if t == nil { + decl = ~'{rhs := funAsX1(fun, nil)} + bind = ~'{ + // force left-to-right evaluation order + place := lhs(env) + value := rhs(env) + if value == Nil || value == None { + value = zero + } else if value.Type() != rt { + value = value.Convert(rt) + } + place.Set(value) + } + return ~"{ + ~,decl + zero := r.Zero(rt) + ret = func(env *Env) (Stmt, *Env) { + ~,@bind + env.IP++ + return env.Code[env.IP], env + } + } + } + + decl = ~"{rhs := fun.(func (*Env) ~,typ)} + switch t.Kind() { + case r.Bool: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetBool(value) + } + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetInt(int64(value)) + } + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetUint(uint64(value)) + } + case r.Float32, r.Float64: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetFloat(float64(value)) + } + case r.Complex64, r.Complex128: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetComplex(complex128(value)) + } + case r.String: + bind = ~'{ + place := lhs(env) + value := rhs(env) + place.SetString(value) + } + default: + panic("fsetplace_expr unimplemented for type " + t.String()) + } + return ~"{ + ~,decl + ret = func(env *Env) (Stmt, *Env) { + ~,@bind + env.IP++ + return env.Code[env.IP], env + } + } +} + +:macro setplace_const(typ ast.Node) ast.Node { + return fsetplace_const(typ) +} + +:macro setplace_expr(typ ast.Node) ast.Node { + return fsetplace_expr(typ) +} + +:macro setplaces_const() ast.Node { + return ~"{ + switch KindToCategory(rt.Kind()) { + case r.Bool: setplace_const; bool + case r.Int: setplace_const; int + case r.Uint: setplace_const; uint + case r.Float64: setplace_const; float64 + case r.Complex128: setplace_const; complex128 + case r.String: setplace_const; string + default: setplace_const; nil + } + } +} + +:macro setplaces_expr() ast.Node { + return ~"{ + switch rt.Kind() { + case r.Bool: setplace_expr; bool; + case r.Int: setplace_expr; int; + case r.Int8: setplace_expr; int8; + case r.Int16: setplace_expr; int16; + case r.Int32: setplace_expr; int32; + case r.Int64: setplace_expr; int64; + case r.Uint: setplace_expr; uint; + case r.Uint8: setplace_expr; uint8; + case r.Uint16: setplace_expr; uint16; + case r.Uint32: setplace_expr; uint32; + case r.Uint64: setplace_expr; uint64; + case r.Uintptr: setplace_expr; uintptr; + case r.Float32: setplace_expr; float32; + case r.Float64: setplace_expr; float64; + case r.Complex64: setplace_expr; complex64; + case r.Complex128: setplace_expr; complex128; + case r.String: setplace_expr; string; + default: setplace_expr; nil; + } + } +} + +// placeSetZero compiles 'place = 0' +func (c *Comp) placeSetZero(place *Place) { + rt := place.Type.ReflectType() + zero := r.Zero(rt).Interface() + c.placeSetConst(place, zero) +} + +// placeSetConst compiles 'place = constant' +func (c *Comp) placeSetConst(place *Place, val I) { + rt := place.Type.ReflectType() + v := r.ValueOf(val) + if ValueType(v) == nil { + v = r.Zero(rt) + } else { + v = v.Convert(rt) + } + lhs := place.Fun + var ret Stmt + if mapkey := place.MapKey; mapkey != nil { + ret = func(env *Env) (Stmt, *Env) { + // enforce left-to-right evaluation order + obj := lhs(env) + key := mapkey(env) + obj.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + c.append(ret) + return + } + setplaces_const + c.append(ret) +} + +// placeSetExpr compiles 'place = expression' +func (c *Comp) placeSetExpr(place *Place, fun I) { + rt := place.Type.ReflectType() + lhs := place.Fun + var ret Stmt + if mapkey := place.MapKey; mapkey != nil { + rhs := funAsX1(fun, nil) + ret = func(env *Env) (Stmt, *Env) { + // enforce left-to-right evaluation order + obj := lhs(env) + key := mapkey(env) + val := rhs(env) + if val.Type() != rt { + val = val.Convert(rt) + } + obj.SetMapIndex(key, val) + env.IP++ + return env.Code[env.IP], env + } + c.append(ret) + return + } + setplaces_expr + c.append(ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_set_value.go b/vendor/github.com/cosmos72/gomacro/fast/place_set_value.go new file mode 100644 index 0000000..271f5a5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_set_value.go @@ -0,0 +1,94 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_set_value.go + * + * Created on May 29, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +// placeSetValue compiles 'place = value' where value is a reflect.Value passed at runtime. +// Used to assign places with the result of multi-valued expressions, +// and to implement multiple assignment place1, place2... = expr1, expr2... +func (c *Comp) placeSetValue(place *Place) func(lhs, key, val r.Value) { + rtype := place.Type.ReflectType() + + if place.MapKey != nil { + zero := r.Zero(rtype) + return func(lhs, key, val r.Value) { + if val == Nil || val == None { + val = zero + } else if val.Type() != rtype { + val = val.Convert(rtype) + } + lhs.SetMapIndex(key, val) + } + } + var ret func(r.Value, r.Value, r.Value) + switch KindToCategory(rtype.Kind()) { + case r.Bool: + ret = func(lhs, key, val r.Value) { + lhs.SetBool(val.Bool()) + } + case r.Int: + ret = func(lhs, key, val r.Value) { + lhs.SetInt(val.Int()) + } + case r.Uint: + ret = func(lhs, key, val r.Value) { + lhs.SetUint(val.Uint()) + } + case r.Float64: + ret = func(lhs, key, val r.Value) { + lhs.SetFloat(val.Float()) + } + case r.Complex128: + ret = func(lhs, key, val r.Value) { + lhs.SetComplex(val.Complex()) + } + case r.String: + ret = func(lhs, key, val r.Value) { + lhs.SetString(val.String()) + } + default: + zero := r.Zero(rtype) + ret = func(lhs, key, val r.Value) { + if val == Nil || val == None { + val = zero + } else if val.Type() != rtype { + val = val.Convert(rtype) + } + lhs.Set(val) + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_shifts.go b/vendor/github.com/cosmos72/gomacro/fast/place_shifts.go new file mode 100644 index 0000000..1721c6f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_shifts.go @@ -0,0 +1,1148 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_shifts.go + * + * Created on May 17, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) placeShlConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + val := r.ValueOf(val).Uint() + + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } else { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + } + + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", token.SHL, place.Type) + } + + c.append(ret) + } +} +func (c *Comp) placeShlExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + case r.Int: + + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result << + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + } + } else { + switch cat { + case r.Int: + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result << + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", token.SHL, place.Type) + } + + c.append(ret) +} +func (c *Comp) placeShrConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + val := r.ValueOf(val).Uint() + + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } else { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + } + + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", token.SHR, place.Type) + } + + c.append(ret) + } +} +func (c *Comp) placeShrExpr(place *Place, fun I) { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + case r.Int: + + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + lhs.SetInt(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + } + } else { + switch cat { + case r.Int: + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + case r.Uint: + switch fun := fun.(type) { + case func(*Env) uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + fun(env), + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", token.SHR, place.Type) + } + + c.append(ret) +} +func (c *Comp) placeQuoPow2(place *Place, val I) bool { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, r.TypeOf(val)) + return false + } else if isLiteralNumber(val, 1) { + c.placeForSideEffects(place) + return true + } + + ypositive := true + yv := r.ValueOf(val) + ycat := KindToCategory(yv.Kind()) + var y uint64 + switch ycat { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + + case r.Uint: + y = yv.Uint() + default: + return false + } + if !isPowerOfTwo(y) { + return false + } + + shift := integerLen(y) - 1 + + if !ypositive { + return false + } + + var roundup int64 + if ycat == r.Int { + roundup = int64(y - 1) + } + { + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + val := shift + + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Int() + + if result < 0 { + result += roundup + } + lhs.SetInt(result >> + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := lhs.Uint() + lhs.SetUint(result >> + val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } else { + switch cat { + case r.Int: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Int() + + if result < 0 { + result += roundup + } + + v := r.ValueOf(result >> + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := lhs.MapIndex(key).Uint() + + v := r.ValueOf(result >> + val, + ) + if v.Type() != rt { + v = v.Convert(rt) + } + + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + } + + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", token.QUO, place.Type) + } + + c.append(ret) + } + return true +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/place_shifts.gomacro b/vendor/github.com/cosmos72/gomacro/fast/place_shifts.gomacro new file mode 100644 index 0000000..48973f7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/place_shifts.gomacro @@ -0,0 +1,404 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * place_shifts.go + * + * Created on May 17, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" +) + + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makeupcase(node ast.Node, name string) ast.Node { + // go/ast.SelectorExpr requires the foo in x.foo to be an *ast.Ident, cannot unquote there + kind := ~"{~,node . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(name)} + return kind +} + +:func makekind(typ ast.Node) ast.Node { + name := EvalType(typ).Name() + return makeupcase(~'r, name) +} + +:func fsetplace(opnode, typ, expr, roundup ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + var get, set ast.Node + var shift *ast.BinaryExpr = ~"{result >> ~,expr} + op := Eval(opnode).(token.Token) + shift.Op = op + signed := false + + switch t.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + get = ~"{lhs.Int()} + set = ~"{lhs.SetInt(~,shift)} + signed = true + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + get = ~"{lhs.Uint()} + set = ~"{lhs.SetUint(~,shift)} + default: + panic("invalid operator " + op.String() + "= on " + t.String()) + } + + if signed && Eval(roundup) == true { + return ~"{ + // used to optimize division by constant-power-of-two + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := ~,get + if result < 0 { + result += roundup + } + ~,set + env.IP++ + return env.Code[env.IP], env + } + } + } + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + result := ~,get + ~,set + env.IP++ + return env.Code[env.IP], env + } + } +} + +:func fsetmap(opnode, typ, expr, option ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + var get ast.Node + var shift *ast.BinaryExpr = ~"{result >> ~,expr} + op := Eval(opnode).(token.Token) + shift.Op = op + signed := false + + switch t.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + get = ~"{lhs.MapIndex(key).Int()} + signed = true + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + get = ~"{lhs.MapIndex(key).Uint()} + default: + panic("invalid operator " + op.String() + "= on " + t.String()) + } + + var opt interface{} = Eval(option) + if signed && opt == true { + return ~"{ + // used to optimize division by constant-power-of-two + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := ~,get + if result < 0 { + result += roundup + } + v := r.ValueOf(~,shift) + if v.Type() != rt { + v = v.Convert(rt) + } + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + } else { + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + lhs := lhsfun(env) + key := keyfun(env) + result := ~,get + v := r.ValueOf(~,shift) + if v.Type() != rt { + v = v.Convert(rt) + } + lhs.SetMapIndex(key, v) + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:macro setplace_const(opnode, typ, option ast.Node) ast.Node { + return fsetplace(opnode, typ, ~'val, option) +} + +:macro setplace_expr(opnode, typ ast.Node) ast.Node { + return fsetplace(opnode, typ, ~'{fun(env)}, nil) +} + +:macro setmap_const(opnode, typ, option ast.Node) ast.Node { + return fsetmap(opnode, typ, ~'val, option) +} + +:macro setmap_expr(opnode, typ ast.Node) ast.Node { + return fsetmap(opnode, typ, ~'{fun(env)}, ~'0) +} + + +:func list_types(typelist []ast.Stmt) []ast.Node { + rets := make([]ast.Node, 0, len(typelist)) + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + rets = append(rets, ~'nil) + } else if t.Kind() == r.Int { + rets = append(rets, ~'int, ~'int8, ~'int16, ~'int32, ~'int64) + } else if t.Kind() == r.Uint { + rets = append(rets, ~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr) + } else if t.Kind() == r.Float64 { + rets = append(rets, ~'float32, ~'float64) + } else if t.Kind() == r.Complex128 { + rets = append(rets, ~'complex64, ~'complex128) + } else { + rets = append(rets, typ) + } + } + return rets +} + +:macro setplaces_const(opnode, types, roundup ast.Node) ast.Node { + // separate cases for int8, uint16... not needed + typelist := types.(*ast.BlockStmt).List + caselist := make([]ast.Stmt, len(typelist)) + mapcaselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + kind := makekind(typ) + caselist[i] = ~"{case ~,kind: + setplace_const; ~,opnode; ~,typ; ~,roundup + } + mapcaselist[i] = ~"{case ~,kind: + setmap_const; ~,opnode; ~,typ; ~,roundup + } + } + var conv ast.Node + var isroundup interface{} = Eval(roundup) + if isroundup == true { + conv = ~'shift + opnode = ~'{token.QUO} // for error messages + } else { + conv = ~'{r.ValueOf(val).Uint()} + } + + return ~"{ + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + val := ~,conv + + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + ~,@caselist + } + } else { + switch cat { + ~,@mapcaselist + } + } + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", ~,opnode, place.Type) + } + c.append(ret) + } +} + +:macro setplaces_expr(opnode, ltyp, rtypes ast.Node) ast.Node { + rtypelist := list_types(rtypes.(*ast.BlockStmt).List) + + caselist := make([]ast.Stmt, len(rtypelist)) + for i, rtyp := range rtypelist { + caselist[i] = ~"{~typecase func(*Env) ~,rtyp: + setplace_expr; ~,opnode; ~,ltyp + } + } + return ~"{ + switch fun := fun.(type) { + ~,@caselist + } + } +} + +:macro setmaps_expr(opnode, ltyp, rtypes ast.Node) ast.Node { + rtypelist := list_types(rtypes.(*ast.BlockStmt).List) + + caselist := make([]ast.Stmt, len(rtypelist)) + for i, rtyp := range rtypelist { + caselist[i] = ~"{~typecase func(*Env) ~,rtyp: + setmap_expr; ~,opnode; ~,ltyp + } + } + return ~"{ + switch fun := fun.(type) { + ~,@caselist + } + } +} + +:macro setplacess_expr(opnode, ltypes, rtypes ast.Node) ast.Node { + ltypelist := ltypes.(*ast.BlockStmt).List + + caselist := make([]ast.Stmt, len(ltypelist)) + mapcaselist := make([]ast.Stmt, len(ltypelist)) + for i, ltyp := range ltypelist { + kind := makekind(ltyp) + caselist[i] = ~"{case ~,kind: + setplaces_expr; ~,opnode; ~,ltyp; ~,rtypes + } + mapcaselist[i] = ~"{case ~,kind: + setmaps_expr; ~,opnode; ~,ltyp; ~,rtypes + } + } + return ~"{ + var ret Stmt + lhsfun := place.Fun + keyfun := place.MapKey + t := place.Type + rt := t.ReflectType() + cat := KindToCategory(t.Kind()) + if keyfun == nil { + switch cat { + ~,@caselist + } + } else { + switch cat { + ~,@mapcaselist + } + } + if ret == nil { + c.Errorf("invalid operator %s= on <%v>", ~,opnode, place.Type) + } + c.append(ret) + } +} + +// placeShlConst compiles 'place <<= constant' +func (c *Comp) placeShlConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.SHL; {int; uint}; false +} + +// placeShlExpr compiles 'place <<= expression' +func (c *Comp) placeShlExpr(place *Place, fun I) { + setplacess_expr; token.SHL; {int; uint}; {uint} +} + +// placeShrConst compiles 'place >>= constant' +func (c *Comp) placeShrConst(place *Place, val I) { + if isLiteralNumber(val, 0) { + c.placeForSideEffects(place) + return + } + setplaces_const; token.SHR; {int; uint}; false +} + +// placeShrExpr compiles 'place >>= expression' +func (c *Comp) placeShrExpr(place *Place, fun I) { + setplacess_expr; token.SHR; {int; uint}; {uint} +} + +// placeQuoPow2 compiles 'place /= constant-power-of-two' +func (c *Comp) placeQuoPow2(place *Place, val I) bool { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, r.TypeOf(val)) + return false + } else if isLiteralNumber(val, 1) { + c.placeForSideEffects(place) + return true // nothing to do + } + + ypositive := true + yv := r.ValueOf(val) + ycat := KindToCategory(yv.Kind()) + var y uint64 + switch ycat { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + case r.Uint: + y = yv.Uint() + default: + // floating point or complex division + return false + } + if !isPowerOfTwo(y) { + // division by multiplication and shift not implemented... + return false + } + // attention: xe / (2**n) and xe >> n have different truncation rules for negative xe: + // quotient / truncates toward zero + // right shift >> truncates toward negative infinity + // see quoPow2() in binary_ops.go for more details + shift := integerLen(y) - 1 + + if !ypositive { + return false // not yet implemented + } + + var roundup int64 + if ycat == r.Int { + // fix rounding mode + roundup = int64(y-1) + } + setplaces_const; token.SHR; {int; uint}; true + + return true +} + diff --git a/vendor/github.com/cosmos72/gomacro/fast/quasiquote.go b/vendor/github.com/cosmos72/gomacro/fast/quasiquote.go new file mode 100644 index 0000000..b958f17 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/quasiquote.go @@ -0,0 +1,290 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * quasiquote.go + * + * Created on Jun 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "fmt" + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/ast2" + . "github.com/cosmos72/gomacro/base" + mp "github.com/cosmos72/gomacro/parser" + mt "github.com/cosmos72/gomacro/token" +) + +var ( + rtypeOfNode = r.TypeOf((*ast.Node)(nil)).Elem() + rtypeOfUnaryExpr = r.TypeOf((*ast.UnaryExpr)(nil)) + rtypeOfBlockStmt = r.TypeOf((*ast.BlockStmt)(nil)).Elem() +) + +func (c *Comp) quasiquoteUnary(unary *ast.UnaryExpr) *Expr { + block := unary.X.(*ast.FuncLit).Body + node := SimplifyNodeForQuote(block, true) + + if block != nil && len(block.List) == 1 { + if unary, ok := SimplifyNodeForQuote(block.List[0], false).(*ast.UnaryExpr); ok && (unary.Op == mt.UNQUOTE || unary.Op == mt.UNQUOTE_SPLICE) { + // to support quasiquote{unquote ...} and quasiquote{unquote_splice ...} + // we invoke SimplifyNodeForQuote() at the end, not at the beginning. + + in := ToAst(block) + expr := c.quasiquote1(in, 1, true) + + if unary.Op == mt.UNQUOTE_SPLICE { + return expr + } + fun := expr.AsX1() + toUnwrap := block != node + return exprX1(c.Universe.FromReflectType(rtypeOfNode), func(env *Env) r.Value { + x := ValueInterface(fun(env)) + node := AnyToAstWithNode(x, "Quasiquote").Node() + node = SimplifyNodeForQuote(node, toUnwrap) + return r.ValueOf(node) + }) + } + } + return c.quasiquote1(ToAst(node), 1, true) +} + +// Quasiquote expands and compiles ~quasiquote, if Ast starts with it +func (c *Comp) Quasiquote(in Ast) *Expr { + switch form := in.(type) { + case UnaryExpr: + if form.Op() == mt.QUASIQUOTE { + body := form.X.X.(*ast.FuncLit).Body + return c.quasiquote1(ToAst(body), 1, true) + } + } + return c.Compile(in) +} + +func (c *Comp) quasiquote1(in Ast, depth int, can_splice bool) *Expr { + expr, _ := c.quasiquote(in, depth, can_splice) + return expr +} + +// quasiquote expands and compiles the contents of a ~quasiquote +func (c *Comp) quasiquote(in Ast, depth int, can_splice bool) (*Expr, bool) { + if in == nil || in.Interface() == nil { + return nil, false + } + debug := c.Options&OptDebugQuasiquote != 0 + var label string + if can_splice { + label = " splice" + } + if debug { + c.Debugf("Quasiquote[%d]%s expanding %s: %v <%v>", depth, label, mt.String(mt.QUASIQUOTE), in.Interface(), r.TypeOf(in.Interface())) + } + + switch in := in.(type) { + case AstWithSlice: + n := in.Size() + funs := make([]func(*Env) r.Value, 0, n) + splices := make([]bool, 0, n) + positions := make([]token.Position, 0, n) + for i := 0; i < n; i++ { + if form := in.Get(i); form != nil { + form = SimplifyAstForQuote(form, false) + expr, splice := c.quasiquote(form, depth, true) + fun := expr.AsX1() + if fun == nil { + c.Warnf("Quasiquote[%d]%s: node expanded to nil: %v <%v>", depth, label, form.Interface(), r.TypeOf(form.Interface())) + continue + } + funs = append(funs, fun) + splices = append(splices, splice) + var position token.Position + if form, ok := form.(AstWithNode); ok { + position = c.Fileset.Position(form.Node().Pos()) + } + positions = append(positions, position) + } + } + form := in.New().(AstWithSlice) + + typ := c.TypeOf(in.Interface()) // extract the concrete type implementing ast.Node + rtype := typ.ReflectType() + + return exprX1(typ, func(env *Env) r.Value { + out := form.New().(AstWithSlice) + for i, fun := range funs { + x := ValueInterface(fun(env)) + if debug { + Debugf("Quasiquote: env=%p, append to AstWithSlice: <%v> returned %v <%v>", env, r.TypeOf(fun), x, r.TypeOf(x)) + } + if x == nil { + continue + } else if !splices[i] { + out = out.Append(AnyToAst(x, positions[i])) + } else { + xs := AnyToAstWithSlice(x, positions[i]) + n := xs.Size() + for j := 0; j < n; j++ { + if xj := xs.Get(j); xj != nil { + out = out.Append(xj) + } + } + } + } + return r.ValueOf(out.Interface()).Convert(rtype) + }), false + case UnaryExpr: + unary := in.X + switch op := unary.Op; op { + case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE: + node := SimplifyNodeForQuote(unary.X.(*ast.FuncLit).Body, true) + form := ToAst(node) + + if op == mt.QUASIQUOTE { + depth++ + } else if op == mt.UNQUOTE || op == mt.UNQUOTE_SPLICE { + depth-- + } + if depth <= 0 { + if debug { + c.Debugf("Quasiquote[%d]%s compiling %s: %v <%v>", depth, label, mt.String(op), node, r.TypeOf(node)) + } + return c.compileExpr(form), op == mt.UNQUOTE_SPLICE + } + fun := c.quasiquote1(form, depth, true).AsX1() + if fun == nil { + c.Warnf("Quasiquote[%d]%s: node expanded to nil: %v <%v>", depth, label, node, r.TypeOf(node)) + } + var pos token.Pos + var position token.Position + if node, ok := node.(ast.Node); ok { + pos = node.Pos() + position = c.Fileset.Position(pos) + } + if op == mt.UNQUOTE_SPLICE { + return c.quoteUnquoteSplice(op, pos, position, fun), false + } + return exprX1(c.Universe.FromReflectType(rtypeOfUnaryExpr), func(env *Env) r.Value { + var node ast.Node + if fun != nil { + x := ValueInterface(fun(env)) + if debug { + Debugf("Quasiquote: env = %p, body of %s: <%v> returned %v <%v>", env, mt.String(op), r.TypeOf(fun), x, r.TypeOf(x)) + } + node = AnyToAstWithNode(x, position).Node() + } + ret, _ := mp.MakeQuote(nil, op, token.NoPos, node) + return r.ValueOf(ret) + }), false + } + } + + // Ast can still be a tree: just not a resizeable one, so support ~unquote but not ~unquote_splice + in, ok := in.(AstWithNode) + if !ok { + x := in.Interface() + c.Errorf("Quasiquote: unsupported node type, expecting AstWithNode or AstWithSlice: %v <%v>", x, r.TypeOf(x)) + return nil, false + } + node := in.Interface() + if debug { + c.Debugf("Quasiquote[%d] recursing: %v <%v>", depth, node, r.TypeOf(node)) + } + if node == nil { + return nil, false + } + form := in.New().(AstWithNode) // we must NOT retain input argument, so clone it + n := in.Size() + typ := c.TypeOf(in.Interface()) // extract the concrete type implementing ast.Node + rtype := typ.ReflectType() + + if n == 0 { + return exprX1(typ, func(env *Env) r.Value { + return r.ValueOf(form.New().Interface()).Convert(rtype) + }), false + } + funs := make([]func(*Env) r.Value, n) + positions := make([]token.Position, n) + for i := 0; i < n; i++ { + if form := in.Get(i); form != nil { + form = SimplifyAstForQuote(form, false) + fun := c.quasiquote1(form, depth, false).AsX1() + if fun == nil { + c.Warnf("Quasiquote[%d]: node expanded to nil: %v", depth, form.Interface()) + continue + } + funs[i] = fun + if form, ok := form.(AstWithNode); ok && form.Node() != nil { + positions[i] = c.Fileset.Position(form.Node().Pos()) + } + } + } + + return exprX1(typ, func(env *Env) r.Value { + out := form.New().(AstWithNode) + for i, fun := range funs { + if fun != nil { + x := ValueInterface(fun(env)) + if debug { + Debugf("Quasiquote: env = %p, <%v> returned %v <%v>", env, r.TypeOf(fun), x, r.TypeOf(x)) + } + out.Set(i, AnyToAst(x, positions[i])) + } + } + return r.ValueOf(out.Interface()).Convert(rtype) + }), false +} + +func (c *Comp) quoteUnquoteSplice(op token.Token, pos token.Pos, position token.Position, fun func(*Env) r.Value) *Expr { + return exprX1(c.Universe.FromReflectType(rtypeOfUnaryExpr), func(env *Env) r.Value { + var node ast.Node + if fun != nil { + x := ValueInterface(fun(env)) + form := AnyToAst(x, position) + switch form := form.(type) { + case AstWithNode: + node = form.Node() + case AstWithSlice: + block := BlockStmt{&ast.BlockStmt{Lbrace: pos}} + n := form.Size() + for i := 0; i < n; i++ { + if formi := form.Get(i); formi != nil { + /*block =*/ block.Append(formi) + } + } + node = block.X + default: + var prefix string + if pos != token.NoPos { + prefix = fmt.Sprintf("%s: ", position) + } + Errorf("%s%s returned invalid type, expecting AstWithNode or AstWithSlice: %v, <%v>", + prefix, mt.String(mt.UNQUOTE_SPLICE), form, r.TypeOf(form)) + return Nil + } + } + ret, _ := mp.MakeQuote(nil, op, token.NoPos, node) + return r.ValueOf(ret) + }) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/range.go b/vendor/github.com/cosmos72/gomacro/fast/range.go new file mode 100644 index 0000000..05ef733 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/range.go @@ -0,0 +1,484 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * range.go + * + * Created on Jun 04, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + "sort" + "unicode/utf8" + "unsafe" + + "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type rangeJump struct { + Start, Continue, Break int +} + +// Range compiles a "for-range" statement +func (c *Comp) Range(node *ast.RangeStmt, labels []string) { + var nbinds [2]int + + c, _ = c.pushEnvIfFlag(&nbinds, true) + erange := c.Expr1(node.X) + t := erange.Type + if erange.Untyped() { + t = erange.DefaultType() + erange.ConstTo(t) + } + var jump rangeJump + + sort.Strings(labels) + // we need a fresh Comp here... created above by c.pushEnvIfLocalBinds() + c.Loop = &LoopInfo{ + Continue: &jump.Continue, + Break: &jump.Break, + ThisLabels: labels, + } + + switch t.Kind() { + case r.Ptr: + if t.Elem().Kind() != r.Array { + c.Errorf("cannot range over %v <%v>", node.X, t) + } + // range on pointer to array: dereference it + t = t.Elem() + efun := erange.AsX1() + erange = exprX1(t, func(env *Env) r.Value { + return efun(env).Elem() + }) + fallthrough + case r.Chan: + c.rangeChan(node, erange, &jump) + case r.Map: + c.rangeMap(node, erange, &jump) + case r.Array, r.Slice: + c.rangeSlice(node, erange, &jump) + case r.String: + c.rangeString(node, erange, &jump) + default: + c.Errorf("cannot range over %v <%v>", node.X, t) + } + + jump.Break = c.Code.Len() + + c = c.popEnvIfFlag(&nbinds, true) +} + +func (c *Comp) rangeChan(node *ast.RangeStmt, erange *Expr, jump *rangeJump) { + t := erange.Type + telem := t.Elem() + + // unnamed bind, contains channel + bindchan := c.DeclVar0("", nil, erange) + idxchan := bindchan.Desc.Index() + + placekey, _ := c.rangeVars(node, telem, nil) + + jump.Start = c.Code.Len() + + if placekey == nil { + c.append(func(env *Env) (Stmt, *Env) { + _, ok := env.Binds[idxchan].Recv() + var ip int + if ok { + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } else { + // unnamed bind, contains last received value + bindrecv := c.AddBind("", VarBind, c.TypeOfInterface()) + idxrecv := bindrecv.Desc.Index() + + c.append(func(env *Env) (Stmt, *Env) { + v, ok := env.Binds[idxchan].Recv() + var ip int + if ok { + env.Binds[idxrecv] = v + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + c.SetPlace(placekey, token.ASSIGN, unwrapBind(bindrecv, telem)) + } + + // compile the body + c.Block(node.Body) + + // jump back to start + c.append(func(env *Env) (Stmt, *Env) { + ip := jump.Start + env.IP = ip + return env.Code[ip], env + }) +} + +func (c *Comp) rangeMap(node *ast.RangeStmt, erange *Expr, jump *rangeJump) { + c.ErrorIfCompiled(node) + + t := erange.Type + tkey, tval := t.Key(), t.Elem() + tkeyslice := xr.SliceOf(tkey) + rtkeyslice := tkeyslice.ReflectType() + + // unnamed bind, contains map + bindmap := c.DeclVar0("", nil, erange) + idxmap := bindmap.Desc.Index() + + // unnamed bind, contains map keys + bindkeys := c.AddBind("", VarBind, tkeyslice) + idxkeys := bindkeys.Desc.Index() + c.append(func(env *Env) (Stmt, *Env) { + // convert []r.Value slice into a []rtkey slice, to avoid reflect.Value.Interface() while iterating + vkeys := env.Binds[idxmap].MapKeys() + keys := r.MakeSlice(rtkeyslice, len(vkeys), len(vkeys)) + for i, vkey := range vkeys { + keys.Index(i).Set(vkey) + } + env.Binds[idxkeys] = keys + env.IP++ + return env.Code[env.IP], env + }) + + // unnamed bind, contains iteration index + bindnext := c.DeclVar0("", c.TypeOfInt(), nil) + idxnext := bindnext.Desc.Index() + + placekey, placeval := c.rangeVars(node, tkey, tval) + + var bindkey *Bind + var ekey *Expr + if placekey != nil || placeval != nil { + // unnamed bind, contains iteration map key + bindkey = c.DeclVar0("", c.TypeOfInterface(), nil) + ekey = unwrapBind(bindkey, tkey) + } + + jump.Start = c.Code.Len() + + if bindkey == nil { + // check iteration index against # of keys + c.append(func(env *Env) (Stmt, *Env) { + n := env.Binds[idxkeys].Len() + i := *(*int)(unsafe.Pointer(&env.IntBinds[idxnext])) + var ip int + if i < n { + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } else { + // check iteration index against # of keys, + // and copy current map key into bindkey + idxkey := bindkey.Desc.Index() + c.append(func(env *Env) (Stmt, *Env) { + vkeys := env.Binds[idxkeys] + n := vkeys.Len() + i := *(*int)(unsafe.Pointer(&env.IntBinds[idxnext])) + var ip int + if i < n { + env.Binds[idxkey] = vkeys.Index(i) + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } + + if placekey != nil { + // copy current map key into placekey + c.SetPlace(placekey, token.ASSIGN, ekey) + } + + if placeval == nil { + // nothing to do + } else if placeval.IsVar() && !base.IsOptimizedKind(placeval.Type.Kind()) { + idxkey := bindkey.Desc.Index() + idxval := placeval.Var.Desc.Index() + upval := placeval.Var.Upn + rtype := tval.ReflectType() + zero := r.Zero(rtype) + c.append(func(env *Env) (Stmt, *Env) { + vmap := env.Binds[idxmap] + key := env.Binds[idxkey] + o := env + for j := 0; j < upval; j++ { + o = o.Outer + } + val := vmap.MapIndex(key) + if !val.IsValid() { + val = zero + } else if val.Type() != rtype { + val = val.Convert(rtype) + } + o.Binds[idxval].Set(val) + env.IP++ + return env.Code[env.IP], env + }) + } else { + emap := c.Symbol(bindmap.AsSymbol(0)) + c.SetPlace(placeval, token.ASSIGN, c.mapIndex1(nil, emap, ekey)) + } + + // compile the body + c.Block(node.Body) + + // increase iteration index and jump back to start + c.append(func(env *Env) (Stmt, *Env) { + (*(*int)(unsafe.Pointer(&env.IntBinds[idxnext])))++ + ip := jump.Start + env.IP = ip + return env.Code[ip], env + }) +} + +func (c *Comp) rangeSlice(node *ast.RangeStmt, erange *Expr, jump *rangeJump) { + t := erange.Type + var constlen int + var elen *Expr + + if node.Value != nil || t.Kind() != r.Array { + // Go spec: one-variable range on array ONLY evaluates the array length, not the array itself + // save range variable in an unnamed bind + sym := c.DeclVar0("", nil, erange).AsSymbol(0) + erange = c.Symbol(sym) + } + + if t.Kind() == r.Array { + constlen = t.Len() + } else { + // save range length in an unnamed bind + rangefun := erange.AsX1() + elen0 := exprFun(c.TypeOfInt(), func(env *Env) int { + return rangefun(env).Len() + }) + symlen := c.DeclVar0("", nil, elen0).AsSymbol(0) + elen = c.Symbol(symlen) + } + + placekey, placeval := c.rangeVars(node, c.TypeOfInt(), t.Elem()) + + if placekey == nil { + // we need an interation variable, even if user code ignores it + placekey = c.DeclVar0("", c.TypeOfInt(), nil).AsVar(0, PlaceSettable).AsPlace() + } + + jump.Start = c.Code.Len() + + // compile comparison against range length + ekey := c.GetPlace(placekey) + funkey := ekey.WithFun().(func(*Env) int) + + if t.Kind() == r.Array { + c.append(func(env *Env) (Stmt, *Env) { + var ip int + if funkey(env) < constlen { + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } else { + funlen := elen.WithFun().(func(*Env) int) + c.append(func(env *Env) (Stmt, *Env) { + var ip int + if funkey(env) < funlen(env) { + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } + if placeval != nil { + // for error messages + indexnode := &ast.IndexExpr{X: node.X, Lbrack: node.X.Pos(), Index: node.Key, Rbrack: node.X.Pos()} + eindex := c.vectorIndex(indexnode, erange, ekey) + c.SetPlace(placeval, token.ASSIGN, eindex) + } + + // compile the body + c.Block(node.Body) + + // increment key + c.Pos = node.End() - 1 + one := c.exprValue(c.TypeOfInt(), 1) + c.SetPlace(placekey, token.ADD_ASSIGN, one) + + // jump back to comparison + c.append(func(env *Env) (Stmt, *Env) { + ip := jump.Start + env.IP = ip + return env.Code[ip], env + }) +} + +func (c *Comp) rangeString(node *ast.RangeStmt, erange *Expr, jump *rangeJump) { + // save string in an unnamed bind + bindrange := c.DeclVar0("", nil, erange) + idxrange := bindrange.Desc.Index() + + placekey, placeval := c.rangeVars(node, c.TypeOfInt(), c.TypeOfInt32()) + bindnext := c.DeclVar0("", c.TypeOfInt(), nil) + idxnext := bindnext.Desc.Index() + + var bindrune *Bind + if placeval != nil && !placeval.IsVar() { + bindrune = c.DeclVar0("", c.TypeOfInt32(), nil) + } + + jump.Start = c.Code.Len() + + if placekey != nil { + c.SetPlace(placekey, token.ASSIGN, c.Symbol(bindnext.AsSymbol(0))) + } + if placeval == nil { + c.append(func(env *Env) (Stmt, *Env) { + s := env.Binds[idxrange].String() + pnext := (*int)(unsafe.Pointer(&env.IntBinds[idxnext])) + next := *pnext + + _, size := utf8.DecodeRuneInString(s[next:]) + var ip int + if size != 0 { + next += size + *pnext = next + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } else if placeval.IsVar() { + idxval := placeval.Var.Desc.Index() + upval := placeval.Var.Upn + c.append(func(env *Env) (Stmt, *Env) { + s := env.Binds[idxrange].String() + pnext := (*int)(unsafe.Pointer(&env.IntBinds[idxnext])) + next := *pnext + + r, size := utf8.DecodeRuneInString(s[next:]) + var ip int + if size != 0 { + next += size + *pnext = next + o := env + for i := 0; i < upval; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&env.IntBinds[idxval])) = r + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + } else { + idxrune := bindrune.Desc.Index() + c.append(func(env *Env) (Stmt, *Env) { + s := env.Binds[idxrange].String() + pnext := (*int)(unsafe.Pointer(&env.IntBinds[idxnext])) + next := *pnext + + r, size := utf8.DecodeRuneInString(s[next:]) + var ip int + if size != 0 { + next += size + *pnext = next + *(*int32)(unsafe.Pointer(&env.IntBinds[idxrune])) = r + ip = env.IP + 1 + } else { + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + }) + c.SetPlace(placeval, token.ASSIGN, c.Symbol(bindrune.AsSymbol(0))) + } + + // compile the body + c.Block(node.Body) + + // jump back to iteration + c.append(func(env *Env) (Stmt, *Env) { + ip := jump.Start + env.IP = ip + return env.Code[ip], env + }) +} + +// rangeVars compiles the key and value iteration variables in a for-range +func (c *Comp) rangeVars(node *ast.RangeStmt, tkey xr.Type, tval xr.Type) (*Place, *Place) { + var place [2]*Place + t := [2]xr.Type{tkey, tval} + + for i, expr := range [2]ast.Expr{node.Key, node.Value} { + if expr == nil { + continue + } else if t[i] == nil { + c.Pos = expr.Pos() + c.Errorf("too many variables in range") + } + c.Pos = expr.Pos() + if node.Tok == token.DEFINE { + switch expr := expr.(type) { + case *ast.Ident: + name := expr.Name + if name != "_" { + place[i] = c.DeclVar0(name, t[i], nil).AsVar(0, PlaceSettable).AsPlace() + } + default: + c.Errorf("non-name %v on left side of :=", expr) + } + } else { + place[i] = c.Place(expr) + if !t[i].AssignableTo(place[i].Type) { + c.Errorf("cannot assign type <%v> to %v <%v> in range", t[i], expr, place[i].Type) + } + } + } + return place[0], place[1] +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/select.go b/vendor/github.com/cosmos72/gomacro/fast/select.go new file mode 100644 index 0000000..561e3c5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/select.go @@ -0,0 +1,252 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * select.go + * + * Created on Jun 05, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + "sort" +) + +type selectEntry struct { + Dir r.SelectDir + Chan func(*Env) r.Value + Send func(*Env) r.Value +} + +func (c *Comp) Select(node *ast.SelectStmt, labels []string) { + if node.Body == nil || len(node.Body.List) == 0 { + return + } + + var ibreak int + sort.Strings(labels) + c.Loop = &LoopInfo{ + Break: &ibreak, + ThisLabels: labels, + } + + // unnamed bind, contains received value. Nil means nothing received + bindrecv := c.AddBind("", VarBind, c.TypeOfInterface()) + idxrecv := bindrecv.Desc.Index() + + list := node.Body.List + n := len(list) + entries := make([]selectEntry, n) + ips := make([]int, n) + defaultip := -1 + defaultpos := token.NoPos + + c.append(func(env *Env) (Stmt, *Env) { + cases := make([]r.SelectCase, len(entries)) + for i := range entries { + c := &cases[i] + e := &entries[i] + c.Dir = e.Dir + if e.Chan != nil { + c.Chan = e.Chan(env) + if e.Send != nil { + c.Send = e.Send(env) + } + } + } + chosen, recv, _ := r.Select(cases) + env.Binds[idxrecv] = recv + ip := ips[chosen] + env.IP = ip + return env.Code[ip], env + }) + + for i, stmt := range list { + ips[i] = c.Code.Len() + switch clause := stmt.(type) { + case *ast.CommClause: + if clause.Comm == nil { + if defaultip >= 0 { + c.Errorf("multiple defaults in select (first at %s)", c.Fileset.Position(defaultpos)) + } + defaultip = c.Code.Len() + defaultpos = clause.Pos() + entries[i] = c.selectDefault(clause) + } else { + entries[i] = c.selectCase(clause, bindrecv) + } + default: + c.Errorf("invalid statement inside select: expecting case or default, found: %v <%v>", stmt, r.TypeOf(stmt)) + } + } + // we finally know this + ibreak = c.Code.Len() +} + +// selectDefault compiles the default case in a switch +func (c *Comp) selectDefault(node *ast.CommClause) selectEntry { + if len(node.Body) != 0 { + c.List(node.Body) + } + c.jumpOut(0, c.Loop.Break) + return selectEntry{Dir: r.SelectDefault} +} + +// selectCase compiles a case in a select. +func (c *Comp) selectCase(clause *ast.CommClause, bind *Bind) selectEntry { + + var entry selectEntry + var nbinds [2]int + stmt := clause.Comm + c2 := c + locals := false + + switch node := stmt.(type) { + case *ast.ExprStmt: + // <-ch + entry = selectEntry{ + Dir: r.SelectRecv, + Chan: c.selectRecv(stmt, node.X).AsX1(), + } + case *ast.AssignStmt: + // v := <-ch or v = <-ch + lhs := node.Lhs + n := len(lhs) + if (n != 1 && n != 2) || len(node.Rhs) != 1 { + c.badSelectCase(stmt) + } + var l0, l1 ast.Expr = lhs[0], nil + if n == 2 { + l1 = lhs[1] + } + r0 := node.Rhs[0] + switch node.Tok { + case token.DEFINE: + id0 := asIdent(l0) + id1 := asIdent(l1) + if (id0 == nil && l0 != nil) || (id1 == nil && l1 != nil) { + c.badSelectCase(stmt) + } + echan := c.selectRecv(node, r0) + entry = selectEntry{Dir: r.SelectRecv, Chan: echan.AsX1()} + + if id0 != nil && id0.Name != "_" || id1 != nil && id1.Name != "_" { + c2, locals = c.pushEnvIfFlag(&nbinds, true) + + if id0 != nil && id0.Name != "_" { + t := echan.Type.Elem() + c2.DeclVar0(id0.Name, t, unwrapBindUp1(bind, t)) + } + if id1 != nil && id1.Name != "_" { + idx := bind.Desc.Index() + c2.DeclVar0(id1.Name, c.TypeOfBool(), c.exprBool(func(env *Env) bool { + return env.Outer.Binds[idx].IsValid() + })) + } + } else if len(clause.Body) != 0 { + c2, locals = c.pushEnvIfLocalBinds(&nbinds, clause.Body...) + } + + case token.ASSIGN: + echan := c.selectRecv(stmt, r0) + entry = selectEntry{Dir: r.SelectRecv, Chan: echan.AsX1()} + + if l0 != nil { + place := c.Place(l0) + t := echan.Type.Elem() + tplace := place.Type + if !t.AssignableTo(tplace) { + c.Errorf("cannot use <%v> as <%v> in assignment: %v = %v", t, tplace, l0, r0) + } + c.SetPlace(place, token.ASSIGN, unwrapBind(bind, t)) + } + if l1 != nil { + place := c.Place(l1) + t := c.TypeOfBool() + tplace := place.Type + if !t.AssignableTo(tplace) { + c.Errorf("cannot use <%v> as <%v> in assignment: _, %v = %v", t, tplace, l1, r0) + } + idx := bind.Desc.Index() + c.SetPlace(place, token.ASSIGN, c.exprBool(func(env *Env) bool { + return env.Binds[idx].IsValid() + })) + } + + if len(clause.Body) != 0 { + c2, locals = c.pushEnvIfLocalBinds(&nbinds, clause.Body...) + } + } + + case *ast.SendStmt: + // ch <- v + echan := c.Expr1(node.Chan) + if echan.Type.Kind() != r.Chan { + c.Errorf("cannot use %v <%v> as channel in select case", node, echan.Type) + } + esend := c.Expr1(node.Value) + tactual := esend.Type + texpected := echan.Type.Elem() + if !tactual.AssignableTo(texpected) { + c.Errorf("cannot use %v <%v> as <%v> in channel send", node.Value, tactual, texpected) + } + entry = selectEntry{Dir: r.SelectSend, Chan: echan.AsX1(), Send: esend.AsX1()} + + default: + c.badSelectCase(stmt) + } + + if len(clause.Body) != 0 { + c2.List(clause.Body) + } + if c2 != c { + c2.popEnvIfFlag(&nbinds, locals) + } + c.jumpOut(0, c.Loop.Break) + return entry +} + +func (c *Comp) selectRecv(stmt ast.Stmt, node ast.Expr) *Expr { + for { + switch expr := node.(type) { + case *ast.ParenExpr: + node = expr.X + continue + case *ast.UnaryExpr: + if expr.Op == token.ARROW { + e := c.Expr1(expr.X) + if e.Type.Kind() != r.Chan { + c.Errorf("cannot use %v <%v> as channel in select case", node, e.Type) + } + return e + } + } + c.badSelectCase(stmt) + return nil + } +} + +func (c *Comp) badSelectCase(stmt ast.Stmt) { + c.Errorf("invalid select case, expecting [ch <- val] or [<-ch] or [vars := <-ch] or [places = <-ch], found: %v <%v>", + stmt, r.TypeOf(stmt)) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/selector.go b/vendor/github.com/cosmos72/gomacro/fast/selector.go new file mode 100644 index 0000000..f1bba1e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/selector.go @@ -0,0 +1,890 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * selector.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// SelectorExpr compiles foo.bar, i.e. read access to methods, struct fields and imported packages +func (c *Comp) SelectorExpr(node *ast.SelectorExpr) *Expr { + e, t := c.Expr1OrType(node.X) + if t != nil { + return c.selectorType(node, t) + } + t = e.Type + eorig := e + if t.Kind() == r.Ptr && t.Elem().Kind() == r.Struct { + t = t.Elem() + fun := e.AsX1() + e = exprFun(t, func(env *Env) r.Value { + return fun(env).Elem() + }) + } + name := node.Sel.Name + switch t.Kind() { + case r.Struct: + if t.ReflectType() == rtypeOfImport && e.Const() { + // access symbol from imported package, for example fmt.Printf + imp := e.Value.(Import) + return c.selectorImport(&imp, name) + } + field, fieldok, mtd, mtdok := c.LookupFieldOrMethod(t, name) + if fieldok { + return c.compileField(e, field) + } else if mtdok { + return c.compileMethod(node, eorig, mtd) + } + default: + // interfaces and named types can have methods, but no fields + if t.NumMethod() != 0 { + mtd, mtdn := c.LookupMethod(t, name) + switch mtdn { + case 0: + case 1: + return c.compileMethod(node, eorig, mtd) + default: + c.Errorf("type %s has %d methods %q, expression is ambiguous: %v", t, mtdn, name, node) + } + } + } + c.Errorf("type %s has no field or method %q: %v", t, name, node) + return nil +} + +// selectorImport compiles foo.bar where 'foo' is an imported package +func (c *Comp) selectorImport(imp *Import, name string) *Expr { + if bind, ok := imp.Binds[name]; ok { + t := imp.BindTypes[name] + var value interface{} + if bind.IsValid() && bind.CanInterface() { + if bind.CanAddr() { + // bind is an imported variable. do NOT extract its value, otherwise the fast interpreter + // will (incorrectly) assume that it's a constant and will perform constant propagation + fun := importedBindAsFun(t, bind) + return exprFun(t, fun) + } + value = bind.Interface() + } else { + value = xr.Zero(t) + } + return c.exprValue(t, value) + } + c.Errorf("package %v %q has no symbol %s", imp.Name, imp.Path, name) + return nil +} + +// selectorType compiles foo.bar where 'foo' is a type +func (c *Comp) selectorType(node *ast.SelectorExpr, t xr.Type) *Expr { + mtd, count := c.LookupMethod(t, node.Sel.Name) + if count == 0 { + c.Errorf("type <%v> has no method %q: %v", t, node.Sel, node) + } else if count > 1 { + c.Errorf("type <%v> has %d wrapper methods %q all at the same depth=%d - expression is ambiguous: %v", t, count, node.Sel, len(mtd.FieldIndex), node) + } + return c.compileMethodAsFunc(t, mtd) +} + +// lookup fields and methods at the same time... it's and error if both exist at the same depth +func (c *Comp) LookupFieldOrMethod(t xr.Type, name string) (xr.StructField, bool, xr.Method, bool) { + field, fieldn := c.LookupField(t, name) + mtd, mtdn := c.LookupMethod(t, name) + fielddepth := len(field.Index) + mtddepth := len(mtd.FieldIndex) + 1 + if fieldn != 0 && mtdn != 0 { + if fielddepth < mtddepth { + // prefer the field + mtdn = 0 + } else if fielddepth > mtddepth { + // prefer the method + fieldn = 0 + } else { + c.Errorf("type %v has %d field(s) and %d method(s) named %q at depth %d", + t, fieldn, mtdn, name, fielddepth) + } + } + if fieldn > 1 { + c.Errorf("type %v has %d fields named %q at depth %d", t, fieldn, name, fielddepth) + } else if mtdn > 1 { + c.Errorf("type %v has %d methods named %q at depth %d", t, mtdn, name, mtddepth) + } + return field, fieldn == 1, mtd, mtdn == 1 +} + +// LookupField performs a breadth-first search for struct field with given name +func (c *Comp) LookupField(t xr.Type, name string) (field xr.StructField, numfound int) { + return t.FieldByName(name, c.FileComp().Path) +} + +// LookupMethod performs a breadth-first search for method with given name +func (c *Comp) LookupMethod(t xr.Type, name string) (mtd xr.Method, numfound int) { + return t.MethodByName(name, c.FileComp().Path) +} + +// field1 isa variand of reflect.Value.Field, also accepts pointer values +// and dereferences pointer ONLY if index is negative (actually used index will be ^x) +func field0(v r.Value, index int) r.Value { + if index < 0 { + v = v.Elem() + index = ^index + } + return v.Field(index) +} + +// fieldByIndex is a variant of reflect.Value.FieldByIndex, also accepts pointer values +// and dereferences pointers ONLY if index[i] is negative (actually used index will be ^x) +func fieldByIndex(v r.Value, index []int) r.Value { + for _, x := range index { + if x < 0 { + v = v.Elem() + x = ^x + } + v = v.Field(x) + } + return v +} + +func (c *Comp) compileField(e *Expr, field xr.StructField) *Expr { + objfun := e.AsX1() + t := e.Type + var fun I + index := field.Index + + // descend embedded fields + for i, x := range index { + if t.Kind() == r.Ptr && t.Elem().Kind() == r.Struct { + // embedded field (or initial value) is a pointer, dereference it. + t = t.Elem() + index[i] = ^x // remember we neeed a pointer dereference at runtime + } + t = t.Field(x).Type + } + + t = field.Type + // c.Debugf("compileField: field=%#v", field) + if len(index) == 1 { + index0 := index[0] + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + obj := objfun(env) + return field0(obj, index0).Bool() + } + case r.Int: + fun = func(env *Env) int { + obj := objfun(env) + return int(field0(obj, index0).Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + obj := objfun(env) + return int8(field0(obj, index0).Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + obj := objfun(env) + return int16(field0(obj, index0).Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + obj := objfun(env) + return int32(field0(obj, index0).Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + obj := objfun(env) + return field0(obj, index0).Int() + } + case r.Uint: + fun = func(env *Env) uint { + obj := objfun(env) + return uint(field0(obj, index0).Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + obj := objfun(env) + return uint8(field0(obj, index0).Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + obj := objfun(env) + return uint16(field0(obj, index0).Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + obj := objfun(env) + return uint32(field0(obj, index0).Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + obj := objfun(env) + return field0(obj, index0).Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + obj := objfun(env) + return uintptr(field0(obj, index0).Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + obj := objfun(env) + return float32(field0(obj, index0).Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + obj := objfun(env) + return field0(obj, index0).Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + obj := objfun(env) + return complex64(field0(obj, index0).Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + obj := objfun(env) + return field0(obj, index0).Complex() + } + case r.String: + fun = func(env *Env) string { + obj := objfun(env) + return field0(obj, index0).String() + } + default: + fun = func(env *Env) r.Value { + obj := objfun(env) + return field0(obj, index0) + } + } + } else { + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + obj := objfun(env) + return fieldByIndex(obj, index).Bool() + } + case r.Int: + fun = func(env *Env) int { + obj := objfun(env) + return int(fieldByIndex(obj, index).Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + obj := objfun(env) + return int8(fieldByIndex(obj, index).Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + obj := objfun(env) + return int16(fieldByIndex(obj, index).Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + obj := objfun(env) + return int32(fieldByIndex(obj, index).Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + obj := objfun(env) + return fieldByIndex(obj, index).Int() + } + case r.Uint: + fun = func(env *Env) uint { + obj := objfun(env) + return uint(fieldByIndex(obj, index).Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + obj := objfun(env) + return uint8(fieldByIndex(obj, index).Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + obj := objfun(env) + return uint16(fieldByIndex(obj, index).Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + obj := objfun(env) + return uint32(fieldByIndex(obj, index).Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + obj := objfun(env) + return fieldByIndex(obj, index).Uint() + } + case r.Uintptr: + + fun = func(env *Env) uintptr { + obj := objfun(env) + return uintptr(fieldByIndex(obj, index).Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + obj := objfun(env) + return float32(fieldByIndex(obj, index).Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + obj := objfun(env) + return fieldByIndex(obj, index).Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + obj := objfun(env) + return complex64(fieldByIndex(obj, index).Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + obj := objfun(env) + return fieldByIndex(obj, index).Complex() + } + case r.String: + fun = func(env *Env) string { + obj := objfun(env) + return fieldByIndex(obj, index).String() + } + default: + fun = func(env *Env) r.Value { + obj := objfun(env) + return fieldByIndex(obj, index) + } + } + } + return exprFun(t, fun) +} + +func (c *Comp) changeFirstParam(tfirstparam, t xr.Type) xr.Type { + nin := t.NumIn() + if nin == 0 { + c.Errorf("compileMethod: inconsistent method type: expecting at least the receiver, found zero input parameters: <%v>", t) + } + params := make([]xr.Type, nin) + params[0] = tfirstparam + for i := 1; i < nin; i++ { + params[i] = t.In(i) + } + nout := t.NumOut() + results := make([]xr.Type, nout) + for i := 0; i < nout; i++ { + results[i] = t.Out(i) + } + return c.Universe.FuncOf(params, results, t.IsVariadic()) +} + +func (c *Comp) removeFirstParam(t xr.Type) xr.Type { + nin := t.NumIn() + if nin == 0 { + c.Errorf("compileMethod: inconsistent method type: expecting at least the receiver, found zero input parameters: <%v>", t) + } + params := make([]xr.Type, nin-1) + for i := 1; i < nin; i++ { + params[i-1] = t.In(i) + } + nout := t.NumOut() + results := make([]xr.Type, nout) + for i := 0; i < nout; i++ { + results[i] = t.Out(i) + } + return c.Universe.FuncOf(params, results, t.IsVariadic()) +} + +// compileMethod compiles a method call. +// relatively slow, but simple: return a closure with the receiver already bound +func (c *Comp) compileMethod(node *ast.SelectorExpr, e *Expr, mtd xr.Method) *Expr { + fieldindex := mtd.FieldIndex + t := e.Type + indirect := false // executed a dereference ? + + // descend embedded fields + for i, index := range fieldindex { + if t.Kind() == r.Ptr && t.Elem().Kind() == r.Struct { + // embedded field (or initial value) is a pointer, dereference it. + t = t.Elem() + indirect = true + fieldindex[i] = ^index // remember we neeed a pointer dereference at runtime + } + t = t.Field(index).Type + } + index := mtd.Index + rtype := t.ReflectType() + tfunc := mtd.Type + tclosure := c.removeFirstParam(tfunc) + rtclosure := tclosure.ReflectType() + trecv := tfunc.In(0) + + objPointer := t.Kind() == r.Ptr // field is pointer? + recvPointer := trecv.Kind() == r.Ptr // method with pointer receiver? + addressof := !objPointer && recvPointer + deref := objPointer && !recvPointer + + debug := c.Options&OptDebugMethod != 0 + if debug { + c.Debugf("compiling method %v: receiver is <%v>, value is <%v>", node, trecv, t) + } + if t.AssignableTo(trecv) { + addressof = false + deref = false + if debug { + c.Debugf("compiling method %v: value is assignable to receiver", node) + } + } else if addressof && xr.PtrTo(t).AssignableTo(trecv) { + // c.Debugf("method call <%v> will take address of receiver <%v>", tfunc, t) + // ensure receiver is addressable. maybe it was simply dereferenced by Comp.SelectorExpr + // or maybe we need to explicitly take its address + if indirect { + if len(fieldindex) != 0 { + // easy, we dereferenced some expression while descending embedded fields + // so the receiver is addressable + if debug { + c.Debugf("compiling method %v: address-of-value is assignable to receiver", node) + } + } else { + // even easier, the initial expression already contains the address we want + addressof = false + if debug { + c.Debugf("compiling method %v: value was initially an address", node) + } + } + } else { + // manually compile "& receiver_expression" + if debug { + c.Debugf("compiling method %v: compiling address-of-value", node) + } + if len(fieldindex) != 0 { + // must execute address-of-field at runtime, just check that struct is addressable + c.addressOf(node.X) + } else { + e = c.addressOf(node.X) + addressof = false + } + } + } else if deref && t.Elem().AssignableTo(trecv) { + if debug { + c.Debugf("method call <%v> will dereference receiver <%v>", tfunc, t) + } + } else { + c.Errorf("cannot use <%v> as <%v> in receiver of method <%v>", t, trecv, tfunc) + } + + objfun := e.AsX1() + var ret func(env *Env) r.Value + + if t.NumMethod() == rtype.NumMethod() && t.Named() && xr.QName1(t) == xr.QName1(rtype) { + // closures for methods declared by compiled code are available + // simply with reflect.Value.Method(index). Easy. + switch len(fieldindex) { + case 0: + ret = func(env *Env) r.Value { + obj := objfun(env) + return obj.Method(index) + } + case 1: + fieldindex := fieldindex[0] + ret = func(env *Env) r.Value { + obj := objfun(env) + obj = field0(obj, fieldindex) + return obj.Method(index) + } + default: + ret = func(env *Env) r.Value { + obj := objfun(env) + obj = fieldByIndex(obj, fieldindex) + return obj.Method(index) + } + } + } else { + // method declared by interpreted code, manually build the closure. + // + // It's not possible to call r.MakeFunc() only once at compile-time, + // because the closure passed to it needs access to a variable holding the receiver. + // such variable would be allocated only once at compile-time, + // not once per goroutine! + funs := mtd.Funs + nin := tfunc.NumIn() + + tname := t.Name() + methodname := mtd.Name + if funs == nil { + c.Errorf("method declared but not yet implemented: %s.%s", tname, methodname) + } else if len(*funs) <= index || (*funs)[index].Kind() != r.Func { + // c.Warnf("method declared but not yet implemented: %s.%s", tname, methodname) + } + + switch len(fieldindex) { + case 0: + ret = func(env *Env) r.Value { + obj := objfun(env) + if addressof { + obj = obj.Addr() + } else if deref { + obj = obj.Elem() + } + fun := (*funs)[index] // retrieve the function as soon as possible (early bind) + if fun == Nil { + Errorf("method is declared but not yet implemented: %s.%s", tname, methodname) + } + + return r.MakeFunc(rtclosure, func(args []r.Value) []r.Value { + fullargs := make([]r.Value, nin) + fullargs[0] = obj + copy(fullargs[1:], args) + // Debugf("invoking <%v> with args %v", fun.Type(), fullargs) + return fun.Call(fullargs) + }) + } + case 1: + fieldindex := fieldindex[0] + ret = func(env *Env) r.Value { + obj := objfun(env) + obj = field0(obj, fieldindex) + // Debugf("invoking method <%v> on receiver <%v> (addressof=%t, deref=%t)", (*funs)[index].Type(), obj.Type(), addressof, deref) + if addressof { + obj = obj.Addr() + } else if deref { + obj = obj.Elem() + } + fun := (*funs)[index] // retrieve the function as soon as possible (early bind) + + return r.MakeFunc(rtclosure, func(args []r.Value) []r.Value { + fullargs := make([]r.Value, nin) + fullargs[0] = obj + copy(fullargs[1:], args) + // Debugf("invoking <%v> with args %v", fun.Type(), fullargs) + return fun.Call(fullargs) + }) + } + default: + ret = func(env *Env) r.Value { + obj := objfun(env) + obj = fieldByIndex(obj, fieldindex) + if addressof { + obj = obj.Addr() + } else if deref { + obj = obj.Elem() + } + fun := (*funs)[index] // retrieve the function as soon as possible (early bind) + + return r.MakeFunc(rtclosure, func(args []r.Value) []r.Value { + fullargs := make([]r.Value, nin) + fullargs[0] = obj + copy(fullargs[1:], args) + // Debugf("invoking <%v> with args %v", fun.Type(), fullargs) + return fun.Call(fullargs) + }) + } + } + } + return exprX1(tclosure, ret) +} + +// compileMethodAsFunc compiles a method as a function, for example time.Duration.String. +// The method receiver will be the first argument of returned function. +func (c *Comp) compileMethodAsFunc(t xr.Type, mtd xr.Method) *Expr { + tsave := t + fieldindex := mtd.FieldIndex + + // descend embedded fields + for i, index := range fieldindex { + if t.Kind() == r.Ptr && t.Elem().Kind() == r.Struct { + // embedded field (or initial value) is a pointer, dereference it. + t = t.Elem() + fieldindex[i] = ^index // remember we neeed a pointer dereference at runtime + } + t = t.Field(index).Type + } + + index := mtd.Index + tfunc := mtd.Type + trecv := tfunc.In(0) + + objPointer := t.Kind() == r.Ptr // field is pointer? + recvPointer := trecv.Kind() == r.Ptr // method with pointer receiver? + addressof := !objPointer && recvPointer + deref := objPointer && !recvPointer + + // convert a method (i.e. with first param used as receiver) to regular function + // and, if needed, create wrapper method for embedded field + if recvPointer { + // receiver is pointer-to-tsave + if tsave.Kind() != r.Ptr { + tsave = xr.PtrTo(tsave) + if len(fieldindex) != 0 && fieldindex[0] >= 0 { + // remember we neeed a pointer dereference at runtime + fieldindex[0] = ^fieldindex[0] + } + } + } else { + // receiver is tsave + if tsave.Kind() == r.Ptr { + tsave = tsave.Elem() + if len(fieldindex) != 0 && fieldindex[0] < 0 { + // no pointer dereference at runtime + fieldindex[0] = ^fieldindex[0] + } + } + } + tfunc = c.changeFirstParam(tsave, tfunc) + + if len(fieldindex) == 0 { + // tsave is a named type, while trecv may be an unnamed interface: + // use tsave for correctness + t = tsave + } else { + t = trecv + } + if t.Kind() == r.Ptr { + t = t.Elem() + } + rtype := t.ReflectType() + + var ret r.Value + + // c.Debugf("compileMethodAsFunc: t = <%v> has %d methods, rtype = <%v> has %d methods", t, t.NumMethod(), rtype, rtype.NumMethod()) + + if t.NumMethod() == rtype.NumMethod() && t.Named() && xr.QName1(t) == xr.QName1(rtype) { + // methods declared by compiled code are available + // simply with reflect.Type.Method(index). Easy. + rmethod, ok := rtype.MethodByName(mtd.Name) + if !ok { + c.Errorf("inconsistent type <%v>: reflect.Type <%v> has no method %q", t, rtype, mtd.Name) + } + rfunc := rmethod.Func + + if rfunc.Kind() != r.Func { + if rtype.Kind() != r.Interface { + c.Errorf("inconsistent type <%v>: reflect.Type <%v> has method %q with callable function = nil", t, rtype, mtd.Name) + } + // invoking interface method... retrieve the function at runtime + rindex := rmethod.Index // usually == index. may differ if we removed wrapper methods from t + switch len(fieldindex) { + case 0: + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + return args[0].Method(rindex).Call(args[1:]) + }) + case 1: + fieldindex := fieldindex[0] + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = field0(args[0], fieldindex) + return args[0].Method(rindex).Call(args[1:]) + }) + default: + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = fieldByIndex(args[0], fieldindex) + return args[0].Method(rindex).Call(args[1:]) + }) + } + } else { + // invoking method of named type + switch len(fieldindex) { + case 0: + ret = rfunc + case 1: + fieldindex := fieldindex[0] + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = field0(args[0], fieldindex) + return rfunc.Call(args) + }) + default: + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = fieldByIndex(args[0], fieldindex) + return rfunc.Call(args) + }) + } + } + } else { + // method declared by interpreted code, manually retrieve it. + funs := mtd.Funs + + tname := t.Name() + methodname := mtd.Name + if funs == nil { + c.Errorf("method declared but not yet implemented: %s.%s", tname, methodname) + } else if len(*funs) <= index || (*funs)[index].Kind() != r.Func { + // c.Warnf("method declared but not yet implemented: %s.%s", tname, methodname) + } + + switch len(fieldindex) { + case 0: + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + if addressof { + args[0] = args[0].Addr() + } else if deref { + args[0] = args[0].Elem() + } + fun := (*funs)[index] // retrieve the function as soon as possible (early bind) + if fun == Nil { + Errorf("method is declared but not yet implemented: %s.%s", tname, methodname) + } + return fun.Call(args) + }) + case 1: + fieldindex := fieldindex[0] + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = field0(args[0], fieldindex) + // Debugf("invoking method <%v> on receiver <%v> (addressof=%t, deref=%t)", (*funs)[index].Type(), obj.Type(), addressof, deref) + if addressof { + args[0] = args[0].Addr() + } else if deref { + args[0] = args[0].Elem() + } + fun := (*funs)[index] + if fun == Nil { + Errorf("method is declared but not yet implemented: %s.%s", tname, methodname) + } + return fun.Call(args) + }) + default: + ret = r.MakeFunc(tfunc.ReflectType(), func(args []r.Value) []r.Value { + args[0] = fieldByIndex(args[0], fieldindex) + if addressof { + args[0] = args[0].Addr() + } else if deref { + args[0] = args[0].Elem() + } + fun := (*funs)[index] // retrieve the function as soon as possible (early bind) + if fun == Nil { + Errorf("method is declared but not yet implemented: %s.%s", tname, methodname) + } + return fun.Call(args) + }) + } + } + return c.exprValue(tfunc, ret.Interface()) +} + +// SelectorPlace compiles a.b returning a settable and addressable Place +func (c *Comp) SelectorPlace(node *ast.SelectorExpr, opt PlaceOption) *Place { + obje := c.Expr1(node.X) + te := obje.Type + name := node.Sel.Name + switch te.Kind() { + case r.Ptr: + te = te.Elem() + if te.Kind() != r.Struct { + break + } + objfun := obje.AsX1() + obje = exprFun(te, func(env *Env) r.Value { + obj := objfun(env) + // Debugf("SelectorPlace: obj = %v <%v> (expecting pointer to struct)", obj, obj.Type()) + return obj.Elem() + }) + fallthrough + case r.Struct: + if te.ReflectType() == rtypeOfImport && obje.Const() { + // access symbol from imported package, for example fmt.Printf + imp := obje.Value.(Import) + return c.selectorPlaceImport(&imp, name, opt) + } + field, fieldn := c.LookupField(te, name) + if fieldn == 0 { + break + } else if fieldn > 1 { + c.Errorf("type %v has %d fields named %q, all at depth %d", te, fieldn, name, len(field.Index)) + return nil + } + // if te.Kind() == r.Ptr, field is automatically settable and addressable + // because the 'a' in 'a.b' is actually a pointer + if te.Kind() == r.Struct { + c.checkAddressableField(node) + } + return c.compileFieldPlace(obje, field) + } + c.Errorf("type %v has no field %q: %v", te, name, node) + return nil +} + +// selectorImport compiles pkgname.varname returning a settable and/or addressable Place +func (c *Comp) selectorPlaceImport(imp *Import, name string, opt PlaceOption) *Place { + if bind, ok := imp.Binds[name]; ok { + // a settable reflect.Value is always addressable. + // the converse is not guaranteed: unexported fields can be addressed but not set. + // see implementation of reflect.Value.CanAddr() and reflect.Value.CanSet() for details + if bind.IsValid() && bind.CanAddr() { + return &Place{ + Var: Var{Type: imp.BindTypes[name]}, + Fun: func(*Env) r.Value { + return bind + }, + Addr: func(*Env) r.Value { + return bind.Addr() + }, + } + } + c.Errorf("%s %s %s.%s", opt, bind.Kind(), imp.Name, name) + } + c.Errorf("package %v %q has no symbol %s", imp.Name, imp.Path, name) + return nil +} + +// checkSettableField check that a struct field is settable and addressable. +// by Go specs, this requires the struct itself to be settable and addressable. +func (c *Comp) checkAddressableField(node *ast.SelectorExpr) { + panicking := true + defer func() { + if panicking { + rec := recover() + c.Pos = node.Pos() + c.Errorf("cannot assign to %v\n\t%v", node, rec) + } + }() + c.placeOrAddress(node.X, PlaceAddress) + panicking = false +} + +func (c *Comp) compileFieldPlace(obje *Expr, field xr.StructField) *Place { + // c.Debugf("compileFieldPlace: field=%#v", field) + objfun := obje.AsX1() + t := field.Type + var fun, addr func(*Env) r.Value + index := field.Index + if len(index) == 1 { + index0 := index[0] + fun = func(env *Env) r.Value { + obj := objfun(env) + return field0(obj, index0) + } + addr = func(env *Env) r.Value { + obj := objfun(env) + return field0(obj, index0).Addr() + } + } else { + fun = func(env *Env) r.Value { + obj := objfun(env) + return fieldByIndex(obj, index) + } + addr = func(env *Env) r.Value { + obj := objfun(env) + return fieldByIndex(obj, index).Addr() + } + } + return &Place{Var: Var{Type: t, Name: field.Name}, Fun: fun, Addr: addr} +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/slice.go b/vendor/github.com/cosmos72/gomacro/fast/slice.go new file mode 100644 index 0000000..828711d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/slice.go @@ -0,0 +1,284 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * slice.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + r "reflect" + + xr "github.com/cosmos72/gomacro/xreflect" +) + +// SliceExpr compiles slice[lo:hi] and slice[lo:hi:max] +func (c *Comp) SliceExpr(node *ast.SliceExpr) *Expr { + e := c.Expr1(node.X) + if e.Const() { + e.ConstTo(e.DefaultType()) + } + if e.Type.Kind() == r.Array { + c.sliceArrayMustBeAddressable(node, e) + } + lo := c.sliceIndex(node.Low) + hi := c.sliceIndex(node.High) + max := c.sliceIndex(node.Max) + var ret *Expr + if node.Slice3 { + ret = c.slice3(node, e, lo, hi, max) + } else { + ret = c.slice2(node, e, lo, hi) + } + // constant propagation + if e.Const() && (lo == nil || lo.Const()) && (hi == nil || hi.Const()) && (max == nil || max.Const()) { + ret.EvalConst(OptKeepUntyped) + } + return ret +} + +func (c *Comp) sliceIndex(node ast.Expr) *Expr { + if node == nil { + return nil + } + idx := c.Expr1(node) + if idx.Const() { + idx.ConstTo(c.TypeOfInt()) + if idx.Value.(int) < 0 { + c.Errorf("negative slice index: %v == %v", node, idx) + } + } else if idx.Type == nil || !idx.Type.AssignableTo(c.TypeOfInt()) { + c.Errorf("invalid slice index: expecting integer, found: %v <%v>", idx.Type, node) + } + return idx +} + +// slice2 compiles slice[lo:hi] +func (c *Comp) slice2(node *ast.SliceExpr, e, lo, hi *Expr) *Expr { + t := e.Type + switch t.Kind() { + case r.String: + return c.sliceString(e, lo, hi) + case r.Ptr: + if t.Elem().Kind() != r.Array { + break + } + fallthrough + case r.Slice, r.Array: + if t.Kind() == r.Ptr { + t = t.Elem() + objfun := e.AsX1() + e = exprX1(t, func(env *Env) r.Value { + return objfun(env).Elem() + }) + } + objfun := e.AsX1() + if lo == nil { + lo = c.exprValue(c.TypeOfInt(), 0) + } + var fun func(env *Env) r.Value + if lo.Const() { + lo := lo.Value.(int) + if hi == nil { + fun = func(env *Env) r.Value { + obj := objfun(env) + return obj.Slice(lo, obj.Len()) + } + } else if hi.Const() { + hi := hi.Value.(int) + fun = func(env *Env) r.Value { + obj := objfun(env) + return obj.Slice(lo, hi) + } + } else { + hifun := hi.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + obj := objfun(env) + hi := hifun(env) + return obj.Slice(lo, hi) + } + } + } else { + lofun := lo.WithFun().(func(*Env) int) + if hi == nil { + fun = func(env *Env) r.Value { + obj := objfun(env) + lo := lofun(env) + return obj.Slice(lo, obj.Len()) + } + } else if hi.Const() { + hi := hi.Value.(int) + fun = func(env *Env) r.Value { + obj := objfun(env) + lo := lofun(env) + return obj.Slice(lo, hi) + } + } else { + hifun := hi.WithFun().(func(*Env) int) + fun = func(env *Env) r.Value { + obj := objfun(env) + lo := lofun(env) + hi := hifun(env) + return obj.Slice(lo, hi) + } + } + } + tout := xr.SliceOf(t.Elem()) + return exprX1(tout, fun) + } + c.Errorf("cannot slice %v: %v", t, node) + return nil +} + +// sliceString compiles string[lo:hi] +func (c *Comp) sliceString(e, lo, hi *Expr) *Expr { + objfun := e.WithFun().(func(*Env) string) + var fun func(env *Env) string + if lo == nil { + if hi == nil { + fun = objfun + } else if hi.Const() { + hi := hi.Value.(int) + fun = func(env *Env) string { + obj := objfun(env) + return obj[:hi] + } + } else { + hifun := hi.WithFun().(func(*Env) int) + fun = func(env *Env) string { + obj := objfun(env) + hi := hifun(env) + return obj[:hi] + } + } + } else if lo.Const() { + lo := lo.Value.(int) + if hi == nil { + fun = func(env *Env) string { + obj := objfun(env) + return obj[lo:] + } + } else if hi.Const() { + hi := hi.Value.(int) + fun = func(env *Env) string { + obj := objfun(env) + return obj[lo:hi] + } + } else { + hifun := hi.WithFun().(func(*Env) int) + fun = func(env *Env) string { + obj := objfun(env) + hi := hifun(env) + return obj[lo:hi] + } + } + } else { + lofun := lo.WithFun().(func(*Env) int) + if hi == nil { + fun = func(env *Env) string { + obj := objfun(env) + lo := lofun(env) + return obj[lo:] + } + } else if hi.Const() { + hi := hi.Value.(int) + fun = func(env *Env) string { + obj := objfun(env) + lo := lofun(env) + return obj[lo:hi] + } + } else { + hifun := hi.WithFun().(func(*Env) int) + fun = func(env *Env) string { + obj := objfun(env) + lo := lofun(env) + hi := hifun(env) + return obj[lo:hi] + } + } + } + return exprFun(c.TypeOfString(), fun) +} + +// slice3 compiles slice[lo:hi:max] +func (c *Comp) slice3(node *ast.SliceExpr, e, lo, hi, max *Expr) *Expr { + if lo == nil { + lo = c.exprValue(c.TypeOfInt(), 0) + } + if hi == nil { + c.Errorf("final index required in 3-index slice: %v", node) + } + if max == nil { + c.Errorf("final index required in 3-index slice: %v", node) + } + t := e.Type + switch t.Kind() { + case r.String: + c.Errorf("invalid operation %v (3-index slice of string)", node) + return nil + case r.Ptr: + if t.Elem().Kind() != r.Array { + break + } + fallthrough + case r.Slice, r.Array: + objfun := e.AsX1() + lofun := lo.WithFun().(func(*Env) int) + hifun := hi.WithFun().(func(*Env) int) + maxfun := max.WithFun().(func(*Env) int) + var fun func(env *Env) r.Value + if t.Kind() == r.Ptr { + t = t.Elem() + fun = func(env *Env) r.Value { + obj := objfun(env).Elem() + lo := lofun(env) + hi := hifun(env) + max := maxfun(env) + return obj.Slice3(lo, hi, max) + } + } else { + fun = func(env *Env) r.Value { + obj := objfun(env) + lo := lofun(env) + hi := hifun(env) + max := maxfun(env) + return obj.Slice3(lo, hi, max) + } + } + tout := xr.SliceOf(t.Elem()) + return exprX1(tout, fun) + } + c.Errorf("cannot slice %v: %v", t, node) + return nil +} + +func (c *Comp) sliceArrayMustBeAddressable(node *ast.SliceExpr, e *Expr) { + panicking := true + defer func() { + if panicking { + c.Errorf("cannot slice: array must be addressable: %v <%v>", node, e.Type) + } + }() + c.placeOrAddress(node.X, PlaceAddress) + panicking = false +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/statement.go b/vendor/github.com/cosmos72/gomacro/fast/statement.go new file mode 100644 index 0000000..b16f7ab --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/statement.go @@ -0,0 +1,702 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * statement.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + "sort" + + . "github.com/cosmos72/gomacro/base" +) + +func stmtNop(env *Env) (Stmt, *Env) { + env.IP++ + return env.Code[env.IP], env +} + +func popEnv(env *Env) (Stmt, *Env) { + outer := env.Outer + outer.IP = env.IP + 1 + env.FreeEnv() + return outer.Code[outer.IP], outer +} + +func (c *Comp) Stmt(in ast.Stmt) { + var labels []string + for { + if in != nil { + c.Pos = in.Pos() + } + switch node := in.(type) { + case nil: + case *ast.AssignStmt: + c.Assign(node) + case *ast.BlockStmt: + c.Block(node) + case *ast.BranchStmt: + c.Branch(node) + case *ast.CaseClause: + c.misplacedCase(node, node.List == nil) + case *ast.CommClause: + c.misplacedCase(node, node.Comm == nil) + case *ast.DeclStmt: + c.Decl(node.Decl) + case *ast.DeferStmt: + c.Defer(node) + case *ast.EmptyStmt: + // nothing to do + case *ast.ExprStmt: + expr := c.Expr(node.X) + if !expr.Const() { + c.Append(expr.AsStmt(), in.Pos()) + } + case *ast.ForStmt: + c.For(node, labels) + case *ast.GoStmt: + c.Go(node) + case *ast.IfStmt: + c.If(node) + case *ast.IncDecStmt: + c.IncDec(node) + case *ast.LabeledStmt: + labels = append(labels, node.Label.Name) + in = node.Stmt + continue + case *ast.RangeStmt: + c.Range(node, labels) + case *ast.ReturnStmt: + c.Return(node) + case *ast.SelectStmt: + c.Select(node, labels) + case *ast.SendStmt: + c.Send(node) + case *ast.SwitchStmt: + c.Switch(node, labels) + case *ast.TypeSwitchStmt: + c.TypeSwitch(node, labels) + default: + c.Errorf("unimplemented statement: %v <%v>", node, r.TypeOf(node)) + } + return + } +} + +// Block compiles a block statement, i.e. { ... } +func (c *Comp) Block(block *ast.BlockStmt) { + if block == nil || len(block.List) == 0 { + return + } + c.List(block.List) +} + +// List compiles a slice of statements +func (c *Comp) List(list []ast.Stmt) { + if len(list) == 0 { + c.Errorf("List invoked on empty statement list") + } + var nbinds [2]int // # of binds in the block + + c2, locals := c.pushEnvIfLocalBinds(&nbinds, list...) + + for _, node := range list { + c2.Stmt(node) + } + + c2.popEnvIfLocalBinds(locals, &nbinds, list...) + + // c.Debugf("List compiled. inner *Comp = %#v", c2) +} + +// Branch compiles a break, continue, fallthrough or goto statement +func (c *Comp) Branch(node *ast.BranchStmt) { + switch node.Tok { + case token.BREAK: + c.Break(node) + case token.CONTINUE: + c.Continue(node) + case token.FALLTHROUGH: + c.misplacedFallthrough() + /* + case token.GOTO: + c.Goto(node) + */ + default: + c.Errorf("unimplemented branch statement: %v <%v>", node, r.TypeOf(node)) + } +} + +// Break compiles a "break" statement +func (c *Comp) Break(node *ast.BranchStmt) { + label := "" + if node.Label != nil { + label = node.Label.Name + } + upn := 0 + // do not cross function boundaries + for o := c; o != nil && o.Func == nil; o = o.Outer { + if o.Loop != nil && o.Loop.Break != nil { + if len(label) == 0 || o.Loop.HasLabel(label) { + // only keep a reference to the jump target, NOT TO THE WHOLE *Comp! + c.jumpOut(upn, o.Loop.Break) + return + } + } + upn += o.UpCost // count how many Env:s we must exit at runtime + } + if len(label) != 0 { + c.Errorf("break label not defined: %v", label) + } else { + c.Errorf("break outside for/switch") + } +} + +// Continue compiles a "continue" statement +func (c *Comp) Continue(node *ast.BranchStmt) { + label := "" + if node.Label != nil { + label = node.Label.Name + } + upn := 0 + // do not cross function boundaries + for o := c; o != nil && o.Func == nil; o = o.Outer { + if o.Loop != nil && o.Loop.Continue != nil { + if len(label) == 0 || o.Loop.HasLabel(label) { + // only keep a reference to the jump target, NOT TO THE WHOLE *Comp! + c.jumpOut(upn, o.Loop.Continue) + return + } + } + upn += o.UpCost // count how many Env:s we must exit at runtime + } + if len(label) != 0 { + c.Errorf("continue label not defined: %v", label) + } else { + c.Errorf("continue outside for") + } +} + +// Defer compiles a "defer" statement +func (c *Comp) Defer(node *ast.DeferStmt) { + call := c.prepareCall(node.Call, nil) + fun := call.Fun.AsX1() + argfuns := call.MakeArgfunsX1() + ellipsis := call.Ellipsis + c.append(func(env *Env) (Stmt, *Env) { + // Go specs: arguments of a defer call are evaluated immediately. + // the call itself is executed when the function containing defer returns, + // either normally or with a panic + f := fun(env) + if f.CanSet() { + f = f.Convert(f.Type()) // make a copy + } + args := make([]r.Value, len(argfuns)) + for i, argfun := range argfuns { + v := argfun(env) + if v.CanSet() { + v = v.Convert(v.Type()) // make a copy + } + args[i] = v + } + env.IP++ + g := env.ThreadGlobals + if ellipsis { + g.InstallDefer = func() { + f.CallSlice(args) + } + } else { + g.InstallDefer = func() { + f.Call(args) + } + } + g.Signal = SigDefer + return g.Interrupt, env + }) + c.Code.WithDefers = true +} + +// jumpOut compiles a break or continue statement +// ip is a pointer because the jump target may not be known yet... it will be filled later +func (c *Comp) jumpOut(upn int, ip *int) { + var stmt Stmt + switch upn { + case 0: + stmt = func(env *Env) (Stmt, *Env) { + ip := *ip + env.IP = ip + return env.Code[ip], env + } + case 1: + stmt = func(env *Env) (Stmt, *Env) { + env = env.Outer + ip := *ip + env.IP = ip + return env.Code[ip], env + } + case 2: + stmt = func(env *Env) (Stmt, *Env) { + env = env.Outer.Outer + ip := *ip + env.IP = ip + return env.Code[ip], env + } + default: + stmt = func(env *Env) (Stmt, *Env) { + env = env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + env = env.Outer + } + ip := *ip + env.IP = ip + return env.Code[ip], env + } + } + c.append(stmt) +} + +// For compiles a "for" statement +func (c *Comp) For(node *ast.ForStmt, labels []string) { + initLocals := false + var initBinds [2]int + + c, initLocals = c.pushEnvIfLocalBinds(&initBinds, node.Init) + if node.Init != nil { + c.Stmt(node.Init) + } + flag, fun, err := true, (func(*Env) bool)(nil), false // "for { }" without a condition means "for true { }" + if node.Cond != nil { + pred := c.Expr(node.Cond) + flag, fun, err = pred.TryAsPred() + if err { + c.invalidPred(node.Cond, pred) + return + } + } + var jump struct{ Cond, Post, Break int } + sort.Strings(labels) + // we need a fresh Comp here... created above by c.pushEnvIfLocalBinds() + c.Loop = &LoopInfo{ + Continue: &jump.Post, + Break: &jump.Break, + ThisLabels: labels, + } + + // compile the condition, if not a constant + jump.Cond = c.Code.Len() + if fun != nil { + stmt := func(env *Env) (Stmt, *Env) { + var ip int + if fun(env) { + ip = env.IP + 1 + // Debugf("for: condition = true, iterating. IntBinds = %v", env.IntBinds) + } else { + // Debugf("for: condition = false, exiting. IntBinds = %v", env.IntBinds) + ip = jump.Break + } + env.IP = ip + return env.Code[ip], env + } + c.Append(stmt, node.Cond.Pos()) + } + // compile the body + c.Block(node.Body) + // compile the post + if node.Post == nil { + jump.Post = jump.Cond // no post statement. "continue" jumps to the condition + } else { + jump.Post = c.Code.Len() + if containLocalBinds(node.Post) { + c.Errorf("invalid for: cannot declare new variables in post statement: %v", node.Post) + } + c.Stmt(node.Post) + } + c.Append(func(env *Env) (Stmt, *Env) { + // jump back to the condition + // Debugf("for: body executed, jumping back to condition. IntBinds = %v", env.IntBinds) + // time.Sleep(time.Second / 10) + ip := jump.Cond + env.IP = ip + return env.Code[ip], env + }, node.End()-1) + if fun == nil && !flag { + // "for false { }" means that body, post and jump back to condition are never executed... + // still compiled above (to check for errors) but drop the generated code + c.Code.List = c.Code.List[0:jump.Cond] + } + jump.Break = c.Code.Len() + + c = c.popEnvIfLocalBinds(initLocals, &initBinds, node.Init) +} + +// Go compiles a "go" statement i.e. a goroutine +func (c *Comp) Go(node *ast.GoStmt) { + // we must create a new ThreadGlobals with a new Pool. + // Ideally, the new ThreadGlobals could be created inside the call, + // but that requires modifying the function being executed. + // Instead, we create the new ThreadGlobals here and wrap it into an "unnecessary" Env + // Thus we must create a corresponding "unnecessary" Comp and use it to compile the call + c2 := NewComp(c, &c.Code) + + call := c2.prepareCall(node.Call, nil) + exprfun := call.Fun.AsX1() + argfunsX1 := call.MakeArgfunsX1() + + stmt := func(env *Env) (Stmt, *Env) { + // create a new Env to hold the new ThreadGlobals and (initially empty) Pool + env2 := NewEnv4Func(env, 0, 0) + tg := env.ThreadGlobals + env2.ThreadGlobals = &ThreadGlobals{ + FileEnv: tg.FileEnv, + TopEnv: tg.TopEnv, + // Interrupt, Signal, PoolSize and Pool are zero-initialized, fine with that + Globals: tg.Globals, + } + // env2.MarkUsedByClosure() // redundant, done by exprfun(env2) below + + // function and arguments are evaluated in the caller's goroutine + // using the new Env: we compiled them with c2 => execute them with env2 + funv := exprfun(env2) + argv := make([]r.Value, len(argfunsX1)) + for i, argfun := range argfunsX1 { + argv[i] = argfun(env2) + } + // the call is executed in a new goroutine. + // make it easy and do not try to optimize this call. + go funv.Call(argv) + + env.IP++ + return env.Code[env.IP], env + } + c2.Append(stmt, node.Pos()) + + // propagate back the compiled code + c.Code = c2.Code +} + +// If compiles an "if" statement +func (c *Comp) If(node *ast.IfStmt) { + var jump struct{ Then, Else, End int } + + initLocals := false + var initBinds [2]int + c, initLocals = c.pushEnvIfLocalBinds(&initBinds, node.Init) + if node.Init != nil { + c.Stmt(node.Init) + } + pred := c.Expr(node.Cond) + flag, fun, err := pred.TryAsPred() + if err { + c.invalidPred(node.Cond, pred) + return + } + if fun != nil { + stmt := func(env *Env) (Stmt, *Env) { + var ip int + if fun(env) { + ip = jump.Then + } else { + ip = jump.Else + } + env.IP = ip + return env.Code[ip], env + } + c.Append(stmt, node.Cond.Pos()) + } + // compile 'then' branch + jump.Then = c.Code.Len() + c.Block(node.Body) + if fun == nil && !flag { + // 'then' branch is never executed... + // still compiled above (to check for errors) but drop the generated code + c.Code.List = c.Code.List[0:jump.Then] + } + // compile a 'goto' between 'then' and 'else' branches + if fun != nil && node.Else != nil { + c.Append(func(env *Env) (Stmt, *Env) { + // after executing 'then' branch, we must skip 'else' branch + env.IP = jump.End + return env.Code[jump.End], env + }, node.Else.Pos()) + } + // compile 'else' branch + jump.Else = c.Code.Len() + if node.Else != nil { + // parser should guarantee Else to be a block or another "if" + // but macroexpansion can optimize away the block if it contains no declarations. + // still, better be safe and wrap the Else again in a block because: + // 1) catches improper macroexpander optimizations + // 2) there is no runtime performance penalty + xelse := node.Else + _, ok1 := xelse.(*ast.BlockStmt) + _, ok2 := xelse.(*ast.IfStmt) + if ok1 || ok2 { + c.Stmt(xelse) + } else { + c.Block(&ast.BlockStmt{List: []ast.Stmt{xelse}}) + } + if fun == nil && flag { + // 'else' branch is never executed... + // still compiled above (to check for errors) but drop the generated code + c.Code.List = c.Code.List[0:jump.Else] + } + } + jump.End = c.Code.Len() + + c = c.popEnvIfLocalBinds(initLocals, &initBinds, node.Init) +} + +// IncDec compiles a "place++" or "place--" statement +func (c *Comp) IncDec(node *ast.IncDecStmt) { + place := c.Place(node.X) + op := node.Tok + if op == token.DEC { + op = token.SUB + } else { + op = token.ADD + } + one := c.exprUntypedLit(untypedOne.Kind, untypedOne.Obj) + c.SetPlace(place, op, one) +} + +// Return compiles a "return" statement +func (c *Comp) Return(node *ast.ReturnStmt) { + var cinfo *FuncInfo + var upn int + var cf *Comp + for cf = c; cf != nil; cf = cf.Outer { + if cf.Func != nil { + cinfo = cf.Func + break + } + upn += cf.UpCost // count how many Env:s we must exit at runtime + } + if cinfo == nil { + c.Errorf("return outside function") + return + } + + resultBinds := cinfo.Results + resultExprs := node.Results + n := len(resultBinds) + switch len(resultExprs) { + case n: + // ok + case 1: + if n == 0 { + c.Errorf("return: expecting %d expressions, found %d: %v", n, len(resultExprs), node) + } + c.returnMultiValues(node, resultBinds, upn, resultExprs) + return + case 0: + if !cinfo.NamedResults { + // naked return requires results to have names + c.Errorf("return: expecting %d expressions, found %d: %v", n, len(resultExprs), node) + return + } + n = 0 // naked return. results are already set + default: + c.Errorf("return: expecting %d expressions, found %d: %v", n, len(resultExprs), node) + return + } + + exprs := c.Exprs(resultExprs) + for i := 0; i < n; i++ { + c.SetVar(resultBinds[i].AsVar(upn, PlaceSettable), token.ASSIGN, exprs[i]) + } + c.Append(stmtReturn, node.Pos()) +} + +// returnMultiValues compiles a "return foo()" statement where foo() returns multiple values +func (c *Comp) returnMultiValues(node *ast.ReturnStmt, resultBinds []*Bind, upn int, exprs []ast.Expr) { + n := len(resultBinds) + e := c.ExprsMultipleValues(exprs, n)[0] + fun := e.AsXV(OptDefaults) + assigns := make([]func(*Env, r.Value), n) + for i := 0; i < n; i++ { + texpected := resultBinds[i].Type + tactual := e.Out(i) + if !tactual.AssignableTo(texpected) { + c.Errorf("incompatible types in assignment: %v = %v", texpected, tactual) + } + assigns[i] = c.varSetValue(resultBinds[i].AsVar(upn, PlaceSettable)) + } + c.Append(func(env *Env) (Stmt, *Env) { + // no risk in evaluating fun() first: return binds are plain variables, not places with side effects + _, vals := fun(env) + for i, assign := range assigns { + assign(env, vals[i]) + } + // append the return epilogue + common := env.ThreadGlobals + common.Signal = SigReturn + return common.Interrupt, env + }, node.Pos()) +} + +func stmtReturn(env *Env) (Stmt, *Env) { + common := env.ThreadGlobals + common.Signal = SigReturn + return common.Interrupt, env +} + +// containLocalBinds return true if one or more of the given statements (but not their contents: +// blocks are not examined) contain some function/variable declaration. +// ignores types, constants and anything named "_" +func containLocalBinds(list ...ast.Stmt) bool { + if len(list) == 0 { + Errorf("internal error: containLocalBinds() invoked on empty statement list") + } + for _, node := range list { + switch node := node.(type) { + case *ast.AssignStmt: + if node.Tok == token.DEFINE { + return true + } + case *ast.DeclStmt: + switch decl := node.Decl.(type) { + case *ast.FuncDecl: + // Go compiler forbids local functions... we allow them + if decl.Name != nil && decl.Name.Name != "_" { + return true + } + case *ast.GenDecl: + if decl.Tok != token.VAR { + continue + } + // found local variables... bail out unless they are all named "_" + for _, spec := range decl.Specs { + switch spec := spec.(type) { + case *ast.ValueSpec: + for _, ident := range spec.Names { + if ident.Name != "_" { + return true + } + } + } + } + } + case nil: + } + } + return false +} + +// pushEnvIfLocalBinds compiles a PushEnv statement if list contains local binds +// returns the *Comp to use to compile statement list. +func (c *Comp) pushEnvIfLocalBinds(nbinds *[2]int, list ...ast.Stmt) (inner *Comp, locals bool) { + if len(list) == 0 { + inner.Errorf("internal error: pushEnvIfLocalBinds() invoked on empty statement list") + } + // 2. optimization: examine statements. if none of them is a function/variable declaration, + // no need to create a new *Env at runtime + // note: we still create a new *Comp at compile time to handle constant/type declarations + locals = containLocalBinds(list...) + return c.pushEnvIfFlag(nbinds, locals) +} + +// pushEnvIfDefine compiles a PushEnv statement if tok is token.DEFINE +// returns the *Comp to use to compile statement list. +func (c *Comp) pushEnvIfDefine(nbinds *[2]int, tok token.Token) (inner *Comp, locals bool) { + return c.pushEnvIfFlag(nbinds, tok == token.DEFINE) +} + +// pushEnvIfFlag compiles a PushEnv statement if flag is true +// returns the *Comp to use to compile statement list. +func (c *Comp) pushEnvIfFlag(nbinds *[2]int, flag bool) (*Comp, bool) { + if flag { + // push new *Env at runtime. we will know # of binds in the block only later, so use a closure on them + c.append(func(env *Env) (Stmt, *Env) { + inner := NewEnv(env, nbinds[0], nbinds[1]) + inner.IP++ + // Debugf("PushEnv(%p->%p), IP = %d of %d, pushed %d binds and %d intbinds", env, inner, inner.IP, nbinds[0], nbinds[1]) + return inner.Code[inner.IP], inner + }) + } + inner := NewComp(c, &c.Code) + if !flag { + inner.UpCost = 0 + inner.Depth-- + } + return inner, flag +} + +// popEnvIfLocalBinds compiles a PopEnv statement if locals is true. also sets *nbinds and *nintbinds +func (inner *Comp) popEnvIfLocalBinds(locals bool, nbinds *[2]int, list ...ast.Stmt) *Comp { + if len(list) == 0 { + inner.Errorf("internal error: popEnvIfLocalBinds() invoked on empty statement list") + } + c := inner.Outer + c.Code = inner.Code // copy back accumulated code + nbinds[0] = inner.BindNum // we finally know these + nbinds[1] = inner.IntBindNum + + if locals != (inner.BindNum != 0 || inner.IntBindNum != 0) { + c.Errorf(`internal error: containLocalBinds() returned %t, but block actually defined %d Binds and %d IntBinds: + Binds = %v + Block = +%v`, locals, inner.BindNum, inner.IntBindNum, inner.Binds, &ast.BlockStmt{List: list}) + return nil + } + + if locals { + // pop *Env at runtime + c.append(popEnv) + } + return c +} + +// popEnvIfLocalBinds compiles a PopEnv statement if flag is true. also sets *nbinds and *nintbinds +func (inner *Comp) popEnvIfFlag(nbinds *[2]int, flag bool) *Comp { + c := inner.Outer + c.Code = inner.Code // copy back accumulated code + nbinds[0] = inner.BindNum // we finally know these + nbinds[1] = inner.IntBindNum + + if flag != (inner.BindNum != 0 || inner.IntBindNum != 0) { + c.Errorf(`popEnvIfFlag internal error: flag is %t, but block actually defined %d Binds and %d IntBinds: + Binds = %v`, flag, inner.BindNum, inner.IntBindNum, inner.Binds) + return nil + } + + if flag { + // pop *Env at runtime + c.append(popEnv) + } + return c +} + +func (c *Comp) misplacedCase(node ast.Node, isdefault bool) { + label := "case" + if isdefault { + label = "default" + } + c.Errorf("misplaced %s: not inside switch or select: %v <%v>", label, node, r.TypeOf(node)) +} + +func (c *Comp) misplacedFallthrough() { + c.Errorf("misplaced fallthrough: not inside switch") +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/switch.go b/vendor/github.com/cosmos72/gomacro/fast/switch.go new file mode 100644 index 0000000..fc6e738 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/switch.go @@ -0,0 +1,364 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * switch.go + * + * Created on May 06, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/constant" + "go/token" + r "reflect" + "sort" + "time" + + . "github.com/cosmos72/gomacro/base" +) + +type caseEntry struct { + Pos token.Pos + IP int +} + +type caseMap map[interface{}]caseEntry + +type caseHelper struct { + ConstMap caseMap // constains all case constants + GotoMap caseMap // contains only the constants appearing before any non-constant case expression + AllConst bool +} + +// keep track of constant expressions in cases. error on duplicates +func (seen *caseHelper) add(c *Comp, val interface{}, entry caseEntry) { + prev, found := seen.ConstMap[val] + if found { + c.Errorf("duplicate case %v <%v> in switch\n\tprevious case at %s", val, r.TypeOf(val), c.Fileset.Position(prev.Pos)) + return + } + seen.ConstMap[val] = entry + if seen.AllConst { + seen.GotoMap[val] = entry + } +} + +func (c *Comp) Switch(node *ast.SwitchStmt, labels []string) { + initLocals := false + var initBinds [2]int + c, initLocals = c.pushEnvIfLocalBinds(&initBinds, node.Init) + if node.Init != nil { + c.Stmt(node.Init) + } + var ibreak int + sort.Strings(labels) + c.Loop = &LoopInfo{ + Break: &ibreak, + ThisLabels: labels, + } + + // tag.Value (if constant) or tag.Fun() will return the tag value at runtime + var tag *Expr + tagnode := node.Tag + if tagnode == nil { + // "switch { }" without an expression means "switch true { }" + tag = c.exprUntypedLit(r.Bool, constant.MakeBool(true)) + tagnode = &ast.Ident{NamePos: node.Pos() + 6, Name: "true"} // only for error messages + } else { + tag = c.Expr1(tagnode) + } + if !tag.Const() { + // cannot invoke tag.Fun() multiple times because side effects must be applied only once! + // switchTag saves the result of tag.Fun() in a runtime bind + // and returns an expression that retrieves it + tag = c.switchTag(tag) + + if c.Options&OptDebugSleepOnSwitch != 0 { + c.append(func(env *Env) (Stmt, *Env) { + Debugf("start sleeping on switch, env = %p", env) + time.Sleep(time.Second / 30) + Debugf("done sleeping on switch, env = %p", env) + env.IP++ + return env.Code[env.IP], env + }) + } + } + if node.Body != nil { + // reserve a code slot for switchGotoMap/switchGotoSlice optimizer + ipswitchgoto := c.Code.Len() + seen := &caseHelper{make(caseMap), make(caseMap), true} // keeps track of constant expressions in cases. errors on duplicates + c.Append(stmtNop, node.Body.Pos()) + + list := node.Body.List + defaulti := -1 + var defaultpos token.Pos + n := len(list) + for i, stmt := range list { + switch clause := stmt.(type) { + case *ast.CaseClause: + canfallthrough := i < n-1 // last case cannot fallthrough + if clause.List == nil { + if defaulti >= 0 { + c.Errorf("multiple defaults in switch (first at %s)", c.Fileset.Position(defaultpos)) + } + defaulti = c.Code.Len() + defaultpos = clause.Pos() + c.switchDefault(clause, canfallthrough) + } else { + c.switchCase(clause, tagnode, tag, canfallthrough, seen) + } + default: + c.Errorf("invalid statement inside switch: expecting case or default, found: %v <%v>", stmt, r.TypeOf(stmt)) + } + } + // default is executed as last, if no other case matches + if defaulti >= 0 { + // +1 to skip its "never matches" header + c.Append(func(env *Env) (Stmt, *Env) { + ip := defaulti + 1 + env.IP = ip + return env.Code[ip], env + }, defaultpos) + } + // try to optimize + c.switchGotoMap(tag, seen, ipswitchgoto) + } + // we finally know this + ibreak = c.Code.Len() + + c = c.popEnvIfLocalBinds(initLocals, &initBinds, node.Init) +} + +// switchTag takes the expression immediately following a switch, +// compiles it to a statement that evaluates it and saves its result +// in a runtime binding (an interpreter local variable), +// finally returns another expression that retrieves such runtime binding +func (c *Comp) switchTag(e *Expr) *Expr { + var upn, o = 0, c + // try to piggyback the binding to a Comp that already has some bindings, + // but do not cross function boundaries + for o.BindNum == 0 && o.IntBindNum == 0 && o.Func == nil && o.Outer != nil { + upn += o.UpCost + o = o.Outer + } + return c.Symbol(c.declUnnamedBind(e, o, upn)) +} + +// switchCase compiles a case in a switch. +func (c *Comp) switchCase(node *ast.CaseClause, tagnode ast.Expr, tag *Expr, canfallthrough bool, seen *caseHelper) { + cmpfuns := make([]func(*Env) bool, 0) + cmpnode := &ast.BinaryExpr{Op: token.EQL, X: tagnode} // for error messages, and Comp.BinaryExpr1 dispatches on its Op + + ibody := c.Code.Len() + 1 // body will start here + // compile a comparison of tag against each expression + sometrue := false + for _, enode := range node.List { + e := c.Expr1(enode) + if e.Const() { + e.ConstTo(tag.Type) + } + cmpnode.OpPos = enode.Pos() + cmpnode.Y = enode + cmp := c.BinaryExpr1(cmpnode, tag, e) + if e.Const() { + seen.add(c, e.Value, caseEntry{Pos: enode.Pos(), IP: ibody}) + if tag.Const() { + // constant propagation + flag := cmp.EvalConst(OptDefaults) + if r.ValueOf(flag).Bool() { + sometrue = true + break // always matches, no need to check further expressions + } else { + // can never match, skip this expression + continue + } + } + } else { + seen.AllConst = false + } + // constants are handled above. only add non-constant comparisons to cmpfuns + cmpfuns = append(cmpfuns, cmp.Fun.(func(*Env) bool)) + } + // compile like "if tag == e1 || tag == e2 ... { }" + // and keep track of where to jump if no expression matches + // + // always occupy a Code slot for cmpfuns, even if nothing to do. + // reason: both caseMap optimizer and fallthrough from previous case + // skip such slot and jump to current body + var iend int + var stmt Stmt + switch len(cmpfuns) { + case 0: + if sometrue { + stmt = stmtNop + } else { + // compile anyway, a fallthrough from previous case may still reach the current body + stmt = func(env *Env) (Stmt, *Env) { + ip := iend + env.IP = ip + return env.Code[ip], env + } + } + case 1: + cmpfun := cmpfuns[0] + if sometrue { + stmt = func(env *Env) (Stmt, *Env) { + // keep side effects + cmpfun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + var ip int + if cmpfun(env) { + ip = env.IP + 1 + } else { + ip = iend + } + env.IP = ip + return env.Code[ip], env + } + } + case 2: + cmpfuns := [...]func(*Env) bool{ + cmpfuns[0], + cmpfuns[1], + } + if sometrue { + stmt = func(env *Env) (Stmt, *Env) { + // keep side effects + _ = cmpfuns[0](env) || cmpfuns[1](env) + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + var ip int + if cmpfuns[0](env) || cmpfuns[1](env) { + ip = env.IP + 1 + } else { + ip = iend + } + env.IP = ip + return env.Code[ip], env + } + } + default: + if sometrue { + stmt = func(env *Env) (Stmt, *Env) { + for _, cmpfun := range cmpfuns { + // keep side effects + if cmpfun(env) { + break + } + } + env.IP++ + return env.Code[env.IP], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + ip := iend + for _, cmpfun := range cmpfuns { + if cmpfun(env) { + ip = env.IP + 1 + break + } + } + env.IP = ip + return env.Code[ip], env + } + } + } + c.Append(stmt, node.Pos()) + c.switchCaseBody(node.Body, canfallthrough) + // we finally know where to jump if match fails + iend = c.Code.Len() +} + +// switchDefault compiles the default case in a switch +func (c *Comp) switchDefault(node *ast.CaseClause, canfallthrough bool) { + var iend int + c.Append(func(env *Env) (Stmt, *Env) { + // jump to the next case. we must always add this statement for three reasons: + // 1) if default is entered normally, it always fails to match and jumps to the next case + // 2) if the previous case ends with fallthrough, it will skip this statement and jump to default's body + // 3) if the switch ends without any matching case, it will manually jump to default's body (skipping this statement) + ip := iend + env.IP = ip + return env.Code[ip], env + }, node.Pos()) + c.switchCaseBody(node.Body, canfallthrough) + // we finally know where to jump if match fails + iend = c.Code.Len() +} + +// switchCaseBody compiles the body of a case in a switch +func (c *Comp) switchCaseBody(list []ast.Stmt, canfallthrough bool) { + var isfallthrough bool + var endpos token.Pos + n := len(list) + if n != 0 { + isfallthrough = isFallthrough(list[n-1]) + if isfallthrough { + endpos = list[n-1].Pos() + if canfallthrough { + n-- + list = list[:n] + } else { + c.Errorf("cannot fallthrough final case in switch") + return + } + } else { + endpos = list[n-1].End() + } + + // c.List creates a new scope... not accurate, compiled Go doesn't. + // but at least isolates per-case variables, as compiled Go does + if n != 0 { + c.List(list) + } + } + // after executing the case body, either break or fallthrough + c.Pos = endpos + if isfallthrough { + c.append(stmtFallthrough) + } else { + c.jumpOut(0, c.Loop.Break) + } +} + +// stmtFallThrough executes a fallthrough statement - only works inside a switch, +// and cannot be used in the last switch of a case +func stmtFallthrough(env *Env) (Stmt, *Env) { + env.IP += 2 // +2 to skip the comparisons in next case, and jump directly to its body + return env.Code[env.IP], env +} + +func isFallthrough(node ast.Stmt) bool { + switch node := node.(type) { + case *ast.BranchStmt: + return node.Tok == token.FALLTHROUGH + default: + return false + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/switch2.go b/vendor/github.com/cosmos72/gomacro/fast/switch2.go new file mode 100644 index 0000000..b717b1b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/switch2.go @@ -0,0 +1,1045 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * switch2.go + * + * Created on May 06, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) switchGotoMap(tag *Expr, seen *caseHelper, ip int) { + if len(seen.GotoMap) <= 1 { + return + } + + var stmt Stmt + switch efun := tag.Fun.(type) { + case func(*Env) bool: + m := [2]int{-1, -1} + for k, v := range seen.GotoMap { + if r.ValueOf(k).Bool() { + m[1] = v.IP + } else { + m[0] = v.IP + } + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + var ip int + if val { + ip = m[1] + } else { + ip = m[0] + } + + if ip >= 0 { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + case func(*Env) int: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[int]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[int(r.ValueOf(k).Int())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) int8: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[int8]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[int8(r.ValueOf(k).Int())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) int16: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[int16]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[int16(r.ValueOf(k).Int())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) int32: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[int32]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[int32(r.ValueOf(k).Int())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) int64: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[int64]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[r.ValueOf(k).Int()] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uint: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uint]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[uint(r.ValueOf(k).Uint())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uint8: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uint8]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[uint8(r.ValueOf(k).Uint())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uint16: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uint16]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[uint16(r.ValueOf(k).Uint())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uint32: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uint32]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[uint32(r.ValueOf(k).Uint())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uint64: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uint64]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[r.ValueOf(k).Uint()] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) uintptr: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[uintptr]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[uintptr(r.ValueOf(k).Uint())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) float32: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[float32]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[float32(r.ValueOf(k).Float())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) float64: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[float64]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[r.ValueOf(k).Float()] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) complex64: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[complex64]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[complex64(r.ValueOf(k).Complex())] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) complex128: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[complex128]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[r.ValueOf(k).Complex()] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) string: + { + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + + m := make(map[string]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[r.ValueOf(k).String()] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + + case func(*Env) (r.Value, []r.Value): + m := make(map[interface{}]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[k] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + v, _ := efun(env) + if ip, ok := m[v.Interface()]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + default: + fun := tag.AsX1() + m := make(map[interface{}]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[k] = v.IP + } + + stmt = func(env *Env) (Stmt, *Env) { + val := fun(env).Interface() + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + if stmt == nil { + return + } + + c.Code.List[ip] = stmt +} +func (c *Comp) switchGotoSlice(tag *Expr, seen *caseHelper) Stmt { + var stmt Stmt + switch efun := tag.Fun.(type) { + case func(*Env) int: + { + var min, max int + for k := range seen.GotoMap { + key := int(r.ValueOf(k).Int()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := int(r.ValueOf(k).Int()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := int(r.ValueOf(k).Int()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) int8: + { + var min, max int8 + for k := range seen.GotoMap { + key := int8(r.ValueOf(k).Int()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := int8(r.ValueOf(k).Int()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := int8(r.ValueOf(k).Int()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) int16: + { + var min, max int16 + for k := range seen.GotoMap { + key := int16(r.ValueOf(k).Int()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := int16(r.ValueOf(k).Int()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := int16(r.ValueOf(k).Int()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) int32: + { + var min, max int32 + for k := range seen.GotoMap { + key := + int32(r.ValueOf(k).Int()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := int32(r.ValueOf(k).Int()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := int32(r.ValueOf(k).Int()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) int64: + { + var min, max int64 + for k := range seen.GotoMap { + key := r.ValueOf(k).Int() + min = key + max = key + break + } + for k := range seen.GotoMap { + key := r.ValueOf(k).Int() + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := r.ValueOf(k).Int() + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uint: + { + var min, max uint + for k := range seen.GotoMap { + key := + + uint(r.ValueOf(k).Uint()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := uint(r.ValueOf(k).Uint()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := uint(r.ValueOf(k).Uint()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uint8: + { + var min, max uint8 + for k := range seen.GotoMap { + key := + + uint8(r.ValueOf(k).Uint()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := uint8(r.ValueOf(k).Uint()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := uint8(r.ValueOf(k).Uint()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uint16: + { + var min, max uint16 + for k := range seen.GotoMap { + key := + + uint16(r.ValueOf(k).Uint()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := uint16(r.ValueOf(k).Uint()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := uint16(r.ValueOf(k).Uint()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uint32: + { + var min, max uint32 + for k := range seen.GotoMap { + key := + + uint32(r.ValueOf(k).Uint()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := uint32(r.ValueOf(k).Uint()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := uint32(r.ValueOf(k).Uint()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uint64: + { + var min, max uint64 + for k := range seen.GotoMap { + key := r.ValueOf(k).Uint() + min = key + max = key + break + } + for k := range seen.GotoMap { + key := r.ValueOf(k).Uint() + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := r.ValueOf(k).Uint() + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + case func(*Env) uintptr: + { + var min, max uintptr + for k := range seen.GotoMap { + key := + + uintptr(r.ValueOf(k).Uint()) + min = key + max = key + break + } + for k := range seen.GotoMap { + key := + + uintptr(r.ValueOf(k).Uint()) + if min > key { + min = key + } else if max < key { + max = key + } + + } + + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2-3) || int(halfrange_trunc) > len(seen.GotoMap) { + break + } + + fullrange := int(max-min) + 1 + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := uintptr(r.ValueOf(k).Uint()) + + slice[key-min] = v.IP + 1 + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val-min] + } + + if ip > 0 { + env.IP = ip - 1 + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + } + return stmt +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/switch2.gomacro b/vendor/github.com/cosmos72/gomacro/fast/switch2.gomacro new file mode 100644 index 0000000..5eb3178 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/switch2.gomacro @@ -0,0 +1,321 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * switch2.go + * + * Created on May 06, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "go/ast" + r "reflect" +) + + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + // keep the result wrapped in a reflect.Value + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro switchtag(typ ast.Node) ast.Node { + return ~"{ + var val ~,typ + cachefun = func(*Env) ~,typ { + return val + } + efun := efun.(func(*Env) ~,typ) + stmt = func(env *Env) (Stmt, *Env) { + val = efun(env) + env.IP++ + return env.Code[env.IP], env + } + } +} + +/* +// BUGGED: not thread-safe, do not use. +// compile a statement that evaluates e.Fun() once, +// and return an expression that returns cached e.Fun() result +func (c *Comp) switchTag(e *Expr) *Expr { + efun := e.Fun + var cachefun I + var stmt Stmt + switch e.Type.Kind() { + case r.Bool: {switchtag; bool} + case r.Int: {switchtag; int} + case r.Int8: {switchtag; int8} + case r.Int16: {switchtag; int16} + case r.Int32: {switchtag; int32} + case r.Int64: {switchtag; int64} + case r.Uint: {switchtag; uint} + case r.Uint8: {switchtag; uint8} + case r.Uint16: {switchtag; uint16} + case r.Uint32: {switchtag; uint32} + case r.Uint64: {switchtag; uint64} + case r.Uintptr: {switchtag; uintptr} + case r.Float32: {switchtag; float32} + case r.Float64: {switchtag; float64} + case r.Complex64: {switchtag; complex64} + case r.Complex128: {switchtag; complex128} + case r.String: {switchtag; string} + default: + val := xr.Zero(e.Type) + cachefun = func(*Env) r.Value { + return val + } + if efun, ok := efun.(func(*Env) (r.Value, []r.Value)); ok { + stmt = func(env *Env) (Stmt, *Env) { + val, _ = efun(env) + env.IP++ + return env.Code[env.IP], env + } + } else { + efun := e.AsX1() + stmt = func(env *Env) (Stmt, *Env) { + val = efun(env) + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(stmt) + return exprFun(e.Type, cachefun) +} +*/ + +:macro switch_goto_map(typ ast.Node) ast.Node { + conv := convertvalue1(typ, ~'{r.ValueOf(k)}) + return ~"{ + stmt = c.switchGotoSlice(tag, seen) + if stmt != nil { + break + } + m := make(map[~,typ]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[~,conv] = v.IP + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } +} + +:macro switch_goto_slice(typ ast.Node) ast.Node { + conv := convertvalue1(typ, ~'{r.ValueOf(k)}) + return ~"{ + var min, max ~,typ + for k := range seen.GotoMap { + key := ~,conv + min = key + max = key + break + } + for k := range seen.GotoMap { + key := ~,conv + if min > key { + min = key + } else if max < key { + max = key + } + } + // full range is max - min + 1, but may overflow (example: MaxInt - MinInt + 1) + // so divide by 2 before subtracting and do not add one + halfrange_trunc := max/2 - min/2 + if uint64(halfrange_trunc) >= uint64(MaxInt/2 - 3) || int(halfrange_trunc) > len(seen.GotoMap) { + // too sparse for a slice, or slice indexes would overflow int + break + } + fullrange := int(max - min) + 1 // cannot overflow, we just checked above + if fullrange < len(seen.GotoMap) { + c.Errorf("switchGotoSlice: internal error, allocated slice has len=%v: less than the %d cases", fullrange, len(seen.GotoMap)) + } + slice := make([]int, fullrange) + for k, v := range seen.GotoMap { + key := ~,conv + slice[key - min] = v.IP + 1 // we will subtract one later. useful to mark 0 as invalid. + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + ip := 0 + if val >= min && val <= max { + ip = slice[val - min] + } + if ip > 0 { + env.IP = ip - 1 // 0 means invalid + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } +} + +// try to optimize switch using a computed goto +func (c *Comp) switchGotoMap(tag *Expr, seen *caseHelper, ip int) { + if len(seen.GotoMap) <= 1 { + return + } + var stmt Stmt + switch efun := tag.Fun.(type) { + case func(*Env) bool: + m := [2]int{-1, -1} + for k, v := range seen.GotoMap { + if r.ValueOf(k).Bool() { + m[1] = v.IP + } else { + m[0] = v.IP + } + } + stmt = func(env *Env) (Stmt, *Env) { + val := efun(env) + var ip int + if val { + ip = m[1] + } else { + ip = m[0] + } + if ip >= 0 { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + case func(*Env) int: {switch_goto_map; int} + case func(*Env) int8: {switch_goto_map; int8} + case func(*Env) int16: {switch_goto_map; int16} + case func(*Env) int32: {switch_goto_map; int32} + case func(*Env) int64: {switch_goto_map; int64} + case func(*Env) uint: {switch_goto_map; uint} + case func(*Env) uint8: {switch_goto_map; uint8} + case func(*Env) uint16: {switch_goto_map; uint16} + case func(*Env) uint32: {switch_goto_map; uint32} + case func(*Env) uint64: {switch_goto_map; uint64} + case func(*Env) uintptr: {switch_goto_map; uintptr} + case func(*Env) float32: {switch_goto_map; float32} + case func(*Env) float64: {switch_goto_map; float64} + case func(*Env) complex64: {switch_goto_map; complex64} + case func(*Env) complex128: {switch_goto_map; complex128} + case func(*Env) string: {switch_goto_map; string} + case func(*Env) (r.Value, []r.Value): + m := make(map[interface{}]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[k] = v.IP + } + stmt = func(env *Env) (Stmt, *Env) { + v, _ := efun(env) + if ip, ok := m[v.Interface()]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + default: + fun := tag.AsX1() + m := make(map[interface{}]int, len(seen.GotoMap)) + for k, v := range seen.GotoMap { + m[k] = v.IP + } + stmt = func(env *Env) (Stmt, *Env) { + val := fun(env).Interface() + if ip, ok := m[val]; ok { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + } + if stmt == nil { + return + } + // replace the nop we reserved for this purpose + c.Code.List[ip] = stmt +} + +func (c *Comp) switchGotoSlice(tag *Expr, seen *caseHelper) Stmt { + var stmt Stmt + switch efun := tag.Fun.(type) { + case func(*Env) int: {switch_goto_slice; int} + case func(*Env) int8: {switch_goto_slice; int8} + case func(*Env) int16: {switch_goto_slice; int16} + case func(*Env) int32: {switch_goto_slice; int32} + case func(*Env) int64: {switch_goto_slice; int64} + case func(*Env) uint: {switch_goto_slice; uint} + case func(*Env) uint8: {switch_goto_slice; uint8} + case func(*Env) uint16: {switch_goto_slice; uint16} + case func(*Env) uint32: {switch_goto_slice; uint32} + case func(*Env) uint64: {switch_goto_slice; uint64} + case func(*Env) uintptr: {switch_goto_slice; uintptr} + } + return stmt +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/switch_type.go b/vendor/github.com/cosmos72/gomacro/fast/switch_type.go new file mode 100644 index 0000000..7aa1f44 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/switch_type.go @@ -0,0 +1,533 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * switch.go + * + * Created on May 06, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "fmt" + "go/ast" + "go/token" + "go/types" + r "reflect" + "sort" + "unsafe" + + "github.com/cosmos72/gomacro/typeutil" + xr "github.com/cosmos72/gomacro/xreflect" +) + +type typecaseEntry struct { + Type xr.Type + Pos token.Pos + IP int +} + +type typecaseHelper struct { + TypeMap typeutil.Map // map types.Type -> typecaseEntry + ConcreteMap typeutil.Map // only contains the initial segment of non-interface types + AllConcrete bool +} + +// keep track of types in type-switch. error on duplicates +func (seen *typecaseHelper) add(c *Comp, t xr.Type, entry typecaseEntry) { + var gtype types.Type + if t != nil { + gtype = t.GoType() + } + prev := seen.TypeMap.At(gtype) + if prev != nil { + c.Errorf("duplicate case <%v> in switch\n\tprevious case at %s", t, c.Fileset.Position(prev.(typecaseEntry).Pos)) + return + } + entry.Type = t + seen.TypeMap.Set(gtype, entry) + if t.Kind() == r.Interface { + seen.AllConcrete = false + } else if seen.AllConcrete { + seen.ConcreteMap.Set(gtype, entry) + } +} + +/* +func (c *Comp) TypeSwitch(node *ast.TypeSwitchStmt, labels []string) { + c.Errorf("unimplemented statement: %v <%v>", node, r.TypeOf(node)) +} +*/ + +func (c *Comp) TypeSwitch(node *ast.TypeSwitchStmt, labels []string) { + initLocals := false + var initBinds [2]int + // TypeSwitch always allocates at least a bind "" in typeswitchTag() + c, initLocals = c.pushEnvIfFlag(&initBinds, true) + if node.Init != nil { + c.Stmt(node.Init) + } + var ibreak int + sort.Strings(labels) + c.Loop = &LoopInfo{ + Break: &ibreak, + ThisLabels: labels, + } + + tagnode, varname := c.typeswitchNode(node.Assign) + tagexpr := c.Expr1(tagnode) + if tagexpr.Type.Kind() != r.Interface { + c.Errorf("cannot type switch on non-interface type <%v>: %v", tagexpr.Type, tagnode) + } + if tagexpr.Const() { + c.Warnf("type switch on constant!? %v = %v <%v>", tagnode, tagexpr.Value, tagexpr.Type) + } + // just like Comp.Switch, we cannot invoke tagexpr.Fun() multiple times because + // side effects must be applied only once! + // typeswitchTag saves the result of tagexpr.Fun() in a runtime bind + // and returns the bind + bind := c.typeswitchTag(tagexpr) + + if node.Body != nil { + // reserve a code slot for typeSwitchGotoMap optimizer + ipswitchgoto := c.Code.Len() + seen := &typecaseHelper{AllConcrete: true} // keeps track of types in cases. errors on duplicates + c.Append(stmtNop, node.Body.Pos()) + + list := node.Body.List + defaulti := -1 + var defaultpos token.Pos + for _, stmt := range list { + c.Pos = stmt.Pos() + switch clause := stmt.(type) { + case *ast.CaseClause: + if clause.List == nil { + if defaulti >= 0 { + c.Errorf("multiple defaults in switch (first at %s)", c.Fileset.Position(defaultpos)) + } + defaulti = c.Code.Len() + defaultpos = clause.Pos() + c.typeswitchDefault(clause, varname, bind) + } else { + c.typeswitchCase(clause, varname, bind, seen) + } + default: + c.Errorf("invalid statement inside switch: expecting case or default, found: %v <%v>", stmt, r.TypeOf(stmt)) + } + } + // default is executed as last, if no other case matches + if defaulti >= 0 { + // +1 to skip its "never matches" header + c.Append(func(env *Env) (Stmt, *Env) { + ip := defaulti + 1 + env.IP = ip + return env.Code[ip], env + }, defaultpos) + } + // try to optimize + c.typeswitchGotoMap(bind, seen, ipswitchgoto) + } + // we finally know this + ibreak = c.Code.Len() + + c = c.popEnvIfLocalBinds(initLocals, &initBinds, node.Init, node.Assign) +} + +// typeswitchNode returns the expression to type-switch on. +// if such expression is used to declare a variable, the variable name is returned too +func (c *Comp) typeswitchNode(stmt ast.Stmt) (ast.Expr, string) { + var varname string // empty, or name of variable in 'switch varname := expression.(type)' + var tagnode ast.Expr + switch stmt := stmt.(type) { + case *ast.AssignStmt: + if len(stmt.Lhs) == 1 && len(stmt.Rhs) == 1 && stmt.Tok == token.DEFINE { + if lhs, ok := stmt.Lhs[0].(*ast.Ident); ok { + varname = lhs.Name + tagnode = stmt.Rhs[0] + } + } + case *ast.ExprStmt: + tagnode = stmt.X + } + + for { + switch e := tagnode.(type) { + case *ast.ParenExpr: + tagnode = e.X + continue + case *ast.TypeAssertExpr: + if e.Type != nil { + c.Errorf("invalid type switch: expecting '.(type)', found type assertion: %v", stmt) + } + tagnode = e.X + default: + tagnode = e + } + break + } + if tagnode == nil { + c.Errorf("expected type-switch expression, found: %v", stmt) + } + return tagnode, varname +} + +// typeswitchTag takes the expression immediately following a type-switch, +// compiles it to a statement that evaluates it and saves its result and its type +// in two runtime bindings (interpreter local variables), +// finally returns another expression that retrieves the expression value +// with its concrete type +func (c *Comp) typeswitchTag(e *Expr) *Bind { + bind := c.AddBind("", VarBind, e.Type) // e.Type must be an interface type... + + // c.Debugf("typeswitchTag: allocated bind %v", bind) + switch bind.Desc.Class() { + case VarBind: + // cannot use c.DeclVar0 because the variable is declared in o + // cannot use o.DeclVar0 because the initializer must be evaluated in c + // so initialize the binding manually + index := bind.Desc.Index() + init := e.AsX1() + c.append(func(env *Env) (Stmt, *Env) { + v := r.ValueOf(init(env).Interface()) // extract concrete type + // Debugf("typeswitchTag = %v <%v>", v, ValueType(v)) + // no need to create a settable reflect.Value + env.Binds[index] = v + env.IP++ + return env.Code[env.IP], env + }) + default: + c.Errorf("internal error! Comp.AddBind(name=%q, class=VarBind, type=%v) returned class=%v, expecting VarBind", + "", bind.Type, bind.Desc.Class()) + return nil + } + return bind +} + +// typeswitchGotoMap tries to optimize the dispatching of a type-switch +func (c *Comp) typeswitchGotoMap(bind *Bind, seen *typecaseHelper, ip int) { + if seen.ConcreteMap.Len() <= 1 { + return + } + m := make(map[r.Type]int) // FIXME this breaks on types declared in the interpreter + seen.ConcreteMap.Iterate(func(k types.Type, v interface{}) { + entry := v.(typecaseEntry) + m[entry.Type.ReflectType()] = entry.IP + }) + idx := bind.Desc.Index() + + stmt := func(env *Env) (Stmt, *Env) { + // FIXME this breaks on types declared in the interpreter + var rtype r.Type + if v := env.Binds[idx]; v.IsValid() { + rtype = v.Type() // concrete reflect.Type already extracted by typeswitchTag + } + if ip, found := m[rtype]; found { + env.IP = ip + } else { + env.IP++ + } + return env.Code[env.IP], env + } + c.Code.List[ip] = stmt +} + +// typeswitchCase compiles a case in a type-switch. +func (c *Comp) typeswitchCase(node *ast.CaseClause, varname string, bind *Bind, seen *typecaseHelper) { + + ibody := c.Code.Len() + 1 // body will start here + ts := make([]xr.Type, len(node.List)) + rtypes := make([]r.Type, len(node.List)) + + // compile a comparison of tag against each type + for i, enode := range node.List { + t := c.compileTypeOrNil(enode) + if t != nil { + rtypes[i] = t.ReflectType() + if t.Kind() != r.Interface && !t.Implements(bind.Type) { + c.Errorf("impossible typeswitch case: <%v> does not implement <%v>", t, bind.Type) + } + } + ts[i] = t + seen.add(c, t, typecaseEntry{Pos: enode.Pos(), IP: ibody}) + } + // compile like "if r.TypeOf(bind) == t1 || r.TypeOf(bind) == t2 ... { }" + // and keep track of where to jump if no expression matches + // + // always occupy a Code slot for type comparison, even if nothing to do. + // reason: typeswitchGotoMap optimizer skips such slot and jumps to current body + var iend int + var stmt Stmt + idx := bind.Desc.Index() + switch len(node.List) { + case 0: + // compile anyway. reachable? + stmt = func(env *Env) (Stmt, *Env) { + // Debugf("typeswitchCase: comparing %v against zero types", tagfun(env)) + ip := iend + env.IP = ip + return env.Code[ip], env + } + case 1: + t := ts[0] + rtype := rtypes[0] + if t == nil { + stmt = func(env *Env) (Stmt, *Env) { + v := env.Binds[idx] + // Debugf("typeswitchCase: comparing %v <%v> against nil type", v, ValueType(v)) + var ip int + if !v.IsValid() { + ip = env.IP + 1 + } else { + ip = iend + } + env.IP = ip + return env.Code[ip], env + } + } else if t.Kind() == r.Interface { + stmt = func(env *Env) (Stmt, *Env) { + v := env.Binds[idx] + // Debugf("typeswitchCase: comparing %v <%v> against interface type %v", v, ValueType(v), rtype) + var ip int + if v.IsValid() && v.Type().Implements(rtype) { + ip = env.IP + 1 + } else { + ip = iend + } + env.IP = ip + return env.Code[ip], env + } + } else { + stmt = func(env *Env) (Stmt, *Env) { + v := env.Binds[idx] + // Debugf("typeswitchCase: comparing %v <%v> against concrete type %v", v, ValueType(v), rtype) + var ip int + if v.IsValid() && v.Type() == rtype { + ip = env.IP + 1 + } else { + ip = iend + } + env.IP = ip + return env.Code[ip], env + } + } + default: + stmt = func(env *Env) (Stmt, *Env) { + v := env.Binds[idx] + var vt r.Type + if v.IsValid() { + vt = v.Type() + } + // Debugf("typeswitchCase: comparing %v <%v> against types %v", v, vt, rtypes) + ip := iend + for _, rtype := range rtypes { + switch { + case vt == rtype: + case rtype != nil: + if rtype.Kind() != r.Interface || !vt.Implements(rtype) { + continue + } + default: // rtype == nil + if v.IsValid() { + continue + } + } + // Debugf("typeswitchCase: v <%v> matches type %v", v, vt, rtype) + ip = env.IP + 1 + break + } + env.IP = ip + return env.Code[ip], env + } + } + c.Pos = node.Pos() + c.append(stmt) + var t xr.Type + if len(ts) == 1 { + t = ts[0] + } + c.typeswitchBody(node.Body, varname, t, bind) + // we finally know where to jump if match fails + iend = c.Code.Len() +} + +// typeswitchDefault compiles the default case in a type-switch. +func (c *Comp) typeswitchDefault(node *ast.CaseClause, varname string, bind *Bind) { + var iend int + stmt := func(env *Env) (Stmt, *Env) { + // Debugf("typeswitchDefault: default entered normally, skipping it") + ip := iend + env.IP = ip + return env.Code[ip], env + } + c.Pos = node.Pos() + c.append(stmt) + c.typeswitchBody(node.Body, varname, nil, bind) + iend = c.Code.Len() +} + +// typeswitchBody compiles the body of a case in a type-switch. +func (c *Comp) typeswitchBody(list []ast.Stmt, varname string, t xr.Type, bind *Bind) { + list1 := list + if list1 == nil { + list1 = []ast.Stmt{nil} + } + declvar := varname != "" && varname != "_" + locals := declvar || containLocalBinds(list1...) + var nbinds [2]int + + c2, locals2 := c.pushEnvIfFlag(&nbinds, locals || c.IsCompiled()) + if declvar { + sym := bind.AsSymbol(c2.UpCost) + if t == nil { + t = sym.Type + } + // cannot simply use sym as varname initializer: it returns the wrong type + c2.typeswitchVar(varname, t, sym) + } + for _, stmt := range list { + c2.Stmt(stmt) + } + c2.jumpOut(c2.UpCost, c.Loop.Break) + c2.popEnvIfLocalBinds(locals2, &nbinds, list1...) +} + +// typeswitchVar compiles the tag variable declaration in a type-switch. +func (c *Comp) typeswitchVar(varname string, t xr.Type, sym *Symbol) { + c.ErrorIfCompiled(fmt.Sprintf("switch %s.(type)", varname)) + + sidx := sym.Bind.Desc.Index() + + bind := c.AddBind(varname, VarBind, t) + idx := bind.Desc.Index() + + if sym.Upn != 1 { + c.Errorf("typeswitchVar: impossible sym.Upn = %v", sym.Upn) + } + var stmt Stmt + switch t.Kind() { + case r.Bool: + stmt = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env.IntBinds[idx])) = env.Outer.Binds[sidx].Bool() + env.IP++ + return env.Code[env.IP], env + } + case r.Int: + stmt = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[idx])) = int(env.Outer.Binds[sidx].Int()) + env.IP++ + return env.Code[env.IP], env + } + case r.Int8: + stmt = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[idx])) = int8(env.Outer.Binds[sidx].Int()) + env.IP++ + return env.Code[env.IP], env + } + case r.Int16: + stmt = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[idx])) = int16(env.Outer.Binds[sidx].Int()) + env.IP++ + return env.Code[env.IP], env + } + case r.Int32: + stmt = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[idx])) = int32(env.Outer.Binds[sidx].Int()) + env.IP++ + return env.Code[env.IP], env + } + case r.Int64: + stmt = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[idx])) = int64(env.Outer.Binds[sidx].Int()) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint: + stmt = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[idx])) = uint(env.Outer.Binds[sidx].Uint()) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint8: + stmt = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[idx])) = uint8(env.Outer.Binds[sidx].Uint()) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint16: + stmt = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[idx])) = uint16(env.Outer.Binds[sidx].Uint()) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint32: + stmt = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[idx])) = uint32(env.Outer.Binds[sidx].Uint()) + env.IP++ + return env.Code[env.IP], env + } + case r.Uint64: + stmt = func(env *Env) (Stmt, *Env) { + env.IntBinds[idx] = env.Outer.Binds[sidx].Uint() + env.IP++ + return env.Code[env.IP], env + } + case r.Uintptr: + stmt = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[idx])) = uintptr(env.Outer.Binds[sidx].Uint()) + env.IP++ + return env.Code[env.IP], env + } + case r.Float32: + stmt = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[idx])) = float32(env.Outer.Binds[sidx].Float()) + env.IP++ + return env.Code[env.IP], env + } + case r.Float64: + stmt = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[idx])) = env.Outer.Binds[sidx].Float() + env.IP++ + return env.Code[env.IP], env + } + case r.Complex64: + stmt = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[idx])) = complex64(env.Outer.Binds[sidx].Complex()) + env.IP++ + return env.Code[env.IP], env + } + default: + rtype := t.ReflectType() + zero := r.Zero(rtype) + stmt = func(env *Env) (Stmt, *Env) { + v := env.Outer.Binds[sidx] + place := r.New(rtype).Elem() + if !v.IsValid() { + v = zero + } else if v.Type() != rtype { + v = v.Convert(rtype) + } + place.Set(v) + env.Binds[idx] = place + env.IP++ + return env.Code[env.IP], env + } + } + c.append(stmt) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/type.go b/vendor/github.com/cosmos72/gomacro/fast/type.go new file mode 100644 index 0000000..f01c402 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/type.go @@ -0,0 +1,796 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * type.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "fmt" + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// DeclType compiles a type declaration. +func (c *Comp) DeclType(node ast.Spec) { + switch node := node.(type) { + case *ast.TypeSpec: + name := node.Name.Name + // PATCH: support type aliases + if unary, ok := node.Type.(*ast.UnaryExpr); ok && unary.Op == token.ASSIGN { + t := c.Type(unary.X) + c.DeclTypeAlias(name, t) + break + } + // support self-referencing types, as for example: type List struct { First int; Rest *List } + oldt := c.Types[name] + panicking := true + defer func() { + // On compile error, restore pre-existing declaration + if !panicking || c.Types == nil { + // nothing to do + } else if oldt != nil { + c.Types[name] = oldt + } else { + delete(c.Types, name) + } + }() + t := c.DeclNamedType(name) + u := c.Type(node.Type) + if t != nil { // t == nil means name == "_", discard the result of type declaration + c.SetUnderlyingType(t, u) + } + panicking = false + default: + c.Errorf("Compile: unexpected type declaration, expecting <*ast.TypeSpec>, found: %v <%v>", node, r.TypeOf(node)) + } +} + +// DeclTypeAlias compiles a typealias declaration, i.e. type Foo = /*...*/ +// Returns the second argument. +func (c *Comp) DeclTypeAlias(name string, t xr.Type) xr.Type { + if name == "_" { + return t + } + if _, ok := c.Types[name]; ok { + c.Warnf("redefined type alias: %v", name) + c.Universe.InvalidateCache() + } else if c.Types == nil { + c.Types = make(map[string]xr.Type) + } + c.Types[name] = t + return t +} + +// DeclNamedType executes a named type forward declaration. +// Returns nil if name == "_" +// Otherwise it must be followed by Comp.SetUnderlyingType() +func (c *Comp) DeclNamedType(name string) xr.Type { + if name == "_" { + return nil + } + if t, ok := c.Types[name]; ok { + c.Warnf("redefined type: %v", name) + if xr.QName1(t) != xr.QName2(name, c.FileComp().Path) { + // the current type "name" is an alias, discard it + c.Universe.InvalidateCache() + } else { + // reuse t, change only its underlying type + return t + } + } else if c.Types == nil { + c.Types = make(map[string]xr.Type) + } + t := c.Universe.NamedOf(name, c.FileComp().Path) + c.Types[name] = t + return t +} + +func (c *Comp) SetUnderlyingType(t, underlying xr.Type) { + t.SetUnderlying(underlying) +} + +// DeclType0 declares a type +// in Go, types are computed only at compile time - no need for a runtime *Env +func (c *Comp) DeclType0(t xr.Type) xr.Type { + if t == nil { + return nil + } + return c.DeclTypeAlias0(t.Name(), t) +} + +// DeclTypeAlias0 declares a type alias +// in Go, types are computed only at compile time - no need for a runtime *Env +func (c *Comp) DeclTypeAlias0(alias string, t xr.Type) xr.Type { + if alias == "" || alias == "_" { + // never define bindings for "_" + return t + } + if _, ok := c.Types[alias]; ok { + c.Warnf("redefined type: %v", alias) + } else if c.Types == nil { + c.Types = make(map[string]xr.Type) + } + c.Types[alias] = t + return t +} + +// Type compiles a type expression. +func (c *Comp) Type(node ast.Expr) xr.Type { + t, _ := c.compileType2(node, false) + return t +} + +// compileTypeOrNil compiles a type expression. as a special case used by type switch, compiles *ast.Ident{Name:"nil"} to nil +func (c *Comp) compileTypeOrNil(node ast.Expr) xr.Type { + for { + switch expr := node.(type) { + case *ast.ParenExpr: + node = expr.X + continue + case *ast.Ident: + if expr.Name == "nil" { + sym := c.TryResolve(expr.Name) + if sym != nil && sym.Type == nil { + return nil + } + } + } + break + } + t, _ := c.compileType2(node, false) + return t +} + +// compileType2 compiles a type expression. +// if allowEllipsis is true, it supports the special case &ast.Ellipsis{/*expression*/} +// that represents ellipsis in the last argument of a function declaration. +// The second return value is true both in the case above, and for array types whose length is [...] +func (c *Comp) compileType2(node ast.Expr, allowEllipsis bool) (t xr.Type, ellipsis bool) { + stars := 0 + for { + switch expr := node.(type) { + case *ast.StarExpr: + stars++ + node = expr.X + continue + case *ast.ParenExpr: + node = expr.X + continue + case *ast.Ellipsis: + if allowEllipsis { + node = expr.Elt + ellipsis = true + continue + } + } + break + } + if node != nil { + c.Pos = node.Pos() + } + universe := c.Universe + var ellipsisArray bool + + switch node := node.(type) { + case *ast.ArrayType: // also for slices + t, ellipsisArray = c.TypeArray(node) + case *ast.ChanType: + telem := c.Type(node.Value) + dir := r.BothDir + if node.Dir == ast.SEND { + dir = r.SendDir + } else if node.Dir == ast.RECV { + dir = r.RecvDir + } + t = universe.ChanOf(dir, telem) + case *ast.FuncType: + t, _, _ = c.TypeFunction(node) + case *ast.Ident: + t = c.TypeIdent(node.Name) + case *ast.InterfaceType: + t = c.TypeInterface(node) + case *ast.MapType: + kt := c.Type(node.Key) + vt := c.Type(node.Value) + t = universe.MapOf(kt, vt) + case *ast.SelectorExpr: + ident, ok := node.X.(*ast.Ident) + if !ok { + c.Errorf("invalid qualified type, expecting packagename.identifier, found: %v <%v>", node, r.TypeOf(node)) + } + // this could be Package.Type, or other non-type expressions: Type.Method, Value.Method, Struct.Field... + // check for Package.Type + name := ident.Name + var bind *Bind + for o := c; o != nil; o = o.Outer { + if bind = o.Binds[name]; bind != nil { + break + } + } + if bind == nil { + c.Errorf("undefined %q in %v <%v>", name, node, r.TypeOf(node)) + } else if !bind.Const() || bind.Type.ReflectType() != rtypeOfImport { + c.Errorf("not a package: %q in %v <%v>", name, node, r.TypeOf(node)) + } + imp, ok := bind.Value.(Import) + if !ok { + c.Errorf("not a package: %q in %v <%v>", name, node, r.TypeOf(node)) + } + name = node.Sel.Name + t, ok = imp.Types[name] + if !ok || t == nil { + c.Errorf("not a type: %v <%v>", node, r.TypeOf(node)) + } + if !ast.IsExported(name) { + c.Errorf("cannot refer to unexported name %v", node) + } + case *ast.StructType: + // c.Debugf("evalType() struct declaration: %v <%v>", node, r.TypeOf(node)) + types, names := c.TypeFields(node.Fields) + // c.Debugf("evalType() struct names and types: %v %v", types, names) + pkg := universe.LoadPackage(c.FileComp().Path) + fields := c.makeStructFields(pkg, names, types) + // c.Debugf("compileType2() declaring struct type. fields=%#v", fields) + t = universe.StructOf(fields) + case nil: + // type can be omitted in many case - then we must perform type inference + break + default: + // TODO which types are still missing? + c.Errorf("unimplemented type: %v <%v>", node, r.TypeOf(node)) + } + if t != nil { + for i := 0; i < stars; i++ { + t = universe.PtrTo(t) + } + if allowEllipsis && ellipsis { + // ellipsis in the last argument of a function declaration + t = universe.SliceOf(t) + } + } + return t, ellipsis || ellipsisArray +} + +func (c *Comp) TypeArray(node *ast.ArrayType) (t xr.Type, ellipsis bool) { + universe := c.Universe + t = c.Type(node.Elt) + n := node.Len + switch n := n.(type) { + case *ast.Ellipsis: + t = universe.ArrayOf(0, t) + ellipsis = true + case nil: + t = universe.SliceOf(t) + default: + // as stated by https://golang.org/ref/spec#Array_types + // "The length is part of the array's type; it must evaluate to a non-negative constant + // representable by a value of type int. " + var count int + init := c.Expr(n) + if !init.Const() { + c.Errorf("array length is not a constant: %v", node) + return + } else if init.Untyped() { + count = init.ConstTo(c.TypeOfInt()).(int) + } else { + count = convertLiteralCheckOverflow(init.Value, c.TypeOfInt()).(int) + } + if count < 0 { + c.Errorf("array length [%v] is negative: %v", count, node) + } + t = universe.ArrayOf(count, t) + } + return t, ellipsis +} + +func (c *Comp) TypeFunction(node *ast.FuncType) (t xr.Type, paramNames []string, resultNames []string) { + return c.TypeFunctionOrMethod(nil, node) +} + +// TypeFunctionOrMethod compiles a function type corresponding to given receiver and function declaration +// If receiver is not null, the returned tFunc will have it as receiver. +func (c *Comp) TypeFunctionOrMethod(recv *ast.Field, node *ast.FuncType) (t xr.Type, paramNames []string, resultNames []string) { + paramTypes, paramNames, variadic := c.typeFieldOrParamList(node.Params, true) + resultTypes, resultNames := c.TypeFields(node.Results) + + var recvType xr.Type + if recv != nil { + // methods are functions with receiver. xreflect allows functions to be treated as methods + // (using the first parameter as receiver), but go/types.Type loaded by go/importer.Default() + // will have methods as functions with receivers. + // + // So be uniform with those. + // + // Alas, go/types.Type.String() does *not* print the receiver, making it cumbersome to debug. + recvTypes, recvNames, _ := c.typeFieldsOrParams([]*ast.Field{recv}, false) + recvType = recvTypes[0] + + // anyway, return the receiver *name* as first element of paramNames + paramNames = append(recvNames, paramNames...) + } + t = c.Universe.MethodOf(recvType, paramTypes, resultTypes, variadic) + return t, paramNames, resultNames +} + +func (c *Comp) TypeFields(fields *ast.FieldList) (types []xr.Type, names []string) { + types, names, _ = c.typeFieldOrParamList(fields, false) + return types, names +} + +func (c *Comp) typeFieldOrParamList(fields *ast.FieldList, allowEllipsis bool) (types []xr.Type, names []string, ellipsis bool) { + var list []*ast.Field + if fields != nil { + list = fields.List + } + return c.typeFieldsOrParams(list, allowEllipsis) +} + +func (c *Comp) typeFieldsOrParams(list []*ast.Field, allowEllipsis bool) (types []xr.Type, names []string, ellipsis bool) { + types = make([]xr.Type, 0) + names = ZeroStrings + n := len(list) + if n == 0 { + return types, names, ellipsis + } + var t xr.Type + for i, f := range list { + t, ellipsis = c.compileType2(f.Type, i == n-1) + if len(f.Names) == 0 { + types = append(types, t) + names = append(names, "") + // c.Debugf("evalTypeFields() %v -> %v", f.Type, t) + } else { + for _, ident := range f.Names { + types = append(types, t) + names = append(names, ident.Name) + // Debugf("evalTypeFields() %v %v -> %v", ident.Name, f.Type, t) + } + } + } + return types, names, ellipsis +} + +func (c *Comp) TypeIdent(name string) xr.Type { + for co := c; co != nil; co = co.Outer { + if t, ok := co.Types[name]; ok { + return t + } + } + c.Errorf("undefined identifier: %v", name) + return nil +} + +func (c *Comp) makeStructFields(pkg *xr.Package, names []string, types []xr.Type) []xr.StructField { + // pkgIdentifier := sanitizeIdentifier(pkgPath) + fields := make([]xr.StructField, len(names)) + for i, name := range names { + t := types[i] + fields[i] = xr.StructField{ + Name: name, + Pkg: pkg, + Type: t, + Tag: "", + Anonymous: len(name) == 0, + } + } + return fields +} + +// TypeAssert2 compiles a multi-valued type assertion +func (c *Comp) TypeAssert2(node *ast.TypeAssertExpr) *Expr { + val := c.Expr1(node.X) + tin := val.Type + tout := c.Type(node.Type) + rtout := tout.ReflectType() + if tin == nil || tin.Kind() != r.Interface { + c.Errorf("invalid type assertion: %v (non-interface type <%v> on left)", node, tin) + return nil + } + kin := tin.Kind() + kout := tout.Kind() + if kout != r.Interface && !tout.Implements(tin) { + c.Errorf("impossible type assertion: <%v> does not implement <%v>", tout, tin) + } + fun := val.Fun.(func(*Env) r.Value) // val returns an interface... must be already wrapped in a reflect.Value + fail := []r.Value{xr.Zero(tout), False} // returned by type assertion in case of failure + + var ret func(env *Env) (r.Value, []r.Value) + + if IsOptimizedKind(kout) { + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env) + v = r.ValueOf(v.Interface()) // rebuild reflect.Value with concrete type + if v.Type() != rtout { + return fail[0], fail + } + return v, []r.Value{v, True} + } + } else if tout.ReflectType() == TypeOfInterface { + // special case, nil is a valid interface{} + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env).Convert(TypeOfInterface) + return v, []r.Value{v, True} + } + } else if kout == r.Interface && tin.Implements(tout) { + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env) + // nil is not a valid tout, check for it. + // IsNil() can be invoked only on nillable types... + // but v.Type().Kind() should be r.Interface, which is nillable :) + if v.IsNil() { + return fail[0], fail + } + v = v.Convert(rtout) + return v, []r.Value{v, True} + } + } else if kout == r.Interface { + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env) + // nil is not a valid tout, check for it. + // IsNil() can be invoked only on nillable types... + // but v.Type().Kind() should be r.Interface, which is nillable :) + if v.IsNil() { + return fail[0], fail + } + v = r.ValueOf(v.Interface()) // rebuild reflect.Value with concrete type + rtconcr := v.Type() + if rtconcr != rtout && !rtconcr.Implements(rtout) { + return fail[0], fail + } + v = v.Convert(rtout) + return v, []r.Value{v, True} + } + } else if IsNillableKind(kin) { + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env) + // nil is not a valid tout, check for it. + // IsNil() can be invoked only on nillable types... + // but we just checked IsNillableKind(kin) + if v.IsNil() { + return fail[0], fail + } + v = r.ValueOf(v.Interface()) // rebuild reflect.Value with concrete type + rtconcr := v.Type() + if rtconcr != rtout { + return fail[0], fail + } + return v, []r.Value{v, True} + } + } else { + ret = func(env *Env) (r.Value, []r.Value) { + v := fun(env) + v = r.ValueOf(v.Interface()) // rebuild reflect.Value with concrete type + rtconcr := v.Type() + if rtconcr != rtout { + return fail[0], fail + } + return v, []r.Value{v, True} + } + } + return exprXV([]xr.Type{tout, c.TypeOfBool()}, ret) +} + +// TypeAssert1 compiles a single-valued type assertion +func (c *Comp) TypeAssert1(node *ast.TypeAssertExpr) *Expr { + if node.Type == nil { + c.Errorf("invalid type assertion: expecting actual type, found type switch: %v", node) + } + val := c.Expr1(node.X) + tin := val.Type + tout := c.Type(node.Type) + kout := tout.Kind() + if tin == nil || tin.Kind() != r.Interface { + c.Errorf("invalid type assertion: %v (non-interface type <%v> on left)", node, tin) + return nil + } + if tout.Kind() != r.Interface && !tout.Implements(tin) { + c.Errorf("impossible type assertion: <%v> does not implement <%v>", tout, tin) + } + fun := val.Fun.(func(*Env) r.Value) // val returns an interface... must be already wrapped in a reflect.Value + rtin := tin.ReflectType() + rtout := tout.ReflectType() + var ret I + switch kout { + case r.Bool: + ret = func(env *Env) bool { + v := typeassert(fun(env), rtin, rtout) + return v.Bool() + } + case r.Int: + ret = func(env *Env) int { + v := typeassert(fun(env), rtin, rtout) + return int(v.Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + v := typeassert(fun(env), rtin, rtout) + return int8(v.Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + v := typeassert(fun(env), rtin, rtout) + return int16(v.Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + v := typeassert(fun(env), rtin, rtout) + return int32(v.Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + v := typeassert(fun(env), rtin, rtout) + return v.Int() + } + case r.Uint: + ret = func(env *Env) uint { + v := typeassert(fun(env), rtin, rtout) + return uint(v.Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + v := typeassert(fun(env), rtin, rtout) + return uint8(v.Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + v := typeassert(fun(env), rtin, rtout) + return uint16(v.Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + v := typeassert(fun(env), rtin, rtout) + return uint32(v.Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + v := typeassert(fun(env), rtin, rtout) + return v.Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + v := typeassert(fun(env), rtin, rtout) + return uintptr(v.Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + v := typeassert(fun(env), rtin, rtout) + return float32(v.Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + v := typeassert(fun(env), rtin, rtout) + return v.Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + v := typeassert(fun(env), rtin, rtout) + return complex64(v.Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + v := typeassert(fun(env), rtin, rtout) + return v.Convert(rtout).Complex() + } + case r.String: + ret = func(env *Env) string { + v := typeassert(fun(env), rtin, rtout) + return v.String() + } + default: + if tout.ReflectType() == TypeOfInterface { + // special case, nil is a valid interface{} + ret = func(env *Env) r.Value { + return fun(env).Convert(TypeOfInterface) + } + break + } + if tout.Kind() == r.Interface && tin.Implements(tout) { + ret = func(env *Env) r.Value { + v := fun(env) + // nil is not a valid tout, check for it. + // IsNil() can be invoked only on nillable types... + // but v.Type().Kind() should be r.Interface, which is nillable :) + if v.IsNil() { + panic(&TypeAssertionError{ + Interface: rtin, + Concrete: nil, + Asserted: rtout, + }) + } + return v.Convert(rtout) + } + break + } + ret = func(env *Env) r.Value { + v := fun(env) + // nil is not a valid tout, check for it. + // IsNil() can be invoked only on nillable types... + // but v.Type().Kind() should be r.Interface, which is nillable :) + if v.IsNil() { + panic(&TypeAssertionError{ + Interface: rtin, + Concrete: nil, + Asserted: rtout, + }) + } + v = r.ValueOf(v.Interface()) // rebuild reflect.Value with concrete type + rtconcr := v.Type() + if rtconcr != rtout && (rtout.Kind() != r.Interface || !rtconcr.Implements(rtout)) { + panic(&TypeAssertionError{ + Interface: rtin, + Concrete: rtconcr, + Asserted: rtout, + }) + } + return v.Convert(rtout) + } + } + return exprFun(tout, ret) +} + +func typeassert(v r.Value, rtin r.Type, rtout r.Type) r.Value { + v = r.ValueOf(v.Interface()) // extract concrete type + rtconcr := v.Type() + if rtconcr != rtout { + panic(&TypeAssertionError{ + Interface: rtin, + Concrete: rtconcr, + Asserted: rtout, + }) + } + return v +} + +func (g *CompThreadGlobals) TypeOfBool() xr.Type { + return g.Universe.BasicTypes[r.Bool] +} + +func (g *CompThreadGlobals) TypeOfInt() xr.Type { + return g.Universe.BasicTypes[r.Int] +} + +func (g *CompThreadGlobals) TypeOfInt8() xr.Type { + return g.Universe.BasicTypes[r.Int8] +} + +func (g *CompThreadGlobals) TypeOfInt16() xr.Type { + return g.Universe.BasicTypes[r.Int16] +} + +func (g *CompThreadGlobals) TypeOfInt32() xr.Type { + return g.Universe.BasicTypes[r.Int32] +} + +func (g *CompThreadGlobals) TypeOfInt64() xr.Type { + return g.Universe.BasicTypes[r.Int64] +} + +func (g *CompThreadGlobals) TypeOfUint() xr.Type { + return g.Universe.BasicTypes[r.Uint] +} + +func (g *CompThreadGlobals) TypeOfUint8() xr.Type { + return g.Universe.BasicTypes[r.Uint8] +} + +func (g *CompThreadGlobals) TypeOfUint16() xr.Type { + return g.Universe.BasicTypes[r.Uint16] +} + +func (g *CompThreadGlobals) TypeOfUint32() xr.Type { + return g.Universe.BasicTypes[r.Uint32] +} + +func (g *CompThreadGlobals) TypeOfUint64() xr.Type { + return g.Universe.BasicTypes[r.Uint64] +} + +func (g *CompThreadGlobals) TypeOfUintptr() xr.Type { + return g.Universe.BasicTypes[r.Uintptr] +} + +func (g *CompThreadGlobals) TypeOfFloat32() xr.Type { + return g.Universe.BasicTypes[r.Float32] +} + +func (g *CompThreadGlobals) TypeOfFloat64() xr.Type { + return g.Universe.BasicTypes[r.Float64] +} + +func (g *CompThreadGlobals) TypeOfComplex64() xr.Type { + return g.Universe.BasicTypes[r.Complex64] +} + +func (g *CompThreadGlobals) TypeOfComplex128() xr.Type { + return g.Universe.BasicTypes[r.Complex128] +} + +func (g *CompThreadGlobals) TypeOfString() xr.Type { + return g.Universe.BasicTypes[r.String] +} + +func (g *CompThreadGlobals) TypeOfError() xr.Type { + return g.Universe.TypeOfError +} + +func (g *CompThreadGlobals) TypeOfInterface() xr.Type { + return g.Universe.TypeOfInterface +} + +var ( + rtypeOfBuiltin = r.TypeOf(Builtin{}) + rtypeOfFunction = r.TypeOf(Function{}) + rtypeOfImport = r.TypeOf(Import{}) + rtypeOfMacro = r.TypeOf(Macro{}) + rtypeOfUntypedLit = r.TypeOf(UntypedLit{}) + rtypeOfReflectType = r.TypeOf((*r.Type)(nil)).Elem() + + zeroOfReflectType = r.Zero(rtypeOfReflectType) +) + +func (g *CompThreadGlobals) TypeOfBuiltin() xr.Type { + return g.Universe.ReflectTypes[rtypeOfBuiltin] +} + +func (g *CompThreadGlobals) TypeOfFunction() xr.Type { + return g.Universe.ReflectTypes[rtypeOfFunction] +} + +func (g *CompThreadGlobals) TypeOfImport() xr.Type { + return g.Universe.ReflectTypes[rtypeOfImport] +} + +func (g *CompThreadGlobals) TypeOfMacro() xr.Type { + return g.Universe.ReflectTypes[rtypeOfMacro] +} + +func (g *CompThreadGlobals) TypeOfUntypedLit() xr.Type { + return g.Universe.ReflectTypes[rtypeOfUntypedLit] +} + +// A TypeAssertionError explains a failed type assertion. +type TypeAssertionError struct { + Interface r.Type + Concrete r.Type + Asserted r.Type + MissingMethod string // one method needed by Interface, missing from Concrete +} + +func (*TypeAssertionError) RuntimeError() {} + +func (e *TypeAssertionError) Error() string { + in := e.Interface + concr := e.Concrete + if concr == nil { + return fmt.Sprintf("interface conversion: <%v> is nil, not <%v>", in, e.Asserted) + } + if len(e.MissingMethod) == 0 { + return fmt.Sprintf("interface conversion: <%v> is <%v>, not <%v>", in, concr, e.Asserted) + } + return fmt.Sprintf("interface conversion: <%v> is not <%v>: missing method ", concr, e.Asserted, e.MissingMethod) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/unary.go b/vendor/github.com/cosmos72/gomacro/fast/unary.go new file mode 100644 index 0000000..5d559c1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/unary.go @@ -0,0 +1,123 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * unary.go + * + * Created on Apr 07, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/constant" + "go/token" + + "github.com/cosmos72/gomacro/base" + mt "github.com/cosmos72/gomacro/token" +) + +func (c *Comp) UnaryExpr(node *ast.UnaryExpr) *Expr { + switch node.Op { + case mt.QUOTE: + // surprisingly easy :) + block := node.X.(*ast.FuncLit).Body + node := base.SimplifyNodeForQuote(block, true) + return c.exprValue(nil, node) + + case mt.QUASIQUOTE: + return c.quasiquoteUnary(node) + + case mt.UNQUOTE, mt.UNQUOTE_SPLICE: + c.Errorf("invalid %s outside %s: %v", mt.String(node.Op), mt.String(mt.QUASIQUOTE), node) + + case token.AND: + // c.Expr(node.X) is useless here... skip it + return c.AddressOf(node) + } + + xe := c.Expr1(node.X) + if xe.Type == nil { + return c.invalidUnaryExpr(node, xe) + } + if xe.Untyped() { + return c.UnaryExprUntyped(node, xe) + } + isConst := xe.Const() + xe.WithFun() + var z *Expr + + switch node.Op { + case token.ADD: + z = c.UnaryPlus(node, xe) // only checks xe type, returns xe itself + case token.SUB: + z = c.UnaryMinus(node, xe) + case token.NOT: + z = c.UnaryNot(node, xe) + case token.XOR: + z = c.UnaryXor(node, xe) + case token.ARROW: + z = c.Recv(node, xe) + // never returns a constant + isConst = false + // case token.MUL: // not seen, the parser produces *ast.StarExpr instead + default: + return c.invalidUnaryExpr(node, xe) + } + if isConst { + // constant propagation + z.EvalConst(OptKeepUntyped) + } + return z +} + +func (c *Comp) UnaryExprUntyped(node *ast.UnaryExpr, xe *Expr) *Expr { + op := node.Op + switch op { + case token.ADD, token.SUB, token.XOR, token.NOT: + xlit := xe.Value.(UntypedLit) + ret := constant.UnaryOp(op, xlit.Obj, 0) + if ret == constant.MakeUnknown() { + return c.invalidUnaryExpr(node, xe) + } + return c.exprUntypedLit(xlit.Kind, ret) + } + return c.invalidUnaryExpr(node, xe) +} + +func (c *Comp) invalidUnaryExpr(node *ast.UnaryExpr, xe *Expr) *Expr { + return c.badUnaryExpr("invalid", node, xe) +} + +func (c *Comp) unimplementedUnaryExpr(node *ast.UnaryExpr, xe *Expr) *Expr { + return c.badUnaryExpr("unimplemented", node, xe) +} + +func (c *Comp) badUnaryExpr(reason string, node *ast.UnaryExpr, xe *Expr) *Expr { + opstr := mt.String(node.Op) + if xe != nil { + c.Errorf("%s unary operation %s on <%v>: %s %v", + reason, opstr, xe.Type, opstr, node.X) + } else { + c.Errorf("%s unary operation %s: %s %v", + reason, opstr, opstr, node.X) + } + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/unary_ops.go b/vendor/github.com/cosmos72/gomacro/fast/unary_ops.go new file mode 100644 index 0000000..2bf23c9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/unary_ops.go @@ -0,0 +1,370 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * unary_plus.go + * + * Created on Apr 07, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/token" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) UnaryPlus(node *ast.UnaryExpr, xe *Expr) *Expr { + if !IsCategory(xe.Type.Kind(), r.Int, r.Uint, r.Float64, r.Complex128) { + return c.invalidUnaryExpr(node, xe) + } + return xe +} + +func (c *Comp) UnaryMinus(node *ast.UnaryExpr, xe *Expr) *Expr { + // if xe is constant, UnaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + x := xe.Fun + var fun I + switch x := x.(type) { + case func(env *Env) int: + fun = func(env *Env) int { + return -x(env) + } + case func(env *Env) int8: + fun = func(env *Env) int8 { + return -x(env) + } + case func(env *Env) int16: + fun = func(env *Env) int16 { + return -x(env) + } + case func(env *Env) int32: + fun = func(env *Env) int32 { + return -x(env) + } + case func(env *Env) int64: + fun = func(env *Env) int64 { + return -x(env) + } + case func(env *Env) uint: + fun = func(env *Env) uint { + return -x(env) + } + case func(env *Env) uint8: + fun = func(env *Env) uint8 { + return -x(env) + } + case func(env *Env) uint16: + fun = func(env *Env) uint16 { + return -x(env) + } + case func(env *Env) uint32: + fun = func(env *Env) uint32 { + return -x(env) + } + case func(env *Env) uint64: + fun = func(env *Env) uint64 { + return -x(env) + } + case func(env *Env) uintptr: + fun = func(env *Env) uintptr { + return -x(env) + } + case func(env *Env) float32: + fun = func(env *Env) float32 { + return -x(env) + } + case func(env *Env) float64: + fun = func(env *Env) float64 { + return -x(env) + } + case func(env *Env) complex64: + fun = func(env *Env) complex64 { + return -x(env) + } + case func(env *Env) complex128: + fun = func(env *Env) complex128 { + return -x(env) + } + default: + return c.invalidUnaryExpr(node, xe) + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) UnaryXor(node *ast.UnaryExpr, xe *Expr) *Expr { + // if xe is constant, UnaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + x := xe.Fun + var fun I + switch x := x.(type) { + case func(env *Env) int: + fun = func(env *Env) int { + return ^x(env) + } + case func(env *Env) int8: + fun = func(env *Env) int8 { + return ^x(env) + } + case func(env *Env) int16: + fun = func(env *Env) int16 { + return ^x(env) + } + case func(env *Env) int32: + fun = func(env *Env) int32 { + return ^x(env) + } + case func(env *Env) int64: + fun = func(env *Env) int64 { + return ^x(env) + } + case func(env *Env) uint: + fun = func(env *Env) uint { + return ^x(env) + } + case func(env *Env) uint8: + fun = func(env *Env) uint8 { + return ^x(env) + } + case func(env *Env) uint16: + fun = func(env *Env) uint16 { + return ^x(env) + } + case func(env *Env) uint32: + fun = func(env *Env) uint32 { + return ^x(env) + } + case func(env *Env) uint64: + fun = func(env *Env) uint64 { + return ^x(env) + } + case func(env *Env) uintptr: + fun = func(env *Env) uintptr { + return ^x(env) + } + default: + return c.invalidUnaryExpr(node, xe) + } + return exprFun(xe.Type, fun) +} + +func (c *Comp) UnaryNot(node *ast.UnaryExpr, xe *Expr) *Expr { + // if xe is constant, UnaryExpr will invoke EvalConst() + // on our return value. no need to optimize that. + x := xe.Fun + var fun I + switch x := x.(type) { + case func(env *Env) bool: + fun = func(env *Env) bool { + return !x(env) + } + default: + return c.invalidUnaryExpr(node, xe) + } + return exprFun(xe.Type, fun) +} + +// StarExpr compiles unary operator * i.e. pointer dereference +func (c *Comp) StarExpr(node *ast.StarExpr) *Expr { + expr := node.X + for { + switch e := expr.(type) { + case *ast.ParenExpr: + expr = e.X + continue + case *ast.UnaryExpr: + if e.Op == token.AND { + // optimize * & x -> x, but check that x is addressable + c.placeOrAddress(e.X, PlaceAddress) + return c.Expr1(e.X) + } + } + break + } + addr := c.Expr1(expr) // panics if addr returns zero values, warns if returns multiple values + taddr := addr.Type + if taddr.Kind() != r.Ptr { + c.Errorf("unary operation * on non-pointer <%v>: %v", taddr, node) + } + return c.Deref(addr) +} + +// Deref compiles unary operator * i.e. pointer dereference +func (c *Comp) Deref(addr *Expr) *Expr { + taddr := addr.Type + if taddr.Kind() != r.Ptr { + c.Errorf("unary operation * on non-pointer <%v>", taddr) + } + x1 := addr.AsX1() // panics if addr returns zero values, warns if returns multiple values + t := taddr.Elem() + x := addr.Fun + var fun I + // fast interpreter expects that Exprs returning primitive types or string + // do NOT wrap them into reflect.Value + switch x := x.(type) { + case func(env *Env) *bool: + fun = func(env *Env) bool { + return *x(env) + } + case func(env *Env) *int: + fun = func(env *Env) int { + return *x(env) + } + case func(env *Env) *int8: + fun = func(env *Env) int8 { + return *x(env) + } + case func(env *Env) *int16: + fun = func(env *Env) int16 { + return *x(env) + } + case func(env *Env) *int32: + fun = func(env *Env) int32 { + return *x(env) + } + case func(env *Env) *int64: + fun = func(env *Env) int64 { + return *x(env) + } + case func(env *Env) *uint: + fun = func(env *Env) uint { + return *x(env) + } + case func(env *Env) *uint8: + fun = func(env *Env) uint8 { + return *x(env) + } + case func(env *Env) *uint16: + fun = func(env *Env) uint16 { + return *x(env) + } + case func(env *Env) *uint32: + fun = func(env *Env) uint32 { + return *x(env) + } + case func(env *Env) *uint64: + fun = func(env *Env) uint64 { + return *x(env) + } + case func(env *Env) *uintptr: + fun = func(env *Env) uintptr { + return *x(env) + } + case func(env *Env) *float32: + fun = func(env *Env) float32 { + return *x(env) + } + case func(env *Env) *float64: + fun = func(env *Env) float64 { + return *x(env) + } + case func(env *Env) *complex64: + fun = func(env *Env) complex64 { + return *x(env) + } + default: + fun = c.derefUnwrap(t, x1) + } + return exprFun(t, fun) +} + +// deref0Unwrap compiles unary operator * on reflect.Value - unwraps reflect.Value.Elem() if possible +func (c *Comp) derefUnwrap(t xr.Type, x1 func(*Env) r.Value) I { + var fun I + switch t.Kind() { + case r.Bool: + fun = func(env *Env) bool { + return x1(env).Elem().Bool() + } + case r.Int: + fun = func(env *Env) int { + return int(x1(env).Elem().Int()) + } + case r.Int8: + fun = func(env *Env) int8 { + return int8(x1(env).Elem().Int()) + } + case r.Int16: + fun = func(env *Env) int16 { + return int16(x1(env).Elem().Int()) + } + case r.Int32: + fun = func(env *Env) int32 { + return int32(x1(env).Elem().Int()) + } + case r.Int64: + fun = func(env *Env) int64 { + return x1(env).Elem().Int() + } + case r.Uint: + fun = func(env *Env) uint { + return uint(x1(env).Elem().Uint()) + } + case r.Uint8: + fun = func(env *Env) uint8 { + return uint8(x1(env).Elem().Uint()) + } + case r.Uint16: + fun = func(env *Env) uint16 { + return uint16(x1(env).Elem().Uint()) + } + case r.Uint32: + fun = func(env *Env) uint32 { + return uint32(x1(env).Elem().Uint()) + } + case r.Uint64: + fun = func(env *Env) uint64 { + return x1(env).Elem().Uint() + } + case r.Uintptr: + fun = func(env *Env) uintptr { + return uintptr(x1(env).Elem().Uint()) + } + case r.Float32: + fun = func(env *Env) float32 { + return float32(x1(env).Elem().Float()) + } + case r.Float64: + fun = func(env *Env) float64 { + return x1(env).Elem().Float() + } + case r.Complex64: + fun = func(env *Env) complex64 { + return complex64(x1(env).Elem().Complex()) + } + case r.Complex128: + fun = func(env *Env) complex128 { + return x1(env).Elem().Complex() + } + case r.String: + fun = func(env *Env) string { + return x1(env).Elem().String() + } + default: + fun = func(env *Env) r.Value { + return x1(env).Elem() + } + } + return fun +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/util.go b/vendor/github.com/cosmos72/gomacro/fast/util.go new file mode 100644 index 0000000..527dfe1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/util.go @@ -0,0 +1,1732 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * identifier.go + * + * Created on Apr 01, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/ast" + "go/constant" + r "reflect" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func eFalse(*Env) bool { + return false +} + +func eTrue(*Env) bool { + return true +} + +func eNone(*Env) { +} + +func eNil(*Env) r.Value { + return Nil +} + +func eXVNone(*Env) (r.Value, []r.Value) { + return None, nil +} + +func nop() { +} + +var valueOfNopFunc = r.ValueOf(nop) + +func asIdent(node ast.Expr) *ast.Ident { + ident, _ := node.(*ast.Ident) + return ident +} + +func (e *Expr) TryAsPred() (value bool, fun func(*Env) bool, err bool) { + if e.Untyped() { + untyp := e.Value.(UntypedLit) + if untyp.Kind != r.Bool { + return false, nil, true + } + return constant.BoolVal(untyp.Obj), nil, false + } + if e.Type.Kind() != r.Bool { + return false, nil, true + } + if e.Const() { + v := r.ValueOf(e.Value) + return v.Bool(), nil, false + } + switch fun := e.Fun.(type) { + case func(*Env) bool: + return false, fun, false + case func(*Env) (r.Value, []r.Value): + e.CheckX1() + return false, func(env *Env) bool { + ret, _ := fun(env) + return ret.Bool() + }, false + default: + fun1 := e.AsX1() + return false, func(env *Env) bool { + return fun1(env).Bool() + }, false + } +} + +func (c *Comp) invalidPred(node ast.Expr, x *Expr) Stmt { + return c.badPred("invalid", node, x) +} + +func (c *Comp) badPred(reason string, node ast.Expr, x *Expr) Stmt { + var t xr.Type = nil + if x.NumOut() != 0 { + t = x.Out(0) + } + c.Errorf("%s boolean predicate, expecting expression, found <%v>: %v", + reason, t, node) + return nil +} + +func (e *Expr) AsX() func(*Env) { + if e == nil || e.Const() { + return nil + } + return funAsX(e.Fun) +} + +func funAsX(any I) func(*Env) { + switch fun := any.(type) { + case nil: + case func(*Env): + return fun + case func(*Env) r.Value: + return func(env *Env) { + fun(env) + } + case func(*Env) (r.Value, []r.Value): + return func(env *Env) { + fun(env) + } + case func(*Env) bool: + return func(env *Env) { + fun(env) + } + case func(*Env) int: + return func(env *Env) { + fun(env) + } + case func(*Env) int8: + return func(env *Env) { + fun(env) + } + case func(*Env) int16: + return func(env *Env) { + fun(env) + } + case func(*Env) int32: + return func(env *Env) { + fun(env) + } + case func(*Env) int64: + return func(env *Env) { + fun(env) + } + case func(*Env) uint: + return func(env *Env) { + fun(env) + } + case func(*Env) uint8: + return func(env *Env) { + fun(env) + } + case func(*Env) uint16: + return func(env *Env) { + fun(env) + } + case func(*Env) uint32: + return func(env *Env) { + fun(env) + } + case func(*Env) uint64: + return func(env *Env) { + fun(env) + } + case func(*Env) uintptr: + return func(env *Env) { + fun(env) + } + case func(*Env) float32: + return func(env *Env) { + fun(env) + } + case func(*Env) float64: + return func(env *Env) { + fun(env) + } + case func(*Env) complex64: + return func(env *Env) { + fun(env) + } + case func(*Env) complex128: + return func(env *Env) { + fun(env) + } + case func(*Env) string: + return func(env *Env) { + fun(env) + } + default: + Errorf("unsupported function type, cannot convert to func(*Env): %v <%v>", any, r.TypeOf(any)) + } + return nil +} + +// CheckX1() panics if given expression cannot be used in single-value context, +// for example because it returns no value at all. +// It just prints a warning if expression returns multiple values. +func (e *Expr) CheckX1() { + if e != nil && e.Const() { + return + } + if e == nil || e.NumOut() == 0 { + Errorf("expression returns no values, cannot convert to func(env *Env) r.Value") + return + } else if e.NumOut() > 1 { + Warnf("expression returns %d values, using only the first one: %v", e.NumOut(), e.Types) + } +} + +func (e *Expr) AsX1() func(*Env) r.Value { + if e == nil { + return eNil + } + if e.Const() { + return valueAsX1(e.Value, e.Type, OptDefaults) + } + e.CheckX1() + return funAsX1(e.Fun, e.Type) +} + +func (e *Expr) AsXV(opts CompileOptions) func(*Env) (r.Value, []r.Value) { + if e == nil { + return eXVNone + } + if e.Const() { + return valueAsXV(e.Value, e.Type, opts) + } + return funAsXV(e.Fun, e.Type) +} + +func valueAsX1(any I, t xr.Type, opts CompileOptions) func(*Env) r.Value { + convertuntyped := opts&OptKeepUntyped == 0 + untyp, untyped := any.(UntypedLit) + if untyped && convertuntyped { + if t == nil || t.ReflectType() == rtypeOfUntypedLit { + t = untyp.DefaultType() + } + // Debugf("late conversion of untyped constant %v <%v> to <%v>", untyp, r.TypeOf(untyp), t) + any = untyp.ConstTo(t) + } + v := r.ValueOf(any) + if t != nil { + rtype := t.ReflectType() + if !v.IsValid() { + v = r.Zero(rtype) + } else if convertuntyped || !untyped { + v = v.Convert(rtype) + } + } + return func(*Env) r.Value { + return v + } +} + +func valueAsXV(any I, t xr.Type, opts CompileOptions) func(*Env) (r.Value, []r.Value) { + convertuntyped := opts&OptKeepUntyped == 0 + untyp, untyped := any.(UntypedLit) + if convertuntyped { + if untyped { + if t == nil || t.ReflectType() == rtypeOfUntypedLit { + t = untyp.DefaultType() + // Debugf("valueAsXV: late conversion of untyped constant %v <%v> to its default type <%v>", untyp, r.TypeOf(untyp), t) + } else { + // Debugf("valueAsXV: late conversion of untyped constant %v <%v> to <%v>", untyp, r.TypeOf(untyp), t.ReflectType()) + } + any = untyp.ConstTo(t) + } + } + v := r.ValueOf(any) + if t != nil { + rtype := t.ReflectType() + if ValueType(v) == nil { + v = r.Zero(rtype) + } else if convertuntyped || !untyped { + v = v.Convert(rtype) + } + } + return func(*Env) (r.Value, []r.Value) { + return v, nil + } +} + +func funAsX1(fun I, t xr.Type) func(*Env) r.Value { + // Debugf("funAsX1() %v -> %v", TypeOf(fun), t) + var rt r.Type + if t != nil { + rt = t.ReflectType() + } + switch fun := fun.(type) { + case nil: + case func(*Env): + if fun == nil { + break + } + return func(env *Env) r.Value { + fun(env) + return None + } + case func(*Env) r.Value: + return fun + case func(*Env) (r.Value, []r.Value): + return func(env *Env) r.Value { + ret, _ := fun(env) + return ret + } + case func(*Env) bool: + if rt == nil || rt == TypeOfBool { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int: + if rt == nil || rt == TypeOfInt { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int8: + if rt == nil || rt == TypeOfInt8 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int16: + if rt == nil || rt == TypeOfInt16 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int32: + if rt == nil || rt == TypeOfInt32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int64: + if rt == nil || rt == TypeOfInt64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint: + if rt == nil || rt == TypeOfUint { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint8: + if rt == nil || rt == TypeOfUint8 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint16: + if rt == nil || rt == TypeOfUint16 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint32: + if rt == nil || rt == TypeOfUint32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint64: + if rt == nil || rt == TypeOfUint64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uintptr: + if rt == nil || rt == TypeOfUintptr { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) float32: + if rt == nil || rt == TypeOfFloat32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) float64: + if rt == nil || rt == TypeOfFloat64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) complex64: + if rt == nil || rt == TypeOfComplex64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) complex128: + if rt == nil || rt == TypeOfComplex128 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) string: + if rt == nil || rt == TypeOfString { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *bool: + if rt == nil || rt == TypeOfPtrBool { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *int: + if rt == nil || rt == TypeOfPtrInt { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *int8: + if rt == nil || rt == TypeOfPtrInt8 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *int16: + if rt == nil || rt == TypeOfPtrInt16 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *int32: + if rt == nil || rt == TypeOfPtrInt32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *int64: + if rt == nil || rt == TypeOfPtrInt64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uint: + if rt == nil || rt == TypeOfPtrUint { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uint8: + if rt == nil || rt == TypeOfPtrUint8 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uint16: + if rt == nil || rt == TypeOfPtrUint16 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uint32: + if rt == nil || rt == TypeOfPtrUint32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uint64: + if rt == nil || rt == TypeOfPtrUint64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *uintptr: + if rt == nil || rt == TypeOfPtrUintptr { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *float32: + if rt == nil || rt == TypeOfPtrFloat32 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *float64: + if rt == nil || rt == TypeOfPtrFloat64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) *complex64: + if rt == nil || rt == TypeOfPtrComplex64 { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)) + } + } else { + return func(env *Env) r.Value { + return r.ValueOf(fun(env)).Convert(rt) + } + } + default: + Errorf("unsupported expression type, cannot convert to func(*Env) r.Value: %v <%v>", fun, r.TypeOf(fun)) + } + return nil +} + +func funAsXV(fun I, t xr.Type) func(*Env) (r.Value, []r.Value) { + // Debugf("funAsXV() %v -> %v", TypeOf(fun), t) + var rt r.Type + if t != nil { + rt = t.ReflectType() + } + switch fun := fun.(type) { + case nil: + case func(*Env): + if fun == nil { + break + } + return func(env *Env) (r.Value, []r.Value) { + fun(env) + return None, nil + } + case func(*Env) r.Value: + return func(env *Env) (r.Value, []r.Value) { + return fun(env), nil + } + case func(*Env) (r.Value, []r.Value): + return fun + case func(*Env) bool: + if rt == nil || rt == TypeOfBool { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) int: + if rt == nil || rt == TypeOfInt { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) int8: + if rt == nil || rt == TypeOfInt8 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) int16: + if rt == nil || rt == TypeOfInt16 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) int32: + if rt == nil || rt == TypeOfInt32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) int64: + if rt == nil || rt == TypeOfInt64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uint: + if rt == nil || rt == TypeOfUint { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uint8: + if rt == nil || rt == TypeOfUint8 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uint16: + if rt == nil || rt == TypeOfUint16 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uint32: + if rt == nil || rt == TypeOfUint32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uint64: + if rt == nil || rt == TypeOfUint64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) uintptr: + if rt == nil || rt == TypeOfUintptr { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) float32: + if rt == nil || rt == TypeOfFloat32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) float64: + if rt == nil || rt == TypeOfFloat64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) complex64: + if rt == nil || rt == TypeOfComplex64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) complex128: + if rt == nil || rt == TypeOfComplex128 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) string: + if rt == nil || rt == TypeOfString { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *bool: + if rt == nil || rt == TypeOfPtrBool { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *int: + if rt == nil || rt == TypeOfPtrInt { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *int8: + if rt == nil || rt == TypeOfPtrInt8 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *int16: + if rt == nil || rt == TypeOfPtrInt16 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *int32: + if rt == nil || rt == TypeOfPtrInt32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *int64: + if rt == nil || rt == TypeOfPtrInt64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uint: + if rt == nil || rt == TypeOfPtrUint { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uint8: + if rt == nil || rt == TypeOfPtrUint8 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uint16: + if rt == nil || rt == TypeOfPtrUint16 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uint32: + if rt == nil || rt == TypeOfPtrUint32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uint64: + if rt == nil || rt == TypeOfPtrUint64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *uintptr: + if rt == nil || rt == TypeOfPtrUintptr { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *float32: + if rt == nil || rt == TypeOfPtrFloat32 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *float64: + if rt == nil || rt == TypeOfPtrFloat64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + case func(*Env) *complex64: + if rt == nil || rt == TypeOfPtrComplex64 { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)), nil + } + } else { + return func(env *Env) (r.Value, []r.Value) { + return r.ValueOf(fun(env)).Convert(rt), nil + } + } + default: + Errorf("unsupported expression, cannot convert to func(*Env) (r.Value, []r.Value) : %v <%v>", + fun, r.TypeOf(fun)) + } + return nil +} + +func (e *Expr) AsStmt() Stmt { + if e == nil || e.Const() { + return nil + } + return funAsStmt(e.Fun) +} + +func funAsStmt(fun I) Stmt { + var ret func(env *Env) (Stmt, *Env) + + switch fun := fun.(type) { + case nil: + case func(*Env): + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) r.Value: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) (r.Value, []r.Value): + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) bool: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int8: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int16: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int32: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) int64: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint8: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint16: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint32: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uint64: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) uintptr: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float32: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) float64: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex64: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) complex128: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + case func(*Env) string: + ret = func(env *Env) (Stmt, *Env) { + fun(env) + env.IP++ + return env.Code[env.IP], env + } + default: + + Errorf("unsupported expression type, cannot convert to Stmt : %v <%v>", + fun, r.TypeOf(fun)) + } + return ret +} + +// funTypeOut returns the first return type of given function +func funTypeOut(fun I) r.Type { + rt := r.TypeOf(fun) + if rt == nil || rt.Kind() != r.Func || rt.NumOut() == 0 { + return nil + } + return rt.Out(0) +} + +// funTypeOuts returns the return types of given function +func funTypeOuts(fun I) []r.Type { + rt := r.TypeOf(fun) + if rt == nil || rt.Kind() != r.Func { + return []r.Type{rt} + } + n := rt.NumOut() + rts := make([]r.Type, n) + for i := 0; i < n; i++ { + rts[i] = rt.Out(i) + } + return rts +} + +// exprList merges together a list of expressions, +// and returns an expression that evaluates each one +func exprList(list []*Expr, opts CompileOptions) *Expr { + // skip constant expressions (except the last one) + var n int + for i, ni := 0, len(list)-1; i <= ni; i++ { + // preserve the last expression even if constant + // because it will be returned to the user + if i == ni || !list[i].Const() { + list[n] = list[i] + n++ + } + } + switch n { + case 0: + return nil + case 1: + return list[0] + } + list = list[:n] + + funs := make([]func(*Env), n-1) + for i := range funs { + funs[i] = list[i].AsX() + } + return &Expr{ + Lit: Lit{Type: list[n-1].Type}, + Types: list[n-1].Types, + Fun: funList(funs, list[n-1], opts), + } +} + +// funList merges together a list of functions, +// and returns a function that evaluates each one +func funList(funs []func(*Env), last *Expr, opts CompileOptions) I { + var rt r.Type + if last.Type != nil { + // keep untyped constants only if requested + if opts != OptKeepUntyped && last.Untyped() { + last.ConstTo(last.DefaultType()) + } + rt = last.Type.ReflectType() + } + switch fun := last.WithFun().(type) { + case nil: + return func(env *Env) { + for _, f := range funs { + f(env) + } + } + case func(*Env): + return func(env *Env) { + for _, f := range funs { + f(env) + } + fun(env) + } + case func(*Env) r.Value: + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return fun(env) + } + case func(*Env) (r.Value, []r.Value): + return func(env *Env) (r.Value, []r.Value) { + for _, f := range funs { + f(env) + } + return fun(env) + } + case func(*Env) bool: + if rt == nil || rt == TypeOfBool { + return func(env *Env) bool { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int: + if rt == nil || rt == TypeOfInt { + return func(env *Env) int { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int8: + if rt == nil || rt == TypeOfInt8 { + return func(env *Env) int8 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int16: + if rt == nil || rt == TypeOfInt16 { + return func(env *Env) int16 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int32: + if rt == nil || rt == TypeOfInt32 { + return func(env *Env) int32 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) int64: + if rt == nil || rt == TypeOfInt64 { + return func(env *Env) int64 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint: + if rt == nil || rt == TypeOfUint { + return func(env *Env) uint { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint8: + if rt == nil || rt == TypeOfUint8 { + return func(env *Env) uint8 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint16: + if rt == nil || rt == TypeOfUint16 { + return func(env *Env) uint16 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint32: + if rt == nil || rt == TypeOfUint32 { + return func(env *Env) uint32 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uint64: + if rt == nil || rt == TypeOfUint64 { + return func(env *Env) uint64 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) uintptr: + if rt == nil || rt == TypeOfUintptr { + return func(env *Env) uintptr { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) float32: + if rt == nil || rt == TypeOfFloat32 { + return func(env *Env) float32 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) float64: + if rt == nil || rt == TypeOfFloat64 { + return func(env *Env) float64 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) complex64: + if rt == nil || rt == TypeOfComplex64 { + return func(env *Env) complex64 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) complex128: + if rt == nil || rt == TypeOfComplex128 { + return func(env *Env) complex128 { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + case func(*Env) string: + if rt == nil || rt == TypeOfString { + return func(env *Env) string { + for _, f := range funs { + f(env) + } + return fun(env) + } + } else { + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + return r.ValueOf(fun(env)).Convert(rt) + } + } + default: + switch last.NumOut() { + case 0: + fun := last.AsX() + return func(env *Env) { + for _, f := range funs { + f(env) + } + fun(env) + } + case 1: + var zero r.Value + if rt != nil { + zero = r.Zero(rt) + } + fun := last.AsX1() + return func(env *Env) r.Value { + for _, f := range funs { + f(env) + } + ret := fun(env) + if ret == Nil { + ret = zero + } else if rt != nil && rt != ret.Type() { + ret = ret.Convert(rt) + } + return ret + } + default: + var zero []r.Value + var rt []r.Type + for i, t := range last.Types { + if t != nil { + rt[i] = t.ReflectType() + zero[i] = r.Zero(rt[i]) + } + } + fun := last.AsXV(opts) + return func(env *Env) (r.Value, []r.Value) { + for _, f := range funs { + f(env) + } + _, rets := fun(env) + for i, ret := range rets { + if ret == Nil { + rets[i] = zero[i] + } else if rt != nil && rt[i] != ret.Type() { + rets[i] = ret.Convert(rt[i]) + } + } + return rets[0], rets + } + } + } +} + +// unwrapBind compiles a conversion from a "mis-typed" bind stored in env.Binds[] as reflect.Value +// into a correctly-typed expression +func unwrapBind(bind *Bind, t xr.Type) *Expr { + idx := bind.Desc.Index() + var ret I + switch t.Kind() { + case r.Bool: + ret = func(env *Env) bool { + return env.Binds[idx].Bool() + } + case r.Int: + ret = func(env *Env) int { + return int(env.Binds[idx].Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + return int8(env.Binds[idx].Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + return int16(env.Binds[idx].Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + return int32(env.Binds[idx].Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + return env.Binds[idx].Int() + } + case r.Uint: + ret = func(env *Env) uint { + return uint(env.Binds[idx].Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + return uint8(env.Binds[idx].Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + return uint16(env.Binds[idx].Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + return uint32(env.Binds[idx].Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + return env.Binds[idx].Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + return uintptr(env.Binds[idx].Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + return float32(env.Binds[idx].Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + return env.Binds[idx].Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + return complex64(env.Binds[idx].Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + return env.Binds[idx].Complex() + } + case r.String: + ret = func(env *Env) string { + return env.Binds[idx].String() + } + default: + rtype := t.ReflectType() + zero := r.Zero(rtype) + ret = func(env *Env) r.Value { + v := env.Binds[idx] + if !v.IsValid() { + v = zero + } else if v.Type() != rtype { + v = v.Convert(rtype) + } + return v + } + } + return exprFun(t, ret) +} + +// unwrapBindUp1 compiles a conversion from a "mis-typed" bind stored in env.Outer.Binds[] as reflect.Value +// into a correctly-typed expression +func unwrapBindUp1(bind *Bind, t xr.Type) *Expr { + idx := bind.Desc.Index() + var ret I + switch t.Kind() { + case r.Bool: + ret = func(env *Env) bool { + return env.Outer.Binds[idx].Bool() + } + case r.Int: + ret = func(env *Env) int { + return int(env.Outer.Binds[idx].Int()) + } + case r.Int8: + ret = func(env *Env) int8 { + return int8(env.Outer.Binds[idx].Int()) + } + case r.Int16: + ret = func(env *Env) int16 { + return int16(env.Outer.Binds[idx].Int()) + } + case r.Int32: + ret = func(env *Env) int32 { + return int32(env.Outer.Binds[idx].Int()) + } + case r.Int64: + ret = func(env *Env) int64 { + return env.Outer.Binds[idx].Int() + } + case r.Uint: + ret = func(env *Env) uint { + return uint(env.Outer.Binds[idx].Uint()) + } + case r.Uint8: + ret = func(env *Env) uint8 { + return uint8(env.Outer.Binds[idx].Uint()) + } + case r.Uint16: + ret = func(env *Env) uint16 { + return uint16(env.Outer.Binds[idx].Uint()) + } + case r.Uint32: + ret = func(env *Env) uint32 { + return uint32(env.Outer.Binds[idx].Uint()) + } + case r.Uint64: + ret = func(env *Env) uint64 { + return env.Outer.Binds[idx].Uint() + } + case r.Uintptr: + ret = func(env *Env) uintptr { + return uintptr(env.Outer.Binds[idx].Uint()) + } + case r.Float32: + ret = func(env *Env) float32 { + return float32(env.Outer.Binds[idx].Float()) + } + case r.Float64: + ret = func(env *Env) float64 { + return env.Outer.Binds[idx].Float() + } + case r.Complex64: + ret = func(env *Env) complex64 { + return complex64(env.Outer.Binds[idx].Complex()) + } + case r.Complex128: + ret = func(env *Env) complex128 { + return env.Outer.Binds[idx].Complex() + } + case r.String: + ret = func(env *Env) string { + return env.Outer.Binds[idx].String() + } + default: + rtype := t.ReflectType() + zero := r.Zero(rtype) + ret = func(env *Env) r.Value { + v := env.Outer.Binds[idx] + if !v.IsValid() { + v = zero + } else if v.Type() != rtype { + v = v.Convert(rtype) + } + return v + } + } + return exprFun(t, ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_ops.go b/vendor/github.com/cosmos72/gomacro/fast/var_ops.go new file mode 100644 index 0000000..9575265 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_ops.go @@ -0,0 +1,31907 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_setops.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) varAddConst(va *Var, val I) { + if isLiteralNumber(val, 0) || val == "" { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + val := + + float32(r.ValueOf(val).Float()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + val := r.ValueOf(val).Float() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + val := + + complex64(r.ValueOf(val).Complex()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + val := r.ValueOf(val).Complex() + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case r.String: + val := r.ValueOf(val).String() + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetString(lhs.String() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetString(lhs.String() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetString(lhs.String() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetString(lhs.String() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetString(lhs.String() + + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.ADD, t) + + } + c.append(ret) + } +} +func (c *Comp) varAddExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() + int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() + uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() + float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) += fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() + complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex128: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case func(*Env) string: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetString(lhs.String() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetString(lhs.String() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetString(lhs.String() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetString(lhs.String() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetString(lhs.String() + + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.ADD, t) + + } + c.append(ret) +} +func (c *Comp) varSubConst(va *Var, val I) { + if isLiteralNumber(val, 0) { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + val := + + float32(r.ValueOf(val).Float()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + val := r.ValueOf(val).Float() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + val := + + complex64(r.ValueOf(val).Complex()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + val := r.ValueOf(val).Complex() + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() - + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() - + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() - + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.SUB, t) + + } + c.append(ret) + } +} +func (c *Comp) varSubExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() - int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() - uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() - float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) -= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() - complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex128: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() - + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.SUB, t) + + } + c.append(ret) +} +func (c *Comp) varMulConst(va *Var, val I) { + if isLiteralNumber(val, 0) { + + c.varSetZero(va) + return + } else if isLiteralNumber(val, 1) { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + val := + + float32(r.ValueOf(val).Float()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + val := r.ValueOf(val).Float() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + val := + + complex64(r.ValueOf(val).Complex()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + val := r.ValueOf(val).Complex() + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() * + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() * + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() * + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.MUL, t) + + } + c.append(ret) + } +} +func (c *Comp) varMulExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() * int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() * uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() * float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) *= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() * complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex128: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() * + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.MUL, t) + + } + c.append(ret) +} +func (c *Comp) varQuoPow2(va *Var, val I) bool { + t := va.Type + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, t) + return false + } else if isLiteralNumber(val, 1) { + return true + } + + ypositive := true + yv := r.ValueOf(val) + var y uint64 + switch KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + + case r.Uint: + y = yv.Uint() + default: + return false + } + if !isPowerOfTwo(y) { + return false + } + + shift := integerLen(y) - 1 + upn := va.Upn + index := va.Desc.Index() + var ret Stmt + + switch t.Kind() { + case r.Int: + switch upn { + case 0: + + { + y_1 := + + int(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 1: + + { + y_1 := + + int(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 2: + { + y_1 := + + int(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + default: + { + y_1 := + + int(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + addr := (*int)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + addr := (*int)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case c.Depth - 1: + { + y_1 := + + int(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + case r.Int8: + switch upn { + case 0: + + { + y_1 := + + int8(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 1: + + { + y_1 := + + int8(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 2: + { + y_1 := + + int8(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + default: + { + y_1 := + + int8(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + addr := (*int8)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + addr := (*int8)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case c.Depth - 1: + { + y_1 := + + int8(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + case r.Int16: + switch upn { + case 0: + + { + y_1 := + + int16(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 1: + + { + y_1 := + + int16(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 2: + { + y_1 := + + int16(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + default: + { + y_1 := + + int16(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + addr := (*int16)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + addr := (*int16)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case c.Depth - 1: + { + y_1 := + + int16(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + case r.Int32: + switch upn { + case 0: + + { + y_1 := + + int32(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 1: + + { + y_1 := + + int32(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 2: + { + y_1 := + + int32(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + default: + { + y_1 := + + int32(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + addr := (*int32)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + addr := (*int32)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case c.Depth - 1: + { + y_1 := + + int32(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + case r.Int64: + switch upn { + case 0: + + { + y_1 := + + int64(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 1: + + { + y_1 := + + int64(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case 2: + { + y_1 := + + int64(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + default: + { + y_1 := + + int64(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + addr := (*int64)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + addr := (*int64)(unsafe.Pointer(&o.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + case c.Depth - 1: + { + y_1 := + + int64(y - 1) + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + + addr := (*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) + + n := *addr + if n < 0 { + n += y_1 + } + + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + + } + } + + case r.Uint: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + case r.Uint8: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + case r.Uint16: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + case r.Uint32: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + case r.Uint64: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + env.IntBinds[index] >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.IntBinds[index] >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer.IntBinds[index] >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o.IntBinds[index] >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + + env.ThreadGlobals.FileEnv.IntBinds[index] >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + case r.Uintptr: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= shift + env.IP++ + return env.Code[env.IP], env + } + } + + } + if ret == nil { + return false + } + + c.append(ret) + return true +} +func (c *Comp) varQuoConst(va *Var, val I) { + if c.varQuoPow2(va, val) { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + val := + + float32(r.ValueOf(val).Float()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + val := r.ValueOf(val).Float() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + val := + + complex64(r.ValueOf(val).Complex()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + val := r.ValueOf(val).Complex() + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() / + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() / + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() / + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.QUO, t) + + } + c.append(ret) + } +} +func (c *Comp) varQuoExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() / int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() / uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float32)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) float64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*float64)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetFloat(lhs.Float() / float64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*complex64)(unsafe.Pointer(&o.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) /= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() / complex128(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) complex128: + switch upn { + case 0: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case 2: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + case c.Depth - 1: + + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetComplex(lhs.Complex() / + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.QUO, t) + + } + c.append(ret) +} +func (c *Comp) varRemConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, t) + return + } else if isLiteralNumber(val, 1) { + + c.varSetZero(va) + return + } + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.REM, t) + + } + c.append(ret) + } +} +func (c *Comp) varRemExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() % int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) %= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() % uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.REM, t) + + } + c.append(ret) +} +func (c *Comp) varAndConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + return + } else if isLiteralNumber(val, 0) { + + c.varSetZero(va) + return + } + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND, t) + + } + c.append(ret) + } +} +func (c *Comp) varAndExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() & int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() & uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND, t) + + } + c.append(ret) +} +func (c *Comp) varOrConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.OR, t) + + } + c.append(ret) + } +} +func (c *Comp) varOrExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() | int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) |= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() | uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.OR, t) + + } + c.append(ret) +} +func (c *Comp) varXorConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + return + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.XOR, t) + + } + c.append(ret) + } +} +func (c *Comp) varXorExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() ^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) ^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() ^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.XOR, t) + + } + c.append(ret) +} +func (c *Comp) varAndnotConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + + c.varSetZero(va) + return + } else if isLiteralNumber(val, 0) { + return + } + } + + { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + case r.Int: + val := int(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + val := int8(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + val := int16(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + val := int32(r.ValueOf(val).Int()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + val := r.ValueOf(val).Int() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + val := uint(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + val := uint8(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + val := uint16(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + val := uint32(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + val := r.ValueOf(val).Uint() + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + val := uintptr(r.ValueOf(val).Uint()) + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(val, + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND_NOT, t) + + } + c.append(ret) + } +} +func (c *Comp) varAndnotExpr(va *Var, fun I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + case func(*Env) int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() &^ int64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case func(*Env) uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + { + lhs := o. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) &^= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() &^ uint64(fun(env), + ), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= on <%v>`, token.AND_NOT, t) + + } + c.append(ret) +} +func (c *Comp) SetVar(va *Var, op token.Token, init *Expr) { + t := va.Type + var ok, shift bool + switch op { + case token.SHL, token.SHL_ASSIGN, token.SHR, token.SHR_ASSIGN: + shift = true + if init.Untyped() { + init.ConstTo(c.TypeOfUint64()) + ok = true + } else { + ok = init.Type != nil && KindToCategory(init.Type.Kind()) == r.Uint + } + + default: + if init.Const() { + init.ConstTo(t) + ok = true + } else if init.Type == nil { + ok = op == token.ASSIGN && IsNillableKind(t.Kind()) + } else { + ok = init.Type.AssignableTo(t) + } + + } + if !ok { + c.Errorf("incompatible types in assignment: %v %s %v", t, op, init.Type) + return + } + class := va.Desc.Class() + if class != VarBind && class != IntBind { + c.Errorf("invalid operator %s on %v", op, class) + return + } + index := va.Desc.Index() + if index == NoIndex { + if op != token.ASSIGN { + c.Errorf("invalid operator %s on _", op) + } + + if !init.Const() { + c.append(init.AsStmt()) + } + + return + } + if init.Const() { + rt := t.ReflectType() + val := init.Value + v := r.ValueOf(val) + if v == None || v == Nil { + v = r.Zero(rt) + val = v.Interface() + } else if v.Type() != rt && !shift { + v = v.Convert(rt) + val = v.Interface() + } + switch op { + case token.ASSIGN: + c.varSetConst(va, val) + case token.ADD, token.ADD_ASSIGN: + c.varAddConst(va, val) + case token.SUB, token.SUB_ASSIGN: + c.varSubConst(va, val) + case token.MUL, token.MUL_ASSIGN: + c.varMulConst(va, val) + case token.QUO, token.QUO_ASSIGN: + c.varQuoConst(va, val) + case token.REM, token.REM_ASSIGN: + c.varRemConst(va, val) + case token.AND, token.AND_ASSIGN: + c.varAndConst(va, val) + case token.OR, token.OR_ASSIGN: + c.varOrConst(va, val) + case token.XOR, token.XOR_ASSIGN: + c.varXorConst(va, val) + case token.SHL, token.SHL_ASSIGN: + c.varShlConst(va, val) + case token.SHR, token.SHR_ASSIGN: + c.varShrConst(va, val) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.varAndnotConst(va, val) + default: + c.Errorf("invalid operator %s", op) + } + } else { + fun := init.Fun + switch op { + case token.ASSIGN: + c.varSetExpr(va, init) + case token.ADD, token.ADD_ASSIGN: + c.varAddExpr(va, fun) + case token.SUB, token.SUB_ASSIGN: + c.varSubExpr(va, fun) + case token.MUL, token.MUL_ASSIGN: + c.varMulExpr(va, fun) + case token.QUO, token.QUO_ASSIGN: + c.varQuoExpr(va, fun) + case token.REM, token.REM_ASSIGN: + c.varRemExpr(va, fun) + case token.AND, token.AND_ASSIGN: + c.varAndExpr(va, fun) + case token.OR, token.OR_ASSIGN: + c.varOrExpr(va, fun) + case token.XOR, token.XOR_ASSIGN: + c.varXorExpr(va, fun) + case token.SHL, token.SHL_ASSIGN: + c.varShlExpr(va, fun) + case token.SHR, token.SHR_ASSIGN: + c.varShrExpr(va, fun) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.varAndnotExpr(va, fun) + default: + c.Errorf("invalid operator %s", op) + } + } +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_ops.gomacro b/vendor/github.com/cosmos72/gomacro/fast/var_ops.gomacro new file mode 100644 index 0000000..595616c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_ops.gomacro @@ -0,0 +1,736 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_setops.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + if t == nil { + return nil + } + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:func op_to_assign(op token.Token) token.Token { + switch op { + case token.ADD: + op = token.ADD_ASSIGN + case token.SUB: + op = token.SUB_ASSIGN + case token.MUL: + op = token.MUL_ASSIGN + case token.QUO: + op = token.QUO_ASSIGN + case token.REM: + op = token.REM_ASSIGN + case token.AND: + op = token.AND_ASSIGN + case token.OR: + op = token.OR_ASSIGN + case token.XOR: + op = token.XOR_ASSIGN + case token.SHL: + op = token.SHL_ASSIGN + case token.SHR: + op = token.SHR_ASSIGN + case token.AND_NOT: + op = token.AND_NOT_ASSIGN + default: + panic(fmt.Sprintf("cannot convert token %s to assignment token", op)) + } + return op +} + +:func fgetplace(depth, typ ast.Node) (/*loop*/ *ast.BlockStmt, /*env*/ ast.Node) { + // the return type of Eval() and EvalType() varies. better check early. + upn := Eval(depth).(int) + var t r.Type = EvalType(typ) + var env ast.Node + var loop *ast.BlockStmt + + if upn >= 0 { + env = ~'{env} + for i := 0; i < upn; i++ { + env = ~"{~,env . Outer} + } + } else if upn == -2 { + env = ~'{env.ThreadGlobals.FileEnv} + } else if upn == -3 { + env = ~'{env.ThreadGlobals.TopEnv} + } else { + loop = ~'{ + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + } + env = ~'o + } + return loop, env +} + +:func fsetplace(opnode, depth, typ, expr, exprv ast.Node) ast.Node { + loop, env := fgetplace(depth, typ) + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + op := Eval(opnode).(token.Token) + opset := op_to_assign(op) + var bind, cbind ast.Node + + var assign *ast.AssignStmt = ~"{*(*~,typ)(unsafe.Pointer(& ~,env .IntBinds[index])) += ~,expr} + assign.Tok = opset + bind = assign + + switch t.Kind() { + case r.Bool: + var result *ast.BinaryExpr = ~"{lhs.Bool() + ~,expr} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetBool(~,result)} + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + var result *ast.BinaryExpr = ~"{lhs.Int() + int64(~,expr)} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetInt(~,result)} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + var result *ast.BinaryExpr = ~"{lhs.Uint() + uint64(~,expr)} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetUint(~,result)} + if t.Kind() == r.Uint64 { + var assign *ast.AssignStmt = ~"{~,env . IntBinds[index] += ~,expr} + assign.Tok = opset + bind = assign + } + case r.Float32, r.Float64: + var result *ast.BinaryExpr = ~"{lhs.Float() + float64(~,expr)} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetFloat(~,result)} + case r.Complex64: + var result *ast.BinaryExpr = ~"{lhs.Complex() + complex128(~,expr)} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetComplex(~,result)} + case r.Complex128: + var result *ast.BinaryExpr = ~"{lhs.Complex() + ~,expr} + result.Op = op + bind = ~"{lhs := ~,env . Binds[index]; lhs.SetComplex(~,result)} + case r.String: + var result *ast.BinaryExpr = ~"{lhs.String() + ~,expr} + result.Op = op + bind = ~"{lhs := ~,env . Binds[index]; lhs.SetString(~,result)} + } + + if cbind == nil { + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } + } + + return ~"{ + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,cbind + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:macro setplace_const(opnode, depth, typ ast.Node) ast.Node { + return fsetplace(opnode, depth, typ, ~'val, ~'v) +} + +:macro setplace_expr(opnode, depth, typ ast.Node) ast.Node { + return fsetplace(opnode, depth, typ, ~'{fun(env)}, ~'{fun(env).Convert(t)}) +} + +:macro setplace_depth_const(opnode, typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: setplace_const; ~,opnode; 0; ~,typ + case 1: setplace_const; ~,opnode; 1; ~,typ + case 2: setplace_const; ~,opnode; 2; ~,typ + default: setplace_const; ~,opnode;-1; ~,typ + case c.Depth-1: setplace_const; ~,opnode;-2; ~,typ + } + } +} + +:macro setplace_depth_expr(opnode, typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: setplace_expr; ~,opnode; 0; ~,typ + case 1: setplace_expr; ~,opnode; 1; ~,typ + case 2: setplace_expr; ~,opnode; 2; ~,typ + default: setplace_expr; ~,opnode;-1; ~,typ + case c.Depth-1: setplace_expr; ~,opnode;-2; ~,typ + } + } +} + +:func list_types(typelist []ast.Stmt) []ast.Node { + rets := make([]ast.Node, 0, len(typelist)) + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + rets = append(rets, ~'nil) + } else if t.Kind() == r.Int { + rets = append(rets, ~'int, ~'int8, ~'int16, ~'int32, ~'int64) + } else if t.Kind() == r.Uint { + rets = append(rets, ~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr) + } else if t.Kind() == r.Float64 { + rets = append(rets, ~'float32, ~'float64) + } else if t.Kind() == r.Complex128 { + rets = append(rets, ~'complex64, ~'complex128) + } else { + rets = append(rets, typ) + } + } + return rets +} + +:macro setplaces_depth_const(opnode, types ast.Node) ast.Node { + typelist := list_types(types.(*ast.BlockStmt).List) + caselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= on <%v>`, ~,opnode, t)} + } else { + kind := makekind(typ) + convertval := convertvalue1(typ, ~'{r.ValueOf(val)}) + caselist[i] = ~"{case ~,kind: val := ~,convertval; setplace_depth_const; ~,opnode; ~,typ} + } + } + return ~"{ + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch t.Kind() { + ~,@caselist + } + c.append(ret) + } +} + +:macro setplaces_depth_expr(opnode, types ast.Node) ast.Node { + typelist := list_types(types.(*ast.BlockStmt).List) + caselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= on <%v>`, ~,opnode, t)} + } else { + caselist[i] = ~"{~typecase func(*Env) ~,typ: setplace_depth_expr; ~,opnode; ~,typ} + } + } + return ~"{ + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + var ret Stmt + switch fun := fun.(type) { + ~,@caselist + } + c.append(ret) + } +} + +// varAddConst compiles 'variable += constant' +func (c *Comp) varAddConst(va *Var, val I) { + if isLiteralNumber(val, 0) || val == "" { + return + } + setplaces_depth_const; token.ADD; {int; uint; float64; complex128; string; nil} +} + +// varAddExpr compiles 'variable += expression' +func (c *Comp) varAddExpr(va *Var, fun I) { + setplaces_depth_expr; token.ADD; {int; uint; float64; complex128; string; nil} +} + +// varSubConst compiles 'variable -= constant' +func (c *Comp) varSubConst(va *Var, val I) { + if isLiteralNumber(val, 0) { + return + } + setplaces_depth_const; token.SUB; {int; uint; float64; complex128; nil} +} + +// varSubExpr compiles 'variable -= expression' +func (c *Comp) varSubExpr(va *Var, fun I) { + setplaces_depth_expr; token.SUB; {int; uint; float64; complex128; nil} +} + +// varMulConst compiles 'variable *= constant' +func (c *Comp) varMulConst(va *Var, val I) { + if isLiteralNumber(val, 0) { + // variable *= 0 is equivalent to variable = 0 + c.varSetZero(va) + return + } else if isLiteralNumber(val, 1) { + return + } + setplaces_depth_const; token.MUL; {int; uint; float64; complex128; nil} +} + +// varMulExpr compiles 'variable *= expression' +func (c *Comp) varMulExpr(va *Var, fun I) { + setplaces_depth_expr; token.MUL; {int; uint; float64; complex128; nil} +} + +:macro place_quopow2(depth, typ ast.Node) ast.Node { + var t r.Type = EvalType(typ) + loop, bind := fgetplace(depth, typ) + + addr := ~"{(*~,typ)(unsafe.Pointer(& ~,bind .IntBinds[index]))} + + return ~"{ + y_1 := ~,typ(y - 1) // cannot overflow, y is the abs() value of a non-zero ~,typ + if ypositive { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + addr := ~,addr + n := *addr + if n < 0 { + n += y_1 + } + *addr = n >> shift + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + addr := ~,addr + n := *addr + if n < 0 { + n += y_1 + } + *addr = -(n >> shift) + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:macro place_quopow2_u(depth, typ ast.Node) ast.Node { + var t r.Type = EvalType(typ) + loop, bind := fgetplace(depth, typ) + + if t.Kind() == r.Uint64 { + bind = ~"{~,bind . IntBinds[index]} + } else { + bind = ~"{*(*~,typ)(unsafe.Pointer(& ~,bind .IntBinds[index]))} + } + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind >>= shift + env.IP++ + return env.Code[env.IP], env + } + } +} + +:macro place_depth_quopow2(typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: place_quopow2; 0; ~,typ + case 1: place_quopow2; 1; ~,typ + case 2: place_quopow2; 2; ~,typ + default: place_quopow2;-1; ~,typ + case c.Depth-1: place_quopow2;-2; ~,typ + } + } +} + +:macro place_depth_quopow2_u(typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: place_quopow2_u; 0; ~,typ + case 1: place_quopow2_u; 1; ~,typ + case 2: place_quopow2_u; 2; ~,typ + default: place_quopow2_u;-1; ~,typ + case c.Depth-1: place_quopow2_u;-2; ~,typ + } + } +} + +// varQuoPow2 compiles 'variable /= constant-power-of-two' +func (c *Comp) varQuoPow2(va *Var, val I) bool { + t := va.Type + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, t) + return false + } else if isLiteralNumber(val, 1) { + return true // nothing to do + } + ypositive := true + yv := r.ValueOf(val) + var y uint64 + switch KindToCategory(yv.Kind()) { + case r.Int: + sy := yv.Int() + if sy < 0 { + ypositive = false + y = uint64(-sy) + } else { + y = uint64(sy) + } + case r.Uint: + y = yv.Uint() + default: + // floating point or complex division + return false + } + if !isPowerOfTwo(y) { + // division by multiplication and shift not implemented... + return false + } + // attention: xe / (2**n) and xe >> n have different truncation rules for negative xe: + // quotient / truncates toward zero + // right shift >> truncates toward negative infinity + // see quoPow2() in binary_ops.go for more details + shift := integerLen(y) - 1 + upn := va.Upn + index := va.Desc.Index() + var ret Stmt + + switch t.Kind() { + case r.Int: {place_depth_quopow2; int} + case r.Int8: {place_depth_quopow2; int8} + case r.Int16: {place_depth_quopow2; int16} + case r.Int32: {place_depth_quopow2; int32} + case r.Int64: {place_depth_quopow2; int64} + case r.Uint: {place_depth_quopow2_u; uint} + case r.Uint8: {place_depth_quopow2_u; uint8} + case r.Uint16: {place_depth_quopow2_u; uint16} + case r.Uint32: {place_depth_quopow2_u; uint32} + case r.Uint64: {place_depth_quopow2_u; uint64} + case r.Uintptr: {place_depth_quopow2_u; uintptr} + } + if ret == nil { + return false + } + c.append(ret) + return true +} + +// varQuoConst compiles 'variable /= constant' +func (c *Comp) varQuoConst(va *Var, val I) { + if c.varQuoPow2(va, val) { + return + } + setplaces_depth_const; token.QUO; {int; uint; float64; complex128; nil} +} + +// varQuoExpr compiles 'variable /= expression' +func (c *Comp) varQuoExpr(va *Var, fun I) { + setplaces_depth_expr; token.QUO; {int; uint; float64; complex128; nil} +} + +// varRemConst compiles 'variable %= constant' +func (c *Comp) varRemConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, 0) { + c.Errorf("division by %v <%v>", val, t) + return + } else if isLiteralNumber(val, 1) { + // variable %= 1 is equivalent to variable = 0 + c.varSetZero(va) + return + } + } + setplaces_depth_const; token.REM; {int; uint; nil} +} + +// varRemExpr compiles 'variable %= expression' +func (c *Comp) varRemExpr(va *Var, fun I) { + setplaces_depth_expr; token.REM; {int; uint; nil} +} + +// varAndConst compiles 'variable &= constant' +func (c *Comp) varAndConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + return + } else if isLiteralNumber(val, 0) { + // variable &= 0 is equivalent to variable = 0 + c.varSetZero(va) + return + } + } + setplaces_depth_const; token.AND; {int; uint; nil} +} + +// varAndExpr compiles 'variable &= expression' +func (c *Comp) varAndExpr(va *Var, fun I) { + setplaces_depth_expr; token.AND; {int; uint; nil} +} + +// varOrConst compiles 'variable |= constant' +func (c *Comp) varOrConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + return + } + setplaces_depth_const; token.OR; {int; uint; nil} +} + +// varOrExpr compiles 'variable |= expression' +func (c *Comp) varOrExpr(va *Var, fun I) { + setplaces_depth_expr; token.OR; {int; uint; nil} +} + +// varXorConst compiles 'variable ^= constant' +func (c *Comp) varXorConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) && isLiteralNumber(val, 0) { + return + } + setplaces_depth_const; token.XOR; {int; uint; nil} +} + +// varXorExpr compiles 'variable ^= expression' +func (c *Comp) varXorExpr(va *Var, fun I) { + setplaces_depth_expr; token.XOR; {int; uint; nil} +} + +// varAndnotConst compiles 'variable &^= constant' +func (c *Comp) varAndnotConst(va *Var, val I) { + t := va.Type + if IsCategory(t.Kind(), r.Int, r.Uint) { + if isLiteralNumber(val, -1) { + // variable &^= -1 is equivalent to variable = 0 + c.varSetZero(va) + return + } else if isLiteralNumber(val, 0) { + return + } + } + setplaces_depth_const; token.AND_NOT; {int; uint; nil} +} + +// varAndnotExpr compiles 'variable &^= expression' +func (c *Comp) varAndnotExpr(va *Var, fun I) { + setplaces_depth_expr; token.AND_NOT; {int; uint; nil} +} + + +// SetVar compiles an assignment to a variable: +// 'variable op constant' and 'variable op expression' +func (c *Comp) SetVar(va *Var, op token.Token, init *Expr) { + t := va.Type + var ok, shift bool + switch op { + case token.SHL, token.SHL_ASSIGN, token.SHR, token.SHR_ASSIGN: + shift = true + if init.Untyped() { + init.ConstTo(c.TypeOfUint64()) + ok = true + } else { + ok = init.Type != nil && KindToCategory(init.Type.Kind()) == r.Uint + } + default: + if init.Const() { + init.ConstTo(t) + ok = true + } else if init.Type == nil { + ok = op == token.ASSIGN && IsNillableKind(t.Kind()) + } else { + ok = init.Type.AssignableTo(t) + } + } + if !ok { + c.Errorf("incompatible types in assignment: %v %s %v", t, op, init.Type) + return + } + class := va.Desc.Class() + if class != VarBind && class != IntBind { + c.Errorf("invalid operator %s on %v", op, class) + return + } + index := va.Desc.Index() + if index == NoIndex { + if op != token.ASSIGN { + c.Errorf("invalid operator %s on _", op) + } + if !init.Const() { + // assigning an expression to _ + // only keep the expression side effects + c.append(init.AsStmt()) + } + return + } + if init.Const() { + rt := t.ReflectType() + val := init.Value + v := r.ValueOf(val) + if v == None || v == Nil { + v = r.Zero(rt) + val = v.Interface() + } else if v.Type() != rt && !shift { + v = v.Convert(rt) + val = v.Interface() + } + switch op { + case token.ASSIGN: + c.varSetConst(va, val) + case token.ADD, token.ADD_ASSIGN: + c.varAddConst(va, val) + case token.SUB, token.SUB_ASSIGN: + c.varSubConst(va, val) + case token.MUL, token.MUL_ASSIGN: + c.varMulConst(va, val) + case token.QUO, token.QUO_ASSIGN: + c.varQuoConst(va, val) + case token.REM, token.REM_ASSIGN: + c.varRemConst(va, val) + case token.AND, token.AND_ASSIGN: + c.varAndConst(va, val) + case token.OR, token.OR_ASSIGN: + c.varOrConst(va, val) + case token.XOR, token.XOR_ASSIGN: + c.varXorConst(va, val) + case token.SHL, token.SHL_ASSIGN: + c.varShlConst(va, val) + case token.SHR, token.SHR_ASSIGN: + c.varShrConst(va, val) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.varAndnotConst(va, val) + default: + c.Errorf("invalid operator %s", op) + } + } else { + fun := init.Fun + switch op { + case token.ASSIGN: + c.varSetExpr(va, init) + case token.ADD, token.ADD_ASSIGN: + c.varAddExpr(va, fun) + case token.SUB, token.SUB_ASSIGN: + c.varSubExpr(va, fun) + case token.MUL, token.MUL_ASSIGN: + c.varMulExpr(va, fun) + case token.QUO, token.QUO_ASSIGN: + c.varQuoExpr(va, fun) + case token.REM, token.REM_ASSIGN: + c.varRemExpr(va, fun) + case token.AND, token.AND_ASSIGN: + c.varAndExpr(va, fun) + case token.OR, token.OR_ASSIGN: + c.varOrExpr(va, fun) + case token.XOR, token.XOR_ASSIGN: + c.varXorExpr(va, fun) + case token.SHL, token.SHL_ASSIGN: + c.varShlExpr(va, fun) + case token.SHR, token.SHR_ASSIGN: + c.varShrExpr(va, fun) + case token.AND_NOT, token.AND_NOT_ASSIGN: + c.varAndnotExpr(va, fun) + default: + c.Errorf("invalid operator %s", op) + } + } +} + + diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_set.go b/vendor/github.com/cosmos72/gomacro/fast/var_set.go new file mode 100644 index 0000000..63a9cdd --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_set.go @@ -0,0 +1,4645 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_set.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +func (c *Comp) varSetZero(va *Var) { + zero := xr.Zero(va.Type).Interface() + c.varSetConst(va, zero) +} +func (c *Comp) varSetConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + + v := r.ValueOf(val) + rt := t.ReflectType() + if ValueType(v) == nil { + v = r.Zero(rt) + } else { + v = v.Convert(rt) + } + + var ret func(env *Env) (Stmt, *Env) + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: + switch t.Kind() { + case r.Bool: + + { + val := v.Bool() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetBool(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + val := int(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + { + val := int8(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + { + val := int16(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + { + val := int32(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + { + val := v.Int() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + { + val := + + uint(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + { + val := + + uint8(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint16: + { + val := + + uint16(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint32: + { + val := + + uint32(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint64: + { + val := v.Uint() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uintptr: + { + val := + + uintptr(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float32: + { + val := + + float32(v.Float()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetFloat(float64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float64: + { + val := v.Float() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetFloat(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex64: + { + val := + + complex64(v.Complex()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetComplex(complex128(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex128: + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetComplex(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetString(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].Set(v, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + switch t.Kind() { + case r.Bool: + + { + val := v.Bool() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetBool(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + val := int(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + { + val := int8(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + { + val := int16(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + { + val := int32(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + { + val := v.Int() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + { + val := + + uint(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + { + val := + + uint8(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint16: + { + val := + + uint16(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint32: + { + val := + + uint32(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint64: + { + val := v.Uint() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uintptr: + { + val := + + uintptr(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float32: + { + val := + + float32(v.Float()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetFloat(float64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float64: + { + val := v.Float() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetFloat(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex64: + { + val := + + complex64(v.Complex()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetComplex(complex128(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex128: + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetComplex(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetString(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].Set(v, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + switch t.Kind() { + case r.Bool: + + { + val := v.Bool() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetBool(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + val := int(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + { + val := int8(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + { + val := int16(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + { + val := int32(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + { + val := v.Int() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + { + val := + + uint(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + { + val := + + uint8(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint16: + { + val := + + uint16(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint32: + { + val := + + uint32(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint64: + { + val := v.Uint() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uintptr: + { + val := + + uintptr(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float32: + { + val := + + float32(v.Float()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetFloat(float64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float64: + { + val := v.Float() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetFloat(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex64: + { + val := + + complex64(v.Complex()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetComplex(complex128(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex128: + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetComplex(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetString(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].Set(v, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + default: + switch t.Kind() { + case r.Bool: + + { + val := v.Bool() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*bool)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetBool(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + val := int(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + { + val := int8(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int8)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + { + val := int16(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int16)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + { + val := int32(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int32)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + { + val := v.Int() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int64)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + { + val := + + uint(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + { + val := + + uint8(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint8)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint16: + { + val := + + uint16(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint16)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint32: + { + val := + + uint32(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint32)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint64: + { + val := v.Uint() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uintptr: + { + val := + + uintptr(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uintptr)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float32: + { + val := + + float32(v.Float()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*float32)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetFloat(float64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float64: + { + val := v.Float() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*float64)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetFloat(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex64: + { + val := + + complex64(v.Complex()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*complex64)(unsafe.Pointer(&o. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetComplex(complex128(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex128: + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetComplex(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetString(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].Set(v, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + switch t.Kind() { + case r.Bool: + + { + val := v.Bool() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetBool(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + val := int(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + { + val := int8(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + { + val := int16(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + { + val := int32(v.Int()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + { + val := v.Int() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + { + val := + + uint(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + { + val := + + uint8(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint16: + { + val := + + uint16(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint32: + { + val := + + uint32(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uint64: + { + val := v.Uint() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Uintptr: + { + val := + + uintptr(v.Uint()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float32: + { + val := + + float32(v.Float()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetFloat(float64(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Float64: + { + val := v.Float() + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetFloat(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex64: + { + val := + + complex64(v.Complex()) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetComplex(complex128(val, + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + case r.Complex128: + { + val := v.Complex() + + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetComplex(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + val := v.String() + + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetString(val, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].Set(v, + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + c.append(ret) +} +func (c *Comp) varSetExpr(va *Var, e *Expr) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + + rt := t.ReflectType() + fun := e.Fun + var ret func(env *Env) (Stmt, *Env) + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: + switch t.Kind() { + case r.Bool: + + { + fun := fun.(func(*Env) bool) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetBool(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + fun := fun.(func(*Env) int) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + + { + fun := fun.(func(*Env) int8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + + { + fun := fun.(func(*Env) int16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + + { + fun := fun.(func(*Env) int32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + + { + fun := fun.(func(*Env) int64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetInt(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + + { + fun := fun.(func(*Env) uint) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + + { + fun := fun.(func(*Env) uint8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + + { + fun := fun.(func(*Env) uint16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + + { + fun := fun.(func(*Env) uint32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + { + fun := fun.(func(*Env) uint64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + { + fun := fun.(func(*Env) uintptr) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + { + fun := fun.(func(*Env) float32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetFloat(float64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + { + fun := fun.(func(*Env) float64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetFloat(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + { + fun := fun.(func(*Env) complex64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetComplex(complex128(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + { + fun := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetComplex(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + fun := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].SetString(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + { + fun := e.AsX1() + if conv := c.Converter(e.Type, t); conv == nil { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].Set(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Binds[index].Set(conv(fun(env), rt), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + } + case 1: + switch t.Kind() { + case r.Bool: + + { + fun := fun.(func(*Env) bool) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetBool(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + fun := fun.(func(*Env) int) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + + { + fun := fun.(func(*Env) int8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + + { + fun := fun.(func(*Env) int16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + + { + fun := fun.(func(*Env) int32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + + { + fun := fun.(func(*Env) int64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetInt(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + + { + fun := fun.(func(*Env) uint) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + + { + fun := fun.(func(*Env) uint8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + + { + fun := fun.(func(*Env) uint16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + + { + fun := fun.(func(*Env) uint32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + { + fun := fun.(func(*Env) uint64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + { + fun := fun.(func(*Env) uintptr) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + { + fun := fun.(func(*Env) float32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetFloat(float64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + { + fun := fun.(func(*Env) float64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetFloat(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + { + fun := fun.(func(*Env) complex64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetComplex(complex128(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + { + fun := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetComplex(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + fun := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].SetString(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + { + fun := e.AsX1() + if conv := c.Converter(e.Type, t); conv == nil { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].Set(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + Binds[index].Set(conv(fun(env), rt), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + } + case 2: + switch t.Kind() { + case r.Bool: + + { + fun := fun.(func(*Env) bool) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetBool(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + fun := fun.(func(*Env) int) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + + { + fun := fun.(func(*Env) int8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + + { + fun := fun.(func(*Env) int16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + + { + fun := fun.(func(*Env) int32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + + { + fun := fun.(func(*Env) int64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetInt(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + + { + fun := fun.(func(*Env) uint) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + + { + fun := fun.(func(*Env) uint8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + + { + fun := fun.(func(*Env) uint16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + + { + fun := fun.(func(*Env) uint32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + { + fun := fun.(func(*Env) uint64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + { + fun := fun.(func(*Env) uintptr) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + { + fun := fun.(func(*Env) float32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetFloat(float64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + { + fun := fun.(func(*Env) float64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetFloat(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + { + fun := fun.(func(*Env) complex64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env. + Outer.Outer. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetComplex(complex128(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + { + fun := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetComplex(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + fun := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].SetString(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + { + fun := e.AsX1() + if conv := c.Converter(e.Type, t); conv == nil { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].Set(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + Binds[index].Set(conv(fun(env), rt), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + } + default: + switch t.Kind() { + case r.Bool: + + { + fun := fun.(func(*Env) bool) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*bool)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetBool(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + fun := fun.(func(*Env) int) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + + { + fun := fun.(func(*Env) int8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int8)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + + { + fun := fun.(func(*Env) int16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int16)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + + { + fun := fun.(func(*Env) int32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int32)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + + { + fun := fun.(func(*Env) int64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*int64)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetInt(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + + { + fun := fun.(func(*Env) uint) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + + { + fun := fun.(func(*Env) uint8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint8)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + + { + fun := fun.(func(*Env) uint16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint16)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + + { + fun := fun.(func(*Env) uint32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uint32)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + { + fun := fun.(func(*Env) uint64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + IntBinds[index] = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + { + fun := fun.(func(*Env) uintptr) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*uintptr)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + { + fun := fun.(func(*Env) float32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*float32)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetFloat(float64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + { + fun := fun.(func(*Env) float64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*float64)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetFloat(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + { + fun := fun.(func(*Env) complex64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + *(*complex64)(unsafe.Pointer(&o. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetComplex(complex128(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + { + fun := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetComplex(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + fun := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].SetString(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + { + fun := e.AsX1() + if conv := c.Converter(e.Type, t); conv == nil { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].Set(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o. + Binds[index].Set(conv(fun(env), rt), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + } + case c.Depth - 1: + switch t.Kind() { + case r.Bool: + + { + fun := fun.(func(*Env) bool) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*bool)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetBool(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int: + + { + fun := fun.(func(*Env) int) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + + { + fun := fun.(func(*Env) int8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + + { + fun := fun.(func(*Env) int16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + + { + fun := fun.(func(*Env) int32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(int64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + + { + fun := fun.(func(*Env) int64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetInt(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + + { + fun := fun.(func(*Env) uint) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + + { + fun := fun.(func(*Env) uint8) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + + { + fun := fun.(func(*Env) uint16) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + + { + fun := fun.(func(*Env) uint32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + { + fun := fun.(func(*Env) uint64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + { + fun := fun.(func(*Env) uintptr) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetUint(uint64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float32: + { + fun := fun.(func(*Env) float32) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetFloat(float64(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Float64: + { + fun := fun.(func(*Env) float64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*float64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetFloat(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex64: + { + fun := fun.(func(*Env) complex64) + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*complex64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv. + IntBinds[index])) = fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetComplex(complex128(fun(env), + )) + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Complex128: + { + fun := fun.(func(*Env) complex128) + + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetComplex(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + case r.String: + { + fun := fun.(func(*Env) string) + + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].SetString(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + + default: + { + fun := e.AsX1() + if conv := c.Converter(e.Type, t); conv == nil { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].Set(fun(env), + ) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + Binds[index].Set(conv(fun(env), rt), + ) + + env.IP++ + return env.Code[env.IP], env + } + } + } + + } + } + c.append(ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_set.gomacro b/vendor/github.com/cosmos72/gomacro/fast/var_set.gomacro new file mode 100644 index 0000000..c4bfdbe --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_set.gomacro @@ -0,0 +1,301 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_set.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +:import ( + "go/ast" + r "reflect" +) + +:func fsetplace(depth, typ, expr, exprv ast.Node) ast.Node { + // the return type of Eval() and EvalType() varies. better check early. + upn := Eval(depth).(int) + var t r.Type = EvalType(typ) + + var loop, env, bind, cbind ast.Node + + if upn >= 0 { + env = ~'{env} + for i := 0; i < upn; i++ { + env = ~"{~,env . Outer} + } + } else if upn == -2 { + env = ~'{env.ThreadGlobals.FileEnv} + } else if upn == -3 { + env = ~'{env.ThreadGlobals.TopEnv} + } else { + loop = ~'{ + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + } + env = ~'o + } + + if t == nil { + bind = ~"{~,env . Binds[index] .Set(~,exprv)} + } else { + typename := &ast.Ident{Name: t.Name()} + bind = ~"{*(*~,typename)(unsafe.Pointer(& ~,env .IntBinds[index])) = ~,expr} + switch t.Kind() { + case r.Bool: + cbind = ~"{~,env . Binds[index].SetBool(~,expr)} + case r.Int, r.Int8, r.Int16, r.Int32: + cbind = ~"{~,env . Binds[index].SetInt(int64(~,expr))} + case r.Int64: + cbind = ~"{~,env . Binds[index].SetInt(~,expr)} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uintptr: + cbind = ~"{~,env . Binds[index].SetUint(uint64(~,expr))} + case r.Uint64: + bind = ~"{~,env . IntBinds[index] = ~,expr} + cbind = ~"{~,env . Binds[index].SetUint(~,expr)} + case r.Float32: + cbind = ~"{~,env . Binds[index].SetFloat(float64(~,expr))} + case r.Float64: + cbind = ~"{~,env . Binds[index].SetFloat(~,expr)} + case r.Complex64: + cbind = ~"{~,env . Binds[index] .SetComplex(complex128(~,expr))} + case r.Complex128: + bind = ~"{~,env . Binds[index] .SetComplex(~,expr)} + case r.String: + bind = ~"{~,env . Binds[index] .SetString(~,expr)} + } + } + + if cbind == nil { + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } + } + + return ~"{ + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,cbind + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func convertconst(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + return val + } + + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:macro setplace_const(depth, typ ast.Node) ast.Node { + ret := fsetplace(depth, typ, ~'val, ~'v) + if EvalType(typ) == nil { + return ret + } + convert := convertconst(typ, ~'v) + return ~"{ + val := ~,convert + ~,ret + } +} + +:macro setplace_expr(depth, typ ast.Node) ast.Node { + if EvalType(typ) == nil { + ret0 := fsetplace(depth, typ, ~'{fun(env)}, ~'{fun(env)}) + ret := fsetplace(depth, typ, ~'{fun(env)}, ~'{conv(fun(env), rt)}) + return ~"{ + fun := e.AsX1() // we need the exact type! + if conv := c.Converter(e.Type, t); conv == nil { + ~,ret0 + } else { + ~,ret + } + } + } + ret := fsetplace(depth, typ, ~'{fun(env)}, ~'{fun(env).Convert(rt)}) + return ~"{ + fun := fun.(func(*Env) ~,typ) + ~,ret + } +} + +:macro setplaces_const(depth ast.Node) ast.Node { + return ~"{ + switch t.Kind() { + case r.Bool: setplace_const; ~,depth; bool; + case r.Int: setplace_const; ~,depth; int; + case r.Int8: setplace_const; ~,depth; int8; + case r.Int16: setplace_const; ~,depth; int16; + case r.Int32: setplace_const; ~,depth; int32; + case r.Int64: setplace_const; ~,depth; int64; + case r.Uint: setplace_const; ~,depth; uint; + case r.Uint8: setplace_const; ~,depth; uint8; + case r.Uint16: setplace_const; ~,depth; uint16; + case r.Uint32: setplace_const; ~,depth; uint32; + case r.Uint64: setplace_const; ~,depth; uint64; + case r.Uintptr: setplace_const; ~,depth; uintptr; + case r.Float32: setplace_const; ~,depth; float32; + case r.Float64: setplace_const; ~,depth; float64; + case r.Complex64: setplace_const; ~,depth; complex64; + case r.Complex128: setplace_const; ~,depth; complex128; + case r.String: setplace_const; ~,depth; string; + default: setplace_const; ~,depth; nil; + } + } +} + +:macro setplaces_expr(depth ast.Node) ast.Node { + return ~"{ + switch t.Kind() { + case r.Bool: setplace_expr; ~,depth; bool; + case r.Int: setplace_expr; ~,depth; int; + case r.Int8: setplace_expr; ~,depth; int8; + case r.Int16: setplace_expr; ~,depth; int16; + case r.Int32: setplace_expr; ~,depth; int32; + case r.Int64: setplace_expr; ~,depth; int64; + case r.Uint: setplace_expr; ~,depth; uint; + case r.Uint8: setplace_expr; ~,depth; uint8; + case r.Uint16: setplace_expr; ~,depth; uint16; + case r.Uint32: setplace_expr; ~,depth; uint32; + case r.Uint64: setplace_expr; ~,depth; uint64; + case r.Uintptr: setplace_expr; ~,depth; uintptr; + case r.Float32: setplace_expr; ~,depth; float32; + case r.Float64: setplace_expr; ~,depth; float64; + case r.Complex64: setplace_expr; ~,depth; complex64; + case r.Complex128: setplace_expr; ~,depth; complex128; + case r.String: setplace_expr; ~,depth; string; + default: setplace_expr; ~,depth; nil; + } + } +} + +// varSetZero compiles 'variable = 0' +func (c *Comp) varSetZero(va *Var) { + zero := xr.Zero(va.Type).Interface() + c.varSetConst(va, zero) +} + +// varSetConst compiles 'name = constant' +func (c *Comp) varSetConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + + v := r.ValueOf(val) + rt := t.ReflectType() + if ValueType(v) == nil { + v = r.Zero(rt) + } else { + v = v.Convert(rt) + } + var ret func(env *Env) (Stmt, *Env) + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: setplaces_const; 0 + case 1: setplaces_const; 1 + case 2: setplaces_const; 2 + default: setplaces_const; -1 + case c.Depth-1: setplaces_const; -2 + } + c.append(ret) +} + +// varSetExpr compiles 'name = expression' +func (c *Comp) varSetExpr(va *Var, e *Expr) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + + rt := t.ReflectType() + fun := e.Fun + var ret func(env *Env) (Stmt, *Env) + intbinds := va.Desc.Class() == IntBind + switch upn { + case 0: setplaces_expr; 0 + case 1: setplaces_expr; 1 + case 2: setplaces_expr; 2 + default: setplaces_expr; -1 + case c.Depth-1: setplaces_expr; -2 + } + c.append(ret) +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_set_value.go b/vendor/github.com/cosmos72/gomacro/fast/var_set_value.go new file mode 100644 index 0000000..821e29d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_set_value.go @@ -0,0 +1,596 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_setter.go + * + * Created on Apr 09, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" + xr "github.com/cosmos72/gomacro/xreflect" +) + +// varSetValue compiles 'name = value' where value is a reflect.Value passed at runtime. +// Used to assign variables with the result of multi-valued expressions, +// and to implement multiple assignment var1, var2... = expr1, expr2... +func (c *Comp) varSetValue(va *Var) func(*Env, r.Value) { + t := va.Type + rt := t.ReflectType() + upn := va.Upn + desc := va.Desc + var ret func(env *Env, v r.Value) + + switch desc.Class() { + default: + c.Errorf("cannot assign to %v %s", desc.Class(), va.Name) + return nil + case VarBind: + // if current package is compiled, also variables with kind = Bool, Int*, Uint*, Float*, Complex64 will have class == VarBind + + index := desc.Index() + if index == NoIndex { + // assigning a value to _ has no effect at all + return nil + } + zero := xr.Zero(t) + switch upn { + case 0: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + env.Binds[index].SetBool(v.Bool()) + } + case r.Int, r.Int8, r.Int32, r.Int64: + ret = func(env *Env, v r.Value) { + env.Binds[index].SetInt(v.Int()) + } + case r.Uint, r.Uint8, r.Uint32, r.Uint64, r.Uintptr: + ret = func(env *Env, v r.Value) { + env.Binds[index].SetUint(v.Uint()) + } + case r.Float32, r.Float64: + ret = func(env *Env, v r.Value) { + env.Binds[index].SetFloat(v.Float()) + } + case r.Complex64, r.Complex128: + ret = func(env *Env, v r.Value) { + env.Binds[index].SetComplex(v.Complex()) + } + case r.String: + ret = func(env *Env, v r.Value) { + if v.Kind() != r.String { + v = v.Convert(TypeOfString) + } + env.Binds[index].SetString(v.String()) + } + case r.Chan, r.Interface, r.Map, r.Ptr, r.Slice: + ret = func(env *Env, v r.Value) { + if v == Nil || v == None { + v = zero + } else if v.Type() != rt { + v = v.Convert(rt) + } + env.Binds[index].Set(v) + } + default: + ret = func(env *Env, v r.Value) { + if v.Type() != rt { + v = v.Convert(rt) + } + env.Binds[index].Set(v) + } + } + case 1: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + env.Outer.Binds[index].SetBool(v.Bool()) + } + case r.Int, r.Int8, r.Int32, r.Int64: + ret = func(env *Env, v r.Value) { + env.Outer.Binds[index].SetInt(v.Int()) + } + case r.Uint, r.Uint8, r.Uint32, r.Uint64, r.Uintptr: + ret = func(env *Env, v r.Value) { + env.Outer.Binds[index].SetUint(v.Uint()) + } + case r.Float32, r.Float64: + ret = func(env *Env, v r.Value) { + env.Outer.Binds[index].SetFloat(v.Float()) + } + case r.Complex64, r.Complex128: + ret = func(env *Env, v r.Value) { + env.Outer.Binds[index].SetComplex(v.Complex()) + } + case r.String: + ret = func(env *Env, v r.Value) { + if v.Kind() != r.String { + v = v.Convert(TypeOfString) + } + env.Outer.Binds[index].SetString(v.String()) + } + case r.Chan, r.Interface, r.Map, r.Ptr, r.Slice: + ret = func(env *Env, v r.Value) { + if v == Nil || v == None { + v = zero + } else if v.Type() != rt { + v = v.Convert(rt) + } + env.Outer.Binds[index].Set(v) + } + default: + ret = func(env *Env, v r.Value) { + if v.Type() != rt { + v = v.Convert(rt) + } + env.Outer.Binds[index].Set(v) + } + } + case 2: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.Binds[index].SetBool(v.Bool()) + } + case r.Int, r.Int8, r.Int32, r.Int64: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.Binds[index].SetInt(v.Int()) + } + case r.Uint, r.Uint8, r.Uint32, r.Uint64, r.Uintptr: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.Binds[index].SetUint(v.Uint()) + } + case r.Float32, r.Float64: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.Binds[index].SetFloat(v.Float()) + } + case r.Complex64, r.Complex128: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.Binds[index].SetComplex(v.Complex()) + } + case r.String: + ret = func(env *Env, v r.Value) { + if v.Kind() != r.String { + v = v.Convert(TypeOfString) + } + env.Outer.Outer.Binds[index].SetString(v.String()) + } + case r.Chan, r.Interface, r.Map, r.Ptr, r.Slice: + ret = func(env *Env, v r.Value) { + if v == Nil || v == None { + v = zero + } else if v.Type() != rt { + v = v.Convert(rt) + } + env.Outer.Outer.Binds[index].Set(v) + } + default: + ret = func(env *Env, v r.Value) { + if v.Type() != rt { + v = v.Convert(rt) + } + env.Outer.Outer.Binds[index].Set(v) + } + } + default: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + o.Binds[index].SetBool(v.Bool()) + } + case r.Int, r.Int8, r.Int32, r.Int64: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + o.Binds[index].SetInt(v.Int()) + } + case r.Uint, r.Uint8, r.Uint32, r.Uint64, r.Uintptr: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + o.Binds[index].SetUint(v.Uint()) + } + case r.Float32, r.Float64: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + o.Binds[index].SetFloat(v.Float()) + } + case r.Complex64, r.Complex128: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + o.Binds[index].SetComplex(v.Complex()) + } + case r.String: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + if v.Kind() != r.String { + v = v.Convert(TypeOfString) + } + o.Binds[index].SetString(v.String()) + } + case r.Chan, r.Interface, r.Map, r.Ptr, r.Slice: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + if v == Nil || v == None { + v = zero + } else if v.Type() != rt { + v = v.Convert(rt) + } + o.Binds[index].Set(v) + } + default: + ret = func(env *Env, v r.Value) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + if v.Type() != rt { + v = v.Convert(rt) + } + o.Binds[index].Set(v) + } + } + } + case IntBind: + index := desc.Index() + if index == NoIndex { + // assigning a value to _ has no effect at all + return nil + } + switch upn { + case 0: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + *(*bool)(unsafe.Pointer(&env.IntBinds[index])) = v.Bool() + } + case r.Int: + ret = func(env *Env, v r.Value) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) = int(v.Int()) + } + case r.Int8: + ret = func(env *Env, v r.Value) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) = int8(v.Int()) + } + case r.Int16: + ret = func(env *Env, v r.Value) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) = int16(v.Int()) + } + case r.Int32: + ret = func(env *Env, v r.Value) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) = int32(v.Int()) + } + case r.Int64: + ret = func(env *Env, v r.Value) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) = v.Int() + } + case r.Uint: + ret = func(env *Env, v r.Value) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) = uint(v.Uint()) + } + case r.Uint8: + ret = func(env *Env, v r.Value) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) = uint8(v.Uint()) + } + case r.Uint16: + ret = func(env *Env, v r.Value) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) = uint16(v.Uint()) + } + case r.Uint32: + ret = func(env *Env, v r.Value) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) = uint32(v.Uint()) + } + case r.Uint64: + ret = func(env *Env, v r.Value) { + env.IntBinds[index] = v.Uint() + } + case r.Uintptr: + ret = func(env *Env, v r.Value) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) = uintptr(v.Uint()) + } + case r.Float32: + ret = func(env *Env, v r.Value) { + *(*float32)(unsafe.Pointer(&env.IntBinds[index])) = float32(v.Float()) + } + case r.Float64: + ret = func(env *Env, v r.Value) { + *(*float64)(unsafe.Pointer(&env.IntBinds[index])) = v.Float() + } + case r.Complex64: + ret = func(env *Env, v r.Value) { + *(*complex64)(unsafe.Pointer(&env.IntBinds[index])) = complex64(v.Complex()) + } + default: + c.Errorf("unsupported type, cannot use for optimized assignment: %s <%v>", va.Name, t) + return nil + } + case 1: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + *(*bool)(unsafe.Pointer(&env.Outer.IntBinds[index])) = v.Bool() + } + case r.Int: + ret = func(env *Env, v r.Value) { + *(*int)(unsafe.Pointer(&env.Outer.IntBinds[index])) = int(v.Int()) + } + case r.Int8: + ret = func(env *Env, v r.Value) { + *(*int8)(unsafe.Pointer(&env.Outer.IntBinds[index])) = int8(v.Int()) + } + case r.Int16: + ret = func(env *Env, v r.Value) { + *(*int16)(unsafe.Pointer(&env.Outer.IntBinds[index])) = int16(v.Int()) + } + case r.Int32: + ret = func(env *Env, v r.Value) { + *(*int32)(unsafe.Pointer(&env.Outer.IntBinds[index])) = int32(v.Int()) + } + case r.Int64: + ret = func(env *Env, v r.Value) { + *(*int64)(unsafe.Pointer(&env.Outer.IntBinds[index])) = v.Int() + } + case r.Uint: + ret = func(env *Env, v r.Value) { + *(*uint)(unsafe.Pointer(&env.Outer.IntBinds[index])) = uint(v.Uint()) + } + case r.Uint8: + ret = func(env *Env, v r.Value) { + *(*uint8)(unsafe.Pointer(&env.Outer.IntBinds[index])) = uint8(v.Uint()) + } + case r.Uint16: + ret = func(env *Env, v r.Value) { + *(*uint16)(unsafe.Pointer(&env.Outer.IntBinds[index])) = uint16(v.Uint()) + } + case r.Uint32: + ret = func(env *Env, v r.Value) { + *(*uint32)(unsafe.Pointer(&env.Outer.IntBinds[index])) = uint32(v.Uint()) + } + case r.Uint64: + ret = func(env *Env, v r.Value) { + env.Outer.IntBinds[index] = v.Uint() + } + case r.Uintptr: + ret = func(env *Env, v r.Value) { + *(*uintptr)(unsafe.Pointer(&env.Outer.IntBinds[index])) = uintptr(v.Uint()) + } + case r.Float32: + ret = func(env *Env, v r.Value) { + *(*float32)(unsafe.Pointer(&env.Outer.IntBinds[index])) = float32(v.Float()) + } + case r.Float64: + ret = func(env *Env, v r.Value) { + *(*float64)(unsafe.Pointer(&env.Outer.IntBinds[index])) = v.Float() + } + case r.Complex64: + ret = func(env *Env, v r.Value) { + *(*complex64)(unsafe.Pointer(&env.Outer.IntBinds[index])) = complex64(v.Complex()) + } + default: + c.Errorf("unsupported type, cannot use for optimized assignment: %s <%v>", va.Name, t) + return nil + } + case 2: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + *(*bool)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = v.Bool() + } + case r.Int: + ret = func(env *Env, v r.Value) { + *(*int)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = int(v.Int()) + } + case r.Int8: + ret = func(env *Env, v r.Value) { + *(*int8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = int8(v.Int()) + } + case r.Int16: + ret = func(env *Env, v r.Value) { + *(*int16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = int16(v.Int()) + } + case r.Int32: + ret = func(env *Env, v r.Value) { + *(*int32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = int32(v.Int()) + } + case r.Int64: + ret = func(env *Env, v r.Value) { + *(*int64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = v.Int() + } + case r.Uint: + ret = func(env *Env, v r.Value) { + *(*uint)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = uint(v.Uint()) + } + case r.Uint8: + ret = func(env *Env, v r.Value) { + *(*uint8)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = uint8(v.Uint()) + } + case r.Uint16: + ret = func(env *Env, v r.Value) { + *(*uint16)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = uint16(v.Uint()) + } + case r.Uint32: + ret = func(env *Env, v r.Value) { + *(*uint32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = uint32(v.Uint()) + } + case r.Uint64: + ret = func(env *Env, v r.Value) { + env.Outer.Outer.IntBinds[index] = v.Uint() + } + case r.Uintptr: + ret = func(env *Env, v r.Value) { + *(*uintptr)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = uintptr(v.Uint()) + } + case r.Float32: + ret = func(env *Env, v r.Value) { + *(*float32)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = float32(v.Float()) + } + case r.Float64: + ret = func(env *Env, v r.Value) { + *(*float64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = v.Float() + } + case r.Complex64: + ret = func(env *Env, v r.Value) { + *(*complex64)(unsafe.Pointer(&env.Outer.Outer.IntBinds[index])) = complex64(v.Complex()) + } + default: + c.Errorf("unsupported type, cannot use for optimized assignment: %s <%v>", va.Name, t) + return nil + } + default: + switch t.Kind() { + case r.Bool: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*bool)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = v.Bool() + } + case r.Int: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*int)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = int(v.Int()) + } + case r.Int8: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*int8)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = int8(v.Int()) + } + case r.Int16: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*int16)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = int16(v.Int()) + } + case r.Int32: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*int32)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = int32(v.Int()) + } + case r.Int64: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*int64)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = v.Int() + } + case r.Uint: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*uint)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = uint(v.Uint()) + } + case r.Uint8: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*uint8)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = uint8(v.Uint()) + } + case r.Uint16: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*uint16)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = uint16(v.Uint()) + } + case r.Uint32: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*uint32)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = uint32(v.Uint()) + } + case r.Uint64: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + env.Outer.Outer.Outer.IntBinds[index] = v.Uint() + } + case r.Uintptr: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*uintptr)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = uintptr(v.Uint()) + } + case r.Float32: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*float32)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = float32(v.Float()) + } + case r.Float64: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*float64)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = v.Float() + } + case r.Complex64: + ret = func(env *Env, v r.Value) { + for i := 3; i < upn; i++ { + env = env.Outer + } + *(*complex64)(unsafe.Pointer(&env.Outer.Outer.Outer.IntBinds[index])) = complex64(v.Complex()) + } + default: + c.Errorf("unsupported type, cannot use for optimized assignment: %s <%v>", va.Name, t) + return nil + } + } + } + return ret +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_shifts.go b/vendor/github.com/cosmos72/gomacro/fast/var_shifts.go new file mode 100644 index 0000000..e54d04b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_shifts.go @@ -0,0 +1,5969 @@ +// ------------------------------------------------------------- +// DO NOT EDIT! this file was generated automatically by gomacro +// Any change will be lost when the file is re-generated +// ------------------------------------------------------------- + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_shifts.go + * + * Created on May 17, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" +) + +func (c *Comp) varShlConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := r.TypeOf(val) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + } + + if isLiteralNumber(val, 0) { + return + } + { + val := r.ValueOf(val).Uint() + var ret Stmt + switch t.Kind() { + case r.Int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o.IntBinds[index] <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + + } + c.append(ret) + } +} +func (c *Comp) varShlExpr(va *Var, function I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := funTypeOut(function) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + } + + fun := asFunUint8(function) + { + var ret Stmt + switch t.Kind() { + case r.Int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o.IntBinds[index] <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) <<= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() << + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + + } + c.append(ret) + } +} +func (c *Comp) varShrConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := r.TypeOf(val) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + } + + if isLiteralNumber(val, 0) { + return + } + { + val := r.ValueOf(val).Uint() + var ret Stmt + switch t.Kind() { + case r.Int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o.IntBinds[index] >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= val + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + val, + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + + } + c.append(ret) + } +} +func (c *Comp) varShrExpr(va *Var, function I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := funTypeOut(function) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + } + + fun := asFunUint8(function) + { + var ret Stmt + switch t.Kind() { + case r.Int: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int8)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int16)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int32)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Int64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*int64)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*int64)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetInt(lhs.Int() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint8: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint8)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint8)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint16: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint16)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint16)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint32: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uint32)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uint32)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uint64: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + IntBinds[index] >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer. + IntBinds[index] >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env. + Outer.Outer. + IntBinds[index] >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + + o.IntBinds[index] >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + env.ThreadGlobals.FileEnv. + IntBinds[index] >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + case r.Uintptr: + switch upn { + case 0: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case 2: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env. + Outer.Outer.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env. + Outer.Outer. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + default: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + *(*uintptr)(unsafe.Pointer(&o.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + { + lhs := + + o.Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + case c.Depth - 1: + + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + *(*uintptr)(unsafe.Pointer(&env.ThreadGlobals.FileEnv.IntBinds[index])) >>= fun(env) + + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + { + lhs := env.ThreadGlobals.FileEnv. + Binds[index] + lhs.SetUint(lhs.Uint() >> + fun(env), + ) + } + + env.IP++ + return env.Code[env.IP], env + } + } + } + default: + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + + } + c.append(ret) + } +} +func asFunUint8(fun I) func(*Env) uint8 { + var f func(*Env) uint8 + switch fun := fun.(type) { + case func(*Env) uint: + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + case func(*Env) uint8: + f = fun + case func(*Env) uint16: + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + case func(*Env) uint32: + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + + case func(*Env) uint64: + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + + case func(*Env) uintptr: + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + + } + return f +} diff --git a/vendor/github.com/cosmos72/gomacro/fast/var_shifts.gomacro b/vendor/github.com/cosmos72/gomacro/fast/var_shifts.gomacro new file mode 100644 index 0000000..194c3a8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/var_shifts.gomacro @@ -0,0 +1,417 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * var_shifts.go + * + * Created on May 17, 2017 + * Author Massimiliano Ghilardi + */ + +package fast + +import ( + "go/token" + r "reflect" + "unsafe" + + . "github.com/cosmos72/gomacro/base" +) + +:import ( + "fmt" + "go/ast" + "go/token" + r "reflect" +) + +:func upcasefirstbyte(str string) string { + if len(str) > 0 && str[0] >= 'a' && str[0] <= 'z' { + bytes := []byte(str) + bytes[0] -= 'a' - 'A' + return string(bytes) + } + return str +} + +:func makekind(typ ast.Node) ast.Node { + t := EvalType(typ) + if t == nil { + return nil + } + // go/ast.SelectorExpr requires the foo in r.foo to be an *ast.Ident, cannot unquote there + kind := ~"{r . foo} + kind.Sel = &ast.Ident{Name: upcasefirstbyte(t.Name())} + return kind +} + + +:func convertvalue1(typ, val ast.Node) ast.Node { + var t r.Type = EvalType(typ) + if t == nil { + return val + } + // unwrap the result + tname := t.Name() + // remove final digits from t.Name() + // needed to convert Uint64 -> Uint etc. to calls reflect.Value.{tname} + for len(tname) != 0 { + ch := tname[len(tname)-1] + if ch < '0' || ch > '9' { + break + } + tname = tname[0:len(tname)-1] + } + if tname == "uintptr" { + tname = "uint" // use reflect.Value.Uint() + } + sel := ~"{~,val . foo} // we modify it destructively + sel.Sel = &ast.Ident{Name: upcasefirstbyte(tname)} + + switch t.Kind() { + case r.Bool, r.Int64, r.Uint64, r.Float64, r.Complex128, r.String: + // result of reflect.Value.{tname} is already the correct type + val = ~"{~,sel ()} + default: + // convert int64, uint64... to the correct type + val = ~"{~,typ ( ~,sel () )} + } + return val +} + +:func op_to_assign(op token.Token) token.Token { + switch op { + case token.ADD: + op = token.ADD_ASSIGN + case token.SUB: + op = token.SUB_ASSIGN + case token.MUL: + op = token.MUL_ASSIGN + case token.QUO: + op = token.QUO_ASSIGN + case token.REM: + op = token.REM_ASSIGN + case token.AND: + op = token.AND_ASSIGN + case token.OR: + op = token.OR_ASSIGN + case token.XOR: + op = token.XOR_ASSIGN + case token.SHL: + op = token.SHL_ASSIGN + case token.SHR: + op = token.SHR_ASSIGN + case token.AND_NOT: + op = token.AND_NOT_ASSIGN + default: + panic(fmt.Sprintf("cannot convert token %s to assignment token", op)) + } + return op +} + +:func fgetplace(depth, typ ast.Node) (/*loop*/ *ast.BlockStmt, /*env*/ ast.Node) { + // the return type of Eval() and EvalType() varies. better check early. + upn := Eval(depth).(int) + var t r.Type = EvalType(typ) + var env ast.Node + var loop *ast.BlockStmt + + if upn >= 0 { + env = ~'{env} + for i := 0; i < upn; i++ { + env = ~"{~,env . Outer} + } + } else if upn == -2 { + env = ~'{env.ThreadGlobals.FileEnv} + } else if upn == -3 { + env = ~'{env.ThreadGlobals.TopEnv} + } else { + loop = ~'{ + o := env.Outer.Outer.Outer + for i := 3; i < upn; i++ { + o = o.Outer + } + } + env = ~'o + } + return loop, env +} + +:func fsetplace(opnode, depth, typ, expr, exprv ast.Node) ast.Node { + loop, env := fgetplace(depth, typ) + // the return type of Eval() and EvalType() varies. better check early. + var t r.Type = EvalType(typ) + op := Eval(opnode).(token.Token) + opset := op_to_assign(op) + var bind, cbind ast.Node + + var assign *ast.AssignStmt = ~"{*(*~,typ)(unsafe.Pointer(& ~,env .IntBinds[index])) += ~,expr} + assign.Tok = opset + bind = assign + + switch t.Kind() { + case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: + var result *ast.BinaryExpr = ~"{lhs.Int() + ~,expr} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetInt(~,result)} + case r.Uint, r.Uint8, r.Uint16, r.Uint32, r.Uint64, r.Uintptr: + var result *ast.BinaryExpr = ~"{lhs.Uint() + ~,expr} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetUint(~,result)} + if t.Kind() == r.Uint64 { + var assign *ast.AssignStmt = ~"{~,env . IntBinds[index] += ~,expr} + assign.Tok = opset + bind = assign + } + case r.Float32, r.Float64: + var result *ast.BinaryExpr = ~"{lhs.Float() + ~,expr} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetFloat(~,result)} + case r.Complex64: + var result *ast.BinaryExpr = ~"{lhs.Complex() + ~,expr} + result.Op = op + cbind = ~"{lhs := ~,env . Binds[index]; lhs.SetComplex(~,result)} + case r.Complex128: + var result *ast.BinaryExpr = ~"{lhs.Complex() + ~,expr} + result.Op = op + bind = ~"{lhs := ~,env . Binds[index]; lhs.SetComplex(~,result)} + case r.String: + var result *ast.BinaryExpr = ~"{lhs.String() + ~,expr} + result.Op = op + bind = ~"{lhs := ~,env . Binds[index]; lhs.SetString(~,result)} + } + + if cbind == nil { + return ~"{ + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } + } + + return ~"{ + if intbinds { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,bind + env.IP++ + return env.Code[env.IP], env + } + } else { + ret = func(env *Env) (Stmt, *Env) { + ~,@loop + ~,cbind + env.IP++ + return env.Code[env.IP], env + } + } + } +} + +:macro setplace_const(opnode, depth, typ ast.Node) ast.Node { + return fsetplace(opnode, depth, typ, ~'val, ~'v) +} + +:macro setplace_expr(opnode, depth, typ ast.Node) ast.Node { + return fsetplace(opnode, depth, typ, ~'{fun(env)}, ~'{fun(env).Convert(t)}) +} + +:macro setplace_depth_const(opnode, typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: setplace_const; ~,opnode; 0; ~,typ + case 1: setplace_const; ~,opnode; 1; ~,typ + case 2: setplace_const; ~,opnode; 2; ~,typ + default: setplace_const; ~,opnode;-1; ~,typ + case c.Depth-1: setplace_const; ~,opnode;-2; ~,typ + } + } +} + +:macro setplace_depth_expr(opnode, typ ast.Node) ast.Node { + return ~"{ + switch upn { + case 0: setplace_expr; ~,opnode; 0; ~,typ + case 1: setplace_expr; ~,opnode; 1; ~,typ + case 2: setplace_expr; ~,opnode; 2; ~,typ + default: setplace_expr; ~,opnode;-1; ~,typ + case c.Depth-1: setplace_expr; ~,opnode;-2; ~,typ + } + } +} + +:func list_types(typelist []ast.Stmt) []ast.Node { + rets := make([]ast.Node, 0, len(typelist)) + for _, typ := range typelist { + t := EvalType(typ) + if t == nil { + rets = append(rets, ~'nil) + } else if t.Kind() == r.Int { + rets = append(rets, ~'int, ~'int8, ~'int16, ~'int32, ~'int64) + } else if t.Kind() == r.Uint { + rets = append(rets, ~'uint, ~'uint8, ~'uint16, ~'uint32, ~'uint64, ~'uintptr) + } else if t.Kind() == r.Float64 { + rets = append(rets, ~'float32, ~'float64) + } else if t.Kind() == r.Complex128 { + rets = append(rets, ~'complex64, ~'complex128) + } else { + rets = append(rets, typ) + } + } + return rets +} + +:macro setplaces_depth_const(opnode, types ast.Node) ast.Node { + typelist := list_types(types.(*ast.BlockStmt).List) + caselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= between <%v> and <%v>`, ~,opnode, t, t2)} + } else { + kind := makekind(typ) + caselist[i] = ~"{case ~,kind: setplace_depth_const; ~,opnode; ~,typ} + } + } + return ~"{ + val := r.ValueOf(val).Uint() + var ret Stmt + switch t.Kind() { + ~,@caselist + } + c.append(ret) + } +} + +:macro setplaces_depth_expr(opnode, types ast.Node) ast.Node { + typelist := list_types(types.(*ast.BlockStmt).List) + caselist := make([]ast.Stmt, len(typelist)) + for i, typ := range typelist { + if EvalType(typ) == nil { + caselist[i] = ~"{default: c.Errorf(`invalid operator %s= between <%v> and <%v>`, ~,opnode, t, t2)} + } else { + kind := makekind(typ) + caselist[i] = ~"{case ~,kind: setplace_depth_expr; ~,opnode; ~,typ} + } + } + return ~"{ + var ret Stmt + switch t.Kind() { + ~,@caselist + } + c.append(ret) + } +} + +// varShlConst compiles 'variable <<= constant' +func (c *Comp) varShlConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := r.TypeOf(val) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + } + if isLiteralNumber(val, 0) { + return + } + setplaces_depth_const; token.SHL; {int; uint; nil} +} + +// varShlExpr compiles 'variable <<= expression' +func (c *Comp) varShlExpr(va *Var, function I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := funTypeOut(function) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHL, t, t2) + } + fun := asFunUint8(function) + setplaces_depth_expr; token.SHL; {int; uint; nil} +} + +// varShrConst compiles 'variable >>= constant' +func (c *Comp) varShrConst(va *Var, val I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := r.TypeOf(val) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + } + if isLiteralNumber(val, 0) { + return + } + setplaces_depth_const; token.SHR; {int; uint; nil} +} + +// varShrExpr compiles 'variable >>= expression' +func (c *Comp) varShrExpr(va *Var, function I) { + t := va.Type + upn := va.Upn + index := va.Desc.Index() + intbinds := va.Desc.Class() == IntBind + + t2 := funTypeOut(function) + if t2 == nil || KindToCategory(t2.Kind()) != r.Uint { + c.Errorf(`invalid operator %s= between <%v> and <%v>`, token.SHR, t, t2) + } + fun := asFunUint8(function) + setplaces_depth_expr; token.SHR; {int; uint; nil} +} + +:macro mfun8() ast.Node { + return ~'{ + return func(env *Env) uint8 { + val := fun(env) + if val > 255 { + val = 255 + } + return uint8(val) + } + } +} + +func asFunUint8(fun I) func(*Env) uint8 { + var f func(*Env) uint8 + switch fun := fun.(type) { + case func(*Env) uint: + mfun8 + case func(*Env) uint8: + f = fun + case func(*Env) uint16: + mfun8 + case func(*Env) uint32: + mfun8 + case func(*Env) uint64: + mfun8 + case func(*Env) uintptr: + mfun8 + } + return f +} + diff --git a/vendor/github.com/cosmos72/gomacro/fast/x_package.go b/vendor/github.com/cosmos72/gomacro/fast/x_package.go new file mode 100644 index 0000000..5da87bb --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/fast/x_package.go @@ -0,0 +1,96 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/fast" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package fast + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/fast" +func init() { + imports.Packages["github.com/cosmos72/gomacro/fast"] = imports.Package{ + Binds: map[string]r.Value{ + "AnyDepth": r.ValueOf(AnyDepth), + "ConstBind": r.ValueOf(ConstBind), + "ConstBindDescriptor": r.ValueOf(ConstBindDescriptor), + "FileDepth": r.ValueOf(FileDepth), + "FuncBind": r.ValueOf(FuncBind), + "IntBind": r.ValueOf(IntBind), + "Interrupt": r.ValueOf(&Interrupt).Elem(), + "MakeBindDescriptor": r.ValueOf(MakeBindDescriptor), + "New": r.ValueOf(New), + "NewComp": r.ValueOf(NewComp), + "NewCompEnv": r.ValueOf(NewCompEnv), + "NewCompEnvTop": r.ValueOf(NewCompEnvTop), + "NewEnv": r.ValueOf(NewEnv), + "NewEnv4Func": r.ValueOf(NewEnv4Func), + "NewThreadGlobals": r.ValueOf(NewThreadGlobals), + "NoIndex": r.ValueOf(NoIndex), + "OptDefaults": r.ValueOf(OptDefaults), + "OptKeepUntyped": r.ValueOf(OptKeepUntyped), + "OptIsCompiled": r.ValueOf(OptIsCompiled), + "PlaceAddress": r.ValueOf(PlaceAddress), + "PlaceSettable": r.ValueOf(PlaceSettable), + "PoolCapacity": r.ValueOf(PoolCapacity), + "SigDefer": r.ValueOf(SigDefer), + "SigNone": r.ValueOf(SigNone), + "SigReturn": r.ValueOf(SigReturn), + "TopDepth": r.ValueOf(TopDepth), + "VarBind": r.ValueOf(VarBind), + }, Types: map[string]r.Type{ + "Assign": r.TypeOf((*Assign)(nil)).Elem(), + "Bind": r.TypeOf((*Bind)(nil)).Elem(), + "BindClass": r.TypeOf((*BindClass)(nil)).Elem(), + "BindDescriptor": r.TypeOf((*BindDescriptor)(nil)).Elem(), + "Builtin": r.TypeOf((*Builtin)(nil)).Elem(), + "Call": r.TypeOf((*Call)(nil)).Elem(), + "Code": r.TypeOf((*Code)(nil)).Elem(), + "Comp": r.TypeOf((*Comp)(nil)).Elem(), + "CompThreadGlobals": r.TypeOf((*CompThreadGlobals)(nil)).Elem(), + "CompileOptions": r.TypeOf((*CompileOptions)(nil)).Elem(), + "Env": r.TypeOf((*Env)(nil)).Elem(), + "Expr": r.TypeOf((*Expr)(nil)).Elem(), + "FuncInfo": r.TypeOf((*FuncInfo)(nil)).Elem(), + "Function": r.TypeOf((*Function)(nil)).Elem(), + "I": r.TypeOf((*I)(nil)).Elem(), + "Import": r.TypeOf((*Import)(nil)).Elem(), + "Interp": r.TypeOf((*Interp)(nil)).Elem(), + "Lit": r.TypeOf((*Lit)(nil)).Elem(), + "LoopInfo": r.TypeOf((*LoopInfo)(nil)).Elem(), + "Macro": r.TypeOf((*Macro)(nil)).Elem(), + "NamedType": r.TypeOf((*NamedType)(nil)).Elem(), + "Place": r.TypeOf((*Place)(nil)).Elem(), + "PlaceOption": r.TypeOf((*PlaceOption)(nil)).Elem(), + "Signal": r.TypeOf((*Signal)(nil)).Elem(), + "Stmt": r.TypeOf((*Stmt)(nil)).Elem(), + "Symbol": r.TypeOf((*Symbol)(nil)).Elem(), + "ThreadGlobals": r.TypeOf((*ThreadGlobals)(nil)).Elem(), + "TypeAssertionError": r.TypeOf((*TypeAssertionError)(nil)).Elem(), + "UntypedLit": r.TypeOf((*UntypedLit)(nil)).Elem(), + "Var": r.TypeOf((*Var)(nil)).Elem(), + }, Proxies: map[string]r.Type{ + "I": r.TypeOf((*I_github_com_cosmos72_gomacro_fast)(nil)).Elem(), + }, Untypeds: map[string]string{ + "AnyDepth": "int:-1", + "FileDepth": "int:-2", + "PoolCapacity": "int:32", + "TopDepth": "int:-3", + }, Wrappers: map[string][]string{ + "Bind": []string{"ConstTo", "DefaultType", "ReflectValue", "Untyped", "UntypedKind"}, + "Comp": []string{"CollectAst", "CollectNode", "CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "IncLine", "IncLineBytes", "Init", "LookupPackage", "ParseBytes", "Position", "Sprintf", "ToString", "TypeOfBool", "TypeOfBuiltin", "TypeOfComplex128", "TypeOfComplex64", "TypeOfError", "TypeOfFloat32", "TypeOfFloat64", "TypeOfFunction", "TypeOfImport", "TypeOfInt", "TypeOfInt16", "TypeOfInt32", "TypeOfInt64", "TypeOfInt8", "TypeOfInterface", "TypeOfMacro", "TypeOfString", "TypeOfUint", "TypeOfUint16", "TypeOfUint32", "TypeOfUint64", "TypeOfUint8", "TypeOfUintptr", "TypeOfUntypedLit", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + "CompThreadGlobals": []string{"CollectAst", "CollectNode", "CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "ImportPackage", "IncLine", "IncLineBytes", "Init", "LookupPackage", "ParseBytes", "Position", "Sprintf", "ToString", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + "Expr": []string{"ReflectValue", "Untyped", "UntypedKind"}, + "Place": []string{"Address", "AsPlace", "AsSymbol"}, + "Symbol": []string{"AsSymbol", "Const", "ConstTo", "ConstValue", "DefaultType", "ReflectValue", "String", "Untyped", "UntypedKind"}, + "ThreadGlobals": []string{"CollectAst", "CollectNode", "CollectPackageImports", "Copy", "Debugf", "Error", "Errorf", "Fprintf", "Gensym", "GensymEmbedded", "GensymPrivate", "ImportPackage", "IncLine", "IncLineBytes", "Init", "LookupPackage", "ParseBytes", "Position", "Sprintf", "ToString", "WarnExtraValues", "Warnf", "WriteDeclsToFile", "WriteDeclsToStream"}, + }, + } +} + +// --------------- proxy for github.com/cosmos72/gomacro/fast.I --------------- +type I_github_com_cosmos72_gomacro_fast struct { + Object interface{} +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/archive_tar.go b/vendor/github.com/cosmos72/gomacro/imports/archive_tar.go new file mode 100644 index 0000000..c8b57e7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/archive_tar.go @@ -0,0 +1,57 @@ +// this file was generated by gomacro command: import _b "archive/tar" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "archive/tar" +) + +// reflection: allow interpreted code to import "archive/tar" +func init() { + Packages["archive/tar"] = Package{ + Binds: map[string]Value{ + "ErrFieldTooLong": ValueOf(&tar.ErrFieldTooLong).Elem(), + "ErrHeader": ValueOf(&tar.ErrHeader).Elem(), + "ErrWriteAfterClose": ValueOf(&tar.ErrWriteAfterClose).Elem(), + "ErrWriteTooLong": ValueOf(&tar.ErrWriteTooLong).Elem(), + "FileInfoHeader": ValueOf(tar.FileInfoHeader), + "NewReader": ValueOf(tar.NewReader), + "NewWriter": ValueOf(tar.NewWriter), + "TypeBlock": ValueOf(tar.TypeBlock), + "TypeChar": ValueOf(tar.TypeChar), + "TypeCont": ValueOf(tar.TypeCont), + "TypeDir": ValueOf(tar.TypeDir), + "TypeFifo": ValueOf(tar.TypeFifo), + "TypeGNULongLink": ValueOf(tar.TypeGNULongLink), + "TypeGNULongName": ValueOf(tar.TypeGNULongName), + "TypeGNUSparse": ValueOf(tar.TypeGNUSparse), + "TypeLink": ValueOf(tar.TypeLink), + "TypeReg": ValueOf(tar.TypeReg), + "TypeRegA": ValueOf(tar.TypeRegA), + "TypeSymlink": ValueOf(tar.TypeSymlink), + "TypeXGlobalHeader": ValueOf(tar.TypeXGlobalHeader), + "TypeXHeader": ValueOf(tar.TypeXHeader), + },Types: map[string]Type{ + "Header": TypeOf((*tar.Header)(nil)).Elem(), + "Reader": TypeOf((*tar.Reader)(nil)).Elem(), + "Writer": TypeOf((*tar.Writer)(nil)).Elem(), + },Untypeds: map[string]string{ + "TypeBlock": "rune:52", + "TypeChar": "rune:51", + "TypeCont": "rune:55", + "TypeDir": "rune:53", + "TypeFifo": "rune:54", + "TypeGNULongLink": "rune:75", + "TypeGNULongName": "rune:76", + "TypeGNUSparse": "rune:83", + "TypeLink": "rune:49", + "TypeReg": "rune:48", + "TypeRegA": "rune:0", + "TypeSymlink": "rune:50", + "TypeXGlobalHeader": "rune:103", + "TypeXHeader": "rune:120", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/archive_zip.go b/vendor/github.com/cosmos72/gomacro/imports/archive_zip.go new file mode 100644 index 0000000..10db346 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/archive_zip.go @@ -0,0 +1,39 @@ +// this file was generated by gomacro command: import _b "archive/zip" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "archive/zip" +) + +// reflection: allow interpreted code to import "archive/zip" +func init() { + Packages["archive/zip"] = Package{ + Binds: map[string]Value{ + "Deflate": ValueOf(zip.Deflate), + "ErrAlgorithm": ValueOf(&zip.ErrAlgorithm).Elem(), + "ErrChecksum": ValueOf(&zip.ErrChecksum).Elem(), + "ErrFormat": ValueOf(&zip.ErrFormat).Elem(), + "FileInfoHeader": ValueOf(zip.FileInfoHeader), + "NewReader": ValueOf(zip.NewReader), + "NewWriter": ValueOf(zip.NewWriter), + "OpenReader": ValueOf(zip.OpenReader), + "RegisterCompressor": ValueOf(zip.RegisterCompressor), + "RegisterDecompressor": ValueOf(zip.RegisterDecompressor), + "Store": ValueOf(zip.Store), + },Types: map[string]Type{ + "Compressor": TypeOf((*zip.Compressor)(nil)).Elem(), + "Decompressor": TypeOf((*zip.Decompressor)(nil)).Elem(), + "File": TypeOf((*zip.File)(nil)).Elem(), + "FileHeader": TypeOf((*zip.FileHeader)(nil)).Elem(), + "ReadCloser": TypeOf((*zip.ReadCloser)(nil)).Elem(), + "Reader": TypeOf((*zip.Reader)(nil)).Elem(), + "Writer": TypeOf((*zip.Writer)(nil)).Elem(), + },Wrappers: map[string][]string{ + "File": []string{"FileInfo","ModTime","Mode","SetModTime","SetMode",}, + "ReadCloser": []string{"RegisterDecompressor",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/bufio.go b/vendor/github.com/cosmos72/gomacro/imports/bufio.go new file mode 100644 index 0000000..c35c44f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/bufio.go @@ -0,0 +1,46 @@ +// this file was generated by gomacro command: import _b "bufio" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "bufio" +) + +// reflection: allow interpreted code to import "bufio" +func init() { + Packages["bufio"] = Package{ + Binds: map[string]Value{ + "ErrAdvanceTooFar": ValueOf(&bufio.ErrAdvanceTooFar).Elem(), + "ErrBufferFull": ValueOf(&bufio.ErrBufferFull).Elem(), + "ErrFinalToken": ValueOf(&bufio.ErrFinalToken).Elem(), + "ErrInvalidUnreadByte": ValueOf(&bufio.ErrInvalidUnreadByte).Elem(), + "ErrInvalidUnreadRune": ValueOf(&bufio.ErrInvalidUnreadRune).Elem(), + "ErrNegativeAdvance": ValueOf(&bufio.ErrNegativeAdvance).Elem(), + "ErrNegativeCount": ValueOf(&bufio.ErrNegativeCount).Elem(), + "ErrTooLong": ValueOf(&bufio.ErrTooLong).Elem(), + "MaxScanTokenSize": ValueOf(bufio.MaxScanTokenSize), + "NewReadWriter": ValueOf(bufio.NewReadWriter), + "NewReader": ValueOf(bufio.NewReader), + "NewReaderSize": ValueOf(bufio.NewReaderSize), + "NewScanner": ValueOf(bufio.NewScanner), + "NewWriter": ValueOf(bufio.NewWriter), + "NewWriterSize": ValueOf(bufio.NewWriterSize), + "ScanBytes": ValueOf(bufio.ScanBytes), + "ScanLines": ValueOf(bufio.ScanLines), + "ScanRunes": ValueOf(bufio.ScanRunes), + "ScanWords": ValueOf(bufio.ScanWords), + },Types: map[string]Type{ + "ReadWriter": TypeOf((*bufio.ReadWriter)(nil)).Elem(), + "Reader": TypeOf((*bufio.Reader)(nil)).Elem(), + "Scanner": TypeOf((*bufio.Scanner)(nil)).Elem(), + "SplitFunc": TypeOf((*bufio.SplitFunc)(nil)).Elem(), + "Writer": TypeOf((*bufio.Writer)(nil)).Elem(), + },Untypeds: map[string]string{ + "MaxScanTokenSize": "int:65536", + },Wrappers: map[string][]string{ + "ReadWriter": []string{"Available","Buffered","Discard","Flush","Peek","Read","ReadByte","ReadBytes","ReadFrom","ReadLine","ReadRune","ReadSlice","ReadString","Reset","UnreadByte","UnreadRune","Write","WriteByte","WriteRune","WriteString","WriteTo",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/bytes.go b/vendor/github.com/cosmos72/gomacro/imports/bytes.go new file mode 100644 index 0000000..63cef80 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/bytes.go @@ -0,0 +1,72 @@ +// this file was generated by gomacro command: import _b "bytes" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "bytes" +) + +// reflection: allow interpreted code to import "bytes" +func init() { + Packages["bytes"] = Package{ + Binds: map[string]Value{ + "Compare": ValueOf(bytes.Compare), + "Contains": ValueOf(bytes.Contains), + "ContainsAny": ValueOf(bytes.ContainsAny), + "ContainsRune": ValueOf(bytes.ContainsRune), + "Count": ValueOf(bytes.Count), + "Equal": ValueOf(bytes.Equal), + "EqualFold": ValueOf(bytes.EqualFold), + "ErrTooLarge": ValueOf(&bytes.ErrTooLarge).Elem(), + "Fields": ValueOf(bytes.Fields), + "FieldsFunc": ValueOf(bytes.FieldsFunc), + "HasPrefix": ValueOf(bytes.HasPrefix), + "HasSuffix": ValueOf(bytes.HasSuffix), + "Index": ValueOf(bytes.Index), + "IndexAny": ValueOf(bytes.IndexAny), + "IndexByte": ValueOf(bytes.IndexByte), + "IndexFunc": ValueOf(bytes.IndexFunc), + "IndexRune": ValueOf(bytes.IndexRune), + "Join": ValueOf(bytes.Join), + "LastIndex": ValueOf(bytes.LastIndex), + "LastIndexAny": ValueOf(bytes.LastIndexAny), + "LastIndexByte": ValueOf(bytes.LastIndexByte), + "LastIndexFunc": ValueOf(bytes.LastIndexFunc), + "Map": ValueOf(bytes.Map), + "MinRead": ValueOf(bytes.MinRead), + "NewBuffer": ValueOf(bytes.NewBuffer), + "NewBufferString": ValueOf(bytes.NewBufferString), + "NewReader": ValueOf(bytes.NewReader), + "Repeat": ValueOf(bytes.Repeat), + "Replace": ValueOf(bytes.Replace), + "Runes": ValueOf(bytes.Runes), + "Split": ValueOf(bytes.Split), + "SplitAfter": ValueOf(bytes.SplitAfter), + "SplitAfterN": ValueOf(bytes.SplitAfterN), + "SplitN": ValueOf(bytes.SplitN), + "Title": ValueOf(bytes.Title), + "ToLower": ValueOf(bytes.ToLower), + "ToLowerSpecial": ValueOf(bytes.ToLowerSpecial), + "ToTitle": ValueOf(bytes.ToTitle), + "ToTitleSpecial": ValueOf(bytes.ToTitleSpecial), + "ToUpper": ValueOf(bytes.ToUpper), + "ToUpperSpecial": ValueOf(bytes.ToUpperSpecial), + "Trim": ValueOf(bytes.Trim), + "TrimFunc": ValueOf(bytes.TrimFunc), + "TrimLeft": ValueOf(bytes.TrimLeft), + "TrimLeftFunc": ValueOf(bytes.TrimLeftFunc), + "TrimPrefix": ValueOf(bytes.TrimPrefix), + "TrimRight": ValueOf(bytes.TrimRight), + "TrimRightFunc": ValueOf(bytes.TrimRightFunc), + "TrimSpace": ValueOf(bytes.TrimSpace), + "TrimSuffix": ValueOf(bytes.TrimSuffix), + },Types: map[string]Type{ + "Buffer": TypeOf((*bytes.Buffer)(nil)).Elem(), + "Reader": TypeOf((*bytes.Reader)(nil)).Elem(), + },Untypeds: map[string]string{ + "MinRead": "int:512", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/compress_bzip2.go b/vendor/github.com/cosmos72/gomacro/imports/compress_bzip2.go new file mode 100644 index 0000000..2e5c3b3 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/compress_bzip2.go @@ -0,0 +1,20 @@ +// this file was generated by gomacro command: import _b "compress/bzip2" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "compress/bzip2" +) + +// reflection: allow interpreted code to import "compress/bzip2" +func init() { + Packages["compress/bzip2"] = Package{ + Binds: map[string]Value{ + "NewReader": ValueOf(bzip2.NewReader), + },Types: map[string]Type{ + "StructuralError": TypeOf((*bzip2.StructuralError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/compress_flate.go b/vendor/github.com/cosmos72/gomacro/imports/compress_flate.go new file mode 100644 index 0000000..94bbcb4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/compress_flate.go @@ -0,0 +1,66 @@ +// this file was generated by gomacro command: import _b "compress/flate" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "compress/flate" + "io" +) + +// reflection: allow interpreted code to import "compress/flate" +func init() { + Packages["compress/flate"] = Package{ + Binds: map[string]Value{ + "BestCompression": ValueOf(flate.BestCompression), + "BestSpeed": ValueOf(flate.BestSpeed), + "DefaultCompression": ValueOf(flate.DefaultCompression), + "HuffmanOnly": ValueOf(flate.HuffmanOnly), + "NewReader": ValueOf(flate.NewReader), + "NewReaderDict": ValueOf(flate.NewReaderDict), + "NewWriter": ValueOf(flate.NewWriter), + "NewWriterDict": ValueOf(flate.NewWriterDict), + "NoCompression": ValueOf(flate.NoCompression), + },Types: map[string]Type{ + "CorruptInputError": TypeOf((*flate.CorruptInputError)(nil)).Elem(), + "InternalError": TypeOf((*flate.InternalError)(nil)).Elem(), + "ReadError": TypeOf((*flate.ReadError)(nil)).Elem(), + "Reader": TypeOf((*flate.Reader)(nil)).Elem(), + "Resetter": TypeOf((*flate.Resetter)(nil)).Elem(), + "WriteError": TypeOf((*flate.WriteError)(nil)).Elem(), + "Writer": TypeOf((*flate.Writer)(nil)).Elem(), + },Proxies: map[string]Type{ + "Reader": TypeOf((*Reader_compress_flate)(nil)).Elem(), + "Resetter": TypeOf((*Resetter_compress_flate)(nil)).Elem(), + },Untypeds: map[string]string{ + "BestCompression": "int:9", + "BestSpeed": "int:1", + "DefaultCompression": "int:-1", + "HuffmanOnly": "int:-2", + "NoCompression": "int:0", + }, + } +} + +// --------------- proxy for compress/flate.Reader --------------- +type Reader_compress_flate struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + ReadByte_ func(interface{}) (byte, error) +} +func (Proxy *Reader_compress_flate) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *Reader_compress_flate) ReadByte() (byte, error) { + return Proxy.ReadByte_(Proxy.Object) +} + +// --------------- proxy for compress/flate.Resetter --------------- +type Resetter_compress_flate struct { + Object interface{} + Reset_ func(_proxy_obj_ interface{}, r io.Reader, dict []byte) error +} +func (Proxy *Resetter_compress_flate) Reset(r io.Reader, dict []byte) error { + return Proxy.Reset_(Proxy.Object, r, dict) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/compress_gzip.go b/vendor/github.com/cosmos72/gomacro/imports/compress_gzip.go new file mode 100644 index 0000000..af1a1f8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/compress_gzip.go @@ -0,0 +1,37 @@ +// this file was generated by gomacro command: import _b "compress/gzip" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "compress/gzip" +) + +// reflection: allow interpreted code to import "compress/gzip" +func init() { + Packages["compress/gzip"] = Package{ + Binds: map[string]Value{ + "BestCompression": ValueOf(gzip.BestCompression), + "BestSpeed": ValueOf(gzip.BestSpeed), + "DefaultCompression": ValueOf(gzip.DefaultCompression), + "ErrChecksum": ValueOf(&gzip.ErrChecksum).Elem(), + "ErrHeader": ValueOf(&gzip.ErrHeader).Elem(), + "HuffmanOnly": ValueOf(gzip.HuffmanOnly), + "NewReader": ValueOf(gzip.NewReader), + "NewWriter": ValueOf(gzip.NewWriter), + "NewWriterLevel": ValueOf(gzip.NewWriterLevel), + "NoCompression": ValueOf(gzip.NoCompression), + },Types: map[string]Type{ + "Header": TypeOf((*gzip.Header)(nil)).Elem(), + "Reader": TypeOf((*gzip.Reader)(nil)).Elem(), + "Writer": TypeOf((*gzip.Writer)(nil)).Elem(), + },Untypeds: map[string]string{ + "BestCompression": "int:9", + "BestSpeed": "int:1", + "DefaultCompression": "int:-1", + "HuffmanOnly": "int:-2", + "NoCompression": "int:0", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/compress_lzw.go b/vendor/github.com/cosmos72/gomacro/imports/compress_lzw.go new file mode 100644 index 0000000..0876660 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/compress_lzw.go @@ -0,0 +1,23 @@ +// this file was generated by gomacro command: import _b "compress/lzw" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "compress/lzw" +) + +// reflection: allow interpreted code to import "compress/lzw" +func init() { + Packages["compress/lzw"] = Package{ + Binds: map[string]Value{ + "LSB": ValueOf(lzw.LSB), + "MSB": ValueOf(lzw.MSB), + "NewReader": ValueOf(lzw.NewReader), + "NewWriter": ValueOf(lzw.NewWriter), + },Types: map[string]Type{ + "Order": TypeOf((*lzw.Order)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/compress_zlib.go b/vendor/github.com/cosmos72/gomacro/imports/compress_zlib.go new file mode 100644 index 0000000..08def98 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/compress_zlib.go @@ -0,0 +1,51 @@ +// this file was generated by gomacro command: import _b "compress/zlib" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "compress/zlib" + "io" +) + +// reflection: allow interpreted code to import "compress/zlib" +func init() { + Packages["compress/zlib"] = Package{ + Binds: map[string]Value{ + "BestCompression": ValueOf(zlib.BestCompression), + "BestSpeed": ValueOf(zlib.BestSpeed), + "DefaultCompression": ValueOf(zlib.DefaultCompression), + "ErrChecksum": ValueOf(&zlib.ErrChecksum).Elem(), + "ErrDictionary": ValueOf(&zlib.ErrDictionary).Elem(), + "ErrHeader": ValueOf(&zlib.ErrHeader).Elem(), + "HuffmanOnly": ValueOf(zlib.HuffmanOnly), + "NewReader": ValueOf(zlib.NewReader), + "NewReaderDict": ValueOf(zlib.NewReaderDict), + "NewWriter": ValueOf(zlib.NewWriter), + "NewWriterLevel": ValueOf(zlib.NewWriterLevel), + "NewWriterLevelDict": ValueOf(zlib.NewWriterLevelDict), + "NoCompression": ValueOf(zlib.NoCompression), + },Types: map[string]Type{ + "Resetter": TypeOf((*zlib.Resetter)(nil)).Elem(), + "Writer": TypeOf((*zlib.Writer)(nil)).Elem(), + },Proxies: map[string]Type{ + "Resetter": TypeOf((*Resetter_compress_zlib)(nil)).Elem(), + },Untypeds: map[string]string{ + "BestCompression": "int:9", + "BestSpeed": "int:1", + "DefaultCompression": "int:-1", + "HuffmanOnly": "int:-2", + "NoCompression": "int:0", + }, + } +} + +// --------------- proxy for compress/zlib.Resetter --------------- +type Resetter_compress_zlib struct { + Object interface{} + Reset_ func(_proxy_obj_ interface{}, r io.Reader, dict []byte) error +} +func (Proxy *Resetter_compress_zlib) Reset(r io.Reader, dict []byte) error { + return Proxy.Reset_(Proxy.Object, r, dict) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/container_heap.go b/vendor/github.com/cosmos72/gomacro/imports/container_heap.go new file mode 100644 index 0000000..c53f185 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/container_heap.go @@ -0,0 +1,51 @@ +// this file was generated by gomacro command: import _b "container/heap" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "container/heap" +) + +// reflection: allow interpreted code to import "container/heap" +func init() { + Packages["container/heap"] = Package{ + Binds: map[string]Value{ + "Fix": ValueOf(heap.Fix), + "Init": ValueOf(heap.Init), + "Pop": ValueOf(heap.Pop), + "Push": ValueOf(heap.Push), + "Remove": ValueOf(heap.Remove), + },Types: map[string]Type{ + "Interface": TypeOf((*heap.Interface)(nil)).Elem(), + },Proxies: map[string]Type{ + "Interface": TypeOf((*Interface_container_heap)(nil)).Elem(), + }, + } +} + +// --------------- proxy for container/heap.Interface --------------- +type Interface_container_heap struct { + Object interface{} + Len_ func(interface{}) int + Less_ func(_proxy_obj_ interface{}, i int, j int) bool + Pop_ func(interface{}) interface{} + Push_ func(_proxy_obj_ interface{}, x interface{}) + Swap_ func(_proxy_obj_ interface{}, i int, j int) +} +func (Proxy *Interface_container_heap) Len() int { + return Proxy.Len_(Proxy.Object) +} +func (Proxy *Interface_container_heap) Less(i int, j int) bool { + return Proxy.Less_(Proxy.Object, i, j) +} +func (Proxy *Interface_container_heap) Pop() interface{} { + return Proxy.Pop_(Proxy.Object) +} +func (Proxy *Interface_container_heap) Push(x interface{}) { + Proxy.Push_(Proxy.Object, x) +} +func (Proxy *Interface_container_heap) Swap(i int, j int) { + Proxy.Swap_(Proxy.Object, i, j) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/container_list.go b/vendor/github.com/cosmos72/gomacro/imports/container_list.go new file mode 100644 index 0000000..55b0543 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/container_list.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "container/list" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "container/list" +) + +// reflection: allow interpreted code to import "container/list" +func init() { + Packages["container/list"] = Package{ + Binds: map[string]Value{ + "New": ValueOf(list.New), + },Types: map[string]Type{ + "Element": TypeOf((*list.Element)(nil)).Elem(), + "List": TypeOf((*list.List)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/container_ring.go b/vendor/github.com/cosmos72/gomacro/imports/container_ring.go new file mode 100644 index 0000000..f0197b9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/container_ring.go @@ -0,0 +1,20 @@ +// this file was generated by gomacro command: import _b "container/ring" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "container/ring" +) + +// reflection: allow interpreted code to import "container/ring" +func init() { + Packages["container/ring"] = Package{ + Binds: map[string]Value{ + "New": ValueOf(ring.New), + },Types: map[string]Type{ + "Ring": TypeOf((*ring.Ring)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/context.go b/vendor/github.com/cosmos72/gomacro/imports/context.go new file mode 100644 index 0000000..cab3213 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/context.go @@ -0,0 +1,52 @@ +// this file was generated by gomacro command: import _b "context" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "context" + "time" +) + +// reflection: allow interpreted code to import "context" +func init() { + Packages["context"] = Package{ + Binds: map[string]Value{ + "Background": ValueOf(context.Background), + "Canceled": ValueOf(&context.Canceled).Elem(), + "DeadlineExceeded": ValueOf(&context.DeadlineExceeded).Elem(), + "TODO": ValueOf(context.TODO), + "WithCancel": ValueOf(context.WithCancel), + "WithDeadline": ValueOf(context.WithDeadline), + "WithTimeout": ValueOf(context.WithTimeout), + "WithValue": ValueOf(context.WithValue), + },Types: map[string]Type{ + "CancelFunc": TypeOf((*context.CancelFunc)(nil)).Elem(), + "Context": TypeOf((*context.Context)(nil)).Elem(), + },Proxies: map[string]Type{ + "Context": TypeOf((*Context_context)(nil)).Elem(), + }, + } +} + +// --------------- proxy for context.Context --------------- +type Context_context struct { + Object interface{} + Deadline_ func(interface{}) (deadline time.Time, ok bool) + Done_ func(interface{}) <-chan struct{} + Err_ func(interface{}) error + Value_ func(_proxy_obj_ interface{}, key interface{}) interface{} +} +func (Proxy *Context_context) Deadline() (deadline time.Time, ok bool) { + return Proxy.Deadline_(Proxy.Object) +} +func (Proxy *Context_context) Done() <-chan struct{} { + return Proxy.Done_(Proxy.Object) +} +func (Proxy *Context_context) Err() error { + return Proxy.Err_(Proxy.Object) +} +func (Proxy *Context_context) Value(key interface{}) interface{} { + return Proxy.Value_(Proxy.Object, key) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto.go b/vendor/github.com/cosmos72/gomacro/imports/crypto.go new file mode 100644 index 0000000..576dbd7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto.go @@ -0,0 +1,99 @@ +// this file was generated by gomacro command: import _b "crypto" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto" + "io" +) + +// reflection: allow interpreted code to import "crypto" +func init() { + Packages["crypto"] = Package{ + Binds: map[string]Value{ + "MD4": ValueOf(crypto.MD4), + "MD5": ValueOf(crypto.MD5), + "MD5SHA1": ValueOf(crypto.MD5SHA1), + "RIPEMD160": ValueOf(crypto.RIPEMD160), + "RegisterHash": ValueOf(crypto.RegisterHash), + "SHA1": ValueOf(crypto.SHA1), + "SHA224": ValueOf(crypto.SHA224), + "SHA256": ValueOf(crypto.SHA256), + "SHA384": ValueOf(crypto.SHA384), + "SHA3_224": ValueOf(crypto.SHA3_224), + "SHA3_256": ValueOf(crypto.SHA3_256), + "SHA3_384": ValueOf(crypto.SHA3_384), + "SHA3_512": ValueOf(crypto.SHA3_512), + "SHA512": ValueOf(crypto.SHA512), + "SHA512_224": ValueOf(crypto.SHA512_224), + "SHA512_256": ValueOf(crypto.SHA512_256), + },Types: map[string]Type{ + "Decrypter": TypeOf((*crypto.Decrypter)(nil)).Elem(), + "DecrypterOpts": TypeOf((*crypto.DecrypterOpts)(nil)).Elem(), + "Hash": TypeOf((*crypto.Hash)(nil)).Elem(), + "PrivateKey": TypeOf((*crypto.PrivateKey)(nil)).Elem(), + "PublicKey": TypeOf((*crypto.PublicKey)(nil)).Elem(), + "Signer": TypeOf((*crypto.Signer)(nil)).Elem(), + "SignerOpts": TypeOf((*crypto.SignerOpts)(nil)).Elem(), + },Proxies: map[string]Type{ + "Decrypter": TypeOf((*Decrypter_crypto)(nil)).Elem(), + "DecrypterOpts": TypeOf((*DecrypterOpts_crypto)(nil)).Elem(), + "PrivateKey": TypeOf((*PrivateKey_crypto)(nil)).Elem(), + "PublicKey": TypeOf((*PublicKey_crypto)(nil)).Elem(), + "Signer": TypeOf((*Signer_crypto)(nil)).Elem(), + "SignerOpts": TypeOf((*SignerOpts_crypto)(nil)).Elem(), + }, + } +} + +// --------------- proxy for crypto.Decrypter --------------- +type Decrypter_crypto struct { + Object interface{} + Decrypt_ func(_proxy_obj_ interface{}, rand io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) + Public_ func(interface{}) crypto.PublicKey +} +func (Proxy *Decrypter_crypto) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) { + return Proxy.Decrypt_(Proxy.Object, rand, msg, opts) +} +func (Proxy *Decrypter_crypto) Public() crypto.PublicKey { + return Proxy.Public_(Proxy.Object) +} + +// --------------- proxy for crypto.DecrypterOpts --------------- +type DecrypterOpts_crypto struct { + Object interface{} +} + +// --------------- proxy for crypto.PrivateKey --------------- +type PrivateKey_crypto struct { + Object interface{} +} + +// --------------- proxy for crypto.PublicKey --------------- +type PublicKey_crypto struct { + Object interface{} +} + +// --------------- proxy for crypto.Signer --------------- +type Signer_crypto struct { + Object interface{} + Public_ func(interface{}) crypto.PublicKey + Sign_ func(_proxy_obj_ interface{}, rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) +} +func (Proxy *Signer_crypto) Public() crypto.PublicKey { + return Proxy.Public_(Proxy.Object) +} +func (Proxy *Signer_crypto) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) { + return Proxy.Sign_(Proxy.Object, rand, digest, opts) +} + +// --------------- proxy for crypto.SignerOpts --------------- +type SignerOpts_crypto struct { + Object interface{} + HashFunc_ func(interface{}) crypto.Hash +} +func (Proxy *SignerOpts_crypto) HashFunc() crypto.Hash { + return Proxy.HashFunc_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_aes.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_aes.go new file mode 100644 index 0000000..826d9ad --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_aes.go @@ -0,0 +1,23 @@ +// this file was generated by gomacro command: import _b "crypto/aes" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/aes" +) + +// reflection: allow interpreted code to import "crypto/aes" +func init() { + Packages["crypto/aes"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(aes.BlockSize), + "NewCipher": ValueOf(aes.NewCipher), + },Types: map[string]Type{ + "KeySizeError": TypeOf((*aes.KeySizeError)(nil)).Elem(), + },Untypeds: map[string]string{ + "BlockSize": "int:16", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_cipher.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_cipher.go new file mode 100644 index 0000000..ad38f01 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_cipher.go @@ -0,0 +1,97 @@ +// this file was generated by gomacro command: import _b "crypto/cipher" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/cipher" +) + +// reflection: allow interpreted code to import "crypto/cipher" +func init() { + Packages["crypto/cipher"] = Package{ + Binds: map[string]Value{ + "NewCBCDecrypter": ValueOf(cipher.NewCBCDecrypter), + "NewCBCEncrypter": ValueOf(cipher.NewCBCEncrypter), + "NewCFBDecrypter": ValueOf(cipher.NewCFBDecrypter), + "NewCFBEncrypter": ValueOf(cipher.NewCFBEncrypter), + "NewCTR": ValueOf(cipher.NewCTR), + "NewGCM": ValueOf(cipher.NewGCM), + "NewGCMWithNonceSize": ValueOf(cipher.NewGCMWithNonceSize), + "NewOFB": ValueOf(cipher.NewOFB), + },Types: map[string]Type{ + "AEAD": TypeOf((*cipher.AEAD)(nil)).Elem(), + "Block": TypeOf((*cipher.Block)(nil)).Elem(), + "BlockMode": TypeOf((*cipher.BlockMode)(nil)).Elem(), + "Stream": TypeOf((*cipher.Stream)(nil)).Elem(), + "StreamReader": TypeOf((*cipher.StreamReader)(nil)).Elem(), + "StreamWriter": TypeOf((*cipher.StreamWriter)(nil)).Elem(), + },Proxies: map[string]Type{ + "AEAD": TypeOf((*AEAD_crypto_cipher)(nil)).Elem(), + "Block": TypeOf((*Block_crypto_cipher)(nil)).Elem(), + "BlockMode": TypeOf((*BlockMode_crypto_cipher)(nil)).Elem(), + "Stream": TypeOf((*Stream_crypto_cipher)(nil)).Elem(), + }, + } +} + +// --------------- proxy for crypto/cipher.AEAD --------------- +type AEAD_crypto_cipher struct { + Object interface{} + NonceSize_ func(interface{}) int + Open_ func(_proxy_obj_ interface{}, dst []byte, nonce []byte, ciphertext []byte, additionalData []byte) ([]byte, error) + Overhead_ func(interface{}) int + Seal_ func(_proxy_obj_ interface{}, dst []byte, nonce []byte, plaintext []byte, additionalData []byte) []byte +} +func (Proxy *AEAD_crypto_cipher) NonceSize() int { + return Proxy.NonceSize_(Proxy.Object) +} +func (Proxy *AEAD_crypto_cipher) Open(dst []byte, nonce []byte, ciphertext []byte, additionalData []byte) ([]byte, error) { + return Proxy.Open_(Proxy.Object, dst, nonce, ciphertext, additionalData) +} +func (Proxy *AEAD_crypto_cipher) Overhead() int { + return Proxy.Overhead_(Proxy.Object) +} +func (Proxy *AEAD_crypto_cipher) Seal(dst []byte, nonce []byte, plaintext []byte, additionalData []byte) []byte { + return Proxy.Seal_(Proxy.Object, dst, nonce, plaintext, additionalData) +} + +// --------------- proxy for crypto/cipher.Block --------------- +type Block_crypto_cipher struct { + Object interface{} + BlockSize_ func(interface{}) int + Decrypt_ func(_proxy_obj_ interface{}, dst []byte, src []byte) + Encrypt_ func(_proxy_obj_ interface{}, dst []byte, src []byte) +} +func (Proxy *Block_crypto_cipher) BlockSize() int { + return Proxy.BlockSize_(Proxy.Object) +} +func (Proxy *Block_crypto_cipher) Decrypt(dst []byte, src []byte) { + Proxy.Decrypt_(Proxy.Object, dst, src) +} +func (Proxy *Block_crypto_cipher) Encrypt(dst []byte, src []byte) { + Proxy.Encrypt_(Proxy.Object, dst, src) +} + +// --------------- proxy for crypto/cipher.BlockMode --------------- +type BlockMode_crypto_cipher struct { + Object interface{} + BlockSize_ func(interface{}) int + CryptBlocks_ func(_proxy_obj_ interface{}, dst []byte, src []byte) +} +func (Proxy *BlockMode_crypto_cipher) BlockSize() int { + return Proxy.BlockSize_(Proxy.Object) +} +func (Proxy *BlockMode_crypto_cipher) CryptBlocks(dst []byte, src []byte) { + Proxy.CryptBlocks_(Proxy.Object, dst, src) +} + +// --------------- proxy for crypto/cipher.Stream --------------- +type Stream_crypto_cipher struct { + Object interface{} + XORKeyStream_ func(_proxy_obj_ interface{}, dst []byte, src []byte) +} +func (Proxy *Stream_crypto_cipher) XORKeyStream(dst []byte, src []byte) { + Proxy.XORKeyStream_(Proxy.Object, dst, src) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_des.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_des.go new file mode 100644 index 0000000..c2d4834 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_des.go @@ -0,0 +1,24 @@ +// this file was generated by gomacro command: import _b "crypto/des" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/des" +) + +// reflection: allow interpreted code to import "crypto/des" +func init() { + Packages["crypto/des"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(des.BlockSize), + "NewCipher": ValueOf(des.NewCipher), + "NewTripleDESCipher": ValueOf(des.NewTripleDESCipher), + },Types: map[string]Type{ + "KeySizeError": TypeOf((*des.KeySizeError)(nil)).Elem(), + },Untypeds: map[string]string{ + "BlockSize": "int:8", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_dsa.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_dsa.go new file mode 100644 index 0000000..0fa22ad --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_dsa.go @@ -0,0 +1,31 @@ +// this file was generated by gomacro command: import _b "crypto/dsa" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/dsa" +) + +// reflection: allow interpreted code to import "crypto/dsa" +func init() { + Packages["crypto/dsa"] = Package{ + Binds: map[string]Value{ + "ErrInvalidPublicKey": ValueOf(&dsa.ErrInvalidPublicKey).Elem(), + "GenerateKey": ValueOf(dsa.GenerateKey), + "GenerateParameters": ValueOf(dsa.GenerateParameters), + "L1024N160": ValueOf(dsa.L1024N160), + "L2048N224": ValueOf(dsa.L2048N224), + "L2048N256": ValueOf(dsa.L2048N256), + "L3072N256": ValueOf(dsa.L3072N256), + "Sign": ValueOf(dsa.Sign), + "Verify": ValueOf(dsa.Verify), + },Types: map[string]Type{ + "ParameterSizes": TypeOf((*dsa.ParameterSizes)(nil)).Elem(), + "Parameters": TypeOf((*dsa.Parameters)(nil)).Elem(), + "PrivateKey": TypeOf((*dsa.PrivateKey)(nil)).Elem(), + "PublicKey": TypeOf((*dsa.PublicKey)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_ecdsa.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_ecdsa.go new file mode 100644 index 0000000..feb6825 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_ecdsa.go @@ -0,0 +1,23 @@ +// this file was generated by gomacro command: import _b "crypto/ecdsa" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/ecdsa" +) + +// reflection: allow interpreted code to import "crypto/ecdsa" +func init() { + Packages["crypto/ecdsa"] = Package{ + Binds: map[string]Value{ + "GenerateKey": ValueOf(ecdsa.GenerateKey), + "Sign": ValueOf(ecdsa.Sign), + "Verify": ValueOf(ecdsa.Verify), + },Types: map[string]Type{ + "PrivateKey": TypeOf((*ecdsa.PrivateKey)(nil)).Elem(), + "PublicKey": TypeOf((*ecdsa.PublicKey)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_elliptic.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_elliptic.go new file mode 100644 index 0000000..0b4e510 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_elliptic.go @@ -0,0 +1,59 @@ +// this file was generated by gomacro command: import _b "crypto/elliptic" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/elliptic" + "math/big" +) + +// reflection: allow interpreted code to import "crypto/elliptic" +func init() { + Packages["crypto/elliptic"] = Package{ + Binds: map[string]Value{ + "GenerateKey": ValueOf(elliptic.GenerateKey), + "Marshal": ValueOf(elliptic.Marshal), + "P224": ValueOf(elliptic.P224), + "P256": ValueOf(elliptic.P256), + "P384": ValueOf(elliptic.P384), + "P521": ValueOf(elliptic.P521), + "Unmarshal": ValueOf(elliptic.Unmarshal), + },Types: map[string]Type{ + "Curve": TypeOf((*elliptic.Curve)(nil)).Elem(), + "CurveParams": TypeOf((*elliptic.CurveParams)(nil)).Elem(), + },Proxies: map[string]Type{ + "Curve": TypeOf((*Curve_crypto_elliptic)(nil)).Elem(), + }, + } +} + +// --------------- proxy for crypto/elliptic.Curve --------------- +type Curve_crypto_elliptic struct { + Object interface{} + Add_ func(_proxy_obj_ interface{}, x1 *big.Int, y1 *big.Int, x2 *big.Int, y2 *big.Int) (x *big.Int, y *big.Int) + Double_ func(_proxy_obj_ interface{}, x1 *big.Int, y1 *big.Int) (x *big.Int, y *big.Int) + IsOnCurve_ func(_proxy_obj_ interface{}, x *big.Int, y *big.Int) bool + Params_ func(interface{}) *elliptic.CurveParams + ScalarBaseMult_ func(_proxy_obj_ interface{}, k []byte) (x *big.Int, y *big.Int) + ScalarMult_ func(_proxy_obj_ interface{}, x1 *big.Int, y1 *big.Int, k []byte) (x *big.Int, y *big.Int) +} +func (Proxy *Curve_crypto_elliptic) Add(x1 *big.Int, y1 *big.Int, x2 *big.Int, y2 *big.Int) (x *big.Int, y *big.Int) { + return Proxy.Add_(Proxy.Object, x1, y1, x2, y2) +} +func (Proxy *Curve_crypto_elliptic) Double(x1 *big.Int, y1 *big.Int) (x *big.Int, y *big.Int) { + return Proxy.Double_(Proxy.Object, x1, y1) +} +func (Proxy *Curve_crypto_elliptic) IsOnCurve(x *big.Int, y *big.Int) bool { + return Proxy.IsOnCurve_(Proxy.Object, x, y) +} +func (Proxy *Curve_crypto_elliptic) Params() *elliptic.CurveParams { + return Proxy.Params_(Proxy.Object) +} +func (Proxy *Curve_crypto_elliptic) ScalarBaseMult(k []byte) (x *big.Int, y *big.Int) { + return Proxy.ScalarBaseMult_(Proxy.Object, k) +} +func (Proxy *Curve_crypto_elliptic) ScalarMult(x1 *big.Int, y1 *big.Int, k []byte) (x *big.Int, y *big.Int) { + return Proxy.ScalarMult_(Proxy.Object, x1, y1, k) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_hmac.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_hmac.go new file mode 100644 index 0000000..750f9b9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_hmac.go @@ -0,0 +1,19 @@ +// this file was generated by gomacro command: import _b "crypto/hmac" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/hmac" +) + +// reflection: allow interpreted code to import "crypto/hmac" +func init() { + Packages["crypto/hmac"] = Package{ + Binds: map[string]Value{ + "Equal": ValueOf(hmac.Equal), + "New": ValueOf(hmac.New), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_md5.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_md5.go new file mode 100644 index 0000000..51b5b5b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_md5.go @@ -0,0 +1,24 @@ +// this file was generated by gomacro command: import _b "crypto/md5" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/md5" +) + +// reflection: allow interpreted code to import "crypto/md5" +func init() { + Packages["crypto/md5"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(md5.BlockSize), + "New": ValueOf(md5.New), + "Size": ValueOf(md5.Size), + "Sum": ValueOf(md5.Sum), + },Untypeds: map[string]string{ + "BlockSize": "int:64", + "Size": "int:16", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_rand.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_rand.go new file mode 100644 index 0000000..4540e92 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_rand.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "crypto/rand" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/rand" +) + +// reflection: allow interpreted code to import "crypto/rand" +func init() { + Packages["crypto/rand"] = Package{ + Binds: map[string]Value{ + "Int": ValueOf(rand.Int), + "Prime": ValueOf(rand.Prime), + "Read": ValueOf(rand.Read), + "Reader": ValueOf(&rand.Reader).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_rc4.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_rc4.go new file mode 100644 index 0000000..6e11e6e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_rc4.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "crypto/rc4" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/rc4" +) + +// reflection: allow interpreted code to import "crypto/rc4" +func init() { + Packages["crypto/rc4"] = Package{ + Binds: map[string]Value{ + "NewCipher": ValueOf(rc4.NewCipher), + },Types: map[string]Type{ + "Cipher": TypeOf((*rc4.Cipher)(nil)).Elem(), + "KeySizeError": TypeOf((*rc4.KeySizeError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_rsa.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_rsa.go new file mode 100644 index 0000000..d33285d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_rsa.go @@ -0,0 +1,44 @@ +// this file was generated by gomacro command: import _b "crypto/rsa" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/rsa" +) + +// reflection: allow interpreted code to import "crypto/rsa" +func init() { + Packages["crypto/rsa"] = Package{ + Binds: map[string]Value{ + "DecryptOAEP": ValueOf(rsa.DecryptOAEP), + "DecryptPKCS1v15": ValueOf(rsa.DecryptPKCS1v15), + "DecryptPKCS1v15SessionKey": ValueOf(rsa.DecryptPKCS1v15SessionKey), + "EncryptOAEP": ValueOf(rsa.EncryptOAEP), + "EncryptPKCS1v15": ValueOf(rsa.EncryptPKCS1v15), + "ErrDecryption": ValueOf(&rsa.ErrDecryption).Elem(), + "ErrMessageTooLong": ValueOf(&rsa.ErrMessageTooLong).Elem(), + "ErrVerification": ValueOf(&rsa.ErrVerification).Elem(), + "GenerateKey": ValueOf(rsa.GenerateKey), + "GenerateMultiPrimeKey": ValueOf(rsa.GenerateMultiPrimeKey), + "PSSSaltLengthAuto": ValueOf(rsa.PSSSaltLengthAuto), + "PSSSaltLengthEqualsHash": ValueOf(rsa.PSSSaltLengthEqualsHash), + "SignPKCS1v15": ValueOf(rsa.SignPKCS1v15), + "SignPSS": ValueOf(rsa.SignPSS), + "VerifyPKCS1v15": ValueOf(rsa.VerifyPKCS1v15), + "VerifyPSS": ValueOf(rsa.VerifyPSS), + },Types: map[string]Type{ + "CRTValue": TypeOf((*rsa.CRTValue)(nil)).Elem(), + "OAEPOptions": TypeOf((*rsa.OAEPOptions)(nil)).Elem(), + "PKCS1v15DecryptOptions": TypeOf((*rsa.PKCS1v15DecryptOptions)(nil)).Elem(), + "PSSOptions": TypeOf((*rsa.PSSOptions)(nil)).Elem(), + "PrecomputedValues": TypeOf((*rsa.PrecomputedValues)(nil)).Elem(), + "PrivateKey": TypeOf((*rsa.PrivateKey)(nil)).Elem(), + "PublicKey": TypeOf((*rsa.PublicKey)(nil)).Elem(), + },Untypeds: map[string]string{ + "PSSSaltLengthAuto": "int:0", + "PSSSaltLengthEqualsHash": "int:-1", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_sha1.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha1.go new file mode 100644 index 0000000..1ca71f6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha1.go @@ -0,0 +1,24 @@ +// this file was generated by gomacro command: import _b "crypto/sha1" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/sha1" +) + +// reflection: allow interpreted code to import "crypto/sha1" +func init() { + Packages["crypto/sha1"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(sha1.BlockSize), + "New": ValueOf(sha1.New), + "Size": ValueOf(sha1.Size), + "Sum": ValueOf(sha1.Sum), + },Untypeds: map[string]string{ + "BlockSize": "int:64", + "Size": "int:20", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_sha256.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha256.go new file mode 100644 index 0000000..617e570 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha256.go @@ -0,0 +1,28 @@ +// this file was generated by gomacro command: import _b "crypto/sha256" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/sha256" +) + +// reflection: allow interpreted code to import "crypto/sha256" +func init() { + Packages["crypto/sha256"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(sha256.BlockSize), + "New": ValueOf(sha256.New), + "New224": ValueOf(sha256.New224), + "Size": ValueOf(sha256.Size), + "Size224": ValueOf(sha256.Size224), + "Sum224": ValueOf(sha256.Sum224), + "Sum256": ValueOf(sha256.Sum256), + },Untypeds: map[string]string{ + "BlockSize": "int:64", + "Size": "int:32", + "Size224": "int:28", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_sha512.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha512.go new file mode 100644 index 0000000..ba2ef31 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_sha512.go @@ -0,0 +1,36 @@ +// this file was generated by gomacro command: import _b "crypto/sha512" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/sha512" +) + +// reflection: allow interpreted code to import "crypto/sha512" +func init() { + Packages["crypto/sha512"] = Package{ + Binds: map[string]Value{ + "BlockSize": ValueOf(sha512.BlockSize), + "New": ValueOf(sha512.New), + "New384": ValueOf(sha512.New384), + "New512_224": ValueOf(sha512.New512_224), + "New512_256": ValueOf(sha512.New512_256), + "Size": ValueOf(sha512.Size), + "Size224": ValueOf(sha512.Size224), + "Size256": ValueOf(sha512.Size256), + "Size384": ValueOf(sha512.Size384), + "Sum384": ValueOf(sha512.Sum384), + "Sum512": ValueOf(sha512.Sum512), + "Sum512_224": ValueOf(sha512.Sum512_224), + "Sum512_256": ValueOf(sha512.Sum512_256), + },Untypeds: map[string]string{ + "BlockSize": "int:128", + "Size": "int:64", + "Size224": "int:28", + "Size256": "int:32", + "Size384": "int:48", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_subtle.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_subtle.go new file mode 100644 index 0000000..037ad68 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_subtle.go @@ -0,0 +1,23 @@ +// this file was generated by gomacro command: import _b "crypto/subtle" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/subtle" +) + +// reflection: allow interpreted code to import "crypto/subtle" +func init() { + Packages["crypto/subtle"] = Package{ + Binds: map[string]Value{ + "ConstantTimeByteEq": ValueOf(subtle.ConstantTimeByteEq), + "ConstantTimeCompare": ValueOf(subtle.ConstantTimeCompare), + "ConstantTimeCopy": ValueOf(subtle.ConstantTimeCopy), + "ConstantTimeEq": ValueOf(subtle.ConstantTimeEq), + "ConstantTimeLessOrEq": ValueOf(subtle.ConstantTimeLessOrEq), + "ConstantTimeSelect": ValueOf(subtle.ConstantTimeSelect), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_tls.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_tls.go new file mode 100644 index 0000000..32e0020 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_tls.go @@ -0,0 +1,109 @@ +// this file was generated by gomacro command: import _b "crypto/tls" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/tls" +) + +// reflection: allow interpreted code to import "crypto/tls" +func init() { + Packages["crypto/tls"] = Package{ + Binds: map[string]Value{ + "Client": ValueOf(tls.Client), + "CurveP256": ValueOf(tls.CurveP256), + "CurveP384": ValueOf(tls.CurveP384), + "CurveP521": ValueOf(tls.CurveP521), + "Dial": ValueOf(tls.Dial), + "DialWithDialer": ValueOf(tls.DialWithDialer), + "ECDSAWithP256AndSHA256": ValueOf(tls.ECDSAWithP256AndSHA256), + "ECDSAWithP384AndSHA384": ValueOf(tls.ECDSAWithP384AndSHA384), + "ECDSAWithP521AndSHA512": ValueOf(tls.ECDSAWithP521AndSHA512), + "Listen": ValueOf(tls.Listen), + "LoadX509KeyPair": ValueOf(tls.LoadX509KeyPair), + "NewLRUClientSessionCache": ValueOf(tls.NewLRUClientSessionCache), + "NewListener": ValueOf(tls.NewListener), + "NoClientCert": ValueOf(tls.NoClientCert), + "PKCS1WithSHA1": ValueOf(tls.PKCS1WithSHA1), + "PKCS1WithSHA256": ValueOf(tls.PKCS1WithSHA256), + "PKCS1WithSHA384": ValueOf(tls.PKCS1WithSHA384), + "PKCS1WithSHA512": ValueOf(tls.PKCS1WithSHA512), + "PSSWithSHA256": ValueOf(tls.PSSWithSHA256), + "PSSWithSHA384": ValueOf(tls.PSSWithSHA384), + "PSSWithSHA512": ValueOf(tls.PSSWithSHA512), + "RenegotiateFreelyAsClient": ValueOf(tls.RenegotiateFreelyAsClient), + "RenegotiateNever": ValueOf(tls.RenegotiateNever), + "RenegotiateOnceAsClient": ValueOf(tls.RenegotiateOnceAsClient), + "RequestClientCert": ValueOf(tls.RequestClientCert), + "RequireAndVerifyClientCert": ValueOf(tls.RequireAndVerifyClientCert), + "RequireAnyClientCert": ValueOf(tls.RequireAnyClientCert), + "Server": ValueOf(tls.Server), + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA), + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), + "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256), + "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA), + "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384), + "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305), + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": ValueOf(tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA), + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": ValueOf(tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA), + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": ValueOf(tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA), + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256": ValueOf(tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256), + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": ValueOf(tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256), + "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": ValueOf(tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), + "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": ValueOf(tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384), + "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305": ValueOf(tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305), + "TLS_ECDHE_RSA_WITH_RC4_128_SHA": ValueOf(tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA), + "TLS_FALLBACK_SCSV": ValueOf(tls.TLS_FALLBACK_SCSV), + "TLS_RSA_WITH_3DES_EDE_CBC_SHA": ValueOf(tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA), + "TLS_RSA_WITH_AES_128_CBC_SHA": ValueOf(tls.TLS_RSA_WITH_AES_128_CBC_SHA), + "TLS_RSA_WITH_AES_128_CBC_SHA256": ValueOf(tls.TLS_RSA_WITH_AES_128_CBC_SHA256), + "TLS_RSA_WITH_AES_128_GCM_SHA256": ValueOf(tls.TLS_RSA_WITH_AES_128_GCM_SHA256), + "TLS_RSA_WITH_AES_256_CBC_SHA": ValueOf(tls.TLS_RSA_WITH_AES_256_CBC_SHA), + "TLS_RSA_WITH_AES_256_GCM_SHA384": ValueOf(tls.TLS_RSA_WITH_AES_256_GCM_SHA384), + "TLS_RSA_WITH_RC4_128_SHA": ValueOf(tls.TLS_RSA_WITH_RC4_128_SHA), + "VerifyClientCertIfGiven": ValueOf(tls.VerifyClientCertIfGiven), + "VersionSSL30": ValueOf(tls.VersionSSL30), + "VersionTLS10": ValueOf(tls.VersionTLS10), + "VersionTLS11": ValueOf(tls.VersionTLS11), + "VersionTLS12": ValueOf(tls.VersionTLS12), + "X25519": ValueOf(tls.X25519), + "X509KeyPair": ValueOf(tls.X509KeyPair), + },Types: map[string]Type{ + "Certificate": TypeOf((*tls.Certificate)(nil)).Elem(), + "CertificateRequestInfo": TypeOf((*tls.CertificateRequestInfo)(nil)).Elem(), + "ClientAuthType": TypeOf((*tls.ClientAuthType)(nil)).Elem(), + "ClientHelloInfo": TypeOf((*tls.ClientHelloInfo)(nil)).Elem(), + "ClientSessionCache": TypeOf((*tls.ClientSessionCache)(nil)).Elem(), + "ClientSessionState": TypeOf((*tls.ClientSessionState)(nil)).Elem(), + "Config": TypeOf((*tls.Config)(nil)).Elem(), + "Conn": TypeOf((*tls.Conn)(nil)).Elem(), + "ConnectionState": TypeOf((*tls.ConnectionState)(nil)).Elem(), + "CurveID": TypeOf((*tls.CurveID)(nil)).Elem(), + "RecordHeaderError": TypeOf((*tls.RecordHeaderError)(nil)).Elem(), + "RenegotiationSupport": TypeOf((*tls.RenegotiationSupport)(nil)).Elem(), + "SignatureScheme": TypeOf((*tls.SignatureScheme)(nil)).Elem(), + },Proxies: map[string]Type{ + "ClientSessionCache": TypeOf((*ClientSessionCache_crypto_tls)(nil)).Elem(), + },Untypeds: map[string]string{ + "VersionSSL30": "int:768", + "VersionTLS10": "int:769", + "VersionTLS11": "int:770", + "VersionTLS12": "int:771", + }, + } +} + +// --------------- proxy for crypto/tls.ClientSessionCache --------------- +type ClientSessionCache_crypto_tls struct { + Object interface{} + Get_ func(_proxy_obj_ interface{}, sessionKey string) (session *tls.ClientSessionState, ok bool) + Put_ func(_proxy_obj_ interface{}, sessionKey string, cs *tls.ClientSessionState) +} +func (Proxy *ClientSessionCache_crypto_tls) Get(sessionKey string) (session *tls.ClientSessionState, ok bool) { + return Proxy.Get_(Proxy.Object, sessionKey) +} +func (Proxy *ClientSessionCache_crypto_tls) Put(sessionKey string, cs *tls.ClientSessionState) { + Proxy.Put_(Proxy.Object, sessionKey, cs) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_x509.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_x509.go new file mode 100644 index 0000000..9bee467 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_x509.go @@ -0,0 +1,108 @@ +// this file was generated by gomacro command: import _b "crypto/x509" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/x509" +) + +// reflection: allow interpreted code to import "crypto/x509" +func init() { + Packages["crypto/x509"] = Package{ + Binds: map[string]Value{ + "CANotAuthorizedForThisName": ValueOf(x509.CANotAuthorizedForThisName), + "CreateCertificate": ValueOf(x509.CreateCertificate), + "CreateCertificateRequest": ValueOf(x509.CreateCertificateRequest), + "DSA": ValueOf(x509.DSA), + "DSAWithSHA1": ValueOf(x509.DSAWithSHA1), + "DSAWithSHA256": ValueOf(x509.DSAWithSHA256), + "DecryptPEMBlock": ValueOf(x509.DecryptPEMBlock), + "ECDSA": ValueOf(x509.ECDSA), + "ECDSAWithSHA1": ValueOf(x509.ECDSAWithSHA1), + "ECDSAWithSHA256": ValueOf(x509.ECDSAWithSHA256), + "ECDSAWithSHA384": ValueOf(x509.ECDSAWithSHA384), + "ECDSAWithSHA512": ValueOf(x509.ECDSAWithSHA512), + "EncryptPEMBlock": ValueOf(x509.EncryptPEMBlock), + "ErrUnsupportedAlgorithm": ValueOf(&x509.ErrUnsupportedAlgorithm).Elem(), + "Expired": ValueOf(x509.Expired), + "ExtKeyUsageAny": ValueOf(x509.ExtKeyUsageAny), + "ExtKeyUsageClientAuth": ValueOf(x509.ExtKeyUsageClientAuth), + "ExtKeyUsageCodeSigning": ValueOf(x509.ExtKeyUsageCodeSigning), + "ExtKeyUsageEmailProtection": ValueOf(x509.ExtKeyUsageEmailProtection), + "ExtKeyUsageIPSECEndSystem": ValueOf(x509.ExtKeyUsageIPSECEndSystem), + "ExtKeyUsageIPSECTunnel": ValueOf(x509.ExtKeyUsageIPSECTunnel), + "ExtKeyUsageIPSECUser": ValueOf(x509.ExtKeyUsageIPSECUser), + "ExtKeyUsageMicrosoftServerGatedCrypto": ValueOf(x509.ExtKeyUsageMicrosoftServerGatedCrypto), + "ExtKeyUsageNetscapeServerGatedCrypto": ValueOf(x509.ExtKeyUsageNetscapeServerGatedCrypto), + "ExtKeyUsageOCSPSigning": ValueOf(x509.ExtKeyUsageOCSPSigning), + "ExtKeyUsageServerAuth": ValueOf(x509.ExtKeyUsageServerAuth), + "ExtKeyUsageTimeStamping": ValueOf(x509.ExtKeyUsageTimeStamping), + "IncompatibleUsage": ValueOf(x509.IncompatibleUsage), + "IncorrectPasswordError": ValueOf(&x509.IncorrectPasswordError).Elem(), + "IsEncryptedPEMBlock": ValueOf(x509.IsEncryptedPEMBlock), + "KeyUsageCRLSign": ValueOf(x509.KeyUsageCRLSign), + "KeyUsageCertSign": ValueOf(x509.KeyUsageCertSign), + "KeyUsageContentCommitment": ValueOf(x509.KeyUsageContentCommitment), + "KeyUsageDataEncipherment": ValueOf(x509.KeyUsageDataEncipherment), + "KeyUsageDecipherOnly": ValueOf(x509.KeyUsageDecipherOnly), + "KeyUsageDigitalSignature": ValueOf(x509.KeyUsageDigitalSignature), + "KeyUsageEncipherOnly": ValueOf(x509.KeyUsageEncipherOnly), + "KeyUsageKeyAgreement": ValueOf(x509.KeyUsageKeyAgreement), + "KeyUsageKeyEncipherment": ValueOf(x509.KeyUsageKeyEncipherment), + "MD2WithRSA": ValueOf(x509.MD2WithRSA), + "MD5WithRSA": ValueOf(x509.MD5WithRSA), + "MarshalECPrivateKey": ValueOf(x509.MarshalECPrivateKey), + "MarshalPKCS1PrivateKey": ValueOf(x509.MarshalPKCS1PrivateKey), + "MarshalPKIXPublicKey": ValueOf(x509.MarshalPKIXPublicKey), + "NameMismatch": ValueOf(x509.NameMismatch), + "NewCertPool": ValueOf(x509.NewCertPool), + "NotAuthorizedToSign": ValueOf(x509.NotAuthorizedToSign), + "PEMCipher3DES": ValueOf(x509.PEMCipher3DES), + "PEMCipherAES128": ValueOf(x509.PEMCipherAES128), + "PEMCipherAES192": ValueOf(x509.PEMCipherAES192), + "PEMCipherAES256": ValueOf(x509.PEMCipherAES256), + "PEMCipherDES": ValueOf(x509.PEMCipherDES), + "ParseCRL": ValueOf(x509.ParseCRL), + "ParseCertificate": ValueOf(x509.ParseCertificate), + "ParseCertificateRequest": ValueOf(x509.ParseCertificateRequest), + "ParseCertificates": ValueOf(x509.ParseCertificates), + "ParseDERCRL": ValueOf(x509.ParseDERCRL), + "ParseECPrivateKey": ValueOf(x509.ParseECPrivateKey), + "ParsePKCS1PrivateKey": ValueOf(x509.ParsePKCS1PrivateKey), + "ParsePKCS8PrivateKey": ValueOf(x509.ParsePKCS8PrivateKey), + "ParsePKIXPublicKey": ValueOf(x509.ParsePKIXPublicKey), + "RSA": ValueOf(x509.RSA), + "SHA1WithRSA": ValueOf(x509.SHA1WithRSA), + "SHA256WithRSA": ValueOf(x509.SHA256WithRSA), + "SHA256WithRSAPSS": ValueOf(x509.SHA256WithRSAPSS), + "SHA384WithRSA": ValueOf(x509.SHA384WithRSA), + "SHA384WithRSAPSS": ValueOf(x509.SHA384WithRSAPSS), + "SHA512WithRSA": ValueOf(x509.SHA512WithRSA), + "SHA512WithRSAPSS": ValueOf(x509.SHA512WithRSAPSS), + "SystemCertPool": ValueOf(x509.SystemCertPool), + "TooManyIntermediates": ValueOf(x509.TooManyIntermediates), + "UnknownPublicKeyAlgorithm": ValueOf(x509.UnknownPublicKeyAlgorithm), + "UnknownSignatureAlgorithm": ValueOf(x509.UnknownSignatureAlgorithm), + },Types: map[string]Type{ + "CertPool": TypeOf((*x509.CertPool)(nil)).Elem(), + "Certificate": TypeOf((*x509.Certificate)(nil)).Elem(), + "CertificateInvalidError": TypeOf((*x509.CertificateInvalidError)(nil)).Elem(), + "CertificateRequest": TypeOf((*x509.CertificateRequest)(nil)).Elem(), + "ConstraintViolationError": TypeOf((*x509.ConstraintViolationError)(nil)).Elem(), + "ExtKeyUsage": TypeOf((*x509.ExtKeyUsage)(nil)).Elem(), + "HostnameError": TypeOf((*x509.HostnameError)(nil)).Elem(), + "InsecureAlgorithmError": TypeOf((*x509.InsecureAlgorithmError)(nil)).Elem(), + "InvalidReason": TypeOf((*x509.InvalidReason)(nil)).Elem(), + "KeyUsage": TypeOf((*x509.KeyUsage)(nil)).Elem(), + "PEMCipher": TypeOf((*x509.PEMCipher)(nil)).Elem(), + "PublicKeyAlgorithm": TypeOf((*x509.PublicKeyAlgorithm)(nil)).Elem(), + "SignatureAlgorithm": TypeOf((*x509.SignatureAlgorithm)(nil)).Elem(), + "SystemRootsError": TypeOf((*x509.SystemRootsError)(nil)).Elem(), + "UnhandledCriticalExtension": TypeOf((*x509.UnhandledCriticalExtension)(nil)).Elem(), + "UnknownAuthorityError": TypeOf((*x509.UnknownAuthorityError)(nil)).Elem(), + "VerifyOptions": TypeOf((*x509.VerifyOptions)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/crypto_x509_pkix.go b/vendor/github.com/cosmos72/gomacro/imports/crypto_x509_pkix.go new file mode 100644 index 0000000..4c1fa75 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/crypto_x509_pkix.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "crypto/x509/pkix" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "crypto/x509/pkix" +) + +// reflection: allow interpreted code to import "crypto/x509/pkix" +func init() { + Packages["crypto/x509/pkix"] = Package{ + Types: map[string]Type{ + "AlgorithmIdentifier": TypeOf((*pkix.AlgorithmIdentifier)(nil)).Elem(), + "AttributeTypeAndValue": TypeOf((*pkix.AttributeTypeAndValue)(nil)).Elem(), + "AttributeTypeAndValueSET": TypeOf((*pkix.AttributeTypeAndValueSET)(nil)).Elem(), + "CertificateList": TypeOf((*pkix.CertificateList)(nil)).Elem(), + "Extension": TypeOf((*pkix.Extension)(nil)).Elem(), + "Name": TypeOf((*pkix.Name)(nil)).Elem(), + "RDNSequence": TypeOf((*pkix.RDNSequence)(nil)).Elem(), + "RelativeDistinguishedNameSET": TypeOf((*pkix.RelativeDistinguishedNameSET)(nil)).Elem(), + "RevokedCertificate": TypeOf((*pkix.RevokedCertificate)(nil)).Elem(), + "TBSCertificateList": TypeOf((*pkix.TBSCertificateList)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/database_sql.go b/vendor/github.com/cosmos72/gomacro/imports/database_sql.go new file mode 100644 index 0000000..a996886 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/database_sql.go @@ -0,0 +1,74 @@ +// this file was generated by gomacro command: import _b "database/sql" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "database/sql" +) + +// reflection: allow interpreted code to import "database/sql" +func init() { + Packages["database/sql"] = Package{ + Binds: map[string]Value{ + "Drivers": ValueOf(sql.Drivers), + "ErrNoRows": ValueOf(&sql.ErrNoRows).Elem(), + "ErrTxDone": ValueOf(&sql.ErrTxDone).Elem(), + "LevelDefault": ValueOf(sql.LevelDefault), + "LevelLinearizable": ValueOf(sql.LevelLinearizable), + "LevelReadCommitted": ValueOf(sql.LevelReadCommitted), + "LevelReadUncommitted": ValueOf(sql.LevelReadUncommitted), + "LevelRepeatableRead": ValueOf(sql.LevelRepeatableRead), + "LevelSerializable": ValueOf(sql.LevelSerializable), + "LevelSnapshot": ValueOf(sql.LevelSnapshot), + "LevelWriteCommitted": ValueOf(sql.LevelWriteCommitted), + "Named": ValueOf(sql.Named), + "Open": ValueOf(sql.Open), + "Register": ValueOf(sql.Register), + },Types: map[string]Type{ + "ColumnType": TypeOf((*sql.ColumnType)(nil)).Elem(), + "DB": TypeOf((*sql.DB)(nil)).Elem(), + "DBStats": TypeOf((*sql.DBStats)(nil)).Elem(), + "IsolationLevel": TypeOf((*sql.IsolationLevel)(nil)).Elem(), + "NamedArg": TypeOf((*sql.NamedArg)(nil)).Elem(), + "NullBool": TypeOf((*sql.NullBool)(nil)).Elem(), + "NullFloat64": TypeOf((*sql.NullFloat64)(nil)).Elem(), + "NullInt64": TypeOf((*sql.NullInt64)(nil)).Elem(), + "NullString": TypeOf((*sql.NullString)(nil)).Elem(), + "RawBytes": TypeOf((*sql.RawBytes)(nil)).Elem(), + "Result": TypeOf((*sql.Result)(nil)).Elem(), + "Row": TypeOf((*sql.Row)(nil)).Elem(), + "Rows": TypeOf((*sql.Rows)(nil)).Elem(), + "Scanner": TypeOf((*sql.Scanner)(nil)).Elem(), + "Stmt": TypeOf((*sql.Stmt)(nil)).Elem(), + "Tx": TypeOf((*sql.Tx)(nil)).Elem(), + "TxOptions": TypeOf((*sql.TxOptions)(nil)).Elem(), + },Proxies: map[string]Type{ + "Result": TypeOf((*Result_database_sql)(nil)).Elem(), + "Scanner": TypeOf((*Scanner_database_sql)(nil)).Elem(), + }, + } +} + +// --------------- proxy for database/sql.Result --------------- +type Result_database_sql struct { + Object interface{} + LastInsertId_ func(interface{}) (int64, error) + RowsAffected_ func(interface{}) (int64, error) +} +func (Proxy *Result_database_sql) LastInsertId() (int64, error) { + return Proxy.LastInsertId_(Proxy.Object) +} +func (Proxy *Result_database_sql) RowsAffected() (int64, error) { + return Proxy.RowsAffected_(Proxy.Object) +} + +// --------------- proxy for database/sql.Scanner --------------- +type Scanner_database_sql struct { + Object interface{} + Scan_ func(_proxy_obj_ interface{}, src interface{}) error +} +func (Proxy *Scanner_database_sql) Scan(src interface{}) error { + return Proxy.Scan_(Proxy.Object, src) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/database_sql_driver.go b/vendor/github.com/cosmos72/gomacro/imports/database_sql_driver.go new file mode 100644 index 0000000..788433f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/database_sql_driver.go @@ -0,0 +1,419 @@ +// this file was generated by gomacro command: import _b "database/sql/driver" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "context" + "database/sql/driver" + "reflect" +) + +// reflection: allow interpreted code to import "database/sql/driver" +func init() { + Packages["database/sql/driver"] = Package{ + Binds: map[string]Value{ + "Bool": ValueOf(&driver.Bool).Elem(), + "DefaultParameterConverter": ValueOf(&driver.DefaultParameterConverter).Elem(), + "ErrBadConn": ValueOf(&driver.ErrBadConn).Elem(), + "ErrSkip": ValueOf(&driver.ErrSkip).Elem(), + "Int32": ValueOf(&driver.Int32).Elem(), + "IsScanValue": ValueOf(driver.IsScanValue), + "IsValue": ValueOf(driver.IsValue), + "ResultNoRows": ValueOf(&driver.ResultNoRows).Elem(), + "String": ValueOf(&driver.String).Elem(), + },Types: map[string]Type{ + "ColumnConverter": TypeOf((*driver.ColumnConverter)(nil)).Elem(), + "Conn": TypeOf((*driver.Conn)(nil)).Elem(), + "ConnBeginTx": TypeOf((*driver.ConnBeginTx)(nil)).Elem(), + "ConnPrepareContext": TypeOf((*driver.ConnPrepareContext)(nil)).Elem(), + "Driver": TypeOf((*driver.Driver)(nil)).Elem(), + "Execer": TypeOf((*driver.Execer)(nil)).Elem(), + "ExecerContext": TypeOf((*driver.ExecerContext)(nil)).Elem(), + "IsolationLevel": TypeOf((*driver.IsolationLevel)(nil)).Elem(), + "NamedValue": TypeOf((*driver.NamedValue)(nil)).Elem(), + "NotNull": TypeOf((*driver.NotNull)(nil)).Elem(), + "Null": TypeOf((*driver.Null)(nil)).Elem(), + "Pinger": TypeOf((*driver.Pinger)(nil)).Elem(), + "Queryer": TypeOf((*driver.Queryer)(nil)).Elem(), + "QueryerContext": TypeOf((*driver.QueryerContext)(nil)).Elem(), + "Result": TypeOf((*driver.Result)(nil)).Elem(), + "Rows": TypeOf((*driver.Rows)(nil)).Elem(), + "RowsAffected": TypeOf((*driver.RowsAffected)(nil)).Elem(), + "RowsColumnTypeDatabaseTypeName": TypeOf((*driver.RowsColumnTypeDatabaseTypeName)(nil)).Elem(), + "RowsColumnTypeLength": TypeOf((*driver.RowsColumnTypeLength)(nil)).Elem(), + "RowsColumnTypeNullable": TypeOf((*driver.RowsColumnTypeNullable)(nil)).Elem(), + "RowsColumnTypePrecisionScale": TypeOf((*driver.RowsColumnTypePrecisionScale)(nil)).Elem(), + "RowsColumnTypeScanType": TypeOf((*driver.RowsColumnTypeScanType)(nil)).Elem(), + "RowsNextResultSet": TypeOf((*driver.RowsNextResultSet)(nil)).Elem(), + "Stmt": TypeOf((*driver.Stmt)(nil)).Elem(), + "StmtExecContext": TypeOf((*driver.StmtExecContext)(nil)).Elem(), + "StmtQueryContext": TypeOf((*driver.StmtQueryContext)(nil)).Elem(), + "Tx": TypeOf((*driver.Tx)(nil)).Elem(), + "TxOptions": TypeOf((*driver.TxOptions)(nil)).Elem(), + "Value": TypeOf((*driver.Value)(nil)).Elem(), + "ValueConverter": TypeOf((*driver.ValueConverter)(nil)).Elem(), + "Valuer": TypeOf((*driver.Valuer)(nil)).Elem(), + },Proxies: map[string]Type{ + "ColumnConverter": TypeOf((*ColumnConverter_database_sql_driver)(nil)).Elem(), + "Conn": TypeOf((*Conn_database_sql_driver)(nil)).Elem(), + "ConnBeginTx": TypeOf((*ConnBeginTx_database_sql_driver)(nil)).Elem(), + "ConnPrepareContext": TypeOf((*ConnPrepareContext_database_sql_driver)(nil)).Elem(), + "Driver": TypeOf((*Driver_database_sql_driver)(nil)).Elem(), + "Execer": TypeOf((*Execer_database_sql_driver)(nil)).Elem(), + "ExecerContext": TypeOf((*ExecerContext_database_sql_driver)(nil)).Elem(), + "Pinger": TypeOf((*Pinger_database_sql_driver)(nil)).Elem(), + "Queryer": TypeOf((*Queryer_database_sql_driver)(nil)).Elem(), + "QueryerContext": TypeOf((*QueryerContext_database_sql_driver)(nil)).Elem(), + "Result": TypeOf((*Result_database_sql_driver)(nil)).Elem(), + "Rows": TypeOf((*Rows_database_sql_driver)(nil)).Elem(), + "RowsColumnTypeDatabaseTypeName": TypeOf((*RowsColumnTypeDatabaseTypeName_database_sql_driver)(nil)).Elem(), + "RowsColumnTypeLength": TypeOf((*RowsColumnTypeLength_database_sql_driver)(nil)).Elem(), + "RowsColumnTypeNullable": TypeOf((*RowsColumnTypeNullable_database_sql_driver)(nil)).Elem(), + "RowsColumnTypePrecisionScale": TypeOf((*RowsColumnTypePrecisionScale_database_sql_driver)(nil)).Elem(), + "RowsColumnTypeScanType": TypeOf((*RowsColumnTypeScanType_database_sql_driver)(nil)).Elem(), + "RowsNextResultSet": TypeOf((*RowsNextResultSet_database_sql_driver)(nil)).Elem(), + "Stmt": TypeOf((*Stmt_database_sql_driver)(nil)).Elem(), + "StmtExecContext": TypeOf((*StmtExecContext_database_sql_driver)(nil)).Elem(), + "StmtQueryContext": TypeOf((*StmtQueryContext_database_sql_driver)(nil)).Elem(), + "Tx": TypeOf((*Tx_database_sql_driver)(nil)).Elem(), + "Value": TypeOf((*Value_database_sql_driver)(nil)).Elem(), + "ValueConverter": TypeOf((*ValueConverter_database_sql_driver)(nil)).Elem(), + "Valuer": TypeOf((*Valuer_database_sql_driver)(nil)).Elem(), + }, + } +} + +// --------------- proxy for database/sql/driver.ColumnConverter --------------- +type ColumnConverter_database_sql_driver struct { + Object interface{} + ColumnConverter_ func(_proxy_obj_ interface{}, idx int) driver.ValueConverter +} +func (Proxy *ColumnConverter_database_sql_driver) ColumnConverter(idx int) driver.ValueConverter { + return Proxy.ColumnConverter_(Proxy.Object, idx) +} + +// --------------- proxy for database/sql/driver.Conn --------------- +type Conn_database_sql_driver struct { + Object interface{} + Begin_ func(interface{}) (driver.Tx, error) + Close_ func(interface{}) error + Prepare_ func(_proxy_obj_ interface{}, query string) (driver.Stmt, error) +} +func (Proxy *Conn_database_sql_driver) Begin() (driver.Tx, error) { + return Proxy.Begin_(Proxy.Object) +} +func (Proxy *Conn_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *Conn_database_sql_driver) Prepare(query string) (driver.Stmt, error) { + return Proxy.Prepare_(Proxy.Object, query) +} + +// --------------- proxy for database/sql/driver.ConnBeginTx --------------- +type ConnBeginTx_database_sql_driver struct { + Object interface{} + BeginTx_ func(_proxy_obj_ interface{}, ctx context.Context, opts driver.TxOptions) (driver.Tx, error) +} +func (Proxy *ConnBeginTx_database_sql_driver) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { + return Proxy.BeginTx_(Proxy.Object, ctx, opts) +} + +// --------------- proxy for database/sql/driver.ConnPrepareContext --------------- +type ConnPrepareContext_database_sql_driver struct { + Object interface{} + PrepareContext_ func(_proxy_obj_ interface{}, ctx context.Context, query string) (driver.Stmt, error) +} +func (Proxy *ConnPrepareContext_database_sql_driver) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { + return Proxy.PrepareContext_(Proxy.Object, ctx, query) +} + +// --------------- proxy for database/sql/driver.Driver --------------- +type Driver_database_sql_driver struct { + Object interface{} + Open_ func(_proxy_obj_ interface{}, name string) (driver.Conn, error) +} +func (Proxy *Driver_database_sql_driver) Open(name string) (driver.Conn, error) { + return Proxy.Open_(Proxy.Object, name) +} + +// --------------- proxy for database/sql/driver.Execer --------------- +type Execer_database_sql_driver struct { + Object interface{} + Exec_ func(_proxy_obj_ interface{}, query string, args []driver.Value) (driver.Result, error) +} +func (Proxy *Execer_database_sql_driver) Exec(query string, args []driver.Value) (driver.Result, error) { + return Proxy.Exec_(Proxy.Object, query, args) +} + +// --------------- proxy for database/sql/driver.ExecerContext --------------- +type ExecerContext_database_sql_driver struct { + Object interface{} + ExecContext_ func(_proxy_obj_ interface{}, ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) +} +func (Proxy *ExecerContext_database_sql_driver) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { + return Proxy.ExecContext_(Proxy.Object, ctx, query, args) +} + +// --------------- proxy for database/sql/driver.Pinger --------------- +type Pinger_database_sql_driver struct { + Object interface{} + Ping_ func(_proxy_obj_ interface{}, ctx context.Context) error +} +func (Proxy *Pinger_database_sql_driver) Ping(ctx context.Context) error { + return Proxy.Ping_(Proxy.Object, ctx) +} + +// --------------- proxy for database/sql/driver.Queryer --------------- +type Queryer_database_sql_driver struct { + Object interface{} + Query_ func(_proxy_obj_ interface{}, query string, args []driver.Value) (driver.Rows, error) +} +func (Proxy *Queryer_database_sql_driver) Query(query string, args []driver.Value) (driver.Rows, error) { + return Proxy.Query_(Proxy.Object, query, args) +} + +// --------------- proxy for database/sql/driver.QueryerContext --------------- +type QueryerContext_database_sql_driver struct { + Object interface{} + QueryContext_ func(_proxy_obj_ interface{}, ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) +} +func (Proxy *QueryerContext_database_sql_driver) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { + return Proxy.QueryContext_(Proxy.Object, ctx, query, args) +} + +// --------------- proxy for database/sql/driver.Result --------------- +type Result_database_sql_driver struct { + Object interface{} + LastInsertId_ func(interface{}) (int64, error) + RowsAffected_ func(interface{}) (int64, error) +} +func (Proxy *Result_database_sql_driver) LastInsertId() (int64, error) { + return Proxy.LastInsertId_(Proxy.Object) +} +func (Proxy *Result_database_sql_driver) RowsAffected() (int64, error) { + return Proxy.RowsAffected_(Proxy.Object) +} + +// --------------- proxy for database/sql/driver.Rows --------------- +type Rows_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *Rows_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *Rows_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *Rows_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsColumnTypeDatabaseTypeName --------------- +type RowsColumnTypeDatabaseTypeName_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + ColumnTypeDatabaseTypeName_ func(_proxy_obj_ interface{}, index int) string + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *RowsColumnTypeDatabaseTypeName_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsColumnTypeDatabaseTypeName_database_sql_driver) ColumnTypeDatabaseTypeName(index int) string { + return Proxy.ColumnTypeDatabaseTypeName_(Proxy.Object, index) +} +func (Proxy *RowsColumnTypeDatabaseTypeName_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsColumnTypeDatabaseTypeName_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsColumnTypeLength --------------- +type RowsColumnTypeLength_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + ColumnTypeLength_ func(_proxy_obj_ interface{}, index int) (length int64, ok bool) + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *RowsColumnTypeLength_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsColumnTypeLength_database_sql_driver) ColumnTypeLength(index int) (length int64, ok bool) { + return Proxy.ColumnTypeLength_(Proxy.Object, index) +} +func (Proxy *RowsColumnTypeLength_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsColumnTypeLength_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsColumnTypeNullable --------------- +type RowsColumnTypeNullable_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + ColumnTypeNullable_ func(_proxy_obj_ interface{}, index int) (nullable bool, ok bool) + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *RowsColumnTypeNullable_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsColumnTypeNullable_database_sql_driver) ColumnTypeNullable(index int) (nullable bool, ok bool) { + return Proxy.ColumnTypeNullable_(Proxy.Object, index) +} +func (Proxy *RowsColumnTypeNullable_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsColumnTypeNullable_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsColumnTypePrecisionScale --------------- +type RowsColumnTypePrecisionScale_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + ColumnTypePrecisionScale_ func(_proxy_obj_ interface{}, index int) (precision int64, scale int64, ok bool) + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *RowsColumnTypePrecisionScale_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsColumnTypePrecisionScale_database_sql_driver) ColumnTypePrecisionScale(index int) (precision int64, scale int64, ok bool) { + return Proxy.ColumnTypePrecisionScale_(Proxy.Object, index) +} +func (Proxy *RowsColumnTypePrecisionScale_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsColumnTypePrecisionScale_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsColumnTypeScanType --------------- +type RowsColumnTypeScanType_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + ColumnTypeScanType_ func(_proxy_obj_ interface{}, index int) reflect.Type + Columns_ func(interface{}) []string + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error +} +func (Proxy *RowsColumnTypeScanType_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsColumnTypeScanType_database_sql_driver) ColumnTypeScanType(index int) reflect.Type { + return Proxy.ColumnTypeScanType_(Proxy.Object, index) +} +func (Proxy *RowsColumnTypeScanType_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsColumnTypeScanType_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} + +// --------------- proxy for database/sql/driver.RowsNextResultSet --------------- +type RowsNextResultSet_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + Columns_ func(interface{}) []string + HasNextResultSet_ func(interface{}) bool + Next_ func(_proxy_obj_ interface{}, dest []driver.Value) error + NextResultSet_ func(interface{}) error +} +func (Proxy *RowsNextResultSet_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *RowsNextResultSet_database_sql_driver) Columns() []string { + return Proxy.Columns_(Proxy.Object) +} +func (Proxy *RowsNextResultSet_database_sql_driver) HasNextResultSet() bool { + return Proxy.HasNextResultSet_(Proxy.Object) +} +func (Proxy *RowsNextResultSet_database_sql_driver) Next(dest []driver.Value) error { + return Proxy.Next_(Proxy.Object, dest) +} +func (Proxy *RowsNextResultSet_database_sql_driver) NextResultSet() error { + return Proxy.NextResultSet_(Proxy.Object) +} + +// --------------- proxy for database/sql/driver.Stmt --------------- +type Stmt_database_sql_driver struct { + Object interface{} + Close_ func(interface{}) error + Exec_ func(_proxy_obj_ interface{}, args []driver.Value) (driver.Result, error) + NumInput_ func(interface{}) int + Query_ func(_proxy_obj_ interface{}, args []driver.Value) (driver.Rows, error) +} +func (Proxy *Stmt_database_sql_driver) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *Stmt_database_sql_driver) Exec(args []driver.Value) (driver.Result, error) { + return Proxy.Exec_(Proxy.Object, args) +} +func (Proxy *Stmt_database_sql_driver) NumInput() int { + return Proxy.NumInput_(Proxy.Object) +} +func (Proxy *Stmt_database_sql_driver) Query(args []driver.Value) (driver.Rows, error) { + return Proxy.Query_(Proxy.Object, args) +} + +// --------------- proxy for database/sql/driver.StmtExecContext --------------- +type StmtExecContext_database_sql_driver struct { + Object interface{} + ExecContext_ func(_proxy_obj_ interface{}, ctx context.Context, args []driver.NamedValue) (driver.Result, error) +} +func (Proxy *StmtExecContext_database_sql_driver) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { + return Proxy.ExecContext_(Proxy.Object, ctx, args) +} + +// --------------- proxy for database/sql/driver.StmtQueryContext --------------- +type StmtQueryContext_database_sql_driver struct { + Object interface{} + QueryContext_ func(_proxy_obj_ interface{}, ctx context.Context, args []driver.NamedValue) (driver.Rows, error) +} +func (Proxy *StmtQueryContext_database_sql_driver) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { + return Proxy.QueryContext_(Proxy.Object, ctx, args) +} + +// --------------- proxy for database/sql/driver.Tx --------------- +type Tx_database_sql_driver struct { + Object interface{} + Commit_ func(interface{}) error + Rollback_ func(interface{}) error +} +func (Proxy *Tx_database_sql_driver) Commit() error { + return Proxy.Commit_(Proxy.Object) +} +func (Proxy *Tx_database_sql_driver) Rollback() error { + return Proxy.Rollback_(Proxy.Object) +} + +// --------------- proxy for database/sql/driver.Value --------------- +type Value_database_sql_driver struct { + Object interface{} +} + +// --------------- proxy for database/sql/driver.ValueConverter --------------- +type ValueConverter_database_sql_driver struct { + Object interface{} + ConvertValue_ func(_proxy_obj_ interface{}, v interface{}) (driver.Value, error) +} +func (Proxy *ValueConverter_database_sql_driver) ConvertValue(v interface{}) (driver.Value, error) { + return Proxy.ConvertValue_(Proxy.Object, v) +} + +// --------------- proxy for database/sql/driver.Valuer --------------- +type Valuer_database_sql_driver struct { + Object interface{} + Value_ func(interface{}) (driver.Value, error) +} +func (Proxy *Valuer_database_sql_driver) Value() (driver.Value, error) { + return Proxy.Value_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_dwarf.go b/vendor/github.com/cosmos72/gomacro/imports/debug_dwarf.go new file mode 100644 index 0000000..96c3ca9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_dwarf.go @@ -0,0 +1,243 @@ +// this file was generated by gomacro command: import _b "debug/dwarf" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/dwarf" +) + +// reflection: allow interpreted code to import "debug/dwarf" +func init() { + Packages["debug/dwarf"] = Package{ + Binds: map[string]Value{ + "AttrAbstractOrigin": ValueOf(dwarf.AttrAbstractOrigin), + "AttrAccessibility": ValueOf(dwarf.AttrAccessibility), + "AttrAddrClass": ValueOf(dwarf.AttrAddrClass), + "AttrAllocated": ValueOf(dwarf.AttrAllocated), + "AttrArtificial": ValueOf(dwarf.AttrArtificial), + "AttrAssociated": ValueOf(dwarf.AttrAssociated), + "AttrBaseTypes": ValueOf(dwarf.AttrBaseTypes), + "AttrBitOffset": ValueOf(dwarf.AttrBitOffset), + "AttrBitSize": ValueOf(dwarf.AttrBitSize), + "AttrByteSize": ValueOf(dwarf.AttrByteSize), + "AttrCallColumn": ValueOf(dwarf.AttrCallColumn), + "AttrCallFile": ValueOf(dwarf.AttrCallFile), + "AttrCallLine": ValueOf(dwarf.AttrCallLine), + "AttrCalling": ValueOf(dwarf.AttrCalling), + "AttrCommonRef": ValueOf(dwarf.AttrCommonRef), + "AttrCompDir": ValueOf(dwarf.AttrCompDir), + "AttrConstValue": ValueOf(dwarf.AttrConstValue), + "AttrContainingType": ValueOf(dwarf.AttrContainingType), + "AttrCount": ValueOf(dwarf.AttrCount), + "AttrDataLocation": ValueOf(dwarf.AttrDataLocation), + "AttrDataMemberLoc": ValueOf(dwarf.AttrDataMemberLoc), + "AttrDeclColumn": ValueOf(dwarf.AttrDeclColumn), + "AttrDeclFile": ValueOf(dwarf.AttrDeclFile), + "AttrDeclLine": ValueOf(dwarf.AttrDeclLine), + "AttrDeclaration": ValueOf(dwarf.AttrDeclaration), + "AttrDefaultValue": ValueOf(dwarf.AttrDefaultValue), + "AttrDescription": ValueOf(dwarf.AttrDescription), + "AttrDiscr": ValueOf(dwarf.AttrDiscr), + "AttrDiscrList": ValueOf(dwarf.AttrDiscrList), + "AttrDiscrValue": ValueOf(dwarf.AttrDiscrValue), + "AttrEncoding": ValueOf(dwarf.AttrEncoding), + "AttrEntrypc": ValueOf(dwarf.AttrEntrypc), + "AttrExtension": ValueOf(dwarf.AttrExtension), + "AttrExternal": ValueOf(dwarf.AttrExternal), + "AttrFrameBase": ValueOf(dwarf.AttrFrameBase), + "AttrFriend": ValueOf(dwarf.AttrFriend), + "AttrHighpc": ValueOf(dwarf.AttrHighpc), + "AttrIdentifierCase": ValueOf(dwarf.AttrIdentifierCase), + "AttrImport": ValueOf(dwarf.AttrImport), + "AttrInline": ValueOf(dwarf.AttrInline), + "AttrIsOptional": ValueOf(dwarf.AttrIsOptional), + "AttrLanguage": ValueOf(dwarf.AttrLanguage), + "AttrLocation": ValueOf(dwarf.AttrLocation), + "AttrLowerBound": ValueOf(dwarf.AttrLowerBound), + "AttrLowpc": ValueOf(dwarf.AttrLowpc), + "AttrMacroInfo": ValueOf(dwarf.AttrMacroInfo), + "AttrName": ValueOf(dwarf.AttrName), + "AttrNamelistItem": ValueOf(dwarf.AttrNamelistItem), + "AttrOrdering": ValueOf(dwarf.AttrOrdering), + "AttrPriority": ValueOf(dwarf.AttrPriority), + "AttrProducer": ValueOf(dwarf.AttrProducer), + "AttrPrototyped": ValueOf(dwarf.AttrPrototyped), + "AttrRanges": ValueOf(dwarf.AttrRanges), + "AttrReturnAddr": ValueOf(dwarf.AttrReturnAddr), + "AttrSegment": ValueOf(dwarf.AttrSegment), + "AttrSibling": ValueOf(dwarf.AttrSibling), + "AttrSpecification": ValueOf(dwarf.AttrSpecification), + "AttrStartScope": ValueOf(dwarf.AttrStartScope), + "AttrStaticLink": ValueOf(dwarf.AttrStaticLink), + "AttrStmtList": ValueOf(dwarf.AttrStmtList), + "AttrStride": ValueOf(dwarf.AttrStride), + "AttrStrideSize": ValueOf(dwarf.AttrStrideSize), + "AttrStringLength": ValueOf(dwarf.AttrStringLength), + "AttrTrampoline": ValueOf(dwarf.AttrTrampoline), + "AttrType": ValueOf(dwarf.AttrType), + "AttrUpperBound": ValueOf(dwarf.AttrUpperBound), + "AttrUseLocation": ValueOf(dwarf.AttrUseLocation), + "AttrUseUTF8": ValueOf(dwarf.AttrUseUTF8), + "AttrVarParam": ValueOf(dwarf.AttrVarParam), + "AttrVirtuality": ValueOf(dwarf.AttrVirtuality), + "AttrVisibility": ValueOf(dwarf.AttrVisibility), + "AttrVtableElemLoc": ValueOf(dwarf.AttrVtableElemLoc), + "ClassAddress": ValueOf(dwarf.ClassAddress), + "ClassBlock": ValueOf(dwarf.ClassBlock), + "ClassConstant": ValueOf(dwarf.ClassConstant), + "ClassExprLoc": ValueOf(dwarf.ClassExprLoc), + "ClassFlag": ValueOf(dwarf.ClassFlag), + "ClassLinePtr": ValueOf(dwarf.ClassLinePtr), + "ClassLocListPtr": ValueOf(dwarf.ClassLocListPtr), + "ClassMacPtr": ValueOf(dwarf.ClassMacPtr), + "ClassRangeListPtr": ValueOf(dwarf.ClassRangeListPtr), + "ClassReference": ValueOf(dwarf.ClassReference), + "ClassReferenceAlt": ValueOf(dwarf.ClassReferenceAlt), + "ClassReferenceSig": ValueOf(dwarf.ClassReferenceSig), + "ClassString": ValueOf(dwarf.ClassString), + "ClassStringAlt": ValueOf(dwarf.ClassStringAlt), + "ClassUnknown": ValueOf(dwarf.ClassUnknown), + "ErrUnknownPC": ValueOf(&dwarf.ErrUnknownPC).Elem(), + "New": ValueOf(dwarf.New), + "TagAccessDeclaration": ValueOf(dwarf.TagAccessDeclaration), + "TagArrayType": ValueOf(dwarf.TagArrayType), + "TagBaseType": ValueOf(dwarf.TagBaseType), + "TagCatchDwarfBlock": ValueOf(dwarf.TagCatchDwarfBlock), + "TagClassType": ValueOf(dwarf.TagClassType), + "TagCommonDwarfBlock": ValueOf(dwarf.TagCommonDwarfBlock), + "TagCommonInclusion": ValueOf(dwarf.TagCommonInclusion), + "TagCompileUnit": ValueOf(dwarf.TagCompileUnit), + "TagCondition": ValueOf(dwarf.TagCondition), + "TagConstType": ValueOf(dwarf.TagConstType), + "TagConstant": ValueOf(dwarf.TagConstant), + "TagDwarfProcedure": ValueOf(dwarf.TagDwarfProcedure), + "TagEntryPoint": ValueOf(dwarf.TagEntryPoint), + "TagEnumerationType": ValueOf(dwarf.TagEnumerationType), + "TagEnumerator": ValueOf(dwarf.TagEnumerator), + "TagFileType": ValueOf(dwarf.TagFileType), + "TagFormalParameter": ValueOf(dwarf.TagFormalParameter), + "TagFriend": ValueOf(dwarf.TagFriend), + "TagImportedDeclaration": ValueOf(dwarf.TagImportedDeclaration), + "TagImportedModule": ValueOf(dwarf.TagImportedModule), + "TagImportedUnit": ValueOf(dwarf.TagImportedUnit), + "TagInheritance": ValueOf(dwarf.TagInheritance), + "TagInlinedSubroutine": ValueOf(dwarf.TagInlinedSubroutine), + "TagInterfaceType": ValueOf(dwarf.TagInterfaceType), + "TagLabel": ValueOf(dwarf.TagLabel), + "TagLexDwarfBlock": ValueOf(dwarf.TagLexDwarfBlock), + "TagMember": ValueOf(dwarf.TagMember), + "TagModule": ValueOf(dwarf.TagModule), + "TagMutableType": ValueOf(dwarf.TagMutableType), + "TagNamelist": ValueOf(dwarf.TagNamelist), + "TagNamelistItem": ValueOf(dwarf.TagNamelistItem), + "TagNamespace": ValueOf(dwarf.TagNamespace), + "TagPackedType": ValueOf(dwarf.TagPackedType), + "TagPartialUnit": ValueOf(dwarf.TagPartialUnit), + "TagPointerType": ValueOf(dwarf.TagPointerType), + "TagPtrToMemberType": ValueOf(dwarf.TagPtrToMemberType), + "TagReferenceType": ValueOf(dwarf.TagReferenceType), + "TagRestrictType": ValueOf(dwarf.TagRestrictType), + "TagRvalueReferenceType": ValueOf(dwarf.TagRvalueReferenceType), + "TagSetType": ValueOf(dwarf.TagSetType), + "TagSharedType": ValueOf(dwarf.TagSharedType), + "TagStringType": ValueOf(dwarf.TagStringType), + "TagStructType": ValueOf(dwarf.TagStructType), + "TagSubprogram": ValueOf(dwarf.TagSubprogram), + "TagSubrangeType": ValueOf(dwarf.TagSubrangeType), + "TagSubroutineType": ValueOf(dwarf.TagSubroutineType), + "TagTemplateAlias": ValueOf(dwarf.TagTemplateAlias), + "TagTemplateTypeParameter": ValueOf(dwarf.TagTemplateTypeParameter), + "TagTemplateValueParameter": ValueOf(dwarf.TagTemplateValueParameter), + "TagThrownType": ValueOf(dwarf.TagThrownType), + "TagTryDwarfBlock": ValueOf(dwarf.TagTryDwarfBlock), + "TagTypeUnit": ValueOf(dwarf.TagTypeUnit), + "TagTypedef": ValueOf(dwarf.TagTypedef), + "TagUnionType": ValueOf(dwarf.TagUnionType), + "TagUnspecifiedParameters": ValueOf(dwarf.TagUnspecifiedParameters), + "TagUnspecifiedType": ValueOf(dwarf.TagUnspecifiedType), + "TagVariable": ValueOf(dwarf.TagVariable), + "TagVariant": ValueOf(dwarf.TagVariant), + "TagVariantPart": ValueOf(dwarf.TagVariantPart), + "TagVolatileType": ValueOf(dwarf.TagVolatileType), + "TagWithStmt": ValueOf(dwarf.TagWithStmt), + },Types: map[string]Type{ + "AddrType": TypeOf((*dwarf.AddrType)(nil)).Elem(), + "ArrayType": TypeOf((*dwarf.ArrayType)(nil)).Elem(), + "Attr": TypeOf((*dwarf.Attr)(nil)).Elem(), + "BasicType": TypeOf((*dwarf.BasicType)(nil)).Elem(), + "BoolType": TypeOf((*dwarf.BoolType)(nil)).Elem(), + "CharType": TypeOf((*dwarf.CharType)(nil)).Elem(), + "Class": TypeOf((*dwarf.Class)(nil)).Elem(), + "CommonType": TypeOf((*dwarf.CommonType)(nil)).Elem(), + "ComplexType": TypeOf((*dwarf.ComplexType)(nil)).Elem(), + "Data": TypeOf((*dwarf.Data)(nil)).Elem(), + "DecodeError": TypeOf((*dwarf.DecodeError)(nil)).Elem(), + "DotDotDotType": TypeOf((*dwarf.DotDotDotType)(nil)).Elem(), + "Entry": TypeOf((*dwarf.Entry)(nil)).Elem(), + "EnumType": TypeOf((*dwarf.EnumType)(nil)).Elem(), + "EnumValue": TypeOf((*dwarf.EnumValue)(nil)).Elem(), + "Field": TypeOf((*dwarf.Field)(nil)).Elem(), + "FloatType": TypeOf((*dwarf.FloatType)(nil)).Elem(), + "FuncType": TypeOf((*dwarf.FuncType)(nil)).Elem(), + "IntType": TypeOf((*dwarf.IntType)(nil)).Elem(), + "LineEntry": TypeOf((*dwarf.LineEntry)(nil)).Elem(), + "LineFile": TypeOf((*dwarf.LineFile)(nil)).Elem(), + "LineReader": TypeOf((*dwarf.LineReader)(nil)).Elem(), + "LineReaderPos": TypeOf((*dwarf.LineReaderPos)(nil)).Elem(), + "Offset": TypeOf((*dwarf.Offset)(nil)).Elem(), + "PtrType": TypeOf((*dwarf.PtrType)(nil)).Elem(), + "QualType": TypeOf((*dwarf.QualType)(nil)).Elem(), + "Reader": TypeOf((*dwarf.Reader)(nil)).Elem(), + "StructField": TypeOf((*dwarf.StructField)(nil)).Elem(), + "StructType": TypeOf((*dwarf.StructType)(nil)).Elem(), + "Tag": TypeOf((*dwarf.Tag)(nil)).Elem(), + "Type": TypeOf((*dwarf.Type)(nil)).Elem(), + "TypedefType": TypeOf((*dwarf.TypedefType)(nil)).Elem(), + "UcharType": TypeOf((*dwarf.UcharType)(nil)).Elem(), + "UintType": TypeOf((*dwarf.UintType)(nil)).Elem(), + "UnspecifiedType": TypeOf((*dwarf.UnspecifiedType)(nil)).Elem(), + "VoidType": TypeOf((*dwarf.VoidType)(nil)).Elem(), + },Proxies: map[string]Type{ + "Type": TypeOf((*Type_debug_dwarf)(nil)).Elem(), + },Wrappers: map[string][]string{ + "AddrType": []string{"Basic","Common","Size","String",}, + "ArrayType": []string{"Common",}, + "BasicType": []string{"Common","Size",}, + "BoolType": []string{"Basic","Common","Size","String",}, + "CharType": []string{"Basic","Common","Size","String",}, + "ComplexType": []string{"Basic","Common","Size","String",}, + "DotDotDotType": []string{"Common","Size",}, + "EnumType": []string{"Common","Size",}, + "FloatType": []string{"Basic","Common","Size","String",}, + "FuncType": []string{"Common","Size",}, + "IntType": []string{"Basic","Common","Size","String",}, + "PtrType": []string{"Common","Size",}, + "QualType": []string{"Common",}, + "StructType": []string{"Common","Size",}, + "TypedefType": []string{"Common",}, + "UcharType": []string{"Basic","Common","Size","String",}, + "UintType": []string{"Basic","Common","Size","String",}, + "UnspecifiedType": []string{"Basic","Common","Size","String",}, + "VoidType": []string{"Common","Size",}, + }, + } +} + +// --------------- proxy for debug/dwarf.Type --------------- +type Type_debug_dwarf struct { + Object interface{} + Common_ func(interface{}) *dwarf.CommonType + Size_ func(interface{}) int64 + String_ func(interface{}) string +} +func (Proxy *Type_debug_dwarf) Common() *dwarf.CommonType { + return Proxy.Common_(Proxy.Object) +} +func (Proxy *Type_debug_dwarf) Size() int64 { + return Proxy.Size_(Proxy.Object) +} +func (Proxy *Type_debug_dwarf) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_elf.go b/vendor/github.com/cosmos72/gomacro/imports/debug_elf.go new file mode 100644 index 0000000..8319587 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_elf.go @@ -0,0 +1,894 @@ +// this file was generated by gomacro command: import _b "debug/elf" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/elf" +) + +// reflection: allow interpreted code to import "debug/elf" +func init() { + Packages["debug/elf"] = Package{ + Binds: map[string]Value{ + "ARM_MAGIC_TRAMP_NUMBER": ValueOf(elf.ARM_MAGIC_TRAMP_NUMBER), + "COMPRESS_HIOS": ValueOf(elf.COMPRESS_HIOS), + "COMPRESS_HIPROC": ValueOf(elf.COMPRESS_HIPROC), + "COMPRESS_LOOS": ValueOf(elf.COMPRESS_LOOS), + "COMPRESS_LOPROC": ValueOf(elf.COMPRESS_LOPROC), + "COMPRESS_ZLIB": ValueOf(elf.COMPRESS_ZLIB), + "DF_BIND_NOW": ValueOf(elf.DF_BIND_NOW), + "DF_ORIGIN": ValueOf(elf.DF_ORIGIN), + "DF_STATIC_TLS": ValueOf(elf.DF_STATIC_TLS), + "DF_SYMBOLIC": ValueOf(elf.DF_SYMBOLIC), + "DF_TEXTREL": ValueOf(elf.DF_TEXTREL), + "DT_BIND_NOW": ValueOf(elf.DT_BIND_NOW), + "DT_DEBUG": ValueOf(elf.DT_DEBUG), + "DT_ENCODING": ValueOf(elf.DT_ENCODING), + "DT_FINI": ValueOf(elf.DT_FINI), + "DT_FINI_ARRAY": ValueOf(elf.DT_FINI_ARRAY), + "DT_FINI_ARRAYSZ": ValueOf(elf.DT_FINI_ARRAYSZ), + "DT_FLAGS": ValueOf(elf.DT_FLAGS), + "DT_HASH": ValueOf(elf.DT_HASH), + "DT_HIOS": ValueOf(elf.DT_HIOS), + "DT_HIPROC": ValueOf(elf.DT_HIPROC), + "DT_INIT": ValueOf(elf.DT_INIT), + "DT_INIT_ARRAY": ValueOf(elf.DT_INIT_ARRAY), + "DT_INIT_ARRAYSZ": ValueOf(elf.DT_INIT_ARRAYSZ), + "DT_JMPREL": ValueOf(elf.DT_JMPREL), + "DT_LOOS": ValueOf(elf.DT_LOOS), + "DT_LOPROC": ValueOf(elf.DT_LOPROC), + "DT_NEEDED": ValueOf(elf.DT_NEEDED), + "DT_NULL": ValueOf(elf.DT_NULL), + "DT_PLTGOT": ValueOf(elf.DT_PLTGOT), + "DT_PLTREL": ValueOf(elf.DT_PLTREL), + "DT_PLTRELSZ": ValueOf(elf.DT_PLTRELSZ), + "DT_PREINIT_ARRAY": ValueOf(elf.DT_PREINIT_ARRAY), + "DT_PREINIT_ARRAYSZ": ValueOf(elf.DT_PREINIT_ARRAYSZ), + "DT_REL": ValueOf(elf.DT_REL), + "DT_RELA": ValueOf(elf.DT_RELA), + "DT_RELAENT": ValueOf(elf.DT_RELAENT), + "DT_RELASZ": ValueOf(elf.DT_RELASZ), + "DT_RELENT": ValueOf(elf.DT_RELENT), + "DT_RELSZ": ValueOf(elf.DT_RELSZ), + "DT_RPATH": ValueOf(elf.DT_RPATH), + "DT_RUNPATH": ValueOf(elf.DT_RUNPATH), + "DT_SONAME": ValueOf(elf.DT_SONAME), + "DT_STRSZ": ValueOf(elf.DT_STRSZ), + "DT_STRTAB": ValueOf(elf.DT_STRTAB), + "DT_SYMBOLIC": ValueOf(elf.DT_SYMBOLIC), + "DT_SYMENT": ValueOf(elf.DT_SYMENT), + "DT_SYMTAB": ValueOf(elf.DT_SYMTAB), + "DT_TEXTREL": ValueOf(elf.DT_TEXTREL), + "DT_VERNEED": ValueOf(elf.DT_VERNEED), + "DT_VERNEEDNUM": ValueOf(elf.DT_VERNEEDNUM), + "DT_VERSYM": ValueOf(elf.DT_VERSYM), + "EI_ABIVERSION": ValueOf(elf.EI_ABIVERSION), + "EI_CLASS": ValueOf(elf.EI_CLASS), + "EI_DATA": ValueOf(elf.EI_DATA), + "EI_NIDENT": ValueOf(elf.EI_NIDENT), + "EI_OSABI": ValueOf(elf.EI_OSABI), + "EI_PAD": ValueOf(elf.EI_PAD), + "EI_VERSION": ValueOf(elf.EI_VERSION), + "ELFCLASS32": ValueOf(elf.ELFCLASS32), + "ELFCLASS64": ValueOf(elf.ELFCLASS64), + "ELFCLASSNONE": ValueOf(elf.ELFCLASSNONE), + "ELFDATA2LSB": ValueOf(elf.ELFDATA2LSB), + "ELFDATA2MSB": ValueOf(elf.ELFDATA2MSB), + "ELFDATANONE": ValueOf(elf.ELFDATANONE), + "ELFMAG": ValueOf(elf.ELFMAG), + "ELFOSABI_86OPEN": ValueOf(elf.ELFOSABI_86OPEN), + "ELFOSABI_AIX": ValueOf(elf.ELFOSABI_AIX), + "ELFOSABI_ARM": ValueOf(elf.ELFOSABI_ARM), + "ELFOSABI_FREEBSD": ValueOf(elf.ELFOSABI_FREEBSD), + "ELFOSABI_HPUX": ValueOf(elf.ELFOSABI_HPUX), + "ELFOSABI_HURD": ValueOf(elf.ELFOSABI_HURD), + "ELFOSABI_IRIX": ValueOf(elf.ELFOSABI_IRIX), + "ELFOSABI_LINUX": ValueOf(elf.ELFOSABI_LINUX), + "ELFOSABI_MODESTO": ValueOf(elf.ELFOSABI_MODESTO), + "ELFOSABI_NETBSD": ValueOf(elf.ELFOSABI_NETBSD), + "ELFOSABI_NONE": ValueOf(elf.ELFOSABI_NONE), + "ELFOSABI_NSK": ValueOf(elf.ELFOSABI_NSK), + "ELFOSABI_OPENBSD": ValueOf(elf.ELFOSABI_OPENBSD), + "ELFOSABI_OPENVMS": ValueOf(elf.ELFOSABI_OPENVMS), + "ELFOSABI_SOLARIS": ValueOf(elf.ELFOSABI_SOLARIS), + "ELFOSABI_STANDALONE": ValueOf(elf.ELFOSABI_STANDALONE), + "ELFOSABI_TRU64": ValueOf(elf.ELFOSABI_TRU64), + "EM_386": ValueOf(elf.EM_386), + "EM_486": ValueOf(elf.EM_486), + "EM_68HC12": ValueOf(elf.EM_68HC12), + "EM_68K": ValueOf(elf.EM_68K), + "EM_860": ValueOf(elf.EM_860), + "EM_88K": ValueOf(elf.EM_88K), + "EM_960": ValueOf(elf.EM_960), + "EM_AARCH64": ValueOf(elf.EM_AARCH64), + "EM_ALPHA": ValueOf(elf.EM_ALPHA), + "EM_ALPHA_STD": ValueOf(elf.EM_ALPHA_STD), + "EM_ARC": ValueOf(elf.EM_ARC), + "EM_ARM": ValueOf(elf.EM_ARM), + "EM_COLDFIRE": ValueOf(elf.EM_COLDFIRE), + "EM_FR20": ValueOf(elf.EM_FR20), + "EM_H8S": ValueOf(elf.EM_H8S), + "EM_H8_300": ValueOf(elf.EM_H8_300), + "EM_H8_300H": ValueOf(elf.EM_H8_300H), + "EM_H8_500": ValueOf(elf.EM_H8_500), + "EM_IA_64": ValueOf(elf.EM_IA_64), + "EM_M32": ValueOf(elf.EM_M32), + "EM_ME16": ValueOf(elf.EM_ME16), + "EM_MIPS": ValueOf(elf.EM_MIPS), + "EM_MIPS_RS3_LE": ValueOf(elf.EM_MIPS_RS3_LE), + "EM_MIPS_RS4_BE": ValueOf(elf.EM_MIPS_RS4_BE), + "EM_MIPS_X": ValueOf(elf.EM_MIPS_X), + "EM_MMA": ValueOf(elf.EM_MMA), + "EM_NCPU": ValueOf(elf.EM_NCPU), + "EM_NDR1": ValueOf(elf.EM_NDR1), + "EM_NONE": ValueOf(elf.EM_NONE), + "EM_PARISC": ValueOf(elf.EM_PARISC), + "EM_PCP": ValueOf(elf.EM_PCP), + "EM_PPC": ValueOf(elf.EM_PPC), + "EM_PPC64": ValueOf(elf.EM_PPC64), + "EM_RCE": ValueOf(elf.EM_RCE), + "EM_RH32": ValueOf(elf.EM_RH32), + "EM_S370": ValueOf(elf.EM_S370), + "EM_S390": ValueOf(elf.EM_S390), + "EM_SH": ValueOf(elf.EM_SH), + "EM_SPARC": ValueOf(elf.EM_SPARC), + "EM_SPARC32PLUS": ValueOf(elf.EM_SPARC32PLUS), + "EM_SPARCV9": ValueOf(elf.EM_SPARCV9), + "EM_ST100": ValueOf(elf.EM_ST100), + "EM_STARCORE": ValueOf(elf.EM_STARCORE), + "EM_TINYJ": ValueOf(elf.EM_TINYJ), + "EM_TRICORE": ValueOf(elf.EM_TRICORE), + "EM_V800": ValueOf(elf.EM_V800), + "EM_VPP500": ValueOf(elf.EM_VPP500), + "EM_X86_64": ValueOf(elf.EM_X86_64), + "ET_CORE": ValueOf(elf.ET_CORE), + "ET_DYN": ValueOf(elf.ET_DYN), + "ET_EXEC": ValueOf(elf.ET_EXEC), + "ET_HIOS": ValueOf(elf.ET_HIOS), + "ET_HIPROC": ValueOf(elf.ET_HIPROC), + "ET_LOOS": ValueOf(elf.ET_LOOS), + "ET_LOPROC": ValueOf(elf.ET_LOPROC), + "ET_NONE": ValueOf(elf.ET_NONE), + "ET_REL": ValueOf(elf.ET_REL), + "EV_CURRENT": ValueOf(elf.EV_CURRENT), + "EV_NONE": ValueOf(elf.EV_NONE), + "ErrNoSymbols": ValueOf(&elf.ErrNoSymbols).Elem(), + "NT_FPREGSET": ValueOf(elf.NT_FPREGSET), + "NT_PRPSINFO": ValueOf(elf.NT_PRPSINFO), + "NT_PRSTATUS": ValueOf(elf.NT_PRSTATUS), + "NewFile": ValueOf(elf.NewFile), + "Open": ValueOf(elf.Open), + "PF_MASKOS": ValueOf(elf.PF_MASKOS), + "PF_MASKPROC": ValueOf(elf.PF_MASKPROC), + "PF_R": ValueOf(elf.PF_R), + "PF_W": ValueOf(elf.PF_W), + "PF_X": ValueOf(elf.PF_X), + "PT_DYNAMIC": ValueOf(elf.PT_DYNAMIC), + "PT_HIOS": ValueOf(elf.PT_HIOS), + "PT_HIPROC": ValueOf(elf.PT_HIPROC), + "PT_INTERP": ValueOf(elf.PT_INTERP), + "PT_LOAD": ValueOf(elf.PT_LOAD), + "PT_LOOS": ValueOf(elf.PT_LOOS), + "PT_LOPROC": ValueOf(elf.PT_LOPROC), + "PT_NOTE": ValueOf(elf.PT_NOTE), + "PT_NULL": ValueOf(elf.PT_NULL), + "PT_PHDR": ValueOf(elf.PT_PHDR), + "PT_SHLIB": ValueOf(elf.PT_SHLIB), + "PT_TLS": ValueOf(elf.PT_TLS), + "R_386_32": ValueOf(elf.R_386_32), + "R_386_COPY": ValueOf(elf.R_386_COPY), + "R_386_GLOB_DAT": ValueOf(elf.R_386_GLOB_DAT), + "R_386_GOT32": ValueOf(elf.R_386_GOT32), + "R_386_GOTOFF": ValueOf(elf.R_386_GOTOFF), + "R_386_GOTPC": ValueOf(elf.R_386_GOTPC), + "R_386_JMP_SLOT": ValueOf(elf.R_386_JMP_SLOT), + "R_386_NONE": ValueOf(elf.R_386_NONE), + "R_386_PC32": ValueOf(elf.R_386_PC32), + "R_386_PLT32": ValueOf(elf.R_386_PLT32), + "R_386_RELATIVE": ValueOf(elf.R_386_RELATIVE), + "R_386_TLS_DTPMOD32": ValueOf(elf.R_386_TLS_DTPMOD32), + "R_386_TLS_DTPOFF32": ValueOf(elf.R_386_TLS_DTPOFF32), + "R_386_TLS_GD": ValueOf(elf.R_386_TLS_GD), + "R_386_TLS_GD_32": ValueOf(elf.R_386_TLS_GD_32), + "R_386_TLS_GD_CALL": ValueOf(elf.R_386_TLS_GD_CALL), + "R_386_TLS_GD_POP": ValueOf(elf.R_386_TLS_GD_POP), + "R_386_TLS_GD_PUSH": ValueOf(elf.R_386_TLS_GD_PUSH), + "R_386_TLS_GOTIE": ValueOf(elf.R_386_TLS_GOTIE), + "R_386_TLS_IE": ValueOf(elf.R_386_TLS_IE), + "R_386_TLS_IE_32": ValueOf(elf.R_386_TLS_IE_32), + "R_386_TLS_LDM": ValueOf(elf.R_386_TLS_LDM), + "R_386_TLS_LDM_32": ValueOf(elf.R_386_TLS_LDM_32), + "R_386_TLS_LDM_CALL": ValueOf(elf.R_386_TLS_LDM_CALL), + "R_386_TLS_LDM_POP": ValueOf(elf.R_386_TLS_LDM_POP), + "R_386_TLS_LDM_PUSH": ValueOf(elf.R_386_TLS_LDM_PUSH), + "R_386_TLS_LDO_32": ValueOf(elf.R_386_TLS_LDO_32), + "R_386_TLS_LE": ValueOf(elf.R_386_TLS_LE), + "R_386_TLS_LE_32": ValueOf(elf.R_386_TLS_LE_32), + "R_386_TLS_TPOFF": ValueOf(elf.R_386_TLS_TPOFF), + "R_386_TLS_TPOFF32": ValueOf(elf.R_386_TLS_TPOFF32), + "R_390_12": ValueOf(elf.R_390_12), + "R_390_16": ValueOf(elf.R_390_16), + "R_390_20": ValueOf(elf.R_390_20), + "R_390_32": ValueOf(elf.R_390_32), + "R_390_64": ValueOf(elf.R_390_64), + "R_390_8": ValueOf(elf.R_390_8), + "R_390_COPY": ValueOf(elf.R_390_COPY), + "R_390_GLOB_DAT": ValueOf(elf.R_390_GLOB_DAT), + "R_390_GOT12": ValueOf(elf.R_390_GOT12), + "R_390_GOT16": ValueOf(elf.R_390_GOT16), + "R_390_GOT20": ValueOf(elf.R_390_GOT20), + "R_390_GOT32": ValueOf(elf.R_390_GOT32), + "R_390_GOT64": ValueOf(elf.R_390_GOT64), + "R_390_GOTENT": ValueOf(elf.R_390_GOTENT), + "R_390_GOTOFF": ValueOf(elf.R_390_GOTOFF), + "R_390_GOTOFF16": ValueOf(elf.R_390_GOTOFF16), + "R_390_GOTOFF64": ValueOf(elf.R_390_GOTOFF64), + "R_390_GOTPC": ValueOf(elf.R_390_GOTPC), + "R_390_GOTPCDBL": ValueOf(elf.R_390_GOTPCDBL), + "R_390_GOTPLT12": ValueOf(elf.R_390_GOTPLT12), + "R_390_GOTPLT16": ValueOf(elf.R_390_GOTPLT16), + "R_390_GOTPLT20": ValueOf(elf.R_390_GOTPLT20), + "R_390_GOTPLT32": ValueOf(elf.R_390_GOTPLT32), + "R_390_GOTPLT64": ValueOf(elf.R_390_GOTPLT64), + "R_390_GOTPLTENT": ValueOf(elf.R_390_GOTPLTENT), + "R_390_GOTPLTOFF16": ValueOf(elf.R_390_GOTPLTOFF16), + "R_390_GOTPLTOFF32": ValueOf(elf.R_390_GOTPLTOFF32), + "R_390_GOTPLTOFF64": ValueOf(elf.R_390_GOTPLTOFF64), + "R_390_JMP_SLOT": ValueOf(elf.R_390_JMP_SLOT), + "R_390_NONE": ValueOf(elf.R_390_NONE), + "R_390_PC16": ValueOf(elf.R_390_PC16), + "R_390_PC16DBL": ValueOf(elf.R_390_PC16DBL), + "R_390_PC32": ValueOf(elf.R_390_PC32), + "R_390_PC32DBL": ValueOf(elf.R_390_PC32DBL), + "R_390_PC64": ValueOf(elf.R_390_PC64), + "R_390_PLT16DBL": ValueOf(elf.R_390_PLT16DBL), + "R_390_PLT32": ValueOf(elf.R_390_PLT32), + "R_390_PLT32DBL": ValueOf(elf.R_390_PLT32DBL), + "R_390_PLT64": ValueOf(elf.R_390_PLT64), + "R_390_RELATIVE": ValueOf(elf.R_390_RELATIVE), + "R_390_TLS_DTPMOD": ValueOf(elf.R_390_TLS_DTPMOD), + "R_390_TLS_DTPOFF": ValueOf(elf.R_390_TLS_DTPOFF), + "R_390_TLS_GD32": ValueOf(elf.R_390_TLS_GD32), + "R_390_TLS_GD64": ValueOf(elf.R_390_TLS_GD64), + "R_390_TLS_GDCALL": ValueOf(elf.R_390_TLS_GDCALL), + "R_390_TLS_GOTIE12": ValueOf(elf.R_390_TLS_GOTIE12), + "R_390_TLS_GOTIE20": ValueOf(elf.R_390_TLS_GOTIE20), + "R_390_TLS_GOTIE32": ValueOf(elf.R_390_TLS_GOTIE32), + "R_390_TLS_GOTIE64": ValueOf(elf.R_390_TLS_GOTIE64), + "R_390_TLS_IE32": ValueOf(elf.R_390_TLS_IE32), + "R_390_TLS_IE64": ValueOf(elf.R_390_TLS_IE64), + "R_390_TLS_IEENT": ValueOf(elf.R_390_TLS_IEENT), + "R_390_TLS_LDCALL": ValueOf(elf.R_390_TLS_LDCALL), + "R_390_TLS_LDM32": ValueOf(elf.R_390_TLS_LDM32), + "R_390_TLS_LDM64": ValueOf(elf.R_390_TLS_LDM64), + "R_390_TLS_LDO32": ValueOf(elf.R_390_TLS_LDO32), + "R_390_TLS_LDO64": ValueOf(elf.R_390_TLS_LDO64), + "R_390_TLS_LE32": ValueOf(elf.R_390_TLS_LE32), + "R_390_TLS_LE64": ValueOf(elf.R_390_TLS_LE64), + "R_390_TLS_LOAD": ValueOf(elf.R_390_TLS_LOAD), + "R_390_TLS_TPOFF": ValueOf(elf.R_390_TLS_TPOFF), + "R_AARCH64_ABS16": ValueOf(elf.R_AARCH64_ABS16), + "R_AARCH64_ABS32": ValueOf(elf.R_AARCH64_ABS32), + "R_AARCH64_ABS64": ValueOf(elf.R_AARCH64_ABS64), + "R_AARCH64_ADD_ABS_LO12_NC": ValueOf(elf.R_AARCH64_ADD_ABS_LO12_NC), + "R_AARCH64_ADR_GOT_PAGE": ValueOf(elf.R_AARCH64_ADR_GOT_PAGE), + "R_AARCH64_ADR_PREL_LO21": ValueOf(elf.R_AARCH64_ADR_PREL_LO21), + "R_AARCH64_ADR_PREL_PG_HI21": ValueOf(elf.R_AARCH64_ADR_PREL_PG_HI21), + "R_AARCH64_ADR_PREL_PG_HI21_NC": ValueOf(elf.R_AARCH64_ADR_PREL_PG_HI21_NC), + "R_AARCH64_CALL26": ValueOf(elf.R_AARCH64_CALL26), + "R_AARCH64_CONDBR19": ValueOf(elf.R_AARCH64_CONDBR19), + "R_AARCH64_COPY": ValueOf(elf.R_AARCH64_COPY), + "R_AARCH64_GLOB_DAT": ValueOf(elf.R_AARCH64_GLOB_DAT), + "R_AARCH64_GOT_LD_PREL19": ValueOf(elf.R_AARCH64_GOT_LD_PREL19), + "R_AARCH64_IRELATIVE": ValueOf(elf.R_AARCH64_IRELATIVE), + "R_AARCH64_JUMP26": ValueOf(elf.R_AARCH64_JUMP26), + "R_AARCH64_JUMP_SLOT": ValueOf(elf.R_AARCH64_JUMP_SLOT), + "R_AARCH64_LD64_GOT_LO12_NC": ValueOf(elf.R_AARCH64_LD64_GOT_LO12_NC), + "R_AARCH64_LDST128_ABS_LO12_NC": ValueOf(elf.R_AARCH64_LDST128_ABS_LO12_NC), + "R_AARCH64_LDST16_ABS_LO12_NC": ValueOf(elf.R_AARCH64_LDST16_ABS_LO12_NC), + "R_AARCH64_LDST32_ABS_LO12_NC": ValueOf(elf.R_AARCH64_LDST32_ABS_LO12_NC), + "R_AARCH64_LDST64_ABS_LO12_NC": ValueOf(elf.R_AARCH64_LDST64_ABS_LO12_NC), + "R_AARCH64_LDST8_ABS_LO12_NC": ValueOf(elf.R_AARCH64_LDST8_ABS_LO12_NC), + "R_AARCH64_LD_PREL_LO19": ValueOf(elf.R_AARCH64_LD_PREL_LO19), + "R_AARCH64_MOVW_SABS_G0": ValueOf(elf.R_AARCH64_MOVW_SABS_G0), + "R_AARCH64_MOVW_SABS_G1": ValueOf(elf.R_AARCH64_MOVW_SABS_G1), + "R_AARCH64_MOVW_SABS_G2": ValueOf(elf.R_AARCH64_MOVW_SABS_G2), + "R_AARCH64_MOVW_UABS_G0": ValueOf(elf.R_AARCH64_MOVW_UABS_G0), + "R_AARCH64_MOVW_UABS_G0_NC": ValueOf(elf.R_AARCH64_MOVW_UABS_G0_NC), + "R_AARCH64_MOVW_UABS_G1": ValueOf(elf.R_AARCH64_MOVW_UABS_G1), + "R_AARCH64_MOVW_UABS_G1_NC": ValueOf(elf.R_AARCH64_MOVW_UABS_G1_NC), + "R_AARCH64_MOVW_UABS_G2": ValueOf(elf.R_AARCH64_MOVW_UABS_G2), + "R_AARCH64_MOVW_UABS_G2_NC": ValueOf(elf.R_AARCH64_MOVW_UABS_G2_NC), + "R_AARCH64_MOVW_UABS_G3": ValueOf(elf.R_AARCH64_MOVW_UABS_G3), + "R_AARCH64_NONE": ValueOf(elf.R_AARCH64_NONE), + "R_AARCH64_NULL": ValueOf(elf.R_AARCH64_NULL), + "R_AARCH64_P32_ABS16": ValueOf(elf.R_AARCH64_P32_ABS16), + "R_AARCH64_P32_ABS32": ValueOf(elf.R_AARCH64_P32_ABS32), + "R_AARCH64_P32_ADD_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_ADD_ABS_LO12_NC), + "R_AARCH64_P32_ADR_GOT_PAGE": ValueOf(elf.R_AARCH64_P32_ADR_GOT_PAGE), + "R_AARCH64_P32_ADR_PREL_LO21": ValueOf(elf.R_AARCH64_P32_ADR_PREL_LO21), + "R_AARCH64_P32_ADR_PREL_PG_HI21": ValueOf(elf.R_AARCH64_P32_ADR_PREL_PG_HI21), + "R_AARCH64_P32_CALL26": ValueOf(elf.R_AARCH64_P32_CALL26), + "R_AARCH64_P32_CONDBR19": ValueOf(elf.R_AARCH64_P32_CONDBR19), + "R_AARCH64_P32_COPY": ValueOf(elf.R_AARCH64_P32_COPY), + "R_AARCH64_P32_GLOB_DAT": ValueOf(elf.R_AARCH64_P32_GLOB_DAT), + "R_AARCH64_P32_GOT_LD_PREL19": ValueOf(elf.R_AARCH64_P32_GOT_LD_PREL19), + "R_AARCH64_P32_IRELATIVE": ValueOf(elf.R_AARCH64_P32_IRELATIVE), + "R_AARCH64_P32_JUMP26": ValueOf(elf.R_AARCH64_P32_JUMP26), + "R_AARCH64_P32_JUMP_SLOT": ValueOf(elf.R_AARCH64_P32_JUMP_SLOT), + "R_AARCH64_P32_LD32_GOT_LO12_NC": ValueOf(elf.R_AARCH64_P32_LD32_GOT_LO12_NC), + "R_AARCH64_P32_LDST128_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_LDST128_ABS_LO12_NC), + "R_AARCH64_P32_LDST16_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_LDST16_ABS_LO12_NC), + "R_AARCH64_P32_LDST32_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_LDST32_ABS_LO12_NC), + "R_AARCH64_P32_LDST64_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_LDST64_ABS_LO12_NC), + "R_AARCH64_P32_LDST8_ABS_LO12_NC": ValueOf(elf.R_AARCH64_P32_LDST8_ABS_LO12_NC), + "R_AARCH64_P32_LD_PREL_LO19": ValueOf(elf.R_AARCH64_P32_LD_PREL_LO19), + "R_AARCH64_P32_MOVW_SABS_G0": ValueOf(elf.R_AARCH64_P32_MOVW_SABS_G0), + "R_AARCH64_P32_MOVW_UABS_G0": ValueOf(elf.R_AARCH64_P32_MOVW_UABS_G0), + "R_AARCH64_P32_MOVW_UABS_G0_NC": ValueOf(elf.R_AARCH64_P32_MOVW_UABS_G0_NC), + "R_AARCH64_P32_MOVW_UABS_G1": ValueOf(elf.R_AARCH64_P32_MOVW_UABS_G1), + "R_AARCH64_P32_PREL16": ValueOf(elf.R_AARCH64_P32_PREL16), + "R_AARCH64_P32_PREL32": ValueOf(elf.R_AARCH64_P32_PREL32), + "R_AARCH64_P32_RELATIVE": ValueOf(elf.R_AARCH64_P32_RELATIVE), + "R_AARCH64_P32_TLSDESC": ValueOf(elf.R_AARCH64_P32_TLSDESC), + "R_AARCH64_P32_TLSDESC_ADD_LO12_NC": ValueOf(elf.R_AARCH64_P32_TLSDESC_ADD_LO12_NC), + "R_AARCH64_P32_TLSDESC_ADR_PAGE21": ValueOf(elf.R_AARCH64_P32_TLSDESC_ADR_PAGE21), + "R_AARCH64_P32_TLSDESC_ADR_PREL21": ValueOf(elf.R_AARCH64_P32_TLSDESC_ADR_PREL21), + "R_AARCH64_P32_TLSDESC_CALL": ValueOf(elf.R_AARCH64_P32_TLSDESC_CALL), + "R_AARCH64_P32_TLSDESC_LD32_LO12_NC": ValueOf(elf.R_AARCH64_P32_TLSDESC_LD32_LO12_NC), + "R_AARCH64_P32_TLSDESC_LD_PREL19": ValueOf(elf.R_AARCH64_P32_TLSDESC_LD_PREL19), + "R_AARCH64_P32_TLSGD_ADD_LO12_NC": ValueOf(elf.R_AARCH64_P32_TLSGD_ADD_LO12_NC), + "R_AARCH64_P32_TLSGD_ADR_PAGE21": ValueOf(elf.R_AARCH64_P32_TLSGD_ADR_PAGE21), + "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21": ValueOf(elf.R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21), + "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC": ValueOf(elf.R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC), + "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19": ValueOf(elf.R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19), + "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12": ValueOf(elf.R_AARCH64_P32_TLSLE_ADD_TPREL_HI12), + "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12": ValueOf(elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12), + "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC": ValueOf(elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC), + "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0": ValueOf(elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0), + "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC": ValueOf(elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC), + "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1": ValueOf(elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G1), + "R_AARCH64_P32_TLS_DTPMOD": ValueOf(elf.R_AARCH64_P32_TLS_DTPMOD), + "R_AARCH64_P32_TLS_DTPREL": ValueOf(elf.R_AARCH64_P32_TLS_DTPREL), + "R_AARCH64_P32_TLS_TPREL": ValueOf(elf.R_AARCH64_P32_TLS_TPREL), + "R_AARCH64_P32_TSTBR14": ValueOf(elf.R_AARCH64_P32_TSTBR14), + "R_AARCH64_PREL16": ValueOf(elf.R_AARCH64_PREL16), + "R_AARCH64_PREL32": ValueOf(elf.R_AARCH64_PREL32), + "R_AARCH64_PREL64": ValueOf(elf.R_AARCH64_PREL64), + "R_AARCH64_RELATIVE": ValueOf(elf.R_AARCH64_RELATIVE), + "R_AARCH64_TLSDESC": ValueOf(elf.R_AARCH64_TLSDESC), + "R_AARCH64_TLSDESC_ADD": ValueOf(elf.R_AARCH64_TLSDESC_ADD), + "R_AARCH64_TLSDESC_ADD_LO12_NC": ValueOf(elf.R_AARCH64_TLSDESC_ADD_LO12_NC), + "R_AARCH64_TLSDESC_ADR_PAGE21": ValueOf(elf.R_AARCH64_TLSDESC_ADR_PAGE21), + "R_AARCH64_TLSDESC_ADR_PREL21": ValueOf(elf.R_AARCH64_TLSDESC_ADR_PREL21), + "R_AARCH64_TLSDESC_CALL": ValueOf(elf.R_AARCH64_TLSDESC_CALL), + "R_AARCH64_TLSDESC_LD64_LO12_NC": ValueOf(elf.R_AARCH64_TLSDESC_LD64_LO12_NC), + "R_AARCH64_TLSDESC_LDR": ValueOf(elf.R_AARCH64_TLSDESC_LDR), + "R_AARCH64_TLSDESC_LD_PREL19": ValueOf(elf.R_AARCH64_TLSDESC_LD_PREL19), + "R_AARCH64_TLSDESC_OFF_G0_NC": ValueOf(elf.R_AARCH64_TLSDESC_OFF_G0_NC), + "R_AARCH64_TLSDESC_OFF_G1": ValueOf(elf.R_AARCH64_TLSDESC_OFF_G1), + "R_AARCH64_TLSGD_ADD_LO12_NC": ValueOf(elf.R_AARCH64_TLSGD_ADD_LO12_NC), + "R_AARCH64_TLSGD_ADR_PAGE21": ValueOf(elf.R_AARCH64_TLSGD_ADR_PAGE21), + "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21": ValueOf(elf.R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21), + "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC": ValueOf(elf.R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC), + "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19": ValueOf(elf.R_AARCH64_TLSIE_LD_GOTTPREL_PREL19), + "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC": ValueOf(elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC), + "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1": ValueOf(elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G1), + "R_AARCH64_TLSLE_ADD_TPREL_HI12": ValueOf(elf.R_AARCH64_TLSLE_ADD_TPREL_HI12), + "R_AARCH64_TLSLE_ADD_TPREL_LO12": ValueOf(elf.R_AARCH64_TLSLE_ADD_TPREL_LO12), + "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC": ValueOf(elf.R_AARCH64_TLSLE_ADD_TPREL_LO12_NC), + "R_AARCH64_TLSLE_MOVW_TPREL_G0": ValueOf(elf.R_AARCH64_TLSLE_MOVW_TPREL_G0), + "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC": ValueOf(elf.R_AARCH64_TLSLE_MOVW_TPREL_G0_NC), + "R_AARCH64_TLSLE_MOVW_TPREL_G1": ValueOf(elf.R_AARCH64_TLSLE_MOVW_TPREL_G1), + "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC": ValueOf(elf.R_AARCH64_TLSLE_MOVW_TPREL_G1_NC), + "R_AARCH64_TLSLE_MOVW_TPREL_G2": ValueOf(elf.R_AARCH64_TLSLE_MOVW_TPREL_G2), + "R_AARCH64_TLS_DTPMOD64": ValueOf(elf.R_AARCH64_TLS_DTPMOD64), + "R_AARCH64_TLS_DTPREL64": ValueOf(elf.R_AARCH64_TLS_DTPREL64), + "R_AARCH64_TLS_TPREL64": ValueOf(elf.R_AARCH64_TLS_TPREL64), + "R_AARCH64_TSTBR14": ValueOf(elf.R_AARCH64_TSTBR14), + "R_ALPHA_BRADDR": ValueOf(elf.R_ALPHA_BRADDR), + "R_ALPHA_COPY": ValueOf(elf.R_ALPHA_COPY), + "R_ALPHA_GLOB_DAT": ValueOf(elf.R_ALPHA_GLOB_DAT), + "R_ALPHA_GPDISP": ValueOf(elf.R_ALPHA_GPDISP), + "R_ALPHA_GPREL32": ValueOf(elf.R_ALPHA_GPREL32), + "R_ALPHA_GPRELHIGH": ValueOf(elf.R_ALPHA_GPRELHIGH), + "R_ALPHA_GPRELLOW": ValueOf(elf.R_ALPHA_GPRELLOW), + "R_ALPHA_GPVALUE": ValueOf(elf.R_ALPHA_GPVALUE), + "R_ALPHA_HINT": ValueOf(elf.R_ALPHA_HINT), + "R_ALPHA_IMMED_BR_HI32": ValueOf(elf.R_ALPHA_IMMED_BR_HI32), + "R_ALPHA_IMMED_GP_16": ValueOf(elf.R_ALPHA_IMMED_GP_16), + "R_ALPHA_IMMED_GP_HI32": ValueOf(elf.R_ALPHA_IMMED_GP_HI32), + "R_ALPHA_IMMED_LO32": ValueOf(elf.R_ALPHA_IMMED_LO32), + "R_ALPHA_IMMED_SCN_HI32": ValueOf(elf.R_ALPHA_IMMED_SCN_HI32), + "R_ALPHA_JMP_SLOT": ValueOf(elf.R_ALPHA_JMP_SLOT), + "R_ALPHA_LITERAL": ValueOf(elf.R_ALPHA_LITERAL), + "R_ALPHA_LITUSE": ValueOf(elf.R_ALPHA_LITUSE), + "R_ALPHA_NONE": ValueOf(elf.R_ALPHA_NONE), + "R_ALPHA_OP_PRSHIFT": ValueOf(elf.R_ALPHA_OP_PRSHIFT), + "R_ALPHA_OP_PSUB": ValueOf(elf.R_ALPHA_OP_PSUB), + "R_ALPHA_OP_PUSH": ValueOf(elf.R_ALPHA_OP_PUSH), + "R_ALPHA_OP_STORE": ValueOf(elf.R_ALPHA_OP_STORE), + "R_ALPHA_REFLONG": ValueOf(elf.R_ALPHA_REFLONG), + "R_ALPHA_REFQUAD": ValueOf(elf.R_ALPHA_REFQUAD), + "R_ALPHA_RELATIVE": ValueOf(elf.R_ALPHA_RELATIVE), + "R_ALPHA_SREL16": ValueOf(elf.R_ALPHA_SREL16), + "R_ALPHA_SREL32": ValueOf(elf.R_ALPHA_SREL32), + "R_ALPHA_SREL64": ValueOf(elf.R_ALPHA_SREL64), + "R_ARM_ABS12": ValueOf(elf.R_ARM_ABS12), + "R_ARM_ABS16": ValueOf(elf.R_ARM_ABS16), + "R_ARM_ABS32": ValueOf(elf.R_ARM_ABS32), + "R_ARM_ABS8": ValueOf(elf.R_ARM_ABS8), + "R_ARM_AMP_VCALL9": ValueOf(elf.R_ARM_AMP_VCALL9), + "R_ARM_COPY": ValueOf(elf.R_ARM_COPY), + "R_ARM_GLOB_DAT": ValueOf(elf.R_ARM_GLOB_DAT), + "R_ARM_GNU_VTENTRY": ValueOf(elf.R_ARM_GNU_VTENTRY), + "R_ARM_GNU_VTINHERIT": ValueOf(elf.R_ARM_GNU_VTINHERIT), + "R_ARM_GOT32": ValueOf(elf.R_ARM_GOT32), + "R_ARM_GOTOFF": ValueOf(elf.R_ARM_GOTOFF), + "R_ARM_GOTPC": ValueOf(elf.R_ARM_GOTPC), + "R_ARM_JUMP_SLOT": ValueOf(elf.R_ARM_JUMP_SLOT), + "R_ARM_NONE": ValueOf(elf.R_ARM_NONE), + "R_ARM_PC13": ValueOf(elf.R_ARM_PC13), + "R_ARM_PC24": ValueOf(elf.R_ARM_PC24), + "R_ARM_PLT32": ValueOf(elf.R_ARM_PLT32), + "R_ARM_RABS32": ValueOf(elf.R_ARM_RABS32), + "R_ARM_RBASE": ValueOf(elf.R_ARM_RBASE), + "R_ARM_REL32": ValueOf(elf.R_ARM_REL32), + "R_ARM_RELATIVE": ValueOf(elf.R_ARM_RELATIVE), + "R_ARM_RPC24": ValueOf(elf.R_ARM_RPC24), + "R_ARM_RREL32": ValueOf(elf.R_ARM_RREL32), + "R_ARM_RSBREL32": ValueOf(elf.R_ARM_RSBREL32), + "R_ARM_SBREL32": ValueOf(elf.R_ARM_SBREL32), + "R_ARM_SWI24": ValueOf(elf.R_ARM_SWI24), + "R_ARM_THM_ABS5": ValueOf(elf.R_ARM_THM_ABS5), + "R_ARM_THM_PC22": ValueOf(elf.R_ARM_THM_PC22), + "R_ARM_THM_PC8": ValueOf(elf.R_ARM_THM_PC8), + "R_ARM_THM_RPC22": ValueOf(elf.R_ARM_THM_RPC22), + "R_ARM_THM_SWI8": ValueOf(elf.R_ARM_THM_SWI8), + "R_ARM_THM_XPC22": ValueOf(elf.R_ARM_THM_XPC22), + "R_ARM_XPC25": ValueOf(elf.R_ARM_XPC25), + "R_INFO": ValueOf(elf.R_INFO), + "R_INFO32": ValueOf(elf.R_INFO32), + "R_MIPS_16": ValueOf(elf.R_MIPS_16), + "R_MIPS_26": ValueOf(elf.R_MIPS_26), + "R_MIPS_32": ValueOf(elf.R_MIPS_32), + "R_MIPS_64": ValueOf(elf.R_MIPS_64), + "R_MIPS_ADD_IMMEDIATE": ValueOf(elf.R_MIPS_ADD_IMMEDIATE), + "R_MIPS_CALL16": ValueOf(elf.R_MIPS_CALL16), + "R_MIPS_CALL_HI16": ValueOf(elf.R_MIPS_CALL_HI16), + "R_MIPS_CALL_LO16": ValueOf(elf.R_MIPS_CALL_LO16), + "R_MIPS_DELETE": ValueOf(elf.R_MIPS_DELETE), + "R_MIPS_GOT16": ValueOf(elf.R_MIPS_GOT16), + "R_MIPS_GOT_DISP": ValueOf(elf.R_MIPS_GOT_DISP), + "R_MIPS_GOT_HI16": ValueOf(elf.R_MIPS_GOT_HI16), + "R_MIPS_GOT_LO16": ValueOf(elf.R_MIPS_GOT_LO16), + "R_MIPS_GOT_OFST": ValueOf(elf.R_MIPS_GOT_OFST), + "R_MIPS_GOT_PAGE": ValueOf(elf.R_MIPS_GOT_PAGE), + "R_MIPS_GPREL16": ValueOf(elf.R_MIPS_GPREL16), + "R_MIPS_GPREL32": ValueOf(elf.R_MIPS_GPREL32), + "R_MIPS_HI16": ValueOf(elf.R_MIPS_HI16), + "R_MIPS_HIGHER": ValueOf(elf.R_MIPS_HIGHER), + "R_MIPS_HIGHEST": ValueOf(elf.R_MIPS_HIGHEST), + "R_MIPS_INSERT_A": ValueOf(elf.R_MIPS_INSERT_A), + "R_MIPS_INSERT_B": ValueOf(elf.R_MIPS_INSERT_B), + "R_MIPS_JALR": ValueOf(elf.R_MIPS_JALR), + "R_MIPS_LITERAL": ValueOf(elf.R_MIPS_LITERAL), + "R_MIPS_LO16": ValueOf(elf.R_MIPS_LO16), + "R_MIPS_NONE": ValueOf(elf.R_MIPS_NONE), + "R_MIPS_PC16": ValueOf(elf.R_MIPS_PC16), + "R_MIPS_PJUMP": ValueOf(elf.R_MIPS_PJUMP), + "R_MIPS_REL16": ValueOf(elf.R_MIPS_REL16), + "R_MIPS_REL32": ValueOf(elf.R_MIPS_REL32), + "R_MIPS_RELGOT": ValueOf(elf.R_MIPS_RELGOT), + "R_MIPS_SCN_DISP": ValueOf(elf.R_MIPS_SCN_DISP), + "R_MIPS_SHIFT5": ValueOf(elf.R_MIPS_SHIFT5), + "R_MIPS_SHIFT6": ValueOf(elf.R_MIPS_SHIFT6), + "R_MIPS_SUB": ValueOf(elf.R_MIPS_SUB), + "R_MIPS_TLS_DTPMOD32": ValueOf(elf.R_MIPS_TLS_DTPMOD32), + "R_MIPS_TLS_DTPMOD64": ValueOf(elf.R_MIPS_TLS_DTPMOD64), + "R_MIPS_TLS_DTPREL32": ValueOf(elf.R_MIPS_TLS_DTPREL32), + "R_MIPS_TLS_DTPREL64": ValueOf(elf.R_MIPS_TLS_DTPREL64), + "R_MIPS_TLS_DTPREL_HI16": ValueOf(elf.R_MIPS_TLS_DTPREL_HI16), + "R_MIPS_TLS_DTPREL_LO16": ValueOf(elf.R_MIPS_TLS_DTPREL_LO16), + "R_MIPS_TLS_GD": ValueOf(elf.R_MIPS_TLS_GD), + "R_MIPS_TLS_GOTTPREL": ValueOf(elf.R_MIPS_TLS_GOTTPREL), + "R_MIPS_TLS_LDM": ValueOf(elf.R_MIPS_TLS_LDM), + "R_MIPS_TLS_TPREL32": ValueOf(elf.R_MIPS_TLS_TPREL32), + "R_MIPS_TLS_TPREL64": ValueOf(elf.R_MIPS_TLS_TPREL64), + "R_MIPS_TLS_TPREL_HI16": ValueOf(elf.R_MIPS_TLS_TPREL_HI16), + "R_MIPS_TLS_TPREL_LO16": ValueOf(elf.R_MIPS_TLS_TPREL_LO16), + "R_PPC64_ADDR14": ValueOf(elf.R_PPC64_ADDR14), + "R_PPC64_ADDR14_BRNTAKEN": ValueOf(elf.R_PPC64_ADDR14_BRNTAKEN), + "R_PPC64_ADDR14_BRTAKEN": ValueOf(elf.R_PPC64_ADDR14_BRTAKEN), + "R_PPC64_ADDR16": ValueOf(elf.R_PPC64_ADDR16), + "R_PPC64_ADDR16_DS": ValueOf(elf.R_PPC64_ADDR16_DS), + "R_PPC64_ADDR16_HA": ValueOf(elf.R_PPC64_ADDR16_HA), + "R_PPC64_ADDR16_HI": ValueOf(elf.R_PPC64_ADDR16_HI), + "R_PPC64_ADDR16_HIGHER": ValueOf(elf.R_PPC64_ADDR16_HIGHER), + "R_PPC64_ADDR16_HIGHERA": ValueOf(elf.R_PPC64_ADDR16_HIGHERA), + "R_PPC64_ADDR16_HIGHEST": ValueOf(elf.R_PPC64_ADDR16_HIGHEST), + "R_PPC64_ADDR16_HIGHESTA": ValueOf(elf.R_PPC64_ADDR16_HIGHESTA), + "R_PPC64_ADDR16_LO": ValueOf(elf.R_PPC64_ADDR16_LO), + "R_PPC64_ADDR16_LO_DS": ValueOf(elf.R_PPC64_ADDR16_LO_DS), + "R_PPC64_ADDR24": ValueOf(elf.R_PPC64_ADDR24), + "R_PPC64_ADDR32": ValueOf(elf.R_PPC64_ADDR32), + "R_PPC64_ADDR64": ValueOf(elf.R_PPC64_ADDR64), + "R_PPC64_DTPMOD64": ValueOf(elf.R_PPC64_DTPMOD64), + "R_PPC64_DTPREL16": ValueOf(elf.R_PPC64_DTPREL16), + "R_PPC64_DTPREL16_DS": ValueOf(elf.R_PPC64_DTPREL16_DS), + "R_PPC64_DTPREL16_HA": ValueOf(elf.R_PPC64_DTPREL16_HA), + "R_PPC64_DTPREL16_HI": ValueOf(elf.R_PPC64_DTPREL16_HI), + "R_PPC64_DTPREL16_HIGHER": ValueOf(elf.R_PPC64_DTPREL16_HIGHER), + "R_PPC64_DTPREL16_HIGHERA": ValueOf(elf.R_PPC64_DTPREL16_HIGHERA), + "R_PPC64_DTPREL16_HIGHEST": ValueOf(elf.R_PPC64_DTPREL16_HIGHEST), + "R_PPC64_DTPREL16_HIGHESTA": ValueOf(elf.R_PPC64_DTPREL16_HIGHESTA), + "R_PPC64_DTPREL16_LO": ValueOf(elf.R_PPC64_DTPREL16_LO), + "R_PPC64_DTPREL16_LO_DS": ValueOf(elf.R_PPC64_DTPREL16_LO_DS), + "R_PPC64_DTPREL64": ValueOf(elf.R_PPC64_DTPREL64), + "R_PPC64_GOT16": ValueOf(elf.R_PPC64_GOT16), + "R_PPC64_GOT16_DS": ValueOf(elf.R_PPC64_GOT16_DS), + "R_PPC64_GOT16_HA": ValueOf(elf.R_PPC64_GOT16_HA), + "R_PPC64_GOT16_HI": ValueOf(elf.R_PPC64_GOT16_HI), + "R_PPC64_GOT16_LO": ValueOf(elf.R_PPC64_GOT16_LO), + "R_PPC64_GOT16_LO_DS": ValueOf(elf.R_PPC64_GOT16_LO_DS), + "R_PPC64_GOT_DTPREL16_DS": ValueOf(elf.R_PPC64_GOT_DTPREL16_DS), + "R_PPC64_GOT_DTPREL16_HA": ValueOf(elf.R_PPC64_GOT_DTPREL16_HA), + "R_PPC64_GOT_DTPREL16_HI": ValueOf(elf.R_PPC64_GOT_DTPREL16_HI), + "R_PPC64_GOT_DTPREL16_LO_DS": ValueOf(elf.R_PPC64_GOT_DTPREL16_LO_DS), + "R_PPC64_GOT_TLSGD16": ValueOf(elf.R_PPC64_GOT_TLSGD16), + "R_PPC64_GOT_TLSGD16_HA": ValueOf(elf.R_PPC64_GOT_TLSGD16_HA), + "R_PPC64_GOT_TLSGD16_HI": ValueOf(elf.R_PPC64_GOT_TLSGD16_HI), + "R_PPC64_GOT_TLSGD16_LO": ValueOf(elf.R_PPC64_GOT_TLSGD16_LO), + "R_PPC64_GOT_TLSLD16": ValueOf(elf.R_PPC64_GOT_TLSLD16), + "R_PPC64_GOT_TLSLD16_HA": ValueOf(elf.R_PPC64_GOT_TLSLD16_HA), + "R_PPC64_GOT_TLSLD16_HI": ValueOf(elf.R_PPC64_GOT_TLSLD16_HI), + "R_PPC64_GOT_TLSLD16_LO": ValueOf(elf.R_PPC64_GOT_TLSLD16_LO), + "R_PPC64_GOT_TPREL16_DS": ValueOf(elf.R_PPC64_GOT_TPREL16_DS), + "R_PPC64_GOT_TPREL16_HA": ValueOf(elf.R_PPC64_GOT_TPREL16_HA), + "R_PPC64_GOT_TPREL16_HI": ValueOf(elf.R_PPC64_GOT_TPREL16_HI), + "R_PPC64_GOT_TPREL16_LO_DS": ValueOf(elf.R_PPC64_GOT_TPREL16_LO_DS), + "R_PPC64_JMP_SLOT": ValueOf(elf.R_PPC64_JMP_SLOT), + "R_PPC64_NONE": ValueOf(elf.R_PPC64_NONE), + "R_PPC64_REL14": ValueOf(elf.R_PPC64_REL14), + "R_PPC64_REL14_BRNTAKEN": ValueOf(elf.R_PPC64_REL14_BRNTAKEN), + "R_PPC64_REL14_BRTAKEN": ValueOf(elf.R_PPC64_REL14_BRTAKEN), + "R_PPC64_REL16": ValueOf(elf.R_PPC64_REL16), + "R_PPC64_REL16_HA": ValueOf(elf.R_PPC64_REL16_HA), + "R_PPC64_REL16_HI": ValueOf(elf.R_PPC64_REL16_HI), + "R_PPC64_REL16_LO": ValueOf(elf.R_PPC64_REL16_LO), + "R_PPC64_REL24": ValueOf(elf.R_PPC64_REL24), + "R_PPC64_REL32": ValueOf(elf.R_PPC64_REL32), + "R_PPC64_REL64": ValueOf(elf.R_PPC64_REL64), + "R_PPC64_TLS": ValueOf(elf.R_PPC64_TLS), + "R_PPC64_TLSGD": ValueOf(elf.R_PPC64_TLSGD), + "R_PPC64_TLSLD": ValueOf(elf.R_PPC64_TLSLD), + "R_PPC64_TOC": ValueOf(elf.R_PPC64_TOC), + "R_PPC64_TOC16": ValueOf(elf.R_PPC64_TOC16), + "R_PPC64_TOC16_DS": ValueOf(elf.R_PPC64_TOC16_DS), + "R_PPC64_TOC16_HA": ValueOf(elf.R_PPC64_TOC16_HA), + "R_PPC64_TOC16_HI": ValueOf(elf.R_PPC64_TOC16_HI), + "R_PPC64_TOC16_LO": ValueOf(elf.R_PPC64_TOC16_LO), + "R_PPC64_TOC16_LO_DS": ValueOf(elf.R_PPC64_TOC16_LO_DS), + "R_PPC64_TPREL16": ValueOf(elf.R_PPC64_TPREL16), + "R_PPC64_TPREL16_DS": ValueOf(elf.R_PPC64_TPREL16_DS), + "R_PPC64_TPREL16_HA": ValueOf(elf.R_PPC64_TPREL16_HA), + "R_PPC64_TPREL16_HI": ValueOf(elf.R_PPC64_TPREL16_HI), + "R_PPC64_TPREL16_HIGHER": ValueOf(elf.R_PPC64_TPREL16_HIGHER), + "R_PPC64_TPREL16_HIGHERA": ValueOf(elf.R_PPC64_TPREL16_HIGHERA), + "R_PPC64_TPREL16_HIGHEST": ValueOf(elf.R_PPC64_TPREL16_HIGHEST), + "R_PPC64_TPREL16_HIGHESTA": ValueOf(elf.R_PPC64_TPREL16_HIGHESTA), + "R_PPC64_TPREL16_LO": ValueOf(elf.R_PPC64_TPREL16_LO), + "R_PPC64_TPREL16_LO_DS": ValueOf(elf.R_PPC64_TPREL16_LO_DS), + "R_PPC64_TPREL64": ValueOf(elf.R_PPC64_TPREL64), + "R_PPC_ADDR14": ValueOf(elf.R_PPC_ADDR14), + "R_PPC_ADDR14_BRNTAKEN": ValueOf(elf.R_PPC_ADDR14_BRNTAKEN), + "R_PPC_ADDR14_BRTAKEN": ValueOf(elf.R_PPC_ADDR14_BRTAKEN), + "R_PPC_ADDR16": ValueOf(elf.R_PPC_ADDR16), + "R_PPC_ADDR16_HA": ValueOf(elf.R_PPC_ADDR16_HA), + "R_PPC_ADDR16_HI": ValueOf(elf.R_PPC_ADDR16_HI), + "R_PPC_ADDR16_LO": ValueOf(elf.R_PPC_ADDR16_LO), + "R_PPC_ADDR24": ValueOf(elf.R_PPC_ADDR24), + "R_PPC_ADDR32": ValueOf(elf.R_PPC_ADDR32), + "R_PPC_COPY": ValueOf(elf.R_PPC_COPY), + "R_PPC_DTPMOD32": ValueOf(elf.R_PPC_DTPMOD32), + "R_PPC_DTPREL16": ValueOf(elf.R_PPC_DTPREL16), + "R_PPC_DTPREL16_HA": ValueOf(elf.R_PPC_DTPREL16_HA), + "R_PPC_DTPREL16_HI": ValueOf(elf.R_PPC_DTPREL16_HI), + "R_PPC_DTPREL16_LO": ValueOf(elf.R_PPC_DTPREL16_LO), + "R_PPC_DTPREL32": ValueOf(elf.R_PPC_DTPREL32), + "R_PPC_EMB_BIT_FLD": ValueOf(elf.R_PPC_EMB_BIT_FLD), + "R_PPC_EMB_MRKREF": ValueOf(elf.R_PPC_EMB_MRKREF), + "R_PPC_EMB_NADDR16": ValueOf(elf.R_PPC_EMB_NADDR16), + "R_PPC_EMB_NADDR16_HA": ValueOf(elf.R_PPC_EMB_NADDR16_HA), + "R_PPC_EMB_NADDR16_HI": ValueOf(elf.R_PPC_EMB_NADDR16_HI), + "R_PPC_EMB_NADDR16_LO": ValueOf(elf.R_PPC_EMB_NADDR16_LO), + "R_PPC_EMB_NADDR32": ValueOf(elf.R_PPC_EMB_NADDR32), + "R_PPC_EMB_RELSDA": ValueOf(elf.R_PPC_EMB_RELSDA), + "R_PPC_EMB_RELSEC16": ValueOf(elf.R_PPC_EMB_RELSEC16), + "R_PPC_EMB_RELST_HA": ValueOf(elf.R_PPC_EMB_RELST_HA), + "R_PPC_EMB_RELST_HI": ValueOf(elf.R_PPC_EMB_RELST_HI), + "R_PPC_EMB_RELST_LO": ValueOf(elf.R_PPC_EMB_RELST_LO), + "R_PPC_EMB_SDA21": ValueOf(elf.R_PPC_EMB_SDA21), + "R_PPC_EMB_SDA2I16": ValueOf(elf.R_PPC_EMB_SDA2I16), + "R_PPC_EMB_SDA2REL": ValueOf(elf.R_PPC_EMB_SDA2REL), + "R_PPC_EMB_SDAI16": ValueOf(elf.R_PPC_EMB_SDAI16), + "R_PPC_GLOB_DAT": ValueOf(elf.R_PPC_GLOB_DAT), + "R_PPC_GOT16": ValueOf(elf.R_PPC_GOT16), + "R_PPC_GOT16_HA": ValueOf(elf.R_PPC_GOT16_HA), + "R_PPC_GOT16_HI": ValueOf(elf.R_PPC_GOT16_HI), + "R_PPC_GOT16_LO": ValueOf(elf.R_PPC_GOT16_LO), + "R_PPC_GOT_TLSGD16": ValueOf(elf.R_PPC_GOT_TLSGD16), + "R_PPC_GOT_TLSGD16_HA": ValueOf(elf.R_PPC_GOT_TLSGD16_HA), + "R_PPC_GOT_TLSGD16_HI": ValueOf(elf.R_PPC_GOT_TLSGD16_HI), + "R_PPC_GOT_TLSGD16_LO": ValueOf(elf.R_PPC_GOT_TLSGD16_LO), + "R_PPC_GOT_TLSLD16": ValueOf(elf.R_PPC_GOT_TLSLD16), + "R_PPC_GOT_TLSLD16_HA": ValueOf(elf.R_PPC_GOT_TLSLD16_HA), + "R_PPC_GOT_TLSLD16_HI": ValueOf(elf.R_PPC_GOT_TLSLD16_HI), + "R_PPC_GOT_TLSLD16_LO": ValueOf(elf.R_PPC_GOT_TLSLD16_LO), + "R_PPC_GOT_TPREL16": ValueOf(elf.R_PPC_GOT_TPREL16), + "R_PPC_GOT_TPREL16_HA": ValueOf(elf.R_PPC_GOT_TPREL16_HA), + "R_PPC_GOT_TPREL16_HI": ValueOf(elf.R_PPC_GOT_TPREL16_HI), + "R_PPC_GOT_TPREL16_LO": ValueOf(elf.R_PPC_GOT_TPREL16_LO), + "R_PPC_JMP_SLOT": ValueOf(elf.R_PPC_JMP_SLOT), + "R_PPC_LOCAL24PC": ValueOf(elf.R_PPC_LOCAL24PC), + "R_PPC_NONE": ValueOf(elf.R_PPC_NONE), + "R_PPC_PLT16_HA": ValueOf(elf.R_PPC_PLT16_HA), + "R_PPC_PLT16_HI": ValueOf(elf.R_PPC_PLT16_HI), + "R_PPC_PLT16_LO": ValueOf(elf.R_PPC_PLT16_LO), + "R_PPC_PLT32": ValueOf(elf.R_PPC_PLT32), + "R_PPC_PLTREL24": ValueOf(elf.R_PPC_PLTREL24), + "R_PPC_PLTREL32": ValueOf(elf.R_PPC_PLTREL32), + "R_PPC_REL14": ValueOf(elf.R_PPC_REL14), + "R_PPC_REL14_BRNTAKEN": ValueOf(elf.R_PPC_REL14_BRNTAKEN), + "R_PPC_REL14_BRTAKEN": ValueOf(elf.R_PPC_REL14_BRTAKEN), + "R_PPC_REL24": ValueOf(elf.R_PPC_REL24), + "R_PPC_REL32": ValueOf(elf.R_PPC_REL32), + "R_PPC_RELATIVE": ValueOf(elf.R_PPC_RELATIVE), + "R_PPC_SDAREL16": ValueOf(elf.R_PPC_SDAREL16), + "R_PPC_SECTOFF": ValueOf(elf.R_PPC_SECTOFF), + "R_PPC_SECTOFF_HA": ValueOf(elf.R_PPC_SECTOFF_HA), + "R_PPC_SECTOFF_HI": ValueOf(elf.R_PPC_SECTOFF_HI), + "R_PPC_SECTOFF_LO": ValueOf(elf.R_PPC_SECTOFF_LO), + "R_PPC_TLS": ValueOf(elf.R_PPC_TLS), + "R_PPC_TPREL16": ValueOf(elf.R_PPC_TPREL16), + "R_PPC_TPREL16_HA": ValueOf(elf.R_PPC_TPREL16_HA), + "R_PPC_TPREL16_HI": ValueOf(elf.R_PPC_TPREL16_HI), + "R_PPC_TPREL16_LO": ValueOf(elf.R_PPC_TPREL16_LO), + "R_PPC_TPREL32": ValueOf(elf.R_PPC_TPREL32), + "R_PPC_UADDR16": ValueOf(elf.R_PPC_UADDR16), + "R_PPC_UADDR32": ValueOf(elf.R_PPC_UADDR32), + "R_SPARC_10": ValueOf(elf.R_SPARC_10), + "R_SPARC_11": ValueOf(elf.R_SPARC_11), + "R_SPARC_13": ValueOf(elf.R_SPARC_13), + "R_SPARC_16": ValueOf(elf.R_SPARC_16), + "R_SPARC_22": ValueOf(elf.R_SPARC_22), + "R_SPARC_32": ValueOf(elf.R_SPARC_32), + "R_SPARC_5": ValueOf(elf.R_SPARC_5), + "R_SPARC_6": ValueOf(elf.R_SPARC_6), + "R_SPARC_64": ValueOf(elf.R_SPARC_64), + "R_SPARC_7": ValueOf(elf.R_SPARC_7), + "R_SPARC_8": ValueOf(elf.R_SPARC_8), + "R_SPARC_COPY": ValueOf(elf.R_SPARC_COPY), + "R_SPARC_DISP16": ValueOf(elf.R_SPARC_DISP16), + "R_SPARC_DISP32": ValueOf(elf.R_SPARC_DISP32), + "R_SPARC_DISP64": ValueOf(elf.R_SPARC_DISP64), + "R_SPARC_DISP8": ValueOf(elf.R_SPARC_DISP8), + "R_SPARC_GLOB_DAT": ValueOf(elf.R_SPARC_GLOB_DAT), + "R_SPARC_GLOB_JMP": ValueOf(elf.R_SPARC_GLOB_JMP), + "R_SPARC_GOT10": ValueOf(elf.R_SPARC_GOT10), + "R_SPARC_GOT13": ValueOf(elf.R_SPARC_GOT13), + "R_SPARC_GOT22": ValueOf(elf.R_SPARC_GOT22), + "R_SPARC_H44": ValueOf(elf.R_SPARC_H44), + "R_SPARC_HH22": ValueOf(elf.R_SPARC_HH22), + "R_SPARC_HI22": ValueOf(elf.R_SPARC_HI22), + "R_SPARC_HIPLT22": ValueOf(elf.R_SPARC_HIPLT22), + "R_SPARC_HIX22": ValueOf(elf.R_SPARC_HIX22), + "R_SPARC_HM10": ValueOf(elf.R_SPARC_HM10), + "R_SPARC_JMP_SLOT": ValueOf(elf.R_SPARC_JMP_SLOT), + "R_SPARC_L44": ValueOf(elf.R_SPARC_L44), + "R_SPARC_LM22": ValueOf(elf.R_SPARC_LM22), + "R_SPARC_LO10": ValueOf(elf.R_SPARC_LO10), + "R_SPARC_LOPLT10": ValueOf(elf.R_SPARC_LOPLT10), + "R_SPARC_LOX10": ValueOf(elf.R_SPARC_LOX10), + "R_SPARC_M44": ValueOf(elf.R_SPARC_M44), + "R_SPARC_NONE": ValueOf(elf.R_SPARC_NONE), + "R_SPARC_OLO10": ValueOf(elf.R_SPARC_OLO10), + "R_SPARC_PC10": ValueOf(elf.R_SPARC_PC10), + "R_SPARC_PC22": ValueOf(elf.R_SPARC_PC22), + "R_SPARC_PCPLT10": ValueOf(elf.R_SPARC_PCPLT10), + "R_SPARC_PCPLT22": ValueOf(elf.R_SPARC_PCPLT22), + "R_SPARC_PCPLT32": ValueOf(elf.R_SPARC_PCPLT32), + "R_SPARC_PC_HH22": ValueOf(elf.R_SPARC_PC_HH22), + "R_SPARC_PC_HM10": ValueOf(elf.R_SPARC_PC_HM10), + "R_SPARC_PC_LM22": ValueOf(elf.R_SPARC_PC_LM22), + "R_SPARC_PLT32": ValueOf(elf.R_SPARC_PLT32), + "R_SPARC_PLT64": ValueOf(elf.R_SPARC_PLT64), + "R_SPARC_REGISTER": ValueOf(elf.R_SPARC_REGISTER), + "R_SPARC_RELATIVE": ValueOf(elf.R_SPARC_RELATIVE), + "R_SPARC_UA16": ValueOf(elf.R_SPARC_UA16), + "R_SPARC_UA32": ValueOf(elf.R_SPARC_UA32), + "R_SPARC_UA64": ValueOf(elf.R_SPARC_UA64), + "R_SPARC_WDISP16": ValueOf(elf.R_SPARC_WDISP16), + "R_SPARC_WDISP19": ValueOf(elf.R_SPARC_WDISP19), + "R_SPARC_WDISP22": ValueOf(elf.R_SPARC_WDISP22), + "R_SPARC_WDISP30": ValueOf(elf.R_SPARC_WDISP30), + "R_SPARC_WPLT30": ValueOf(elf.R_SPARC_WPLT30), + "R_SYM32": ValueOf(elf.R_SYM32), + "R_SYM64": ValueOf(elf.R_SYM64), + "R_TYPE32": ValueOf(elf.R_TYPE32), + "R_TYPE64": ValueOf(elf.R_TYPE64), + "R_X86_64_16": ValueOf(elf.R_X86_64_16), + "R_X86_64_32": ValueOf(elf.R_X86_64_32), + "R_X86_64_32S": ValueOf(elf.R_X86_64_32S), + "R_X86_64_64": ValueOf(elf.R_X86_64_64), + "R_X86_64_8": ValueOf(elf.R_X86_64_8), + "R_X86_64_COPY": ValueOf(elf.R_X86_64_COPY), + "R_X86_64_DTPMOD64": ValueOf(elf.R_X86_64_DTPMOD64), + "R_X86_64_DTPOFF32": ValueOf(elf.R_X86_64_DTPOFF32), + "R_X86_64_DTPOFF64": ValueOf(elf.R_X86_64_DTPOFF64), + "R_X86_64_GLOB_DAT": ValueOf(elf.R_X86_64_GLOB_DAT), + "R_X86_64_GOT32": ValueOf(elf.R_X86_64_GOT32), + "R_X86_64_GOTPCREL": ValueOf(elf.R_X86_64_GOTPCREL), + "R_X86_64_GOTTPOFF": ValueOf(elf.R_X86_64_GOTTPOFF), + "R_X86_64_JMP_SLOT": ValueOf(elf.R_X86_64_JMP_SLOT), + "R_X86_64_NONE": ValueOf(elf.R_X86_64_NONE), + "R_X86_64_PC16": ValueOf(elf.R_X86_64_PC16), + "R_X86_64_PC32": ValueOf(elf.R_X86_64_PC32), + "R_X86_64_PC8": ValueOf(elf.R_X86_64_PC8), + "R_X86_64_PLT32": ValueOf(elf.R_X86_64_PLT32), + "R_X86_64_RELATIVE": ValueOf(elf.R_X86_64_RELATIVE), + "R_X86_64_TLSGD": ValueOf(elf.R_X86_64_TLSGD), + "R_X86_64_TLSLD": ValueOf(elf.R_X86_64_TLSLD), + "R_X86_64_TPOFF32": ValueOf(elf.R_X86_64_TPOFF32), + "R_X86_64_TPOFF64": ValueOf(elf.R_X86_64_TPOFF64), + "SHF_ALLOC": ValueOf(elf.SHF_ALLOC), + "SHF_COMPRESSED": ValueOf(elf.SHF_COMPRESSED), + "SHF_EXECINSTR": ValueOf(elf.SHF_EXECINSTR), + "SHF_GROUP": ValueOf(elf.SHF_GROUP), + "SHF_INFO_LINK": ValueOf(elf.SHF_INFO_LINK), + "SHF_LINK_ORDER": ValueOf(elf.SHF_LINK_ORDER), + "SHF_MASKOS": ValueOf(elf.SHF_MASKOS), + "SHF_MASKPROC": ValueOf(elf.SHF_MASKPROC), + "SHF_MERGE": ValueOf(elf.SHF_MERGE), + "SHF_OS_NONCONFORMING": ValueOf(elf.SHF_OS_NONCONFORMING), + "SHF_STRINGS": ValueOf(elf.SHF_STRINGS), + "SHF_TLS": ValueOf(elf.SHF_TLS), + "SHF_WRITE": ValueOf(elf.SHF_WRITE), + "SHN_ABS": ValueOf(elf.SHN_ABS), + "SHN_COMMON": ValueOf(elf.SHN_COMMON), + "SHN_HIOS": ValueOf(elf.SHN_HIOS), + "SHN_HIPROC": ValueOf(elf.SHN_HIPROC), + "SHN_HIRESERVE": ValueOf(elf.SHN_HIRESERVE), + "SHN_LOOS": ValueOf(elf.SHN_LOOS), + "SHN_LOPROC": ValueOf(elf.SHN_LOPROC), + "SHN_LORESERVE": ValueOf(elf.SHN_LORESERVE), + "SHN_UNDEF": ValueOf(elf.SHN_UNDEF), + "SHN_XINDEX": ValueOf(elf.SHN_XINDEX), + "SHT_DYNAMIC": ValueOf(elf.SHT_DYNAMIC), + "SHT_DYNSYM": ValueOf(elf.SHT_DYNSYM), + "SHT_FINI_ARRAY": ValueOf(elf.SHT_FINI_ARRAY), + "SHT_GNU_ATTRIBUTES": ValueOf(elf.SHT_GNU_ATTRIBUTES), + "SHT_GNU_HASH": ValueOf(elf.SHT_GNU_HASH), + "SHT_GNU_LIBLIST": ValueOf(elf.SHT_GNU_LIBLIST), + "SHT_GNU_VERDEF": ValueOf(elf.SHT_GNU_VERDEF), + "SHT_GNU_VERNEED": ValueOf(elf.SHT_GNU_VERNEED), + "SHT_GNU_VERSYM": ValueOf(elf.SHT_GNU_VERSYM), + "SHT_GROUP": ValueOf(elf.SHT_GROUP), + "SHT_HASH": ValueOf(elf.SHT_HASH), + "SHT_HIOS": ValueOf(elf.SHT_HIOS), + "SHT_HIPROC": ValueOf(elf.SHT_HIPROC), + "SHT_HIUSER": ValueOf(elf.SHT_HIUSER), + "SHT_INIT_ARRAY": ValueOf(elf.SHT_INIT_ARRAY), + "SHT_LOOS": ValueOf(elf.SHT_LOOS), + "SHT_LOPROC": ValueOf(elf.SHT_LOPROC), + "SHT_LOUSER": ValueOf(elf.SHT_LOUSER), + "SHT_NOBITS": ValueOf(elf.SHT_NOBITS), + "SHT_NOTE": ValueOf(elf.SHT_NOTE), + "SHT_NULL": ValueOf(elf.SHT_NULL), + "SHT_PREINIT_ARRAY": ValueOf(elf.SHT_PREINIT_ARRAY), + "SHT_PROGBITS": ValueOf(elf.SHT_PROGBITS), + "SHT_REL": ValueOf(elf.SHT_REL), + "SHT_RELA": ValueOf(elf.SHT_RELA), + "SHT_SHLIB": ValueOf(elf.SHT_SHLIB), + "SHT_STRTAB": ValueOf(elf.SHT_STRTAB), + "SHT_SYMTAB": ValueOf(elf.SHT_SYMTAB), + "SHT_SYMTAB_SHNDX": ValueOf(elf.SHT_SYMTAB_SHNDX), + "STB_GLOBAL": ValueOf(elf.STB_GLOBAL), + "STB_HIOS": ValueOf(elf.STB_HIOS), + "STB_HIPROC": ValueOf(elf.STB_HIPROC), + "STB_LOCAL": ValueOf(elf.STB_LOCAL), + "STB_LOOS": ValueOf(elf.STB_LOOS), + "STB_LOPROC": ValueOf(elf.STB_LOPROC), + "STB_WEAK": ValueOf(elf.STB_WEAK), + "STT_COMMON": ValueOf(elf.STT_COMMON), + "STT_FILE": ValueOf(elf.STT_FILE), + "STT_FUNC": ValueOf(elf.STT_FUNC), + "STT_HIOS": ValueOf(elf.STT_HIOS), + "STT_HIPROC": ValueOf(elf.STT_HIPROC), + "STT_LOOS": ValueOf(elf.STT_LOOS), + "STT_LOPROC": ValueOf(elf.STT_LOPROC), + "STT_NOTYPE": ValueOf(elf.STT_NOTYPE), + "STT_OBJECT": ValueOf(elf.STT_OBJECT), + "STT_SECTION": ValueOf(elf.STT_SECTION), + "STT_TLS": ValueOf(elf.STT_TLS), + "STV_DEFAULT": ValueOf(elf.STV_DEFAULT), + "STV_HIDDEN": ValueOf(elf.STV_HIDDEN), + "STV_INTERNAL": ValueOf(elf.STV_INTERNAL), + "STV_PROTECTED": ValueOf(elf.STV_PROTECTED), + "ST_BIND": ValueOf(elf.ST_BIND), + "ST_INFO": ValueOf(elf.ST_INFO), + "ST_TYPE": ValueOf(elf.ST_TYPE), + "ST_VISIBILITY": ValueOf(elf.ST_VISIBILITY), + "Sym32Size": ValueOf(elf.Sym32Size), + "Sym64Size": ValueOf(elf.Sym64Size), + },Types: map[string]Type{ + "Chdr32": TypeOf((*elf.Chdr32)(nil)).Elem(), + "Chdr64": TypeOf((*elf.Chdr64)(nil)).Elem(), + "Class": TypeOf((*elf.Class)(nil)).Elem(), + "CompressionType": TypeOf((*elf.CompressionType)(nil)).Elem(), + "Data": TypeOf((*elf.Data)(nil)).Elem(), + "Dyn32": TypeOf((*elf.Dyn32)(nil)).Elem(), + "Dyn64": TypeOf((*elf.Dyn64)(nil)).Elem(), + "DynFlag": TypeOf((*elf.DynFlag)(nil)).Elem(), + "DynTag": TypeOf((*elf.DynTag)(nil)).Elem(), + "File": TypeOf((*elf.File)(nil)).Elem(), + "FileHeader": TypeOf((*elf.FileHeader)(nil)).Elem(), + "FormatError": TypeOf((*elf.FormatError)(nil)).Elem(), + "Header32": TypeOf((*elf.Header32)(nil)).Elem(), + "Header64": TypeOf((*elf.Header64)(nil)).Elem(), + "ImportedSymbol": TypeOf((*elf.ImportedSymbol)(nil)).Elem(), + "Machine": TypeOf((*elf.Machine)(nil)).Elem(), + "NType": TypeOf((*elf.NType)(nil)).Elem(), + "OSABI": TypeOf((*elf.OSABI)(nil)).Elem(), + "Prog": TypeOf((*elf.Prog)(nil)).Elem(), + "Prog32": TypeOf((*elf.Prog32)(nil)).Elem(), + "Prog64": TypeOf((*elf.Prog64)(nil)).Elem(), + "ProgFlag": TypeOf((*elf.ProgFlag)(nil)).Elem(), + "ProgHeader": TypeOf((*elf.ProgHeader)(nil)).Elem(), + "ProgType": TypeOf((*elf.ProgType)(nil)).Elem(), + "R_386": TypeOf((*elf.R_386)(nil)).Elem(), + "R_390": TypeOf((*elf.R_390)(nil)).Elem(), + "R_AARCH64": TypeOf((*elf.R_AARCH64)(nil)).Elem(), + "R_ALPHA": TypeOf((*elf.R_ALPHA)(nil)).Elem(), + "R_ARM": TypeOf((*elf.R_ARM)(nil)).Elem(), + "R_MIPS": TypeOf((*elf.R_MIPS)(nil)).Elem(), + "R_PPC": TypeOf((*elf.R_PPC)(nil)).Elem(), + "R_PPC64": TypeOf((*elf.R_PPC64)(nil)).Elem(), + "R_SPARC": TypeOf((*elf.R_SPARC)(nil)).Elem(), + "R_X86_64": TypeOf((*elf.R_X86_64)(nil)).Elem(), + "Rel32": TypeOf((*elf.Rel32)(nil)).Elem(), + "Rel64": TypeOf((*elf.Rel64)(nil)).Elem(), + "Rela32": TypeOf((*elf.Rela32)(nil)).Elem(), + "Rela64": TypeOf((*elf.Rela64)(nil)).Elem(), + "Section": TypeOf((*elf.Section)(nil)).Elem(), + "Section32": TypeOf((*elf.Section32)(nil)).Elem(), + "Section64": TypeOf((*elf.Section64)(nil)).Elem(), + "SectionFlag": TypeOf((*elf.SectionFlag)(nil)).Elem(), + "SectionHeader": TypeOf((*elf.SectionHeader)(nil)).Elem(), + "SectionIndex": TypeOf((*elf.SectionIndex)(nil)).Elem(), + "SectionType": TypeOf((*elf.SectionType)(nil)).Elem(), + "Sym32": TypeOf((*elf.Sym32)(nil)).Elem(), + "Sym64": TypeOf((*elf.Sym64)(nil)).Elem(), + "SymBind": TypeOf((*elf.SymBind)(nil)).Elem(), + "SymType": TypeOf((*elf.SymType)(nil)).Elem(), + "SymVis": TypeOf((*elf.SymVis)(nil)).Elem(), + "Symbol": TypeOf((*elf.Symbol)(nil)).Elem(), + "Type": TypeOf((*elf.Type)(nil)).Elem(), + "Version": TypeOf((*elf.Version)(nil)).Elem(), + },Untypeds: map[string]string{ + "ARM_MAGIC_TRAMP_NUMBER": "int:1543503875", + "EI_ABIVERSION": "int:8", + "EI_CLASS": "int:4", + "EI_DATA": "int:5", + "EI_NIDENT": "int:16", + "EI_OSABI": "int:7", + "EI_PAD": "int:9", + "EI_VERSION": "int:6", + "ELFMAG": "string:\u007fELF", + "Sym32Size": "int:16", + "Sym64Size": "int:24", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_gosym.go b/vendor/github.com/cosmos72/gomacro/imports/debug_gosym.go new file mode 100644 index 0000000..7d9862d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_gosym.go @@ -0,0 +1,30 @@ +// this file was generated by gomacro command: import _b "debug/gosym" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/gosym" +) + +// reflection: allow interpreted code to import "debug/gosym" +func init() { + Packages["debug/gosym"] = Package{ + Binds: map[string]Value{ + "NewLineTable": ValueOf(gosym.NewLineTable), + "NewTable": ValueOf(gosym.NewTable), + },Types: map[string]Type{ + "DecodingError": TypeOf((*gosym.DecodingError)(nil)).Elem(), + "Func": TypeOf((*gosym.Func)(nil)).Elem(), + "LineTable": TypeOf((*gosym.LineTable)(nil)).Elem(), + "Obj": TypeOf((*gosym.Obj)(nil)).Elem(), + "Sym": TypeOf((*gosym.Sym)(nil)).Elem(), + "Table": TypeOf((*gosym.Table)(nil)).Elem(), + "UnknownFileError": TypeOf((*gosym.UnknownFileError)(nil)).Elem(), + "UnknownLineError": TypeOf((*gosym.UnknownLineError)(nil)).Elem(), + },Wrappers: map[string][]string{ + "Func": []string{"BaseName","PackageName","ReceiverName","Static",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_macho.go b/vendor/github.com/cosmos72/gomacro/imports/debug_macho.go new file mode 100644 index 0000000..cfe4cb4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_macho.go @@ -0,0 +1,91 @@ +// this file was generated by gomacro command: import _b "debug/macho" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/macho" +) + +// reflection: allow interpreted code to import "debug/macho" +func init() { + Packages["debug/macho"] = Package{ + Binds: map[string]Value{ + "Cpu386": ValueOf(macho.Cpu386), + "CpuAmd64": ValueOf(macho.CpuAmd64), + "CpuArm": ValueOf(macho.CpuArm), + "CpuPpc": ValueOf(macho.CpuPpc), + "CpuPpc64": ValueOf(macho.CpuPpc64), + "ErrNotFat": ValueOf(&macho.ErrNotFat).Elem(), + "LoadCmdDylib": ValueOf(macho.LoadCmdDylib), + "LoadCmdDylinker": ValueOf(macho.LoadCmdDylinker), + "LoadCmdDysymtab": ValueOf(macho.LoadCmdDysymtab), + "LoadCmdSegment": ValueOf(macho.LoadCmdSegment), + "LoadCmdSegment64": ValueOf(macho.LoadCmdSegment64), + "LoadCmdSymtab": ValueOf(macho.LoadCmdSymtab), + "LoadCmdThread": ValueOf(macho.LoadCmdThread), + "LoadCmdUnixThread": ValueOf(macho.LoadCmdUnixThread), + "Magic32": ValueOf(macho.Magic32), + "Magic64": ValueOf(macho.Magic64), + "MagicFat": ValueOf(macho.MagicFat), + "NewFatFile": ValueOf(macho.NewFatFile), + "NewFile": ValueOf(macho.NewFile), + "Open": ValueOf(macho.Open), + "OpenFat": ValueOf(macho.OpenFat), + "TypeBundle": ValueOf(macho.TypeBundle), + "TypeDylib": ValueOf(macho.TypeDylib), + "TypeExec": ValueOf(macho.TypeExec), + "TypeObj": ValueOf(macho.TypeObj), + },Types: map[string]Type{ + "Cpu": TypeOf((*macho.Cpu)(nil)).Elem(), + "Dylib": TypeOf((*macho.Dylib)(nil)).Elem(), + "DylibCmd": TypeOf((*macho.DylibCmd)(nil)).Elem(), + "Dysymtab": TypeOf((*macho.Dysymtab)(nil)).Elem(), + "DysymtabCmd": TypeOf((*macho.DysymtabCmd)(nil)).Elem(), + "FatArch": TypeOf((*macho.FatArch)(nil)).Elem(), + "FatArchHeader": TypeOf((*macho.FatArchHeader)(nil)).Elem(), + "FatFile": TypeOf((*macho.FatFile)(nil)).Elem(), + "File": TypeOf((*macho.File)(nil)).Elem(), + "FileHeader": TypeOf((*macho.FileHeader)(nil)).Elem(), + "FormatError": TypeOf((*macho.FormatError)(nil)).Elem(), + "Load": TypeOf((*macho.Load)(nil)).Elem(), + "LoadBytes": TypeOf((*macho.LoadBytes)(nil)).Elem(), + "LoadCmd": TypeOf((*macho.LoadCmd)(nil)).Elem(), + "Nlist32": TypeOf((*macho.Nlist32)(nil)).Elem(), + "Nlist64": TypeOf((*macho.Nlist64)(nil)).Elem(), + "Regs386": TypeOf((*macho.Regs386)(nil)).Elem(), + "RegsAMD64": TypeOf((*macho.RegsAMD64)(nil)).Elem(), + "Section": TypeOf((*macho.Section)(nil)).Elem(), + "Section32": TypeOf((*macho.Section32)(nil)).Elem(), + "Section64": TypeOf((*macho.Section64)(nil)).Elem(), + "SectionHeader": TypeOf((*macho.SectionHeader)(nil)).Elem(), + "Segment": TypeOf((*macho.Segment)(nil)).Elem(), + "Segment32": TypeOf((*macho.Segment32)(nil)).Elem(), + "Segment64": TypeOf((*macho.Segment64)(nil)).Elem(), + "SegmentHeader": TypeOf((*macho.SegmentHeader)(nil)).Elem(), + "Symbol": TypeOf((*macho.Symbol)(nil)).Elem(), + "Symtab": TypeOf((*macho.Symtab)(nil)).Elem(), + "SymtabCmd": TypeOf((*macho.SymtabCmd)(nil)).Elem(), + "Thread": TypeOf((*macho.Thread)(nil)).Elem(), + "Type": TypeOf((*macho.Type)(nil)).Elem(), + },Proxies: map[string]Type{ + "Load": TypeOf((*Load_debug_macho)(nil)).Elem(), + },Wrappers: map[string][]string{ + "Dylib": []string{"Raw",}, + "Dysymtab": []string{"Raw",}, + "FatArch": []string{"Close","DWARF","ImportedLibraries","ImportedSymbols","Section","Segment",}, + "Segment": []string{"Raw",}, + "Symtab": []string{"Raw",}, + }, + } +} + +// --------------- proxy for debug/macho.Load --------------- +type Load_debug_macho struct { + Object interface{} + Raw_ func(interface{}) []byte +} +func (Proxy *Load_debug_macho) Raw() []byte { + return Proxy.Raw_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_pe.go b/vendor/github.com/cosmos72/gomacro/imports/debug_pe.go new file mode 100644 index 0000000..862e12b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_pe.go @@ -0,0 +1,77 @@ +// this file was generated by gomacro command: import _b "debug/pe" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/pe" +) + +// reflection: allow interpreted code to import "debug/pe" +func init() { + Packages["debug/pe"] = Package{ + Binds: map[string]Value{ + "COFFSymbolSize": ValueOf(pe.COFFSymbolSize), + "IMAGE_FILE_MACHINE_AM33": ValueOf(pe.IMAGE_FILE_MACHINE_AM33), + "IMAGE_FILE_MACHINE_AMD64": ValueOf(pe.IMAGE_FILE_MACHINE_AMD64), + "IMAGE_FILE_MACHINE_ARM": ValueOf(pe.IMAGE_FILE_MACHINE_ARM), + "IMAGE_FILE_MACHINE_EBC": ValueOf(pe.IMAGE_FILE_MACHINE_EBC), + "IMAGE_FILE_MACHINE_I386": ValueOf(pe.IMAGE_FILE_MACHINE_I386), + "IMAGE_FILE_MACHINE_IA64": ValueOf(pe.IMAGE_FILE_MACHINE_IA64), + "IMAGE_FILE_MACHINE_M32R": ValueOf(pe.IMAGE_FILE_MACHINE_M32R), + "IMAGE_FILE_MACHINE_MIPS16": ValueOf(pe.IMAGE_FILE_MACHINE_MIPS16), + "IMAGE_FILE_MACHINE_MIPSFPU": ValueOf(pe.IMAGE_FILE_MACHINE_MIPSFPU), + "IMAGE_FILE_MACHINE_MIPSFPU16": ValueOf(pe.IMAGE_FILE_MACHINE_MIPSFPU16), + "IMAGE_FILE_MACHINE_POWERPC": ValueOf(pe.IMAGE_FILE_MACHINE_POWERPC), + "IMAGE_FILE_MACHINE_POWERPCFP": ValueOf(pe.IMAGE_FILE_MACHINE_POWERPCFP), + "IMAGE_FILE_MACHINE_R4000": ValueOf(pe.IMAGE_FILE_MACHINE_R4000), + "IMAGE_FILE_MACHINE_SH3": ValueOf(pe.IMAGE_FILE_MACHINE_SH3), + "IMAGE_FILE_MACHINE_SH3DSP": ValueOf(pe.IMAGE_FILE_MACHINE_SH3DSP), + "IMAGE_FILE_MACHINE_SH4": ValueOf(pe.IMAGE_FILE_MACHINE_SH4), + "IMAGE_FILE_MACHINE_SH5": ValueOf(pe.IMAGE_FILE_MACHINE_SH5), + "IMAGE_FILE_MACHINE_THUMB": ValueOf(pe.IMAGE_FILE_MACHINE_THUMB), + "IMAGE_FILE_MACHINE_UNKNOWN": ValueOf(pe.IMAGE_FILE_MACHINE_UNKNOWN), + "IMAGE_FILE_MACHINE_WCEMIPSV2": ValueOf(pe.IMAGE_FILE_MACHINE_WCEMIPSV2), + "NewFile": ValueOf(pe.NewFile), + "Open": ValueOf(pe.Open), + },Types: map[string]Type{ + "COFFSymbol": TypeOf((*pe.COFFSymbol)(nil)).Elem(), + "DataDirectory": TypeOf((*pe.DataDirectory)(nil)).Elem(), + "File": TypeOf((*pe.File)(nil)).Elem(), + "FileHeader": TypeOf((*pe.FileHeader)(nil)).Elem(), + "FormatError": TypeOf((*pe.FormatError)(nil)).Elem(), + "ImportDirectory": TypeOf((*pe.ImportDirectory)(nil)).Elem(), + "OptionalHeader32": TypeOf((*pe.OptionalHeader32)(nil)).Elem(), + "OptionalHeader64": TypeOf((*pe.OptionalHeader64)(nil)).Elem(), + "Reloc": TypeOf((*pe.Reloc)(nil)).Elem(), + "Section": TypeOf((*pe.Section)(nil)).Elem(), + "SectionHeader": TypeOf((*pe.SectionHeader)(nil)).Elem(), + "SectionHeader32": TypeOf((*pe.SectionHeader32)(nil)).Elem(), + "StringTable": TypeOf((*pe.StringTable)(nil)).Elem(), + "Symbol": TypeOf((*pe.Symbol)(nil)).Elem(), + },Untypeds: map[string]string{ + "COFFSymbolSize": "int:18", + "IMAGE_FILE_MACHINE_AM33": "int:467", + "IMAGE_FILE_MACHINE_AMD64": "int:34404", + "IMAGE_FILE_MACHINE_ARM": "int:448", + "IMAGE_FILE_MACHINE_EBC": "int:3772", + "IMAGE_FILE_MACHINE_I386": "int:332", + "IMAGE_FILE_MACHINE_IA64": "int:512", + "IMAGE_FILE_MACHINE_M32R": "int:36929", + "IMAGE_FILE_MACHINE_MIPS16": "int:614", + "IMAGE_FILE_MACHINE_MIPSFPU": "int:870", + "IMAGE_FILE_MACHINE_MIPSFPU16": "int:1126", + "IMAGE_FILE_MACHINE_POWERPC": "int:496", + "IMAGE_FILE_MACHINE_POWERPCFP": "int:497", + "IMAGE_FILE_MACHINE_R4000": "int:358", + "IMAGE_FILE_MACHINE_SH3": "int:418", + "IMAGE_FILE_MACHINE_SH3DSP": "int:419", + "IMAGE_FILE_MACHINE_SH4": "int:422", + "IMAGE_FILE_MACHINE_SH5": "int:424", + "IMAGE_FILE_MACHINE_THUMB": "int:450", + "IMAGE_FILE_MACHINE_UNKNOWN": "int:0", + "IMAGE_FILE_MACHINE_WCEMIPSV2": "int:361", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/debug_plan9obj.go b/vendor/github.com/cosmos72/gomacro/imports/debug_plan9obj.go new file mode 100644 index 0000000..e102f2d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/debug_plan9obj.go @@ -0,0 +1,34 @@ +// this file was generated by gomacro command: import _b "debug/plan9obj" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "debug/plan9obj" +) + +// reflection: allow interpreted code to import "debug/plan9obj" +func init() { + Packages["debug/plan9obj"] = Package{ + Binds: map[string]Value{ + "Magic386": ValueOf(plan9obj.Magic386), + "Magic64": ValueOf(plan9obj.Magic64), + "MagicAMD64": ValueOf(plan9obj.MagicAMD64), + "MagicARM": ValueOf(plan9obj.MagicARM), + "NewFile": ValueOf(plan9obj.NewFile), + "Open": ValueOf(plan9obj.Open), + },Types: map[string]Type{ + "File": TypeOf((*plan9obj.File)(nil)).Elem(), + "FileHeader": TypeOf((*plan9obj.FileHeader)(nil)).Elem(), + "Section": TypeOf((*plan9obj.Section)(nil)).Elem(), + "SectionHeader": TypeOf((*plan9obj.SectionHeader)(nil)).Elem(), + "Sym": TypeOf((*plan9obj.Sym)(nil)).Elem(), + },Untypeds: map[string]string{ + "Magic386": "int:491", + "Magic64": "int:32768", + "MagicAMD64": "int:35479", + "MagicARM": "int:1607", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding.go b/vendor/github.com/cosmos72/gomacro/imports/encoding.go new file mode 100644 index 0000000..41f45f5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding.go @@ -0,0 +1,62 @@ +// this file was generated by gomacro command: import _b "encoding" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding" +) + +// reflection: allow interpreted code to import "encoding" +func init() { + Packages["encoding"] = Package{ + Types: map[string]Type{ + "BinaryMarshaler": TypeOf((*encoding.BinaryMarshaler)(nil)).Elem(), + "BinaryUnmarshaler": TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem(), + "TextMarshaler": TypeOf((*encoding.TextMarshaler)(nil)).Elem(), + "TextUnmarshaler": TypeOf((*encoding.TextUnmarshaler)(nil)).Elem(), + },Proxies: map[string]Type{ + "BinaryMarshaler": TypeOf((*BinaryMarshaler_encoding)(nil)).Elem(), + "BinaryUnmarshaler": TypeOf((*BinaryUnmarshaler_encoding)(nil)).Elem(), + "TextMarshaler": TypeOf((*TextMarshaler_encoding)(nil)).Elem(), + "TextUnmarshaler": TypeOf((*TextUnmarshaler_encoding)(nil)).Elem(), + }, + } +} + +// --------------- proxy for encoding.BinaryMarshaler --------------- +type BinaryMarshaler_encoding struct { + Object interface{} + MarshalBinary_ func(interface{}) (data []byte, err error) +} +func (Proxy *BinaryMarshaler_encoding) MarshalBinary() (data []byte, err error) { + return Proxy.MarshalBinary_(Proxy.Object) +} + +// --------------- proxy for encoding.BinaryUnmarshaler --------------- +type BinaryUnmarshaler_encoding struct { + Object interface{} + UnmarshalBinary_ func(_proxy_obj_ interface{}, data []byte) error +} +func (Proxy *BinaryUnmarshaler_encoding) UnmarshalBinary(data []byte) error { + return Proxy.UnmarshalBinary_(Proxy.Object, data) +} + +// --------------- proxy for encoding.TextMarshaler --------------- +type TextMarshaler_encoding struct { + Object interface{} + MarshalText_ func(interface{}) (text []byte, err error) +} +func (Proxy *TextMarshaler_encoding) MarshalText() (text []byte, err error) { + return Proxy.MarshalText_(Proxy.Object) +} + +// --------------- proxy for encoding.TextUnmarshaler --------------- +type TextUnmarshaler_encoding struct { + Object interface{} + UnmarshalText_ func(_proxy_obj_ interface{}, text []byte) error +} +func (Proxy *TextUnmarshaler_encoding) UnmarshalText(text []byte) error { + return Proxy.UnmarshalText_(Proxy.Object, text) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_ascii85.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_ascii85.go new file mode 100644 index 0000000..82d80de --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_ascii85.go @@ -0,0 +1,24 @@ +// this file was generated by gomacro command: import _b "encoding/ascii85" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/ascii85" +) + +// reflection: allow interpreted code to import "encoding/ascii85" +func init() { + Packages["encoding/ascii85"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(ascii85.Decode), + "Encode": ValueOf(ascii85.Encode), + "MaxEncodedLen": ValueOf(ascii85.MaxEncodedLen), + "NewDecoder": ValueOf(ascii85.NewDecoder), + "NewEncoder": ValueOf(ascii85.NewEncoder), + },Types: map[string]Type{ + "CorruptInputError": TypeOf((*ascii85.CorruptInputError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_asn1.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_asn1.go new file mode 100644 index 0000000..cd97c75 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_asn1.go @@ -0,0 +1,68 @@ +// this file was generated by gomacro command: import _b "encoding/asn1" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/asn1" +) + +// reflection: allow interpreted code to import "encoding/asn1" +func init() { + Packages["encoding/asn1"] = Package{ + Binds: map[string]Value{ + "ClassApplication": ValueOf(asn1.ClassApplication), + "ClassContextSpecific": ValueOf(asn1.ClassContextSpecific), + "ClassPrivate": ValueOf(asn1.ClassPrivate), + "ClassUniversal": ValueOf(asn1.ClassUniversal), + "Marshal": ValueOf(asn1.Marshal), + "TagBitString": ValueOf(asn1.TagBitString), + "TagBoolean": ValueOf(asn1.TagBoolean), + "TagEnum": ValueOf(asn1.TagEnum), + "TagGeneralString": ValueOf(asn1.TagGeneralString), + "TagGeneralizedTime": ValueOf(asn1.TagGeneralizedTime), + "TagIA5String": ValueOf(asn1.TagIA5String), + "TagInteger": ValueOf(asn1.TagInteger), + "TagOID": ValueOf(asn1.TagOID), + "TagOctetString": ValueOf(asn1.TagOctetString), + "TagPrintableString": ValueOf(asn1.TagPrintableString), + "TagSequence": ValueOf(asn1.TagSequence), + "TagSet": ValueOf(asn1.TagSet), + "TagT61String": ValueOf(asn1.TagT61String), + "TagUTCTime": ValueOf(asn1.TagUTCTime), + "TagUTF8String": ValueOf(asn1.TagUTF8String), + "Unmarshal": ValueOf(asn1.Unmarshal), + "UnmarshalWithParams": ValueOf(asn1.UnmarshalWithParams), + },Types: map[string]Type{ + "BitString": TypeOf((*asn1.BitString)(nil)).Elem(), + "Enumerated": TypeOf((*asn1.Enumerated)(nil)).Elem(), + "Flag": TypeOf((*asn1.Flag)(nil)).Elem(), + "ObjectIdentifier": TypeOf((*asn1.ObjectIdentifier)(nil)).Elem(), + "RawContent": TypeOf((*asn1.RawContent)(nil)).Elem(), + "RawValue": TypeOf((*asn1.RawValue)(nil)).Elem(), + "StructuralError": TypeOf((*asn1.StructuralError)(nil)).Elem(), + "SyntaxError": TypeOf((*asn1.SyntaxError)(nil)).Elem(), + },Untypeds: map[string]string{ + "ClassApplication": "int:1", + "ClassContextSpecific": "int:2", + "ClassPrivate": "int:3", + "ClassUniversal": "int:0", + "TagBitString": "int:3", + "TagBoolean": "int:1", + "TagEnum": "int:10", + "TagGeneralString": "int:27", + "TagGeneralizedTime": "int:24", + "TagIA5String": "int:22", + "TagInteger": "int:2", + "TagOID": "int:6", + "TagOctetString": "int:4", + "TagPrintableString": "int:19", + "TagSequence": "int:16", + "TagSet": "int:17", + "TagT61String": "int:20", + "TagUTCTime": "int:23", + "TagUTF8String": "int:12", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_base32.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_base32.go new file mode 100644 index 0000000..0855789 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_base32.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "encoding/base32" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/base32" +) + +// reflection: allow interpreted code to import "encoding/base32" +func init() { + Packages["encoding/base32"] = Package{ + Binds: map[string]Value{ + "HexEncoding": ValueOf(&base32.HexEncoding).Elem(), + "NewDecoder": ValueOf(base32.NewDecoder), + "NewEncoder": ValueOf(base32.NewEncoder), + "NewEncoding": ValueOf(base32.NewEncoding), + "StdEncoding": ValueOf(&base32.StdEncoding).Elem(), + },Types: map[string]Type{ + "CorruptInputError": TypeOf((*base32.CorruptInputError)(nil)).Elem(), + "Encoding": TypeOf((*base32.Encoding)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_base64.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_base64.go new file mode 100644 index 0000000..f241161 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_base64.go @@ -0,0 +1,29 @@ +// this file was generated by gomacro command: import _b "encoding/base64" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/base64" +) + +// reflection: allow interpreted code to import "encoding/base64" +func init() { + Packages["encoding/base64"] = Package{ + Binds: map[string]Value{ + "NewDecoder": ValueOf(base64.NewDecoder), + "NewEncoder": ValueOf(base64.NewEncoder), + "NewEncoding": ValueOf(base64.NewEncoding), + "NoPadding": ValueOf(base64.NoPadding), + "RawStdEncoding": ValueOf(&base64.RawStdEncoding).Elem(), + "RawURLEncoding": ValueOf(&base64.RawURLEncoding).Elem(), + "StdEncoding": ValueOf(&base64.StdEncoding).Elem(), + "StdPadding": ValueOf(base64.StdPadding), + "URLEncoding": ValueOf(&base64.URLEncoding).Elem(), + },Types: map[string]Type{ + "CorruptInputError": TypeOf((*base64.CorruptInputError)(nil)).Elem(), + "Encoding": TypeOf((*base64.Encoding)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_binary.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_binary.go new file mode 100644 index 0000000..de2368b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_binary.go @@ -0,0 +1,72 @@ +// this file was generated by gomacro command: import _b "encoding/binary" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/binary" +) + +// reflection: allow interpreted code to import "encoding/binary" +func init() { + Packages["encoding/binary"] = Package{ + Binds: map[string]Value{ + "BigEndian": ValueOf(&binary.BigEndian).Elem(), + "LittleEndian": ValueOf(&binary.LittleEndian).Elem(), + "MaxVarintLen16": ValueOf(binary.MaxVarintLen16), + "MaxVarintLen32": ValueOf(binary.MaxVarintLen32), + "MaxVarintLen64": ValueOf(binary.MaxVarintLen64), + "PutUvarint": ValueOf(binary.PutUvarint), + "PutVarint": ValueOf(binary.PutVarint), + "Read": ValueOf(binary.Read), + "ReadUvarint": ValueOf(binary.ReadUvarint), + "ReadVarint": ValueOf(binary.ReadVarint), + "Size": ValueOf(binary.Size), + "Uvarint": ValueOf(binary.Uvarint), + "Varint": ValueOf(binary.Varint), + "Write": ValueOf(binary.Write), + },Types: map[string]Type{ + "ByteOrder": TypeOf((*binary.ByteOrder)(nil)).Elem(), + },Proxies: map[string]Type{ + "ByteOrder": TypeOf((*ByteOrder_encoding_binary)(nil)).Elem(), + },Untypeds: map[string]string{ + "MaxVarintLen16": "int:3", + "MaxVarintLen32": "int:5", + "MaxVarintLen64": "int:10", + }, + } +} + +// --------------- proxy for encoding/binary.ByteOrder --------------- +type ByteOrder_encoding_binary struct { + Object interface{} + PutUint16_ func(interface{}, []byte, uint16) + PutUint32_ func(interface{}, []byte, uint32) + PutUint64_ func(interface{}, []byte, uint64) + String_ func(interface{}) string + Uint16_ func(interface{}, []byte) uint16 + Uint32_ func(interface{}, []byte) uint32 + Uint64_ func(interface{}, []byte) uint64 +} +func (Proxy *ByteOrder_encoding_binary) PutUint16(unnamed0 []byte, unnamed1 uint16) { + Proxy.PutUint16_(Proxy.Object, unnamed0, unnamed1) +} +func (Proxy *ByteOrder_encoding_binary) PutUint32(unnamed0 []byte, unnamed1 uint32) { + Proxy.PutUint32_(Proxy.Object, unnamed0, unnamed1) +} +func (Proxy *ByteOrder_encoding_binary) PutUint64(unnamed0 []byte, unnamed1 uint64) { + Proxy.PutUint64_(Proxy.Object, unnamed0, unnamed1) +} +func (Proxy *ByteOrder_encoding_binary) String() string { + return Proxy.String_(Proxy.Object) +} +func (Proxy *ByteOrder_encoding_binary) Uint16(unnamed0 []byte) uint16 { + return Proxy.Uint16_(Proxy.Object, unnamed0) +} +func (Proxy *ByteOrder_encoding_binary) Uint32(unnamed0 []byte) uint32 { + return Proxy.Uint32_(Proxy.Object, unnamed0) +} +func (Proxy *ByteOrder_encoding_binary) Uint64(unnamed0 []byte) uint64 { + return Proxy.Uint64_(Proxy.Object, unnamed0) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_csv.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_csv.go new file mode 100644 index 0000000..8ed0be1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_csv.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "encoding/csv" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/csv" +) + +// reflection: allow interpreted code to import "encoding/csv" +func init() { + Packages["encoding/csv"] = Package{ + Binds: map[string]Value{ + "ErrBareQuote": ValueOf(&csv.ErrBareQuote).Elem(), + "ErrFieldCount": ValueOf(&csv.ErrFieldCount).Elem(), + "ErrQuote": ValueOf(&csv.ErrQuote).Elem(), + "ErrTrailingComma": ValueOf(&csv.ErrTrailingComma).Elem(), + "NewReader": ValueOf(csv.NewReader), + "NewWriter": ValueOf(csv.NewWriter), + },Types: map[string]Type{ + "ParseError": TypeOf((*csv.ParseError)(nil)).Elem(), + "Reader": TypeOf((*csv.Reader)(nil)).Elem(), + "Writer": TypeOf((*csv.Writer)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_gob.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_gob.go new file mode 100644 index 0000000..cd3a04e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_gob.go @@ -0,0 +1,48 @@ +// this file was generated by gomacro command: import _b "encoding/gob" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/gob" +) + +// reflection: allow interpreted code to import "encoding/gob" +func init() { + Packages["encoding/gob"] = Package{ + Binds: map[string]Value{ + "NewDecoder": ValueOf(gob.NewDecoder), + "NewEncoder": ValueOf(gob.NewEncoder), + "Register": ValueOf(gob.Register), + "RegisterName": ValueOf(gob.RegisterName), + },Types: map[string]Type{ + "CommonType": TypeOf((*gob.CommonType)(nil)).Elem(), + "Decoder": TypeOf((*gob.Decoder)(nil)).Elem(), + "Encoder": TypeOf((*gob.Encoder)(nil)).Elem(), + "GobDecoder": TypeOf((*gob.GobDecoder)(nil)).Elem(), + "GobEncoder": TypeOf((*gob.GobEncoder)(nil)).Elem(), + },Proxies: map[string]Type{ + "GobDecoder": TypeOf((*GobDecoder_encoding_gob)(nil)).Elem(), + "GobEncoder": TypeOf((*GobEncoder_encoding_gob)(nil)).Elem(), + }, + } +} + +// --------------- proxy for encoding/gob.GobDecoder --------------- +type GobDecoder_encoding_gob struct { + Object interface{} + GobDecode_ func(interface{}, []byte) error +} +func (Proxy *GobDecoder_encoding_gob) GobDecode(unnamed0 []byte) error { + return Proxy.GobDecode_(Proxy.Object, unnamed0) +} + +// --------------- proxy for encoding/gob.GobEncoder --------------- +type GobEncoder_encoding_gob struct { + Object interface{} + GobEncode_ func(interface{}) ([]byte, error) +} +func (Proxy *GobEncoder_encoding_gob) GobEncode() ([]byte, error) { + return Proxy.GobEncode_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_hex.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_hex.go new file mode 100644 index 0000000..a268393 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_hex.go @@ -0,0 +1,28 @@ +// this file was generated by gomacro command: import _b "encoding/hex" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/hex" +) + +// reflection: allow interpreted code to import "encoding/hex" +func init() { + Packages["encoding/hex"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(hex.Decode), + "DecodeString": ValueOf(hex.DecodeString), + "DecodedLen": ValueOf(hex.DecodedLen), + "Dump": ValueOf(hex.Dump), + "Dumper": ValueOf(hex.Dumper), + "Encode": ValueOf(hex.Encode), + "EncodeToString": ValueOf(hex.EncodeToString), + "EncodedLen": ValueOf(hex.EncodedLen), + "ErrLength": ValueOf(&hex.ErrLength).Elem(), + },Types: map[string]Type{ + "InvalidByteError": TypeOf((*hex.InvalidByteError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_json.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_json.go new file mode 100644 index 0000000..cef7391 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_json.go @@ -0,0 +1,69 @@ +// this file was generated by gomacro command: import _b "encoding/json" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/json" +) + +// reflection: allow interpreted code to import "encoding/json" +func init() { + Packages["encoding/json"] = Package{ + Binds: map[string]Value{ + "Compact": ValueOf(json.Compact), + "HTMLEscape": ValueOf(json.HTMLEscape), + "Indent": ValueOf(json.Indent), + "Marshal": ValueOf(json.Marshal), + "MarshalIndent": ValueOf(json.MarshalIndent), + "NewDecoder": ValueOf(json.NewDecoder), + "NewEncoder": ValueOf(json.NewEncoder), + "Unmarshal": ValueOf(json.Unmarshal), + },Types: map[string]Type{ + "Decoder": TypeOf((*json.Decoder)(nil)).Elem(), + "Delim": TypeOf((*json.Delim)(nil)).Elem(), + "Encoder": TypeOf((*json.Encoder)(nil)).Elem(), + "InvalidUTF8Error": TypeOf((*json.InvalidUTF8Error)(nil)).Elem(), + "InvalidUnmarshalError": TypeOf((*json.InvalidUnmarshalError)(nil)).Elem(), + "Marshaler": TypeOf((*json.Marshaler)(nil)).Elem(), + "MarshalerError": TypeOf((*json.MarshalerError)(nil)).Elem(), + "Number": TypeOf((*json.Number)(nil)).Elem(), + "RawMessage": TypeOf((*json.RawMessage)(nil)).Elem(), + "SyntaxError": TypeOf((*json.SyntaxError)(nil)).Elem(), + "Token": TypeOf((*json.Token)(nil)).Elem(), + "UnmarshalFieldError": TypeOf((*json.UnmarshalFieldError)(nil)).Elem(), + "UnmarshalTypeError": TypeOf((*json.UnmarshalTypeError)(nil)).Elem(), + "Unmarshaler": TypeOf((*json.Unmarshaler)(nil)).Elem(), + "UnsupportedTypeError": TypeOf((*json.UnsupportedTypeError)(nil)).Elem(), + "UnsupportedValueError": TypeOf((*json.UnsupportedValueError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Marshaler": TypeOf((*Marshaler_encoding_json)(nil)).Elem(), + "Token": TypeOf((*Token_encoding_json)(nil)).Elem(), + "Unmarshaler": TypeOf((*Unmarshaler_encoding_json)(nil)).Elem(), + }, + } +} + +// --------------- proxy for encoding/json.Marshaler --------------- +type Marshaler_encoding_json struct { + Object interface{} + MarshalJSON_ func(interface{}) ([]byte, error) +} +func (Proxy *Marshaler_encoding_json) MarshalJSON() ([]byte, error) { + return Proxy.MarshalJSON_(Proxy.Object) +} + +// --------------- proxy for encoding/json.Token --------------- +type Token_encoding_json struct { + Object interface{} +} + +// --------------- proxy for encoding/json.Unmarshaler --------------- +type Unmarshaler_encoding_json struct { + Object interface{} + UnmarshalJSON_ func(interface{}, []byte) error +} +func (Proxy *Unmarshaler_encoding_json) UnmarshalJSON(unnamed0 []byte) error { + return Proxy.UnmarshalJSON_(Proxy.Object, unnamed0) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_pem.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_pem.go new file mode 100644 index 0000000..762c2e7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_pem.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "encoding/pem" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/pem" +) + +// reflection: allow interpreted code to import "encoding/pem" +func init() { + Packages["encoding/pem"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(pem.Decode), + "Encode": ValueOf(pem.Encode), + "EncodeToMemory": ValueOf(pem.EncodeToMemory), + },Types: map[string]Type{ + "Block": TypeOf((*pem.Block)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/encoding_xml.go b/vendor/github.com/cosmos72/gomacro/imports/encoding_xml.go new file mode 100644 index 0000000..3fe9156 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/encoding_xml.go @@ -0,0 +1,97 @@ +// this file was generated by gomacro command: import _b "encoding/xml" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "encoding/xml" +) + +// reflection: allow interpreted code to import "encoding/xml" +func init() { + Packages["encoding/xml"] = Package{ + Binds: map[string]Value{ + "CopyToken": ValueOf(xml.CopyToken), + "Escape": ValueOf(xml.Escape), + "EscapeText": ValueOf(xml.EscapeText), + "HTMLAutoClose": ValueOf(&xml.HTMLAutoClose).Elem(), + "HTMLEntity": ValueOf(&xml.HTMLEntity).Elem(), + "Header": ValueOf(xml.Header), + "Marshal": ValueOf(xml.Marshal), + "MarshalIndent": ValueOf(xml.MarshalIndent), + "NewDecoder": ValueOf(xml.NewDecoder), + "NewEncoder": ValueOf(xml.NewEncoder), + "Unmarshal": ValueOf(xml.Unmarshal), + },Types: map[string]Type{ + "Attr": TypeOf((*xml.Attr)(nil)).Elem(), + "CharData": TypeOf((*xml.CharData)(nil)).Elem(), + "Comment": TypeOf((*xml.Comment)(nil)).Elem(), + "Decoder": TypeOf((*xml.Decoder)(nil)).Elem(), + "Directive": TypeOf((*xml.Directive)(nil)).Elem(), + "Encoder": TypeOf((*xml.Encoder)(nil)).Elem(), + "EndElement": TypeOf((*xml.EndElement)(nil)).Elem(), + "Marshaler": TypeOf((*xml.Marshaler)(nil)).Elem(), + "MarshalerAttr": TypeOf((*xml.MarshalerAttr)(nil)).Elem(), + "Name": TypeOf((*xml.Name)(nil)).Elem(), + "ProcInst": TypeOf((*xml.ProcInst)(nil)).Elem(), + "StartElement": TypeOf((*xml.StartElement)(nil)).Elem(), + "SyntaxError": TypeOf((*xml.SyntaxError)(nil)).Elem(), + "TagPathError": TypeOf((*xml.TagPathError)(nil)).Elem(), + "Token": TypeOf((*xml.Token)(nil)).Elem(), + "UnmarshalError": TypeOf((*xml.UnmarshalError)(nil)).Elem(), + "Unmarshaler": TypeOf((*xml.Unmarshaler)(nil)).Elem(), + "UnmarshalerAttr": TypeOf((*xml.UnmarshalerAttr)(nil)).Elem(), + "UnsupportedTypeError": TypeOf((*xml.UnsupportedTypeError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Marshaler": TypeOf((*Marshaler_encoding_xml)(nil)).Elem(), + "MarshalerAttr": TypeOf((*MarshalerAttr_encoding_xml)(nil)).Elem(), + "Token": TypeOf((*Token_encoding_xml)(nil)).Elem(), + "Unmarshaler": TypeOf((*Unmarshaler_encoding_xml)(nil)).Elem(), + "UnmarshalerAttr": TypeOf((*UnmarshalerAttr_encoding_xml)(nil)).Elem(), + },Untypeds: map[string]string{ + "Header": "string:\n", + }, + } +} + +// --------------- proxy for encoding/xml.Marshaler --------------- +type Marshaler_encoding_xml struct { + Object interface{} + MarshalXML_ func(_proxy_obj_ interface{}, e *xml.Encoder, start xml.StartElement) error +} +func (Proxy *Marshaler_encoding_xml) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + return Proxy.MarshalXML_(Proxy.Object, e, start) +} + +// --------------- proxy for encoding/xml.MarshalerAttr --------------- +type MarshalerAttr_encoding_xml struct { + Object interface{} + MarshalXMLAttr_ func(_proxy_obj_ interface{}, name xml.Name) (xml.Attr, error) +} +func (Proxy *MarshalerAttr_encoding_xml) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + return Proxy.MarshalXMLAttr_(Proxy.Object, name) +} + +// --------------- proxy for encoding/xml.Token --------------- +type Token_encoding_xml struct { + Object interface{} +} + +// --------------- proxy for encoding/xml.Unmarshaler --------------- +type Unmarshaler_encoding_xml struct { + Object interface{} + UnmarshalXML_ func(_proxy_obj_ interface{}, d *xml.Decoder, start xml.StartElement) error +} +func (Proxy *Unmarshaler_encoding_xml) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + return Proxy.UnmarshalXML_(Proxy.Object, d, start) +} + +// --------------- proxy for encoding/xml.UnmarshalerAttr --------------- +type UnmarshalerAttr_encoding_xml struct { + Object interface{} + UnmarshalXMLAttr_ func(_proxy_obj_ interface{}, attr xml.Attr) error +} +func (Proxy *UnmarshalerAttr_encoding_xml) UnmarshalXMLAttr(attr xml.Attr) error { + return Proxy.UnmarshalXMLAttr_(Proxy.Object, attr) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/errors.go b/vendor/github.com/cosmos72/gomacro/imports/errors.go new file mode 100644 index 0000000..822ef33 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/errors.go @@ -0,0 +1,18 @@ +// this file was generated by gomacro command: import _b "errors" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "errors" +) + +// reflection: allow interpreted code to import "errors" +func init() { + Packages["errors"] = Package{ + Binds: map[string]Value{ + "New": ValueOf(errors.New), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/expvar.go b/vendor/github.com/cosmos72/gomacro/imports/expvar.go new file mode 100644 index 0000000..a2f235c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/expvar.go @@ -0,0 +1,44 @@ +// this file was generated by gomacro command: import _b "expvar" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "expvar" +) + +// reflection: allow interpreted code to import "expvar" +func init() { + Packages["expvar"] = Package{ + Binds: map[string]Value{ + "Do": ValueOf(expvar.Do), + "Get": ValueOf(expvar.Get), + "Handler": ValueOf(expvar.Handler), + "NewFloat": ValueOf(expvar.NewFloat), + "NewInt": ValueOf(expvar.NewInt), + "NewMap": ValueOf(expvar.NewMap), + "NewString": ValueOf(expvar.NewString), + "Publish": ValueOf(expvar.Publish), + },Types: map[string]Type{ + "Float": TypeOf((*expvar.Float)(nil)).Elem(), + "Func": TypeOf((*expvar.Func)(nil)).Elem(), + "Int": TypeOf((*expvar.Int)(nil)).Elem(), + "KeyValue": TypeOf((*expvar.KeyValue)(nil)).Elem(), + "Map": TypeOf((*expvar.Map)(nil)).Elem(), + "String": TypeOf((*expvar.String)(nil)).Elem(), + "Var": TypeOf((*expvar.Var)(nil)).Elem(), + },Proxies: map[string]Type{ + "Var": TypeOf((*Var_expvar)(nil)).Elem(), + }, + } +} + +// --------------- proxy for expvar.Var --------------- +type Var_expvar struct { + Object interface{} + String_ func(interface{}) string +} +func (Proxy *Var_expvar) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/flag.go b/vendor/github.com/cosmos72/gomacro/imports/flag.go new file mode 100644 index 0000000..18e6ba0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/flag.go @@ -0,0 +1,92 @@ +// this file was generated by gomacro command: import _b "flag" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "flag" +) + +// reflection: allow interpreted code to import "flag" +func init() { + Packages["flag"] = Package{ + Binds: map[string]Value{ + "Arg": ValueOf(flag.Arg), + "Args": ValueOf(flag.Args), + "Bool": ValueOf(flag.Bool), + "BoolVar": ValueOf(flag.BoolVar), + "CommandLine": ValueOf(&flag.CommandLine).Elem(), + "ContinueOnError": ValueOf(flag.ContinueOnError), + "Duration": ValueOf(flag.Duration), + "DurationVar": ValueOf(flag.DurationVar), + "ErrHelp": ValueOf(&flag.ErrHelp).Elem(), + "ExitOnError": ValueOf(flag.ExitOnError), + "Float64": ValueOf(flag.Float64), + "Float64Var": ValueOf(flag.Float64Var), + "Int": ValueOf(flag.Int), + "Int64": ValueOf(flag.Int64), + "Int64Var": ValueOf(flag.Int64Var), + "IntVar": ValueOf(flag.IntVar), + "Lookup": ValueOf(flag.Lookup), + "NArg": ValueOf(flag.NArg), + "NFlag": ValueOf(flag.NFlag), + "NewFlagSet": ValueOf(flag.NewFlagSet), + "PanicOnError": ValueOf(flag.PanicOnError), + "Parse": ValueOf(flag.Parse), + "Parsed": ValueOf(flag.Parsed), + "PrintDefaults": ValueOf(flag.PrintDefaults), + "Set": ValueOf(flag.Set), + "String": ValueOf(flag.String), + "StringVar": ValueOf(flag.StringVar), + "Uint": ValueOf(flag.Uint), + "Uint64": ValueOf(flag.Uint64), + "Uint64Var": ValueOf(flag.Uint64Var), + "UintVar": ValueOf(flag.UintVar), + "UnquoteUsage": ValueOf(flag.UnquoteUsage), + "Usage": ValueOf(&flag.Usage).Elem(), + "Var": ValueOf(flag.Var), + "Visit": ValueOf(flag.Visit), + "VisitAll": ValueOf(flag.VisitAll), + },Types: map[string]Type{ + "ErrorHandling": TypeOf((*flag.ErrorHandling)(nil)).Elem(), + "Flag": TypeOf((*flag.Flag)(nil)).Elem(), + "FlagSet": TypeOf((*flag.FlagSet)(nil)).Elem(), + "Getter": TypeOf((*flag.Getter)(nil)).Elem(), + "Value": TypeOf((*flag.Value)(nil)).Elem(), + },Proxies: map[string]Type{ + "Getter": TypeOf((*Getter_flag)(nil)).Elem(), + "Value": TypeOf((*Value_flag)(nil)).Elem(), + }, + } +} + +// --------------- proxy for flag.Getter --------------- +type Getter_flag struct { + Object interface{} + Get_ func(interface{}) interface{} + Set_ func(interface{}, string) error + String_ func(interface{}) string +} +func (Proxy *Getter_flag) Get() interface{} { + return Proxy.Get_(Proxy.Object) +} +func (Proxy *Getter_flag) Set(unnamed0 string) error { + return Proxy.Set_(Proxy.Object, unnamed0) +} +func (Proxy *Getter_flag) String() string { + return Proxy.String_(Proxy.Object) +} + +// --------------- proxy for flag.Value --------------- +type Value_flag struct { + Object interface{} + Set_ func(interface{}, string) error + String_ func(interface{}) string +} +func (Proxy *Value_flag) Set(unnamed0 string) error { + return Proxy.Set_(Proxy.Object, unnamed0) +} +func (Proxy *Value_flag) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/fmt.go b/vendor/github.com/cosmos72/gomacro/imports/fmt.go new file mode 100644 index 0000000..21a360d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/fmt.go @@ -0,0 +1,136 @@ +// this file was generated by gomacro command: import _b "fmt" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "fmt" +) + +// reflection: allow interpreted code to import "fmt" +func init() { + Packages["fmt"] = Package{ + Binds: map[string]Value{ + "Errorf": ValueOf(fmt.Errorf), + "Fprint": ValueOf(fmt.Fprint), + "Fprintf": ValueOf(fmt.Fprintf), + "Fprintln": ValueOf(fmt.Fprintln), + "Fscan": ValueOf(fmt.Fscan), + "Fscanf": ValueOf(fmt.Fscanf), + "Fscanln": ValueOf(fmt.Fscanln), + "Print": ValueOf(fmt.Print), + "Printf": ValueOf(fmt.Printf), + "Println": ValueOf(fmt.Println), + "Scan": ValueOf(fmt.Scan), + "Scanf": ValueOf(fmt.Scanf), + "Scanln": ValueOf(fmt.Scanln), + "Sprint": ValueOf(fmt.Sprint), + "Sprintf": ValueOf(fmt.Sprintf), + "Sprintln": ValueOf(fmt.Sprintln), + "Sscan": ValueOf(fmt.Sscan), + "Sscanf": ValueOf(fmt.Sscanf), + "Sscanln": ValueOf(fmt.Sscanln), + },Types: map[string]Type{ + "Formatter": TypeOf((*fmt.Formatter)(nil)).Elem(), + "GoStringer": TypeOf((*fmt.GoStringer)(nil)).Elem(), + "ScanState": TypeOf((*fmt.ScanState)(nil)).Elem(), + "Scanner": TypeOf((*fmt.Scanner)(nil)).Elem(), + "State": TypeOf((*fmt.State)(nil)).Elem(), + "Stringer": TypeOf((*fmt.Stringer)(nil)).Elem(), + },Proxies: map[string]Type{ + "Formatter": TypeOf((*Formatter_fmt)(nil)).Elem(), + "GoStringer": TypeOf((*GoStringer_fmt)(nil)).Elem(), + "ScanState": TypeOf((*ScanState_fmt)(nil)).Elem(), + "Scanner": TypeOf((*Scanner_fmt)(nil)).Elem(), + "State": TypeOf((*State_fmt)(nil)).Elem(), + "Stringer": TypeOf((*Stringer_fmt)(nil)).Elem(), + }, + } +} + +// --------------- proxy for fmt.Formatter --------------- +type Formatter_fmt struct { + Object interface{} + Format_ func(_proxy_obj_ interface{}, f fmt.State, c rune) +} +func (Proxy *Formatter_fmt) Format(f fmt.State, c rune) { + Proxy.Format_(Proxy.Object, f, c) +} + +// --------------- proxy for fmt.GoStringer --------------- +type GoStringer_fmt struct { + Object interface{} + GoString_ func(interface{}) string +} +func (Proxy *GoStringer_fmt) GoString() string { + return Proxy.GoString_(Proxy.Object) +} + +// --------------- proxy for fmt.ScanState --------------- +type ScanState_fmt struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, buf []byte) (n int, err error) + ReadRune_ func(interface{}) (r rune, size int, err error) + SkipSpace_ func(interface{}) + Token_ func(_proxy_obj_ interface{}, skipSpace bool, f func(rune) bool) (token []byte, err error) + UnreadRune_ func(interface{}) error + Width_ func(interface{}) (wid int, ok bool) +} +func (Proxy *ScanState_fmt) Read(buf []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, buf) +} +func (Proxy *ScanState_fmt) ReadRune() (r rune, size int, err error) { + return Proxy.ReadRune_(Proxy.Object) +} +func (Proxy *ScanState_fmt) SkipSpace() { + Proxy.SkipSpace_(Proxy.Object) +} +func (Proxy *ScanState_fmt) Token(skipSpace bool, f func(rune) bool) (token []byte, err error) { + return Proxy.Token_(Proxy.Object, skipSpace, f) +} +func (Proxy *ScanState_fmt) UnreadRune() error { + return Proxy.UnreadRune_(Proxy.Object) +} +func (Proxy *ScanState_fmt) Width() (wid int, ok bool) { + return Proxy.Width_(Proxy.Object) +} + +// --------------- proxy for fmt.Scanner --------------- +type Scanner_fmt struct { + Object interface{} + Scan_ func(_proxy_obj_ interface{}, state fmt.ScanState, verb rune) error +} +func (Proxy *Scanner_fmt) Scan(state fmt.ScanState, verb rune) error { + return Proxy.Scan_(Proxy.Object, state, verb) +} + +// --------------- proxy for fmt.State --------------- +type State_fmt struct { + Object interface{} + Flag_ func(_proxy_obj_ interface{}, c int) bool + Precision_ func(interface{}) (prec int, ok bool) + Width_ func(interface{}) (wid int, ok bool) + Write_ func(_proxy_obj_ interface{}, b []byte) (n int, err error) +} +func (Proxy *State_fmt) Flag(c int) bool { + return Proxy.Flag_(Proxy.Object, c) +} +func (Proxy *State_fmt) Precision() (prec int, ok bool) { + return Proxy.Precision_(Proxy.Object) +} +func (Proxy *State_fmt) Width() (wid int, ok bool) { + return Proxy.Width_(Proxy.Object) +} +func (Proxy *State_fmt) Write(b []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, b) +} + +// --------------- proxy for fmt.Stringer --------------- +type Stringer_fmt struct { + Object interface{} + String_ func(interface{}) string +} +func (Proxy *Stringer_fmt) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_ast.go b/vendor/github.com/cosmos72/gomacro/imports/go_ast.go new file mode 100644 index 0000000..73efd04 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_ast.go @@ -0,0 +1,144 @@ +// this file was generated by gomacro command: import _b "go/ast" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/ast" + "go/token" +) + +// reflection: allow interpreted code to import "go/ast" +func init() { + Packages["go/ast"] = Package{ + Binds: map[string]Value{ + "Bad": ValueOf(ast.Bad), + "Con": ValueOf(ast.Con), + "FileExports": ValueOf(ast.FileExports), + "FilterDecl": ValueOf(ast.FilterDecl), + "FilterFile": ValueOf(ast.FilterFile), + "FilterFuncDuplicates": ValueOf(ast.FilterFuncDuplicates), + "FilterImportDuplicates": ValueOf(ast.FilterImportDuplicates), + "FilterPackage": ValueOf(ast.FilterPackage), + "FilterUnassociatedComments": ValueOf(ast.FilterUnassociatedComments), + "Fprint": ValueOf(ast.Fprint), + "Fun": ValueOf(ast.Fun), + "Inspect": ValueOf(ast.Inspect), + "IsExported": ValueOf(ast.IsExported), + "Lbl": ValueOf(ast.Lbl), + "MergePackageFiles": ValueOf(ast.MergePackageFiles), + "NewCommentMap": ValueOf(ast.NewCommentMap), + "NewIdent": ValueOf(ast.NewIdent), + "NewObj": ValueOf(ast.NewObj), + "NewPackage": ValueOf(ast.NewPackage), + "NewScope": ValueOf(ast.NewScope), + "NotNilFilter": ValueOf(ast.NotNilFilter), + "PackageExports": ValueOf(ast.PackageExports), + "Pkg": ValueOf(ast.Pkg), + "Print": ValueOf(ast.Print), + "RECV": ValueOf(ast.RECV), + "SEND": ValueOf(ast.SEND), + "SortImports": ValueOf(ast.SortImports), + "Typ": ValueOf(ast.Typ), + "Var": ValueOf(ast.Var), + "Walk": ValueOf(ast.Walk), + },Types: map[string]Type{ + "ArrayType": TypeOf((*ast.ArrayType)(nil)).Elem(), + "AssignStmt": TypeOf((*ast.AssignStmt)(nil)).Elem(), + "BadDecl": TypeOf((*ast.BadDecl)(nil)).Elem(), + "BadExpr": TypeOf((*ast.BadExpr)(nil)).Elem(), + "BadStmt": TypeOf((*ast.BadStmt)(nil)).Elem(), + "BasicLit": TypeOf((*ast.BasicLit)(nil)).Elem(), + "BinaryExpr": TypeOf((*ast.BinaryExpr)(nil)).Elem(), + "BlockStmt": TypeOf((*ast.BlockStmt)(nil)).Elem(), + "BranchStmt": TypeOf((*ast.BranchStmt)(nil)).Elem(), + "CallExpr": TypeOf((*ast.CallExpr)(nil)).Elem(), + "CaseClause": TypeOf((*ast.CaseClause)(nil)).Elem(), + "ChanDir": TypeOf((*ast.ChanDir)(nil)).Elem(), + "ChanType": TypeOf((*ast.ChanType)(nil)).Elem(), + "CommClause": TypeOf((*ast.CommClause)(nil)).Elem(), + "Comment": TypeOf((*ast.Comment)(nil)).Elem(), + "CommentGroup": TypeOf((*ast.CommentGroup)(nil)).Elem(), + "CommentMap": TypeOf((*ast.CommentMap)(nil)).Elem(), + "CompositeLit": TypeOf((*ast.CompositeLit)(nil)).Elem(), + "Decl": TypeOf((*ast.Decl)(nil)).Elem(), + "DeclStmt": TypeOf((*ast.DeclStmt)(nil)).Elem(), + "DeferStmt": TypeOf((*ast.DeferStmt)(nil)).Elem(), + "Ellipsis": TypeOf((*ast.Ellipsis)(nil)).Elem(), + "EmptyStmt": TypeOf((*ast.EmptyStmt)(nil)).Elem(), + "Expr": TypeOf((*ast.Expr)(nil)).Elem(), + "ExprStmt": TypeOf((*ast.ExprStmt)(nil)).Elem(), + "Field": TypeOf((*ast.Field)(nil)).Elem(), + "FieldFilter": TypeOf((*ast.FieldFilter)(nil)).Elem(), + "FieldList": TypeOf((*ast.FieldList)(nil)).Elem(), + "File": TypeOf((*ast.File)(nil)).Elem(), + "Filter": TypeOf((*ast.Filter)(nil)).Elem(), + "ForStmt": TypeOf((*ast.ForStmt)(nil)).Elem(), + "FuncDecl": TypeOf((*ast.FuncDecl)(nil)).Elem(), + "FuncLit": TypeOf((*ast.FuncLit)(nil)).Elem(), + "FuncType": TypeOf((*ast.FuncType)(nil)).Elem(), + "GenDecl": TypeOf((*ast.GenDecl)(nil)).Elem(), + "GoStmt": TypeOf((*ast.GoStmt)(nil)).Elem(), + "Ident": TypeOf((*ast.Ident)(nil)).Elem(), + "IfStmt": TypeOf((*ast.IfStmt)(nil)).Elem(), + "ImportSpec": TypeOf((*ast.ImportSpec)(nil)).Elem(), + "Importer": TypeOf((*ast.Importer)(nil)).Elem(), + "IncDecStmt": TypeOf((*ast.IncDecStmt)(nil)).Elem(), + "IndexExpr": TypeOf((*ast.IndexExpr)(nil)).Elem(), + "InterfaceType": TypeOf((*ast.InterfaceType)(nil)).Elem(), + "KeyValueExpr": TypeOf((*ast.KeyValueExpr)(nil)).Elem(), + "LabeledStmt": TypeOf((*ast.LabeledStmt)(nil)).Elem(), + "MapType": TypeOf((*ast.MapType)(nil)).Elem(), + "MergeMode": TypeOf((*ast.MergeMode)(nil)).Elem(), + "Node": TypeOf((*ast.Node)(nil)).Elem(), + "ObjKind": TypeOf((*ast.ObjKind)(nil)).Elem(), + "Object": TypeOf((*ast.Object)(nil)).Elem(), + "Package": TypeOf((*ast.Package)(nil)).Elem(), + "ParenExpr": TypeOf((*ast.ParenExpr)(nil)).Elem(), + "RangeStmt": TypeOf((*ast.RangeStmt)(nil)).Elem(), + "ReturnStmt": TypeOf((*ast.ReturnStmt)(nil)).Elem(), + "Scope": TypeOf((*ast.Scope)(nil)).Elem(), + "SelectStmt": TypeOf((*ast.SelectStmt)(nil)).Elem(), + "SelectorExpr": TypeOf((*ast.SelectorExpr)(nil)).Elem(), + "SendStmt": TypeOf((*ast.SendStmt)(nil)).Elem(), + "SliceExpr": TypeOf((*ast.SliceExpr)(nil)).Elem(), + "Spec": TypeOf((*ast.Spec)(nil)).Elem(), + "StarExpr": TypeOf((*ast.StarExpr)(nil)).Elem(), + "Stmt": TypeOf((*ast.Stmt)(nil)).Elem(), + "StructType": TypeOf((*ast.StructType)(nil)).Elem(), + "SwitchStmt": TypeOf((*ast.SwitchStmt)(nil)).Elem(), + "TypeAssertExpr": TypeOf((*ast.TypeAssertExpr)(nil)).Elem(), + "TypeSpec": TypeOf((*ast.TypeSpec)(nil)).Elem(), + "TypeSwitchStmt": TypeOf((*ast.TypeSwitchStmt)(nil)).Elem(), + "UnaryExpr": TypeOf((*ast.UnaryExpr)(nil)).Elem(), + "ValueSpec": TypeOf((*ast.ValueSpec)(nil)).Elem(), + "Visitor": TypeOf((*ast.Visitor)(nil)).Elem(), + },Proxies: map[string]Type{ + "Node": TypeOf((*Node_go_ast)(nil)).Elem(), + "Visitor": TypeOf((*Visitor_go_ast)(nil)).Elem(), + }, + } +} + +// --------------- proxy for go/ast.Node --------------- +type Node_go_ast struct { + Object interface{} + End_ func(interface{}) token.Pos + Pos_ func(interface{}) token.Pos +} +func (Proxy *Node_go_ast) End() token.Pos { + return Proxy.End_(Proxy.Object) +} +func (Proxy *Node_go_ast) Pos() token.Pos { + return Proxy.Pos_(Proxy.Object) +} + +// --------------- proxy for go/ast.Visitor --------------- +type Visitor_go_ast struct { + Object interface{} + Visit_ func(_proxy_obj_ interface{}, node ast.Node) (w ast.Visitor) +} +func (Proxy *Visitor_go_ast) Visit(node ast.Node) (w ast.Visitor) { + return Proxy.Visit_(Proxy.Object, node) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_build.go b/vendor/github.com/cosmos72/gomacro/imports/go_build.go new file mode 100644 index 0000000..031be9c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_build.go @@ -0,0 +1,33 @@ +// this file was generated by gomacro command: import _b "go/build" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/build" +) + +// reflection: allow interpreted code to import "go/build" +func init() { + Packages["go/build"] = Package{ + Binds: map[string]Value{ + "AllowBinary": ValueOf(build.AllowBinary), + "ArchChar": ValueOf(build.ArchChar), + "Default": ValueOf(&build.Default).Elem(), + "FindOnly": ValueOf(build.FindOnly), + "IgnoreVendor": ValueOf(build.IgnoreVendor), + "Import": ValueOf(build.Import), + "ImportComment": ValueOf(build.ImportComment), + "ImportDir": ValueOf(build.ImportDir), + "IsLocalImport": ValueOf(build.IsLocalImport), + "ToolDir": ValueOf(&build.ToolDir).Elem(), + },Types: map[string]Type{ + "Context": TypeOf((*build.Context)(nil)).Elem(), + "ImportMode": TypeOf((*build.ImportMode)(nil)).Elem(), + "MultiplePackageError": TypeOf((*build.MultiplePackageError)(nil)).Elem(), + "NoGoError": TypeOf((*build.NoGoError)(nil)).Elem(), + "Package": TypeOf((*build.Package)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_constant.go b/vendor/github.com/cosmos72/gomacro/imports/go_constant.go new file mode 100644 index 0000000..f2bf9a6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_constant.go @@ -0,0 +1,55 @@ +// this file was generated by gomacro command: import _b "go/constant" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/constant" +) + +// reflection: allow interpreted code to import "go/constant" +func init() { + Packages["go/constant"] = Package{ + Binds: map[string]Value{ + "BinaryOp": ValueOf(constant.BinaryOp), + "BitLen": ValueOf(constant.BitLen), + "Bool": ValueOf(constant.Bool), + "BoolVal": ValueOf(constant.BoolVal), + "Bytes": ValueOf(constant.Bytes), + "Compare": ValueOf(constant.Compare), + "Complex": ValueOf(constant.Complex), + "Denom": ValueOf(constant.Denom), + "Float": ValueOf(constant.Float), + "Float32Val": ValueOf(constant.Float32Val), + "Float64Val": ValueOf(constant.Float64Val), + "Imag": ValueOf(constant.Imag), + "Int": ValueOf(constant.Int), + "Int64Val": ValueOf(constant.Int64Val), + "MakeBool": ValueOf(constant.MakeBool), + "MakeFloat64": ValueOf(constant.MakeFloat64), + "MakeFromBytes": ValueOf(constant.MakeFromBytes), + "MakeFromLiteral": ValueOf(constant.MakeFromLiteral), + "MakeImag": ValueOf(constant.MakeImag), + "MakeInt64": ValueOf(constant.MakeInt64), + "MakeString": ValueOf(constant.MakeString), + "MakeUint64": ValueOf(constant.MakeUint64), + "MakeUnknown": ValueOf(constant.MakeUnknown), + "Num": ValueOf(constant.Num), + "Real": ValueOf(constant.Real), + "Shift": ValueOf(constant.Shift), + "Sign": ValueOf(constant.Sign), + "String": ValueOf(constant.String), + "StringVal": ValueOf(constant.StringVal), + "ToComplex": ValueOf(constant.ToComplex), + "ToFloat": ValueOf(constant.ToFloat), + "ToInt": ValueOf(constant.ToInt), + "Uint64Val": ValueOf(constant.Uint64Val), + "UnaryOp": ValueOf(constant.UnaryOp), + "Unknown": ValueOf(constant.Unknown), + },Types: map[string]Type{ + "Kind": TypeOf((*constant.Kind)(nil)).Elem(), + "Value": TypeOf((*constant.Value)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_doc.go b/vendor/github.com/cosmos72/gomacro/imports/go_doc.go new file mode 100644 index 0000000..6536109 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_doc.go @@ -0,0 +1,35 @@ +// this file was generated by gomacro command: import _b "go/doc" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/doc" +) + +// reflection: allow interpreted code to import "go/doc" +func init() { + Packages["go/doc"] = Package{ + Binds: map[string]Value{ + "AllDecls": ValueOf(doc.AllDecls), + "AllMethods": ValueOf(doc.AllMethods), + "Examples": ValueOf(doc.Examples), + "IllegalPrefixes": ValueOf(&doc.IllegalPrefixes).Elem(), + "IsPredeclared": ValueOf(doc.IsPredeclared), + "New": ValueOf(doc.New), + "Synopsis": ValueOf(doc.Synopsis), + "ToHTML": ValueOf(doc.ToHTML), + "ToText": ValueOf(doc.ToText), + },Types: map[string]Type{ + "Example": TypeOf((*doc.Example)(nil)).Elem(), + "Filter": TypeOf((*doc.Filter)(nil)).Elem(), + "Func": TypeOf((*doc.Func)(nil)).Elem(), + "Mode": TypeOf((*doc.Mode)(nil)).Elem(), + "Note": TypeOf((*doc.Note)(nil)).Elem(), + "Package": TypeOf((*doc.Package)(nil)).Elem(), + "Type": TypeOf((*doc.Type)(nil)).Elem(), + "Value": TypeOf((*doc.Value)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_format.go b/vendor/github.com/cosmos72/gomacro/imports/go_format.go new file mode 100644 index 0000000..ca49068 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_format.go @@ -0,0 +1,19 @@ +// this file was generated by gomacro command: import _b "go/format" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/format" +) + +// reflection: allow interpreted code to import "go/format" +func init() { + Packages["go/format"] = Package{ + Binds: map[string]Value{ + "Node": ValueOf(format.Node), + "Source": ValueOf(format.Source), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_importer.go b/vendor/github.com/cosmos72/gomacro/imports/go_importer.go new file mode 100644 index 0000000..58b7d16 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_importer.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "go/importer" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/importer" +) + +// reflection: allow interpreted code to import "go/importer" +func init() { + Packages["go/importer"] = Package{ + Binds: map[string]Value{ + "Default": ValueOf(importer.Default), + "For": ValueOf(importer.For), + },Types: map[string]Type{ + "Lookup": TypeOf((*importer.Lookup)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_parser.go b/vendor/github.com/cosmos72/gomacro/imports/go_parser.go new file mode 100644 index 0000000..5dcd9ef --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_parser.go @@ -0,0 +1,30 @@ +// this file was generated by gomacro command: import _b "go/parser" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/parser" +) + +// reflection: allow interpreted code to import "go/parser" +func init() { + Packages["go/parser"] = Package{ + Binds: map[string]Value{ + "AllErrors": ValueOf(parser.AllErrors), + "DeclarationErrors": ValueOf(parser.DeclarationErrors), + "ImportsOnly": ValueOf(parser.ImportsOnly), + "PackageClauseOnly": ValueOf(parser.PackageClauseOnly), + "ParseComments": ValueOf(parser.ParseComments), + "ParseDir": ValueOf(parser.ParseDir), + "ParseExpr": ValueOf(parser.ParseExpr), + "ParseExprFrom": ValueOf(parser.ParseExprFrom), + "ParseFile": ValueOf(parser.ParseFile), + "SpuriousErrors": ValueOf(parser.SpuriousErrors), + "Trace": ValueOf(parser.Trace), + },Types: map[string]Type{ + "Mode": TypeOf((*parser.Mode)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_printer.go b/vendor/github.com/cosmos72/gomacro/imports/go_printer.go new file mode 100644 index 0000000..514ee41 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_printer.go @@ -0,0 +1,26 @@ +// this file was generated by gomacro command: import _b "go/printer" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/printer" +) + +// reflection: allow interpreted code to import "go/printer" +func init() { + Packages["go/printer"] = Package{ + Binds: map[string]Value{ + "Fprint": ValueOf(printer.Fprint), + "RawFormat": ValueOf(printer.RawFormat), + "SourcePos": ValueOf(printer.SourcePos), + "TabIndent": ValueOf(printer.TabIndent), + "UseSpaces": ValueOf(printer.UseSpaces), + },Types: map[string]Type{ + "CommentedNode": TypeOf((*printer.CommentedNode)(nil)).Elem(), + "Config": TypeOf((*printer.Config)(nil)).Elem(), + "Mode": TypeOf((*printer.Mode)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_scanner.go b/vendor/github.com/cosmos72/gomacro/imports/go_scanner.go new file mode 100644 index 0000000..102085a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_scanner.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "go/scanner" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/scanner" +) + +// reflection: allow interpreted code to import "go/scanner" +func init() { + Packages["go/scanner"] = Package{ + Binds: map[string]Value{ + "PrintError": ValueOf(scanner.PrintError), + "ScanComments": ValueOf(scanner.ScanComments), + },Types: map[string]Type{ + "Error": TypeOf((*scanner.Error)(nil)).Elem(), + "ErrorHandler": TypeOf((*scanner.ErrorHandler)(nil)).Elem(), + "ErrorList": TypeOf((*scanner.ErrorList)(nil)).Elem(), + "Mode": TypeOf((*scanner.Mode)(nil)).Elem(), + "Scanner": TypeOf((*scanner.Scanner)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_token.go b/vendor/github.com/cosmos72/gomacro/imports/go_token.go new file mode 100644 index 0000000..b91e4d7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_token.go @@ -0,0 +1,114 @@ +// this file was generated by gomacro command: import _b "go/token" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/token" +) + +// reflection: allow interpreted code to import "go/token" +func init() { + Packages["go/token"] = Package{ + Binds: map[string]Value{ + "ADD": ValueOf(token.ADD), + "ADD_ASSIGN": ValueOf(token.ADD_ASSIGN), + "AND": ValueOf(token.AND), + "AND_ASSIGN": ValueOf(token.AND_ASSIGN), + "AND_NOT": ValueOf(token.AND_NOT), + "AND_NOT_ASSIGN": ValueOf(token.AND_NOT_ASSIGN), + "ARROW": ValueOf(token.ARROW), + "ASSIGN": ValueOf(token.ASSIGN), + "BREAK": ValueOf(token.BREAK), + "CASE": ValueOf(token.CASE), + "CHAN": ValueOf(token.CHAN), + "CHAR": ValueOf(token.CHAR), + "COLON": ValueOf(token.COLON), + "COMMA": ValueOf(token.COMMA), + "COMMENT": ValueOf(token.COMMENT), + "CONST": ValueOf(token.CONST), + "CONTINUE": ValueOf(token.CONTINUE), + "DEC": ValueOf(token.DEC), + "DEFAULT": ValueOf(token.DEFAULT), + "DEFER": ValueOf(token.DEFER), + "DEFINE": ValueOf(token.DEFINE), + "ELLIPSIS": ValueOf(token.ELLIPSIS), + "ELSE": ValueOf(token.ELSE), + "EOF": ValueOf(token.EOF), + "EQL": ValueOf(token.EQL), + "FALLTHROUGH": ValueOf(token.FALLTHROUGH), + "FLOAT": ValueOf(token.FLOAT), + "FOR": ValueOf(token.FOR), + "FUNC": ValueOf(token.FUNC), + "GEQ": ValueOf(token.GEQ), + "GO": ValueOf(token.GO), + "GOTO": ValueOf(token.GOTO), + "GTR": ValueOf(token.GTR), + "HighestPrec": ValueOf(token.HighestPrec), + "IDENT": ValueOf(token.IDENT), + "IF": ValueOf(token.IF), + "ILLEGAL": ValueOf(token.ILLEGAL), + "IMAG": ValueOf(token.IMAG), + "IMPORT": ValueOf(token.IMPORT), + "INC": ValueOf(token.INC), + "INT": ValueOf(token.INT), + "INTERFACE": ValueOf(token.INTERFACE), + "LAND": ValueOf(token.LAND), + "LBRACE": ValueOf(token.LBRACE), + "LBRACK": ValueOf(token.LBRACK), + "LEQ": ValueOf(token.LEQ), + "LOR": ValueOf(token.LOR), + "LPAREN": ValueOf(token.LPAREN), + "LSS": ValueOf(token.LSS), + "Lookup": ValueOf(token.Lookup), + "LowestPrec": ValueOf(token.LowestPrec), + "MAP": ValueOf(token.MAP), + "MUL": ValueOf(token.MUL), + "MUL_ASSIGN": ValueOf(token.MUL_ASSIGN), + "NEQ": ValueOf(token.NEQ), + "NOT": ValueOf(token.NOT), + "NewFileSet": ValueOf(token.NewFileSet), + "NoPos": ValueOf(token.NoPos), + "OR": ValueOf(token.OR), + "OR_ASSIGN": ValueOf(token.OR_ASSIGN), + "PACKAGE": ValueOf(token.PACKAGE), + "PERIOD": ValueOf(token.PERIOD), + "QUO": ValueOf(token.QUO), + "QUO_ASSIGN": ValueOf(token.QUO_ASSIGN), + "RANGE": ValueOf(token.RANGE), + "RBRACE": ValueOf(token.RBRACE), + "RBRACK": ValueOf(token.RBRACK), + "REM": ValueOf(token.REM), + "REM_ASSIGN": ValueOf(token.REM_ASSIGN), + "RETURN": ValueOf(token.RETURN), + "RPAREN": ValueOf(token.RPAREN), + "SELECT": ValueOf(token.SELECT), + "SEMICOLON": ValueOf(token.SEMICOLON), + "SHL": ValueOf(token.SHL), + "SHL_ASSIGN": ValueOf(token.SHL_ASSIGN), + "SHR": ValueOf(token.SHR), + "SHR_ASSIGN": ValueOf(token.SHR_ASSIGN), + "STRING": ValueOf(token.STRING), + "STRUCT": ValueOf(token.STRUCT), + "SUB": ValueOf(token.SUB), + "SUB_ASSIGN": ValueOf(token.SUB_ASSIGN), + "SWITCH": ValueOf(token.SWITCH), + "TYPE": ValueOf(token.TYPE), + "UnaryPrec": ValueOf(token.UnaryPrec), + "VAR": ValueOf(token.VAR), + "XOR": ValueOf(token.XOR), + "XOR_ASSIGN": ValueOf(token.XOR_ASSIGN), + },Types: map[string]Type{ + "File": TypeOf((*token.File)(nil)).Elem(), + "FileSet": TypeOf((*token.FileSet)(nil)).Elem(), + "Pos": TypeOf((*token.Pos)(nil)).Elem(), + "Position": TypeOf((*token.Position)(nil)).Elem(), + "Token": TypeOf((*token.Token)(nil)).Elem(), + },Untypeds: map[string]string{ + "HighestPrec": "int:7", + "LowestPrec": "int:0", + "UnaryPrec": "int:6", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/go_types.go b/vendor/github.com/cosmos72/gomacro/imports/go_types.go new file mode 100644 index 0000000..f5c9e8b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/go_types.go @@ -0,0 +1,217 @@ +// this file was generated by gomacro command: import _b "go/types" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "go/types" +) + +// reflection: allow interpreted code to import "go/types" +func init() { + Packages["go/types"] = Package{ + Binds: map[string]Value{ + "AssertableTo": ValueOf(types.AssertableTo), + "AssignableTo": ValueOf(types.AssignableTo), + "Bool": ValueOf(types.Bool), + "Byte": ValueOf(types.Byte), + "Comparable": ValueOf(types.Comparable), + "Complex128": ValueOf(types.Complex128), + "Complex64": ValueOf(types.Complex64), + "ConvertibleTo": ValueOf(types.ConvertibleTo), + "DefPredeclaredTestFuncs": ValueOf(types.DefPredeclaredTestFuncs), + "Default": ValueOf(types.Default), + "Eval": ValueOf(types.Eval), + "ExprString": ValueOf(types.ExprString), + "FieldVal": ValueOf(types.FieldVal), + "Float32": ValueOf(types.Float32), + "Float64": ValueOf(types.Float64), + "Id": ValueOf(types.Id), + "Identical": ValueOf(types.Identical), + "IdenticalIgnoreTags": ValueOf(types.IdenticalIgnoreTags), + "Implements": ValueOf(types.Implements), + "Int": ValueOf(types.Int), + "Int16": ValueOf(types.Int16), + "Int32": ValueOf(types.Int32), + "Int64": ValueOf(types.Int64), + "Int8": ValueOf(types.Int8), + "Invalid": ValueOf(types.Invalid), + "IsBoolean": ValueOf(types.IsBoolean), + "IsComplex": ValueOf(types.IsComplex), + "IsConstType": ValueOf(types.IsConstType), + "IsFloat": ValueOf(types.IsFloat), + "IsInteger": ValueOf(types.IsInteger), + "IsInterface": ValueOf(types.IsInterface), + "IsNumeric": ValueOf(types.IsNumeric), + "IsOrdered": ValueOf(types.IsOrdered), + "IsString": ValueOf(types.IsString), + "IsUnsigned": ValueOf(types.IsUnsigned), + "IsUntyped": ValueOf(types.IsUntyped), + "LookupFieldOrMethod": ValueOf(types.LookupFieldOrMethod), + "MethodExpr": ValueOf(types.MethodExpr), + "MethodVal": ValueOf(types.MethodVal), + "MissingMethod": ValueOf(types.MissingMethod), + "NewArray": ValueOf(types.NewArray), + "NewChan": ValueOf(types.NewChan), + "NewChecker": ValueOf(types.NewChecker), + "NewConst": ValueOf(types.NewConst), + "NewField": ValueOf(types.NewField), + "NewFunc": ValueOf(types.NewFunc), + "NewInterface": ValueOf(types.NewInterface), + "NewLabel": ValueOf(types.NewLabel), + "NewMap": ValueOf(types.NewMap), + "NewMethodSet": ValueOf(types.NewMethodSet), + "NewNamed": ValueOf(types.NewNamed), + "NewPackage": ValueOf(types.NewPackage), + "NewParam": ValueOf(types.NewParam), + "NewPkgName": ValueOf(types.NewPkgName), + "NewPointer": ValueOf(types.NewPointer), + "NewScope": ValueOf(types.NewScope), + "NewSignature": ValueOf(types.NewSignature), + "NewSlice": ValueOf(types.NewSlice), + "NewStruct": ValueOf(types.NewStruct), + "NewTuple": ValueOf(types.NewTuple), + "NewTypeName": ValueOf(types.NewTypeName), + "NewVar": ValueOf(types.NewVar), + "ObjectString": ValueOf(types.ObjectString), + "RecvOnly": ValueOf(types.RecvOnly), + "RelativeTo": ValueOf(types.RelativeTo), + "Rune": ValueOf(types.Rune), + "SelectionString": ValueOf(types.SelectionString), + "SendOnly": ValueOf(types.SendOnly), + "SendRecv": ValueOf(types.SendRecv), + "String": ValueOf(types.String), + "Typ": ValueOf(&types.Typ).Elem(), + "TypeString": ValueOf(types.TypeString), + "Uint": ValueOf(types.Uint), + "Uint16": ValueOf(types.Uint16), + "Uint32": ValueOf(types.Uint32), + "Uint64": ValueOf(types.Uint64), + "Uint8": ValueOf(types.Uint8), + "Uintptr": ValueOf(types.Uintptr), + "Universe": ValueOf(&types.Universe).Elem(), + "Unsafe": ValueOf(&types.Unsafe).Elem(), + "UnsafePointer": ValueOf(types.UnsafePointer), + "UntypedBool": ValueOf(types.UntypedBool), + "UntypedComplex": ValueOf(types.UntypedComplex), + "UntypedFloat": ValueOf(types.UntypedFloat), + "UntypedInt": ValueOf(types.UntypedInt), + "UntypedNil": ValueOf(types.UntypedNil), + "UntypedRune": ValueOf(types.UntypedRune), + "UntypedString": ValueOf(types.UntypedString), + "WriteExpr": ValueOf(types.WriteExpr), + "WriteSignature": ValueOf(types.WriteSignature), + "WriteType": ValueOf(types.WriteType), + },Types: map[string]Type{ + "Array": TypeOf((*types.Array)(nil)).Elem(), + "Basic": TypeOf((*types.Basic)(nil)).Elem(), + "BasicInfo": TypeOf((*types.BasicInfo)(nil)).Elem(), + "BasicKind": TypeOf((*types.BasicKind)(nil)).Elem(), + "Builtin": TypeOf((*types.Builtin)(nil)).Elem(), + "Chan": TypeOf((*types.Chan)(nil)).Elem(), + "ChanDir": TypeOf((*types.ChanDir)(nil)).Elem(), + "Checker": TypeOf((*types.Checker)(nil)).Elem(), + "Config": TypeOf((*types.Config)(nil)).Elem(), + "Const": TypeOf((*types.Const)(nil)).Elem(), + "Error": TypeOf((*types.Error)(nil)).Elem(), + "Func": TypeOf((*types.Func)(nil)).Elem(), + "ImportMode": TypeOf((*types.ImportMode)(nil)).Elem(), + "Importer": TypeOf((*types.Importer)(nil)).Elem(), + "ImporterFrom": TypeOf((*types.ImporterFrom)(nil)).Elem(), + "Info": TypeOf((*types.Info)(nil)).Elem(), + "Initializer": TypeOf((*types.Initializer)(nil)).Elem(), + "Interface": TypeOf((*types.Interface)(nil)).Elem(), + "Label": TypeOf((*types.Label)(nil)).Elem(), + "Map": TypeOf((*types.Map)(nil)).Elem(), + "MethodSet": TypeOf((*types.MethodSet)(nil)).Elem(), + "Named": TypeOf((*types.Named)(nil)).Elem(), + "Nil": TypeOf((*types.Nil)(nil)).Elem(), + "Object": TypeOf((*types.Object)(nil)).Elem(), + "Package": TypeOf((*types.Package)(nil)).Elem(), + "PkgName": TypeOf((*types.PkgName)(nil)).Elem(), + "Pointer": TypeOf((*types.Pointer)(nil)).Elem(), + "Qualifier": TypeOf((*types.Qualifier)(nil)).Elem(), + "Scope": TypeOf((*types.Scope)(nil)).Elem(), + "Selection": TypeOf((*types.Selection)(nil)).Elem(), + "SelectionKind": TypeOf((*types.SelectionKind)(nil)).Elem(), + "Signature": TypeOf((*types.Signature)(nil)).Elem(), + "Sizes": TypeOf((*types.Sizes)(nil)).Elem(), + "Slice": TypeOf((*types.Slice)(nil)).Elem(), + "StdSizes": TypeOf((*types.StdSizes)(nil)).Elem(), + "Struct": TypeOf((*types.Struct)(nil)).Elem(), + "Tuple": TypeOf((*types.Tuple)(nil)).Elem(), + "Type": TypeOf((*types.Type)(nil)).Elem(), + "TypeAndValue": TypeOf((*types.TypeAndValue)(nil)).Elem(), + "TypeName": TypeOf((*types.TypeName)(nil)).Elem(), + "Var": TypeOf((*types.Var)(nil)).Elem(), + },Proxies: map[string]Type{ + "Importer": TypeOf((*Importer_go_types)(nil)).Elem(), + "ImporterFrom": TypeOf((*ImporterFrom_go_types)(nil)).Elem(), + "Sizes": TypeOf((*Sizes_go_types)(nil)).Elem(), + "Type": TypeOf((*Type_go_types)(nil)).Elem(), + },Wrappers: map[string][]string{ + "Builtin": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "Checker": []string{"ObjectOf","TypeOf",}, + "Const": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "Func": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "Label": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "Nil": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "PkgName": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "TypeName": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + "Var": []string{"Exported","Id","Name","Parent","Pkg","Pos","Type",}, + }, + } +} + +// --------------- proxy for go/types.Importer --------------- +type Importer_go_types struct { + Object interface{} + Import_ func(_proxy_obj_ interface{}, path string) (*types.Package, error) +} +func (Proxy *Importer_go_types) Import(path string) (*types.Package, error) { + return Proxy.Import_(Proxy.Object, path) +} + +// --------------- proxy for go/types.ImporterFrom --------------- +type ImporterFrom_go_types struct { + Object interface{} + Import_ func(_proxy_obj_ interface{}, path string) (*types.Package, error) + ImportFrom_ func(_proxy_obj_ interface{}, path string, srcDir string, mode types.ImportMode) (*types.Package, error) +} +func (Proxy *ImporterFrom_go_types) Import(path string) (*types.Package, error) { + return Proxy.Import_(Proxy.Object, path) +} +func (Proxy *ImporterFrom_go_types) ImportFrom(path string, srcDir string, mode types.ImportMode) (*types.Package, error) { + return Proxy.ImportFrom_(Proxy.Object, path, srcDir, mode) +} + +// --------------- proxy for go/types.Sizes --------------- +type Sizes_go_types struct { + Object interface{} + Alignof_ func(_proxy_obj_ interface{}, T types.Type) int64 + Offsetsof_ func(_proxy_obj_ interface{}, fields []*types.Var) []int64 + Sizeof_ func(_proxy_obj_ interface{}, T types.Type) int64 +} +func (Proxy *Sizes_go_types) Alignof(T types.Type) int64 { + return Proxy.Alignof_(Proxy.Object, T) +} +func (Proxy *Sizes_go_types) Offsetsof(fields []*types.Var) []int64 { + return Proxy.Offsetsof_(Proxy.Object, fields) +} +func (Proxy *Sizes_go_types) Sizeof(T types.Type) int64 { + return Proxy.Sizeof_(Proxy.Object, T) +} + +// --------------- proxy for go/types.Type --------------- +type Type_go_types struct { + Object interface{} + String_ func(interface{}) string + Underlying_ func(interface{}) types.Type +} +func (Proxy *Type_go_types) String() string { + return Proxy.String_(Proxy.Object) +} +func (Proxy *Type_go_types) Underlying() types.Type { + return Proxy.Underlying_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/hash.go b/vendor/github.com/cosmos72/gomacro/imports/hash.go new file mode 100644 index 0000000..12cde0b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/hash.go @@ -0,0 +1,107 @@ +// this file was generated by gomacro command: import _b "hash" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "hash" +) + +// reflection: allow interpreted code to import "hash" +func init() { + Packages["hash"] = Package{ + Types: map[string]Type{ + "Hash": TypeOf((*hash.Hash)(nil)).Elem(), + "Hash32": TypeOf((*hash.Hash32)(nil)).Elem(), + "Hash64": TypeOf((*hash.Hash64)(nil)).Elem(), + },Proxies: map[string]Type{ + "Hash": TypeOf((*Hash_hash)(nil)).Elem(), + "Hash32": TypeOf((*Hash32_hash)(nil)).Elem(), + "Hash64": TypeOf((*Hash64_hash)(nil)).Elem(), + }, + } +} + +// --------------- proxy for hash.Hash --------------- +type Hash_hash struct { + Object interface{} + BlockSize_ func(interface{}) int + Reset_ func(interface{}) + Size_ func(interface{}) int + Sum_ func(_proxy_obj_ interface{}, b []byte) []byte + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *Hash_hash) BlockSize() int { + return Proxy.BlockSize_(Proxy.Object) +} +func (Proxy *Hash_hash) Reset() { + Proxy.Reset_(Proxy.Object) +} +func (Proxy *Hash_hash) Size() int { + return Proxy.Size_(Proxy.Object) +} +func (Proxy *Hash_hash) Sum(b []byte) []byte { + return Proxy.Sum_(Proxy.Object, b) +} +func (Proxy *Hash_hash) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for hash.Hash32 --------------- +type Hash32_hash struct { + Object interface{} + BlockSize_ func(interface{}) int + Reset_ func(interface{}) + Size_ func(interface{}) int + Sum_ func(_proxy_obj_ interface{}, b []byte) []byte + Sum32_ func(interface{}) uint32 + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *Hash32_hash) BlockSize() int { + return Proxy.BlockSize_(Proxy.Object) +} +func (Proxy *Hash32_hash) Reset() { + Proxy.Reset_(Proxy.Object) +} +func (Proxy *Hash32_hash) Size() int { + return Proxy.Size_(Proxy.Object) +} +func (Proxy *Hash32_hash) Sum(b []byte) []byte { + return Proxy.Sum_(Proxy.Object, b) +} +func (Proxy *Hash32_hash) Sum32() uint32 { + return Proxy.Sum32_(Proxy.Object) +} +func (Proxy *Hash32_hash) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for hash.Hash64 --------------- +type Hash64_hash struct { + Object interface{} + BlockSize_ func(interface{}) int + Reset_ func(interface{}) + Size_ func(interface{}) int + Sum_ func(_proxy_obj_ interface{}, b []byte) []byte + Sum64_ func(interface{}) uint64 + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *Hash64_hash) BlockSize() int { + return Proxy.BlockSize_(Proxy.Object) +} +func (Proxy *Hash64_hash) Reset() { + Proxy.Reset_(Proxy.Object) +} +func (Proxy *Hash64_hash) Size() int { + return Proxy.Size_(Proxy.Object) +} +func (Proxy *Hash64_hash) Sum(b []byte) []byte { + return Proxy.Sum_(Proxy.Object, b) +} +func (Proxy *Hash64_hash) Sum64() uint64 { + return Proxy.Sum64_(Proxy.Object) +} +func (Proxy *Hash64_hash) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/hash_adler32.go b/vendor/github.com/cosmos72/gomacro/imports/hash_adler32.go new file mode 100644 index 0000000..fc615c1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/hash_adler32.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "hash/adler32" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "hash/adler32" +) + +// reflection: allow interpreted code to import "hash/adler32" +func init() { + Packages["hash/adler32"] = Package{ + Binds: map[string]Value{ + "Checksum": ValueOf(adler32.Checksum), + "New": ValueOf(adler32.New), + "Size": ValueOf(adler32.Size), + },Untypeds: map[string]string{ + "Size": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/hash_crc32.go b/vendor/github.com/cosmos72/gomacro/imports/hash_crc32.go new file mode 100644 index 0000000..c0e0daa --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/hash_crc32.go @@ -0,0 +1,35 @@ +// this file was generated by gomacro command: import _b "hash/crc32" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "hash/crc32" +) + +// reflection: allow interpreted code to import "hash/crc32" +func init() { + Packages["hash/crc32"] = Package{ + Binds: map[string]Value{ + "Castagnoli": ValueOf(uint32(crc32.Castagnoli)), + "Checksum": ValueOf(crc32.Checksum), + "ChecksumIEEE": ValueOf(crc32.ChecksumIEEE), + "IEEE": ValueOf(uint32(crc32.IEEE)), + "IEEETable": ValueOf(&crc32.IEEETable).Elem(), + "Koopman": ValueOf(uint32(crc32.Koopman)), + "MakeTable": ValueOf(crc32.MakeTable), + "New": ValueOf(crc32.New), + "NewIEEE": ValueOf(crc32.NewIEEE), + "Size": ValueOf(crc32.Size), + "Update": ValueOf(crc32.Update), + },Types: map[string]Type{ + "Table": TypeOf((*crc32.Table)(nil)).Elem(), + },Untypeds: map[string]string{ + "Castagnoli": "int:2197175160", + "IEEE": "int:3988292384", + "Koopman": "int:3945912366", + "Size": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/hash_crc64.go b/vendor/github.com/cosmos72/gomacro/imports/hash_crc64.go new file mode 100644 index 0000000..84ef28f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/hash_crc64.go @@ -0,0 +1,30 @@ +// this file was generated by gomacro command: import _b "hash/crc64" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "hash/crc64" +) + +// reflection: allow interpreted code to import "hash/crc64" +func init() { + Packages["hash/crc64"] = Package{ + Binds: map[string]Value{ + "Checksum": ValueOf(crc64.Checksum), + "ECMA": ValueOf(uint64(crc64.ECMA)), + "ISO": ValueOf(uint64(crc64.ISO)), + "MakeTable": ValueOf(crc64.MakeTable), + "New": ValueOf(crc64.New), + "Size": ValueOf(crc64.Size), + "Update": ValueOf(crc64.Update), + },Types: map[string]Type{ + "Table": TypeOf((*crc64.Table)(nil)).Elem(), + },Untypeds: map[string]string{ + "ECMA": "int:14514072000185962306", + "ISO": "int:15564440312192434176", + "Size": "int:8", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/hash_fnv.go b/vendor/github.com/cosmos72/gomacro/imports/hash_fnv.go new file mode 100644 index 0000000..198f0cc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/hash_fnv.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "hash/fnv" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "hash/fnv" +) + +// reflection: allow interpreted code to import "hash/fnv" +func init() { + Packages["hash/fnv"] = Package{ + Binds: map[string]Value{ + "New32": ValueOf(fnv.New32), + "New32a": ValueOf(fnv.New32a), + "New64": ValueOf(fnv.New64), + "New64a": ValueOf(fnv.New64a), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/html.go b/vendor/github.com/cosmos72/gomacro/imports/html.go new file mode 100644 index 0000000..8806c48 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/html.go @@ -0,0 +1,19 @@ +// this file was generated by gomacro command: import _b "html" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "html" +) + +// reflection: allow interpreted code to import "html" +func init() { + Packages["html"] = Package{ + Binds: map[string]Value{ + "EscapeString": ValueOf(html.EscapeString), + "UnescapeString": ValueOf(html.UnescapeString), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/html_template.go b/vendor/github.com/cosmos72/gomacro/imports/html_template.go new file mode 100644 index 0000000..65a2bff --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/html_template.go @@ -0,0 +1,51 @@ +// this file was generated by gomacro command: import _b "html/template" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "html/template" +) + +// reflection: allow interpreted code to import "html/template" +func init() { + Packages["html/template"] = Package{ + Binds: map[string]Value{ + "ErrAmbigContext": ValueOf(template.ErrAmbigContext), + "ErrBadHTML": ValueOf(template.ErrBadHTML), + "ErrBranchEnd": ValueOf(template.ErrBranchEnd), + "ErrEndContext": ValueOf(template.ErrEndContext), + "ErrNoSuchTemplate": ValueOf(template.ErrNoSuchTemplate), + "ErrOutputContext": ValueOf(template.ErrOutputContext), + "ErrPartialCharset": ValueOf(template.ErrPartialCharset), + "ErrPartialEscape": ValueOf(template.ErrPartialEscape), + "ErrRangeLoopReentry": ValueOf(template.ErrRangeLoopReentry), + "ErrSlashAmbig": ValueOf(template.ErrSlashAmbig), + "HTMLEscape": ValueOf(template.HTMLEscape), + "HTMLEscapeString": ValueOf(template.HTMLEscapeString), + "HTMLEscaper": ValueOf(template.HTMLEscaper), + "IsTrue": ValueOf(template.IsTrue), + "JSEscape": ValueOf(template.JSEscape), + "JSEscapeString": ValueOf(template.JSEscapeString), + "JSEscaper": ValueOf(template.JSEscaper), + "Must": ValueOf(template.Must), + "New": ValueOf(template.New), + "OK": ValueOf(template.OK), + "ParseFiles": ValueOf(template.ParseFiles), + "ParseGlob": ValueOf(template.ParseGlob), + "URLQueryEscaper": ValueOf(template.URLQueryEscaper), + },Types: map[string]Type{ + "CSS": TypeOf((*template.CSS)(nil)).Elem(), + "Error": TypeOf((*template.Error)(nil)).Elem(), + "ErrorCode": TypeOf((*template.ErrorCode)(nil)).Elem(), + "FuncMap": TypeOf((*template.FuncMap)(nil)).Elem(), + "HTML": TypeOf((*template.HTML)(nil)).Elem(), + "HTMLAttr": TypeOf((*template.HTMLAttr)(nil)).Elem(), + "JS": TypeOf((*template.JS)(nil)).Elem(), + "JSStr": TypeOf((*template.JSStr)(nil)).Elem(), + "Template": TypeOf((*template.Template)(nil)).Elem(), + "URL": TypeOf((*template.URL)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image.go b/vendor/github.com/cosmos72/gomacro/imports/image.go new file mode 100644 index 0000000..9651536 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image.go @@ -0,0 +1,112 @@ +// this file was generated by gomacro command: import _b "image" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image" + "image/color" +) + +// reflection: allow interpreted code to import "image" +func init() { + Packages["image"] = Package{ + Binds: map[string]Value{ + "Black": ValueOf(&image.Black).Elem(), + "Decode": ValueOf(image.Decode), + "DecodeConfig": ValueOf(image.DecodeConfig), + "ErrFormat": ValueOf(&image.ErrFormat).Elem(), + "NewAlpha": ValueOf(image.NewAlpha), + "NewAlpha16": ValueOf(image.NewAlpha16), + "NewCMYK": ValueOf(image.NewCMYK), + "NewGray": ValueOf(image.NewGray), + "NewGray16": ValueOf(image.NewGray16), + "NewNRGBA": ValueOf(image.NewNRGBA), + "NewNRGBA64": ValueOf(image.NewNRGBA64), + "NewNYCbCrA": ValueOf(image.NewNYCbCrA), + "NewPaletted": ValueOf(image.NewPaletted), + "NewRGBA": ValueOf(image.NewRGBA), + "NewRGBA64": ValueOf(image.NewRGBA64), + "NewUniform": ValueOf(image.NewUniform), + "NewYCbCr": ValueOf(image.NewYCbCr), + "Opaque": ValueOf(&image.Opaque).Elem(), + "Pt": ValueOf(image.Pt), + "Rect": ValueOf(image.Rect), + "RegisterFormat": ValueOf(image.RegisterFormat), + "Transparent": ValueOf(&image.Transparent).Elem(), + "White": ValueOf(&image.White).Elem(), + "YCbCrSubsampleRatio410": ValueOf(image.YCbCrSubsampleRatio410), + "YCbCrSubsampleRatio411": ValueOf(image.YCbCrSubsampleRatio411), + "YCbCrSubsampleRatio420": ValueOf(image.YCbCrSubsampleRatio420), + "YCbCrSubsampleRatio422": ValueOf(image.YCbCrSubsampleRatio422), + "YCbCrSubsampleRatio440": ValueOf(image.YCbCrSubsampleRatio440), + "YCbCrSubsampleRatio444": ValueOf(image.YCbCrSubsampleRatio444), + "ZP": ValueOf(&image.ZP).Elem(), + "ZR": ValueOf(&image.ZR).Elem(), + },Types: map[string]Type{ + "Alpha": TypeOf((*image.Alpha)(nil)).Elem(), + "Alpha16": TypeOf((*image.Alpha16)(nil)).Elem(), + "CMYK": TypeOf((*image.CMYK)(nil)).Elem(), + "Config": TypeOf((*image.Config)(nil)).Elem(), + "Gray": TypeOf((*image.Gray)(nil)).Elem(), + "Gray16": TypeOf((*image.Gray16)(nil)).Elem(), + "Image": TypeOf((*image.Image)(nil)).Elem(), + "NRGBA": TypeOf((*image.NRGBA)(nil)).Elem(), + "NRGBA64": TypeOf((*image.NRGBA64)(nil)).Elem(), + "NYCbCrA": TypeOf((*image.NYCbCrA)(nil)).Elem(), + "Paletted": TypeOf((*image.Paletted)(nil)).Elem(), + "PalettedImage": TypeOf((*image.PalettedImage)(nil)).Elem(), + "Point": TypeOf((*image.Point)(nil)).Elem(), + "RGBA": TypeOf((*image.RGBA)(nil)).Elem(), + "RGBA64": TypeOf((*image.RGBA64)(nil)).Elem(), + "Rectangle": TypeOf((*image.Rectangle)(nil)).Elem(), + "Uniform": TypeOf((*image.Uniform)(nil)).Elem(), + "YCbCr": TypeOf((*image.YCbCr)(nil)).Elem(), + "YCbCrSubsampleRatio": TypeOf((*image.YCbCrSubsampleRatio)(nil)).Elem(), + },Proxies: map[string]Type{ + "Image": TypeOf((*Image_image)(nil)).Elem(), + "PalettedImage": TypeOf((*PalettedImage_image)(nil)).Elem(), + },Wrappers: map[string][]string{ + "NYCbCrA": []string{"Bounds","COffset","YCbCrAt","YOffset",}, + }, + } +} + +// --------------- proxy for image.Image --------------- +type Image_image struct { + Object interface{} + At_ func(_proxy_obj_ interface{}, x int, y int) color.Color + Bounds_ func(interface{}) image.Rectangle + ColorModel_ func(interface{}) color.Model +} +func (Proxy *Image_image) At(x int, y int) color.Color { + return Proxy.At_(Proxy.Object, x, y) +} +func (Proxy *Image_image) Bounds() image.Rectangle { + return Proxy.Bounds_(Proxy.Object) +} +func (Proxy *Image_image) ColorModel() color.Model { + return Proxy.ColorModel_(Proxy.Object) +} + +// --------------- proxy for image.PalettedImage --------------- +type PalettedImage_image struct { + Object interface{} + At_ func(_proxy_obj_ interface{}, x int, y int) color.Color + Bounds_ func(interface{}) image.Rectangle + ColorIndexAt_ func(_proxy_obj_ interface{}, x int, y int) uint8 + ColorModel_ func(interface{}) color.Model +} +func (Proxy *PalettedImage_image) At(x int, y int) color.Color { + return Proxy.At_(Proxy.Object, x, y) +} +func (Proxy *PalettedImage_image) Bounds() image.Rectangle { + return Proxy.Bounds_(Proxy.Object) +} +func (Proxy *PalettedImage_image) ColorIndexAt(x int, y int) uint8 { + return Proxy.ColorIndexAt_(Proxy.Object, x, y) +} +func (Proxy *PalettedImage_image) ColorModel() color.Model { + return Proxy.ColorModel_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_color.go b/vendor/github.com/cosmos72/gomacro/imports/image_color.go new file mode 100644 index 0000000..64820b0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_color.go @@ -0,0 +1,73 @@ +// this file was generated by gomacro command: import _b "image/color" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image/color" +) + +// reflection: allow interpreted code to import "image/color" +func init() { + Packages["image/color"] = Package{ + Binds: map[string]Value{ + "Alpha16Model": ValueOf(&color.Alpha16Model).Elem(), + "AlphaModel": ValueOf(&color.AlphaModel).Elem(), + "Black": ValueOf(&color.Black).Elem(), + "CMYKModel": ValueOf(&color.CMYKModel).Elem(), + "CMYKToRGB": ValueOf(color.CMYKToRGB), + "Gray16Model": ValueOf(&color.Gray16Model).Elem(), + "GrayModel": ValueOf(&color.GrayModel).Elem(), + "ModelFunc": ValueOf(color.ModelFunc), + "NRGBA64Model": ValueOf(&color.NRGBA64Model).Elem(), + "NRGBAModel": ValueOf(&color.NRGBAModel).Elem(), + "NYCbCrAModel": ValueOf(&color.NYCbCrAModel).Elem(), + "Opaque": ValueOf(&color.Opaque).Elem(), + "RGBA64Model": ValueOf(&color.RGBA64Model).Elem(), + "RGBAModel": ValueOf(&color.RGBAModel).Elem(), + "RGBToCMYK": ValueOf(color.RGBToCMYK), + "RGBToYCbCr": ValueOf(color.RGBToYCbCr), + "Transparent": ValueOf(&color.Transparent).Elem(), + "White": ValueOf(&color.White).Elem(), + "YCbCrModel": ValueOf(&color.YCbCrModel).Elem(), + "YCbCrToRGB": ValueOf(color.YCbCrToRGB), + },Types: map[string]Type{ + "Alpha": TypeOf((*color.Alpha)(nil)).Elem(), + "Alpha16": TypeOf((*color.Alpha16)(nil)).Elem(), + "CMYK": TypeOf((*color.CMYK)(nil)).Elem(), + "Color": TypeOf((*color.Color)(nil)).Elem(), + "Gray": TypeOf((*color.Gray)(nil)).Elem(), + "Gray16": TypeOf((*color.Gray16)(nil)).Elem(), + "Model": TypeOf((*color.Model)(nil)).Elem(), + "NRGBA": TypeOf((*color.NRGBA)(nil)).Elem(), + "NRGBA64": TypeOf((*color.NRGBA64)(nil)).Elem(), + "NYCbCrA": TypeOf((*color.NYCbCrA)(nil)).Elem(), + "Palette": TypeOf((*color.Palette)(nil)).Elem(), + "RGBA": TypeOf((*color.RGBA)(nil)).Elem(), + "RGBA64": TypeOf((*color.RGBA64)(nil)).Elem(), + "YCbCr": TypeOf((*color.YCbCr)(nil)).Elem(), + },Proxies: map[string]Type{ + "Color": TypeOf((*Color_image_color)(nil)).Elem(), + "Model": TypeOf((*Model_image_color)(nil)).Elem(), + }, + } +} + +// --------------- proxy for image/color.Color --------------- +type Color_image_color struct { + Object interface{} + RGBA_ func(interface{}) (r uint32, g uint32, b uint32, a uint32) +} +func (Proxy *Color_image_color) RGBA() (r uint32, g uint32, b uint32, a uint32) { + return Proxy.RGBA_(Proxy.Object) +} + +// --------------- proxy for image/color.Model --------------- +type Model_image_color struct { + Object interface{} + Convert_ func(_proxy_obj_ interface{}, c color.Color) color.Color +} +func (Proxy *Model_image_color) Convert(c color.Color) color.Color { + return Proxy.Convert_(Proxy.Object, c) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_color_palette.go b/vendor/github.com/cosmos72/gomacro/imports/image_color_palette.go new file mode 100644 index 0000000..2e1a749 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_color_palette.go @@ -0,0 +1,19 @@ +// this file was generated by gomacro command: import _b "image/color/palette" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image/color/palette" +) + +// reflection: allow interpreted code to import "image/color/palette" +func init() { + Packages["image/color/palette"] = Package{ + Binds: map[string]Value{ + "Plan9": ValueOf(&palette.Plan9).Elem(), + "WebSafe": ValueOf(&palette.WebSafe).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_draw.go b/vendor/github.com/cosmos72/gomacro/imports/image_draw.go new file mode 100644 index 0000000..ff0b71d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_draw.go @@ -0,0 +1,72 @@ +// this file was generated by gomacro command: import _b "image/draw" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image" + "image/color" + "image/draw" +) + +// reflection: allow interpreted code to import "image/draw" +func init() { + Packages["image/draw"] = Package{ + Binds: map[string]Value{ + "Draw": ValueOf(draw.Draw), + "DrawMask": ValueOf(draw.DrawMask), + "FloydSteinberg": ValueOf(&draw.FloydSteinberg).Elem(), + "Over": ValueOf(draw.Over), + "Src": ValueOf(draw.Src), + },Types: map[string]Type{ + "Drawer": TypeOf((*draw.Drawer)(nil)).Elem(), + "Image": TypeOf((*draw.Image)(nil)).Elem(), + "Op": TypeOf((*draw.Op)(nil)).Elem(), + "Quantizer": TypeOf((*draw.Quantizer)(nil)).Elem(), + },Proxies: map[string]Type{ + "Drawer": TypeOf((*Drawer_image_draw)(nil)).Elem(), + "Image": TypeOf((*Image_image_draw)(nil)).Elem(), + "Quantizer": TypeOf((*Quantizer_image_draw)(nil)).Elem(), + }, + } +} + +// --------------- proxy for image/draw.Drawer --------------- +type Drawer_image_draw struct { + Object interface{} + Draw_ func(_proxy_obj_ interface{}, dst draw.Image, r image.Rectangle, src image.Image, sp image.Point) +} +func (Proxy *Drawer_image_draw) Draw(dst draw.Image, r image.Rectangle, src image.Image, sp image.Point) { + Proxy.Draw_(Proxy.Object, dst, r, src, sp) +} + +// --------------- proxy for image/draw.Image --------------- +type Image_image_draw struct { + Object interface{} + At_ func(_proxy_obj_ interface{}, x int, y int) color.Color + Bounds_ func(interface{}) image.Rectangle + ColorModel_ func(interface{}) color.Model + Set_ func(_proxy_obj_ interface{}, x int, y int, c color.Color) +} +func (Proxy *Image_image_draw) At(x int, y int) color.Color { + return Proxy.At_(Proxy.Object, x, y) +} +func (Proxy *Image_image_draw) Bounds() image.Rectangle { + return Proxy.Bounds_(Proxy.Object) +} +func (Proxy *Image_image_draw) ColorModel() color.Model { + return Proxy.ColorModel_(Proxy.Object) +} +func (Proxy *Image_image_draw) Set(x int, y int, c color.Color) { + Proxy.Set_(Proxy.Object, x, y, c) +} + +// --------------- proxy for image/draw.Quantizer --------------- +type Quantizer_image_draw struct { + Object interface{} + Quantize_ func(_proxy_obj_ interface{}, p color.Palette, m image.Image) color.Palette +} +func (Proxy *Quantizer_image_draw) Quantize(p color.Palette, m image.Image) color.Palette { + return Proxy.Quantize_(Proxy.Object, p, m) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_gif.go b/vendor/github.com/cosmos72/gomacro/imports/image_gif.go new file mode 100644 index 0000000..a39aba3 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_gif.go @@ -0,0 +1,32 @@ +// this file was generated by gomacro command: import _b "image/gif" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image/gif" +) + +// reflection: allow interpreted code to import "image/gif" +func init() { + Packages["image/gif"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(gif.Decode), + "DecodeAll": ValueOf(gif.DecodeAll), + "DecodeConfig": ValueOf(gif.DecodeConfig), + "DisposalBackground": ValueOf(gif.DisposalBackground), + "DisposalNone": ValueOf(gif.DisposalNone), + "DisposalPrevious": ValueOf(gif.DisposalPrevious), + "Encode": ValueOf(gif.Encode), + "EncodeAll": ValueOf(gif.EncodeAll), + },Types: map[string]Type{ + "GIF": TypeOf((*gif.GIF)(nil)).Elem(), + "Options": TypeOf((*gif.Options)(nil)).Elem(), + },Untypeds: map[string]string{ + "DisposalBackground": "int:2", + "DisposalNone": "int:1", + "DisposalPrevious": "int:3", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_jpeg.go b/vendor/github.com/cosmos72/gomacro/imports/image_jpeg.go new file mode 100644 index 0000000..e7f5ed5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_jpeg.go @@ -0,0 +1,43 @@ +// this file was generated by gomacro command: import _b "image/jpeg" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image/jpeg" +) + +// reflection: allow interpreted code to import "image/jpeg" +func init() { + Packages["image/jpeg"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(jpeg.Decode), + "DecodeConfig": ValueOf(jpeg.DecodeConfig), + "DefaultQuality": ValueOf(jpeg.DefaultQuality), + "Encode": ValueOf(jpeg.Encode), + },Types: map[string]Type{ + "FormatError": TypeOf((*jpeg.FormatError)(nil)).Elem(), + "Options": TypeOf((*jpeg.Options)(nil)).Elem(), + "Reader": TypeOf((*jpeg.Reader)(nil)).Elem(), + "UnsupportedError": TypeOf((*jpeg.UnsupportedError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Reader": TypeOf((*Reader_image_jpeg)(nil)).Elem(), + },Untypeds: map[string]string{ + "DefaultQuality": "int:75", + }, + } +} + +// --------------- proxy for image/jpeg.Reader --------------- +type Reader_image_jpeg struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + ReadByte_ func(interface{}) (byte, error) +} +func (Proxy *Reader_image_jpeg) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *Reader_image_jpeg) ReadByte() (byte, error) { + return Proxy.ReadByte_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/image_png.go b/vendor/github.com/cosmos72/gomacro/imports/image_png.go new file mode 100644 index 0000000..8781c3a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/image_png.go @@ -0,0 +1,29 @@ +// this file was generated by gomacro command: import _b "image/png" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "image/png" +) + +// reflection: allow interpreted code to import "image/png" +func init() { + Packages["image/png"] = Package{ + Binds: map[string]Value{ + "BestCompression": ValueOf(png.BestCompression), + "BestSpeed": ValueOf(png.BestSpeed), + "Decode": ValueOf(png.Decode), + "DecodeConfig": ValueOf(png.DecodeConfig), + "DefaultCompression": ValueOf(png.DefaultCompression), + "Encode": ValueOf(png.Encode), + "NoCompression": ValueOf(png.NoCompression), + },Types: map[string]Type{ + "CompressionLevel": TypeOf((*png.CompressionLevel)(nil)).Elem(), + "Encoder": TypeOf((*png.Encoder)(nil)).Elem(), + "FormatError": TypeOf((*png.FormatError)(nil)).Elem(), + "UnsupportedError": TypeOf((*png.UnsupportedError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/index_suffixarray.go b/vendor/github.com/cosmos72/gomacro/imports/index_suffixarray.go new file mode 100644 index 0000000..d1a801a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/index_suffixarray.go @@ -0,0 +1,20 @@ +// this file was generated by gomacro command: import _b "index/suffixarray" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "index/suffixarray" +) + +// reflection: allow interpreted code to import "index/suffixarray" +func init() { + Packages["index/suffixarray"] = Package{ + Binds: map[string]Value{ + "New": ValueOf(suffixarray.New), + },Types: map[string]Type{ + "Index": TypeOf((*suffixarray.Index)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/io.go b/vendor/github.com/cosmos72/gomacro/imports/io.go new file mode 100644 index 0000000..ed7d171 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/io.go @@ -0,0 +1,312 @@ +// this file was generated by gomacro command: import _b "io" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "io" +) + +// reflection: allow interpreted code to import "io" +func init() { + Packages["io"] = Package{ + Binds: map[string]Value{ + "Copy": ValueOf(io.Copy), + "CopyBuffer": ValueOf(io.CopyBuffer), + "CopyN": ValueOf(io.CopyN), + "EOF": ValueOf(&io.EOF).Elem(), + "ErrClosedPipe": ValueOf(&io.ErrClosedPipe).Elem(), + "ErrNoProgress": ValueOf(&io.ErrNoProgress).Elem(), + "ErrShortBuffer": ValueOf(&io.ErrShortBuffer).Elem(), + "ErrShortWrite": ValueOf(&io.ErrShortWrite).Elem(), + "ErrUnexpectedEOF": ValueOf(&io.ErrUnexpectedEOF).Elem(), + "LimitReader": ValueOf(io.LimitReader), + "MultiReader": ValueOf(io.MultiReader), + "MultiWriter": ValueOf(io.MultiWriter), + "NewSectionReader": ValueOf(io.NewSectionReader), + "Pipe": ValueOf(io.Pipe), + "ReadAtLeast": ValueOf(io.ReadAtLeast), + "ReadFull": ValueOf(io.ReadFull), + "SeekCurrent": ValueOf(io.SeekCurrent), + "SeekEnd": ValueOf(io.SeekEnd), + "SeekStart": ValueOf(io.SeekStart), + "TeeReader": ValueOf(io.TeeReader), + "WriteString": ValueOf(io.WriteString), + },Types: map[string]Type{ + "ByteReader": TypeOf((*io.ByteReader)(nil)).Elem(), + "ByteScanner": TypeOf((*io.ByteScanner)(nil)).Elem(), + "ByteWriter": TypeOf((*io.ByteWriter)(nil)).Elem(), + "Closer": TypeOf((*io.Closer)(nil)).Elem(), + "LimitedReader": TypeOf((*io.LimitedReader)(nil)).Elem(), + "PipeReader": TypeOf((*io.PipeReader)(nil)).Elem(), + "PipeWriter": TypeOf((*io.PipeWriter)(nil)).Elem(), + "ReadCloser": TypeOf((*io.ReadCloser)(nil)).Elem(), + "ReadSeeker": TypeOf((*io.ReadSeeker)(nil)).Elem(), + "ReadWriteCloser": TypeOf((*io.ReadWriteCloser)(nil)).Elem(), + "ReadWriteSeeker": TypeOf((*io.ReadWriteSeeker)(nil)).Elem(), + "ReadWriter": TypeOf((*io.ReadWriter)(nil)).Elem(), + "Reader": TypeOf((*io.Reader)(nil)).Elem(), + "ReaderAt": TypeOf((*io.ReaderAt)(nil)).Elem(), + "ReaderFrom": TypeOf((*io.ReaderFrom)(nil)).Elem(), + "RuneReader": TypeOf((*io.RuneReader)(nil)).Elem(), + "RuneScanner": TypeOf((*io.RuneScanner)(nil)).Elem(), + "SectionReader": TypeOf((*io.SectionReader)(nil)).Elem(), + "Seeker": TypeOf((*io.Seeker)(nil)).Elem(), + "WriteCloser": TypeOf((*io.WriteCloser)(nil)).Elem(), + "WriteSeeker": TypeOf((*io.WriteSeeker)(nil)).Elem(), + "Writer": TypeOf((*io.Writer)(nil)).Elem(), + "WriterAt": TypeOf((*io.WriterAt)(nil)).Elem(), + "WriterTo": TypeOf((*io.WriterTo)(nil)).Elem(), + },Proxies: map[string]Type{ + "ByteReader": TypeOf((*ByteReader_io)(nil)).Elem(), + "ByteScanner": TypeOf((*ByteScanner_io)(nil)).Elem(), + "ByteWriter": TypeOf((*ByteWriter_io)(nil)).Elem(), + "Closer": TypeOf((*Closer_io)(nil)).Elem(), + "ReadCloser": TypeOf((*ReadCloser_io)(nil)).Elem(), + "ReadSeeker": TypeOf((*ReadSeeker_io)(nil)).Elem(), + "ReadWriteCloser": TypeOf((*ReadWriteCloser_io)(nil)).Elem(), + "ReadWriteSeeker": TypeOf((*ReadWriteSeeker_io)(nil)).Elem(), + "ReadWriter": TypeOf((*ReadWriter_io)(nil)).Elem(), + "Reader": TypeOf((*Reader_io)(nil)).Elem(), + "ReaderAt": TypeOf((*ReaderAt_io)(nil)).Elem(), + "ReaderFrom": TypeOf((*ReaderFrom_io)(nil)).Elem(), + "RuneReader": TypeOf((*RuneReader_io)(nil)).Elem(), + "RuneScanner": TypeOf((*RuneScanner_io)(nil)).Elem(), + "Seeker": TypeOf((*Seeker_io)(nil)).Elem(), + "WriteCloser": TypeOf((*WriteCloser_io)(nil)).Elem(), + "WriteSeeker": TypeOf((*WriteSeeker_io)(nil)).Elem(), + "Writer": TypeOf((*Writer_io)(nil)).Elem(), + "WriterAt": TypeOf((*WriterAt_io)(nil)).Elem(), + "WriterTo": TypeOf((*WriterTo_io)(nil)).Elem(), + },Untypeds: map[string]string{ + "SeekCurrent": "int:1", + "SeekEnd": "int:2", + "SeekStart": "int:0", + }, + } +} + +// --------------- proxy for io.ByteReader --------------- +type ByteReader_io struct { + Object interface{} + ReadByte_ func(interface{}) (byte, error) +} +func (Proxy *ByteReader_io) ReadByte() (byte, error) { + return Proxy.ReadByte_(Proxy.Object) +} + +// --------------- proxy for io.ByteScanner --------------- +type ByteScanner_io struct { + Object interface{} + ReadByte_ func(interface{}) (byte, error) + UnreadByte_ func(interface{}) error +} +func (Proxy *ByteScanner_io) ReadByte() (byte, error) { + return Proxy.ReadByte_(Proxy.Object) +} +func (Proxy *ByteScanner_io) UnreadByte() error { + return Proxy.UnreadByte_(Proxy.Object) +} + +// --------------- proxy for io.ByteWriter --------------- +type ByteWriter_io struct { + Object interface{} + WriteByte_ func(_proxy_obj_ interface{}, c byte) error +} +func (Proxy *ByteWriter_io) WriteByte(c byte) error { + return Proxy.WriteByte_(Proxy.Object, c) +} + +// --------------- proxy for io.Closer --------------- +type Closer_io struct { + Object interface{} + Close_ func(interface{}) error +} +func (Proxy *Closer_io) Close() error { + return Proxy.Close_(Proxy.Object) +} + +// --------------- proxy for io.ReadCloser --------------- +type ReadCloser_io struct { + Object interface{} + Close_ func(interface{}) error + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *ReadCloser_io) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *ReadCloser_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} + +// --------------- proxy for io.ReadSeeker --------------- +type ReadSeeker_io struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) +} +func (Proxy *ReadSeeker_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *ReadSeeker_io) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} + +// --------------- proxy for io.ReadWriteCloser --------------- +type ReadWriteCloser_io struct { + Object interface{} + Close_ func(interface{}) error + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *ReadWriteCloser_io) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *ReadWriteCloser_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *ReadWriteCloser_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.ReadWriteSeeker --------------- +type ReadWriteSeeker_io struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *ReadWriteSeeker_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *ReadWriteSeeker_io) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} +func (Proxy *ReadWriteSeeker_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.ReadWriter --------------- +type ReadWriter_io struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *ReadWriter_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *ReadWriter_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.Reader --------------- +type Reader_io struct { + Object interface{} + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *Reader_io) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} + +// --------------- proxy for io.ReaderAt --------------- +type ReaderAt_io struct { + Object interface{} + ReadAt_ func(_proxy_obj_ interface{}, p []byte, off int64) (n int, err error) +} +func (Proxy *ReaderAt_io) ReadAt(p []byte, off int64) (n int, err error) { + return Proxy.ReadAt_(Proxy.Object, p, off) +} + +// --------------- proxy for io.ReaderFrom --------------- +type ReaderFrom_io struct { + Object interface{} + ReadFrom_ func(_proxy_obj_ interface{}, r io.Reader) (n int64, err error) +} +func (Proxy *ReaderFrom_io) ReadFrom(r io.Reader) (n int64, err error) { + return Proxy.ReadFrom_(Proxy.Object, r) +} + +// --------------- proxy for io.RuneReader --------------- +type RuneReader_io struct { + Object interface{} + ReadRune_ func(interface{}) (r rune, size int, err error) +} +func (Proxy *RuneReader_io) ReadRune() (r rune, size int, err error) { + return Proxy.ReadRune_(Proxy.Object) +} + +// --------------- proxy for io.RuneScanner --------------- +type RuneScanner_io struct { + Object interface{} + ReadRune_ func(interface{}) (r rune, size int, err error) + UnreadRune_ func(interface{}) error +} +func (Proxy *RuneScanner_io) ReadRune() (r rune, size int, err error) { + return Proxy.ReadRune_(Proxy.Object) +} +func (Proxy *RuneScanner_io) UnreadRune() error { + return Proxy.UnreadRune_(Proxy.Object) +} + +// --------------- proxy for io.Seeker --------------- +type Seeker_io struct { + Object interface{} + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) +} +func (Proxy *Seeker_io) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} + +// --------------- proxy for io.WriteCloser --------------- +type WriteCloser_io struct { + Object interface{} + Close_ func(interface{}) error + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *WriteCloser_io) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *WriteCloser_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.WriteSeeker --------------- +type WriteSeeker_io struct { + Object interface{} + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *WriteSeeker_io) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} +func (Proxy *WriteSeeker_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.Writer --------------- +type Writer_io struct { + Object interface{} + Write_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) +} +func (Proxy *Writer_io) Write(p []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, p) +} + +// --------------- proxy for io.WriterAt --------------- +type WriterAt_io struct { + Object interface{} + WriteAt_ func(_proxy_obj_ interface{}, p []byte, off int64) (n int, err error) +} +func (Proxy *WriterAt_io) WriteAt(p []byte, off int64) (n int, err error) { + return Proxy.WriteAt_(Proxy.Object, p, off) +} + +// --------------- proxy for io.WriterTo --------------- +type WriterTo_io struct { + Object interface{} + WriteTo_ func(_proxy_obj_ interface{}, w io.Writer) (n int64, err error) +} +func (Proxy *WriterTo_io) WriteTo(w io.Writer) (n int64, err error) { + return Proxy.WriteTo_(Proxy.Object, w) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/io_ioutil.go b/vendor/github.com/cosmos72/gomacro/imports/io_ioutil.go new file mode 100644 index 0000000..d91a4a1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/io_ioutil.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "io/ioutil" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "io/ioutil" +) + +// reflection: allow interpreted code to import "io/ioutil" +func init() { + Packages["io/ioutil"] = Package{ + Binds: map[string]Value{ + "Discard": ValueOf(&ioutil.Discard).Elem(), + "NopCloser": ValueOf(ioutil.NopCloser), + "ReadAll": ValueOf(ioutil.ReadAll), + "ReadDir": ValueOf(ioutil.ReadDir), + "ReadFile": ValueOf(ioutil.ReadFile), + "TempDir": ValueOf(ioutil.TempDir), + "TempFile": ValueOf(ioutil.TempFile), + "WriteFile": ValueOf(ioutil.WriteFile), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/log.go b/vendor/github.com/cosmos72/gomacro/imports/log.go new file mode 100644 index 0000000..3c5213e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/log.go @@ -0,0 +1,50 @@ +// this file was generated by gomacro command: import _b "log" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "log" +) + +// reflection: allow interpreted code to import "log" +func init() { + Packages["log"] = Package{ + Binds: map[string]Value{ + "Fatal": ValueOf(log.Fatal), + "Fatalf": ValueOf(log.Fatalf), + "Fatalln": ValueOf(log.Fatalln), + "Flags": ValueOf(log.Flags), + "LUTC": ValueOf(log.LUTC), + "Ldate": ValueOf(log.Ldate), + "Llongfile": ValueOf(log.Llongfile), + "Lmicroseconds": ValueOf(log.Lmicroseconds), + "Lshortfile": ValueOf(log.Lshortfile), + "LstdFlags": ValueOf(log.LstdFlags), + "Ltime": ValueOf(log.Ltime), + "New": ValueOf(log.New), + "Output": ValueOf(log.Output), + "Panic": ValueOf(log.Panic), + "Panicf": ValueOf(log.Panicf), + "Panicln": ValueOf(log.Panicln), + "Prefix": ValueOf(log.Prefix), + "Print": ValueOf(log.Print), + "Printf": ValueOf(log.Printf), + "Println": ValueOf(log.Println), + "SetFlags": ValueOf(log.SetFlags), + "SetOutput": ValueOf(log.SetOutput), + "SetPrefix": ValueOf(log.SetPrefix), + },Types: map[string]Type{ + "Logger": TypeOf((*log.Logger)(nil)).Elem(), + },Untypeds: map[string]string{ + "LUTC": "int:32", + "Ldate": "int:1", + "Llongfile": "int:8", + "Lmicroseconds": "int:4", + "Lshortfile": "int:16", + "LstdFlags": "int:3", + "Ltime": "int:2", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/log_syslog.go b/vendor/github.com/cosmos72/gomacro/imports/log_syslog.go new file mode 100644 index 0000000..fe11c8f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/log_syslog.go @@ -0,0 +1,55 @@ +// this file was generated by gomacro command: import _b "log/syslog" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +// +build !nacl +// +build !plan9 +// +build !windows + +package imports + +import ( + . "reflect" + "log/syslog" +) + +// reflection: allow interpreted code to import "log/syslog" +func init() { + Packages["log/syslog"] = Package{ + Binds: map[string]Value{ + "Dial": ValueOf(syslog.Dial), + "LOG_ALERT": ValueOf(syslog.LOG_ALERT), + "LOG_AUTH": ValueOf(syslog.LOG_AUTH), + "LOG_AUTHPRIV": ValueOf(syslog.LOG_AUTHPRIV), + "LOG_CRIT": ValueOf(syslog.LOG_CRIT), + "LOG_CRON": ValueOf(syslog.LOG_CRON), + "LOG_DAEMON": ValueOf(syslog.LOG_DAEMON), + "LOG_DEBUG": ValueOf(syslog.LOG_DEBUG), + "LOG_EMERG": ValueOf(syslog.LOG_EMERG), + "LOG_ERR": ValueOf(syslog.LOG_ERR), + "LOG_FTP": ValueOf(syslog.LOG_FTP), + "LOG_INFO": ValueOf(syslog.LOG_INFO), + "LOG_KERN": ValueOf(syslog.LOG_KERN), + "LOG_LOCAL0": ValueOf(syslog.LOG_LOCAL0), + "LOG_LOCAL1": ValueOf(syslog.LOG_LOCAL1), + "LOG_LOCAL2": ValueOf(syslog.LOG_LOCAL2), + "LOG_LOCAL3": ValueOf(syslog.LOG_LOCAL3), + "LOG_LOCAL4": ValueOf(syslog.LOG_LOCAL4), + "LOG_LOCAL5": ValueOf(syslog.LOG_LOCAL5), + "LOG_LOCAL6": ValueOf(syslog.LOG_LOCAL6), + "LOG_LOCAL7": ValueOf(syslog.LOG_LOCAL7), + "LOG_LPR": ValueOf(syslog.LOG_LPR), + "LOG_MAIL": ValueOf(syslog.LOG_MAIL), + "LOG_NEWS": ValueOf(syslog.LOG_NEWS), + "LOG_NOTICE": ValueOf(syslog.LOG_NOTICE), + "LOG_SYSLOG": ValueOf(syslog.LOG_SYSLOG), + "LOG_USER": ValueOf(syslog.LOG_USER), + "LOG_UUCP": ValueOf(syslog.LOG_UUCP), + "LOG_WARNING": ValueOf(syslog.LOG_WARNING), + "New": ValueOf(syslog.New), + "NewLogger": ValueOf(syslog.NewLogger), + },Types: map[string]Type{ + "Priority": TypeOf((*syslog.Priority)(nil)).Elem(), + "Writer": TypeOf((*syslog.Writer)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/math.go b/vendor/github.com/cosmos72/gomacro/imports/math.go new file mode 100644 index 0000000..1e616dc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/math.go @@ -0,0 +1,134 @@ +// this file was generated by gomacro command: import _b "math" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "math" +) + +// reflection: allow interpreted code to import "math" +func init() { + Packages["math"] = Package{ + Binds: map[string]Value{ + "Abs": ValueOf(math.Abs), + "Acos": ValueOf(math.Acos), + "Acosh": ValueOf(math.Acosh), + "Asin": ValueOf(math.Asin), + "Asinh": ValueOf(math.Asinh), + "Atan": ValueOf(math.Atan), + "Atan2": ValueOf(math.Atan2), + "Atanh": ValueOf(math.Atanh), + "Cbrt": ValueOf(math.Cbrt), + "Ceil": ValueOf(math.Ceil), + "Copysign": ValueOf(math.Copysign), + "Cos": ValueOf(math.Cos), + "Cosh": ValueOf(math.Cosh), + "Dim": ValueOf(math.Dim), + "E": ValueOf(math.E), + "Erf": ValueOf(math.Erf), + "Erfc": ValueOf(math.Erfc), + "Exp": ValueOf(math.Exp), + "Exp2": ValueOf(math.Exp2), + "Expm1": ValueOf(math.Expm1), + "Float32bits": ValueOf(math.Float32bits), + "Float32frombits": ValueOf(math.Float32frombits), + "Float64bits": ValueOf(math.Float64bits), + "Float64frombits": ValueOf(math.Float64frombits), + "Floor": ValueOf(math.Floor), + "Frexp": ValueOf(math.Frexp), + "Gamma": ValueOf(math.Gamma), + "Hypot": ValueOf(math.Hypot), + "Ilogb": ValueOf(math.Ilogb), + "Inf": ValueOf(math.Inf), + "IsInf": ValueOf(math.IsInf), + "IsNaN": ValueOf(math.IsNaN), + "J0": ValueOf(math.J0), + "J1": ValueOf(math.J1), + "Jn": ValueOf(math.Jn), + "Ldexp": ValueOf(math.Ldexp), + "Lgamma": ValueOf(math.Lgamma), + "Ln10": ValueOf(math.Ln10), + "Ln2": ValueOf(math.Ln2), + "Log": ValueOf(math.Log), + "Log10": ValueOf(math.Log10), + "Log10E": ValueOf(math.Log10E), + "Log1p": ValueOf(math.Log1p), + "Log2": ValueOf(math.Log2), + "Log2E": ValueOf(math.Log2E), + "Logb": ValueOf(math.Logb), + "Max": ValueOf(math.Max), + "MaxFloat32": ValueOf(float32(math.MaxFloat32)), + "MaxFloat64": ValueOf(float64(math.MaxFloat64)), + "MaxInt16": ValueOf(math.MaxInt16), + "MaxInt32": ValueOf(math.MaxInt32), + "MaxInt64": ValueOf(int64(math.MaxInt64)), + "MaxInt8": ValueOf(math.MaxInt8), + "MaxUint16": ValueOf(math.MaxUint16), + "MaxUint32": ValueOf(uint32(math.MaxUint32)), + "MaxUint64": ValueOf(uint64(math.MaxUint64)), + "MaxUint8": ValueOf(math.MaxUint8), + "Min": ValueOf(math.Min), + "MinInt16": ValueOf(math.MinInt16), + "MinInt32": ValueOf(math.MinInt32), + "MinInt64": ValueOf(int64(math.MinInt64)), + "MinInt8": ValueOf(math.MinInt8), + "Mod": ValueOf(math.Mod), + "Modf": ValueOf(math.Modf), + "NaN": ValueOf(math.NaN), + "Nextafter": ValueOf(math.Nextafter), + "Nextafter32": ValueOf(math.Nextafter32), + "Phi": ValueOf(math.Phi), + "Pi": ValueOf(math.Pi), + "Pow": ValueOf(math.Pow), + "Pow10": ValueOf(math.Pow10), + "Remainder": ValueOf(math.Remainder), + "Signbit": ValueOf(math.Signbit), + "Sin": ValueOf(math.Sin), + "Sincos": ValueOf(math.Sincos), + "Sinh": ValueOf(math.Sinh), + "SmallestNonzeroFloat32": ValueOf(math.SmallestNonzeroFloat32), + "SmallestNonzeroFloat64": ValueOf(math.SmallestNonzeroFloat64), + "Sqrt": ValueOf(math.Sqrt), + "Sqrt2": ValueOf(math.Sqrt2), + "SqrtE": ValueOf(math.SqrtE), + "SqrtPhi": ValueOf(math.SqrtPhi), + "SqrtPi": ValueOf(math.SqrtPi), + "Tan": ValueOf(math.Tan), + "Tanh": ValueOf(math.Tanh), + "Trunc": ValueOf(math.Trunc), + "Y0": ValueOf(math.Y0), + "Y1": ValueOf(math.Y1), + "Yn": ValueOf(math.Yn), + },Untypeds: map[string]string{ + "E": "float:9111550163858012281440901732746538838772262590143654133938674751170893736363860704678356685906435473285900222617098459660313571825500424586151709661124231/3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024", + "Ln10": "float:7718154667303294525535807123668701784088749544639269844330854713417502399132378792470215254015532173856280403153541607081951593465883977341501885089972609/3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024", + "Ln2": "float:1161698033016123487673055082581635139703829175621884955134501220495379707050587855317621548207870502811545419056917762934492002063302542007440018497053197/1675975991242824637446753124775730765934920727574049172215445180465220503759193372100234287270862928461253982273310756356719235351493321243304206125760512", + "Log10E": "float:11645873996785463169335113650913961638081378781380835843607526526887199042223674282440048773139860374459897757791791429659694786306613464090293660335282213/26815615859885194199148049996411692254958731641184786755447122887443528060147093953603748596333806855380063716372972101707507765623893139892867298012168192", + "Log2E": "float:9671689004859951471451510700966227821397578809549890556103133486120211484101236374917210827834571490990560020909793651977303669442567160330196651027673915/6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042048", + "MaxFloat32": "float:340282346638528859811704183484516925440", + "MaxFloat64": "float:179769313486231570814527423731704356798100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001726091719747851502452248840877809013992353692576760003314411346346787114201583914540245118557675136988317857687302483414838584368727290187675497882714112", + "MaxInt16": "int:32767", + "MaxInt32": "int:2147483647", + "MaxInt64": "int:9223372036854775807", + "MaxInt8": "int:127", + "MaxUint16": "int:65535", + "MaxUint32": "int:4294967295", + "MaxUint64": "int:18446744073709551615", + "MaxUint8": "int:255", + "MinInt16": "int:-32768", + "MinInt32": "int:-2147483648", + "MinInt64": "int:-9223372036854775808", + "MinInt8": "int:-128", + "Phi": "float:1355893059079843193030097015621153611996040418655586468942144325530191466769501318141688179946842310342863020505846766772662711907185210172534864277556413/837987995621412318723376562387865382967460363787024586107722590232610251879596686050117143635431464230626991136655378178359617675746660621652103062880256", + "Pi": "float:5265233861681329527430852685569923513156999664186156825699335632145130833652529926715379955630651875029455043336995646403337241248353639932329607400740841/1675975991242824637446753124775730765934920727574049172215445180465220503759193372100234287270862928461253982273310756356719235351493321243304206125760512", + "SmallestNonzeroFloat32": "float:13407807929942597099574024998205846127476859526281406305997157614053697519758116209723839542388419390837860564546892625342279307746235762181839259274038433/9568131466127621947163770315237577352582483950433331955534014747297500715462012198465648064079848065788579276806882658480425438483841942548911565191978080929321047135323978360596199778018349602045952", + "SmallestNonzeroFloat64": "float:837987995621412318723376562387865382967528542837591553054231272745319198424369655365935231952608328604793302723807080372339569516882534924689845329132395/169610658558250597457949882757253129256512582825232846524880306601538402823521241146029596619315984411186040958942601714115551210232864300981082979971362343290567722620469726473734686654453609615462992711162886914312002548467323965655079024463264900175579232518184090858573444982995938918601148906296146506082388046271954770533990741509051865409843001664221654092011338230906199419669398139261492786445466233786170361793273957887549496248290745722916589964061626271423952584704", + "Sqrt2": "float:2370187977027294181708131613913039815021135436007832465948110837130147201951018863264485267316490927583884794148767707476886477873843439514530955153130291/1675975991242824637446753124775730765934920727574049172215445180465220503759193372100234287270862928461253982273310756356719235351493321243304206125760512", + "SqrtE": "float:5526434531889553359100339527602551136535293759178014794854010166956579300433867493319128312730236202227030041787483535082815593803939658073242247126443667/3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024", + "SqrtPhi": "float:4263748785949384222047394170590505028114438860640840609262555507082501186239921195173529474565705679454046425697050803084649101634749198923578942876946925/3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024", + "SqrtPi": "float:5941180199407067869909325294831655792192555130773991214446196790352931403459697425080809383647149191660934688457292053536928055420572552259905515759885317/3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/math_big.go b/vendor/github.com/cosmos72/gomacro/imports/math_big.go new file mode 100644 index 0000000..0bf0aed --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/math_big.go @@ -0,0 +1,48 @@ +// this file was generated by gomacro command: import _b "math/big" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "math/big" +) + +// reflection: allow interpreted code to import "math/big" +func init() { + Packages["math/big"] = Package{ + Binds: map[string]Value{ + "Above": ValueOf(big.Above), + "AwayFromZero": ValueOf(big.AwayFromZero), + "Below": ValueOf(big.Below), + "Exact": ValueOf(big.Exact), + "Jacobi": ValueOf(big.Jacobi), + "MaxBase": ValueOf(big.MaxBase), + "MaxExp": ValueOf(big.MaxExp), + "MaxPrec": ValueOf(uint32(big.MaxPrec)), + "MinExp": ValueOf(big.MinExp), + "NewFloat": ValueOf(big.NewFloat), + "NewInt": ValueOf(big.NewInt), + "NewRat": ValueOf(big.NewRat), + "ParseFloat": ValueOf(big.ParseFloat), + "ToNearestAway": ValueOf(big.ToNearestAway), + "ToNearestEven": ValueOf(big.ToNearestEven), + "ToNegativeInf": ValueOf(big.ToNegativeInf), + "ToPositiveInf": ValueOf(big.ToPositiveInf), + "ToZero": ValueOf(big.ToZero), + },Types: map[string]Type{ + "Accuracy": TypeOf((*big.Accuracy)(nil)).Elem(), + "ErrNaN": TypeOf((*big.ErrNaN)(nil)).Elem(), + "Float": TypeOf((*big.Float)(nil)).Elem(), + "Int": TypeOf((*big.Int)(nil)).Elem(), + "Rat": TypeOf((*big.Rat)(nil)).Elem(), + "RoundingMode": TypeOf((*big.RoundingMode)(nil)).Elem(), + "Word": TypeOf((*big.Word)(nil)).Elem(), + },Untypeds: map[string]string{ + "MaxBase": "rune:36", + "MaxExp": "int:2147483647", + "MaxPrec": "int:4294967295", + "MinExp": "int:-2147483648", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/math_cmplx.go b/vendor/github.com/cosmos72/gomacro/imports/math_cmplx.go new file mode 100644 index 0000000..b24939f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/math_cmplx.go @@ -0,0 +1,44 @@ +// this file was generated by gomacro command: import _b "math/cmplx" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "math/cmplx" +) + +// reflection: allow interpreted code to import "math/cmplx" +func init() { + Packages["math/cmplx"] = Package{ + Binds: map[string]Value{ + "Abs": ValueOf(cmplx.Abs), + "Acos": ValueOf(cmplx.Acos), + "Acosh": ValueOf(cmplx.Acosh), + "Asin": ValueOf(cmplx.Asin), + "Asinh": ValueOf(cmplx.Asinh), + "Atan": ValueOf(cmplx.Atan), + "Atanh": ValueOf(cmplx.Atanh), + "Conj": ValueOf(cmplx.Conj), + "Cos": ValueOf(cmplx.Cos), + "Cosh": ValueOf(cmplx.Cosh), + "Cot": ValueOf(cmplx.Cot), + "Exp": ValueOf(cmplx.Exp), + "Inf": ValueOf(cmplx.Inf), + "IsInf": ValueOf(cmplx.IsInf), + "IsNaN": ValueOf(cmplx.IsNaN), + "Log": ValueOf(cmplx.Log), + "Log10": ValueOf(cmplx.Log10), + "NaN": ValueOf(cmplx.NaN), + "Phase": ValueOf(cmplx.Phase), + "Polar": ValueOf(cmplx.Polar), + "Pow": ValueOf(cmplx.Pow), + "Rect": ValueOf(cmplx.Rect), + "Sin": ValueOf(cmplx.Sin), + "Sinh": ValueOf(cmplx.Sinh), + "Sqrt": ValueOf(cmplx.Sqrt), + "Tan": ValueOf(cmplx.Tan), + "Tanh": ValueOf(cmplx.Tanh), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/math_rand.go b/vendor/github.com/cosmos72/gomacro/imports/math_rand.go new file mode 100644 index 0000000..735c33b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/math_rand.go @@ -0,0 +1,73 @@ +// this file was generated by gomacro command: import _b "math/rand" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "math/rand" +) + +// reflection: allow interpreted code to import "math/rand" +func init() { + Packages["math/rand"] = Package{ + Binds: map[string]Value{ + "ExpFloat64": ValueOf(rand.ExpFloat64), + "Float32": ValueOf(rand.Float32), + "Float64": ValueOf(rand.Float64), + "Int": ValueOf(rand.Int), + "Int31": ValueOf(rand.Int31), + "Int31n": ValueOf(rand.Int31n), + "Int63": ValueOf(rand.Int63), + "Int63n": ValueOf(rand.Int63n), + "Intn": ValueOf(rand.Intn), + "New": ValueOf(rand.New), + "NewSource": ValueOf(rand.NewSource), + "NewZipf": ValueOf(rand.NewZipf), + "NormFloat64": ValueOf(rand.NormFloat64), + "Perm": ValueOf(rand.Perm), + "Read": ValueOf(rand.Read), + "Seed": ValueOf(rand.Seed), + "Uint32": ValueOf(rand.Uint32), + "Uint64": ValueOf(rand.Uint64), + },Types: map[string]Type{ + "Rand": TypeOf((*rand.Rand)(nil)).Elem(), + "Source": TypeOf((*rand.Source)(nil)).Elem(), + "Source64": TypeOf((*rand.Source64)(nil)).Elem(), + "Zipf": TypeOf((*rand.Zipf)(nil)).Elem(), + },Proxies: map[string]Type{ + "Source": TypeOf((*Source_math_rand)(nil)).Elem(), + "Source64": TypeOf((*Source64_math_rand)(nil)).Elem(), + }, + } +} + +// --------------- proxy for math/rand.Source --------------- +type Source_math_rand struct { + Object interface{} + Int63_ func(interface{}) int64 + Seed_ func(_proxy_obj_ interface{}, seed int64) +} +func (Proxy *Source_math_rand) Int63() int64 { + return Proxy.Int63_(Proxy.Object) +} +func (Proxy *Source_math_rand) Seed(seed int64) { + Proxy.Seed_(Proxy.Object, seed) +} + +// --------------- proxy for math/rand.Source64 --------------- +type Source64_math_rand struct { + Object interface{} + Int63_ func(interface{}) int64 + Seed_ func(_proxy_obj_ interface{}, seed int64) + Uint64_ func(interface{}) uint64 +} +func (Proxy *Source64_math_rand) Int63() int64 { + return Proxy.Int63_(Proxy.Object) +} +func (Proxy *Source64_math_rand) Seed(seed int64) { + Proxy.Seed_(Proxy.Object, seed) +} +func (Proxy *Source64_math_rand) Uint64() uint64 { + return Proxy.Uint64_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/mime.go b/vendor/github.com/cosmos72/gomacro/imports/mime.go new file mode 100644 index 0000000..9fb683b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/mime.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "mime" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "mime" +) + +// reflection: allow interpreted code to import "mime" +func init() { + Packages["mime"] = Package{ + Binds: map[string]Value{ + "AddExtensionType": ValueOf(mime.AddExtensionType), + "BEncoding": ValueOf(mime.BEncoding), + "ExtensionsByType": ValueOf(mime.ExtensionsByType), + "FormatMediaType": ValueOf(mime.FormatMediaType), + "ParseMediaType": ValueOf(mime.ParseMediaType), + "QEncoding": ValueOf(mime.QEncoding), + "TypeByExtension": ValueOf(mime.TypeByExtension), + },Types: map[string]Type{ + "WordDecoder": TypeOf((*mime.WordDecoder)(nil)).Elem(), + "WordEncoder": TypeOf((*mime.WordEncoder)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/mime_multipart.go b/vendor/github.com/cosmos72/gomacro/imports/mime_multipart.go new file mode 100644 index 0000000..73bc4da --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/mime_multipart.go @@ -0,0 +1,49 @@ +// this file was generated by gomacro command: import _b "mime/multipart" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "mime/multipart" +) + +// reflection: allow interpreted code to import "mime/multipart" +func init() { + Packages["mime/multipart"] = Package{ + Binds: map[string]Value{ + "NewReader": ValueOf(multipart.NewReader), + "NewWriter": ValueOf(multipart.NewWriter), + },Types: map[string]Type{ + "File": TypeOf((*multipart.File)(nil)).Elem(), + "FileHeader": TypeOf((*multipart.FileHeader)(nil)).Elem(), + "Form": TypeOf((*multipart.Form)(nil)).Elem(), + "Part": TypeOf((*multipart.Part)(nil)).Elem(), + "Reader": TypeOf((*multipart.Reader)(nil)).Elem(), + "Writer": TypeOf((*multipart.Writer)(nil)).Elem(), + },Proxies: map[string]Type{ + "File": TypeOf((*File_mime_multipart)(nil)).Elem(), + }, + } +} + +// --------------- proxy for mime/multipart.File --------------- +type File_mime_multipart struct { + Object interface{} + Close_ func(interface{}) error + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + ReadAt_ func(_proxy_obj_ interface{}, p []byte, off int64) (n int, err error) + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) +} +func (Proxy *File_mime_multipart) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *File_mime_multipart) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *File_mime_multipart) ReadAt(p []byte, off int64) (n int, err error) { + return Proxy.ReadAt_(Proxy.Object, p, off) +} +func (Proxy *File_mime_multipart) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/mime_quotedprintable.go b/vendor/github.com/cosmos72/gomacro/imports/mime_quotedprintable.go new file mode 100644 index 0000000..3a46c3b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/mime_quotedprintable.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "mime/quotedprintable" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "mime/quotedprintable" +) + +// reflection: allow interpreted code to import "mime/quotedprintable" +func init() { + Packages["mime/quotedprintable"] = Package{ + Binds: map[string]Value{ + "NewReader": ValueOf(quotedprintable.NewReader), + "NewWriter": ValueOf(quotedprintable.NewWriter), + },Types: map[string]Type{ + "Reader": TypeOf((*quotedprintable.Reader)(nil)).Elem(), + "Writer": TypeOf((*quotedprintable.Writer)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net.go b/vendor/github.com/cosmos72/gomacro/imports/net.go new file mode 100644 index 0000000..57273fa --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net.go @@ -0,0 +1,246 @@ +// this file was generated by gomacro command: import _b "net" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net" + "time" +) + +// reflection: allow interpreted code to import "net" +func init() { + Packages["net"] = Package{ + Binds: map[string]Value{ + "CIDRMask": ValueOf(net.CIDRMask), + "DefaultResolver": ValueOf(&net.DefaultResolver).Elem(), + "Dial": ValueOf(net.Dial), + "DialIP": ValueOf(net.DialIP), + "DialTCP": ValueOf(net.DialTCP), + "DialTimeout": ValueOf(net.DialTimeout), + "DialUDP": ValueOf(net.DialUDP), + "DialUnix": ValueOf(net.DialUnix), + "ErrWriteToConnected": ValueOf(&net.ErrWriteToConnected).Elem(), + "FileConn": ValueOf(net.FileConn), + "FileListener": ValueOf(net.FileListener), + "FilePacketConn": ValueOf(net.FilePacketConn), + "FlagBroadcast": ValueOf(net.FlagBroadcast), + "FlagLoopback": ValueOf(net.FlagLoopback), + "FlagMulticast": ValueOf(net.FlagMulticast), + "FlagPointToPoint": ValueOf(net.FlagPointToPoint), + "FlagUp": ValueOf(net.FlagUp), + "IPv4": ValueOf(net.IPv4), + "IPv4Mask": ValueOf(net.IPv4Mask), + "IPv4allrouter": ValueOf(&net.IPv4allrouter).Elem(), + "IPv4allsys": ValueOf(&net.IPv4allsys).Elem(), + "IPv4bcast": ValueOf(&net.IPv4bcast).Elem(), + "IPv4len": ValueOf(net.IPv4len), + "IPv4zero": ValueOf(&net.IPv4zero).Elem(), + "IPv6interfacelocalallnodes": ValueOf(&net.IPv6interfacelocalallnodes).Elem(), + "IPv6len": ValueOf(net.IPv6len), + "IPv6linklocalallnodes": ValueOf(&net.IPv6linklocalallnodes).Elem(), + "IPv6linklocalallrouters": ValueOf(&net.IPv6linklocalallrouters).Elem(), + "IPv6loopback": ValueOf(&net.IPv6loopback).Elem(), + "IPv6unspecified": ValueOf(&net.IPv6unspecified).Elem(), + "IPv6zero": ValueOf(&net.IPv6zero).Elem(), + "InterfaceAddrs": ValueOf(net.InterfaceAddrs), + "InterfaceByIndex": ValueOf(net.InterfaceByIndex), + "InterfaceByName": ValueOf(net.InterfaceByName), + "Interfaces": ValueOf(net.Interfaces), + "JoinHostPort": ValueOf(net.JoinHostPort), + "Listen": ValueOf(net.Listen), + "ListenIP": ValueOf(net.ListenIP), + "ListenMulticastUDP": ValueOf(net.ListenMulticastUDP), + "ListenPacket": ValueOf(net.ListenPacket), + "ListenTCP": ValueOf(net.ListenTCP), + "ListenUDP": ValueOf(net.ListenUDP), + "ListenUnix": ValueOf(net.ListenUnix), + "ListenUnixgram": ValueOf(net.ListenUnixgram), + "LookupAddr": ValueOf(net.LookupAddr), + "LookupCNAME": ValueOf(net.LookupCNAME), + "LookupHost": ValueOf(net.LookupHost), + "LookupIP": ValueOf(net.LookupIP), + "LookupMX": ValueOf(net.LookupMX), + "LookupNS": ValueOf(net.LookupNS), + "LookupPort": ValueOf(net.LookupPort), + "LookupSRV": ValueOf(net.LookupSRV), + "LookupTXT": ValueOf(net.LookupTXT), + "ParseCIDR": ValueOf(net.ParseCIDR), + "ParseIP": ValueOf(net.ParseIP), + "ParseMAC": ValueOf(net.ParseMAC), + "Pipe": ValueOf(net.Pipe), + "ResolveIPAddr": ValueOf(net.ResolveIPAddr), + "ResolveTCPAddr": ValueOf(net.ResolveTCPAddr), + "ResolveUDPAddr": ValueOf(net.ResolveUDPAddr), + "ResolveUnixAddr": ValueOf(net.ResolveUnixAddr), + "SplitHostPort": ValueOf(net.SplitHostPort), + },Types: map[string]Type{ + "Addr": TypeOf((*net.Addr)(nil)).Elem(), + "AddrError": TypeOf((*net.AddrError)(nil)).Elem(), + "Buffers": TypeOf((*net.Buffers)(nil)).Elem(), + "Conn": TypeOf((*net.Conn)(nil)).Elem(), + "DNSConfigError": TypeOf((*net.DNSConfigError)(nil)).Elem(), + "DNSError": TypeOf((*net.DNSError)(nil)).Elem(), + "Dialer": TypeOf((*net.Dialer)(nil)).Elem(), + "Error": TypeOf((*net.Error)(nil)).Elem(), + "Flags": TypeOf((*net.Flags)(nil)).Elem(), + "HardwareAddr": TypeOf((*net.HardwareAddr)(nil)).Elem(), + "IP": TypeOf((*net.IP)(nil)).Elem(), + "IPAddr": TypeOf((*net.IPAddr)(nil)).Elem(), + "IPConn": TypeOf((*net.IPConn)(nil)).Elem(), + "IPMask": TypeOf((*net.IPMask)(nil)).Elem(), + "IPNet": TypeOf((*net.IPNet)(nil)).Elem(), + "Interface": TypeOf((*net.Interface)(nil)).Elem(), + "InvalidAddrError": TypeOf((*net.InvalidAddrError)(nil)).Elem(), + "Listener": TypeOf((*net.Listener)(nil)).Elem(), + "MX": TypeOf((*net.MX)(nil)).Elem(), + "NS": TypeOf((*net.NS)(nil)).Elem(), + "OpError": TypeOf((*net.OpError)(nil)).Elem(), + "PacketConn": TypeOf((*net.PacketConn)(nil)).Elem(), + "ParseError": TypeOf((*net.ParseError)(nil)).Elem(), + "Resolver": TypeOf((*net.Resolver)(nil)).Elem(), + "SRV": TypeOf((*net.SRV)(nil)).Elem(), + "TCPAddr": TypeOf((*net.TCPAddr)(nil)).Elem(), + "TCPConn": TypeOf((*net.TCPConn)(nil)).Elem(), + "TCPListener": TypeOf((*net.TCPListener)(nil)).Elem(), + "UDPAddr": TypeOf((*net.UDPAddr)(nil)).Elem(), + "UDPConn": TypeOf((*net.UDPConn)(nil)).Elem(), + "UnixAddr": TypeOf((*net.UnixAddr)(nil)).Elem(), + "UnixConn": TypeOf((*net.UnixConn)(nil)).Elem(), + "UnixListener": TypeOf((*net.UnixListener)(nil)).Elem(), + "UnknownNetworkError": TypeOf((*net.UnknownNetworkError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Addr": TypeOf((*Addr_net)(nil)).Elem(), + "Conn": TypeOf((*Conn_net)(nil)).Elem(), + "Error": TypeOf((*Error_net)(nil)).Elem(), + "Listener": TypeOf((*Listener_net)(nil)).Elem(), + "PacketConn": TypeOf((*PacketConn_net)(nil)).Elem(), + },Untypeds: map[string]string{ + "IPv4len": "int:4", + "IPv6len": "int:16", + },Wrappers: map[string][]string{ + "IPConn": []string{"Close","File","LocalAddr","Read","RemoteAddr","SetDeadline","SetReadBuffer","SetReadDeadline","SetWriteBuffer","SetWriteDeadline","Write",}, + "TCPConn": []string{"Close","File","LocalAddr","Read","RemoteAddr","SetDeadline","SetReadBuffer","SetReadDeadline","SetWriteBuffer","SetWriteDeadline","Write",}, + "UDPConn": []string{"Close","File","LocalAddr","Read","RemoteAddr","SetDeadline","SetReadBuffer","SetReadDeadline","SetWriteBuffer","SetWriteDeadline","Write",}, + "UnixConn": []string{"Close","File","LocalAddr","Read","RemoteAddr","SetDeadline","SetReadBuffer","SetReadDeadline","SetWriteBuffer","SetWriteDeadline","Write",}, + }, + } +} + +// --------------- proxy for net.Addr --------------- +type Addr_net struct { + Object interface{} + Network_ func(interface{}) string + String_ func(interface{}) string +} +func (Proxy *Addr_net) Network() string { + return Proxy.Network_(Proxy.Object) +} +func (Proxy *Addr_net) String() string { + return Proxy.String_(Proxy.Object) +} + +// --------------- proxy for net.Conn --------------- +type Conn_net struct { + Object interface{} + Close_ func(interface{}) error + LocalAddr_ func(interface{}) net.Addr + Read_ func(_proxy_obj_ interface{}, b []byte) (n int, err error) + RemoteAddr_ func(interface{}) net.Addr + SetDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + SetReadDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + SetWriteDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + Write_ func(_proxy_obj_ interface{}, b []byte) (n int, err error) +} +func (Proxy *Conn_net) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *Conn_net) LocalAddr() net.Addr { + return Proxy.LocalAddr_(Proxy.Object) +} +func (Proxy *Conn_net) Read(b []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, b) +} +func (Proxy *Conn_net) RemoteAddr() net.Addr { + return Proxy.RemoteAddr_(Proxy.Object) +} +func (Proxy *Conn_net) SetDeadline(t time.Time) error { + return Proxy.SetDeadline_(Proxy.Object, t) +} +func (Proxy *Conn_net) SetReadDeadline(t time.Time) error { + return Proxy.SetReadDeadline_(Proxy.Object, t) +} +func (Proxy *Conn_net) SetWriteDeadline(t time.Time) error { + return Proxy.SetWriteDeadline_(Proxy.Object, t) +} +func (Proxy *Conn_net) Write(b []byte) (n int, err error) { + return Proxy.Write_(Proxy.Object, b) +} + +// --------------- proxy for net.Error --------------- +type Error_net struct { + Object interface{} + Error_ func(interface{}) string + Temporary_ func(interface{}) bool + Timeout_ func(interface{}) bool +} +func (Proxy *Error_net) Error() string { + return Proxy.Error_(Proxy.Object) +} +func (Proxy *Error_net) Temporary() bool { + return Proxy.Temporary_(Proxy.Object) +} +func (Proxy *Error_net) Timeout() bool { + return Proxy.Timeout_(Proxy.Object) +} + +// --------------- proxy for net.Listener --------------- +type Listener_net struct { + Object interface{} + Accept_ func(interface{}) (net.Conn, error) + Addr_ func(interface{}) net.Addr + Close_ func(interface{}) error +} +func (Proxy *Listener_net) Accept() (net.Conn, error) { + return Proxy.Accept_(Proxy.Object) +} +func (Proxy *Listener_net) Addr() net.Addr { + return Proxy.Addr_(Proxy.Object) +} +func (Proxy *Listener_net) Close() error { + return Proxy.Close_(Proxy.Object) +} + +// --------------- proxy for net.PacketConn --------------- +type PacketConn_net struct { + Object interface{} + Close_ func(interface{}) error + LocalAddr_ func(interface{}) net.Addr + ReadFrom_ func(_proxy_obj_ interface{}, b []byte) (n int, addr net.Addr, err error) + SetDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + SetReadDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + SetWriteDeadline_ func(_proxy_obj_ interface{}, t time.Time) error + WriteTo_ func(_proxy_obj_ interface{}, b []byte, addr net.Addr) (n int, err error) +} +func (Proxy *PacketConn_net) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *PacketConn_net) LocalAddr() net.Addr { + return Proxy.LocalAddr_(Proxy.Object) +} +func (Proxy *PacketConn_net) ReadFrom(b []byte) (n int, addr net.Addr, err error) { + return Proxy.ReadFrom_(Proxy.Object, b) +} +func (Proxy *PacketConn_net) SetDeadline(t time.Time) error { + return Proxy.SetDeadline_(Proxy.Object, t) +} +func (Proxy *PacketConn_net) SetReadDeadline(t time.Time) error { + return Proxy.SetReadDeadline_(Proxy.Object, t) +} +func (Proxy *PacketConn_net) SetWriteDeadline(t time.Time) error { + return Proxy.SetWriteDeadline_(Proxy.Object, t) +} +func (Proxy *PacketConn_net) WriteTo(b []byte, addr net.Addr) (n int, err error) { + return Proxy.WriteTo_(Proxy.Object, b, addr) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http.go b/vendor/github.com/cosmos72/gomacro/imports/net_http.go new file mode 100644 index 0000000..450c1e4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http.go @@ -0,0 +1,384 @@ +// this file was generated by gomacro command: import _b "net/http" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "bufio" + "net" + "net/http" + "net/url" + "os" +) + +// reflection: allow interpreted code to import "net/http" +func init() { + Packages["net/http"] = Package{ + Binds: map[string]Value{ + "CanonicalHeaderKey": ValueOf(http.CanonicalHeaderKey), + "DefaultClient": ValueOf(&http.DefaultClient).Elem(), + "DefaultMaxHeaderBytes": ValueOf(http.DefaultMaxHeaderBytes), + "DefaultMaxIdleConnsPerHost": ValueOf(http.DefaultMaxIdleConnsPerHost), + "DefaultServeMux": ValueOf(&http.DefaultServeMux).Elem(), + "DefaultTransport": ValueOf(&http.DefaultTransport).Elem(), + "DetectContentType": ValueOf(http.DetectContentType), + "ErrAbortHandler": ValueOf(&http.ErrAbortHandler).Elem(), + "ErrBodyNotAllowed": ValueOf(&http.ErrBodyNotAllowed).Elem(), + "ErrBodyReadAfterClose": ValueOf(&http.ErrBodyReadAfterClose).Elem(), + "ErrContentLength": ValueOf(&http.ErrContentLength).Elem(), + "ErrHandlerTimeout": ValueOf(&http.ErrHandlerTimeout).Elem(), + "ErrHeaderTooLong": ValueOf(&http.ErrHeaderTooLong).Elem(), + "ErrHijacked": ValueOf(&http.ErrHijacked).Elem(), + "ErrLineTooLong": ValueOf(&http.ErrLineTooLong).Elem(), + "ErrMissingBoundary": ValueOf(&http.ErrMissingBoundary).Elem(), + "ErrMissingContentLength": ValueOf(&http.ErrMissingContentLength).Elem(), + "ErrMissingFile": ValueOf(&http.ErrMissingFile).Elem(), + "ErrNoCookie": ValueOf(&http.ErrNoCookie).Elem(), + "ErrNoLocation": ValueOf(&http.ErrNoLocation).Elem(), + "ErrNotMultipart": ValueOf(&http.ErrNotMultipart).Elem(), + "ErrNotSupported": ValueOf(&http.ErrNotSupported).Elem(), + "ErrServerClosed": ValueOf(&http.ErrServerClosed).Elem(), + "ErrShortBody": ValueOf(&http.ErrShortBody).Elem(), + "ErrSkipAltProtocol": ValueOf(&http.ErrSkipAltProtocol).Elem(), + "ErrUnexpectedTrailer": ValueOf(&http.ErrUnexpectedTrailer).Elem(), + "ErrUseLastResponse": ValueOf(&http.ErrUseLastResponse).Elem(), + "ErrWriteAfterFlush": ValueOf(&http.ErrWriteAfterFlush).Elem(), + "Error": ValueOf(http.Error), + "FileServer": ValueOf(http.FileServer), + "Get": ValueOf(http.Get), + "Handle": ValueOf(http.Handle), + "HandleFunc": ValueOf(http.HandleFunc), + "Head": ValueOf(http.Head), + "ListenAndServe": ValueOf(http.ListenAndServe), + "ListenAndServeTLS": ValueOf(http.ListenAndServeTLS), + "LocalAddrContextKey": ValueOf(&http.LocalAddrContextKey).Elem(), + "MaxBytesReader": ValueOf(http.MaxBytesReader), + "MethodConnect": ValueOf(http.MethodConnect), + "MethodDelete": ValueOf(http.MethodDelete), + "MethodGet": ValueOf(http.MethodGet), + "MethodHead": ValueOf(http.MethodHead), + "MethodOptions": ValueOf(http.MethodOptions), + "MethodPatch": ValueOf(http.MethodPatch), + "MethodPost": ValueOf(http.MethodPost), + "MethodPut": ValueOf(http.MethodPut), + "MethodTrace": ValueOf(http.MethodTrace), + "NewFileTransport": ValueOf(http.NewFileTransport), + "NewRequest": ValueOf(http.NewRequest), + "NewServeMux": ValueOf(http.NewServeMux), + "NoBody": ValueOf(&http.NoBody).Elem(), + "NotFound": ValueOf(http.NotFound), + "NotFoundHandler": ValueOf(http.NotFoundHandler), + "ParseHTTPVersion": ValueOf(http.ParseHTTPVersion), + "ParseTime": ValueOf(http.ParseTime), + "Post": ValueOf(http.Post), + "PostForm": ValueOf(http.PostForm), + "ProxyFromEnvironment": ValueOf(http.ProxyFromEnvironment), + "ProxyURL": ValueOf(http.ProxyURL), + "ReadRequest": ValueOf(http.ReadRequest), + "ReadResponse": ValueOf(http.ReadResponse), + "Redirect": ValueOf(http.Redirect), + "RedirectHandler": ValueOf(http.RedirectHandler), + "Serve": ValueOf(http.Serve), + "ServeContent": ValueOf(http.ServeContent), + "ServeFile": ValueOf(http.ServeFile), + "ServerContextKey": ValueOf(&http.ServerContextKey).Elem(), + "SetCookie": ValueOf(http.SetCookie), + "StateActive": ValueOf(http.StateActive), + "StateClosed": ValueOf(http.StateClosed), + "StateHijacked": ValueOf(http.StateHijacked), + "StateIdle": ValueOf(http.StateIdle), + "StateNew": ValueOf(http.StateNew), + "StatusAccepted": ValueOf(http.StatusAccepted), + "StatusAlreadyReported": ValueOf(http.StatusAlreadyReported), + "StatusBadGateway": ValueOf(http.StatusBadGateway), + "StatusBadRequest": ValueOf(http.StatusBadRequest), + "StatusConflict": ValueOf(http.StatusConflict), + "StatusContinue": ValueOf(http.StatusContinue), + "StatusCreated": ValueOf(http.StatusCreated), + "StatusExpectationFailed": ValueOf(http.StatusExpectationFailed), + "StatusFailedDependency": ValueOf(http.StatusFailedDependency), + "StatusForbidden": ValueOf(http.StatusForbidden), + "StatusFound": ValueOf(http.StatusFound), + "StatusGatewayTimeout": ValueOf(http.StatusGatewayTimeout), + "StatusGone": ValueOf(http.StatusGone), + "StatusHTTPVersionNotSupported": ValueOf(http.StatusHTTPVersionNotSupported), + "StatusIMUsed": ValueOf(http.StatusIMUsed), + "StatusInsufficientStorage": ValueOf(http.StatusInsufficientStorage), + "StatusInternalServerError": ValueOf(http.StatusInternalServerError), + "StatusLengthRequired": ValueOf(http.StatusLengthRequired), + "StatusLocked": ValueOf(http.StatusLocked), + "StatusLoopDetected": ValueOf(http.StatusLoopDetected), + "StatusMethodNotAllowed": ValueOf(http.StatusMethodNotAllowed), + "StatusMovedPermanently": ValueOf(http.StatusMovedPermanently), + "StatusMultiStatus": ValueOf(http.StatusMultiStatus), + "StatusMultipleChoices": ValueOf(http.StatusMultipleChoices), + "StatusNetworkAuthenticationRequired": ValueOf(http.StatusNetworkAuthenticationRequired), + "StatusNoContent": ValueOf(http.StatusNoContent), + "StatusNonAuthoritativeInfo": ValueOf(http.StatusNonAuthoritativeInfo), + "StatusNotAcceptable": ValueOf(http.StatusNotAcceptable), + "StatusNotExtended": ValueOf(http.StatusNotExtended), + "StatusNotFound": ValueOf(http.StatusNotFound), + "StatusNotImplemented": ValueOf(http.StatusNotImplemented), + "StatusNotModified": ValueOf(http.StatusNotModified), + "StatusOK": ValueOf(http.StatusOK), + "StatusPartialContent": ValueOf(http.StatusPartialContent), + "StatusPaymentRequired": ValueOf(http.StatusPaymentRequired), + "StatusPermanentRedirect": ValueOf(http.StatusPermanentRedirect), + "StatusPreconditionFailed": ValueOf(http.StatusPreconditionFailed), + "StatusPreconditionRequired": ValueOf(http.StatusPreconditionRequired), + "StatusProcessing": ValueOf(http.StatusProcessing), + "StatusProxyAuthRequired": ValueOf(http.StatusProxyAuthRequired), + "StatusRequestEntityTooLarge": ValueOf(http.StatusRequestEntityTooLarge), + "StatusRequestHeaderFieldsTooLarge": ValueOf(http.StatusRequestHeaderFieldsTooLarge), + "StatusRequestTimeout": ValueOf(http.StatusRequestTimeout), + "StatusRequestURITooLong": ValueOf(http.StatusRequestURITooLong), + "StatusRequestedRangeNotSatisfiable": ValueOf(http.StatusRequestedRangeNotSatisfiable), + "StatusResetContent": ValueOf(http.StatusResetContent), + "StatusSeeOther": ValueOf(http.StatusSeeOther), + "StatusServiceUnavailable": ValueOf(http.StatusServiceUnavailable), + "StatusSwitchingProtocols": ValueOf(http.StatusSwitchingProtocols), + "StatusTeapot": ValueOf(http.StatusTeapot), + "StatusTemporaryRedirect": ValueOf(http.StatusTemporaryRedirect), + "StatusText": ValueOf(http.StatusText), + "StatusTooManyRequests": ValueOf(http.StatusTooManyRequests), + "StatusUnauthorized": ValueOf(http.StatusUnauthorized), + "StatusUnavailableForLegalReasons": ValueOf(http.StatusUnavailableForLegalReasons), + "StatusUnprocessableEntity": ValueOf(http.StatusUnprocessableEntity), + "StatusUnsupportedMediaType": ValueOf(http.StatusUnsupportedMediaType), + "StatusUpgradeRequired": ValueOf(http.StatusUpgradeRequired), + "StatusUseProxy": ValueOf(http.StatusUseProxy), + "StatusVariantAlsoNegotiates": ValueOf(http.StatusVariantAlsoNegotiates), + "StripPrefix": ValueOf(http.StripPrefix), + "TimeFormat": ValueOf(http.TimeFormat), + "TimeoutHandler": ValueOf(http.TimeoutHandler), + "TrailerPrefix": ValueOf(http.TrailerPrefix), + },Types: map[string]Type{ + "Client": TypeOf((*http.Client)(nil)).Elem(), + "CloseNotifier": TypeOf((*http.CloseNotifier)(nil)).Elem(), + "ConnState": TypeOf((*http.ConnState)(nil)).Elem(), + "Cookie": TypeOf((*http.Cookie)(nil)).Elem(), + "CookieJar": TypeOf((*http.CookieJar)(nil)).Elem(), + "Dir": TypeOf((*http.Dir)(nil)).Elem(), + "File": TypeOf((*http.File)(nil)).Elem(), + "FileSystem": TypeOf((*http.FileSystem)(nil)).Elem(), + "Flusher": TypeOf((*http.Flusher)(nil)).Elem(), + "Handler": TypeOf((*http.Handler)(nil)).Elem(), + "HandlerFunc": TypeOf((*http.HandlerFunc)(nil)).Elem(), + "Header": TypeOf((*http.Header)(nil)).Elem(), + "Hijacker": TypeOf((*http.Hijacker)(nil)).Elem(), + "ProtocolError": TypeOf((*http.ProtocolError)(nil)).Elem(), + "PushOptions": TypeOf((*http.PushOptions)(nil)).Elem(), + "Pusher": TypeOf((*http.Pusher)(nil)).Elem(), + "Request": TypeOf((*http.Request)(nil)).Elem(), + "Response": TypeOf((*http.Response)(nil)).Elem(), + "ResponseWriter": TypeOf((*http.ResponseWriter)(nil)).Elem(), + "RoundTripper": TypeOf((*http.RoundTripper)(nil)).Elem(), + "ServeMux": TypeOf((*http.ServeMux)(nil)).Elem(), + "Server": TypeOf((*http.Server)(nil)).Elem(), + "Transport": TypeOf((*http.Transport)(nil)).Elem(), + },Proxies: map[string]Type{ + "CloseNotifier": TypeOf((*CloseNotifier_net_http)(nil)).Elem(), + "CookieJar": TypeOf((*CookieJar_net_http)(nil)).Elem(), + "File": TypeOf((*File_net_http)(nil)).Elem(), + "FileSystem": TypeOf((*FileSystem_net_http)(nil)).Elem(), + "Flusher": TypeOf((*Flusher_net_http)(nil)).Elem(), + "Handler": TypeOf((*Handler_net_http)(nil)).Elem(), + "Hijacker": TypeOf((*Hijacker_net_http)(nil)).Elem(), + "Pusher": TypeOf((*Pusher_net_http)(nil)).Elem(), + "ResponseWriter": TypeOf((*ResponseWriter_net_http)(nil)).Elem(), + "RoundTripper": TypeOf((*RoundTripper_net_http)(nil)).Elem(), + },Untypeds: map[string]string{ + "DefaultMaxHeaderBytes": "int:1048576", + "DefaultMaxIdleConnsPerHost": "int:2", + "MethodConnect": "string:CONNECT", + "MethodDelete": "string:DELETE", + "MethodGet": "string:GET", + "MethodHead": "string:HEAD", + "MethodOptions": "string:OPTIONS", + "MethodPatch": "string:PATCH", + "MethodPost": "string:POST", + "MethodPut": "string:PUT", + "MethodTrace": "string:TRACE", + "StatusAccepted": "int:202", + "StatusAlreadyReported": "int:208", + "StatusBadGateway": "int:502", + "StatusBadRequest": "int:400", + "StatusConflict": "int:409", + "StatusContinue": "int:100", + "StatusCreated": "int:201", + "StatusExpectationFailed": "int:417", + "StatusFailedDependency": "int:424", + "StatusForbidden": "int:403", + "StatusFound": "int:302", + "StatusGatewayTimeout": "int:504", + "StatusGone": "int:410", + "StatusHTTPVersionNotSupported": "int:505", + "StatusIMUsed": "int:226", + "StatusInsufficientStorage": "int:507", + "StatusInternalServerError": "int:500", + "StatusLengthRequired": "int:411", + "StatusLocked": "int:423", + "StatusLoopDetected": "int:508", + "StatusMethodNotAllowed": "int:405", + "StatusMovedPermanently": "int:301", + "StatusMultiStatus": "int:207", + "StatusMultipleChoices": "int:300", + "StatusNetworkAuthenticationRequired": "int:511", + "StatusNoContent": "int:204", + "StatusNonAuthoritativeInfo": "int:203", + "StatusNotAcceptable": "int:406", + "StatusNotExtended": "int:510", + "StatusNotFound": "int:404", + "StatusNotImplemented": "int:501", + "StatusNotModified": "int:304", + "StatusOK": "int:200", + "StatusPartialContent": "int:206", + "StatusPaymentRequired": "int:402", + "StatusPermanentRedirect": "int:308", + "StatusPreconditionFailed": "int:412", + "StatusPreconditionRequired": "int:428", + "StatusProcessing": "int:102", + "StatusProxyAuthRequired": "int:407", + "StatusRequestEntityTooLarge": "int:413", + "StatusRequestHeaderFieldsTooLarge": "int:431", + "StatusRequestTimeout": "int:408", + "StatusRequestURITooLong": "int:414", + "StatusRequestedRangeNotSatisfiable": "int:416", + "StatusResetContent": "int:205", + "StatusSeeOther": "int:303", + "StatusServiceUnavailable": "int:503", + "StatusSwitchingProtocols": "int:101", + "StatusTeapot": "int:418", + "StatusTemporaryRedirect": "int:307", + "StatusTooManyRequests": "int:429", + "StatusUnauthorized": "int:401", + "StatusUnavailableForLegalReasons": "int:451", + "StatusUnprocessableEntity": "int:422", + "StatusUnsupportedMediaType": "int:415", + "StatusUpgradeRequired": "int:426", + "StatusUseProxy": "int:305", + "StatusVariantAlsoNegotiates": "int:506", + "TimeFormat": "string:Mon, 02 Jan 2006 15:04:05 GMT", + "TrailerPrefix": "string:Trailer:", + }, + } +} + +// --------------- proxy for net/http.CloseNotifier --------------- +type CloseNotifier_net_http struct { + Object interface{} + CloseNotify_ func(interface{}) <-chan bool +} +func (Proxy *CloseNotifier_net_http) CloseNotify() <-chan bool { + return Proxy.CloseNotify_(Proxy.Object) +} + +// --------------- proxy for net/http.CookieJar --------------- +type CookieJar_net_http struct { + Object interface{} + Cookies_ func(_proxy_obj_ interface{}, u *url.URL) []*http.Cookie + SetCookies_ func(_proxy_obj_ interface{}, u *url.URL, cookies []*http.Cookie) +} +func (Proxy *CookieJar_net_http) Cookies(u *url.URL) []*http.Cookie { + return Proxy.Cookies_(Proxy.Object, u) +} +func (Proxy *CookieJar_net_http) SetCookies(u *url.URL, cookies []*http.Cookie) { + Proxy.SetCookies_(Proxy.Object, u, cookies) +} + +// --------------- proxy for net/http.File --------------- +type File_net_http struct { + Object interface{} + Close_ func(interface{}) error + Read_ func(_proxy_obj_ interface{}, p []byte) (n int, err error) + Readdir_ func(_proxy_obj_ interface{}, count int) ([]os.FileInfo, error) + Seek_ func(_proxy_obj_ interface{}, offset int64, whence int) (int64, error) + Stat_ func(interface{}) (os.FileInfo, error) +} +func (Proxy *File_net_http) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *File_net_http) Read(p []byte) (n int, err error) { + return Proxy.Read_(Proxy.Object, p) +} +func (Proxy *File_net_http) Readdir(count int) ([]os.FileInfo, error) { + return Proxy.Readdir_(Proxy.Object, count) +} +func (Proxy *File_net_http) Seek(offset int64, whence int) (int64, error) { + return Proxy.Seek_(Proxy.Object, offset, whence) +} +func (Proxy *File_net_http) Stat() (os.FileInfo, error) { + return Proxy.Stat_(Proxy.Object) +} + +// --------------- proxy for net/http.FileSystem --------------- +type FileSystem_net_http struct { + Object interface{} + Open_ func(_proxy_obj_ interface{}, name string) (http.File, error) +} +func (Proxy *FileSystem_net_http) Open(name string) (http.File, error) { + return Proxy.Open_(Proxy.Object, name) +} + +// --------------- proxy for net/http.Flusher --------------- +type Flusher_net_http struct { + Object interface{} + Flush_ func(interface{}) +} +func (Proxy *Flusher_net_http) Flush() { + Proxy.Flush_(Proxy.Object) +} + +// --------------- proxy for net/http.Handler --------------- +type Handler_net_http struct { + Object interface{} + ServeHTTP_ func(interface{}, http.ResponseWriter, *http.Request) +} +func (Proxy *Handler_net_http) ServeHTTP(unnamed0 http.ResponseWriter, unnamed1 *http.Request) { + Proxy.ServeHTTP_(Proxy.Object, unnamed0, unnamed1) +} + +// --------------- proxy for net/http.Hijacker --------------- +type Hijacker_net_http struct { + Object interface{} + Hijack_ func(interface{}) (net.Conn, *bufio.ReadWriter, error) +} +func (Proxy *Hijacker_net_http) Hijack() (net.Conn, *bufio.ReadWriter, error) { + return Proxy.Hijack_(Proxy.Object) +} + +// --------------- proxy for net/http.Pusher --------------- +type Pusher_net_http struct { + Object interface{} + Push_ func(_proxy_obj_ interface{}, target string, opts *http.PushOptions) error +} +func (Proxy *Pusher_net_http) Push(target string, opts *http.PushOptions) error { + return Proxy.Push_(Proxy.Object, target, opts) +} + +// --------------- proxy for net/http.ResponseWriter --------------- +type ResponseWriter_net_http struct { + Object interface{} + Header_ func(interface{}) http.Header + Write_ func(interface{}, []byte) (int, error) + WriteHeader_ func(interface{}, int) +} +func (Proxy *ResponseWriter_net_http) Header() http.Header { + return Proxy.Header_(Proxy.Object) +} +func (Proxy *ResponseWriter_net_http) Write(unnamed0 []byte) (int, error) { + return Proxy.Write_(Proxy.Object, unnamed0) +} +func (Proxy *ResponseWriter_net_http) WriteHeader(unnamed0 int) { + Proxy.WriteHeader_(Proxy.Object, unnamed0) +} + +// --------------- proxy for net/http.RoundTripper --------------- +type RoundTripper_net_http struct { + Object interface{} + RoundTrip_ func(interface{}, *http.Request) (*http.Response, error) +} +func (Proxy *RoundTripper_net_http) RoundTrip(unnamed0 *http.Request) (*http.Response, error) { + return Proxy.RoundTrip_(Proxy.Object, unnamed0) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_cgi.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_cgi.go new file mode 100644 index 0000000..038eed2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_cgi.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "net/http/cgi" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/cgi" +) + +// reflection: allow interpreted code to import "net/http/cgi" +func init() { + Packages["net/http/cgi"] = Package{ + Binds: map[string]Value{ + "Request": ValueOf(cgi.Request), + "RequestFromMap": ValueOf(cgi.RequestFromMap), + "Serve": ValueOf(cgi.Serve), + },Types: map[string]Type{ + "Handler": TypeOf((*cgi.Handler)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_cookiejar.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_cookiejar.go new file mode 100644 index 0000000..c1d5329 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_cookiejar.go @@ -0,0 +1,37 @@ +// this file was generated by gomacro command: import _b "net/http/cookiejar" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/cookiejar" +) + +// reflection: allow interpreted code to import "net/http/cookiejar" +func init() { + Packages["net/http/cookiejar"] = Package{ + Binds: map[string]Value{ + "New": ValueOf(cookiejar.New), + },Types: map[string]Type{ + "Jar": TypeOf((*cookiejar.Jar)(nil)).Elem(), + "Options": TypeOf((*cookiejar.Options)(nil)).Elem(), + "PublicSuffixList": TypeOf((*cookiejar.PublicSuffixList)(nil)).Elem(), + },Proxies: map[string]Type{ + "PublicSuffixList": TypeOf((*PublicSuffixList_net_http_cookiejar)(nil)).Elem(), + }, + } +} + +// --------------- proxy for net/http/cookiejar.PublicSuffixList --------------- +type PublicSuffixList_net_http_cookiejar struct { + Object interface{} + PublicSuffix_ func(_proxy_obj_ interface{}, domain string) string + String_ func(interface{}) string +} +func (Proxy *PublicSuffixList_net_http_cookiejar) PublicSuffix(domain string) string { + return Proxy.PublicSuffix_(Proxy.Object, domain) +} +func (Proxy *PublicSuffixList_net_http_cookiejar) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_fcgi.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_fcgi.go new file mode 100644 index 0000000..0bf78e5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_fcgi.go @@ -0,0 +1,20 @@ +// this file was generated by gomacro command: import _b "net/http/fcgi" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/fcgi" +) + +// reflection: allow interpreted code to import "net/http/fcgi" +func init() { + Packages["net/http/fcgi"] = Package{ + Binds: map[string]Value{ + "ErrConnClosed": ValueOf(&fcgi.ErrConnClosed).Elem(), + "ErrRequestAborted": ValueOf(&fcgi.ErrRequestAborted).Elem(), + "Serve": ValueOf(fcgi.Serve), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_httptest.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_httptest.go new file mode 100644 index 0000000..61d2507 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_httptest.go @@ -0,0 +1,28 @@ +// this file was generated by gomacro command: import _b "net/http/httptest" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/httptest" +) + +// reflection: allow interpreted code to import "net/http/httptest" +func init() { + Packages["net/http/httptest"] = Package{ + Binds: map[string]Value{ + "DefaultRemoteAddr": ValueOf(httptest.DefaultRemoteAddr), + "NewRecorder": ValueOf(httptest.NewRecorder), + "NewRequest": ValueOf(httptest.NewRequest), + "NewServer": ValueOf(httptest.NewServer), + "NewTLSServer": ValueOf(httptest.NewTLSServer), + "NewUnstartedServer": ValueOf(httptest.NewUnstartedServer), + },Types: map[string]Type{ + "ResponseRecorder": TypeOf((*httptest.ResponseRecorder)(nil)).Elem(), + "Server": TypeOf((*httptest.Server)(nil)).Elem(), + },Untypeds: map[string]string{ + "DefaultRemoteAddr": "string:1.2.3.4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_httptrace.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_httptrace.go new file mode 100644 index 0000000..7f48d98 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_httptrace.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "net/http/httptrace" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/httptrace" +) + +// reflection: allow interpreted code to import "net/http/httptrace" +func init() { + Packages["net/http/httptrace"] = Package{ + Binds: map[string]Value{ + "ContextClientTrace": ValueOf(httptrace.ContextClientTrace), + "WithClientTrace": ValueOf(httptrace.WithClientTrace), + },Types: map[string]Type{ + "ClientTrace": TypeOf((*httptrace.ClientTrace)(nil)).Elem(), + "DNSDoneInfo": TypeOf((*httptrace.DNSDoneInfo)(nil)).Elem(), + "DNSStartInfo": TypeOf((*httptrace.DNSStartInfo)(nil)).Elem(), + "GotConnInfo": TypeOf((*httptrace.GotConnInfo)(nil)).Elem(), + "WroteRequestInfo": TypeOf((*httptrace.WroteRequestInfo)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_httputil.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_httputil.go new file mode 100644 index 0000000..12df7b6 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_httputil.go @@ -0,0 +1,50 @@ +// this file was generated by gomacro command: import _b "net/http/httputil" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/httputil" +) + +// reflection: allow interpreted code to import "net/http/httputil" +func init() { + Packages["net/http/httputil"] = Package{ + Binds: map[string]Value{ + "DumpRequest": ValueOf(httputil.DumpRequest), + "DumpRequestOut": ValueOf(httputil.DumpRequestOut), + "DumpResponse": ValueOf(httputil.DumpResponse), + "ErrClosed": ValueOf(&httputil.ErrClosed).Elem(), + "ErrLineTooLong": ValueOf(&httputil.ErrLineTooLong).Elem(), + "ErrPersistEOF": ValueOf(&httputil.ErrPersistEOF).Elem(), + "ErrPipeline": ValueOf(&httputil.ErrPipeline).Elem(), + "NewChunkedReader": ValueOf(httputil.NewChunkedReader), + "NewChunkedWriter": ValueOf(httputil.NewChunkedWriter), + "NewClientConn": ValueOf(httputil.NewClientConn), + "NewProxyClientConn": ValueOf(httputil.NewProxyClientConn), + "NewServerConn": ValueOf(httputil.NewServerConn), + "NewSingleHostReverseProxy": ValueOf(httputil.NewSingleHostReverseProxy), + },Types: map[string]Type{ + "BufferPool": TypeOf((*httputil.BufferPool)(nil)).Elem(), + "ClientConn": TypeOf((*httputil.ClientConn)(nil)).Elem(), + "ReverseProxy": TypeOf((*httputil.ReverseProxy)(nil)).Elem(), + "ServerConn": TypeOf((*httputil.ServerConn)(nil)).Elem(), + },Proxies: map[string]Type{ + "BufferPool": TypeOf((*BufferPool_net_http_httputil)(nil)).Elem(), + }, + } +} + +// --------------- proxy for net/http/httputil.BufferPool --------------- +type BufferPool_net_http_httputil struct { + Object interface{} + Get_ func(interface{}) []byte + Put_ func(interface{}, []byte) +} +func (Proxy *BufferPool_net_http_httputil) Get() []byte { + return Proxy.Get_(Proxy.Object) +} +func (Proxy *BufferPool_net_http_httputil) Put(unnamed0 []byte) { + Proxy.Put_(Proxy.Object, unnamed0) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_http_pprof.go b/vendor/github.com/cosmos72/gomacro/imports/net_http_pprof.go new file mode 100644 index 0000000..03cd526 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_http_pprof.go @@ -0,0 +1,23 @@ +// this file was generated by gomacro command: import _b "net/http/pprof" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/http/pprof" +) + +// reflection: allow interpreted code to import "net/http/pprof" +func init() { + Packages["net/http/pprof"] = Package{ + Binds: map[string]Value{ + "Cmdline": ValueOf(pprof.Cmdline), + "Handler": ValueOf(pprof.Handler), + "Index": ValueOf(pprof.Index), + "Profile": ValueOf(pprof.Profile), + "Symbol": ValueOf(pprof.Symbol), + "Trace": ValueOf(pprof.Trace), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_mail.go b/vendor/github.com/cosmos72/gomacro/imports/net_mail.go new file mode 100644 index 0000000..96ad085 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_mail.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "net/mail" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/mail" +) + +// reflection: allow interpreted code to import "net/mail" +func init() { + Packages["net/mail"] = Package{ + Binds: map[string]Value{ + "ErrHeaderNotPresent": ValueOf(&mail.ErrHeaderNotPresent).Elem(), + "ParseAddress": ValueOf(mail.ParseAddress), + "ParseAddressList": ValueOf(mail.ParseAddressList), + "ParseDate": ValueOf(mail.ParseDate), + "ReadMessage": ValueOf(mail.ReadMessage), + },Types: map[string]Type{ + "Address": TypeOf((*mail.Address)(nil)).Elem(), + "AddressParser": TypeOf((*mail.AddressParser)(nil)).Elem(), + "Header": TypeOf((*mail.Header)(nil)).Elem(), + "Message": TypeOf((*mail.Message)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_rpc.go b/vendor/github.com/cosmos72/gomacro/imports/net_rpc.go new file mode 100644 index 0000000..f1a30b5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_rpc.go @@ -0,0 +1,91 @@ +// this file was generated by gomacro command: import _b "net/rpc" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/rpc" +) + +// reflection: allow interpreted code to import "net/rpc" +func init() { + Packages["net/rpc"] = Package{ + Binds: map[string]Value{ + "Accept": ValueOf(rpc.Accept), + "DefaultDebugPath": ValueOf(rpc.DefaultDebugPath), + "DefaultRPCPath": ValueOf(rpc.DefaultRPCPath), + "DefaultServer": ValueOf(&rpc.DefaultServer).Elem(), + "Dial": ValueOf(rpc.Dial), + "DialHTTP": ValueOf(rpc.DialHTTP), + "DialHTTPPath": ValueOf(rpc.DialHTTPPath), + "ErrShutdown": ValueOf(&rpc.ErrShutdown).Elem(), + "HandleHTTP": ValueOf(rpc.HandleHTTP), + "NewClient": ValueOf(rpc.NewClient), + "NewClientWithCodec": ValueOf(rpc.NewClientWithCodec), + "NewServer": ValueOf(rpc.NewServer), + "Register": ValueOf(rpc.Register), + "RegisterName": ValueOf(rpc.RegisterName), + "ServeCodec": ValueOf(rpc.ServeCodec), + "ServeConn": ValueOf(rpc.ServeConn), + "ServeRequest": ValueOf(rpc.ServeRequest), + },Types: map[string]Type{ + "Call": TypeOf((*rpc.Call)(nil)).Elem(), + "Client": TypeOf((*rpc.Client)(nil)).Elem(), + "ClientCodec": TypeOf((*rpc.ClientCodec)(nil)).Elem(), + "Request": TypeOf((*rpc.Request)(nil)).Elem(), + "Response": TypeOf((*rpc.Response)(nil)).Elem(), + "Server": TypeOf((*rpc.Server)(nil)).Elem(), + "ServerCodec": TypeOf((*rpc.ServerCodec)(nil)).Elem(), + "ServerError": TypeOf((*rpc.ServerError)(nil)).Elem(), + },Proxies: map[string]Type{ + "ClientCodec": TypeOf((*ClientCodec_net_rpc)(nil)).Elem(), + "ServerCodec": TypeOf((*ServerCodec_net_rpc)(nil)).Elem(), + },Untypeds: map[string]string{ + "DefaultDebugPath": "string:/debug/rpc", + "DefaultRPCPath": "string:/_goRPC_", + }, + } +} + +// --------------- proxy for net/rpc.ClientCodec --------------- +type ClientCodec_net_rpc struct { + Object interface{} + Close_ func(interface{}) error + ReadResponseBody_ func(interface{}, interface{}) error + ReadResponseHeader_ func(interface{}, *rpc.Response) error + WriteRequest_ func(interface{}, *rpc.Request, interface{}) error +} +func (Proxy *ClientCodec_net_rpc) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *ClientCodec_net_rpc) ReadResponseBody(unnamed0 interface{}) error { + return Proxy.ReadResponseBody_(Proxy.Object, unnamed0) +} +func (Proxy *ClientCodec_net_rpc) ReadResponseHeader(unnamed0 *rpc.Response) error { + return Proxy.ReadResponseHeader_(Proxy.Object, unnamed0) +} +func (Proxy *ClientCodec_net_rpc) WriteRequest(unnamed0 *rpc.Request, unnamed1 interface{}) error { + return Proxy.WriteRequest_(Proxy.Object, unnamed0, unnamed1) +} + +// --------------- proxy for net/rpc.ServerCodec --------------- +type ServerCodec_net_rpc struct { + Object interface{} + Close_ func(interface{}) error + ReadRequestBody_ func(interface{}, interface{}) error + ReadRequestHeader_ func(interface{}, *rpc.Request) error + WriteResponse_ func(interface{}, *rpc.Response, interface{}) error +} +func (Proxy *ServerCodec_net_rpc) Close() error { + return Proxy.Close_(Proxy.Object) +} +func (Proxy *ServerCodec_net_rpc) ReadRequestBody(unnamed0 interface{}) error { + return Proxy.ReadRequestBody_(Proxy.Object, unnamed0) +} +func (Proxy *ServerCodec_net_rpc) ReadRequestHeader(unnamed0 *rpc.Request) error { + return Proxy.ReadRequestHeader_(Proxy.Object, unnamed0) +} +func (Proxy *ServerCodec_net_rpc) WriteResponse(unnamed0 *rpc.Response, unnamed1 interface{}) error { + return Proxy.WriteResponse_(Proxy.Object, unnamed0, unnamed1) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_rpc_jsonrpc.go b/vendor/github.com/cosmos72/gomacro/imports/net_rpc_jsonrpc.go new file mode 100644 index 0000000..b5a6905 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_rpc_jsonrpc.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "net/rpc/jsonrpc" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/rpc/jsonrpc" +) + +// reflection: allow interpreted code to import "net/rpc/jsonrpc" +func init() { + Packages["net/rpc/jsonrpc"] = Package{ + Binds: map[string]Value{ + "Dial": ValueOf(jsonrpc.Dial), + "NewClient": ValueOf(jsonrpc.NewClient), + "NewClientCodec": ValueOf(jsonrpc.NewClientCodec), + "NewServerCodec": ValueOf(jsonrpc.NewServerCodec), + "ServeConn": ValueOf(jsonrpc.ServeConn), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_smtp.go b/vendor/github.com/cosmos72/gomacro/imports/net_smtp.go new file mode 100644 index 0000000..889895c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_smtp.go @@ -0,0 +1,41 @@ +// this file was generated by gomacro command: import _b "net/smtp" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/smtp" +) + +// reflection: allow interpreted code to import "net/smtp" +func init() { + Packages["net/smtp"] = Package{ + Binds: map[string]Value{ + "CRAMMD5Auth": ValueOf(smtp.CRAMMD5Auth), + "Dial": ValueOf(smtp.Dial), + "NewClient": ValueOf(smtp.NewClient), + "PlainAuth": ValueOf(smtp.PlainAuth), + "SendMail": ValueOf(smtp.SendMail), + },Types: map[string]Type{ + "Auth": TypeOf((*smtp.Auth)(nil)).Elem(), + "Client": TypeOf((*smtp.Client)(nil)).Elem(), + "ServerInfo": TypeOf((*smtp.ServerInfo)(nil)).Elem(), + },Proxies: map[string]Type{ + "Auth": TypeOf((*Auth_net_smtp)(nil)).Elem(), + }, + } +} + +// --------------- proxy for net/smtp.Auth --------------- +type Auth_net_smtp struct { + Object interface{} + Next_ func(_proxy_obj_ interface{}, fromServer []byte, more bool) (toServer []byte, err error) + Start_ func(_proxy_obj_ interface{}, server *smtp.ServerInfo) (proto string, toServer []byte, err error) +} +func (Proxy *Auth_net_smtp) Next(fromServer []byte, more bool) (toServer []byte, err error) { + return Proxy.Next_(Proxy.Object, fromServer, more) +} +func (Proxy *Auth_net_smtp) Start(server *smtp.ServerInfo) (proto string, toServer []byte, err error) { + return Proxy.Start_(Proxy.Object, server) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_textproto.go b/vendor/github.com/cosmos72/gomacro/imports/net_textproto.go new file mode 100644 index 0000000..ed20e96 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_textproto.go @@ -0,0 +1,34 @@ +// this file was generated by gomacro command: import _b "net/textproto" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/textproto" +) + +// reflection: allow interpreted code to import "net/textproto" +func init() { + Packages["net/textproto"] = Package{ + Binds: map[string]Value{ + "CanonicalMIMEHeaderKey": ValueOf(textproto.CanonicalMIMEHeaderKey), + "Dial": ValueOf(textproto.Dial), + "NewConn": ValueOf(textproto.NewConn), + "NewReader": ValueOf(textproto.NewReader), + "NewWriter": ValueOf(textproto.NewWriter), + "TrimBytes": ValueOf(textproto.TrimBytes), + "TrimString": ValueOf(textproto.TrimString), + },Types: map[string]Type{ + "Conn": TypeOf((*textproto.Conn)(nil)).Elem(), + "Error": TypeOf((*textproto.Error)(nil)).Elem(), + "MIMEHeader": TypeOf((*textproto.MIMEHeader)(nil)).Elem(), + "Pipeline": TypeOf((*textproto.Pipeline)(nil)).Elem(), + "ProtocolError": TypeOf((*textproto.ProtocolError)(nil)).Elem(), + "Reader": TypeOf((*textproto.Reader)(nil)).Elem(), + "Writer": TypeOf((*textproto.Writer)(nil)).Elem(), + },Wrappers: map[string][]string{ + "Conn": []string{"DotReader","DotWriter","EndRequest","EndResponse","Next","PrintfLine","ReadCodeLine","ReadContinuedLine","ReadContinuedLineBytes","ReadDotBytes","ReadDotLines","ReadLine","ReadLineBytes","ReadMIMEHeader","ReadResponse","StartRequest","StartResponse",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/net_url.go b/vendor/github.com/cosmos72/gomacro/imports/net_url.go new file mode 100644 index 0000000..e0c1610 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/net_url.go @@ -0,0 +1,33 @@ +// this file was generated by gomacro command: import _b "net/url" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "net/url" +) + +// reflection: allow interpreted code to import "net/url" +func init() { + Packages["net/url"] = Package{ + Binds: map[string]Value{ + "Parse": ValueOf(url.Parse), + "ParseQuery": ValueOf(url.ParseQuery), + "ParseRequestURI": ValueOf(url.ParseRequestURI), + "PathEscape": ValueOf(url.PathEscape), + "PathUnescape": ValueOf(url.PathUnescape), + "QueryEscape": ValueOf(url.QueryEscape), + "QueryUnescape": ValueOf(url.QueryUnescape), + "User": ValueOf(url.User), + "UserPassword": ValueOf(url.UserPassword), + },Types: map[string]Type{ + "Error": TypeOf((*url.Error)(nil)).Elem(), + "EscapeError": TypeOf((*url.EscapeError)(nil)).Elem(), + "InvalidHostError": TypeOf((*url.InvalidHostError)(nil)).Elem(), + "URL": TypeOf((*url.URL)(nil)).Elem(), + "Userinfo": TypeOf((*url.Userinfo)(nil)).Elem(), + "Values": TypeOf((*url.Values)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/os.go b/vendor/github.com/cosmos72/gomacro/imports/os.go new file mode 100644 index 0000000..5a59dae --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/os.go @@ -0,0 +1,167 @@ +// this file was generated by gomacro command: import _b "os" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "os" + "time" +) + +// reflection: allow interpreted code to import "os" +func init() { + Packages["os"] = Package{ + Binds: map[string]Value{ + "Args": ValueOf(&os.Args).Elem(), + "Chdir": ValueOf(os.Chdir), + "Chmod": ValueOf(os.Chmod), + "Chown": ValueOf(os.Chown), + "Chtimes": ValueOf(os.Chtimes), + "Clearenv": ValueOf(os.Clearenv), + "Create": ValueOf(os.Create), + "DevNull": ValueOf(os.DevNull), + "Environ": ValueOf(os.Environ), + "ErrClosed": ValueOf(&os.ErrClosed).Elem(), + "ErrExist": ValueOf(&os.ErrExist).Elem(), + "ErrInvalid": ValueOf(&os.ErrInvalid).Elem(), + "ErrNotExist": ValueOf(&os.ErrNotExist).Elem(), + "ErrPermission": ValueOf(&os.ErrPermission).Elem(), + "Executable": ValueOf(os.Executable), + "Exit": ValueOf(os.Exit), + "Expand": ValueOf(os.Expand), + "ExpandEnv": ValueOf(os.ExpandEnv), + "FindProcess": ValueOf(os.FindProcess), + "Getegid": ValueOf(os.Getegid), + "Getenv": ValueOf(os.Getenv), + "Geteuid": ValueOf(os.Geteuid), + "Getgid": ValueOf(os.Getgid), + "Getgroups": ValueOf(os.Getgroups), + "Getpagesize": ValueOf(os.Getpagesize), + "Getpid": ValueOf(os.Getpid), + "Getppid": ValueOf(os.Getppid), + "Getuid": ValueOf(os.Getuid), + "Getwd": ValueOf(os.Getwd), + "Hostname": ValueOf(os.Hostname), + "Interrupt": ValueOf(&os.Interrupt).Elem(), + "IsExist": ValueOf(os.IsExist), + "IsNotExist": ValueOf(os.IsNotExist), + "IsPathSeparator": ValueOf(os.IsPathSeparator), + "IsPermission": ValueOf(os.IsPermission), + "Kill": ValueOf(&os.Kill).Elem(), + "Lchown": ValueOf(os.Lchown), + "Link": ValueOf(os.Link), + "LookupEnv": ValueOf(os.LookupEnv), + "Lstat": ValueOf(os.Lstat), + "Mkdir": ValueOf(os.Mkdir), + "MkdirAll": ValueOf(os.MkdirAll), + "ModeAppend": ValueOf(os.ModeAppend), + "ModeCharDevice": ValueOf(os.ModeCharDevice), + "ModeDevice": ValueOf(os.ModeDevice), + "ModeDir": ValueOf(os.ModeDir), + "ModeExclusive": ValueOf(os.ModeExclusive), + "ModeNamedPipe": ValueOf(os.ModeNamedPipe), + "ModePerm": ValueOf(os.ModePerm), + "ModeSetgid": ValueOf(os.ModeSetgid), + "ModeSetuid": ValueOf(os.ModeSetuid), + "ModeSocket": ValueOf(os.ModeSocket), + "ModeSticky": ValueOf(os.ModeSticky), + "ModeSymlink": ValueOf(os.ModeSymlink), + "ModeTemporary": ValueOf(os.ModeTemporary), + "ModeType": ValueOf(os.ModeType), + "NewFile": ValueOf(os.NewFile), + "NewSyscallError": ValueOf(os.NewSyscallError), + "O_APPEND": ValueOf(os.O_APPEND), + "O_CREATE": ValueOf(os.O_CREATE), + "O_EXCL": ValueOf(os.O_EXCL), + "O_RDONLY": ValueOf(os.O_RDONLY), + "O_RDWR": ValueOf(os.O_RDWR), + "O_SYNC": ValueOf(os.O_SYNC), + "O_TRUNC": ValueOf(os.O_TRUNC), + "O_WRONLY": ValueOf(os.O_WRONLY), + "Open": ValueOf(os.Open), + "OpenFile": ValueOf(os.OpenFile), + "PathListSeparator": ValueOf(os.PathListSeparator), + "PathSeparator": ValueOf(os.PathSeparator), + "Pipe": ValueOf(os.Pipe), + "Readlink": ValueOf(os.Readlink), + "Remove": ValueOf(os.Remove), + "RemoveAll": ValueOf(os.RemoveAll), + "Rename": ValueOf(os.Rename), + "SEEK_CUR": ValueOf(os.SEEK_CUR), + "SEEK_END": ValueOf(os.SEEK_END), + "SEEK_SET": ValueOf(os.SEEK_SET), + "SameFile": ValueOf(os.SameFile), + "Setenv": ValueOf(os.Setenv), + "StartProcess": ValueOf(os.StartProcess), + "Stat": ValueOf(os.Stat), + "Stderr": ValueOf(&os.Stderr).Elem(), + "Stdin": ValueOf(&os.Stdin).Elem(), + "Stdout": ValueOf(&os.Stdout).Elem(), + "Symlink": ValueOf(os.Symlink), + "TempDir": ValueOf(os.TempDir), + "Truncate": ValueOf(os.Truncate), + "Unsetenv": ValueOf(os.Unsetenv), + },Types: map[string]Type{ + "File": TypeOf((*os.File)(nil)).Elem(), + "FileInfo": TypeOf((*os.FileInfo)(nil)).Elem(), + "FileMode": TypeOf((*os.FileMode)(nil)).Elem(), + "LinkError": TypeOf((*os.LinkError)(nil)).Elem(), + "PathError": TypeOf((*os.PathError)(nil)).Elem(), + "ProcAttr": TypeOf((*os.ProcAttr)(nil)).Elem(), + "Process": TypeOf((*os.Process)(nil)).Elem(), + "ProcessState": TypeOf((*os.ProcessState)(nil)).Elem(), + "Signal": TypeOf((*os.Signal)(nil)).Elem(), + "SyscallError": TypeOf((*os.SyscallError)(nil)).Elem(), + },Proxies: map[string]Type{ + "FileInfo": TypeOf((*FileInfo_os)(nil)).Elem(), + "Signal": TypeOf((*Signal_os)(nil)).Elem(), + },Untypeds: map[string]string{ + "DevNull": "string:/dev/null", + "PathListSeparator": "rune:58", + "PathSeparator": "rune:47", + }, + } +} + +// --------------- proxy for os.FileInfo --------------- +type FileInfo_os struct { + Object interface{} + IsDir_ func(interface{}) bool + ModTime_ func(interface{}) time.Time + Mode_ func(interface{}) os.FileMode + Name_ func(interface{}) string + Size_ func(interface{}) int64 + Sys_ func(interface{}) interface{} +} +func (Proxy *FileInfo_os) IsDir() bool { + return Proxy.IsDir_(Proxy.Object) +} +func (Proxy *FileInfo_os) ModTime() time.Time { + return Proxy.ModTime_(Proxy.Object) +} +func (Proxy *FileInfo_os) Mode() os.FileMode { + return Proxy.Mode_(Proxy.Object) +} +func (Proxy *FileInfo_os) Name() string { + return Proxy.Name_(Proxy.Object) +} +func (Proxy *FileInfo_os) Size() int64 { + return Proxy.Size_(Proxy.Object) +} +func (Proxy *FileInfo_os) Sys() interface{} { + return Proxy.Sys_(Proxy.Object) +} + +// --------------- proxy for os.Signal --------------- +type Signal_os struct { + Object interface{} + Signal_ func(interface{}) + String_ func(interface{}) string +} +func (Proxy *Signal_os) Signal() { + Proxy.Signal_(Proxy.Object) +} +func (Proxy *Signal_os) String() string { + return Proxy.String_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/os_exec.go b/vendor/github.com/cosmos72/gomacro/imports/os_exec.go new file mode 100644 index 0000000..7273b5f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/os_exec.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "os/exec" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "os/exec" +) + +// reflection: allow interpreted code to import "os/exec" +func init() { + Packages["os/exec"] = Package{ + Binds: map[string]Value{ + "Command": ValueOf(exec.Command), + "CommandContext": ValueOf(exec.CommandContext), + "ErrNotFound": ValueOf(&exec.ErrNotFound).Elem(), + "LookPath": ValueOf(exec.LookPath), + },Types: map[string]Type{ + "Cmd": TypeOf((*exec.Cmd)(nil)).Elem(), + "Error": TypeOf((*exec.Error)(nil)).Elem(), + "ExitError": TypeOf((*exec.ExitError)(nil)).Elem(), + },Wrappers: map[string][]string{ + "ExitError": []string{"Exited","Pid","String","Success","Sys","SysUsage","SystemTime","UserTime",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/os_signal.go b/vendor/github.com/cosmos72/gomacro/imports/os_signal.go new file mode 100644 index 0000000..c034382 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/os_signal.go @@ -0,0 +1,21 @@ +// this file was generated by gomacro command: import _b "os/signal" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "os/signal" +) + +// reflection: allow interpreted code to import "os/signal" +func init() { + Packages["os/signal"] = Package{ + Binds: map[string]Value{ + "Ignore": ValueOf(signal.Ignore), + "Notify": ValueOf(signal.Notify), + "Reset": ValueOf(signal.Reset), + "Stop": ValueOf(signal.Stop), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/os_user.go b/vendor/github.com/cosmos72/gomacro/imports/os_user.go new file mode 100644 index 0000000..4767944 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/os_user.go @@ -0,0 +1,29 @@ +// this file was generated by gomacro command: import _b "os/user" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "os/user" +) + +// reflection: allow interpreted code to import "os/user" +func init() { + Packages["os/user"] = Package{ + Binds: map[string]Value{ + "Current": ValueOf(user.Current), + "Lookup": ValueOf(user.Lookup), + "LookupGroup": ValueOf(user.LookupGroup), + "LookupGroupId": ValueOf(user.LookupGroupId), + "LookupId": ValueOf(user.LookupId), + },Types: map[string]Type{ + "Group": TypeOf((*user.Group)(nil)).Elem(), + "UnknownGroupError": TypeOf((*user.UnknownGroupError)(nil)).Elem(), + "UnknownGroupIdError": TypeOf((*user.UnknownGroupIdError)(nil)).Elem(), + "UnknownUserError": TypeOf((*user.UnknownUserError)(nil)).Elem(), + "UnknownUserIdError": TypeOf((*user.UnknownUserIdError)(nil)).Elem(), + "User": TypeOf((*user.User)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/package.go b/vendor/github.com/cosmos72/gomacro/imports/package.go new file mode 100644 index 0000000..49027cf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/package.go @@ -0,0 +1,98 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * import.go + * + * Created on: Feb 28, 2017 + * Author: Massimiliano Ghilardi + */ + +package imports + +import ( + . "reflect" +) + +type Package struct { + Binds map[string]Value + Types map[string]Type + Proxies map[string]Type + // Untypeds contains a string representation of untyped constants, + // stored without loss of precision + Untypeds map[string]string + // Wrappers is the list of wrapper methods for named types. + // Stored explicitly because reflect package cannot distinguish + // between explicit methods and wrapper methods for embedded fields + Wrappers map[string][]string +} + +var Packages = make(map[string]Package) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/imports" +func init() { + Packages["github.com/cosmos72/gomacro/imports"] = Package{ + Binds: map[string]Value{ + "Packages": ValueOf(&Packages).Elem(), + }, + Types: map[string]Type{ + "Package": TypeOf((*Package)(nil)).Elem(), + }, + Proxies: map[string]Type{}, + Untypeds: map[string]string{}, + Wrappers: map[string][]string{}, + } +} + +func (pkg *Package) Init() { + pkg.Binds = make(map[string]Value) + pkg.Types = make(map[string]Type) + pkg.Proxies = make(map[string]Type) + pkg.Untypeds = make(map[string]string) + pkg.Wrappers = make(map[string][]string) +} + +func (pkg Package) SaveToPackages(path string) { + // exploit the fact that maps are actually handles + dst, ok := Packages[path] + if !ok { + dst = Package{} + dst.Init() + Packages[path] = dst + } + dst.Merge(pkg) +} + +func (dst Package) Merge(src Package) { + // exploit the fact that maps are actually handles + for k, v := range src.Binds { + dst.Binds[k] = v + } + for k, v := range src.Types { + dst.Types[k] = v + } + for k, v := range src.Proxies { + dst.Proxies[k] = v + } + for k, v := range src.Untypeds { + dst.Untypeds[k] = v + } + for k, v := range src.Wrappers { + dst.Wrappers[k] = v + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/path.go b/vendor/github.com/cosmos72/gomacro/imports/path.go new file mode 100644 index 0000000..0587c76 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/path.go @@ -0,0 +1,26 @@ +// this file was generated by gomacro command: import _b "path" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "path" +) + +// reflection: allow interpreted code to import "path" +func init() { + Packages["path"] = Package{ + Binds: map[string]Value{ + "Base": ValueOf(path.Base), + "Clean": ValueOf(path.Clean), + "Dir": ValueOf(path.Dir), + "ErrBadPattern": ValueOf(&path.ErrBadPattern).Elem(), + "Ext": ValueOf(path.Ext), + "IsAbs": ValueOf(path.IsAbs), + "Join": ValueOf(path.Join), + "Match": ValueOf(path.Match), + "Split": ValueOf(path.Split), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/path_filepath.go b/vendor/github.com/cosmos72/gomacro/imports/path_filepath.go new file mode 100644 index 0000000..d2824a4 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/path_filepath.go @@ -0,0 +1,44 @@ +// this file was generated by gomacro command: import _b "path/filepath" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "path/filepath" +) + +// reflection: allow interpreted code to import "path/filepath" +func init() { + Packages["path/filepath"] = Package{ + Binds: map[string]Value{ + "Abs": ValueOf(filepath.Abs), + "Base": ValueOf(filepath.Base), + "Clean": ValueOf(filepath.Clean), + "Dir": ValueOf(filepath.Dir), + "ErrBadPattern": ValueOf(&filepath.ErrBadPattern).Elem(), + "EvalSymlinks": ValueOf(filepath.EvalSymlinks), + "Ext": ValueOf(filepath.Ext), + "FromSlash": ValueOf(filepath.FromSlash), + "Glob": ValueOf(filepath.Glob), + "HasPrefix": ValueOf(filepath.HasPrefix), + "IsAbs": ValueOf(filepath.IsAbs), + "Join": ValueOf(filepath.Join), + "ListSeparator": ValueOf(filepath.ListSeparator), + "Match": ValueOf(filepath.Match), + "Rel": ValueOf(filepath.Rel), + "Separator": ValueOf(filepath.Separator), + "SkipDir": ValueOf(&filepath.SkipDir).Elem(), + "Split": ValueOf(filepath.Split), + "SplitList": ValueOf(filepath.SplitList), + "ToSlash": ValueOf(filepath.ToSlash), + "VolumeName": ValueOf(filepath.VolumeName), + "Walk": ValueOf(filepath.Walk), + },Types: map[string]Type{ + "WalkFunc": TypeOf((*filepath.WalkFunc)(nil)).Elem(), + },Untypeds: map[string]string{ + "ListSeparator": "rune:58", + "Separator": "rune:47", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/plugin.go b/vendor/github.com/cosmos72/gomacro/imports/plugin.go new file mode 100644 index 0000000..d1389f7 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/plugin.go @@ -0,0 +1,30 @@ +// +build go1.8,!gccgo + +// this file was generated by gomacro command: import _b "plugin" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "plugin" +) + +// reflection: allow interpreted code to import "plugin" +func init() { + Packages["plugin"] = Package{ + Binds: map[string]Value{ + "Open": ValueOf(plugin.Open), + },Types: map[string]Type{ + "Plugin": TypeOf((*plugin.Plugin)(nil)).Elem(), + "Symbol": TypeOf((*plugin.Symbol)(nil)).Elem(), + },Proxies: map[string]Type{ + "Symbol": TypeOf((*Symbol_plugin)(nil)).Elem(), + }, + } +} + +// --------------- proxy for plugin.Symbol --------------- +type Symbol_plugin struct { + Object interface{} +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/reflect.go b/vendor/github.com/cosmos72/gomacro/imports/reflect.go new file mode 100644 index 0000000..edbe006 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/reflect.go @@ -0,0 +1,86 @@ +// this file was generated by gomacro command: import _b "reflect" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "reflect" +) + +// reflection: allow interpreted code to import "reflect" +func init() { + Packages["reflect"] = Package{ + Binds: map[string]Value{ + "Append": ValueOf(reflect.Append), + "AppendSlice": ValueOf(reflect.AppendSlice), + "Array": ValueOf(reflect.Array), + "ArrayOf": ValueOf(reflect.ArrayOf), + "Bool": ValueOf(reflect.Bool), + "BothDir": ValueOf(reflect.BothDir), + "Chan": ValueOf(reflect.Chan), + "ChanOf": ValueOf(reflect.ChanOf), + "Complex128": ValueOf(reflect.Complex128), + "Complex64": ValueOf(reflect.Complex64), + "Copy": ValueOf(reflect.Copy), + "DeepEqual": ValueOf(reflect.DeepEqual), + "Float32": ValueOf(reflect.Float32), + "Float64": ValueOf(reflect.Float64), + "Func": ValueOf(reflect.Func), + "FuncOf": ValueOf(reflect.FuncOf), + "Indirect": ValueOf(reflect.Indirect), + "Int": ValueOf(reflect.Int), + "Int16": ValueOf(reflect.Int16), + "Int32": ValueOf(reflect.Int32), + "Int64": ValueOf(reflect.Int64), + "Int8": ValueOf(reflect.Int8), + "Interface": ValueOf(reflect.Interface), + "Invalid": ValueOf(reflect.Invalid), + "MakeChan": ValueOf(reflect.MakeChan), + "MakeFunc": ValueOf(reflect.MakeFunc), + "MakeMap": ValueOf(reflect.MakeMap), + "MakeSlice": ValueOf(reflect.MakeSlice), + "Map": ValueOf(reflect.Map), + "MapOf": ValueOf(reflect.MapOf), + "New": ValueOf(reflect.New), + "NewAt": ValueOf(reflect.NewAt), + "Ptr": ValueOf(reflect.Ptr), + "PtrTo": ValueOf(reflect.PtrTo), + "RecvDir": ValueOf(reflect.RecvDir), + "Select": ValueOf(reflect.Select), + "SelectDefault": ValueOf(reflect.SelectDefault), + "SelectRecv": ValueOf(reflect.SelectRecv), + "SelectSend": ValueOf(reflect.SelectSend), + "SendDir": ValueOf(reflect.SendDir), + "Slice": ValueOf(reflect.Slice), + "SliceOf": ValueOf(reflect.SliceOf), + "String": ValueOf(reflect.String), + "Struct": ValueOf(reflect.Struct), + "StructOf": ValueOf(reflect.StructOf), + "Swapper": ValueOf(reflect.Swapper), + "TypeOf": ValueOf(reflect.TypeOf), + "Uint": ValueOf(reflect.Uint), + "Uint16": ValueOf(reflect.Uint16), + "Uint32": ValueOf(reflect.Uint32), + "Uint64": ValueOf(reflect.Uint64), + "Uint8": ValueOf(reflect.Uint8), + "Uintptr": ValueOf(reflect.Uintptr), + "UnsafePointer": ValueOf(reflect.UnsafePointer), + "ValueOf": ValueOf(reflect.ValueOf), + "Zero": ValueOf(reflect.Zero), + },Types: map[string]Type{ + "ChanDir": TypeOf((*reflect.ChanDir)(nil)).Elem(), + "Kind": TypeOf((*reflect.Kind)(nil)).Elem(), + "Method": TypeOf((*reflect.Method)(nil)).Elem(), + "SelectCase": TypeOf((*reflect.SelectCase)(nil)).Elem(), + "SelectDir": TypeOf((*reflect.SelectDir)(nil)).Elem(), + "SliceHeader": TypeOf((*reflect.SliceHeader)(nil)).Elem(), + "StringHeader": TypeOf((*reflect.StringHeader)(nil)).Elem(), + "StructField": TypeOf((*reflect.StructField)(nil)).Elem(), + "StructTag": TypeOf((*reflect.StructTag)(nil)).Elem(), + "Type": TypeOf((*reflect.Type)(nil)).Elem(), + "Value": TypeOf((*reflect.Value)(nil)).Elem(), + "ValueError": TypeOf((*reflect.ValueError)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/regexp.go b/vendor/github.com/cosmos72/gomacro/imports/regexp.go new file mode 100644 index 0000000..a0e929a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/regexp.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _b "regexp" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "regexp" +) + +// reflection: allow interpreted code to import "regexp" +func init() { + Packages["regexp"] = Package{ + Binds: map[string]Value{ + "Compile": ValueOf(regexp.Compile), + "CompilePOSIX": ValueOf(regexp.CompilePOSIX), + "Match": ValueOf(regexp.Match), + "MatchReader": ValueOf(regexp.MatchReader), + "MatchString": ValueOf(regexp.MatchString), + "MustCompile": ValueOf(regexp.MustCompile), + "MustCompilePOSIX": ValueOf(regexp.MustCompilePOSIX), + "QuoteMeta": ValueOf(regexp.QuoteMeta), + },Types: map[string]Type{ + "Regexp": TypeOf((*regexp.Regexp)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/regexp_syntax.go b/vendor/github.com/cosmos72/gomacro/imports/regexp_syntax.go new file mode 100644 index 0000000..7a6eb22 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/regexp_syntax.go @@ -0,0 +1,94 @@ +// this file was generated by gomacro command: import _b "regexp/syntax" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "regexp/syntax" +) + +// reflection: allow interpreted code to import "regexp/syntax" +func init() { + Packages["regexp/syntax"] = Package{ + Binds: map[string]Value{ + "ClassNL": ValueOf(syntax.ClassNL), + "Compile": ValueOf(syntax.Compile), + "DotNL": ValueOf(syntax.DotNL), + "EmptyBeginLine": ValueOf(syntax.EmptyBeginLine), + "EmptyBeginText": ValueOf(syntax.EmptyBeginText), + "EmptyEndLine": ValueOf(syntax.EmptyEndLine), + "EmptyEndText": ValueOf(syntax.EmptyEndText), + "EmptyNoWordBoundary": ValueOf(syntax.EmptyNoWordBoundary), + "EmptyOpContext": ValueOf(syntax.EmptyOpContext), + "EmptyWordBoundary": ValueOf(syntax.EmptyWordBoundary), + "ErrInternalError": ValueOf(syntax.ErrInternalError), + "ErrInvalidCharClass": ValueOf(syntax.ErrInvalidCharClass), + "ErrInvalidCharRange": ValueOf(syntax.ErrInvalidCharRange), + "ErrInvalidEscape": ValueOf(syntax.ErrInvalidEscape), + "ErrInvalidNamedCapture": ValueOf(syntax.ErrInvalidNamedCapture), + "ErrInvalidPerlOp": ValueOf(syntax.ErrInvalidPerlOp), + "ErrInvalidRepeatOp": ValueOf(syntax.ErrInvalidRepeatOp), + "ErrInvalidRepeatSize": ValueOf(syntax.ErrInvalidRepeatSize), + "ErrInvalidUTF8": ValueOf(syntax.ErrInvalidUTF8), + "ErrMissingBracket": ValueOf(syntax.ErrMissingBracket), + "ErrMissingParen": ValueOf(syntax.ErrMissingParen), + "ErrMissingRepeatArgument": ValueOf(syntax.ErrMissingRepeatArgument), + "ErrTrailingBackslash": ValueOf(syntax.ErrTrailingBackslash), + "ErrUnexpectedParen": ValueOf(syntax.ErrUnexpectedParen), + "FoldCase": ValueOf(syntax.FoldCase), + "InstAlt": ValueOf(syntax.InstAlt), + "InstAltMatch": ValueOf(syntax.InstAltMatch), + "InstCapture": ValueOf(syntax.InstCapture), + "InstEmptyWidth": ValueOf(syntax.InstEmptyWidth), + "InstFail": ValueOf(syntax.InstFail), + "InstMatch": ValueOf(syntax.InstMatch), + "InstNop": ValueOf(syntax.InstNop), + "InstRune": ValueOf(syntax.InstRune), + "InstRune1": ValueOf(syntax.InstRune1), + "InstRuneAny": ValueOf(syntax.InstRuneAny), + "InstRuneAnyNotNL": ValueOf(syntax.InstRuneAnyNotNL), + "IsWordChar": ValueOf(syntax.IsWordChar), + "Literal": ValueOf(syntax.Literal), + "MatchNL": ValueOf(syntax.MatchNL), + "NonGreedy": ValueOf(syntax.NonGreedy), + "OneLine": ValueOf(syntax.OneLine), + "OpAlternate": ValueOf(syntax.OpAlternate), + "OpAnyChar": ValueOf(syntax.OpAnyChar), + "OpAnyCharNotNL": ValueOf(syntax.OpAnyCharNotNL), + "OpBeginLine": ValueOf(syntax.OpBeginLine), + "OpBeginText": ValueOf(syntax.OpBeginText), + "OpCapture": ValueOf(syntax.OpCapture), + "OpCharClass": ValueOf(syntax.OpCharClass), + "OpConcat": ValueOf(syntax.OpConcat), + "OpEmptyMatch": ValueOf(syntax.OpEmptyMatch), + "OpEndLine": ValueOf(syntax.OpEndLine), + "OpEndText": ValueOf(syntax.OpEndText), + "OpLiteral": ValueOf(syntax.OpLiteral), + "OpNoMatch": ValueOf(syntax.OpNoMatch), + "OpNoWordBoundary": ValueOf(syntax.OpNoWordBoundary), + "OpPlus": ValueOf(syntax.OpPlus), + "OpQuest": ValueOf(syntax.OpQuest), + "OpRepeat": ValueOf(syntax.OpRepeat), + "OpStar": ValueOf(syntax.OpStar), + "OpWordBoundary": ValueOf(syntax.OpWordBoundary), + "POSIX": ValueOf(syntax.POSIX), + "Parse": ValueOf(syntax.Parse), + "Perl": ValueOf(syntax.Perl), + "PerlX": ValueOf(syntax.PerlX), + "Simple": ValueOf(syntax.Simple), + "UnicodeGroups": ValueOf(syntax.UnicodeGroups), + "WasDollar": ValueOf(syntax.WasDollar), + },Types: map[string]Type{ + "EmptyOp": TypeOf((*syntax.EmptyOp)(nil)).Elem(), + "Error": TypeOf((*syntax.Error)(nil)).Elem(), + "ErrorCode": TypeOf((*syntax.ErrorCode)(nil)).Elem(), + "Flags": TypeOf((*syntax.Flags)(nil)).Elem(), + "Inst": TypeOf((*syntax.Inst)(nil)).Elem(), + "InstOp": TypeOf((*syntax.InstOp)(nil)).Elem(), + "Op": TypeOf((*syntax.Op)(nil)).Elem(), + "Prog": TypeOf((*syntax.Prog)(nil)).Elem(), + "Regexp": TypeOf((*syntax.Regexp)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/runtime.go b/vendor/github.com/cosmos72/gomacro/imports/runtime.go new file mode 100644 index 0000000..44d880f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/runtime.go @@ -0,0 +1,85 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "runtime" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "runtime" +) + +// reflection: allow interpreted code to import "runtime" +func init() { + Packages["runtime"] = Package{ + Binds: map[string]Value{ + "BlockProfile": ValueOf(runtime.BlockProfile), + "Breakpoint": ValueOf(runtime.Breakpoint), + "CPUProfile": ValueOf(runtime.CPUProfile), + "Caller": ValueOf(runtime.Caller), + "Callers": ValueOf(runtime.Callers), + "CallersFrames": ValueOf(runtime.CallersFrames), + "Compiler": ValueOf(runtime.Compiler), + "FuncForPC": ValueOf(runtime.FuncForPC), + "GC": ValueOf(runtime.GC), + "GOARCH": ValueOf(runtime.GOARCH), + "GOMAXPROCS": ValueOf(runtime.GOMAXPROCS), + "GOOS": ValueOf(runtime.GOOS), + "GOROOT": ValueOf(runtime.GOROOT), + "Goexit": ValueOf(runtime.Goexit), + "GoroutineProfile": ValueOf(runtime.GoroutineProfile), + "Gosched": ValueOf(runtime.Gosched), + "KeepAlive": ValueOf(runtime.KeepAlive), + "LockOSThread": ValueOf(runtime.LockOSThread), + "MemProfile": ValueOf(runtime.MemProfile), + "MemProfileRate": ValueOf(&runtime.MemProfileRate).Elem(), + "MutexProfile": ValueOf(runtime.MutexProfile), + "NumCPU": ValueOf(runtime.NumCPU), + "NumCgoCall": ValueOf(runtime.NumCgoCall), + "NumGoroutine": ValueOf(runtime.NumGoroutine), + "ReadMemStats": ValueOf(runtime.ReadMemStats), + "ReadTrace": ValueOf(runtime.ReadTrace), + "SetBlockProfileRate": ValueOf(runtime.SetBlockProfileRate), + "SetCPUProfileRate": ValueOf(runtime.SetCPUProfileRate), + "SetCgoTraceback": ValueOf(runtime.SetCgoTraceback), + "SetFinalizer": ValueOf(runtime.SetFinalizer), + "SetMutexProfileFraction": ValueOf(runtime.SetMutexProfileFraction), + "Stack": ValueOf(runtime.Stack), + "StartTrace": ValueOf(runtime.StartTrace), + "StopTrace": ValueOf(runtime.StopTrace), + "ThreadCreateProfile": ValueOf(runtime.ThreadCreateProfile), + "UnlockOSThread": ValueOf(runtime.UnlockOSThread), + "Version": ValueOf(runtime.Version), + },Types: map[string]Type{ + "BlockProfileRecord": TypeOf((*runtime.BlockProfileRecord)(nil)).Elem(), + "Error": TypeOf((*runtime.Error)(nil)).Elem(), + "Frame": TypeOf((*runtime.Frame)(nil)).Elem(), + "Frames": TypeOf((*runtime.Frames)(nil)).Elem(), + "Func": TypeOf((*runtime.Func)(nil)).Elem(), + "MemProfileRecord": TypeOf((*runtime.MemProfileRecord)(nil)).Elem(), + "MemStats": TypeOf((*runtime.MemStats)(nil)).Elem(), + "StackRecord": TypeOf((*runtime.StackRecord)(nil)).Elem(), + "TypeAssertionError": TypeOf((*runtime.TypeAssertionError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Error": TypeOf((*Error_runtime)(nil)).Elem(), + },Untypeds: map[string]string{ + "Compiler": "string:gc", + },Wrappers: map[string][]string{ + "BlockProfileRecord": []string{"Stack",}, + }, + } +} + +// --------------- proxy for runtime.Error --------------- +type Error_runtime struct { + Object interface{} + Error_ func(interface{}) string + RuntimeError_ func(interface{}) +} +func (Proxy *Error_runtime) Error() string { + return Proxy.Error_(Proxy.Object) +} +func (Proxy *Error_runtime) RuntimeError() { + Proxy.RuntimeError_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/runtime_debug.go b/vendor/github.com/cosmos72/gomacro/imports/runtime_debug.go new file mode 100644 index 0000000..16af4cf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/runtime_debug.go @@ -0,0 +1,29 @@ +// this file was generated by gomacro command: import _b "runtime/debug" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "runtime/debug" +) + +// reflection: allow interpreted code to import "runtime/debug" +func init() { + Packages["runtime/debug"] = Package{ + Binds: map[string]Value{ + "FreeOSMemory": ValueOf(debug.FreeOSMemory), + "PrintStack": ValueOf(debug.PrintStack), + "ReadGCStats": ValueOf(debug.ReadGCStats), + "SetGCPercent": ValueOf(debug.SetGCPercent), + "SetMaxStack": ValueOf(debug.SetMaxStack), + "SetMaxThreads": ValueOf(debug.SetMaxThreads), + "SetPanicOnFault": ValueOf(debug.SetPanicOnFault), + "SetTraceback": ValueOf(debug.SetTraceback), + "Stack": ValueOf(debug.Stack), + "WriteHeapDump": ValueOf(debug.WriteHeapDump), + },Types: map[string]Type{ + "GCStats": TypeOf((*debug.GCStats)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/runtime_pprof.go b/vendor/github.com/cosmos72/gomacro/imports/runtime_pprof.go new file mode 100644 index 0000000..42de895 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/runtime_pprof.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "runtime/pprof" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "runtime/pprof" +) + +// reflection: allow interpreted code to import "runtime/pprof" +func init() { + Packages["runtime/pprof"] = Package{ + Binds: map[string]Value{ + "Lookup": ValueOf(pprof.Lookup), + "NewProfile": ValueOf(pprof.NewProfile), + "Profiles": ValueOf(pprof.Profiles), + "StartCPUProfile": ValueOf(pprof.StartCPUProfile), + "StopCPUProfile": ValueOf(pprof.StopCPUProfile), + "WriteHeapProfile": ValueOf(pprof.WriteHeapProfile), + },Types: map[string]Type{ + "Profile": TypeOf((*pprof.Profile)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/runtime_trace.go b/vendor/github.com/cosmos72/gomacro/imports/runtime_trace.go new file mode 100644 index 0000000..5af064d --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/runtime_trace.go @@ -0,0 +1,19 @@ +// this file was generated by gomacro command: import _b "runtime/trace" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "runtime/trace" +) + +// reflection: allow interpreted code to import "runtime/trace" +func init() { + Packages["runtime/trace"] = Package{ + Binds: map[string]Value{ + "Start": ValueOf(trace.Start), + "Stop": ValueOf(trace.Stop), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/sort.go b/vendor/github.com/cosmos72/gomacro/imports/sort.go new file mode 100644 index 0000000..719fb02 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/sort.go @@ -0,0 +1,58 @@ +// this file was generated by gomacro command: import _b "sort" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "sort" +) + +// reflection: allow interpreted code to import "sort" +func init() { + Packages["sort"] = Package{ + Binds: map[string]Value{ + "Float64s": ValueOf(sort.Float64s), + "Float64sAreSorted": ValueOf(sort.Float64sAreSorted), + "Ints": ValueOf(sort.Ints), + "IntsAreSorted": ValueOf(sort.IntsAreSorted), + "IsSorted": ValueOf(sort.IsSorted), + "Reverse": ValueOf(sort.Reverse), + "Search": ValueOf(sort.Search), + "SearchFloat64s": ValueOf(sort.SearchFloat64s), + "SearchInts": ValueOf(sort.SearchInts), + "SearchStrings": ValueOf(sort.SearchStrings), + "Slice": ValueOf(sort.Slice), + "SliceIsSorted": ValueOf(sort.SliceIsSorted), + "SliceStable": ValueOf(sort.SliceStable), + "Sort": ValueOf(sort.Sort), + "Stable": ValueOf(sort.Stable), + "Strings": ValueOf(sort.Strings), + "StringsAreSorted": ValueOf(sort.StringsAreSorted), + },Types: map[string]Type{ + "Float64Slice": TypeOf((*sort.Float64Slice)(nil)).Elem(), + "IntSlice": TypeOf((*sort.IntSlice)(nil)).Elem(), + "Interface": TypeOf((*sort.Interface)(nil)).Elem(), + "StringSlice": TypeOf((*sort.StringSlice)(nil)).Elem(), + },Proxies: map[string]Type{ + "Interface": TypeOf((*Interface_sort)(nil)).Elem(), + }, + } +} + +// --------------- proxy for sort.Interface --------------- +type Interface_sort struct { + Object interface{} + Len_ func(interface{}) int + Less_ func(_proxy_obj_ interface{}, i int, j int) bool + Swap_ func(_proxy_obj_ interface{}, i int, j int) +} +func (Proxy *Interface_sort) Len() int { + return Proxy.Len_(Proxy.Object) +} +func (Proxy *Interface_sort) Less(i int, j int) bool { + return Proxy.Less_(Proxy.Object, i, j) +} +func (Proxy *Interface_sort) Swap(i int, j int) { + Proxy.Swap_(Proxy.Object, i, j) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/strconv.go b/vendor/github.com/cosmos72/gomacro/imports/strconv.go new file mode 100644 index 0000000..8f9f3df --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/strconv.go @@ -0,0 +1,55 @@ +// this file was generated by gomacro command: import _b "strconv" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "strconv" +) + +// reflection: allow interpreted code to import "strconv" +func init() { + Packages["strconv"] = Package{ + Binds: map[string]Value{ + "AppendBool": ValueOf(strconv.AppendBool), + "AppendFloat": ValueOf(strconv.AppendFloat), + "AppendInt": ValueOf(strconv.AppendInt), + "AppendQuote": ValueOf(strconv.AppendQuote), + "AppendQuoteRune": ValueOf(strconv.AppendQuoteRune), + "AppendQuoteRuneToASCII": ValueOf(strconv.AppendQuoteRuneToASCII), + "AppendQuoteRuneToGraphic": ValueOf(strconv.AppendQuoteRuneToGraphic), + "AppendQuoteToASCII": ValueOf(strconv.AppendQuoteToASCII), + "AppendQuoteToGraphic": ValueOf(strconv.AppendQuoteToGraphic), + "AppendUint": ValueOf(strconv.AppendUint), + "Atoi": ValueOf(strconv.Atoi), + "CanBackquote": ValueOf(strconv.CanBackquote), + "ErrRange": ValueOf(&strconv.ErrRange).Elem(), + "ErrSyntax": ValueOf(&strconv.ErrSyntax).Elem(), + "FormatBool": ValueOf(strconv.FormatBool), + "FormatFloat": ValueOf(strconv.FormatFloat), + "FormatInt": ValueOf(strconv.FormatInt), + "FormatUint": ValueOf(strconv.FormatUint), + "IntSize": ValueOf(strconv.IntSize), + "IsGraphic": ValueOf(strconv.IsGraphic), + "IsPrint": ValueOf(strconv.IsPrint), + "Itoa": ValueOf(strconv.Itoa), + "ParseBool": ValueOf(strconv.ParseBool), + "ParseFloat": ValueOf(strconv.ParseFloat), + "ParseInt": ValueOf(strconv.ParseInt), + "ParseUint": ValueOf(strconv.ParseUint), + "Quote": ValueOf(strconv.Quote), + "QuoteRune": ValueOf(strconv.QuoteRune), + "QuoteRuneToASCII": ValueOf(strconv.QuoteRuneToASCII), + "QuoteRuneToGraphic": ValueOf(strconv.QuoteRuneToGraphic), + "QuoteToASCII": ValueOf(strconv.QuoteToASCII), + "QuoteToGraphic": ValueOf(strconv.QuoteToGraphic), + "Unquote": ValueOf(strconv.Unquote), + "UnquoteChar": ValueOf(strconv.UnquoteChar), + },Types: map[string]Type{ + "NumError": TypeOf((*strconv.NumError)(nil)).Elem(), + },Untypeds: map[string]string{ + "IntSize": "int:64", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/strings.go b/vendor/github.com/cosmos72/gomacro/imports/strings.go new file mode 100644 index 0000000..0d98ec3 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/strings.go @@ -0,0 +1,65 @@ +// this file was generated by gomacro command: import _b "strings" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "strings" +) + +// reflection: allow interpreted code to import "strings" +func init() { + Packages["strings"] = Package{ + Binds: map[string]Value{ + "Compare": ValueOf(strings.Compare), + "Contains": ValueOf(strings.Contains), + "ContainsAny": ValueOf(strings.ContainsAny), + "ContainsRune": ValueOf(strings.ContainsRune), + "Count": ValueOf(strings.Count), + "EqualFold": ValueOf(strings.EqualFold), + "Fields": ValueOf(strings.Fields), + "FieldsFunc": ValueOf(strings.FieldsFunc), + "HasPrefix": ValueOf(strings.HasPrefix), + "HasSuffix": ValueOf(strings.HasSuffix), + "Index": ValueOf(strings.Index), + "IndexAny": ValueOf(strings.IndexAny), + "IndexByte": ValueOf(strings.IndexByte), + "IndexFunc": ValueOf(strings.IndexFunc), + "IndexRune": ValueOf(strings.IndexRune), + "Join": ValueOf(strings.Join), + "LastIndex": ValueOf(strings.LastIndex), + "LastIndexAny": ValueOf(strings.LastIndexAny), + "LastIndexByte": ValueOf(strings.LastIndexByte), + "LastIndexFunc": ValueOf(strings.LastIndexFunc), + "Map": ValueOf(strings.Map), + "NewReader": ValueOf(strings.NewReader), + "NewReplacer": ValueOf(strings.NewReplacer), + "Repeat": ValueOf(strings.Repeat), + "Replace": ValueOf(strings.Replace), + "Split": ValueOf(strings.Split), + "SplitAfter": ValueOf(strings.SplitAfter), + "SplitAfterN": ValueOf(strings.SplitAfterN), + "SplitN": ValueOf(strings.SplitN), + "Title": ValueOf(strings.Title), + "ToLower": ValueOf(strings.ToLower), + "ToLowerSpecial": ValueOf(strings.ToLowerSpecial), + "ToTitle": ValueOf(strings.ToTitle), + "ToTitleSpecial": ValueOf(strings.ToTitleSpecial), + "ToUpper": ValueOf(strings.ToUpper), + "ToUpperSpecial": ValueOf(strings.ToUpperSpecial), + "Trim": ValueOf(strings.Trim), + "TrimFunc": ValueOf(strings.TrimFunc), + "TrimLeft": ValueOf(strings.TrimLeft), + "TrimLeftFunc": ValueOf(strings.TrimLeftFunc), + "TrimPrefix": ValueOf(strings.TrimPrefix), + "TrimRight": ValueOf(strings.TrimRight), + "TrimRightFunc": ValueOf(strings.TrimRightFunc), + "TrimSpace": ValueOf(strings.TrimSpace), + "TrimSuffix": ValueOf(strings.TrimSuffix), + },Types: map[string]Type{ + "Reader": TypeOf((*strings.Reader)(nil)).Elem(), + "Replacer": TypeOf((*strings.Replacer)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/sync.go b/vendor/github.com/cosmos72/gomacro/imports/sync.go new file mode 100644 index 0000000..395757e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/sync.go @@ -0,0 +1,41 @@ +// this file was generated by gomacro command: import _b "sync" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "sync" +) + +// reflection: allow interpreted code to import "sync" +func init() { + Packages["sync"] = Package{ + Binds: map[string]Value{ + "NewCond": ValueOf(sync.NewCond), + },Types: map[string]Type{ + "Cond": TypeOf((*sync.Cond)(nil)).Elem(), + "Locker": TypeOf((*sync.Locker)(nil)).Elem(), + "Mutex": TypeOf((*sync.Mutex)(nil)).Elem(), + "Once": TypeOf((*sync.Once)(nil)).Elem(), + "Pool": TypeOf((*sync.Pool)(nil)).Elem(), + "RWMutex": TypeOf((*sync.RWMutex)(nil)).Elem(), + "WaitGroup": TypeOf((*sync.WaitGroup)(nil)).Elem(), + },Proxies: map[string]Type{ + "Locker": TypeOf((*Locker_sync)(nil)).Elem(), + }, + } +} + +// --------------- proxy for sync.Locker --------------- +type Locker_sync struct { + Object interface{} + Lock_ func(interface{}) + Unlock_ func(interface{}) +} +func (Proxy *Locker_sync) Lock() { + Proxy.Lock_(Proxy.Object) +} +func (Proxy *Locker_sync) Unlock() { + Proxy.Unlock_(Proxy.Object) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/sync_atomic.go b/vendor/github.com/cosmos72/gomacro/imports/sync_atomic.go new file mode 100644 index 0000000..df02d6a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/sync_atomic.go @@ -0,0 +1,48 @@ +// this file was generated by gomacro command: import _b "sync/atomic" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "sync/atomic" +) + +// reflection: allow interpreted code to import "sync/atomic" +func init() { + Packages["sync/atomic"] = Package{ + Binds: map[string]Value{ + "AddInt32": ValueOf(atomic.AddInt32), + "AddInt64": ValueOf(atomic.AddInt64), + "AddUint32": ValueOf(atomic.AddUint32), + "AddUint64": ValueOf(atomic.AddUint64), + "AddUintptr": ValueOf(atomic.AddUintptr), + "CompareAndSwapInt32": ValueOf(atomic.CompareAndSwapInt32), + "CompareAndSwapInt64": ValueOf(atomic.CompareAndSwapInt64), + "CompareAndSwapPointer": ValueOf(atomic.CompareAndSwapPointer), + "CompareAndSwapUint32": ValueOf(atomic.CompareAndSwapUint32), + "CompareAndSwapUint64": ValueOf(atomic.CompareAndSwapUint64), + "CompareAndSwapUintptr": ValueOf(atomic.CompareAndSwapUintptr), + "LoadInt32": ValueOf(atomic.LoadInt32), + "LoadInt64": ValueOf(atomic.LoadInt64), + "LoadPointer": ValueOf(atomic.LoadPointer), + "LoadUint32": ValueOf(atomic.LoadUint32), + "LoadUint64": ValueOf(atomic.LoadUint64), + "LoadUintptr": ValueOf(atomic.LoadUintptr), + "StoreInt32": ValueOf(atomic.StoreInt32), + "StoreInt64": ValueOf(atomic.StoreInt64), + "StorePointer": ValueOf(atomic.StorePointer), + "StoreUint32": ValueOf(atomic.StoreUint32), + "StoreUint64": ValueOf(atomic.StoreUint64), + "StoreUintptr": ValueOf(atomic.StoreUintptr), + "SwapInt32": ValueOf(atomic.SwapInt32), + "SwapInt64": ValueOf(atomic.SwapInt64), + "SwapPointer": ValueOf(atomic.SwapPointer), + "SwapUint32": ValueOf(atomic.SwapUint32), + "SwapUint64": ValueOf(atomic.SwapUint64), + "SwapUintptr": ValueOf(atomic.SwapUintptr), + },Types: map[string]Type{ + "Value": TypeOf((*atomic.Value)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_386.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_386.go new file mode 100644 index 0000000..4e316cd --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_386.go @@ -0,0 +1,1918 @@ +// +build !gccgo + +// this file was generated by gomacro command: import "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_CCITT": ValueOf(syscall.AF_CCITT), + "AF_CHAOS": ValueOf(syscall.AF_CHAOS), + "AF_CNT": ValueOf(syscall.AF_CNT), + "AF_COIP": ValueOf(syscall.AF_COIP), + "AF_DATAKIT": ValueOf(syscall.AF_DATAKIT), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_DLI": ValueOf(syscall.AF_DLI), + "AF_E164": ValueOf(syscall.AF_E164), + "AF_ECMA": ValueOf(syscall.AF_ECMA), + "AF_HYLINK": ValueOf(syscall.AF_HYLINK), + "AF_IEEE80211": ValueOf(syscall.AF_IEEE80211), + "AF_IMPLINK": ValueOf(syscall.AF_IMPLINK), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_ISO": ValueOf(syscall.AF_ISO), + "AF_LAT": ValueOf(syscall.AF_LAT), + "AF_LINK": ValueOf(syscall.AF_LINK), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NATM": ValueOf(syscall.AF_NATM), + "AF_NDRV": ValueOf(syscall.AF_NDRV), + "AF_NETBIOS": ValueOf(syscall.AF_NETBIOS), + "AF_NS": ValueOf(syscall.AF_NS), + "AF_OSI": ValueOf(syscall.AF_OSI), + "AF_PPP": ValueOf(syscall.AF_PPP), + "AF_PUP": ValueOf(syscall.AF_PUP), + "AF_RESERVED_36": ValueOf(syscall.AF_RESERVED_36), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_SIP": ValueOf(syscall.AF_SIP), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_SYSTEM": ValueOf(syscall.AF_SYSTEM), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "Accept": ValueOf(syscall.Accept), + "Access": ValueOf(syscall.Access), + "Adjtime": ValueOf(syscall.Adjtime), + "B0": ValueOf(syscall.B0), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B14400": ValueOf(syscall.B14400), + "B150": ValueOf(syscall.B150), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B28800": ValueOf(syscall.B28800), + "B300": ValueOf(syscall.B300), + "B38400": ValueOf(syscall.B38400), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B57600": ValueOf(syscall.B57600), + "B600": ValueOf(syscall.B600), + "B7200": ValueOf(syscall.B7200), + "B75": ValueOf(syscall.B75), + "B76800": ValueOf(syscall.B76800), + "B9600": ValueOf(syscall.B9600), + "BIOCFLUSH": ValueOf(syscall.BIOCFLUSH), + "BIOCGBLEN": ValueOf(syscall.BIOCGBLEN), + "BIOCGDLT": ValueOf(syscall.BIOCGDLT), + "BIOCGDLTLIST": ValueOf(uint64(syscall.BIOCGDLTLIST)), + "BIOCGETIF": ValueOf(syscall.BIOCGETIF), + "BIOCGHDRCMPLT": ValueOf(syscall.BIOCGHDRCMPLT), + "BIOCGRSIG": ValueOf(syscall.BIOCGRSIG), + "BIOCGRTIMEOUT": ValueOf(syscall.BIOCGRTIMEOUT), + "BIOCGSEESENT": ValueOf(syscall.BIOCGSEESENT), + "BIOCGSTATS": ValueOf(syscall.BIOCGSTATS), + "BIOCIMMEDIATE": ValueOf(uint64(syscall.BIOCIMMEDIATE)), + "BIOCPROMISC": ValueOf(syscall.BIOCPROMISC), + "BIOCSBLEN": ValueOf(uint64(syscall.BIOCSBLEN)), + "BIOCSDLT": ValueOf(uint64(syscall.BIOCSDLT)), + "BIOCSETF": ValueOf(uint64(syscall.BIOCSETF)), + "BIOCSETIF": ValueOf(uint64(syscall.BIOCSETIF)), + "BIOCSHDRCMPLT": ValueOf(uint64(syscall.BIOCSHDRCMPLT)), + "BIOCSRSIG": ValueOf(uint64(syscall.BIOCSRSIG)), + "BIOCSRTIMEOUT": ValueOf(uint64(syscall.BIOCSRTIMEOUT)), + "BIOCSSEESENT": ValueOf(uint64(syscall.BIOCSSEESENT)), + "BIOCVERSION": ValueOf(syscall.BIOCVERSION), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALIGNMENT": ValueOf(syscall.BPF_ALIGNMENT), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXBUFSIZE": ValueOf(syscall.BPF_MAXBUFSIZE), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINBUFSIZE": ValueOf(syscall.BPF_MINBUFSIZE), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RELEASE": ValueOf(syscall.BPF_RELEASE), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BpfBuflen": ValueOf(syscall.BpfBuflen), + "BpfDatalink": ValueOf(syscall.BpfDatalink), + "BpfHeadercmpl": ValueOf(syscall.BpfHeadercmpl), + "BpfInterface": ValueOf(syscall.BpfInterface), + "BpfJump": ValueOf(syscall.BpfJump), + "BpfStats": ValueOf(syscall.BpfStats), + "BpfStmt": ValueOf(syscall.BpfStmt), + "BpfTimeout": ValueOf(syscall.BpfTimeout), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CFLUSH": ValueOf(syscall.CFLUSH), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTART": ValueOf(syscall.CSTART), + "CSTATUS": ValueOf(syscall.CSTATUS), + "CSTOP": ValueOf(syscall.CSTOP), + "CSTOPB": ValueOf(syscall.CSTOPB), + "CSUSP": ValueOf(syscall.CSUSP), + "CTL_MAXNAME": ValueOf(syscall.CTL_MAXNAME), + "CTL_NET": ValueOf(syscall.CTL_NET), + "Chdir": ValueOf(syscall.Chdir), + "CheckBpfVersion": ValueOf(syscall.CheckBpfVersion), + "Chflags": ValueOf(syscall.Chflags), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "DLT_APPLE_IP_OVER_IEEE1394": ValueOf(syscall.DLT_APPLE_IP_OVER_IEEE1394), + "DLT_ARCNET": ValueOf(syscall.DLT_ARCNET), + "DLT_ATM_CLIP": ValueOf(syscall.DLT_ATM_CLIP), + "DLT_ATM_RFC1483": ValueOf(syscall.DLT_ATM_RFC1483), + "DLT_AX25": ValueOf(syscall.DLT_AX25), + "DLT_CHAOS": ValueOf(syscall.DLT_CHAOS), + "DLT_CHDLC": ValueOf(syscall.DLT_CHDLC), + "DLT_C_HDLC": ValueOf(syscall.DLT_C_HDLC), + "DLT_EN10MB": ValueOf(syscall.DLT_EN10MB), + "DLT_EN3MB": ValueOf(syscall.DLT_EN3MB), + "DLT_FDDI": ValueOf(syscall.DLT_FDDI), + "DLT_IEEE802": ValueOf(syscall.DLT_IEEE802), + "DLT_IEEE802_11": ValueOf(syscall.DLT_IEEE802_11), + "DLT_IEEE802_11_RADIO": ValueOf(syscall.DLT_IEEE802_11_RADIO), + "DLT_IEEE802_11_RADIO_AVS": ValueOf(syscall.DLT_IEEE802_11_RADIO_AVS), + "DLT_LINUX_SLL": ValueOf(syscall.DLT_LINUX_SLL), + "DLT_LOOP": ValueOf(syscall.DLT_LOOP), + "DLT_NULL": ValueOf(syscall.DLT_NULL), + "DLT_PFLOG": ValueOf(syscall.DLT_PFLOG), + "DLT_PFSYNC": ValueOf(syscall.DLT_PFSYNC), + "DLT_PPP": ValueOf(syscall.DLT_PPP), + "DLT_PPP_BSDOS": ValueOf(syscall.DLT_PPP_BSDOS), + "DLT_PPP_SERIAL": ValueOf(syscall.DLT_PPP_SERIAL), + "DLT_PRONET": ValueOf(syscall.DLT_PRONET), + "DLT_RAW": ValueOf(syscall.DLT_RAW), + "DLT_SLIP": ValueOf(syscall.DLT_SLIP), + "DLT_SLIP_BSDOS": ValueOf(syscall.DLT_SLIP_BSDOS), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EAUTH": ValueOf(syscall.EAUTH), + "EBADARCH": ValueOf(syscall.EBADARCH), + "EBADEXEC": ValueOf(syscall.EBADEXEC), + "EBADF": ValueOf(syscall.EBADF), + "EBADMACHO": ValueOf(syscall.EBADMACHO), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADRPC": ValueOf(syscall.EBADRPC), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDEVERR": ValueOf(syscall.EDEVERR), + "EDOM": ValueOf(syscall.EDOM), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EFTYPE": ValueOf(syscall.EFTYPE), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "ELAST": ValueOf(syscall.ELAST), + "ELOOP": ValueOf(syscall.ELOOP), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENEEDAUTH": ValueOf(syscall.ENEEDAUTH), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOATTR": ValueOf(syscall.ENOATTR), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENOPOLICY": ValueOf(syscall.ENOPOLICY), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPROCLIM": ValueOf(syscall.EPROCLIM), + "EPROCUNAVAIL": ValueOf(syscall.EPROCUNAVAIL), + "EPROGMISMATCH": ValueOf(syscall.EPROGMISMATCH), + "EPROGUNAVAIL": ValueOf(syscall.EPROGUNAVAIL), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "EPWROFF": ValueOf(syscall.EPWROFF), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EROFS": ValueOf(syscall.EROFS), + "ERPCMISMATCH": ValueOf(syscall.ERPCMISMATCH), + "ESHLIBVERS": ValueOf(syscall.ESHLIBVERS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESTALE": ValueOf(syscall.ESTALE), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUSERS": ValueOf(syscall.EUSERS), + "EVFILT_AIO": ValueOf(syscall.EVFILT_AIO), + "EVFILT_FS": ValueOf(syscall.EVFILT_FS), + "EVFILT_MACHPORT": ValueOf(syscall.EVFILT_MACHPORT), + "EVFILT_PROC": ValueOf(syscall.EVFILT_PROC), + "EVFILT_READ": ValueOf(syscall.EVFILT_READ), + "EVFILT_SIGNAL": ValueOf(syscall.EVFILT_SIGNAL), + "EVFILT_SYSCOUNT": ValueOf(syscall.EVFILT_SYSCOUNT), + "EVFILT_THREADMARKER": ValueOf(syscall.EVFILT_THREADMARKER), + "EVFILT_TIMER": ValueOf(syscall.EVFILT_TIMER), + "EVFILT_USER": ValueOf(syscall.EVFILT_USER), + "EVFILT_VM": ValueOf(syscall.EVFILT_VM), + "EVFILT_VNODE": ValueOf(syscall.EVFILT_VNODE), + "EVFILT_WRITE": ValueOf(syscall.EVFILT_WRITE), + "EV_ADD": ValueOf(syscall.EV_ADD), + "EV_CLEAR": ValueOf(syscall.EV_CLEAR), + "EV_DELETE": ValueOf(syscall.EV_DELETE), + "EV_DISABLE": ValueOf(syscall.EV_DISABLE), + "EV_DISPATCH": ValueOf(syscall.EV_DISPATCH), + "EV_ENABLE": ValueOf(syscall.EV_ENABLE), + "EV_EOF": ValueOf(syscall.EV_EOF), + "EV_ERROR": ValueOf(syscall.EV_ERROR), + "EV_FLAG0": ValueOf(syscall.EV_FLAG0), + "EV_FLAG1": ValueOf(syscall.EV_FLAG1), + "EV_ONESHOT": ValueOf(syscall.EV_ONESHOT), + "EV_OOBAND": ValueOf(syscall.EV_OOBAND), + "EV_POLL": ValueOf(syscall.EV_POLL), + "EV_RECEIPT": ValueOf(syscall.EV_RECEIPT), + "EV_SYSFLAGS": ValueOf(syscall.EV_SYSFLAGS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXTA": ValueOf(syscall.EXTA), + "EXTB": ValueOf(syscall.EXTB), + "EXTPROC": ValueOf(syscall.EXTPROC), + "Environ": ValueOf(syscall.Environ), + "Exchangedata": ValueOf(syscall.Exchangedata), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_ADDFILESIGS": ValueOf(syscall.F_ADDFILESIGS), + "F_ADDSIGS": ValueOf(syscall.F_ADDSIGS), + "F_ALLOCATEALL": ValueOf(syscall.F_ALLOCATEALL), + "F_ALLOCATECONTIG": ValueOf(syscall.F_ALLOCATECONTIG), + "F_CHKCLEAN": ValueOf(syscall.F_CHKCLEAN), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_FLUSH_DATA": ValueOf(syscall.F_FLUSH_DATA), + "F_FREEZE_FS": ValueOf(syscall.F_FREEZE_FS), + "F_FULLFSYNC": ValueOf(syscall.F_FULLFSYNC), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLKPID": ValueOf(syscall.F_GETLKPID), + "F_GETNOSIGPIPE": ValueOf(syscall.F_GETNOSIGPIPE), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETPATH": ValueOf(syscall.F_GETPATH), + "F_GETPATH_MTMINFO": ValueOf(syscall.F_GETPATH_MTMINFO), + "F_GETPROTECTIONCLASS": ValueOf(syscall.F_GETPROTECTIONCLASS), + "F_GLOBAL_NOCACHE": ValueOf(syscall.F_GLOBAL_NOCACHE), + "F_LOG2PHYS": ValueOf(syscall.F_LOG2PHYS), + "F_LOG2PHYS_EXT": ValueOf(syscall.F_LOG2PHYS_EXT), + "F_MARKDEPENDENCY": ValueOf(syscall.F_MARKDEPENDENCY), + "F_NOCACHE": ValueOf(syscall.F_NOCACHE), + "F_NODIRECT": ValueOf(syscall.F_NODIRECT), + "F_OK": ValueOf(syscall.F_OK), + "F_PATHPKG_CHECK": ValueOf(syscall.F_PATHPKG_CHECK), + "F_PEOFPOSMODE": ValueOf(syscall.F_PEOFPOSMODE), + "F_PREALLOCATE": ValueOf(syscall.F_PREALLOCATE), + "F_RDADVISE": ValueOf(syscall.F_RDADVISE), + "F_RDAHEAD": ValueOf(syscall.F_RDAHEAD), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_READBOOTSTRAP": ValueOf(syscall.F_READBOOTSTRAP), + "F_SETBACKINGSTORE": ValueOf(syscall.F_SETBACKINGSTORE), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETNOSIGPIPE": ValueOf(syscall.F_SETNOSIGPIPE), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETPROTECTIONCLASS": ValueOf(syscall.F_SETPROTECTIONCLASS), + "F_SETSIZE": ValueOf(syscall.F_SETSIZE), + "F_THAW_FS": ValueOf(syscall.F_THAW_FS), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_VOLPOSMODE": ValueOf(syscall.F_VOLPOSMODE), + "F_WRITEBOOTSTRAP": ValueOf(syscall.F_WRITEBOOTSTRAP), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchflags": ValueOf(syscall.Fchflags), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchown": ValueOf(syscall.Fchown), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Flock": ValueOf(syscall.Flock), + "FlushBpf": ValueOf(syscall.FlushBpf), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fpathconf": ValueOf(syscall.Fpathconf), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Getdirentries": ValueOf(syscall.Getdirentries), + "Getdtablesize": ValueOf(syscall.Getdtablesize), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getfsstat": ValueOf(syscall.Getfsstat), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsid": ValueOf(syscall.Getsid), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptByte": ValueOf(syscall.GetsockoptByte), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMP6_FILTER": ValueOf(syscall.ICMP6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_ALTPHYS": ValueOf(syscall.IFF_ALTPHYS), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_LINK0": ValueOf(syscall.IFF_LINK0), + "IFF_LINK1": ValueOf(syscall.IFF_LINK1), + "IFF_LINK2": ValueOf(syscall.IFF_LINK2), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_OACTIVE": ValueOf(syscall.IFF_OACTIVE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SIMPLEX": ValueOf(syscall.IFF_SIMPLEX), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IFT_1822": ValueOf(syscall.IFT_1822), + "IFT_AAL5": ValueOf(syscall.IFT_AAL5), + "IFT_ARCNET": ValueOf(syscall.IFT_ARCNET), + "IFT_ARCNETPLUS": ValueOf(syscall.IFT_ARCNETPLUS), + "IFT_ATM": ValueOf(syscall.IFT_ATM), + "IFT_BRIDGE": ValueOf(syscall.IFT_BRIDGE), + "IFT_CARP": ValueOf(syscall.IFT_CARP), + "IFT_CELLULAR": ValueOf(syscall.IFT_CELLULAR), + "IFT_CEPT": ValueOf(syscall.IFT_CEPT), + "IFT_DS3": ValueOf(syscall.IFT_DS3), + "IFT_ENC": ValueOf(syscall.IFT_ENC), + "IFT_EON": ValueOf(syscall.IFT_EON), + "IFT_ETHER": ValueOf(syscall.IFT_ETHER), + "IFT_FAITH": ValueOf(syscall.IFT_FAITH), + "IFT_FDDI": ValueOf(syscall.IFT_FDDI), + "IFT_FRELAY": ValueOf(syscall.IFT_FRELAY), + "IFT_FRELAYDCE": ValueOf(syscall.IFT_FRELAYDCE), + "IFT_GIF": ValueOf(syscall.IFT_GIF), + "IFT_HDH1822": ValueOf(syscall.IFT_HDH1822), + "IFT_HIPPI": ValueOf(syscall.IFT_HIPPI), + "IFT_HSSI": ValueOf(syscall.IFT_HSSI), + "IFT_HY": ValueOf(syscall.IFT_HY), + "IFT_IEEE1394": ValueOf(syscall.IFT_IEEE1394), + "IFT_IEEE8023ADLAG": ValueOf(syscall.IFT_IEEE8023ADLAG), + "IFT_ISDNBASIC": ValueOf(syscall.IFT_ISDNBASIC), + "IFT_ISDNPRIMARY": ValueOf(syscall.IFT_ISDNPRIMARY), + "IFT_ISO88022LLC": ValueOf(syscall.IFT_ISO88022LLC), + "IFT_ISO88023": ValueOf(syscall.IFT_ISO88023), + "IFT_ISO88024": ValueOf(syscall.IFT_ISO88024), + "IFT_ISO88025": ValueOf(syscall.IFT_ISO88025), + "IFT_ISO88026": ValueOf(syscall.IFT_ISO88026), + "IFT_L2VLAN": ValueOf(syscall.IFT_L2VLAN), + "IFT_LAPB": ValueOf(syscall.IFT_LAPB), + "IFT_LOCALTALK": ValueOf(syscall.IFT_LOCALTALK), + "IFT_LOOP": ValueOf(syscall.IFT_LOOP), + "IFT_MIOX25": ValueOf(syscall.IFT_MIOX25), + "IFT_MODEM": ValueOf(syscall.IFT_MODEM), + "IFT_NSIP": ValueOf(syscall.IFT_NSIP), + "IFT_OTHER": ValueOf(syscall.IFT_OTHER), + "IFT_P10": ValueOf(syscall.IFT_P10), + "IFT_P80": ValueOf(syscall.IFT_P80), + "IFT_PARA": ValueOf(syscall.IFT_PARA), + "IFT_PDP": ValueOf(syscall.IFT_PDP), + "IFT_PFLOG": ValueOf(syscall.IFT_PFLOG), + "IFT_PFSYNC": ValueOf(syscall.IFT_PFSYNC), + "IFT_PPP": ValueOf(syscall.IFT_PPP), + "IFT_PROPMUX": ValueOf(syscall.IFT_PROPMUX), + "IFT_PROPVIRTUAL": ValueOf(syscall.IFT_PROPVIRTUAL), + "IFT_PTPSERIAL": ValueOf(syscall.IFT_PTPSERIAL), + "IFT_RS232": ValueOf(syscall.IFT_RS232), + "IFT_SDLC": ValueOf(syscall.IFT_SDLC), + "IFT_SIP": ValueOf(syscall.IFT_SIP), + "IFT_SLIP": ValueOf(syscall.IFT_SLIP), + "IFT_SMDSDXI": ValueOf(syscall.IFT_SMDSDXI), + "IFT_SMDSICIP": ValueOf(syscall.IFT_SMDSICIP), + "IFT_SONET": ValueOf(syscall.IFT_SONET), + "IFT_SONETPATH": ValueOf(syscall.IFT_SONETPATH), + "IFT_SONETVT": ValueOf(syscall.IFT_SONETVT), + "IFT_STARLAN": ValueOf(syscall.IFT_STARLAN), + "IFT_STF": ValueOf(syscall.IFT_STF), + "IFT_T1": ValueOf(syscall.IFT_T1), + "IFT_ULTRA": ValueOf(syscall.IFT_ULTRA), + "IFT_V35": ValueOf(syscall.IFT_V35), + "IFT_X25": ValueOf(syscall.IFT_X25), + "IFT_X25DDN": ValueOf(syscall.IFT_X25DDN), + "IFT_X25PLE": ValueOf(syscall.IFT_X25PLE), + "IFT_XETHER": ValueOf(syscall.IFT_XETHER), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint64(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint64(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint64(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLASSD_HOST": ValueOf(syscall.IN_CLASSD_HOST), + "IN_CLASSD_NET": ValueOf(uint64(syscall.IN_CLASSD_NET)), + "IN_CLASSD_NSHIFT": ValueOf(syscall.IN_CLASSD_NSHIFT), + "IN_LINKLOCALNETNUM": ValueOf(uint64(syscall.IN_LINKLOCALNETNUM)), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IPPROTO_3PC": ValueOf(syscall.IPPROTO_3PC), + "IPPROTO_ADFS": ValueOf(syscall.IPPROTO_ADFS), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_AHIP": ValueOf(syscall.IPPROTO_AHIP), + "IPPROTO_APES": ValueOf(syscall.IPPROTO_APES), + "IPPROTO_ARGUS": ValueOf(syscall.IPPROTO_ARGUS), + "IPPROTO_AX25": ValueOf(syscall.IPPROTO_AX25), + "IPPROTO_BHA": ValueOf(syscall.IPPROTO_BHA), + "IPPROTO_BLT": ValueOf(syscall.IPPROTO_BLT), + "IPPROTO_BRSATMON": ValueOf(syscall.IPPROTO_BRSATMON), + "IPPROTO_CFTP": ValueOf(syscall.IPPROTO_CFTP), + "IPPROTO_CHAOS": ValueOf(syscall.IPPROTO_CHAOS), + "IPPROTO_CMTP": ValueOf(syscall.IPPROTO_CMTP), + "IPPROTO_CPHB": ValueOf(syscall.IPPROTO_CPHB), + "IPPROTO_CPNX": ValueOf(syscall.IPPROTO_CPNX), + "IPPROTO_DDP": ValueOf(syscall.IPPROTO_DDP), + "IPPROTO_DGP": ValueOf(syscall.IPPROTO_DGP), + "IPPROTO_DIVERT": ValueOf(syscall.IPPROTO_DIVERT), + "IPPROTO_DONE": ValueOf(syscall.IPPROTO_DONE), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_EMCON": ValueOf(syscall.IPPROTO_EMCON), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_EON": ValueOf(syscall.IPPROTO_EON), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_ETHERIP": ValueOf(syscall.IPPROTO_ETHERIP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GGP": ValueOf(syscall.IPPROTO_GGP), + "IPPROTO_GMTP": ValueOf(syscall.IPPROTO_GMTP), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HELLO": ValueOf(syscall.IPPROTO_HELLO), + "IPPROTO_HMP": ValueOf(syscall.IPPROTO_HMP), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IDPR": ValueOf(syscall.IPPROTO_IDPR), + "IPPROTO_IDRP": ValueOf(syscall.IPPROTO_IDRP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IGP": ValueOf(syscall.IPPROTO_IGP), + "IPPROTO_IGRP": ValueOf(syscall.IPPROTO_IGRP), + "IPPROTO_IL": ValueOf(syscall.IPPROTO_IL), + "IPPROTO_INLSP": ValueOf(syscall.IPPROTO_INLSP), + "IPPROTO_INP": ValueOf(syscall.IPPROTO_INP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPCOMP": ValueOf(syscall.IPPROTO_IPCOMP), + "IPPROTO_IPCV": ValueOf(syscall.IPPROTO_IPCV), + "IPPROTO_IPEIP": ValueOf(syscall.IPPROTO_IPEIP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPPC": ValueOf(syscall.IPPROTO_IPPC), + "IPPROTO_IPV4": ValueOf(syscall.IPPROTO_IPV4), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_IRTP": ValueOf(syscall.IPPROTO_IRTP), + "IPPROTO_KRYPTOLAN": ValueOf(syscall.IPPROTO_KRYPTOLAN), + "IPPROTO_LARP": ValueOf(syscall.IPPROTO_LARP), + "IPPROTO_LEAF1": ValueOf(syscall.IPPROTO_LEAF1), + "IPPROTO_LEAF2": ValueOf(syscall.IPPROTO_LEAF2), + "IPPROTO_MAX": ValueOf(syscall.IPPROTO_MAX), + "IPPROTO_MAXID": ValueOf(syscall.IPPROTO_MAXID), + "IPPROTO_MEAS": ValueOf(syscall.IPPROTO_MEAS), + "IPPROTO_MHRP": ValueOf(syscall.IPPROTO_MHRP), + "IPPROTO_MICP": ValueOf(syscall.IPPROTO_MICP), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_MUX": ValueOf(syscall.IPPROTO_MUX), + "IPPROTO_ND": ValueOf(syscall.IPPROTO_ND), + "IPPROTO_NHRP": ValueOf(syscall.IPPROTO_NHRP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_NSP": ValueOf(syscall.IPPROTO_NSP), + "IPPROTO_NVPII": ValueOf(syscall.IPPROTO_NVPII), + "IPPROTO_OSPFIGP": ValueOf(syscall.IPPROTO_OSPFIGP), + "IPPROTO_PGM": ValueOf(syscall.IPPROTO_PGM), + "IPPROTO_PIGP": ValueOf(syscall.IPPROTO_PIGP), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PRM": ValueOf(syscall.IPPROTO_PRM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_PVP": ValueOf(syscall.IPPROTO_PVP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_RCCMON": ValueOf(syscall.IPPROTO_RCCMON), + "IPPROTO_RDP": ValueOf(syscall.IPPROTO_RDP), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_RVD": ValueOf(syscall.IPPROTO_RVD), + "IPPROTO_SATEXPAK": ValueOf(syscall.IPPROTO_SATEXPAK), + "IPPROTO_SATMON": ValueOf(syscall.IPPROTO_SATMON), + "IPPROTO_SCCSP": ValueOf(syscall.IPPROTO_SCCSP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_SDRP": ValueOf(syscall.IPPROTO_SDRP), + "IPPROTO_SEP": ValueOf(syscall.IPPROTO_SEP), + "IPPROTO_SRPC": ValueOf(syscall.IPPROTO_SRPC), + "IPPROTO_ST": ValueOf(syscall.IPPROTO_ST), + "IPPROTO_SVMTP": ValueOf(syscall.IPPROTO_SVMTP), + "IPPROTO_SWIPE": ValueOf(syscall.IPPROTO_SWIPE), + "IPPROTO_TCF": ValueOf(syscall.IPPROTO_TCF), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_TPXX": ValueOf(syscall.IPPROTO_TPXX), + "IPPROTO_TRUNK1": ValueOf(syscall.IPPROTO_TRUNK1), + "IPPROTO_TRUNK2": ValueOf(syscall.IPPROTO_TRUNK2), + "IPPROTO_TTP": ValueOf(syscall.IPPROTO_TTP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_VINES": ValueOf(syscall.IPPROTO_VINES), + "IPPROTO_VISA": ValueOf(syscall.IPPROTO_VISA), + "IPPROTO_VMTP": ValueOf(syscall.IPPROTO_VMTP), + "IPPROTO_WBEXPAK": ValueOf(syscall.IPPROTO_WBEXPAK), + "IPPROTO_WBMON": ValueOf(syscall.IPPROTO_WBMON), + "IPPROTO_WSN": ValueOf(syscall.IPPROTO_WSN), + "IPPROTO_XNET": ValueOf(syscall.IPPROTO_XNET), + "IPPROTO_XTP": ValueOf(syscall.IPPROTO_XTP), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292NEXTHOP": ValueOf(syscall.IPV6_2292NEXTHOP), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_BINDV6ONLY": ValueOf(syscall.IPV6_BINDV6ONLY), + "IPV6_BOUND_IF": ValueOf(syscall.IPV6_BOUND_IF), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DEFAULT_MULTICAST_HOPS": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_HOPS), + "IPV6_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_LOOP), + "IPV6_DEFHLIM": ValueOf(syscall.IPV6_DEFHLIM), + "IPV6_FAITH": ValueOf(syscall.IPV6_FAITH), + "IPV6_FLOWINFO_MASK": ValueOf(uint64(syscall.IPV6_FLOWINFO_MASK)), + "IPV6_FLOWLABEL_MASK": ValueOf(uint64(syscall.IPV6_FLOWLABEL_MASK)), + "IPV6_FRAGTTL": ValueOf(syscall.IPV6_FRAGTTL), + "IPV6_FW_ADD": ValueOf(syscall.IPV6_FW_ADD), + "IPV6_FW_DEL": ValueOf(syscall.IPV6_FW_DEL), + "IPV6_FW_FLUSH": ValueOf(syscall.IPV6_FW_FLUSH), + "IPV6_FW_GET": ValueOf(syscall.IPV6_FW_GET), + "IPV6_FW_ZERO": ValueOf(syscall.IPV6_FW_ZERO), + "IPV6_HLIMDEC": ValueOf(syscall.IPV6_HLIMDEC), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MAXHLIM": ValueOf(syscall.IPV6_MAXHLIM), + "IPV6_MAXOPTHDR": ValueOf(syscall.IPV6_MAXOPTHDR), + "IPV6_MAXPACKET": ValueOf(syscall.IPV6_MAXPACKET), + "IPV6_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IPV6_MAX_GROUP_SRC_FILTER), + "IPV6_MAX_MEMBERSHIPS": ValueOf(syscall.IPV6_MAX_MEMBERSHIPS), + "IPV6_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IPV6_MAX_SOCK_SRC_FILTER), + "IPV6_MIN_MEMBERSHIPS": ValueOf(syscall.IPV6_MIN_MEMBERSHIPS), + "IPV6_MMTU": ValueOf(syscall.IPV6_MMTU), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_PORTRANGE": ValueOf(syscall.IPV6_PORTRANGE), + "IPV6_PORTRANGE_DEFAULT": ValueOf(syscall.IPV6_PORTRANGE_DEFAULT), + "IPV6_PORTRANGE_HIGH": ValueOf(syscall.IPV6_PORTRANGE_HIGH), + "IPV6_PORTRANGE_LOW": ValueOf(syscall.IPV6_PORTRANGE_LOW), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_SOCKOPT_RESERVED1": ValueOf(syscall.IPV6_SOCKOPT_RESERVED1), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_VERSION": ValueOf(syscall.IPV6_VERSION), + "IPV6_VERSION_MASK": ValueOf(syscall.IPV6_VERSION_MASK), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_BOUND_IF": ValueOf(syscall.IP_BOUND_IF), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_DUMMYNET_CONFIGURE": ValueOf(syscall.IP_DUMMYNET_CONFIGURE), + "IP_DUMMYNET_DEL": ValueOf(syscall.IP_DUMMYNET_DEL), + "IP_DUMMYNET_FLUSH": ValueOf(syscall.IP_DUMMYNET_FLUSH), + "IP_DUMMYNET_GET": ValueOf(syscall.IP_DUMMYNET_GET), + "IP_FAITH": ValueOf(syscall.IP_FAITH), + "IP_FW_ADD": ValueOf(syscall.IP_FW_ADD), + "IP_FW_DEL": ValueOf(syscall.IP_FW_DEL), + "IP_FW_FLUSH": ValueOf(syscall.IP_FW_FLUSH), + "IP_FW_GET": ValueOf(syscall.IP_FW_GET), + "IP_FW_RESETLOG": ValueOf(syscall.IP_FW_RESETLOG), + "IP_FW_ZERO": ValueOf(syscall.IP_FW_ZERO), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IP_MAX_GROUP_SRC_FILTER), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MAX_SOCK_MUTE_FILTER": ValueOf(syscall.IP_MAX_SOCK_MUTE_FILTER), + "IP_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IP_MAX_SOCK_SRC_FILTER), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MIN_MEMBERSHIPS": ValueOf(syscall.IP_MIN_MEMBERSHIPS), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_IFINDEX": ValueOf(syscall.IP_MULTICAST_IFINDEX), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_MULTICAST_VIF": ValueOf(syscall.IP_MULTICAST_VIF), + "IP_NAT__XXX": ValueOf(syscall.IP_NAT__XXX), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OLD_FW_ADD": ValueOf(syscall.IP_OLD_FW_ADD), + "IP_OLD_FW_DEL": ValueOf(syscall.IP_OLD_FW_DEL), + "IP_OLD_FW_FLUSH": ValueOf(syscall.IP_OLD_FW_FLUSH), + "IP_OLD_FW_GET": ValueOf(syscall.IP_OLD_FW_GET), + "IP_OLD_FW_RESETLOG": ValueOf(syscall.IP_OLD_FW_RESETLOG), + "IP_OLD_FW_ZERO": ValueOf(syscall.IP_OLD_FW_ZERO), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PORTRANGE": ValueOf(syscall.IP_PORTRANGE), + "IP_PORTRANGE_DEFAULT": ValueOf(syscall.IP_PORTRANGE_DEFAULT), + "IP_PORTRANGE_HIGH": ValueOf(syscall.IP_PORTRANGE_HIGH), + "IP_PORTRANGE_LOW": ValueOf(syscall.IP_PORTRANGE_LOW), + "IP_RECVDSTADDR": ValueOf(syscall.IP_RECVDSTADDR), + "IP_RECVIF": ValueOf(syscall.IP_RECVIF), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVPKTINFO": ValueOf(syscall.IP_RECVPKTINFO), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_RSVP_OFF": ValueOf(syscall.IP_RSVP_OFF), + "IP_RSVP_ON": ValueOf(syscall.IP_RSVP_ON), + "IP_RSVP_VIF_OFF": ValueOf(syscall.IP_RSVP_VIF_OFF), + "IP_RSVP_VIF_ON": ValueOf(syscall.IP_RSVP_VIF_ON), + "IP_STRIPHDR": ValueOf(syscall.IP_STRIPHDR), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRAFFIC_MGT_BACKGROUND": ValueOf(syscall.IP_TRAFFIC_MGT_BACKGROUND), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "Issetugid": ValueOf(syscall.Issetugid), + "Kevent": ValueOf(syscall.Kevent), + "Kill": ValueOf(syscall.Kill), + "Kqueue": ValueOf(syscall.Kqueue), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Lstat": ValueOf(syscall.Lstat), + "MADV_CAN_REUSE": ValueOf(syscall.MADV_CAN_REUSE), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_FREE": ValueOf(syscall.MADV_FREE), + "MADV_FREE_REUSABLE": ValueOf(syscall.MADV_FREE_REUSABLE), + "MADV_FREE_REUSE": ValueOf(syscall.MADV_FREE_REUSE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MADV_ZERO_WIRED_PAGES": ValueOf(syscall.MADV_ZERO_WIRED_PAGES), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_COPY": ValueOf(syscall.MAP_COPY), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_HASSEMAPHORE": ValueOf(syscall.MAP_HASSEMAPHORE), + "MAP_JIT": ValueOf(syscall.MAP_JIT), + "MAP_NOCACHE": ValueOf(syscall.MAP_NOCACHE), + "MAP_NOEXTEND": ValueOf(syscall.MAP_NOEXTEND), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_RENAME": ValueOf(syscall.MAP_RENAME), + "MAP_RESERVED0080": ValueOf(syscall.MAP_RESERVED0080), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOF": ValueOf(syscall.MSG_EOF), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_FLUSH": ValueOf(syscall.MSG_FLUSH), + "MSG_HAVEMORE": ValueOf(syscall.MSG_HAVEMORE), + "MSG_HOLD": ValueOf(syscall.MSG_HOLD), + "MSG_NEEDSA": ValueOf(syscall.MSG_NEEDSA), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_RCVMORE": ValueOf(syscall.MSG_RCVMORE), + "MSG_SEND": ValueOf(syscall.MSG_SEND), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITSTREAM": ValueOf(syscall.MSG_WAITSTREAM), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_DEACTIVATE": ValueOf(syscall.MS_DEACTIVATE), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_KILLPAGES": ValueOf(syscall.MS_KILLPAGES), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NET_RT_DUMP": ValueOf(syscall.NET_RT_DUMP), + "NET_RT_DUMP2": ValueOf(syscall.NET_RT_DUMP2), + "NET_RT_FLAGS": ValueOf(syscall.NET_RT_FLAGS), + "NET_RT_IFLIST": ValueOf(syscall.NET_RT_IFLIST), + "NET_RT_IFLIST2": ValueOf(syscall.NET_RT_IFLIST2), + "NET_RT_MAXID": ValueOf(syscall.NET_RT_MAXID), + "NET_RT_STAT": ValueOf(syscall.NET_RT_STAT), + "NET_RT_TRASH": ValueOf(syscall.NET_RT_TRASH), + "NOFLSH": ValueOf(uint64(syscall.NOFLSH)), + "NOTE_ABSOLUTE": ValueOf(syscall.NOTE_ABSOLUTE), + "NOTE_ATTRIB": ValueOf(syscall.NOTE_ATTRIB), + "NOTE_CHILD": ValueOf(syscall.NOTE_CHILD), + "NOTE_DELETE": ValueOf(syscall.NOTE_DELETE), + "NOTE_EXEC": ValueOf(syscall.NOTE_EXEC), + "NOTE_EXIT": ValueOf(uint64(syscall.NOTE_EXIT)), + "NOTE_EXITSTATUS": ValueOf(syscall.NOTE_EXITSTATUS), + "NOTE_EXTEND": ValueOf(syscall.NOTE_EXTEND), + "NOTE_FFAND": ValueOf(syscall.NOTE_FFAND), + "NOTE_FFCOPY": ValueOf(uint64(syscall.NOTE_FFCOPY)), + "NOTE_FFCTRLMASK": ValueOf(uint64(syscall.NOTE_FFCTRLMASK)), + "NOTE_FFLAGSMASK": ValueOf(syscall.NOTE_FFLAGSMASK), + "NOTE_FFNOP": ValueOf(syscall.NOTE_FFNOP), + "NOTE_FFOR": ValueOf(uint64(syscall.NOTE_FFOR)), + "NOTE_FORK": ValueOf(syscall.NOTE_FORK), + "NOTE_LINK": ValueOf(syscall.NOTE_LINK), + "NOTE_LOWAT": ValueOf(syscall.NOTE_LOWAT), + "NOTE_NONE": ValueOf(syscall.NOTE_NONE), + "NOTE_NSECONDS": ValueOf(syscall.NOTE_NSECONDS), + "NOTE_PCTRLMASK": ValueOf(syscall.NOTE_PCTRLMASK), + "NOTE_PDATAMASK": ValueOf(syscall.NOTE_PDATAMASK), + "NOTE_REAP": ValueOf(syscall.NOTE_REAP), + "NOTE_RENAME": ValueOf(syscall.NOTE_RENAME), + "NOTE_RESOURCEEND": ValueOf(syscall.NOTE_RESOURCEEND), + "NOTE_REVOKE": ValueOf(syscall.NOTE_REVOKE), + "NOTE_SECONDS": ValueOf(syscall.NOTE_SECONDS), + "NOTE_SIGNAL": ValueOf(syscall.NOTE_SIGNAL), + "NOTE_TRACK": ValueOf(syscall.NOTE_TRACK), + "NOTE_TRACKERR": ValueOf(syscall.NOTE_TRACKERR), + "NOTE_TRIGGER": ValueOf(syscall.NOTE_TRIGGER), + "NOTE_USECONDS": ValueOf(syscall.NOTE_USECONDS), + "NOTE_VM_ERROR": ValueOf(syscall.NOTE_VM_ERROR), + "NOTE_VM_PRESSURE": ValueOf(uint64(syscall.NOTE_VM_PRESSURE)), + "NOTE_VM_PRESSURE_SUDDEN_TERMINATE": ValueOf(syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE), + "NOTE_VM_PRESSURE_TERMINATE": ValueOf(syscall.NOTE_VM_PRESSURE_TERMINATE), + "NOTE_WRITE": ValueOf(syscall.NOTE_WRITE), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "ONOEOT": ValueOf(syscall.ONOEOT), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_ALERT": ValueOf(syscall.O_ALERT), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EVTONLY": ValueOf(syscall.O_EVTONLY), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_EXLOCK": ValueOf(syscall.O_EXLOCK), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_POPUP": ValueOf(uint64(syscall.O_POPUP)), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_SHLOCK": ValueOf(syscall.O_SHLOCK), + "O_SYMLINK": ValueOf(syscall.O_SYMLINK), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "PT_ATTACH": ValueOf(syscall.PT_ATTACH), + "PT_ATTACHEXC": ValueOf(syscall.PT_ATTACHEXC), + "PT_CONTINUE": ValueOf(syscall.PT_CONTINUE), + "PT_DENY_ATTACH": ValueOf(syscall.PT_DENY_ATTACH), + "PT_DETACH": ValueOf(syscall.PT_DETACH), + "PT_FIRSTMACH": ValueOf(syscall.PT_FIRSTMACH), + "PT_FORCEQUOTA": ValueOf(syscall.PT_FORCEQUOTA), + "PT_KILL": ValueOf(syscall.PT_KILL), + "PT_READ_D": ValueOf(syscall.PT_READ_D), + "PT_READ_I": ValueOf(syscall.PT_READ_I), + "PT_READ_U": ValueOf(syscall.PT_READ_U), + "PT_SIGEXC": ValueOf(syscall.PT_SIGEXC), + "PT_STEP": ValueOf(syscall.PT_STEP), + "PT_THUPDATE": ValueOf(syscall.PT_THUPDATE), + "PT_TRACE_ME": ValueOf(syscall.PT_TRACE_ME), + "PT_WRITE_D": ValueOf(syscall.PT_WRITE_D), + "PT_WRITE_I": ValueOf(syscall.PT_WRITE_I), + "PT_WRITE_U": ValueOf(syscall.PT_WRITE_U), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseRoutingMessage": ValueOf(syscall.ParseRoutingMessage), + "ParseRoutingSockaddr": ValueOf(syscall.ParseRoutingSockaddr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "Pathconf": ValueOf(syscall.Pathconf), + "Pipe": ValueOf(syscall.Pipe), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(int64(syscall.RLIM_INFINITY)), + "RTAX_AUTHOR": ValueOf(syscall.RTAX_AUTHOR), + "RTAX_BRD": ValueOf(syscall.RTAX_BRD), + "RTAX_DST": ValueOf(syscall.RTAX_DST), + "RTAX_GATEWAY": ValueOf(syscall.RTAX_GATEWAY), + "RTAX_GENMASK": ValueOf(syscall.RTAX_GENMASK), + "RTAX_IFA": ValueOf(syscall.RTAX_IFA), + "RTAX_IFP": ValueOf(syscall.RTAX_IFP), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_NETMASK": ValueOf(syscall.RTAX_NETMASK), + "RTA_AUTHOR": ValueOf(syscall.RTA_AUTHOR), + "RTA_BRD": ValueOf(syscall.RTA_BRD), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_GENMASK": ValueOf(syscall.RTA_GENMASK), + "RTA_IFA": ValueOf(syscall.RTA_IFA), + "RTA_IFP": ValueOf(syscall.RTA_IFP), + "RTA_NETMASK": ValueOf(syscall.RTA_NETMASK), + "RTF_BLACKHOLE": ValueOf(syscall.RTF_BLACKHOLE), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CLONING": ValueOf(syscall.RTF_CLONING), + "RTF_CONDEMNED": ValueOf(syscall.RTF_CONDEMNED), + "RTF_DELCLONE": ValueOf(syscall.RTF_DELCLONE), + "RTF_DONE": ValueOf(syscall.RTF_DONE), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_IFREF": ValueOf(syscall.RTF_IFREF), + "RTF_IFSCOPE": ValueOf(syscall.RTF_IFSCOPE), + "RTF_LLINFO": ValueOf(syscall.RTF_LLINFO), + "RTF_LOCAL": ValueOf(syscall.RTF_LOCAL), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_PINNED": ValueOf(syscall.RTF_PINNED), + "RTF_PRCLONING": ValueOf(syscall.RTF_PRCLONING), + "RTF_PROTO1": ValueOf(syscall.RTF_PROTO1), + "RTF_PROTO2": ValueOf(syscall.RTF_PROTO2), + "RTF_PROTO3": ValueOf(syscall.RTF_PROTO3), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WASCLONED": ValueOf(syscall.RTF_WASCLONED), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_ADD": ValueOf(syscall.RTM_ADD), + "RTM_CHANGE": ValueOf(syscall.RTM_CHANGE), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELETE": ValueOf(syscall.RTM_DELETE), + "RTM_DELMADDR": ValueOf(syscall.RTM_DELMADDR), + "RTM_GET": ValueOf(syscall.RTM_GET), + "RTM_GET2": ValueOf(syscall.RTM_GET2), + "RTM_IFINFO": ValueOf(syscall.RTM_IFINFO), + "RTM_IFINFO2": ValueOf(syscall.RTM_IFINFO2), + "RTM_LOCK": ValueOf(syscall.RTM_LOCK), + "RTM_LOSING": ValueOf(syscall.RTM_LOSING), + "RTM_MISS": ValueOf(syscall.RTM_MISS), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWMADDR": ValueOf(syscall.RTM_NEWMADDR), + "RTM_NEWMADDR2": ValueOf(syscall.RTM_NEWMADDR2), + "RTM_OLDADD": ValueOf(syscall.RTM_OLDADD), + "RTM_OLDDEL": ValueOf(syscall.RTM_OLDDEL), + "RTM_REDIRECT": ValueOf(syscall.RTM_REDIRECT), + "RTM_RESOLVE": ValueOf(syscall.RTM_RESOLVE), + "RTM_RTTUNIT": ValueOf(syscall.RTM_RTTUNIT), + "RTM_VERSION": ValueOf(syscall.RTM_VERSION), + "RTV_EXPIRE": ValueOf(syscall.RTV_EXPIRE), + "RTV_HOPCOUNT": ValueOf(syscall.RTV_HOPCOUNT), + "RTV_MTU": ValueOf(syscall.RTV_MTU), + "RTV_RPIPE": ValueOf(syscall.RTV_RPIPE), + "RTV_RTT": ValueOf(syscall.RTV_RTT), + "RTV_RTTVAR": ValueOf(syscall.RTV_RTTVAR), + "RTV_SPIPE": ValueOf(syscall.RTV_SPIPE), + "RTV_SSTHRESH": ValueOf(syscall.RTV_SSTHRESH), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Rename": ValueOf(syscall.Rename), + "Revoke": ValueOf(syscall.Revoke), + "Rmdir": ValueOf(syscall.Rmdir), + "RouteRIB": ValueOf(syscall.RouteRIB), + "SCM_CREDS": ValueOf(syscall.SCM_CREDS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMP_MONOTONIC": ValueOf(syscall.SCM_TIMESTAMP_MONOTONIC), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGEMT": ValueOf(syscall.SIGEMT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINFO": ValueOf(syscall.SIGINFO), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDMULTI": ValueOf(uint64(syscall.SIOCADDMULTI)), + "SIOCAIFADDR": ValueOf(uint64(syscall.SIOCAIFADDR)), + "SIOCALIFADDR": ValueOf(uint64(syscall.SIOCALIFADDR)), + "SIOCARPIPLL": ValueOf(uint64(syscall.SIOCARPIPLL)), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCAUTOADDR": ValueOf(uint64(syscall.SIOCAUTOADDR)), + "SIOCAUTONETMASK": ValueOf(uint64(syscall.SIOCAUTONETMASK)), + "SIOCDELMULTI": ValueOf(uint64(syscall.SIOCDELMULTI)), + "SIOCDIFADDR": ValueOf(uint64(syscall.SIOCDIFADDR)), + "SIOCDIFPHYADDR": ValueOf(uint64(syscall.SIOCDIFPHYADDR)), + "SIOCDLIFADDR": ValueOf(uint64(syscall.SIOCDLIFADDR)), + "SIOCGDRVSPEC": ValueOf(uint64(syscall.SIOCGDRVSPEC)), + "SIOCGETSGCNT": ValueOf(uint64(syscall.SIOCGETSGCNT)), + "SIOCGETVIFCNT": ValueOf(uint64(syscall.SIOCGETVIFCNT)), + "SIOCGETVLAN": ValueOf(uint64(syscall.SIOCGETVLAN)), + "SIOCGHIWAT": ValueOf(syscall.SIOCGHIWAT), + "SIOCGIFADDR": ValueOf(uint64(syscall.SIOCGIFADDR)), + "SIOCGIFALTMTU": ValueOf(uint64(syscall.SIOCGIFALTMTU)), + "SIOCGIFASYNCMAP": ValueOf(uint64(syscall.SIOCGIFASYNCMAP)), + "SIOCGIFBOND": ValueOf(uint64(syscall.SIOCGIFBOND)), + "SIOCGIFBRDADDR": ValueOf(uint64(syscall.SIOCGIFBRDADDR)), + "SIOCGIFCAP": ValueOf(uint64(syscall.SIOCGIFCAP)), + "SIOCGIFCONF": ValueOf(uint64(syscall.SIOCGIFCONF)), + "SIOCGIFDEVMTU": ValueOf(uint64(syscall.SIOCGIFDEVMTU)), + "SIOCGIFDSTADDR": ValueOf(uint64(syscall.SIOCGIFDSTADDR)), + "SIOCGIFFLAGS": ValueOf(uint64(syscall.SIOCGIFFLAGS)), + "SIOCGIFGENERIC": ValueOf(uint64(syscall.SIOCGIFGENERIC)), + "SIOCGIFKPI": ValueOf(uint64(syscall.SIOCGIFKPI)), + "SIOCGIFMAC": ValueOf(uint64(syscall.SIOCGIFMAC)), + "SIOCGIFMEDIA": ValueOf(uint64(syscall.SIOCGIFMEDIA)), + "SIOCGIFMETRIC": ValueOf(uint64(syscall.SIOCGIFMETRIC)), + "SIOCGIFMTU": ValueOf(uint64(syscall.SIOCGIFMTU)), + "SIOCGIFNETMASK": ValueOf(uint64(syscall.SIOCGIFNETMASK)), + "SIOCGIFPDSTADDR": ValueOf(uint64(syscall.SIOCGIFPDSTADDR)), + "SIOCGIFPHYS": ValueOf(uint64(syscall.SIOCGIFPHYS)), + "SIOCGIFPSRCADDR": ValueOf(uint64(syscall.SIOCGIFPSRCADDR)), + "SIOCGIFSTATUS": ValueOf(uint64(syscall.SIOCGIFSTATUS)), + "SIOCGIFVLAN": ValueOf(uint64(syscall.SIOCGIFVLAN)), + "SIOCGIFWAKEFLAGS": ValueOf(uint64(syscall.SIOCGIFWAKEFLAGS)), + "SIOCGLIFADDR": ValueOf(uint64(syscall.SIOCGLIFADDR)), + "SIOCGLIFPHYADDR": ValueOf(uint64(syscall.SIOCGLIFPHYADDR)), + "SIOCGLOWAT": ValueOf(syscall.SIOCGLOWAT), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCIFCREATE": ValueOf(uint64(syscall.SIOCIFCREATE)), + "SIOCIFCREATE2": ValueOf(uint64(syscall.SIOCIFCREATE2)), + "SIOCIFDESTROY": ValueOf(uint64(syscall.SIOCIFDESTROY)), + "SIOCRSLVMULTI": ValueOf(uint64(syscall.SIOCRSLVMULTI)), + "SIOCSDRVSPEC": ValueOf(uint64(syscall.SIOCSDRVSPEC)), + "SIOCSETVLAN": ValueOf(uint64(syscall.SIOCSETVLAN)), + "SIOCSHIWAT": ValueOf(uint64(syscall.SIOCSHIWAT)), + "SIOCSIFADDR": ValueOf(uint64(syscall.SIOCSIFADDR)), + "SIOCSIFALTMTU": ValueOf(uint64(syscall.SIOCSIFALTMTU)), + "SIOCSIFASYNCMAP": ValueOf(uint64(syscall.SIOCSIFASYNCMAP)), + "SIOCSIFBOND": ValueOf(uint64(syscall.SIOCSIFBOND)), + "SIOCSIFBRDADDR": ValueOf(uint64(syscall.SIOCSIFBRDADDR)), + "SIOCSIFCAP": ValueOf(uint64(syscall.SIOCSIFCAP)), + "SIOCSIFDSTADDR": ValueOf(uint64(syscall.SIOCSIFDSTADDR)), + "SIOCSIFFLAGS": ValueOf(uint64(syscall.SIOCSIFFLAGS)), + "SIOCSIFGENERIC": ValueOf(uint64(syscall.SIOCSIFGENERIC)), + "SIOCSIFKPI": ValueOf(uint64(syscall.SIOCSIFKPI)), + "SIOCSIFLLADDR": ValueOf(uint64(syscall.SIOCSIFLLADDR)), + "SIOCSIFMAC": ValueOf(uint64(syscall.SIOCSIFMAC)), + "SIOCSIFMEDIA": ValueOf(uint64(syscall.SIOCSIFMEDIA)), + "SIOCSIFMETRIC": ValueOf(uint64(syscall.SIOCSIFMETRIC)), + "SIOCSIFMTU": ValueOf(uint64(syscall.SIOCSIFMTU)), + "SIOCSIFNETMASK": ValueOf(uint64(syscall.SIOCSIFNETMASK)), + "SIOCSIFPHYADDR": ValueOf(uint64(syscall.SIOCSIFPHYADDR)), + "SIOCSIFPHYS": ValueOf(uint64(syscall.SIOCSIFPHYS)), + "SIOCSIFVLAN": ValueOf(uint64(syscall.SIOCSIFVLAN)), + "SIOCSLIFPHYADDR": ValueOf(uint64(syscall.SIOCSLIFPHYADDR)), + "SIOCSLOWAT": ValueOf(uint64(syscall.SIOCSLOWAT)), + "SIOCSPGRP": ValueOf(uint64(syscall.SIOCSPGRP)), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_MAXADDRLEN": ValueOf(syscall.SOCK_MAXADDRLEN), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_DONTTRUNC": ValueOf(syscall.SO_DONTTRUNC), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LABEL": ValueOf(syscall.SO_LABEL), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_LINGER_SEC": ValueOf(syscall.SO_LINGER_SEC), + "SO_NKE": ValueOf(syscall.SO_NKE), + "SO_NOADDRERR": ValueOf(syscall.SO_NOADDRERR), + "SO_NOSIGPIPE": ValueOf(syscall.SO_NOSIGPIPE), + "SO_NOTIFYCONFLICT": ValueOf(syscall.SO_NOTIFYCONFLICT), + "SO_NP_EXTENSIONS": ValueOf(syscall.SO_NP_EXTENSIONS), + "SO_NREAD": ValueOf(syscall.SO_NREAD), + "SO_NWRITE": ValueOf(syscall.SO_NWRITE), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PEERLABEL": ValueOf(syscall.SO_PEERLABEL), + "SO_RANDOMPORT": ValueOf(syscall.SO_RANDOMPORT), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_RESTRICTIONS": ValueOf(syscall.SO_RESTRICTIONS), + "SO_RESTRICT_DENYIN": ValueOf(syscall.SO_RESTRICT_DENYIN), + "SO_RESTRICT_DENYOUT": ValueOf(syscall.SO_RESTRICT_DENYOUT), + "SO_RESTRICT_DENYSET": ValueOf(uint64(syscall.SO_RESTRICT_DENYSET)), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_REUSEPORT": ValueOf(syscall.SO_REUSEPORT), + "SO_REUSESHAREUID": ValueOf(syscall.SO_REUSESHAREUID), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMP_MONOTONIC": ValueOf(syscall.SO_TIMESTAMP_MONOTONIC), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SO_UPCALLCLOSEWAIT": ValueOf(syscall.SO_UPCALLCLOSEWAIT), + "SO_USELOOPBACK": ValueOf(syscall.SO_USELOOPBACK), + "SO_WANTMORE": ValueOf(syscall.SO_WANTMORE), + "SO_WANTOOBFLAG": ValueOf(syscall.SO_WANTOOBFLAG), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT_NOCANCEL": ValueOf(syscall.SYS_ACCEPT_NOCANCEL), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCESS_EXTENDED": ValueOf(syscall.SYS_ACCESS_EXTENDED), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_PROFIL": ValueOf(syscall.SYS_ADD_PROFIL), + "SYS_ADJTIME": ValueOf(syscall.SYS_ADJTIME), + "SYS_AIO_CANCEL": ValueOf(syscall.SYS_AIO_CANCEL), + "SYS_AIO_ERROR": ValueOf(syscall.SYS_AIO_ERROR), + "SYS_AIO_FSYNC": ValueOf(syscall.SYS_AIO_FSYNC), + "SYS_AIO_READ": ValueOf(syscall.SYS_AIO_READ), + "SYS_AIO_RETURN": ValueOf(syscall.SYS_AIO_RETURN), + "SYS_AIO_SUSPEND": ValueOf(syscall.SYS_AIO_SUSPEND), + "SYS_AIO_SUSPEND_NOCANCEL": ValueOf(syscall.SYS_AIO_SUSPEND_NOCANCEL), + "SYS_AIO_WRITE": ValueOf(syscall.SYS_AIO_WRITE), + "SYS_ATGETMSG": ValueOf(syscall.SYS_ATGETMSG), + "SYS_ATPGETREQ": ValueOf(syscall.SYS_ATPGETREQ), + "SYS_ATPGETRSP": ValueOf(syscall.SYS_ATPGETRSP), + "SYS_ATPSNDREQ": ValueOf(syscall.SYS_ATPSNDREQ), + "SYS_ATPSNDRSP": ValueOf(syscall.SYS_ATPSNDRSP), + "SYS_ATPUTMSG": ValueOf(syscall.SYS_ATPUTMSG), + "SYS_ATSOCKET": ValueOf(syscall.SYS_ATSOCKET), + "SYS_AUDIT": ValueOf(syscall.SYS_AUDIT), + "SYS_AUDITCTL": ValueOf(syscall.SYS_AUDITCTL), + "SYS_AUDITON": ValueOf(syscall.SYS_AUDITON), + "SYS_AUDIT_SESSION_JOIN": ValueOf(syscall.SYS_AUDIT_SESSION_JOIN), + "SYS_AUDIT_SESSION_PORT": ValueOf(syscall.SYS_AUDIT_SESSION_PORT), + "SYS_AUDIT_SESSION_SELF": ValueOf(syscall.SYS_AUDIT_SESSION_SELF), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BSDTHREAD_CREATE": ValueOf(syscall.SYS_BSDTHREAD_CREATE), + "SYS_BSDTHREAD_REGISTER": ValueOf(syscall.SYS_BSDTHREAD_REGISTER), + "SYS_BSDTHREAD_TERMINATE": ValueOf(syscall.SYS_BSDTHREAD_TERMINATE), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHFLAGS": ValueOf(syscall.SYS_CHFLAGS), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHMOD_EXTENDED": ValueOf(syscall.SYS_CHMOD_EXTENDED), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CHUD": ValueOf(syscall.SYS_CHUD), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CLOSE_NOCANCEL": ValueOf(syscall.SYS_CLOSE_NOCANCEL), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CONNECT_NOCANCEL": ValueOf(syscall.SYS_CONNECT_NOCANCEL), + "SYS_COPYFILE": ValueOf(syscall.SYS_COPYFILE), + "SYS_CSOPS": ValueOf(syscall.SYS_CSOPS), + "SYS_DELETE": ValueOf(syscall.SYS_DELETE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_EXCHANGEDATA": ValueOf(syscall.SYS_EXCHANGEDATA), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHFLAGS": ValueOf(syscall.SYS_FCHFLAGS), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMOD_EXTENDED": ValueOf(syscall.SYS_FCHMOD_EXTENDED), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FCNTL_NOCANCEL": ValueOf(syscall.SYS_FCNTL_NOCANCEL), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FFSCTL": ValueOf(syscall.SYS_FFSCTL), + "SYS_FGETATTRLIST": ValueOf(syscall.SYS_FGETATTRLIST), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FHOPEN": ValueOf(syscall.SYS_FHOPEN), + "SYS_FILEPORT_MAKEFD": ValueOf(syscall.SYS_FILEPORT_MAKEFD), + "SYS_FILEPORT_MAKEPORT": ValueOf(syscall.SYS_FILEPORT_MAKEPORT), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FPATHCONF": ValueOf(syscall.SYS_FPATHCONF), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSCTL": ValueOf(syscall.SYS_FSCTL), + "SYS_FSETATTRLIST": ValueOf(syscall.SYS_FSETATTRLIST), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSGETPATH": ValueOf(syscall.SYS_FSGETPATH), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTAT64": ValueOf(syscall.SYS_FSTAT64), + "SYS_FSTAT64_EXTENDED": ValueOf(syscall.SYS_FSTAT64_EXTENDED), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSTATFS64": ValueOf(syscall.SYS_FSTATFS64), + "SYS_FSTATV": ValueOf(syscall.SYS_FSTATV), + "SYS_FSTAT_EXTENDED": ValueOf(syscall.SYS_FSTAT_EXTENDED), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FSYNC_NOCANCEL": ValueOf(syscall.SYS_FSYNC_NOCANCEL), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTIMES": ValueOf(syscall.SYS_FUTIMES), + "SYS_GETATTRLIST": ValueOf(syscall.SYS_GETATTRLIST), + "SYS_GETAUDIT": ValueOf(syscall.SYS_GETAUDIT), + "SYS_GETAUDIT_ADDR": ValueOf(syscall.SYS_GETAUDIT_ADDR), + "SYS_GETAUID": ValueOf(syscall.SYS_GETAUID), + "SYS_GETDIRENTRIES": ValueOf(syscall.SYS_GETDIRENTRIES), + "SYS_GETDIRENTRIES64": ValueOf(syscall.SYS_GETDIRENTRIES64), + "SYS_GETDIRENTRIESATTR": ValueOf(syscall.SYS_GETDIRENTRIESATTR), + "SYS_GETDTABLESIZE": ValueOf(syscall.SYS_GETDTABLESIZE), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETFH": ValueOf(syscall.SYS_GETFH), + "SYS_GETFSSTAT": ValueOf(syscall.SYS_GETFSSTAT), + "SYS_GETFSSTAT64": ValueOf(syscall.SYS_GETFSSTAT64), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETHOSTUUID": ValueOf(syscall.SYS_GETHOSTUUID), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETLCID": ValueOf(syscall.SYS_GETLCID), + "SYS_GETLOGIN": ValueOf(syscall.SYS_GETLOGIN), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSGROUPS": ValueOf(syscall.SYS_GETSGROUPS), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETWGROUPS": ValueOf(syscall.SYS_GETWGROUPS), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_IDENTITYSVC": ValueOf(syscall.SYS_IDENTITYSVC), + "SYS_INITGROUPS": ValueOf(syscall.SYS_INITGROUPS), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPOLICYSYS": ValueOf(syscall.SYS_IOPOLICYSYS), + "SYS_ISSETUGID": ValueOf(syscall.SYS_ISSETUGID), + "SYS_KDEBUG_TRACE": ValueOf(syscall.SYS_KDEBUG_TRACE), + "SYS_KEVENT": ValueOf(syscall.SYS_KEVENT), + "SYS_KEVENT64": ValueOf(syscall.SYS_KEVENT64), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_KQUEUE": ValueOf(syscall.SYS_KQUEUE), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LIO_LISTIO": ValueOf(syscall.SYS_LIO_LISTIO), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LSTAT64": ValueOf(syscall.SYS_LSTAT64), + "SYS_LSTAT64_EXTENDED": ValueOf(syscall.SYS_LSTAT64_EXTENDED), + "SYS_LSTATV": ValueOf(syscall.SYS_LSTATV), + "SYS_LSTAT_EXTENDED": ValueOf(syscall.SYS_LSTAT_EXTENDED), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MAXSYSCALL": ValueOf(syscall.SYS_MAXSYSCALL), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MINHERIT": ValueOf(syscall.SYS_MINHERIT), + "SYS_MKCOMPLEX": ValueOf(syscall.SYS_MKCOMPLEX), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIR_EXTENDED": ValueOf(syscall.SYS_MKDIR_EXTENDED), + "SYS_MKFIFO": ValueOf(syscall.SYS_MKFIFO), + "SYS_MKFIFO_EXTENDED": ValueOf(syscall.SYS_MKFIFO_EXTENDED), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MODWATCH": ValueOf(syscall.SYS_MODWATCH), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MSGCTL": ValueOf(syscall.SYS_MSGCTL), + "SYS_MSGGET": ValueOf(syscall.SYS_MSGGET), + "SYS_MSGRCV": ValueOf(syscall.SYS_MSGRCV), + "SYS_MSGRCV_NOCANCEL": ValueOf(syscall.SYS_MSGRCV_NOCANCEL), + "SYS_MSGSND": ValueOf(syscall.SYS_MSGSND), + "SYS_MSGSND_NOCANCEL": ValueOf(syscall.SYS_MSGSND_NOCANCEL), + "SYS_MSGSYS": ValueOf(syscall.SYS_MSGSYS), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MSYNC_NOCANCEL": ValueOf(syscall.SYS_MSYNC_NOCANCEL), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NFSCLNT": ValueOf(syscall.SYS_NFSCLNT), + "SYS_NFSSVC": ValueOf(syscall.SYS_NFSSVC), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPEN_EXTENDED": ValueOf(syscall.SYS_OPEN_EXTENDED), + "SYS_OPEN_NOCANCEL": ValueOf(syscall.SYS_OPEN_NOCANCEL), + "SYS_PATHCONF": ValueOf(syscall.SYS_PATHCONF), + "SYS_PID_HIBERNATE": ValueOf(syscall.SYS_PID_HIBERNATE), + "SYS_PID_RESUME": ValueOf(syscall.SYS_PID_RESUME), + "SYS_PID_SHUTDOWN_SOCKETS": ValueOf(syscall.SYS_PID_SHUTDOWN_SOCKETS), + "SYS_PID_SUSPEND": ValueOf(syscall.SYS_PID_SUSPEND), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_POLL_NOCANCEL": ValueOf(syscall.SYS_POLL_NOCANCEL), + "SYS_POSIX_SPAWN": ValueOf(syscall.SYS_POSIX_SPAWN), + "SYS_PREAD": ValueOf(syscall.SYS_PREAD), + "SYS_PREAD_NOCANCEL": ValueOf(syscall.SYS_PREAD_NOCANCEL), + "SYS_PROCESS_POLICY": ValueOf(syscall.SYS_PROCESS_POLICY), + "SYS_PROC_INFO": ValueOf(syscall.SYS_PROC_INFO), + "SYS_PROFIL": ValueOf(syscall.SYS_PROFIL), + "SYS_PSYNCH_CVBROAD": ValueOf(syscall.SYS_PSYNCH_CVBROAD), + "SYS_PSYNCH_CVCLRPREPOST": ValueOf(syscall.SYS_PSYNCH_CVCLRPREPOST), + "SYS_PSYNCH_CVSIGNAL": ValueOf(syscall.SYS_PSYNCH_CVSIGNAL), + "SYS_PSYNCH_CVWAIT": ValueOf(syscall.SYS_PSYNCH_CVWAIT), + "SYS_PSYNCH_MUTEXDROP": ValueOf(syscall.SYS_PSYNCH_MUTEXDROP), + "SYS_PSYNCH_MUTEXWAIT": ValueOf(syscall.SYS_PSYNCH_MUTEXWAIT), + "SYS_PSYNCH_RW_DOWNGRADE": ValueOf(syscall.SYS_PSYNCH_RW_DOWNGRADE), + "SYS_PSYNCH_RW_LONGRDLOCK": ValueOf(syscall.SYS_PSYNCH_RW_LONGRDLOCK), + "SYS_PSYNCH_RW_RDLOCK": ValueOf(syscall.SYS_PSYNCH_RW_RDLOCK), + "SYS_PSYNCH_RW_UNLOCK": ValueOf(syscall.SYS_PSYNCH_RW_UNLOCK), + "SYS_PSYNCH_RW_UNLOCK2": ValueOf(syscall.SYS_PSYNCH_RW_UNLOCK2), + "SYS_PSYNCH_RW_UPGRADE": ValueOf(syscall.SYS_PSYNCH_RW_UPGRADE), + "SYS_PSYNCH_RW_WRLOCK": ValueOf(syscall.SYS_PSYNCH_RW_WRLOCK), + "SYS_PSYNCH_RW_YIELDWRLOCK": ValueOf(syscall.SYS_PSYNCH_RW_YIELDWRLOCK), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE": ValueOf(syscall.SYS_PWRITE), + "SYS_PWRITE_NOCANCEL": ValueOf(syscall.SYS_PWRITE_NOCANCEL), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_READV_NOCANCEL": ValueOf(syscall.SYS_READV_NOCANCEL), + "SYS_READ_NOCANCEL": ValueOf(syscall.SYS_READ_NOCANCEL), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVFROM_NOCANCEL": ValueOf(syscall.SYS_RECVFROM_NOCANCEL), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_RECVMSG_NOCANCEL": ValueOf(syscall.SYS_RECVMSG_NOCANCEL), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_REVOKE": ValueOf(syscall.SYS_REVOKE), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_SEARCHFS": ValueOf(syscall.SYS_SEARCHFS), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SELECT_NOCANCEL": ValueOf(syscall.SYS_SELECT_NOCANCEL), + "SYS_SEMCTL": ValueOf(syscall.SYS_SEMCTL), + "SYS_SEMGET": ValueOf(syscall.SYS_SEMGET), + "SYS_SEMOP": ValueOf(syscall.SYS_SEMOP), + "SYS_SEMSYS": ValueOf(syscall.SYS_SEMSYS), + "SYS_SEM_CLOSE": ValueOf(syscall.SYS_SEM_CLOSE), + "SYS_SEM_DESTROY": ValueOf(syscall.SYS_SEM_DESTROY), + "SYS_SEM_GETVALUE": ValueOf(syscall.SYS_SEM_GETVALUE), + "SYS_SEM_INIT": ValueOf(syscall.SYS_SEM_INIT), + "SYS_SEM_OPEN": ValueOf(syscall.SYS_SEM_OPEN), + "SYS_SEM_POST": ValueOf(syscall.SYS_SEM_POST), + "SYS_SEM_TRYWAIT": ValueOf(syscall.SYS_SEM_TRYWAIT), + "SYS_SEM_UNLINK": ValueOf(syscall.SYS_SEM_UNLINK), + "SYS_SEM_WAIT": ValueOf(syscall.SYS_SEM_WAIT), + "SYS_SEM_WAIT_NOCANCEL": ValueOf(syscall.SYS_SEM_WAIT_NOCANCEL), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDMSG_NOCANCEL": ValueOf(syscall.SYS_SENDMSG_NOCANCEL), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SENDTO_NOCANCEL": ValueOf(syscall.SYS_SENDTO_NOCANCEL), + "SYS_SETATTRLIST": ValueOf(syscall.SYS_SETATTRLIST), + "SYS_SETAUDIT": ValueOf(syscall.SYS_SETAUDIT), + "SYS_SETAUDIT_ADDR": ValueOf(syscall.SYS_SETAUDIT_ADDR), + "SYS_SETAUID": ValueOf(syscall.SYS_SETAUID), + "SYS_SETEGID": ValueOf(syscall.SYS_SETEGID), + "SYS_SETEUID": ValueOf(syscall.SYS_SETEUID), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETLCID": ValueOf(syscall.SYS_SETLCID), + "SYS_SETLOGIN": ValueOf(syscall.SYS_SETLOGIN), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETPRIVEXEC": ValueOf(syscall.SYS_SETPRIVEXEC), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSGROUPS": ValueOf(syscall.SYS_SETSGROUPS), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTID": ValueOf(syscall.SYS_SETTID), + "SYS_SETTID_WITH_PID": ValueOf(syscall.SYS_SETTID_WITH_PID), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETWGROUPS": ValueOf(syscall.SYS_SETWGROUPS), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SHARED_REGION_CHECK_NP": ValueOf(syscall.SYS_SHARED_REGION_CHECK_NP), + "SYS_SHARED_REGION_MAP_AND_SLIDE_NP": ValueOf(syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP), + "SYS_SHMAT": ValueOf(syscall.SYS_SHMAT), + "SYS_SHMCTL": ValueOf(syscall.SYS_SHMCTL), + "SYS_SHMDT": ValueOf(syscall.SYS_SHMDT), + "SYS_SHMGET": ValueOf(syscall.SYS_SHMGET), + "SYS_SHMSYS": ValueOf(syscall.SYS_SHMSYS), + "SYS_SHM_OPEN": ValueOf(syscall.SYS_SHM_OPEN), + "SYS_SHM_UNLINK": ValueOf(syscall.SYS_SHM_UNLINK), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SIGSUSPEND_NOCANCEL": ValueOf(syscall.SYS_SIGSUSPEND_NOCANCEL), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_STACK_SNAPSHOT": ValueOf(syscall.SYS_STACK_SNAPSHOT), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STAT64": ValueOf(syscall.SYS_STAT64), + "SYS_STAT64_EXTENDED": ValueOf(syscall.SYS_STAT64_EXTENDED), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_STATFS64": ValueOf(syscall.SYS_STATFS64), + "SYS_STATV": ValueOf(syscall.SYS_STATV), + "SYS_STAT_EXTENDED": ValueOf(syscall.SYS_STAT_EXTENDED), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYSCALL": ValueOf(syscall.SYS_SYSCALL), + "SYS_THREAD_SELFID": ValueOf(syscall.SYS_THREAD_SELFID), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMASK_EXTENDED": ValueOf(syscall.SYS_UMASK_EXTENDED), + "SYS_UNDELETE": ValueOf(syscall.SYS_UNDELETE), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNMOUNT": ValueOf(syscall.SYS_UNMOUNT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_VM_PRESSURE_MONITOR": ValueOf(syscall.SYS_VM_PRESSURE_MONITOR), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAIT4_NOCANCEL": ValueOf(syscall.SYS_WAIT4_NOCANCEL), + "SYS_WAITEVENT": ValueOf(syscall.SYS_WAITEVENT), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WAITID_NOCANCEL": ValueOf(syscall.SYS_WAITID_NOCANCEL), + "SYS_WATCHEVENT": ValueOf(syscall.SYS_WATCHEVENT), + "SYS_WORKQ_KERNRETURN": ValueOf(syscall.SYS_WORKQ_KERNRETURN), + "SYS_WORKQ_OPEN": ValueOf(syscall.SYS_WORKQ_OPEN), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS_WRITEV_NOCANCEL": ValueOf(syscall.SYS_WRITEV_NOCANCEL), + "SYS_WRITE_NOCANCEL": ValueOf(syscall.SYS_WRITE_NOCANCEL), + "SYS___DISABLE_THREADSIGNAL": ValueOf(syscall.SYS___DISABLE_THREADSIGNAL), + "SYS___MAC_EXECVE": ValueOf(syscall.SYS___MAC_EXECVE), + "SYS___MAC_GETFSSTAT": ValueOf(syscall.SYS___MAC_GETFSSTAT), + "SYS___MAC_GET_FD": ValueOf(syscall.SYS___MAC_GET_FD), + "SYS___MAC_GET_FILE": ValueOf(syscall.SYS___MAC_GET_FILE), + "SYS___MAC_GET_LCID": ValueOf(syscall.SYS___MAC_GET_LCID), + "SYS___MAC_GET_LCTX": ValueOf(syscall.SYS___MAC_GET_LCTX), + "SYS___MAC_GET_LINK": ValueOf(syscall.SYS___MAC_GET_LINK), + "SYS___MAC_GET_MOUNT": ValueOf(syscall.SYS___MAC_GET_MOUNT), + "SYS___MAC_GET_PID": ValueOf(syscall.SYS___MAC_GET_PID), + "SYS___MAC_GET_PROC": ValueOf(syscall.SYS___MAC_GET_PROC), + "SYS___MAC_MOUNT": ValueOf(syscall.SYS___MAC_MOUNT), + "SYS___MAC_SET_FD": ValueOf(syscall.SYS___MAC_SET_FD), + "SYS___MAC_SET_FILE": ValueOf(syscall.SYS___MAC_SET_FILE), + "SYS___MAC_SET_LCTX": ValueOf(syscall.SYS___MAC_SET_LCTX), + "SYS___MAC_SET_LINK": ValueOf(syscall.SYS___MAC_SET_LINK), + "SYS___MAC_SET_PROC": ValueOf(syscall.SYS___MAC_SET_PROC), + "SYS___MAC_SYSCALL": ValueOf(syscall.SYS___MAC_SYSCALL), + "SYS___OLD_SEMWAIT_SIGNAL": ValueOf(syscall.SYS___OLD_SEMWAIT_SIGNAL), + "SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": ValueOf(syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL), + "SYS___PTHREAD_CANCELED": ValueOf(syscall.SYS___PTHREAD_CANCELED), + "SYS___PTHREAD_CHDIR": ValueOf(syscall.SYS___PTHREAD_CHDIR), + "SYS___PTHREAD_FCHDIR": ValueOf(syscall.SYS___PTHREAD_FCHDIR), + "SYS___PTHREAD_KILL": ValueOf(syscall.SYS___PTHREAD_KILL), + "SYS___PTHREAD_MARKCANCEL": ValueOf(syscall.SYS___PTHREAD_MARKCANCEL), + "SYS___PTHREAD_SIGMASK": ValueOf(syscall.SYS___PTHREAD_SIGMASK), + "SYS___SEMWAIT_SIGNAL": ValueOf(syscall.SYS___SEMWAIT_SIGNAL), + "SYS___SEMWAIT_SIGNAL_NOCANCEL": ValueOf(syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL), + "SYS___SIGWAIT": ValueOf(syscall.SYS___SIGWAIT), + "SYS___SIGWAIT_NOCANCEL": ValueOf(syscall.SYS___SIGWAIT_NOCANCEL), + "SYS___SYSCTL": ValueOf(syscall.SYS___SYSCTL), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IFWHT": ValueOf(syscall.S_IFWHT), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISTXT": ValueOf(syscall.S_ISTXT), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetBpf": ValueOf(syscall.SetBpf), + "SetBpfBuflen": ValueOf(syscall.SetBpfBuflen), + "SetBpfDatalink": ValueOf(syscall.SetBpfDatalink), + "SetBpfHeadercmpl": ValueOf(syscall.SetBpfHeadercmpl), + "SetBpfImmediate": ValueOf(syscall.SetBpfImmediate), + "SetBpfInterface": ValueOf(syscall.SetBpfInterface), + "SetBpfPromisc": ValueOf(syscall.SetBpfPromisc), + "SetBpfTimeout": ValueOf(syscall.SetBpfTimeout), + "SetKevent": ValueOf(syscall.SetKevent), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setegid": ValueOf(syscall.Setegid), + "Setenv": ValueOf(syscall.Setenv), + "Seteuid": ValueOf(syscall.Seteuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Setlogin": ValueOf(syscall.Setlogin), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setprivexec": ValueOf(syscall.Setprivexec), + "Setregid": ValueOf(syscall.Setregid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofBpfHdr": ValueOf(syscall.SizeofBpfHdr), + "SizeofBpfInsn": ValueOf(syscall.SizeofBpfInsn), + "SizeofBpfProgram": ValueOf(syscall.SizeofBpfProgram), + "SizeofBpfStat": ValueOf(syscall.SizeofBpfStat), + "SizeofBpfVersion": ValueOf(syscall.SizeofBpfVersion), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfData": ValueOf(syscall.SizeofIfData), + "SizeofIfMsghdr": ValueOf(syscall.SizeofIfMsghdr), + "SizeofIfaMsghdr": ValueOf(syscall.SizeofIfaMsghdr), + "SizeofIfmaMsghdr": ValueOf(syscall.SizeofIfmaMsghdr), + "SizeofIfmaMsghdr2": ValueOf(syscall.SizeofIfmaMsghdr2), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofRtMetrics": ValueOf(syscall.SizeofRtMetrics), + "SizeofRtMsghdr": ValueOf(syscall.SizeofRtMsghdr), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrDatalink": ValueOf(syscall.SizeofSockaddrDatalink), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Syscall9": ValueOf(syscall.Syscall9), + "Sysctl": ValueOf(syscall.Sysctl), + "SysctlUint32": ValueOf(syscall.SysctlUint32), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONNECTIONTIMEOUT": ValueOf(syscall.TCP_CONNECTIONTIMEOUT), + "TCP_KEEPALIVE": ValueOf(syscall.TCP_KEEPALIVE), + "TCP_MAXHLEN": ValueOf(syscall.TCP_MAXHLEN), + "TCP_MAXOLEN": ValueOf(syscall.TCP_MAXOLEN), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_SACK": ValueOf(syscall.TCP_MAX_SACK), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MINMSS": ValueOf(syscall.TCP_MINMSS), + "TCP_MINMSSOVERLOAD": ValueOf(syscall.TCP_MINMSSOVERLOAD), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_NOOPT": ValueOf(syscall.TCP_NOOPT), + "TCP_NOPUSH": ValueOf(syscall.TCP_NOPUSH), + "TCP_RXT_CONNDROPTIME": ValueOf(syscall.TCP_RXT_CONNDROPTIME), + "TCP_RXT_FINDROP": ValueOf(syscall.TCP_RXT_FINDROP), + "TCSAFLUSH": ValueOf(syscall.TCSAFLUSH), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCDTR": ValueOf(syscall.TIOCCDTR), + "TIOCCONS": ValueOf(uint64(syscall.TIOCCONS)), + "TIOCDCDTIMESTAMP": ValueOf(syscall.TIOCDCDTIMESTAMP), + "TIOCDRAIN": ValueOf(syscall.TIOCDRAIN), + "TIOCDSIMICROCODE": ValueOf(syscall.TIOCDSIMICROCODE), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCEXT": ValueOf(uint64(syscall.TIOCEXT)), + "TIOCFLUSH": ValueOf(uint64(syscall.TIOCFLUSH)), + "TIOCGDRAINWAIT": ValueOf(syscall.TIOCGDRAINWAIT), + "TIOCGETA": ValueOf(syscall.TIOCGETA), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCIXOFF": ValueOf(syscall.TIOCIXOFF), + "TIOCIXON": ValueOf(syscall.TIOCIXON), + "TIOCMBIC": ValueOf(uint64(syscall.TIOCMBIC)), + "TIOCMBIS": ValueOf(uint64(syscall.TIOCMBIS)), + "TIOCMGDTRWAIT": ValueOf(syscall.TIOCMGDTRWAIT), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMODG": ValueOf(syscall.TIOCMODG), + "TIOCMODS": ValueOf(uint64(syscall.TIOCMODS)), + "TIOCMSDTRWAIT": ValueOf(uint64(syscall.TIOCMSDTRWAIT)), + "TIOCMSET": ValueOf(uint64(syscall.TIOCMSET)), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(uint64(syscall.TIOCPKT)), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCPTYGNAME": ValueOf(syscall.TIOCPTYGNAME), + "TIOCPTYGRANT": ValueOf(syscall.TIOCPTYGRANT), + "TIOCPTYUNLK": ValueOf(syscall.TIOCPTYUNLK), + "TIOCREMOTE": ValueOf(uint64(syscall.TIOCREMOTE)), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCONS": ValueOf(syscall.TIOCSCONS), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSDRAINWAIT": ValueOf(uint64(syscall.TIOCSDRAINWAIT)), + "TIOCSDTR": ValueOf(syscall.TIOCSDTR), + "TIOCSETA": ValueOf(uint64(syscall.TIOCSETA)), + "TIOCSETAF": ValueOf(uint64(syscall.TIOCSETAF)), + "TIOCSETAW": ValueOf(uint64(syscall.TIOCSETAW)), + "TIOCSETD": ValueOf(uint64(syscall.TIOCSETD)), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSPGRP": ValueOf(uint64(syscall.TIOCSPGRP)), + "TIOCSTART": ValueOf(syscall.TIOCSTART), + "TIOCSTAT": ValueOf(syscall.TIOCSTAT), + "TIOCSTI": ValueOf(uint64(syscall.TIOCSTI)), + "TIOCSTOP": ValueOf(syscall.TIOCSTOP), + "TIOCSWINSZ": ValueOf(uint64(syscall.TIOCSWINSZ)), + "TIOCTIMESTAMP": ValueOf(syscall.TIOCTIMESTAMP), + "TIOCUCNTL": ValueOf(uint64(syscall.TIOCUCNTL)), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Undelete": ValueOf(syscall.Undelete), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VDSUSP": ValueOf(syscall.VDSUSP), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTATUS": ValueOf(syscall.VSTATUS), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VT0": ValueOf(syscall.VT0), + "VT1": ValueOf(syscall.VT1), + "VTDLY": ValueOf(syscall.VTDLY), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WCOREFLAG": ValueOf(syscall.WCOREFLAG), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + }, + Types: map[string]Type{ + "BpfHdr": TypeOf((*syscall.BpfHdr)(nil)).Elem(), + "BpfInsn": TypeOf((*syscall.BpfInsn)(nil)).Elem(), + "BpfProgram": TypeOf((*syscall.BpfProgram)(nil)).Elem(), + "BpfStat": TypeOf((*syscall.BpfStat)(nil)).Elem(), + "BpfVersion": TypeOf((*syscall.BpfVersion)(nil)).Elem(), + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "Fbootstraptransfer_t": TypeOf((*syscall.Fbootstraptransfer_t)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "Fstore_t": TypeOf((*syscall.Fstore_t)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfData": TypeOf((*syscall.IfData)(nil)).Elem(), + "IfMsghdr": TypeOf((*syscall.IfMsghdr)(nil)).Elem(), + "IfaMsghdr": TypeOf((*syscall.IfaMsghdr)(nil)).Elem(), + "IfmaMsghdr": TypeOf((*syscall.IfmaMsghdr)(nil)).Elem(), + "IfmaMsghdr2": TypeOf((*syscall.IfmaMsghdr2)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InterfaceAddrMessage": TypeOf((*syscall.InterfaceAddrMessage)(nil)).Elem(), + "InterfaceMessage": TypeOf((*syscall.InterfaceMessage)(nil)).Elem(), + "InterfaceMulticastAddrMessage": TypeOf((*syscall.InterfaceMulticastAddrMessage)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Kevent_t": TypeOf((*syscall.Kevent_t)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Log2phys_t": TypeOf((*syscall.Log2phys_t)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "Radvisory_t": TypeOf((*syscall.Radvisory_t)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrDatalink": TypeOf((*syscall.RawSockaddrDatalink)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RouteMessage": TypeOf((*syscall.RouteMessage)(nil)).Elem(), + "RoutingMessage": TypeOf((*syscall.RoutingMessage)(nil)).Elem(), + "RtMetrics": TypeOf((*syscall.RtMetrics)(nil)).Elem(), + "RtMsghdr": TypeOf((*syscall.RtMsghdr)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrDatalink": TypeOf((*syscall.SockaddrDatalink)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timeval32": TypeOf((*syscall.Timeval32)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + }, + Proxies: map[string]Type{ + } } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_amd64.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_amd64.go new file mode 100644 index 0000000..9e418e0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_darwin_amd64.go @@ -0,0 +1,1918 @@ +// +build !gccgo + +// this file was generated by gomacro command: import "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_CCITT": ValueOf(syscall.AF_CCITT), + "AF_CHAOS": ValueOf(syscall.AF_CHAOS), + "AF_CNT": ValueOf(syscall.AF_CNT), + "AF_COIP": ValueOf(syscall.AF_COIP), + "AF_DATAKIT": ValueOf(syscall.AF_DATAKIT), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_DLI": ValueOf(syscall.AF_DLI), + "AF_E164": ValueOf(syscall.AF_E164), + "AF_ECMA": ValueOf(syscall.AF_ECMA), + "AF_HYLINK": ValueOf(syscall.AF_HYLINK), + "AF_IEEE80211": ValueOf(syscall.AF_IEEE80211), + "AF_IMPLINK": ValueOf(syscall.AF_IMPLINK), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_ISO": ValueOf(syscall.AF_ISO), + "AF_LAT": ValueOf(syscall.AF_LAT), + "AF_LINK": ValueOf(syscall.AF_LINK), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NATM": ValueOf(syscall.AF_NATM), + "AF_NDRV": ValueOf(syscall.AF_NDRV), + "AF_NETBIOS": ValueOf(syscall.AF_NETBIOS), + "AF_NS": ValueOf(syscall.AF_NS), + "AF_OSI": ValueOf(syscall.AF_OSI), + "AF_PPP": ValueOf(syscall.AF_PPP), + "AF_PUP": ValueOf(syscall.AF_PUP), + "AF_RESERVED_36": ValueOf(syscall.AF_RESERVED_36), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_SIP": ValueOf(syscall.AF_SIP), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_SYSTEM": ValueOf(syscall.AF_SYSTEM), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "Accept": ValueOf(syscall.Accept), + "Access": ValueOf(syscall.Access), + "Adjtime": ValueOf(syscall.Adjtime), + "B0": ValueOf(syscall.B0), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B14400": ValueOf(syscall.B14400), + "B150": ValueOf(syscall.B150), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B28800": ValueOf(syscall.B28800), + "B300": ValueOf(syscall.B300), + "B38400": ValueOf(syscall.B38400), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B57600": ValueOf(syscall.B57600), + "B600": ValueOf(syscall.B600), + "B7200": ValueOf(syscall.B7200), + "B75": ValueOf(syscall.B75), + "B76800": ValueOf(syscall.B76800), + "B9600": ValueOf(syscall.B9600), + "BIOCFLUSH": ValueOf(syscall.BIOCFLUSH), + "BIOCGBLEN": ValueOf(syscall.BIOCGBLEN), + "BIOCGDLT": ValueOf(syscall.BIOCGDLT), + "BIOCGDLTLIST": ValueOf(uint32(syscall.BIOCGDLTLIST)), + "BIOCGETIF": ValueOf(syscall.BIOCGETIF), + "BIOCGHDRCMPLT": ValueOf(syscall.BIOCGHDRCMPLT), + "BIOCGRSIG": ValueOf(syscall.BIOCGRSIG), + "BIOCGRTIMEOUT": ValueOf(syscall.BIOCGRTIMEOUT), + "BIOCGSEESENT": ValueOf(syscall.BIOCGSEESENT), + "BIOCGSTATS": ValueOf(syscall.BIOCGSTATS), + "BIOCIMMEDIATE": ValueOf(uint32(syscall.BIOCIMMEDIATE)), + "BIOCPROMISC": ValueOf(syscall.BIOCPROMISC), + "BIOCSBLEN": ValueOf(uint32(syscall.BIOCSBLEN)), + "BIOCSDLT": ValueOf(uint32(syscall.BIOCSDLT)), + "BIOCSETF": ValueOf(uint32(syscall.BIOCSETF)), + "BIOCSETIF": ValueOf(uint32(syscall.BIOCSETIF)), + "BIOCSHDRCMPLT": ValueOf(uint32(syscall.BIOCSHDRCMPLT)), + "BIOCSRSIG": ValueOf(uint32(syscall.BIOCSRSIG)), + "BIOCSRTIMEOUT": ValueOf(uint32(syscall.BIOCSRTIMEOUT)), + "BIOCSSEESENT": ValueOf(uint32(syscall.BIOCSSEESENT)), + "BIOCVERSION": ValueOf(syscall.BIOCVERSION), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALIGNMENT": ValueOf(syscall.BPF_ALIGNMENT), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXBUFSIZE": ValueOf(syscall.BPF_MAXBUFSIZE), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINBUFSIZE": ValueOf(syscall.BPF_MINBUFSIZE), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RELEASE": ValueOf(syscall.BPF_RELEASE), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BpfBuflen": ValueOf(syscall.BpfBuflen), + "BpfDatalink": ValueOf(syscall.BpfDatalink), + "BpfHeadercmpl": ValueOf(syscall.BpfHeadercmpl), + "BpfInterface": ValueOf(syscall.BpfInterface), + "BpfJump": ValueOf(syscall.BpfJump), + "BpfStats": ValueOf(syscall.BpfStats), + "BpfStmt": ValueOf(syscall.BpfStmt), + "BpfTimeout": ValueOf(syscall.BpfTimeout), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CFLUSH": ValueOf(syscall.CFLUSH), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTART": ValueOf(syscall.CSTART), + "CSTATUS": ValueOf(syscall.CSTATUS), + "CSTOP": ValueOf(syscall.CSTOP), + "CSTOPB": ValueOf(syscall.CSTOPB), + "CSUSP": ValueOf(syscall.CSUSP), + "CTL_MAXNAME": ValueOf(syscall.CTL_MAXNAME), + "CTL_NET": ValueOf(syscall.CTL_NET), + "Chdir": ValueOf(syscall.Chdir), + "CheckBpfVersion": ValueOf(syscall.CheckBpfVersion), + "Chflags": ValueOf(syscall.Chflags), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "DLT_APPLE_IP_OVER_IEEE1394": ValueOf(syscall.DLT_APPLE_IP_OVER_IEEE1394), + "DLT_ARCNET": ValueOf(syscall.DLT_ARCNET), + "DLT_ATM_CLIP": ValueOf(syscall.DLT_ATM_CLIP), + "DLT_ATM_RFC1483": ValueOf(syscall.DLT_ATM_RFC1483), + "DLT_AX25": ValueOf(syscall.DLT_AX25), + "DLT_CHAOS": ValueOf(syscall.DLT_CHAOS), + "DLT_CHDLC": ValueOf(syscall.DLT_CHDLC), + "DLT_C_HDLC": ValueOf(syscall.DLT_C_HDLC), + "DLT_EN10MB": ValueOf(syscall.DLT_EN10MB), + "DLT_EN3MB": ValueOf(syscall.DLT_EN3MB), + "DLT_FDDI": ValueOf(syscall.DLT_FDDI), + "DLT_IEEE802": ValueOf(syscall.DLT_IEEE802), + "DLT_IEEE802_11": ValueOf(syscall.DLT_IEEE802_11), + "DLT_IEEE802_11_RADIO": ValueOf(syscall.DLT_IEEE802_11_RADIO), + "DLT_IEEE802_11_RADIO_AVS": ValueOf(syscall.DLT_IEEE802_11_RADIO_AVS), + "DLT_LINUX_SLL": ValueOf(syscall.DLT_LINUX_SLL), + "DLT_LOOP": ValueOf(syscall.DLT_LOOP), + "DLT_NULL": ValueOf(syscall.DLT_NULL), + "DLT_PFLOG": ValueOf(syscall.DLT_PFLOG), + "DLT_PFSYNC": ValueOf(syscall.DLT_PFSYNC), + "DLT_PPP": ValueOf(syscall.DLT_PPP), + "DLT_PPP_BSDOS": ValueOf(syscall.DLT_PPP_BSDOS), + "DLT_PPP_SERIAL": ValueOf(syscall.DLT_PPP_SERIAL), + "DLT_PRONET": ValueOf(syscall.DLT_PRONET), + "DLT_RAW": ValueOf(syscall.DLT_RAW), + "DLT_SLIP": ValueOf(syscall.DLT_SLIP), + "DLT_SLIP_BSDOS": ValueOf(syscall.DLT_SLIP_BSDOS), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EAUTH": ValueOf(syscall.EAUTH), + "EBADARCH": ValueOf(syscall.EBADARCH), + "EBADEXEC": ValueOf(syscall.EBADEXEC), + "EBADF": ValueOf(syscall.EBADF), + "EBADMACHO": ValueOf(syscall.EBADMACHO), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADRPC": ValueOf(syscall.EBADRPC), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDEVERR": ValueOf(syscall.EDEVERR), + "EDOM": ValueOf(syscall.EDOM), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EFTYPE": ValueOf(syscall.EFTYPE), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "ELAST": ValueOf(syscall.ELAST), + "ELOOP": ValueOf(syscall.ELOOP), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENEEDAUTH": ValueOf(syscall.ENEEDAUTH), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOATTR": ValueOf(syscall.ENOATTR), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENOPOLICY": ValueOf(syscall.ENOPOLICY), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPROCLIM": ValueOf(syscall.EPROCLIM), + "EPROCUNAVAIL": ValueOf(syscall.EPROCUNAVAIL), + "EPROGMISMATCH": ValueOf(syscall.EPROGMISMATCH), + "EPROGUNAVAIL": ValueOf(syscall.EPROGUNAVAIL), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "EPWROFF": ValueOf(syscall.EPWROFF), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EROFS": ValueOf(syscall.EROFS), + "ERPCMISMATCH": ValueOf(syscall.ERPCMISMATCH), + "ESHLIBVERS": ValueOf(syscall.ESHLIBVERS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESTALE": ValueOf(syscall.ESTALE), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUSERS": ValueOf(syscall.EUSERS), + "EVFILT_AIO": ValueOf(syscall.EVFILT_AIO), + "EVFILT_FS": ValueOf(syscall.EVFILT_FS), + "EVFILT_MACHPORT": ValueOf(syscall.EVFILT_MACHPORT), + "EVFILT_PROC": ValueOf(syscall.EVFILT_PROC), + "EVFILT_READ": ValueOf(syscall.EVFILT_READ), + "EVFILT_SIGNAL": ValueOf(syscall.EVFILT_SIGNAL), + "EVFILT_SYSCOUNT": ValueOf(syscall.EVFILT_SYSCOUNT), + "EVFILT_THREADMARKER": ValueOf(syscall.EVFILT_THREADMARKER), + "EVFILT_TIMER": ValueOf(syscall.EVFILT_TIMER), + "EVFILT_USER": ValueOf(syscall.EVFILT_USER), + "EVFILT_VM": ValueOf(syscall.EVFILT_VM), + "EVFILT_VNODE": ValueOf(syscall.EVFILT_VNODE), + "EVFILT_WRITE": ValueOf(syscall.EVFILT_WRITE), + "EV_ADD": ValueOf(syscall.EV_ADD), + "EV_CLEAR": ValueOf(syscall.EV_CLEAR), + "EV_DELETE": ValueOf(syscall.EV_DELETE), + "EV_DISABLE": ValueOf(syscall.EV_DISABLE), + "EV_DISPATCH": ValueOf(syscall.EV_DISPATCH), + "EV_ENABLE": ValueOf(syscall.EV_ENABLE), + "EV_EOF": ValueOf(syscall.EV_EOF), + "EV_ERROR": ValueOf(syscall.EV_ERROR), + "EV_FLAG0": ValueOf(syscall.EV_FLAG0), + "EV_FLAG1": ValueOf(syscall.EV_FLAG1), + "EV_ONESHOT": ValueOf(syscall.EV_ONESHOT), + "EV_OOBAND": ValueOf(syscall.EV_OOBAND), + "EV_POLL": ValueOf(syscall.EV_POLL), + "EV_RECEIPT": ValueOf(syscall.EV_RECEIPT), + "EV_SYSFLAGS": ValueOf(syscall.EV_SYSFLAGS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXTA": ValueOf(syscall.EXTA), + "EXTB": ValueOf(syscall.EXTB), + "EXTPROC": ValueOf(syscall.EXTPROC), + "Environ": ValueOf(syscall.Environ), + "Exchangedata": ValueOf(syscall.Exchangedata), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_ADDFILESIGS": ValueOf(syscall.F_ADDFILESIGS), + "F_ADDSIGS": ValueOf(syscall.F_ADDSIGS), + "F_ALLOCATEALL": ValueOf(syscall.F_ALLOCATEALL), + "F_ALLOCATECONTIG": ValueOf(syscall.F_ALLOCATECONTIG), + "F_CHKCLEAN": ValueOf(syscall.F_CHKCLEAN), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_FLUSH_DATA": ValueOf(syscall.F_FLUSH_DATA), + "F_FREEZE_FS": ValueOf(syscall.F_FREEZE_FS), + "F_FULLFSYNC": ValueOf(syscall.F_FULLFSYNC), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLKPID": ValueOf(syscall.F_GETLKPID), + "F_GETNOSIGPIPE": ValueOf(syscall.F_GETNOSIGPIPE), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETPATH": ValueOf(syscall.F_GETPATH), + "F_GETPATH_MTMINFO": ValueOf(syscall.F_GETPATH_MTMINFO), + "F_GETPROTECTIONCLASS": ValueOf(syscall.F_GETPROTECTIONCLASS), + "F_GLOBAL_NOCACHE": ValueOf(syscall.F_GLOBAL_NOCACHE), + "F_LOG2PHYS": ValueOf(syscall.F_LOG2PHYS), + "F_LOG2PHYS_EXT": ValueOf(syscall.F_LOG2PHYS_EXT), + "F_MARKDEPENDENCY": ValueOf(syscall.F_MARKDEPENDENCY), + "F_NOCACHE": ValueOf(syscall.F_NOCACHE), + "F_NODIRECT": ValueOf(syscall.F_NODIRECT), + "F_OK": ValueOf(syscall.F_OK), + "F_PATHPKG_CHECK": ValueOf(syscall.F_PATHPKG_CHECK), + "F_PEOFPOSMODE": ValueOf(syscall.F_PEOFPOSMODE), + "F_PREALLOCATE": ValueOf(syscall.F_PREALLOCATE), + "F_RDADVISE": ValueOf(syscall.F_RDADVISE), + "F_RDAHEAD": ValueOf(syscall.F_RDAHEAD), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_READBOOTSTRAP": ValueOf(syscall.F_READBOOTSTRAP), + "F_SETBACKINGSTORE": ValueOf(syscall.F_SETBACKINGSTORE), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETNOSIGPIPE": ValueOf(syscall.F_SETNOSIGPIPE), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETPROTECTIONCLASS": ValueOf(syscall.F_SETPROTECTIONCLASS), + "F_SETSIZE": ValueOf(syscall.F_SETSIZE), + "F_THAW_FS": ValueOf(syscall.F_THAW_FS), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_VOLPOSMODE": ValueOf(syscall.F_VOLPOSMODE), + "F_WRITEBOOTSTRAP": ValueOf(syscall.F_WRITEBOOTSTRAP), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchflags": ValueOf(syscall.Fchflags), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchown": ValueOf(syscall.Fchown), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Flock": ValueOf(syscall.Flock), + "FlushBpf": ValueOf(syscall.FlushBpf), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fpathconf": ValueOf(syscall.Fpathconf), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Getdirentries": ValueOf(syscall.Getdirentries), + "Getdtablesize": ValueOf(syscall.Getdtablesize), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getfsstat": ValueOf(syscall.Getfsstat), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsid": ValueOf(syscall.Getsid), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptByte": ValueOf(syscall.GetsockoptByte), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMP6_FILTER": ValueOf(syscall.ICMP6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_ALTPHYS": ValueOf(syscall.IFF_ALTPHYS), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_LINK0": ValueOf(syscall.IFF_LINK0), + "IFF_LINK1": ValueOf(syscall.IFF_LINK1), + "IFF_LINK2": ValueOf(syscall.IFF_LINK2), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_OACTIVE": ValueOf(syscall.IFF_OACTIVE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SIMPLEX": ValueOf(syscall.IFF_SIMPLEX), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IFT_1822": ValueOf(syscall.IFT_1822), + "IFT_AAL5": ValueOf(syscall.IFT_AAL5), + "IFT_ARCNET": ValueOf(syscall.IFT_ARCNET), + "IFT_ARCNETPLUS": ValueOf(syscall.IFT_ARCNETPLUS), + "IFT_ATM": ValueOf(syscall.IFT_ATM), + "IFT_BRIDGE": ValueOf(syscall.IFT_BRIDGE), + "IFT_CARP": ValueOf(syscall.IFT_CARP), + "IFT_CELLULAR": ValueOf(syscall.IFT_CELLULAR), + "IFT_CEPT": ValueOf(syscall.IFT_CEPT), + "IFT_DS3": ValueOf(syscall.IFT_DS3), + "IFT_ENC": ValueOf(syscall.IFT_ENC), + "IFT_EON": ValueOf(syscall.IFT_EON), + "IFT_ETHER": ValueOf(syscall.IFT_ETHER), + "IFT_FAITH": ValueOf(syscall.IFT_FAITH), + "IFT_FDDI": ValueOf(syscall.IFT_FDDI), + "IFT_FRELAY": ValueOf(syscall.IFT_FRELAY), + "IFT_FRELAYDCE": ValueOf(syscall.IFT_FRELAYDCE), + "IFT_GIF": ValueOf(syscall.IFT_GIF), + "IFT_HDH1822": ValueOf(syscall.IFT_HDH1822), + "IFT_HIPPI": ValueOf(syscall.IFT_HIPPI), + "IFT_HSSI": ValueOf(syscall.IFT_HSSI), + "IFT_HY": ValueOf(syscall.IFT_HY), + "IFT_IEEE1394": ValueOf(syscall.IFT_IEEE1394), + "IFT_IEEE8023ADLAG": ValueOf(syscall.IFT_IEEE8023ADLAG), + "IFT_ISDNBASIC": ValueOf(syscall.IFT_ISDNBASIC), + "IFT_ISDNPRIMARY": ValueOf(syscall.IFT_ISDNPRIMARY), + "IFT_ISO88022LLC": ValueOf(syscall.IFT_ISO88022LLC), + "IFT_ISO88023": ValueOf(syscall.IFT_ISO88023), + "IFT_ISO88024": ValueOf(syscall.IFT_ISO88024), + "IFT_ISO88025": ValueOf(syscall.IFT_ISO88025), + "IFT_ISO88026": ValueOf(syscall.IFT_ISO88026), + "IFT_L2VLAN": ValueOf(syscall.IFT_L2VLAN), + "IFT_LAPB": ValueOf(syscall.IFT_LAPB), + "IFT_LOCALTALK": ValueOf(syscall.IFT_LOCALTALK), + "IFT_LOOP": ValueOf(syscall.IFT_LOOP), + "IFT_MIOX25": ValueOf(syscall.IFT_MIOX25), + "IFT_MODEM": ValueOf(syscall.IFT_MODEM), + "IFT_NSIP": ValueOf(syscall.IFT_NSIP), + "IFT_OTHER": ValueOf(syscall.IFT_OTHER), + "IFT_P10": ValueOf(syscall.IFT_P10), + "IFT_P80": ValueOf(syscall.IFT_P80), + "IFT_PARA": ValueOf(syscall.IFT_PARA), + "IFT_PDP": ValueOf(syscall.IFT_PDP), + "IFT_PFLOG": ValueOf(syscall.IFT_PFLOG), + "IFT_PFSYNC": ValueOf(syscall.IFT_PFSYNC), + "IFT_PPP": ValueOf(syscall.IFT_PPP), + "IFT_PROPMUX": ValueOf(syscall.IFT_PROPMUX), + "IFT_PROPVIRTUAL": ValueOf(syscall.IFT_PROPVIRTUAL), + "IFT_PTPSERIAL": ValueOf(syscall.IFT_PTPSERIAL), + "IFT_RS232": ValueOf(syscall.IFT_RS232), + "IFT_SDLC": ValueOf(syscall.IFT_SDLC), + "IFT_SIP": ValueOf(syscall.IFT_SIP), + "IFT_SLIP": ValueOf(syscall.IFT_SLIP), + "IFT_SMDSDXI": ValueOf(syscall.IFT_SMDSDXI), + "IFT_SMDSICIP": ValueOf(syscall.IFT_SMDSICIP), + "IFT_SONET": ValueOf(syscall.IFT_SONET), + "IFT_SONETPATH": ValueOf(syscall.IFT_SONETPATH), + "IFT_SONETVT": ValueOf(syscall.IFT_SONETVT), + "IFT_STARLAN": ValueOf(syscall.IFT_STARLAN), + "IFT_STF": ValueOf(syscall.IFT_STF), + "IFT_T1": ValueOf(syscall.IFT_T1), + "IFT_ULTRA": ValueOf(syscall.IFT_ULTRA), + "IFT_V35": ValueOf(syscall.IFT_V35), + "IFT_X25": ValueOf(syscall.IFT_X25), + "IFT_X25DDN": ValueOf(syscall.IFT_X25DDN), + "IFT_X25PLE": ValueOf(syscall.IFT_X25PLE), + "IFT_XETHER": ValueOf(syscall.IFT_XETHER), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLASSD_HOST": ValueOf(syscall.IN_CLASSD_HOST), + "IN_CLASSD_NET": ValueOf(uint32(syscall.IN_CLASSD_NET)), + "IN_CLASSD_NSHIFT": ValueOf(syscall.IN_CLASSD_NSHIFT), + "IN_LINKLOCALNETNUM": ValueOf(uint32(syscall.IN_LINKLOCALNETNUM)), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IPPROTO_3PC": ValueOf(syscall.IPPROTO_3PC), + "IPPROTO_ADFS": ValueOf(syscall.IPPROTO_ADFS), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_AHIP": ValueOf(syscall.IPPROTO_AHIP), + "IPPROTO_APES": ValueOf(syscall.IPPROTO_APES), + "IPPROTO_ARGUS": ValueOf(syscall.IPPROTO_ARGUS), + "IPPROTO_AX25": ValueOf(syscall.IPPROTO_AX25), + "IPPROTO_BHA": ValueOf(syscall.IPPROTO_BHA), + "IPPROTO_BLT": ValueOf(syscall.IPPROTO_BLT), + "IPPROTO_BRSATMON": ValueOf(syscall.IPPROTO_BRSATMON), + "IPPROTO_CFTP": ValueOf(syscall.IPPROTO_CFTP), + "IPPROTO_CHAOS": ValueOf(syscall.IPPROTO_CHAOS), + "IPPROTO_CMTP": ValueOf(syscall.IPPROTO_CMTP), + "IPPROTO_CPHB": ValueOf(syscall.IPPROTO_CPHB), + "IPPROTO_CPNX": ValueOf(syscall.IPPROTO_CPNX), + "IPPROTO_DDP": ValueOf(syscall.IPPROTO_DDP), + "IPPROTO_DGP": ValueOf(syscall.IPPROTO_DGP), + "IPPROTO_DIVERT": ValueOf(syscall.IPPROTO_DIVERT), + "IPPROTO_DONE": ValueOf(syscall.IPPROTO_DONE), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_EMCON": ValueOf(syscall.IPPROTO_EMCON), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_EON": ValueOf(syscall.IPPROTO_EON), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_ETHERIP": ValueOf(syscall.IPPROTO_ETHERIP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GGP": ValueOf(syscall.IPPROTO_GGP), + "IPPROTO_GMTP": ValueOf(syscall.IPPROTO_GMTP), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HELLO": ValueOf(syscall.IPPROTO_HELLO), + "IPPROTO_HMP": ValueOf(syscall.IPPROTO_HMP), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IDPR": ValueOf(syscall.IPPROTO_IDPR), + "IPPROTO_IDRP": ValueOf(syscall.IPPROTO_IDRP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IGP": ValueOf(syscall.IPPROTO_IGP), + "IPPROTO_IGRP": ValueOf(syscall.IPPROTO_IGRP), + "IPPROTO_IL": ValueOf(syscall.IPPROTO_IL), + "IPPROTO_INLSP": ValueOf(syscall.IPPROTO_INLSP), + "IPPROTO_INP": ValueOf(syscall.IPPROTO_INP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPCOMP": ValueOf(syscall.IPPROTO_IPCOMP), + "IPPROTO_IPCV": ValueOf(syscall.IPPROTO_IPCV), + "IPPROTO_IPEIP": ValueOf(syscall.IPPROTO_IPEIP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPPC": ValueOf(syscall.IPPROTO_IPPC), + "IPPROTO_IPV4": ValueOf(syscall.IPPROTO_IPV4), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_IRTP": ValueOf(syscall.IPPROTO_IRTP), + "IPPROTO_KRYPTOLAN": ValueOf(syscall.IPPROTO_KRYPTOLAN), + "IPPROTO_LARP": ValueOf(syscall.IPPROTO_LARP), + "IPPROTO_LEAF1": ValueOf(syscall.IPPROTO_LEAF1), + "IPPROTO_LEAF2": ValueOf(syscall.IPPROTO_LEAF2), + "IPPROTO_MAX": ValueOf(syscall.IPPROTO_MAX), + "IPPROTO_MAXID": ValueOf(syscall.IPPROTO_MAXID), + "IPPROTO_MEAS": ValueOf(syscall.IPPROTO_MEAS), + "IPPROTO_MHRP": ValueOf(syscall.IPPROTO_MHRP), + "IPPROTO_MICP": ValueOf(syscall.IPPROTO_MICP), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_MUX": ValueOf(syscall.IPPROTO_MUX), + "IPPROTO_ND": ValueOf(syscall.IPPROTO_ND), + "IPPROTO_NHRP": ValueOf(syscall.IPPROTO_NHRP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_NSP": ValueOf(syscall.IPPROTO_NSP), + "IPPROTO_NVPII": ValueOf(syscall.IPPROTO_NVPII), + "IPPROTO_OSPFIGP": ValueOf(syscall.IPPROTO_OSPFIGP), + "IPPROTO_PGM": ValueOf(syscall.IPPROTO_PGM), + "IPPROTO_PIGP": ValueOf(syscall.IPPROTO_PIGP), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PRM": ValueOf(syscall.IPPROTO_PRM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_PVP": ValueOf(syscall.IPPROTO_PVP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_RCCMON": ValueOf(syscall.IPPROTO_RCCMON), + "IPPROTO_RDP": ValueOf(syscall.IPPROTO_RDP), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_RVD": ValueOf(syscall.IPPROTO_RVD), + "IPPROTO_SATEXPAK": ValueOf(syscall.IPPROTO_SATEXPAK), + "IPPROTO_SATMON": ValueOf(syscall.IPPROTO_SATMON), + "IPPROTO_SCCSP": ValueOf(syscall.IPPROTO_SCCSP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_SDRP": ValueOf(syscall.IPPROTO_SDRP), + "IPPROTO_SEP": ValueOf(syscall.IPPROTO_SEP), + "IPPROTO_SRPC": ValueOf(syscall.IPPROTO_SRPC), + "IPPROTO_ST": ValueOf(syscall.IPPROTO_ST), + "IPPROTO_SVMTP": ValueOf(syscall.IPPROTO_SVMTP), + "IPPROTO_SWIPE": ValueOf(syscall.IPPROTO_SWIPE), + "IPPROTO_TCF": ValueOf(syscall.IPPROTO_TCF), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_TPXX": ValueOf(syscall.IPPROTO_TPXX), + "IPPROTO_TRUNK1": ValueOf(syscall.IPPROTO_TRUNK1), + "IPPROTO_TRUNK2": ValueOf(syscall.IPPROTO_TRUNK2), + "IPPROTO_TTP": ValueOf(syscall.IPPROTO_TTP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_VINES": ValueOf(syscall.IPPROTO_VINES), + "IPPROTO_VISA": ValueOf(syscall.IPPROTO_VISA), + "IPPROTO_VMTP": ValueOf(syscall.IPPROTO_VMTP), + "IPPROTO_WBEXPAK": ValueOf(syscall.IPPROTO_WBEXPAK), + "IPPROTO_WBMON": ValueOf(syscall.IPPROTO_WBMON), + "IPPROTO_WSN": ValueOf(syscall.IPPROTO_WSN), + "IPPROTO_XNET": ValueOf(syscall.IPPROTO_XNET), + "IPPROTO_XTP": ValueOf(syscall.IPPROTO_XTP), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292NEXTHOP": ValueOf(syscall.IPV6_2292NEXTHOP), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_BINDV6ONLY": ValueOf(syscall.IPV6_BINDV6ONLY), + "IPV6_BOUND_IF": ValueOf(syscall.IPV6_BOUND_IF), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DEFAULT_MULTICAST_HOPS": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_HOPS), + "IPV6_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_LOOP), + "IPV6_DEFHLIM": ValueOf(syscall.IPV6_DEFHLIM), + "IPV6_FAITH": ValueOf(syscall.IPV6_FAITH), + "IPV6_FLOWINFO_MASK": ValueOf(uint32(syscall.IPV6_FLOWINFO_MASK)), + "IPV6_FLOWLABEL_MASK": ValueOf(uint32(syscall.IPV6_FLOWLABEL_MASK)), + "IPV6_FRAGTTL": ValueOf(syscall.IPV6_FRAGTTL), + "IPV6_FW_ADD": ValueOf(syscall.IPV6_FW_ADD), + "IPV6_FW_DEL": ValueOf(syscall.IPV6_FW_DEL), + "IPV6_FW_FLUSH": ValueOf(syscall.IPV6_FW_FLUSH), + "IPV6_FW_GET": ValueOf(syscall.IPV6_FW_GET), + "IPV6_FW_ZERO": ValueOf(syscall.IPV6_FW_ZERO), + "IPV6_HLIMDEC": ValueOf(syscall.IPV6_HLIMDEC), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MAXHLIM": ValueOf(syscall.IPV6_MAXHLIM), + "IPV6_MAXOPTHDR": ValueOf(syscall.IPV6_MAXOPTHDR), + "IPV6_MAXPACKET": ValueOf(syscall.IPV6_MAXPACKET), + "IPV6_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IPV6_MAX_GROUP_SRC_FILTER), + "IPV6_MAX_MEMBERSHIPS": ValueOf(syscall.IPV6_MAX_MEMBERSHIPS), + "IPV6_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IPV6_MAX_SOCK_SRC_FILTER), + "IPV6_MIN_MEMBERSHIPS": ValueOf(syscall.IPV6_MIN_MEMBERSHIPS), + "IPV6_MMTU": ValueOf(syscall.IPV6_MMTU), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_PORTRANGE": ValueOf(syscall.IPV6_PORTRANGE), + "IPV6_PORTRANGE_DEFAULT": ValueOf(syscall.IPV6_PORTRANGE_DEFAULT), + "IPV6_PORTRANGE_HIGH": ValueOf(syscall.IPV6_PORTRANGE_HIGH), + "IPV6_PORTRANGE_LOW": ValueOf(syscall.IPV6_PORTRANGE_LOW), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_SOCKOPT_RESERVED1": ValueOf(syscall.IPV6_SOCKOPT_RESERVED1), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_VERSION": ValueOf(syscall.IPV6_VERSION), + "IPV6_VERSION_MASK": ValueOf(syscall.IPV6_VERSION_MASK), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_BOUND_IF": ValueOf(syscall.IP_BOUND_IF), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_DUMMYNET_CONFIGURE": ValueOf(syscall.IP_DUMMYNET_CONFIGURE), + "IP_DUMMYNET_DEL": ValueOf(syscall.IP_DUMMYNET_DEL), + "IP_DUMMYNET_FLUSH": ValueOf(syscall.IP_DUMMYNET_FLUSH), + "IP_DUMMYNET_GET": ValueOf(syscall.IP_DUMMYNET_GET), + "IP_FAITH": ValueOf(syscall.IP_FAITH), + "IP_FW_ADD": ValueOf(syscall.IP_FW_ADD), + "IP_FW_DEL": ValueOf(syscall.IP_FW_DEL), + "IP_FW_FLUSH": ValueOf(syscall.IP_FW_FLUSH), + "IP_FW_GET": ValueOf(syscall.IP_FW_GET), + "IP_FW_RESETLOG": ValueOf(syscall.IP_FW_RESETLOG), + "IP_FW_ZERO": ValueOf(syscall.IP_FW_ZERO), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IP_MAX_GROUP_SRC_FILTER), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MAX_SOCK_MUTE_FILTER": ValueOf(syscall.IP_MAX_SOCK_MUTE_FILTER), + "IP_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IP_MAX_SOCK_SRC_FILTER), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MIN_MEMBERSHIPS": ValueOf(syscall.IP_MIN_MEMBERSHIPS), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_IFINDEX": ValueOf(syscall.IP_MULTICAST_IFINDEX), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_MULTICAST_VIF": ValueOf(syscall.IP_MULTICAST_VIF), + "IP_NAT__XXX": ValueOf(syscall.IP_NAT__XXX), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OLD_FW_ADD": ValueOf(syscall.IP_OLD_FW_ADD), + "IP_OLD_FW_DEL": ValueOf(syscall.IP_OLD_FW_DEL), + "IP_OLD_FW_FLUSH": ValueOf(syscall.IP_OLD_FW_FLUSH), + "IP_OLD_FW_GET": ValueOf(syscall.IP_OLD_FW_GET), + "IP_OLD_FW_RESETLOG": ValueOf(syscall.IP_OLD_FW_RESETLOG), + "IP_OLD_FW_ZERO": ValueOf(syscall.IP_OLD_FW_ZERO), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PORTRANGE": ValueOf(syscall.IP_PORTRANGE), + "IP_PORTRANGE_DEFAULT": ValueOf(syscall.IP_PORTRANGE_DEFAULT), + "IP_PORTRANGE_HIGH": ValueOf(syscall.IP_PORTRANGE_HIGH), + "IP_PORTRANGE_LOW": ValueOf(syscall.IP_PORTRANGE_LOW), + "IP_RECVDSTADDR": ValueOf(syscall.IP_RECVDSTADDR), + "IP_RECVIF": ValueOf(syscall.IP_RECVIF), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVPKTINFO": ValueOf(syscall.IP_RECVPKTINFO), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_RSVP_OFF": ValueOf(syscall.IP_RSVP_OFF), + "IP_RSVP_ON": ValueOf(syscall.IP_RSVP_ON), + "IP_RSVP_VIF_OFF": ValueOf(syscall.IP_RSVP_VIF_OFF), + "IP_RSVP_VIF_ON": ValueOf(syscall.IP_RSVP_VIF_ON), + "IP_STRIPHDR": ValueOf(syscall.IP_STRIPHDR), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRAFFIC_MGT_BACKGROUND": ValueOf(syscall.IP_TRAFFIC_MGT_BACKGROUND), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "Issetugid": ValueOf(syscall.Issetugid), + "Kevent": ValueOf(syscall.Kevent), + "Kill": ValueOf(syscall.Kill), + "Kqueue": ValueOf(syscall.Kqueue), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Lstat": ValueOf(syscall.Lstat), + "MADV_CAN_REUSE": ValueOf(syscall.MADV_CAN_REUSE), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_FREE": ValueOf(syscall.MADV_FREE), + "MADV_FREE_REUSABLE": ValueOf(syscall.MADV_FREE_REUSABLE), + "MADV_FREE_REUSE": ValueOf(syscall.MADV_FREE_REUSE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MADV_ZERO_WIRED_PAGES": ValueOf(syscall.MADV_ZERO_WIRED_PAGES), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_COPY": ValueOf(syscall.MAP_COPY), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_HASSEMAPHORE": ValueOf(syscall.MAP_HASSEMAPHORE), + "MAP_JIT": ValueOf(syscall.MAP_JIT), + "MAP_NOCACHE": ValueOf(syscall.MAP_NOCACHE), + "MAP_NOEXTEND": ValueOf(syscall.MAP_NOEXTEND), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_RENAME": ValueOf(syscall.MAP_RENAME), + "MAP_RESERVED0080": ValueOf(syscall.MAP_RESERVED0080), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOF": ValueOf(syscall.MSG_EOF), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_FLUSH": ValueOf(syscall.MSG_FLUSH), + "MSG_HAVEMORE": ValueOf(syscall.MSG_HAVEMORE), + "MSG_HOLD": ValueOf(syscall.MSG_HOLD), + "MSG_NEEDSA": ValueOf(syscall.MSG_NEEDSA), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_RCVMORE": ValueOf(syscall.MSG_RCVMORE), + "MSG_SEND": ValueOf(syscall.MSG_SEND), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITSTREAM": ValueOf(syscall.MSG_WAITSTREAM), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_DEACTIVATE": ValueOf(syscall.MS_DEACTIVATE), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_KILLPAGES": ValueOf(syscall.MS_KILLPAGES), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NET_RT_DUMP": ValueOf(syscall.NET_RT_DUMP), + "NET_RT_DUMP2": ValueOf(syscall.NET_RT_DUMP2), + "NET_RT_FLAGS": ValueOf(syscall.NET_RT_FLAGS), + "NET_RT_IFLIST": ValueOf(syscall.NET_RT_IFLIST), + "NET_RT_IFLIST2": ValueOf(syscall.NET_RT_IFLIST2), + "NET_RT_MAXID": ValueOf(syscall.NET_RT_MAXID), + "NET_RT_STAT": ValueOf(syscall.NET_RT_STAT), + "NET_RT_TRASH": ValueOf(syscall.NET_RT_TRASH), + "NOFLSH": ValueOf(uint32(syscall.NOFLSH)), + "NOTE_ABSOLUTE": ValueOf(syscall.NOTE_ABSOLUTE), + "NOTE_ATTRIB": ValueOf(syscall.NOTE_ATTRIB), + "NOTE_CHILD": ValueOf(syscall.NOTE_CHILD), + "NOTE_DELETE": ValueOf(syscall.NOTE_DELETE), + "NOTE_EXEC": ValueOf(syscall.NOTE_EXEC), + "NOTE_EXIT": ValueOf(uint32(syscall.NOTE_EXIT)), + "NOTE_EXITSTATUS": ValueOf(syscall.NOTE_EXITSTATUS), + "NOTE_EXTEND": ValueOf(syscall.NOTE_EXTEND), + "NOTE_FFAND": ValueOf(syscall.NOTE_FFAND), + "NOTE_FFCOPY": ValueOf(uint32(syscall.NOTE_FFCOPY)), + "NOTE_FFCTRLMASK": ValueOf(uint32(syscall.NOTE_FFCTRLMASK)), + "NOTE_FFLAGSMASK": ValueOf(syscall.NOTE_FFLAGSMASK), + "NOTE_FFNOP": ValueOf(syscall.NOTE_FFNOP), + "NOTE_FFOR": ValueOf(uint32(syscall.NOTE_FFOR)), + "NOTE_FORK": ValueOf(syscall.NOTE_FORK), + "NOTE_LINK": ValueOf(syscall.NOTE_LINK), + "NOTE_LOWAT": ValueOf(syscall.NOTE_LOWAT), + "NOTE_NONE": ValueOf(syscall.NOTE_NONE), + "NOTE_NSECONDS": ValueOf(syscall.NOTE_NSECONDS), + "NOTE_PCTRLMASK": ValueOf(syscall.NOTE_PCTRLMASK), + "NOTE_PDATAMASK": ValueOf(syscall.NOTE_PDATAMASK), + "NOTE_REAP": ValueOf(syscall.NOTE_REAP), + "NOTE_RENAME": ValueOf(syscall.NOTE_RENAME), + "NOTE_RESOURCEEND": ValueOf(syscall.NOTE_RESOURCEEND), + "NOTE_REVOKE": ValueOf(syscall.NOTE_REVOKE), + "NOTE_SECONDS": ValueOf(syscall.NOTE_SECONDS), + "NOTE_SIGNAL": ValueOf(syscall.NOTE_SIGNAL), + "NOTE_TRACK": ValueOf(syscall.NOTE_TRACK), + "NOTE_TRACKERR": ValueOf(syscall.NOTE_TRACKERR), + "NOTE_TRIGGER": ValueOf(syscall.NOTE_TRIGGER), + "NOTE_USECONDS": ValueOf(syscall.NOTE_USECONDS), + "NOTE_VM_ERROR": ValueOf(syscall.NOTE_VM_ERROR), + "NOTE_VM_PRESSURE": ValueOf(uint32(syscall.NOTE_VM_PRESSURE)), + "NOTE_VM_PRESSURE_SUDDEN_TERMINATE": ValueOf(syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE), + "NOTE_VM_PRESSURE_TERMINATE": ValueOf(syscall.NOTE_VM_PRESSURE_TERMINATE), + "NOTE_WRITE": ValueOf(syscall.NOTE_WRITE), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "ONOEOT": ValueOf(syscall.ONOEOT), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_ALERT": ValueOf(syscall.O_ALERT), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EVTONLY": ValueOf(syscall.O_EVTONLY), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_EXLOCK": ValueOf(syscall.O_EXLOCK), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_POPUP": ValueOf(uint32(syscall.O_POPUP)), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_SHLOCK": ValueOf(syscall.O_SHLOCK), + "O_SYMLINK": ValueOf(syscall.O_SYMLINK), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "PT_ATTACH": ValueOf(syscall.PT_ATTACH), + "PT_ATTACHEXC": ValueOf(syscall.PT_ATTACHEXC), + "PT_CONTINUE": ValueOf(syscall.PT_CONTINUE), + "PT_DENY_ATTACH": ValueOf(syscall.PT_DENY_ATTACH), + "PT_DETACH": ValueOf(syscall.PT_DETACH), + "PT_FIRSTMACH": ValueOf(syscall.PT_FIRSTMACH), + "PT_FORCEQUOTA": ValueOf(syscall.PT_FORCEQUOTA), + "PT_KILL": ValueOf(syscall.PT_KILL), + "PT_READ_D": ValueOf(syscall.PT_READ_D), + "PT_READ_I": ValueOf(syscall.PT_READ_I), + "PT_READ_U": ValueOf(syscall.PT_READ_U), + "PT_SIGEXC": ValueOf(syscall.PT_SIGEXC), + "PT_STEP": ValueOf(syscall.PT_STEP), + "PT_THUPDATE": ValueOf(syscall.PT_THUPDATE), + "PT_TRACE_ME": ValueOf(syscall.PT_TRACE_ME), + "PT_WRITE_D": ValueOf(syscall.PT_WRITE_D), + "PT_WRITE_I": ValueOf(syscall.PT_WRITE_I), + "PT_WRITE_U": ValueOf(syscall.PT_WRITE_U), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseRoutingMessage": ValueOf(syscall.ParseRoutingMessage), + "ParseRoutingSockaddr": ValueOf(syscall.ParseRoutingSockaddr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "Pathconf": ValueOf(syscall.Pathconf), + "Pipe": ValueOf(syscall.Pipe), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(int64(syscall.RLIM_INFINITY)), + "RTAX_AUTHOR": ValueOf(syscall.RTAX_AUTHOR), + "RTAX_BRD": ValueOf(syscall.RTAX_BRD), + "RTAX_DST": ValueOf(syscall.RTAX_DST), + "RTAX_GATEWAY": ValueOf(syscall.RTAX_GATEWAY), + "RTAX_GENMASK": ValueOf(syscall.RTAX_GENMASK), + "RTAX_IFA": ValueOf(syscall.RTAX_IFA), + "RTAX_IFP": ValueOf(syscall.RTAX_IFP), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_NETMASK": ValueOf(syscall.RTAX_NETMASK), + "RTA_AUTHOR": ValueOf(syscall.RTA_AUTHOR), + "RTA_BRD": ValueOf(syscall.RTA_BRD), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_GENMASK": ValueOf(syscall.RTA_GENMASK), + "RTA_IFA": ValueOf(syscall.RTA_IFA), + "RTA_IFP": ValueOf(syscall.RTA_IFP), + "RTA_NETMASK": ValueOf(syscall.RTA_NETMASK), + "RTF_BLACKHOLE": ValueOf(syscall.RTF_BLACKHOLE), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CLONING": ValueOf(syscall.RTF_CLONING), + "RTF_CONDEMNED": ValueOf(syscall.RTF_CONDEMNED), + "RTF_DELCLONE": ValueOf(syscall.RTF_DELCLONE), + "RTF_DONE": ValueOf(syscall.RTF_DONE), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_IFREF": ValueOf(syscall.RTF_IFREF), + "RTF_IFSCOPE": ValueOf(syscall.RTF_IFSCOPE), + "RTF_LLINFO": ValueOf(syscall.RTF_LLINFO), + "RTF_LOCAL": ValueOf(syscall.RTF_LOCAL), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_PINNED": ValueOf(syscall.RTF_PINNED), + "RTF_PRCLONING": ValueOf(syscall.RTF_PRCLONING), + "RTF_PROTO1": ValueOf(syscall.RTF_PROTO1), + "RTF_PROTO2": ValueOf(syscall.RTF_PROTO2), + "RTF_PROTO3": ValueOf(syscall.RTF_PROTO3), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WASCLONED": ValueOf(syscall.RTF_WASCLONED), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_ADD": ValueOf(syscall.RTM_ADD), + "RTM_CHANGE": ValueOf(syscall.RTM_CHANGE), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELETE": ValueOf(syscall.RTM_DELETE), + "RTM_DELMADDR": ValueOf(syscall.RTM_DELMADDR), + "RTM_GET": ValueOf(syscall.RTM_GET), + "RTM_GET2": ValueOf(syscall.RTM_GET2), + "RTM_IFINFO": ValueOf(syscall.RTM_IFINFO), + "RTM_IFINFO2": ValueOf(syscall.RTM_IFINFO2), + "RTM_LOCK": ValueOf(syscall.RTM_LOCK), + "RTM_LOSING": ValueOf(syscall.RTM_LOSING), + "RTM_MISS": ValueOf(syscall.RTM_MISS), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWMADDR": ValueOf(syscall.RTM_NEWMADDR), + "RTM_NEWMADDR2": ValueOf(syscall.RTM_NEWMADDR2), + "RTM_OLDADD": ValueOf(syscall.RTM_OLDADD), + "RTM_OLDDEL": ValueOf(syscall.RTM_OLDDEL), + "RTM_REDIRECT": ValueOf(syscall.RTM_REDIRECT), + "RTM_RESOLVE": ValueOf(syscall.RTM_RESOLVE), + "RTM_RTTUNIT": ValueOf(syscall.RTM_RTTUNIT), + "RTM_VERSION": ValueOf(syscall.RTM_VERSION), + "RTV_EXPIRE": ValueOf(syscall.RTV_EXPIRE), + "RTV_HOPCOUNT": ValueOf(syscall.RTV_HOPCOUNT), + "RTV_MTU": ValueOf(syscall.RTV_MTU), + "RTV_RPIPE": ValueOf(syscall.RTV_RPIPE), + "RTV_RTT": ValueOf(syscall.RTV_RTT), + "RTV_RTTVAR": ValueOf(syscall.RTV_RTTVAR), + "RTV_SPIPE": ValueOf(syscall.RTV_SPIPE), + "RTV_SSTHRESH": ValueOf(syscall.RTV_SSTHRESH), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Rename": ValueOf(syscall.Rename), + "Revoke": ValueOf(syscall.Revoke), + "Rmdir": ValueOf(syscall.Rmdir), + "RouteRIB": ValueOf(syscall.RouteRIB), + "SCM_CREDS": ValueOf(syscall.SCM_CREDS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMP_MONOTONIC": ValueOf(syscall.SCM_TIMESTAMP_MONOTONIC), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGEMT": ValueOf(syscall.SIGEMT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINFO": ValueOf(syscall.SIGINFO), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDMULTI": ValueOf(uint32(syscall.SIOCADDMULTI)), + "SIOCAIFADDR": ValueOf(uint32(syscall.SIOCAIFADDR)), + "SIOCALIFADDR": ValueOf(uint32(syscall.SIOCALIFADDR)), + "SIOCARPIPLL": ValueOf(uint32(syscall.SIOCARPIPLL)), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCAUTOADDR": ValueOf(uint32(syscall.SIOCAUTOADDR)), + "SIOCAUTONETMASK": ValueOf(uint32(syscall.SIOCAUTONETMASK)), + "SIOCDELMULTI": ValueOf(uint32(syscall.SIOCDELMULTI)), + "SIOCDIFADDR": ValueOf(uint32(syscall.SIOCDIFADDR)), + "SIOCDIFPHYADDR": ValueOf(uint32(syscall.SIOCDIFPHYADDR)), + "SIOCDLIFADDR": ValueOf(uint32(syscall.SIOCDLIFADDR)), + "SIOCGDRVSPEC": ValueOf(uint32(syscall.SIOCGDRVSPEC)), + "SIOCGETSGCNT": ValueOf(uint32(syscall.SIOCGETSGCNT)), + "SIOCGETVIFCNT": ValueOf(uint32(syscall.SIOCGETVIFCNT)), + "SIOCGETVLAN": ValueOf(uint32(syscall.SIOCGETVLAN)), + "SIOCGHIWAT": ValueOf(syscall.SIOCGHIWAT), + "SIOCGIFADDR": ValueOf(uint32(syscall.SIOCGIFADDR)), + "SIOCGIFALTMTU": ValueOf(uint32(syscall.SIOCGIFALTMTU)), + "SIOCGIFASYNCMAP": ValueOf(uint32(syscall.SIOCGIFASYNCMAP)), + "SIOCGIFBOND": ValueOf(uint32(syscall.SIOCGIFBOND)), + "SIOCGIFBRDADDR": ValueOf(uint32(syscall.SIOCGIFBRDADDR)), + "SIOCGIFCAP": ValueOf(uint32(syscall.SIOCGIFCAP)), + "SIOCGIFCONF": ValueOf(uint32(syscall.SIOCGIFCONF)), + "SIOCGIFDEVMTU": ValueOf(uint32(syscall.SIOCGIFDEVMTU)), + "SIOCGIFDSTADDR": ValueOf(uint32(syscall.SIOCGIFDSTADDR)), + "SIOCGIFFLAGS": ValueOf(uint32(syscall.SIOCGIFFLAGS)), + "SIOCGIFGENERIC": ValueOf(uint32(syscall.SIOCGIFGENERIC)), + "SIOCGIFKPI": ValueOf(uint32(syscall.SIOCGIFKPI)), + "SIOCGIFMAC": ValueOf(uint32(syscall.SIOCGIFMAC)), + "SIOCGIFMEDIA": ValueOf(uint32(syscall.SIOCGIFMEDIA)), + "SIOCGIFMETRIC": ValueOf(uint32(syscall.SIOCGIFMETRIC)), + "SIOCGIFMTU": ValueOf(uint32(syscall.SIOCGIFMTU)), + "SIOCGIFNETMASK": ValueOf(uint32(syscall.SIOCGIFNETMASK)), + "SIOCGIFPDSTADDR": ValueOf(uint32(syscall.SIOCGIFPDSTADDR)), + "SIOCGIFPHYS": ValueOf(uint32(syscall.SIOCGIFPHYS)), + "SIOCGIFPSRCADDR": ValueOf(uint32(syscall.SIOCGIFPSRCADDR)), + "SIOCGIFSTATUS": ValueOf(uint32(syscall.SIOCGIFSTATUS)), + "SIOCGIFVLAN": ValueOf(uint32(syscall.SIOCGIFVLAN)), + "SIOCGIFWAKEFLAGS": ValueOf(uint32(syscall.SIOCGIFWAKEFLAGS)), + "SIOCGLIFADDR": ValueOf(uint32(syscall.SIOCGLIFADDR)), + "SIOCGLIFPHYADDR": ValueOf(uint32(syscall.SIOCGLIFPHYADDR)), + "SIOCGLOWAT": ValueOf(syscall.SIOCGLOWAT), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCIFCREATE": ValueOf(uint32(syscall.SIOCIFCREATE)), + "SIOCIFCREATE2": ValueOf(uint32(syscall.SIOCIFCREATE2)), + "SIOCIFDESTROY": ValueOf(uint32(syscall.SIOCIFDESTROY)), + "SIOCRSLVMULTI": ValueOf(uint32(syscall.SIOCRSLVMULTI)), + "SIOCSDRVSPEC": ValueOf(uint32(syscall.SIOCSDRVSPEC)), + "SIOCSETVLAN": ValueOf(uint32(syscall.SIOCSETVLAN)), + "SIOCSHIWAT": ValueOf(uint32(syscall.SIOCSHIWAT)), + "SIOCSIFADDR": ValueOf(uint32(syscall.SIOCSIFADDR)), + "SIOCSIFALTMTU": ValueOf(uint32(syscall.SIOCSIFALTMTU)), + "SIOCSIFASYNCMAP": ValueOf(uint32(syscall.SIOCSIFASYNCMAP)), + "SIOCSIFBOND": ValueOf(uint32(syscall.SIOCSIFBOND)), + "SIOCSIFBRDADDR": ValueOf(uint32(syscall.SIOCSIFBRDADDR)), + "SIOCSIFCAP": ValueOf(uint32(syscall.SIOCSIFCAP)), + "SIOCSIFDSTADDR": ValueOf(uint32(syscall.SIOCSIFDSTADDR)), + "SIOCSIFFLAGS": ValueOf(uint32(syscall.SIOCSIFFLAGS)), + "SIOCSIFGENERIC": ValueOf(uint32(syscall.SIOCSIFGENERIC)), + "SIOCSIFKPI": ValueOf(uint32(syscall.SIOCSIFKPI)), + "SIOCSIFLLADDR": ValueOf(uint32(syscall.SIOCSIFLLADDR)), + "SIOCSIFMAC": ValueOf(uint32(syscall.SIOCSIFMAC)), + "SIOCSIFMEDIA": ValueOf(uint32(syscall.SIOCSIFMEDIA)), + "SIOCSIFMETRIC": ValueOf(uint32(syscall.SIOCSIFMETRIC)), + "SIOCSIFMTU": ValueOf(uint32(syscall.SIOCSIFMTU)), + "SIOCSIFNETMASK": ValueOf(uint32(syscall.SIOCSIFNETMASK)), + "SIOCSIFPHYADDR": ValueOf(uint32(syscall.SIOCSIFPHYADDR)), + "SIOCSIFPHYS": ValueOf(uint32(syscall.SIOCSIFPHYS)), + "SIOCSIFVLAN": ValueOf(uint32(syscall.SIOCSIFVLAN)), + "SIOCSLIFPHYADDR": ValueOf(uint32(syscall.SIOCSLIFPHYADDR)), + "SIOCSLOWAT": ValueOf(uint32(syscall.SIOCSLOWAT)), + "SIOCSPGRP": ValueOf(uint32(syscall.SIOCSPGRP)), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_MAXADDRLEN": ValueOf(syscall.SOCK_MAXADDRLEN), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_DONTTRUNC": ValueOf(syscall.SO_DONTTRUNC), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LABEL": ValueOf(syscall.SO_LABEL), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_LINGER_SEC": ValueOf(syscall.SO_LINGER_SEC), + "SO_NKE": ValueOf(syscall.SO_NKE), + "SO_NOADDRERR": ValueOf(syscall.SO_NOADDRERR), + "SO_NOSIGPIPE": ValueOf(syscall.SO_NOSIGPIPE), + "SO_NOTIFYCONFLICT": ValueOf(syscall.SO_NOTIFYCONFLICT), + "SO_NP_EXTENSIONS": ValueOf(syscall.SO_NP_EXTENSIONS), + "SO_NREAD": ValueOf(syscall.SO_NREAD), + "SO_NWRITE": ValueOf(syscall.SO_NWRITE), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PEERLABEL": ValueOf(syscall.SO_PEERLABEL), + "SO_RANDOMPORT": ValueOf(syscall.SO_RANDOMPORT), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_RESTRICTIONS": ValueOf(syscall.SO_RESTRICTIONS), + "SO_RESTRICT_DENYIN": ValueOf(syscall.SO_RESTRICT_DENYIN), + "SO_RESTRICT_DENYOUT": ValueOf(syscall.SO_RESTRICT_DENYOUT), + "SO_RESTRICT_DENYSET": ValueOf(uint32(syscall.SO_RESTRICT_DENYSET)), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_REUSEPORT": ValueOf(syscall.SO_REUSEPORT), + "SO_REUSESHAREUID": ValueOf(syscall.SO_REUSESHAREUID), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMP_MONOTONIC": ValueOf(syscall.SO_TIMESTAMP_MONOTONIC), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SO_UPCALLCLOSEWAIT": ValueOf(syscall.SO_UPCALLCLOSEWAIT), + "SO_USELOOPBACK": ValueOf(syscall.SO_USELOOPBACK), + "SO_WANTMORE": ValueOf(syscall.SO_WANTMORE), + "SO_WANTOOBFLAG": ValueOf(syscall.SO_WANTOOBFLAG), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT_NOCANCEL": ValueOf(syscall.SYS_ACCEPT_NOCANCEL), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCESS_EXTENDED": ValueOf(syscall.SYS_ACCESS_EXTENDED), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_PROFIL": ValueOf(syscall.SYS_ADD_PROFIL), + "SYS_ADJTIME": ValueOf(syscall.SYS_ADJTIME), + "SYS_AIO_CANCEL": ValueOf(syscall.SYS_AIO_CANCEL), + "SYS_AIO_ERROR": ValueOf(syscall.SYS_AIO_ERROR), + "SYS_AIO_FSYNC": ValueOf(syscall.SYS_AIO_FSYNC), + "SYS_AIO_READ": ValueOf(syscall.SYS_AIO_READ), + "SYS_AIO_RETURN": ValueOf(syscall.SYS_AIO_RETURN), + "SYS_AIO_SUSPEND": ValueOf(syscall.SYS_AIO_SUSPEND), + "SYS_AIO_SUSPEND_NOCANCEL": ValueOf(syscall.SYS_AIO_SUSPEND_NOCANCEL), + "SYS_AIO_WRITE": ValueOf(syscall.SYS_AIO_WRITE), + "SYS_ATGETMSG": ValueOf(syscall.SYS_ATGETMSG), + "SYS_ATPGETREQ": ValueOf(syscall.SYS_ATPGETREQ), + "SYS_ATPGETRSP": ValueOf(syscall.SYS_ATPGETRSP), + "SYS_ATPSNDREQ": ValueOf(syscall.SYS_ATPSNDREQ), + "SYS_ATPSNDRSP": ValueOf(syscall.SYS_ATPSNDRSP), + "SYS_ATPUTMSG": ValueOf(syscall.SYS_ATPUTMSG), + "SYS_ATSOCKET": ValueOf(syscall.SYS_ATSOCKET), + "SYS_AUDIT": ValueOf(syscall.SYS_AUDIT), + "SYS_AUDITCTL": ValueOf(syscall.SYS_AUDITCTL), + "SYS_AUDITON": ValueOf(syscall.SYS_AUDITON), + "SYS_AUDIT_SESSION_JOIN": ValueOf(syscall.SYS_AUDIT_SESSION_JOIN), + "SYS_AUDIT_SESSION_PORT": ValueOf(syscall.SYS_AUDIT_SESSION_PORT), + "SYS_AUDIT_SESSION_SELF": ValueOf(syscall.SYS_AUDIT_SESSION_SELF), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BSDTHREAD_CREATE": ValueOf(syscall.SYS_BSDTHREAD_CREATE), + "SYS_BSDTHREAD_REGISTER": ValueOf(syscall.SYS_BSDTHREAD_REGISTER), + "SYS_BSDTHREAD_TERMINATE": ValueOf(syscall.SYS_BSDTHREAD_TERMINATE), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHFLAGS": ValueOf(syscall.SYS_CHFLAGS), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHMOD_EXTENDED": ValueOf(syscall.SYS_CHMOD_EXTENDED), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CHUD": ValueOf(syscall.SYS_CHUD), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CLOSE_NOCANCEL": ValueOf(syscall.SYS_CLOSE_NOCANCEL), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CONNECT_NOCANCEL": ValueOf(syscall.SYS_CONNECT_NOCANCEL), + "SYS_COPYFILE": ValueOf(syscall.SYS_COPYFILE), + "SYS_CSOPS": ValueOf(syscall.SYS_CSOPS), + "SYS_DELETE": ValueOf(syscall.SYS_DELETE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_EXCHANGEDATA": ValueOf(syscall.SYS_EXCHANGEDATA), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHFLAGS": ValueOf(syscall.SYS_FCHFLAGS), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMOD_EXTENDED": ValueOf(syscall.SYS_FCHMOD_EXTENDED), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FCNTL_NOCANCEL": ValueOf(syscall.SYS_FCNTL_NOCANCEL), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FFSCTL": ValueOf(syscall.SYS_FFSCTL), + "SYS_FGETATTRLIST": ValueOf(syscall.SYS_FGETATTRLIST), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FHOPEN": ValueOf(syscall.SYS_FHOPEN), + "SYS_FILEPORT_MAKEFD": ValueOf(syscall.SYS_FILEPORT_MAKEFD), + "SYS_FILEPORT_MAKEPORT": ValueOf(syscall.SYS_FILEPORT_MAKEPORT), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FPATHCONF": ValueOf(syscall.SYS_FPATHCONF), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSCTL": ValueOf(syscall.SYS_FSCTL), + "SYS_FSETATTRLIST": ValueOf(syscall.SYS_FSETATTRLIST), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSGETPATH": ValueOf(syscall.SYS_FSGETPATH), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTAT64": ValueOf(syscall.SYS_FSTAT64), + "SYS_FSTAT64_EXTENDED": ValueOf(syscall.SYS_FSTAT64_EXTENDED), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSTATFS64": ValueOf(syscall.SYS_FSTATFS64), + "SYS_FSTATV": ValueOf(syscall.SYS_FSTATV), + "SYS_FSTAT_EXTENDED": ValueOf(syscall.SYS_FSTAT_EXTENDED), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FSYNC_NOCANCEL": ValueOf(syscall.SYS_FSYNC_NOCANCEL), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTIMES": ValueOf(syscall.SYS_FUTIMES), + "SYS_GETATTRLIST": ValueOf(syscall.SYS_GETATTRLIST), + "SYS_GETAUDIT": ValueOf(syscall.SYS_GETAUDIT), + "SYS_GETAUDIT_ADDR": ValueOf(syscall.SYS_GETAUDIT_ADDR), + "SYS_GETAUID": ValueOf(syscall.SYS_GETAUID), + "SYS_GETDIRENTRIES": ValueOf(syscall.SYS_GETDIRENTRIES), + "SYS_GETDIRENTRIES64": ValueOf(syscall.SYS_GETDIRENTRIES64), + "SYS_GETDIRENTRIESATTR": ValueOf(syscall.SYS_GETDIRENTRIESATTR), + "SYS_GETDTABLESIZE": ValueOf(syscall.SYS_GETDTABLESIZE), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETFH": ValueOf(syscall.SYS_GETFH), + "SYS_GETFSSTAT": ValueOf(syscall.SYS_GETFSSTAT), + "SYS_GETFSSTAT64": ValueOf(syscall.SYS_GETFSSTAT64), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETHOSTUUID": ValueOf(syscall.SYS_GETHOSTUUID), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETLCID": ValueOf(syscall.SYS_GETLCID), + "SYS_GETLOGIN": ValueOf(syscall.SYS_GETLOGIN), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSGROUPS": ValueOf(syscall.SYS_GETSGROUPS), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETWGROUPS": ValueOf(syscall.SYS_GETWGROUPS), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_IDENTITYSVC": ValueOf(syscall.SYS_IDENTITYSVC), + "SYS_INITGROUPS": ValueOf(syscall.SYS_INITGROUPS), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPOLICYSYS": ValueOf(syscall.SYS_IOPOLICYSYS), + "SYS_ISSETUGID": ValueOf(syscall.SYS_ISSETUGID), + "SYS_KDEBUG_TRACE": ValueOf(syscall.SYS_KDEBUG_TRACE), + "SYS_KEVENT": ValueOf(syscall.SYS_KEVENT), + "SYS_KEVENT64": ValueOf(syscall.SYS_KEVENT64), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_KQUEUE": ValueOf(syscall.SYS_KQUEUE), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LIO_LISTIO": ValueOf(syscall.SYS_LIO_LISTIO), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LSTAT64": ValueOf(syscall.SYS_LSTAT64), + "SYS_LSTAT64_EXTENDED": ValueOf(syscall.SYS_LSTAT64_EXTENDED), + "SYS_LSTATV": ValueOf(syscall.SYS_LSTATV), + "SYS_LSTAT_EXTENDED": ValueOf(syscall.SYS_LSTAT_EXTENDED), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MAXSYSCALL": ValueOf(syscall.SYS_MAXSYSCALL), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MINHERIT": ValueOf(syscall.SYS_MINHERIT), + "SYS_MKCOMPLEX": ValueOf(syscall.SYS_MKCOMPLEX), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIR_EXTENDED": ValueOf(syscall.SYS_MKDIR_EXTENDED), + "SYS_MKFIFO": ValueOf(syscall.SYS_MKFIFO), + "SYS_MKFIFO_EXTENDED": ValueOf(syscall.SYS_MKFIFO_EXTENDED), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MODWATCH": ValueOf(syscall.SYS_MODWATCH), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MSGCTL": ValueOf(syscall.SYS_MSGCTL), + "SYS_MSGGET": ValueOf(syscall.SYS_MSGGET), + "SYS_MSGRCV": ValueOf(syscall.SYS_MSGRCV), + "SYS_MSGRCV_NOCANCEL": ValueOf(syscall.SYS_MSGRCV_NOCANCEL), + "SYS_MSGSND": ValueOf(syscall.SYS_MSGSND), + "SYS_MSGSND_NOCANCEL": ValueOf(syscall.SYS_MSGSND_NOCANCEL), + "SYS_MSGSYS": ValueOf(syscall.SYS_MSGSYS), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MSYNC_NOCANCEL": ValueOf(syscall.SYS_MSYNC_NOCANCEL), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NFSCLNT": ValueOf(syscall.SYS_NFSCLNT), + "SYS_NFSSVC": ValueOf(syscall.SYS_NFSSVC), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPEN_EXTENDED": ValueOf(syscall.SYS_OPEN_EXTENDED), + "SYS_OPEN_NOCANCEL": ValueOf(syscall.SYS_OPEN_NOCANCEL), + "SYS_PATHCONF": ValueOf(syscall.SYS_PATHCONF), + "SYS_PID_HIBERNATE": ValueOf(syscall.SYS_PID_HIBERNATE), + "SYS_PID_RESUME": ValueOf(syscall.SYS_PID_RESUME), + "SYS_PID_SHUTDOWN_SOCKETS": ValueOf(syscall.SYS_PID_SHUTDOWN_SOCKETS), + "SYS_PID_SUSPEND": ValueOf(syscall.SYS_PID_SUSPEND), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_POLL_NOCANCEL": ValueOf(syscall.SYS_POLL_NOCANCEL), + "SYS_POSIX_SPAWN": ValueOf(syscall.SYS_POSIX_SPAWN), + "SYS_PREAD": ValueOf(syscall.SYS_PREAD), + "SYS_PREAD_NOCANCEL": ValueOf(syscall.SYS_PREAD_NOCANCEL), + "SYS_PROCESS_POLICY": ValueOf(syscall.SYS_PROCESS_POLICY), + "SYS_PROC_INFO": ValueOf(syscall.SYS_PROC_INFO), + "SYS_PROFIL": ValueOf(syscall.SYS_PROFIL), + "SYS_PSYNCH_CVBROAD": ValueOf(syscall.SYS_PSYNCH_CVBROAD), + "SYS_PSYNCH_CVCLRPREPOST": ValueOf(syscall.SYS_PSYNCH_CVCLRPREPOST), + "SYS_PSYNCH_CVSIGNAL": ValueOf(syscall.SYS_PSYNCH_CVSIGNAL), + "SYS_PSYNCH_CVWAIT": ValueOf(syscall.SYS_PSYNCH_CVWAIT), + "SYS_PSYNCH_MUTEXDROP": ValueOf(syscall.SYS_PSYNCH_MUTEXDROP), + "SYS_PSYNCH_MUTEXWAIT": ValueOf(syscall.SYS_PSYNCH_MUTEXWAIT), + "SYS_PSYNCH_RW_DOWNGRADE": ValueOf(syscall.SYS_PSYNCH_RW_DOWNGRADE), + "SYS_PSYNCH_RW_LONGRDLOCK": ValueOf(syscall.SYS_PSYNCH_RW_LONGRDLOCK), + "SYS_PSYNCH_RW_RDLOCK": ValueOf(syscall.SYS_PSYNCH_RW_RDLOCK), + "SYS_PSYNCH_RW_UNLOCK": ValueOf(syscall.SYS_PSYNCH_RW_UNLOCK), + "SYS_PSYNCH_RW_UNLOCK2": ValueOf(syscall.SYS_PSYNCH_RW_UNLOCK2), + "SYS_PSYNCH_RW_UPGRADE": ValueOf(syscall.SYS_PSYNCH_RW_UPGRADE), + "SYS_PSYNCH_RW_WRLOCK": ValueOf(syscall.SYS_PSYNCH_RW_WRLOCK), + "SYS_PSYNCH_RW_YIELDWRLOCK": ValueOf(syscall.SYS_PSYNCH_RW_YIELDWRLOCK), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE": ValueOf(syscall.SYS_PWRITE), + "SYS_PWRITE_NOCANCEL": ValueOf(syscall.SYS_PWRITE_NOCANCEL), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_READV_NOCANCEL": ValueOf(syscall.SYS_READV_NOCANCEL), + "SYS_READ_NOCANCEL": ValueOf(syscall.SYS_READ_NOCANCEL), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVFROM_NOCANCEL": ValueOf(syscall.SYS_RECVFROM_NOCANCEL), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_RECVMSG_NOCANCEL": ValueOf(syscall.SYS_RECVMSG_NOCANCEL), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_REVOKE": ValueOf(syscall.SYS_REVOKE), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_SEARCHFS": ValueOf(syscall.SYS_SEARCHFS), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SELECT_NOCANCEL": ValueOf(syscall.SYS_SELECT_NOCANCEL), + "SYS_SEMCTL": ValueOf(syscall.SYS_SEMCTL), + "SYS_SEMGET": ValueOf(syscall.SYS_SEMGET), + "SYS_SEMOP": ValueOf(syscall.SYS_SEMOP), + "SYS_SEMSYS": ValueOf(syscall.SYS_SEMSYS), + "SYS_SEM_CLOSE": ValueOf(syscall.SYS_SEM_CLOSE), + "SYS_SEM_DESTROY": ValueOf(syscall.SYS_SEM_DESTROY), + "SYS_SEM_GETVALUE": ValueOf(syscall.SYS_SEM_GETVALUE), + "SYS_SEM_INIT": ValueOf(syscall.SYS_SEM_INIT), + "SYS_SEM_OPEN": ValueOf(syscall.SYS_SEM_OPEN), + "SYS_SEM_POST": ValueOf(syscall.SYS_SEM_POST), + "SYS_SEM_TRYWAIT": ValueOf(syscall.SYS_SEM_TRYWAIT), + "SYS_SEM_UNLINK": ValueOf(syscall.SYS_SEM_UNLINK), + "SYS_SEM_WAIT": ValueOf(syscall.SYS_SEM_WAIT), + "SYS_SEM_WAIT_NOCANCEL": ValueOf(syscall.SYS_SEM_WAIT_NOCANCEL), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDMSG_NOCANCEL": ValueOf(syscall.SYS_SENDMSG_NOCANCEL), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SENDTO_NOCANCEL": ValueOf(syscall.SYS_SENDTO_NOCANCEL), + "SYS_SETATTRLIST": ValueOf(syscall.SYS_SETATTRLIST), + "SYS_SETAUDIT": ValueOf(syscall.SYS_SETAUDIT), + "SYS_SETAUDIT_ADDR": ValueOf(syscall.SYS_SETAUDIT_ADDR), + "SYS_SETAUID": ValueOf(syscall.SYS_SETAUID), + "SYS_SETEGID": ValueOf(syscall.SYS_SETEGID), + "SYS_SETEUID": ValueOf(syscall.SYS_SETEUID), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETLCID": ValueOf(syscall.SYS_SETLCID), + "SYS_SETLOGIN": ValueOf(syscall.SYS_SETLOGIN), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETPRIVEXEC": ValueOf(syscall.SYS_SETPRIVEXEC), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSGROUPS": ValueOf(syscall.SYS_SETSGROUPS), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTID": ValueOf(syscall.SYS_SETTID), + "SYS_SETTID_WITH_PID": ValueOf(syscall.SYS_SETTID_WITH_PID), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETWGROUPS": ValueOf(syscall.SYS_SETWGROUPS), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SHARED_REGION_CHECK_NP": ValueOf(syscall.SYS_SHARED_REGION_CHECK_NP), + "SYS_SHARED_REGION_MAP_AND_SLIDE_NP": ValueOf(syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP), + "SYS_SHMAT": ValueOf(syscall.SYS_SHMAT), + "SYS_SHMCTL": ValueOf(syscall.SYS_SHMCTL), + "SYS_SHMDT": ValueOf(syscall.SYS_SHMDT), + "SYS_SHMGET": ValueOf(syscall.SYS_SHMGET), + "SYS_SHMSYS": ValueOf(syscall.SYS_SHMSYS), + "SYS_SHM_OPEN": ValueOf(syscall.SYS_SHM_OPEN), + "SYS_SHM_UNLINK": ValueOf(syscall.SYS_SHM_UNLINK), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SIGSUSPEND_NOCANCEL": ValueOf(syscall.SYS_SIGSUSPEND_NOCANCEL), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_STACK_SNAPSHOT": ValueOf(syscall.SYS_STACK_SNAPSHOT), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STAT64": ValueOf(syscall.SYS_STAT64), + "SYS_STAT64_EXTENDED": ValueOf(syscall.SYS_STAT64_EXTENDED), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_STATFS64": ValueOf(syscall.SYS_STATFS64), + "SYS_STATV": ValueOf(syscall.SYS_STATV), + "SYS_STAT_EXTENDED": ValueOf(syscall.SYS_STAT_EXTENDED), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYSCALL": ValueOf(syscall.SYS_SYSCALL), + "SYS_THREAD_SELFID": ValueOf(syscall.SYS_THREAD_SELFID), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMASK_EXTENDED": ValueOf(syscall.SYS_UMASK_EXTENDED), + "SYS_UNDELETE": ValueOf(syscall.SYS_UNDELETE), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNMOUNT": ValueOf(syscall.SYS_UNMOUNT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_VM_PRESSURE_MONITOR": ValueOf(syscall.SYS_VM_PRESSURE_MONITOR), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAIT4_NOCANCEL": ValueOf(syscall.SYS_WAIT4_NOCANCEL), + "SYS_WAITEVENT": ValueOf(syscall.SYS_WAITEVENT), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WAITID_NOCANCEL": ValueOf(syscall.SYS_WAITID_NOCANCEL), + "SYS_WATCHEVENT": ValueOf(syscall.SYS_WATCHEVENT), + "SYS_WORKQ_KERNRETURN": ValueOf(syscall.SYS_WORKQ_KERNRETURN), + "SYS_WORKQ_OPEN": ValueOf(syscall.SYS_WORKQ_OPEN), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS_WRITEV_NOCANCEL": ValueOf(syscall.SYS_WRITEV_NOCANCEL), + "SYS_WRITE_NOCANCEL": ValueOf(syscall.SYS_WRITE_NOCANCEL), + "SYS___DISABLE_THREADSIGNAL": ValueOf(syscall.SYS___DISABLE_THREADSIGNAL), + "SYS___MAC_EXECVE": ValueOf(syscall.SYS___MAC_EXECVE), + "SYS___MAC_GETFSSTAT": ValueOf(syscall.SYS___MAC_GETFSSTAT), + "SYS___MAC_GET_FD": ValueOf(syscall.SYS___MAC_GET_FD), + "SYS___MAC_GET_FILE": ValueOf(syscall.SYS___MAC_GET_FILE), + "SYS___MAC_GET_LCID": ValueOf(syscall.SYS___MAC_GET_LCID), + "SYS___MAC_GET_LCTX": ValueOf(syscall.SYS___MAC_GET_LCTX), + "SYS___MAC_GET_LINK": ValueOf(syscall.SYS___MAC_GET_LINK), + "SYS___MAC_GET_MOUNT": ValueOf(syscall.SYS___MAC_GET_MOUNT), + "SYS___MAC_GET_PID": ValueOf(syscall.SYS___MAC_GET_PID), + "SYS___MAC_GET_PROC": ValueOf(syscall.SYS___MAC_GET_PROC), + "SYS___MAC_MOUNT": ValueOf(syscall.SYS___MAC_MOUNT), + "SYS___MAC_SET_FD": ValueOf(syscall.SYS___MAC_SET_FD), + "SYS___MAC_SET_FILE": ValueOf(syscall.SYS___MAC_SET_FILE), + "SYS___MAC_SET_LCTX": ValueOf(syscall.SYS___MAC_SET_LCTX), + "SYS___MAC_SET_LINK": ValueOf(syscall.SYS___MAC_SET_LINK), + "SYS___MAC_SET_PROC": ValueOf(syscall.SYS___MAC_SET_PROC), + "SYS___MAC_SYSCALL": ValueOf(syscall.SYS___MAC_SYSCALL), + "SYS___OLD_SEMWAIT_SIGNAL": ValueOf(syscall.SYS___OLD_SEMWAIT_SIGNAL), + "SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": ValueOf(syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL), + "SYS___PTHREAD_CANCELED": ValueOf(syscall.SYS___PTHREAD_CANCELED), + "SYS___PTHREAD_CHDIR": ValueOf(syscall.SYS___PTHREAD_CHDIR), + "SYS___PTHREAD_FCHDIR": ValueOf(syscall.SYS___PTHREAD_FCHDIR), + "SYS___PTHREAD_KILL": ValueOf(syscall.SYS___PTHREAD_KILL), + "SYS___PTHREAD_MARKCANCEL": ValueOf(syscall.SYS___PTHREAD_MARKCANCEL), + "SYS___PTHREAD_SIGMASK": ValueOf(syscall.SYS___PTHREAD_SIGMASK), + "SYS___SEMWAIT_SIGNAL": ValueOf(syscall.SYS___SEMWAIT_SIGNAL), + "SYS___SEMWAIT_SIGNAL_NOCANCEL": ValueOf(syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL), + "SYS___SIGWAIT": ValueOf(syscall.SYS___SIGWAIT), + "SYS___SIGWAIT_NOCANCEL": ValueOf(syscall.SYS___SIGWAIT_NOCANCEL), + "SYS___SYSCTL": ValueOf(syscall.SYS___SYSCTL), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IFWHT": ValueOf(syscall.S_IFWHT), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISTXT": ValueOf(syscall.S_ISTXT), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetBpf": ValueOf(syscall.SetBpf), + "SetBpfBuflen": ValueOf(syscall.SetBpfBuflen), + "SetBpfDatalink": ValueOf(syscall.SetBpfDatalink), + "SetBpfHeadercmpl": ValueOf(syscall.SetBpfHeadercmpl), + "SetBpfImmediate": ValueOf(syscall.SetBpfImmediate), + "SetBpfInterface": ValueOf(syscall.SetBpfInterface), + "SetBpfPromisc": ValueOf(syscall.SetBpfPromisc), + "SetBpfTimeout": ValueOf(syscall.SetBpfTimeout), + "SetKevent": ValueOf(syscall.SetKevent), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setegid": ValueOf(syscall.Setegid), + "Setenv": ValueOf(syscall.Setenv), + "Seteuid": ValueOf(syscall.Seteuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Setlogin": ValueOf(syscall.Setlogin), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setprivexec": ValueOf(syscall.Setprivexec), + "Setregid": ValueOf(syscall.Setregid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofBpfHdr": ValueOf(syscall.SizeofBpfHdr), + "SizeofBpfInsn": ValueOf(syscall.SizeofBpfInsn), + "SizeofBpfProgram": ValueOf(syscall.SizeofBpfProgram), + "SizeofBpfStat": ValueOf(syscall.SizeofBpfStat), + "SizeofBpfVersion": ValueOf(syscall.SizeofBpfVersion), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfData": ValueOf(syscall.SizeofIfData), + "SizeofIfMsghdr": ValueOf(syscall.SizeofIfMsghdr), + "SizeofIfaMsghdr": ValueOf(syscall.SizeofIfaMsghdr), + "SizeofIfmaMsghdr": ValueOf(syscall.SizeofIfmaMsghdr), + "SizeofIfmaMsghdr2": ValueOf(syscall.SizeofIfmaMsghdr2), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofRtMetrics": ValueOf(syscall.SizeofRtMetrics), + "SizeofRtMsghdr": ValueOf(syscall.SizeofRtMsghdr), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrDatalink": ValueOf(syscall.SizeofSockaddrDatalink), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Syscall9": ValueOf(syscall.Syscall9), + "Sysctl": ValueOf(syscall.Sysctl), + "SysctlUint32": ValueOf(syscall.SysctlUint32), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONNECTIONTIMEOUT": ValueOf(syscall.TCP_CONNECTIONTIMEOUT), + "TCP_KEEPALIVE": ValueOf(syscall.TCP_KEEPALIVE), + "TCP_MAXHLEN": ValueOf(syscall.TCP_MAXHLEN), + "TCP_MAXOLEN": ValueOf(syscall.TCP_MAXOLEN), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_SACK": ValueOf(syscall.TCP_MAX_SACK), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MINMSS": ValueOf(syscall.TCP_MINMSS), + "TCP_MINMSSOVERLOAD": ValueOf(syscall.TCP_MINMSSOVERLOAD), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_NOOPT": ValueOf(syscall.TCP_NOOPT), + "TCP_NOPUSH": ValueOf(syscall.TCP_NOPUSH), + "TCP_RXT_CONNDROPTIME": ValueOf(syscall.TCP_RXT_CONNDROPTIME), + "TCP_RXT_FINDROP": ValueOf(syscall.TCP_RXT_FINDROP), + "TCSAFLUSH": ValueOf(syscall.TCSAFLUSH), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCDTR": ValueOf(syscall.TIOCCDTR), + "TIOCCONS": ValueOf(uint32(syscall.TIOCCONS)), + "TIOCDCDTIMESTAMP": ValueOf(syscall.TIOCDCDTIMESTAMP), + "TIOCDRAIN": ValueOf(syscall.TIOCDRAIN), + "TIOCDSIMICROCODE": ValueOf(syscall.TIOCDSIMICROCODE), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCEXT": ValueOf(uint32(syscall.TIOCEXT)), + "TIOCFLUSH": ValueOf(uint32(syscall.TIOCFLUSH)), + "TIOCGDRAINWAIT": ValueOf(syscall.TIOCGDRAINWAIT), + "TIOCGETA": ValueOf(syscall.TIOCGETA), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCIXOFF": ValueOf(syscall.TIOCIXOFF), + "TIOCIXON": ValueOf(syscall.TIOCIXON), + "TIOCMBIC": ValueOf(uint32(syscall.TIOCMBIC)), + "TIOCMBIS": ValueOf(uint32(syscall.TIOCMBIS)), + "TIOCMGDTRWAIT": ValueOf(syscall.TIOCMGDTRWAIT), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMODG": ValueOf(syscall.TIOCMODG), + "TIOCMODS": ValueOf(uint32(syscall.TIOCMODS)), + "TIOCMSDTRWAIT": ValueOf(uint32(syscall.TIOCMSDTRWAIT)), + "TIOCMSET": ValueOf(uint32(syscall.TIOCMSET)), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(uint32(syscall.TIOCPKT)), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCPTYGNAME": ValueOf(syscall.TIOCPTYGNAME), + "TIOCPTYGRANT": ValueOf(syscall.TIOCPTYGRANT), + "TIOCPTYUNLK": ValueOf(syscall.TIOCPTYUNLK), + "TIOCREMOTE": ValueOf(uint32(syscall.TIOCREMOTE)), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCONS": ValueOf(syscall.TIOCSCONS), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSDRAINWAIT": ValueOf(uint32(syscall.TIOCSDRAINWAIT)), + "TIOCSDTR": ValueOf(syscall.TIOCSDTR), + "TIOCSETA": ValueOf(uint32(syscall.TIOCSETA)), + "TIOCSETAF": ValueOf(uint32(syscall.TIOCSETAF)), + "TIOCSETAW": ValueOf(uint32(syscall.TIOCSETAW)), + "TIOCSETD": ValueOf(uint32(syscall.TIOCSETD)), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSPGRP": ValueOf(uint32(syscall.TIOCSPGRP)), + "TIOCSTART": ValueOf(syscall.TIOCSTART), + "TIOCSTAT": ValueOf(syscall.TIOCSTAT), + "TIOCSTI": ValueOf(uint32(syscall.TIOCSTI)), + "TIOCSTOP": ValueOf(syscall.TIOCSTOP), + "TIOCSWINSZ": ValueOf(uint32(syscall.TIOCSWINSZ)), + "TIOCTIMESTAMP": ValueOf(syscall.TIOCTIMESTAMP), + "TIOCUCNTL": ValueOf(uint32(syscall.TIOCUCNTL)), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Undelete": ValueOf(syscall.Undelete), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VDSUSP": ValueOf(syscall.VDSUSP), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTATUS": ValueOf(syscall.VSTATUS), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VT0": ValueOf(syscall.VT0), + "VT1": ValueOf(syscall.VT1), + "VTDLY": ValueOf(syscall.VTDLY), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WCOREFLAG": ValueOf(syscall.WCOREFLAG), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + }, + Types: map[string]Type{ + "BpfHdr": TypeOf((*syscall.BpfHdr)(nil)).Elem(), + "BpfInsn": TypeOf((*syscall.BpfInsn)(nil)).Elem(), + "BpfProgram": TypeOf((*syscall.BpfProgram)(nil)).Elem(), + "BpfStat": TypeOf((*syscall.BpfStat)(nil)).Elem(), + "BpfVersion": TypeOf((*syscall.BpfVersion)(nil)).Elem(), + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "Fbootstraptransfer_t": TypeOf((*syscall.Fbootstraptransfer_t)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "Fstore_t": TypeOf((*syscall.Fstore_t)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfData": TypeOf((*syscall.IfData)(nil)).Elem(), + "IfMsghdr": TypeOf((*syscall.IfMsghdr)(nil)).Elem(), + "IfaMsghdr": TypeOf((*syscall.IfaMsghdr)(nil)).Elem(), + "IfmaMsghdr": TypeOf((*syscall.IfmaMsghdr)(nil)).Elem(), + "IfmaMsghdr2": TypeOf((*syscall.IfmaMsghdr2)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InterfaceAddrMessage": TypeOf((*syscall.InterfaceAddrMessage)(nil)).Elem(), + "InterfaceMessage": TypeOf((*syscall.InterfaceMessage)(nil)).Elem(), + "InterfaceMulticastAddrMessage": TypeOf((*syscall.InterfaceMulticastAddrMessage)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Kevent_t": TypeOf((*syscall.Kevent_t)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Log2phys_t": TypeOf((*syscall.Log2phys_t)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "Radvisory_t": TypeOf((*syscall.Radvisory_t)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrDatalink": TypeOf((*syscall.RawSockaddrDatalink)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RouteMessage": TypeOf((*syscall.RouteMessage)(nil)).Elem(), + "RoutingMessage": TypeOf((*syscall.RoutingMessage)(nil)).Elem(), + "RtMetrics": TypeOf((*syscall.RtMetrics)(nil)).Elem(), + "RtMsghdr": TypeOf((*syscall.RtMsghdr)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrDatalink": TypeOf((*syscall.SockaddrDatalink)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timeval32": TypeOf((*syscall.Timeval32)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + }, + Proxies: map[string]Type{ + } } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_386.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_386.go new file mode 100644 index 0000000..275f315 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_386.go @@ -0,0 +1,4027 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +// reflection: allow interpreted code to import "syscall" +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ARP": ValueOf(syscall.AF_ARP), + "AF_ATM": ValueOf(syscall.AF_ATM), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_CCITT": ValueOf(syscall.AF_CCITT), + "AF_CHAOS": ValueOf(syscall.AF_CHAOS), + "AF_CNT": ValueOf(syscall.AF_CNT), + "AF_COIP": ValueOf(syscall.AF_COIP), + "AF_DATAKIT": ValueOf(syscall.AF_DATAKIT), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_DLI": ValueOf(syscall.AF_DLI), + "AF_E164": ValueOf(syscall.AF_E164), + "AF_ECMA": ValueOf(syscall.AF_ECMA), + "AF_HYLINK": ValueOf(syscall.AF_HYLINK), + "AF_IEEE80211": ValueOf(syscall.AF_IEEE80211), + "AF_IMPLINK": ValueOf(syscall.AF_IMPLINK), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_INET6_SDP": ValueOf(syscall.AF_INET6_SDP), + "AF_INET_SDP": ValueOf(syscall.AF_INET_SDP), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_ISO": ValueOf(syscall.AF_ISO), + "AF_LAT": ValueOf(syscall.AF_LAT), + "AF_LINK": ValueOf(syscall.AF_LINK), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NATM": ValueOf(syscall.AF_NATM), + "AF_NETBIOS": ValueOf(syscall.AF_NETBIOS), + "AF_NETGRAPH": ValueOf(syscall.AF_NETGRAPH), + "AF_OSI": ValueOf(syscall.AF_OSI), + "AF_PUP": ValueOf(syscall.AF_PUP), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_SCLUSTER": ValueOf(syscall.AF_SCLUSTER), + "AF_SIP": ValueOf(syscall.AF_SIP), + "AF_SLOW": ValueOf(syscall.AF_SLOW), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_VENDOR00": ValueOf(syscall.AF_VENDOR00), + "AF_VENDOR01": ValueOf(syscall.AF_VENDOR01), + "AF_VENDOR02": ValueOf(syscall.AF_VENDOR02), + "AF_VENDOR03": ValueOf(syscall.AF_VENDOR03), + "AF_VENDOR04": ValueOf(syscall.AF_VENDOR04), + "AF_VENDOR05": ValueOf(syscall.AF_VENDOR05), + "AF_VENDOR06": ValueOf(syscall.AF_VENDOR06), + "AF_VENDOR07": ValueOf(syscall.AF_VENDOR07), + "AF_VENDOR08": ValueOf(syscall.AF_VENDOR08), + "AF_VENDOR09": ValueOf(syscall.AF_VENDOR09), + "AF_VENDOR10": ValueOf(syscall.AF_VENDOR10), + "AF_VENDOR11": ValueOf(syscall.AF_VENDOR11), + "AF_VENDOR12": ValueOf(syscall.AF_VENDOR12), + "AF_VENDOR13": ValueOf(syscall.AF_VENDOR13), + "AF_VENDOR14": ValueOf(syscall.AF_VENDOR14), + "AF_VENDOR15": ValueOf(syscall.AF_VENDOR15), + "AF_VENDOR16": ValueOf(syscall.AF_VENDOR16), + "AF_VENDOR17": ValueOf(syscall.AF_VENDOR17), + "AF_VENDOR18": ValueOf(syscall.AF_VENDOR18), + "AF_VENDOR19": ValueOf(syscall.AF_VENDOR19), + "AF_VENDOR20": ValueOf(syscall.AF_VENDOR20), + "AF_VENDOR21": ValueOf(syscall.AF_VENDOR21), + "AF_VENDOR22": ValueOf(syscall.AF_VENDOR22), + "AF_VENDOR23": ValueOf(syscall.AF_VENDOR23), + "AF_VENDOR24": ValueOf(syscall.AF_VENDOR24), + "AF_VENDOR25": ValueOf(syscall.AF_VENDOR25), + "AF_VENDOR26": ValueOf(syscall.AF_VENDOR26), + "AF_VENDOR27": ValueOf(syscall.AF_VENDOR27), + "AF_VENDOR28": ValueOf(syscall.AF_VENDOR28), + "AF_VENDOR29": ValueOf(syscall.AF_VENDOR29), + "AF_VENDOR30": ValueOf(syscall.AF_VENDOR30), + "AF_VENDOR31": ValueOf(syscall.AF_VENDOR31), + "AF_VENDOR32": ValueOf(syscall.AF_VENDOR32), + "AF_VENDOR33": ValueOf(syscall.AF_VENDOR33), + "AF_VENDOR34": ValueOf(syscall.AF_VENDOR34), + "AF_VENDOR35": ValueOf(syscall.AF_VENDOR35), + "AF_VENDOR36": ValueOf(syscall.AF_VENDOR36), + "AF_VENDOR37": ValueOf(syscall.AF_VENDOR37), + "AF_VENDOR38": ValueOf(syscall.AF_VENDOR38), + "AF_VENDOR39": ValueOf(syscall.AF_VENDOR39), + "AF_VENDOR40": ValueOf(syscall.AF_VENDOR40), + "AF_VENDOR41": ValueOf(syscall.AF_VENDOR41), + "AF_VENDOR42": ValueOf(syscall.AF_VENDOR42), + "AF_VENDOR43": ValueOf(syscall.AF_VENDOR43), + "AF_VENDOR44": ValueOf(syscall.AF_VENDOR44), + "AF_VENDOR45": ValueOf(syscall.AF_VENDOR45), + "AF_VENDOR46": ValueOf(syscall.AF_VENDOR46), + "AF_VENDOR47": ValueOf(syscall.AF_VENDOR47), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Adjtime": ValueOf(syscall.Adjtime), + "B0": ValueOf(syscall.B0), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B14400": ValueOf(syscall.B14400), + "B150": ValueOf(syscall.B150), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B28800": ValueOf(syscall.B28800), + "B300": ValueOf(syscall.B300), + "B38400": ValueOf(syscall.B38400), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B57600": ValueOf(syscall.B57600), + "B600": ValueOf(syscall.B600), + "B7200": ValueOf(syscall.B7200), + "B75": ValueOf(syscall.B75), + "B76800": ValueOf(syscall.B76800), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BIOCFEEDBACK": ValueOf(uint32(syscall.BIOCFEEDBACK)), + "BIOCFLUSH": ValueOf(syscall.BIOCFLUSH), + "BIOCGBLEN": ValueOf(syscall.BIOCGBLEN), + "BIOCGDIRECTION": ValueOf(syscall.BIOCGDIRECTION), + "BIOCGDLT": ValueOf(syscall.BIOCGDLT), + "BIOCGDLTLIST": ValueOf(uint32(syscall.BIOCGDLTLIST)), + "BIOCGETBUFMODE": ValueOf(syscall.BIOCGETBUFMODE), + "BIOCGETIF": ValueOf(syscall.BIOCGETIF), + "BIOCGETZMAX": ValueOf(syscall.BIOCGETZMAX), + "BIOCGHDRCMPLT": ValueOf(syscall.BIOCGHDRCMPLT), + "BIOCGRSIG": ValueOf(syscall.BIOCGRSIG), + "BIOCGRTIMEOUT": ValueOf(syscall.BIOCGRTIMEOUT), + "BIOCGSEESENT": ValueOf(syscall.BIOCGSEESENT), + "BIOCGSTATS": ValueOf(syscall.BIOCGSTATS), + "BIOCGTSTAMP": ValueOf(syscall.BIOCGTSTAMP), + "BIOCIMMEDIATE": ValueOf(uint32(syscall.BIOCIMMEDIATE)), + "BIOCLOCK": ValueOf(syscall.BIOCLOCK), + "BIOCPROMISC": ValueOf(syscall.BIOCPROMISC), + "BIOCROTZBUF": ValueOf(syscall.BIOCROTZBUF), + "BIOCSBLEN": ValueOf(uint32(syscall.BIOCSBLEN)), + "BIOCSDIRECTION": ValueOf(uint32(syscall.BIOCSDIRECTION)), + "BIOCSDLT": ValueOf(uint32(syscall.BIOCSDLT)), + "BIOCSETBUFMODE": ValueOf(uint32(syscall.BIOCSETBUFMODE)), + "BIOCSETF": ValueOf(uint32(syscall.BIOCSETF)), + "BIOCSETFNR": ValueOf(uint32(syscall.BIOCSETFNR)), + "BIOCSETIF": ValueOf(uint32(syscall.BIOCSETIF)), + "BIOCSETWF": ValueOf(uint32(syscall.BIOCSETWF)), + "BIOCSETZBUF": ValueOf(uint32(syscall.BIOCSETZBUF)), + "BIOCSHDRCMPLT": ValueOf(uint32(syscall.BIOCSHDRCMPLT)), + "BIOCSRSIG": ValueOf(uint32(syscall.BIOCSRSIG)), + "BIOCSRTIMEOUT": ValueOf(uint32(syscall.BIOCSRTIMEOUT)), + "BIOCSSEESENT": ValueOf(uint32(syscall.BIOCSSEESENT)), + "BIOCSTSTAMP": ValueOf(uint32(syscall.BIOCSTSTAMP)), + "BIOCVERSION": ValueOf(syscall.BIOCVERSION), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALIGNMENT": ValueOf(syscall.BPF_ALIGNMENT), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_BUFMODE_BUFFER": ValueOf(syscall.BPF_BUFMODE_BUFFER), + "BPF_BUFMODE_ZBUF": ValueOf(syscall.BPF_BUFMODE_ZBUF), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXBUFSIZE": ValueOf(syscall.BPF_MAXBUFSIZE), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINBUFSIZE": ValueOf(syscall.BPF_MINBUFSIZE), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RELEASE": ValueOf(syscall.BPF_RELEASE), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_T_BINTIME": ValueOf(syscall.BPF_T_BINTIME), + "BPF_T_BINTIME_FAST": ValueOf(syscall.BPF_T_BINTIME_FAST), + "BPF_T_BINTIME_MONOTONIC": ValueOf(syscall.BPF_T_BINTIME_MONOTONIC), + "BPF_T_BINTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_BINTIME_MONOTONIC_FAST), + "BPF_T_FAST": ValueOf(syscall.BPF_T_FAST), + "BPF_T_FLAG_MASK": ValueOf(syscall.BPF_T_FLAG_MASK), + "BPF_T_FORMAT_MASK": ValueOf(syscall.BPF_T_FORMAT_MASK), + "BPF_T_MICROTIME": ValueOf(syscall.BPF_T_MICROTIME), + "BPF_T_MICROTIME_FAST": ValueOf(syscall.BPF_T_MICROTIME_FAST), + "BPF_T_MICROTIME_MONOTONIC": ValueOf(syscall.BPF_T_MICROTIME_MONOTONIC), + "BPF_T_MICROTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_MICROTIME_MONOTONIC_FAST), + "BPF_T_MONOTONIC": ValueOf(syscall.BPF_T_MONOTONIC), + "BPF_T_MONOTONIC_FAST": ValueOf(syscall.BPF_T_MONOTONIC_FAST), + "BPF_T_NANOTIME": ValueOf(syscall.BPF_T_NANOTIME), + "BPF_T_NANOTIME_FAST": ValueOf(syscall.BPF_T_NANOTIME_FAST), + "BPF_T_NANOTIME_MONOTONIC": ValueOf(syscall.BPF_T_NANOTIME_MONOTONIC), + "BPF_T_NANOTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_NANOTIME_MONOTONIC_FAST), + "BPF_T_NONE": ValueOf(syscall.BPF_T_NONE), + "BPF_T_NORMAL": ValueOf(syscall.BPF_T_NORMAL), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BpfBuflen": ValueOf(syscall.BpfBuflen), + "BpfDatalink": ValueOf(syscall.BpfDatalink), + "BpfHeadercmpl": ValueOf(syscall.BpfHeadercmpl), + "BpfInterface": ValueOf(syscall.BpfInterface), + "BpfJump": ValueOf(syscall.BpfJump), + "BpfStats": ValueOf(syscall.BpfStats), + "BpfStmt": ValueOf(syscall.BpfStmt), + "BpfTimeout": ValueOf(syscall.BpfTimeout), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CFLUSH": ValueOf(syscall.CFLUSH), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTART": ValueOf(syscall.CSTART), + "CSTATUS": ValueOf(syscall.CSTATUS), + "CSTOP": ValueOf(syscall.CSTOP), + "CSTOPB": ValueOf(syscall.CSTOPB), + "CSUSP": ValueOf(syscall.CSUSP), + "CTL_MAXNAME": ValueOf(syscall.CTL_MAXNAME), + "CTL_NET": ValueOf(syscall.CTL_NET), + "Chdir": ValueOf(syscall.Chdir), + "CheckBpfVersion": ValueOf(syscall.CheckBpfVersion), + "Chflags": ValueOf(syscall.Chflags), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "DLT_A429": ValueOf(syscall.DLT_A429), + "DLT_A653_ICM": ValueOf(syscall.DLT_A653_ICM), + "DLT_AIRONET_HEADER": ValueOf(syscall.DLT_AIRONET_HEADER), + "DLT_AOS": ValueOf(syscall.DLT_AOS), + "DLT_APPLE_IP_OVER_IEEE1394": ValueOf(syscall.DLT_APPLE_IP_OVER_IEEE1394), + "DLT_ARCNET": ValueOf(syscall.DLT_ARCNET), + "DLT_ARCNET_LINUX": ValueOf(syscall.DLT_ARCNET_LINUX), + "DLT_ATM_CLIP": ValueOf(syscall.DLT_ATM_CLIP), + "DLT_ATM_RFC1483": ValueOf(syscall.DLT_ATM_RFC1483), + "DLT_AURORA": ValueOf(syscall.DLT_AURORA), + "DLT_AX25": ValueOf(syscall.DLT_AX25), + "DLT_AX25_KISS": ValueOf(syscall.DLT_AX25_KISS), + "DLT_BACNET_MS_TP": ValueOf(syscall.DLT_BACNET_MS_TP), + "DLT_BLUETOOTH_HCI_H4": ValueOf(syscall.DLT_BLUETOOTH_HCI_H4), + "DLT_BLUETOOTH_HCI_H4_WITH_PHDR": ValueOf(syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR), + "DLT_CAN20B": ValueOf(syscall.DLT_CAN20B), + "DLT_CAN_SOCKETCAN": ValueOf(syscall.DLT_CAN_SOCKETCAN), + "DLT_CHAOS": ValueOf(syscall.DLT_CHAOS), + "DLT_CHDLC": ValueOf(syscall.DLT_CHDLC), + "DLT_CISCO_IOS": ValueOf(syscall.DLT_CISCO_IOS), + "DLT_C_HDLC": ValueOf(syscall.DLT_C_HDLC), + "DLT_C_HDLC_WITH_DIR": ValueOf(syscall.DLT_C_HDLC_WITH_DIR), + "DLT_DBUS": ValueOf(syscall.DLT_DBUS), + "DLT_DECT": ValueOf(syscall.DLT_DECT), + "DLT_DOCSIS": ValueOf(syscall.DLT_DOCSIS), + "DLT_DVB_CI": ValueOf(syscall.DLT_DVB_CI), + "DLT_ECONET": ValueOf(syscall.DLT_ECONET), + "DLT_EN10MB": ValueOf(syscall.DLT_EN10MB), + "DLT_EN3MB": ValueOf(syscall.DLT_EN3MB), + "DLT_ENC": ValueOf(syscall.DLT_ENC), + "DLT_ERF": ValueOf(syscall.DLT_ERF), + "DLT_ERF_ETH": ValueOf(syscall.DLT_ERF_ETH), + "DLT_ERF_POS": ValueOf(syscall.DLT_ERF_POS), + "DLT_FC_2": ValueOf(syscall.DLT_FC_2), + "DLT_FC_2_WITH_FRAME_DELIMS": ValueOf(syscall.DLT_FC_2_WITH_FRAME_DELIMS), + "DLT_FDDI": ValueOf(syscall.DLT_FDDI), + "DLT_FLEXRAY": ValueOf(syscall.DLT_FLEXRAY), + "DLT_FRELAY": ValueOf(syscall.DLT_FRELAY), + "DLT_FRELAY_WITH_DIR": ValueOf(syscall.DLT_FRELAY_WITH_DIR), + "DLT_GCOM_SERIAL": ValueOf(syscall.DLT_GCOM_SERIAL), + "DLT_GCOM_T1E1": ValueOf(syscall.DLT_GCOM_T1E1), + "DLT_GPF_F": ValueOf(syscall.DLT_GPF_F), + "DLT_GPF_T": ValueOf(syscall.DLT_GPF_T), + "DLT_GPRS_LLC": ValueOf(syscall.DLT_GPRS_LLC), + "DLT_GSMTAP_ABIS": ValueOf(syscall.DLT_GSMTAP_ABIS), + "DLT_GSMTAP_UM": ValueOf(syscall.DLT_GSMTAP_UM), + "DLT_HHDLC": ValueOf(syscall.DLT_HHDLC), + "DLT_IBM_SN": ValueOf(syscall.DLT_IBM_SN), + "DLT_IBM_SP": ValueOf(syscall.DLT_IBM_SP), + "DLT_IEEE802": ValueOf(syscall.DLT_IEEE802), + "DLT_IEEE802_11": ValueOf(syscall.DLT_IEEE802_11), + "DLT_IEEE802_11_RADIO": ValueOf(syscall.DLT_IEEE802_11_RADIO), + "DLT_IEEE802_11_RADIO_AVS": ValueOf(syscall.DLT_IEEE802_11_RADIO_AVS), + "DLT_IEEE802_15_4": ValueOf(syscall.DLT_IEEE802_15_4), + "DLT_IEEE802_15_4_LINUX": ValueOf(syscall.DLT_IEEE802_15_4_LINUX), + "DLT_IEEE802_15_4_NOFCS": ValueOf(syscall.DLT_IEEE802_15_4_NOFCS), + "DLT_IEEE802_15_4_NONASK_PHY": ValueOf(syscall.DLT_IEEE802_15_4_NONASK_PHY), + "DLT_IEEE802_16_MAC_CPS": ValueOf(syscall.DLT_IEEE802_16_MAC_CPS), + "DLT_IEEE802_16_MAC_CPS_RADIO": ValueOf(syscall.DLT_IEEE802_16_MAC_CPS_RADIO), + "DLT_IPFILTER": ValueOf(syscall.DLT_IPFILTER), + "DLT_IPMB": ValueOf(syscall.DLT_IPMB), + "DLT_IPMB_LINUX": ValueOf(syscall.DLT_IPMB_LINUX), + "DLT_IPNET": ValueOf(syscall.DLT_IPNET), + "DLT_IPOIB": ValueOf(syscall.DLT_IPOIB), + "DLT_IPV4": ValueOf(syscall.DLT_IPV4), + "DLT_IPV6": ValueOf(syscall.DLT_IPV6), + "DLT_IP_OVER_FC": ValueOf(syscall.DLT_IP_OVER_FC), + "DLT_JUNIPER_ATM1": ValueOf(syscall.DLT_JUNIPER_ATM1), + "DLT_JUNIPER_ATM2": ValueOf(syscall.DLT_JUNIPER_ATM2), + "DLT_JUNIPER_ATM_CEMIC": ValueOf(syscall.DLT_JUNIPER_ATM_CEMIC), + "DLT_JUNIPER_CHDLC": ValueOf(syscall.DLT_JUNIPER_CHDLC), + "DLT_JUNIPER_ES": ValueOf(syscall.DLT_JUNIPER_ES), + "DLT_JUNIPER_ETHER": ValueOf(syscall.DLT_JUNIPER_ETHER), + "DLT_JUNIPER_FIBRECHANNEL": ValueOf(syscall.DLT_JUNIPER_FIBRECHANNEL), + "DLT_JUNIPER_FRELAY": ValueOf(syscall.DLT_JUNIPER_FRELAY), + "DLT_JUNIPER_GGSN": ValueOf(syscall.DLT_JUNIPER_GGSN), + "DLT_JUNIPER_ISM": ValueOf(syscall.DLT_JUNIPER_ISM), + "DLT_JUNIPER_MFR": ValueOf(syscall.DLT_JUNIPER_MFR), + "DLT_JUNIPER_MLFR": ValueOf(syscall.DLT_JUNIPER_MLFR), + "DLT_JUNIPER_MLPPP": ValueOf(syscall.DLT_JUNIPER_MLPPP), + "DLT_JUNIPER_MONITOR": ValueOf(syscall.DLT_JUNIPER_MONITOR), + "DLT_JUNIPER_PIC_PEER": ValueOf(syscall.DLT_JUNIPER_PIC_PEER), + "DLT_JUNIPER_PPP": ValueOf(syscall.DLT_JUNIPER_PPP), + "DLT_JUNIPER_PPPOE": ValueOf(syscall.DLT_JUNIPER_PPPOE), + "DLT_JUNIPER_PPPOE_ATM": ValueOf(syscall.DLT_JUNIPER_PPPOE_ATM), + "DLT_JUNIPER_SERVICES": ValueOf(syscall.DLT_JUNIPER_SERVICES), + "DLT_JUNIPER_SRX_E2E": ValueOf(syscall.DLT_JUNIPER_SRX_E2E), + "DLT_JUNIPER_ST": ValueOf(syscall.DLT_JUNIPER_ST), + "DLT_JUNIPER_VP": ValueOf(syscall.DLT_JUNIPER_VP), + "DLT_JUNIPER_VS": ValueOf(syscall.DLT_JUNIPER_VS), + "DLT_LAPB_WITH_DIR": ValueOf(syscall.DLT_LAPB_WITH_DIR), + "DLT_LAPD": ValueOf(syscall.DLT_LAPD), + "DLT_LIN": ValueOf(syscall.DLT_LIN), + "DLT_LINUX_EVDEV": ValueOf(syscall.DLT_LINUX_EVDEV), + "DLT_LINUX_IRDA": ValueOf(syscall.DLT_LINUX_IRDA), + "DLT_LINUX_LAPD": ValueOf(syscall.DLT_LINUX_LAPD), + "DLT_LINUX_PPP_WITHDIRECTION": ValueOf(syscall.DLT_LINUX_PPP_WITHDIRECTION), + "DLT_LINUX_SLL": ValueOf(syscall.DLT_LINUX_SLL), + "DLT_LOOP": ValueOf(syscall.DLT_LOOP), + "DLT_LTALK": ValueOf(syscall.DLT_LTALK), + "DLT_MATCHING_MAX": ValueOf(syscall.DLT_MATCHING_MAX), + "DLT_MATCHING_MIN": ValueOf(syscall.DLT_MATCHING_MIN), + "DLT_MFR": ValueOf(syscall.DLT_MFR), + "DLT_MOST": ValueOf(syscall.DLT_MOST), + "DLT_MPEG_2_TS": ValueOf(syscall.DLT_MPEG_2_TS), + "DLT_MPLS": ValueOf(syscall.DLT_MPLS), + "DLT_MTP2": ValueOf(syscall.DLT_MTP2), + "DLT_MTP2_WITH_PHDR": ValueOf(syscall.DLT_MTP2_WITH_PHDR), + "DLT_MTP3": ValueOf(syscall.DLT_MTP3), + "DLT_MUX27010": ValueOf(syscall.DLT_MUX27010), + "DLT_NETANALYZER": ValueOf(syscall.DLT_NETANALYZER), + "DLT_NETANALYZER_TRANSPARENT": ValueOf(syscall.DLT_NETANALYZER_TRANSPARENT), + "DLT_NFC_LLCP": ValueOf(syscall.DLT_NFC_LLCP), + "DLT_NFLOG": ValueOf(syscall.DLT_NFLOG), + "DLT_NG40": ValueOf(syscall.DLT_NG40), + "DLT_NULL": ValueOf(syscall.DLT_NULL), + "DLT_PCI_EXP": ValueOf(syscall.DLT_PCI_EXP), + "DLT_PFLOG": ValueOf(syscall.DLT_PFLOG), + "DLT_PFSYNC": ValueOf(syscall.DLT_PFSYNC), + "DLT_PPI": ValueOf(syscall.DLT_PPI), + "DLT_PPP": ValueOf(syscall.DLT_PPP), + "DLT_PPP_BSDOS": ValueOf(syscall.DLT_PPP_BSDOS), + "DLT_PPP_ETHER": ValueOf(syscall.DLT_PPP_ETHER), + "DLT_PPP_PPPD": ValueOf(syscall.DLT_PPP_PPPD), + "DLT_PPP_SERIAL": ValueOf(syscall.DLT_PPP_SERIAL), + "DLT_PPP_WITH_DIR": ValueOf(syscall.DLT_PPP_WITH_DIR), + "DLT_PPP_WITH_DIRECTION": ValueOf(syscall.DLT_PPP_WITH_DIRECTION), + "DLT_PRISM_HEADER": ValueOf(syscall.DLT_PRISM_HEADER), + "DLT_PRONET": ValueOf(syscall.DLT_PRONET), + "DLT_RAIF1": ValueOf(syscall.DLT_RAIF1), + "DLT_RAW": ValueOf(syscall.DLT_RAW), + "DLT_RIO": ValueOf(syscall.DLT_RIO), + "DLT_SCCP": ValueOf(syscall.DLT_SCCP), + "DLT_SITA": ValueOf(syscall.DLT_SITA), + "DLT_SLIP": ValueOf(syscall.DLT_SLIP), + "DLT_SLIP_BSDOS": ValueOf(syscall.DLT_SLIP_BSDOS), + "DLT_STANAG_5066_D_PDU": ValueOf(syscall.DLT_STANAG_5066_D_PDU), + "DLT_SUNATM": ValueOf(syscall.DLT_SUNATM), + "DLT_SYMANTEC_FIREWALL": ValueOf(syscall.DLT_SYMANTEC_FIREWALL), + "DLT_TZSP": ValueOf(syscall.DLT_TZSP), + "DLT_USB": ValueOf(syscall.DLT_USB), + "DLT_USB_LINUX": ValueOf(syscall.DLT_USB_LINUX), + "DLT_USB_LINUX_MMAPPED": ValueOf(syscall.DLT_USB_LINUX_MMAPPED), + "DLT_USER0": ValueOf(syscall.DLT_USER0), + "DLT_USER1": ValueOf(syscall.DLT_USER1), + "DLT_USER10": ValueOf(syscall.DLT_USER10), + "DLT_USER11": ValueOf(syscall.DLT_USER11), + "DLT_USER12": ValueOf(syscall.DLT_USER12), + "DLT_USER13": ValueOf(syscall.DLT_USER13), + "DLT_USER14": ValueOf(syscall.DLT_USER14), + "DLT_USER15": ValueOf(syscall.DLT_USER15), + "DLT_USER2": ValueOf(syscall.DLT_USER2), + "DLT_USER3": ValueOf(syscall.DLT_USER3), + "DLT_USER4": ValueOf(syscall.DLT_USER4), + "DLT_USER5": ValueOf(syscall.DLT_USER5), + "DLT_USER6": ValueOf(syscall.DLT_USER6), + "DLT_USER7": ValueOf(syscall.DLT_USER7), + "DLT_USER8": ValueOf(syscall.DLT_USER8), + "DLT_USER9": ValueOf(syscall.DLT_USER9), + "DLT_WIHART": ValueOf(syscall.DLT_WIHART), + "DLT_X2E_SERIAL": ValueOf(syscall.DLT_X2E_SERIAL), + "DLT_X2E_XORAYA": ValueOf(syscall.DLT_X2E_XORAYA), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EAUTH": ValueOf(syscall.EAUTH), + "EBADF": ValueOf(syscall.EBADF), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADRPC": ValueOf(syscall.EBADRPC), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECAPMODE": ValueOf(syscall.ECAPMODE), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOOFUS": ValueOf(syscall.EDOOFUS), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EFTYPE": ValueOf(syscall.EFTYPE), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "ELAST": ValueOf(syscall.ELAST), + "ELOOP": ValueOf(syscall.ELOOP), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENEEDAUTH": ValueOf(syscall.ENEEDAUTH), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOATTR": ValueOf(syscall.ENOATTR), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCAPABLE": ValueOf(syscall.ENOTCAPABLE), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPROCLIM": ValueOf(syscall.EPROCLIM), + "EPROCUNAVAIL": ValueOf(syscall.EPROCUNAVAIL), + "EPROGMISMATCH": ValueOf(syscall.EPROGMISMATCH), + "EPROGUNAVAIL": ValueOf(syscall.EPROGUNAVAIL), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EROFS": ValueOf(syscall.EROFS), + "ERPCMISMATCH": ValueOf(syscall.ERPCMISMATCH), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESTALE": ValueOf(syscall.ESTALE), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUSERS": ValueOf(syscall.EUSERS), + "EVFILT_AIO": ValueOf(syscall.EVFILT_AIO), + "EVFILT_FS": ValueOf(syscall.EVFILT_FS), + "EVFILT_LIO": ValueOf(syscall.EVFILT_LIO), + "EVFILT_PROC": ValueOf(syscall.EVFILT_PROC), + "EVFILT_READ": ValueOf(syscall.EVFILT_READ), + "EVFILT_SIGNAL": ValueOf(syscall.EVFILT_SIGNAL), + "EVFILT_SYSCOUNT": ValueOf(syscall.EVFILT_SYSCOUNT), + "EVFILT_TIMER": ValueOf(syscall.EVFILT_TIMER), + "EVFILT_USER": ValueOf(syscall.EVFILT_USER), + "EVFILT_VNODE": ValueOf(syscall.EVFILT_VNODE), + "EVFILT_WRITE": ValueOf(syscall.EVFILT_WRITE), + "EV_ADD": ValueOf(syscall.EV_ADD), + "EV_CLEAR": ValueOf(syscall.EV_CLEAR), + "EV_DELETE": ValueOf(syscall.EV_DELETE), + "EV_DISABLE": ValueOf(syscall.EV_DISABLE), + "EV_DISPATCH": ValueOf(syscall.EV_DISPATCH), + "EV_DROP": ValueOf(syscall.EV_DROP), + "EV_ENABLE": ValueOf(syscall.EV_ENABLE), + "EV_EOF": ValueOf(syscall.EV_EOF), + "EV_ERROR": ValueOf(syscall.EV_ERROR), + "EV_FLAG1": ValueOf(syscall.EV_FLAG1), + "EV_ONESHOT": ValueOf(syscall.EV_ONESHOT), + "EV_RECEIPT": ValueOf(syscall.EV_RECEIPT), + "EV_SYSFLAGS": ValueOf(syscall.EV_SYSFLAGS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXTA": ValueOf(syscall.EXTA), + "EXTB": ValueOf(syscall.EXTB), + "EXTPROC": ValueOf(syscall.EXTPROC), + "Environ": ValueOf(syscall.Environ), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_CANCEL": ValueOf(syscall.F_CANCEL), + "F_DUP2FD": ValueOf(syscall.F_DUP2FD), + "F_DUP2FD_CLOEXEC": ValueOf(syscall.F_DUP2FD_CLOEXEC), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_OGETLK": ValueOf(syscall.F_OGETLK), + "F_OK": ValueOf(syscall.F_OK), + "F_OSETLK": ValueOf(syscall.F_OSETLK), + "F_OSETLKW": ValueOf(syscall.F_OSETLKW), + "F_RDAHEAD": ValueOf(syscall.F_RDAHEAD), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_READAHEAD": ValueOf(syscall.F_READAHEAD), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLK_REMOTE": ValueOf(syscall.F_SETLK_REMOTE), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_UNLCKSYS": ValueOf(syscall.F_UNLCKSYS), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchflags": ValueOf(syscall.Fchflags), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchown": ValueOf(syscall.Fchown), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Flock": ValueOf(syscall.Flock), + "FlushBpf": ValueOf(syscall.FlushBpf), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fpathconf": ValueOf(syscall.Fpathconf), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Getdirentries": ValueOf(syscall.Getdirentries), + "Getdtablesize": ValueOf(syscall.Getdtablesize), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getfsstat": ValueOf(syscall.Getfsstat), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsid": ValueOf(syscall.Getsid), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptByte": ValueOf(syscall.GetsockoptByte), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMP6_FILTER": ValueOf(syscall.ICMP6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFAN_ARRIVAL": ValueOf(syscall.IFAN_ARRIVAL), + "IFAN_DEPARTURE": ValueOf(syscall.IFAN_DEPARTURE), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_ALTPHYS": ValueOf(syscall.IFF_ALTPHYS), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_CANTCHANGE": ValueOf(syscall.IFF_CANTCHANGE), + "IFF_CANTCONFIG": ValueOf(syscall.IFF_CANTCONFIG), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DRV_OACTIVE": ValueOf(syscall.IFF_DRV_OACTIVE), + "IFF_DRV_RUNNING": ValueOf(syscall.IFF_DRV_RUNNING), + "IFF_DYING": ValueOf(syscall.IFF_DYING), + "IFF_LINK0": ValueOf(syscall.IFF_LINK0), + "IFF_LINK1": ValueOf(syscall.IFF_LINK1), + "IFF_LINK2": ValueOf(syscall.IFF_LINK2), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MONITOR": ValueOf(syscall.IFF_MONITOR), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_OACTIVE": ValueOf(syscall.IFF_OACTIVE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PPROMISC": ValueOf(syscall.IFF_PPROMISC), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RENAMING": ValueOf(syscall.IFF_RENAMING), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SIMPLEX": ValueOf(syscall.IFF_SIMPLEX), + "IFF_SMART": ValueOf(syscall.IFF_SMART), + "IFF_STATICARP": ValueOf(syscall.IFF_STATICARP), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IFT_1822": ValueOf(syscall.IFT_1822), + "IFT_A12MPPSWITCH": ValueOf(syscall.IFT_A12MPPSWITCH), + "IFT_AAL2": ValueOf(syscall.IFT_AAL2), + "IFT_AAL5": ValueOf(syscall.IFT_AAL5), + "IFT_ADSL": ValueOf(syscall.IFT_ADSL), + "IFT_AFLANE8023": ValueOf(syscall.IFT_AFLANE8023), + "IFT_AFLANE8025": ValueOf(syscall.IFT_AFLANE8025), + "IFT_ARAP": ValueOf(syscall.IFT_ARAP), + "IFT_ARCNET": ValueOf(syscall.IFT_ARCNET), + "IFT_ARCNETPLUS": ValueOf(syscall.IFT_ARCNETPLUS), + "IFT_ASYNC": ValueOf(syscall.IFT_ASYNC), + "IFT_ATM": ValueOf(syscall.IFT_ATM), + "IFT_ATMDXI": ValueOf(syscall.IFT_ATMDXI), + "IFT_ATMFUNI": ValueOf(syscall.IFT_ATMFUNI), + "IFT_ATMIMA": ValueOf(syscall.IFT_ATMIMA), + "IFT_ATMLOGICAL": ValueOf(syscall.IFT_ATMLOGICAL), + "IFT_ATMRADIO": ValueOf(syscall.IFT_ATMRADIO), + "IFT_ATMSUBINTERFACE": ValueOf(syscall.IFT_ATMSUBINTERFACE), + "IFT_ATMVCIENDPT": ValueOf(syscall.IFT_ATMVCIENDPT), + "IFT_ATMVIRTUAL": ValueOf(syscall.IFT_ATMVIRTUAL), + "IFT_BGPPOLICYACCOUNTING": ValueOf(syscall.IFT_BGPPOLICYACCOUNTING), + "IFT_BRIDGE": ValueOf(syscall.IFT_BRIDGE), + "IFT_BSC": ValueOf(syscall.IFT_BSC), + "IFT_CARP": ValueOf(syscall.IFT_CARP), + "IFT_CCTEMUL": ValueOf(syscall.IFT_CCTEMUL), + "IFT_CEPT": ValueOf(syscall.IFT_CEPT), + "IFT_CES": ValueOf(syscall.IFT_CES), + "IFT_CHANNEL": ValueOf(syscall.IFT_CHANNEL), + "IFT_CNR": ValueOf(syscall.IFT_CNR), + "IFT_COFFEE": ValueOf(syscall.IFT_COFFEE), + "IFT_COMPOSITELINK": ValueOf(syscall.IFT_COMPOSITELINK), + "IFT_DCN": ValueOf(syscall.IFT_DCN), + "IFT_DIGITALPOWERLINE": ValueOf(syscall.IFT_DIGITALPOWERLINE), + "IFT_DIGITALWRAPPEROVERHEADCHANNEL": ValueOf(syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL), + "IFT_DLSW": ValueOf(syscall.IFT_DLSW), + "IFT_DOCSCABLEDOWNSTREAM": ValueOf(syscall.IFT_DOCSCABLEDOWNSTREAM), + "IFT_DOCSCABLEMACLAYER": ValueOf(syscall.IFT_DOCSCABLEMACLAYER), + "IFT_DOCSCABLEUPSTREAM": ValueOf(syscall.IFT_DOCSCABLEUPSTREAM), + "IFT_DS0": ValueOf(syscall.IFT_DS0), + "IFT_DS0BUNDLE": ValueOf(syscall.IFT_DS0BUNDLE), + "IFT_DS1FDL": ValueOf(syscall.IFT_DS1FDL), + "IFT_DS3": ValueOf(syscall.IFT_DS3), + "IFT_DTM": ValueOf(syscall.IFT_DTM), + "IFT_DVBASILN": ValueOf(syscall.IFT_DVBASILN), + "IFT_DVBASIOUT": ValueOf(syscall.IFT_DVBASIOUT), + "IFT_DVBRCCDOWNSTREAM": ValueOf(syscall.IFT_DVBRCCDOWNSTREAM), + "IFT_DVBRCCMACLAYER": ValueOf(syscall.IFT_DVBRCCMACLAYER), + "IFT_DVBRCCUPSTREAM": ValueOf(syscall.IFT_DVBRCCUPSTREAM), + "IFT_ENC": ValueOf(syscall.IFT_ENC), + "IFT_EON": ValueOf(syscall.IFT_EON), + "IFT_EPLRS": ValueOf(syscall.IFT_EPLRS), + "IFT_ESCON": ValueOf(syscall.IFT_ESCON), + "IFT_ETHER": ValueOf(syscall.IFT_ETHER), + "IFT_FAITH": ValueOf(syscall.IFT_FAITH), + "IFT_FAST": ValueOf(syscall.IFT_FAST), + "IFT_FASTETHER": ValueOf(syscall.IFT_FASTETHER), + "IFT_FASTETHERFX": ValueOf(syscall.IFT_FASTETHERFX), + "IFT_FDDI": ValueOf(syscall.IFT_FDDI), + "IFT_FIBRECHANNEL": ValueOf(syscall.IFT_FIBRECHANNEL), + "IFT_FRAMERELAYINTERCONNECT": ValueOf(syscall.IFT_FRAMERELAYINTERCONNECT), + "IFT_FRAMERELAYMPI": ValueOf(syscall.IFT_FRAMERELAYMPI), + "IFT_FRDLCIENDPT": ValueOf(syscall.IFT_FRDLCIENDPT), + "IFT_FRELAY": ValueOf(syscall.IFT_FRELAY), + "IFT_FRELAYDCE": ValueOf(syscall.IFT_FRELAYDCE), + "IFT_FRF16MFRBUNDLE": ValueOf(syscall.IFT_FRF16MFRBUNDLE), + "IFT_FRFORWARD": ValueOf(syscall.IFT_FRFORWARD), + "IFT_G703AT2MB": ValueOf(syscall.IFT_G703AT2MB), + "IFT_G703AT64K": ValueOf(syscall.IFT_G703AT64K), + "IFT_GIF": ValueOf(syscall.IFT_GIF), + "IFT_GIGABITETHERNET": ValueOf(syscall.IFT_GIGABITETHERNET), + "IFT_GR303IDT": ValueOf(syscall.IFT_GR303IDT), + "IFT_GR303RDT": ValueOf(syscall.IFT_GR303RDT), + "IFT_H323GATEKEEPER": ValueOf(syscall.IFT_H323GATEKEEPER), + "IFT_H323PROXY": ValueOf(syscall.IFT_H323PROXY), + "IFT_HDH1822": ValueOf(syscall.IFT_HDH1822), + "IFT_HDLC": ValueOf(syscall.IFT_HDLC), + "IFT_HDSL2": ValueOf(syscall.IFT_HDSL2), + "IFT_HIPERLAN2": ValueOf(syscall.IFT_HIPERLAN2), + "IFT_HIPPI": ValueOf(syscall.IFT_HIPPI), + "IFT_HIPPIINTERFACE": ValueOf(syscall.IFT_HIPPIINTERFACE), + "IFT_HOSTPAD": ValueOf(syscall.IFT_HOSTPAD), + "IFT_HSSI": ValueOf(syscall.IFT_HSSI), + "IFT_HY": ValueOf(syscall.IFT_HY), + "IFT_IBM370PARCHAN": ValueOf(syscall.IFT_IBM370PARCHAN), + "IFT_IDSL": ValueOf(syscall.IFT_IDSL), + "IFT_IEEE1394": ValueOf(syscall.IFT_IEEE1394), + "IFT_IEEE80211": ValueOf(syscall.IFT_IEEE80211), + "IFT_IEEE80212": ValueOf(syscall.IFT_IEEE80212), + "IFT_IEEE8023ADLAG": ValueOf(syscall.IFT_IEEE8023ADLAG), + "IFT_IFGSN": ValueOf(syscall.IFT_IFGSN), + "IFT_IMT": ValueOf(syscall.IFT_IMT), + "IFT_INFINIBAND": ValueOf(syscall.IFT_INFINIBAND), + "IFT_INTERLEAVE": ValueOf(syscall.IFT_INTERLEAVE), + "IFT_IP": ValueOf(syscall.IFT_IP), + "IFT_IPFORWARD": ValueOf(syscall.IFT_IPFORWARD), + "IFT_IPOVERATM": ValueOf(syscall.IFT_IPOVERATM), + "IFT_IPOVERCDLC": ValueOf(syscall.IFT_IPOVERCDLC), + "IFT_IPOVERCLAW": ValueOf(syscall.IFT_IPOVERCLAW), + "IFT_IPSWITCH": ValueOf(syscall.IFT_IPSWITCH), + "IFT_IPXIP": ValueOf(syscall.IFT_IPXIP), + "IFT_ISDN": ValueOf(syscall.IFT_ISDN), + "IFT_ISDNBASIC": ValueOf(syscall.IFT_ISDNBASIC), + "IFT_ISDNPRIMARY": ValueOf(syscall.IFT_ISDNPRIMARY), + "IFT_ISDNS": ValueOf(syscall.IFT_ISDNS), + "IFT_ISDNU": ValueOf(syscall.IFT_ISDNU), + "IFT_ISO88022LLC": ValueOf(syscall.IFT_ISO88022LLC), + "IFT_ISO88023": ValueOf(syscall.IFT_ISO88023), + "IFT_ISO88024": ValueOf(syscall.IFT_ISO88024), + "IFT_ISO88025": ValueOf(syscall.IFT_ISO88025), + "IFT_ISO88025CRFPINT": ValueOf(syscall.IFT_ISO88025CRFPINT), + "IFT_ISO88025DTR": ValueOf(syscall.IFT_ISO88025DTR), + "IFT_ISO88025FIBER": ValueOf(syscall.IFT_ISO88025FIBER), + "IFT_ISO88026": ValueOf(syscall.IFT_ISO88026), + "IFT_ISUP": ValueOf(syscall.IFT_ISUP), + "IFT_L2VLAN": ValueOf(syscall.IFT_L2VLAN), + "IFT_L3IPVLAN": ValueOf(syscall.IFT_L3IPVLAN), + "IFT_L3IPXVLAN": ValueOf(syscall.IFT_L3IPXVLAN), + "IFT_LAPB": ValueOf(syscall.IFT_LAPB), + "IFT_LAPD": ValueOf(syscall.IFT_LAPD), + "IFT_LAPF": ValueOf(syscall.IFT_LAPF), + "IFT_LOCALTALK": ValueOf(syscall.IFT_LOCALTALK), + "IFT_LOOP": ValueOf(syscall.IFT_LOOP), + "IFT_MEDIAMAILOVERIP": ValueOf(syscall.IFT_MEDIAMAILOVERIP), + "IFT_MFSIGLINK": ValueOf(syscall.IFT_MFSIGLINK), + "IFT_MIOX25": ValueOf(syscall.IFT_MIOX25), + "IFT_MODEM": ValueOf(syscall.IFT_MODEM), + "IFT_MPC": ValueOf(syscall.IFT_MPC), + "IFT_MPLS": ValueOf(syscall.IFT_MPLS), + "IFT_MPLSTUNNEL": ValueOf(syscall.IFT_MPLSTUNNEL), + "IFT_MSDSL": ValueOf(syscall.IFT_MSDSL), + "IFT_MVL": ValueOf(syscall.IFT_MVL), + "IFT_MYRINET": ValueOf(syscall.IFT_MYRINET), + "IFT_NFAS": ValueOf(syscall.IFT_NFAS), + "IFT_NSIP": ValueOf(syscall.IFT_NSIP), + "IFT_OPTICALCHANNEL": ValueOf(syscall.IFT_OPTICALCHANNEL), + "IFT_OPTICALTRANSPORT": ValueOf(syscall.IFT_OPTICALTRANSPORT), + "IFT_OTHER": ValueOf(syscall.IFT_OTHER), + "IFT_P10": ValueOf(syscall.IFT_P10), + "IFT_P80": ValueOf(syscall.IFT_P80), + "IFT_PARA": ValueOf(syscall.IFT_PARA), + "IFT_PFLOG": ValueOf(syscall.IFT_PFLOG), + "IFT_PFSYNC": ValueOf(syscall.IFT_PFSYNC), + "IFT_PLC": ValueOf(syscall.IFT_PLC), + "IFT_POS": ValueOf(syscall.IFT_POS), + "IFT_PPP": ValueOf(syscall.IFT_PPP), + "IFT_PPPMULTILINKBUNDLE": ValueOf(syscall.IFT_PPPMULTILINKBUNDLE), + "IFT_PROPBWAP2MP": ValueOf(syscall.IFT_PROPBWAP2MP), + "IFT_PROPCNLS": ValueOf(syscall.IFT_PROPCNLS), + "IFT_PROPDOCSWIRELESSDOWNSTREAM": ValueOf(syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM), + "IFT_PROPDOCSWIRELESSMACLAYER": ValueOf(syscall.IFT_PROPDOCSWIRELESSMACLAYER), + "IFT_PROPDOCSWIRELESSUPSTREAM": ValueOf(syscall.IFT_PROPDOCSWIRELESSUPSTREAM), + "IFT_PROPMUX": ValueOf(syscall.IFT_PROPMUX), + "IFT_PROPVIRTUAL": ValueOf(syscall.IFT_PROPVIRTUAL), + "IFT_PROPWIRELESSP2P": ValueOf(syscall.IFT_PROPWIRELESSP2P), + "IFT_PTPSERIAL": ValueOf(syscall.IFT_PTPSERIAL), + "IFT_PVC": ValueOf(syscall.IFT_PVC), + "IFT_QLLC": ValueOf(syscall.IFT_QLLC), + "IFT_RADIOMAC": ValueOf(syscall.IFT_RADIOMAC), + "IFT_RADSL": ValueOf(syscall.IFT_RADSL), + "IFT_REACHDSL": ValueOf(syscall.IFT_REACHDSL), + "IFT_RFC1483": ValueOf(syscall.IFT_RFC1483), + "IFT_RS232": ValueOf(syscall.IFT_RS232), + "IFT_RSRB": ValueOf(syscall.IFT_RSRB), + "IFT_SDLC": ValueOf(syscall.IFT_SDLC), + "IFT_SDSL": ValueOf(syscall.IFT_SDSL), + "IFT_SHDSL": ValueOf(syscall.IFT_SHDSL), + "IFT_SIP": ValueOf(syscall.IFT_SIP), + "IFT_SLIP": ValueOf(syscall.IFT_SLIP), + "IFT_SMDSDXI": ValueOf(syscall.IFT_SMDSDXI), + "IFT_SMDSICIP": ValueOf(syscall.IFT_SMDSICIP), + "IFT_SONET": ValueOf(syscall.IFT_SONET), + "IFT_SONETOVERHEADCHANNEL": ValueOf(syscall.IFT_SONETOVERHEADCHANNEL), + "IFT_SONETPATH": ValueOf(syscall.IFT_SONETPATH), + "IFT_SONETVT": ValueOf(syscall.IFT_SONETVT), + "IFT_SRP": ValueOf(syscall.IFT_SRP), + "IFT_SS7SIGLINK": ValueOf(syscall.IFT_SS7SIGLINK), + "IFT_STACKTOSTACK": ValueOf(syscall.IFT_STACKTOSTACK), + "IFT_STARLAN": ValueOf(syscall.IFT_STARLAN), + "IFT_STF": ValueOf(syscall.IFT_STF), + "IFT_T1": ValueOf(syscall.IFT_T1), + "IFT_TDLC": ValueOf(syscall.IFT_TDLC), + "IFT_TERMPAD": ValueOf(syscall.IFT_TERMPAD), + "IFT_TR008": ValueOf(syscall.IFT_TR008), + "IFT_TRANSPHDLC": ValueOf(syscall.IFT_TRANSPHDLC), + "IFT_TUNNEL": ValueOf(syscall.IFT_TUNNEL), + "IFT_ULTRA": ValueOf(syscall.IFT_ULTRA), + "IFT_USB": ValueOf(syscall.IFT_USB), + "IFT_V11": ValueOf(syscall.IFT_V11), + "IFT_V35": ValueOf(syscall.IFT_V35), + "IFT_V36": ValueOf(syscall.IFT_V36), + "IFT_V37": ValueOf(syscall.IFT_V37), + "IFT_VDSL": ValueOf(syscall.IFT_VDSL), + "IFT_VIRTUALIPADDRESS": ValueOf(syscall.IFT_VIRTUALIPADDRESS), + "IFT_VOICEEM": ValueOf(syscall.IFT_VOICEEM), + "IFT_VOICEENCAP": ValueOf(syscall.IFT_VOICEENCAP), + "IFT_VOICEFXO": ValueOf(syscall.IFT_VOICEFXO), + "IFT_VOICEFXS": ValueOf(syscall.IFT_VOICEFXS), + "IFT_VOICEOVERATM": ValueOf(syscall.IFT_VOICEOVERATM), + "IFT_VOICEOVERFRAMERELAY": ValueOf(syscall.IFT_VOICEOVERFRAMERELAY), + "IFT_VOICEOVERIP": ValueOf(syscall.IFT_VOICEOVERIP), + "IFT_X213": ValueOf(syscall.IFT_X213), + "IFT_X25": ValueOf(syscall.IFT_X25), + "IFT_X25DDN": ValueOf(syscall.IFT_X25DDN), + "IFT_X25HUNTGROUP": ValueOf(syscall.IFT_X25HUNTGROUP), + "IFT_X25MLP": ValueOf(syscall.IFT_X25MLP), + "IFT_X25PLE": ValueOf(syscall.IFT_X25PLE), + "IFT_XETHER": ValueOf(syscall.IFT_XETHER), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLASSD_HOST": ValueOf(syscall.IN_CLASSD_HOST), + "IN_CLASSD_NET": ValueOf(uint32(syscall.IN_CLASSD_NET)), + "IN_CLASSD_NSHIFT": ValueOf(syscall.IN_CLASSD_NSHIFT), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_RFC3021_MASK": ValueOf(uint32(syscall.IN_RFC3021_MASK)), + "IPPROTO_3PC": ValueOf(syscall.IPPROTO_3PC), + "IPPROTO_ADFS": ValueOf(syscall.IPPROTO_ADFS), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_AHIP": ValueOf(syscall.IPPROTO_AHIP), + "IPPROTO_APES": ValueOf(syscall.IPPROTO_APES), + "IPPROTO_ARGUS": ValueOf(syscall.IPPROTO_ARGUS), + "IPPROTO_AX25": ValueOf(syscall.IPPROTO_AX25), + "IPPROTO_BHA": ValueOf(syscall.IPPROTO_BHA), + "IPPROTO_BLT": ValueOf(syscall.IPPROTO_BLT), + "IPPROTO_BRSATMON": ValueOf(syscall.IPPROTO_BRSATMON), + "IPPROTO_CARP": ValueOf(syscall.IPPROTO_CARP), + "IPPROTO_CFTP": ValueOf(syscall.IPPROTO_CFTP), + "IPPROTO_CHAOS": ValueOf(syscall.IPPROTO_CHAOS), + "IPPROTO_CMTP": ValueOf(syscall.IPPROTO_CMTP), + "IPPROTO_CPHB": ValueOf(syscall.IPPROTO_CPHB), + "IPPROTO_CPNX": ValueOf(syscall.IPPROTO_CPNX), + "IPPROTO_DDP": ValueOf(syscall.IPPROTO_DDP), + "IPPROTO_DGP": ValueOf(syscall.IPPROTO_DGP), + "IPPROTO_DIVERT": ValueOf(syscall.IPPROTO_DIVERT), + "IPPROTO_DONE": ValueOf(syscall.IPPROTO_DONE), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_EMCON": ValueOf(syscall.IPPROTO_EMCON), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_EON": ValueOf(syscall.IPPROTO_EON), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_ETHERIP": ValueOf(syscall.IPPROTO_ETHERIP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GGP": ValueOf(syscall.IPPROTO_GGP), + "IPPROTO_GMTP": ValueOf(syscall.IPPROTO_GMTP), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HELLO": ValueOf(syscall.IPPROTO_HELLO), + "IPPROTO_HMP": ValueOf(syscall.IPPROTO_HMP), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IDPR": ValueOf(syscall.IPPROTO_IDPR), + "IPPROTO_IDRP": ValueOf(syscall.IPPROTO_IDRP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IGP": ValueOf(syscall.IPPROTO_IGP), + "IPPROTO_IGRP": ValueOf(syscall.IPPROTO_IGRP), + "IPPROTO_IL": ValueOf(syscall.IPPROTO_IL), + "IPPROTO_INLSP": ValueOf(syscall.IPPROTO_INLSP), + "IPPROTO_INP": ValueOf(syscall.IPPROTO_INP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPCOMP": ValueOf(syscall.IPPROTO_IPCOMP), + "IPPROTO_IPCV": ValueOf(syscall.IPPROTO_IPCV), + "IPPROTO_IPEIP": ValueOf(syscall.IPPROTO_IPEIP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPPC": ValueOf(syscall.IPPROTO_IPPC), + "IPPROTO_IPV4": ValueOf(syscall.IPPROTO_IPV4), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_IRTP": ValueOf(syscall.IPPROTO_IRTP), + "IPPROTO_KRYPTOLAN": ValueOf(syscall.IPPROTO_KRYPTOLAN), + "IPPROTO_LARP": ValueOf(syscall.IPPROTO_LARP), + "IPPROTO_LEAF1": ValueOf(syscall.IPPROTO_LEAF1), + "IPPROTO_LEAF2": ValueOf(syscall.IPPROTO_LEAF2), + "IPPROTO_MAX": ValueOf(syscall.IPPROTO_MAX), + "IPPROTO_MAXID": ValueOf(syscall.IPPROTO_MAXID), + "IPPROTO_MEAS": ValueOf(syscall.IPPROTO_MEAS), + "IPPROTO_MH": ValueOf(syscall.IPPROTO_MH), + "IPPROTO_MHRP": ValueOf(syscall.IPPROTO_MHRP), + "IPPROTO_MICP": ValueOf(syscall.IPPROTO_MICP), + "IPPROTO_MOBILE": ValueOf(syscall.IPPROTO_MOBILE), + "IPPROTO_MPLS": ValueOf(syscall.IPPROTO_MPLS), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_MUX": ValueOf(syscall.IPPROTO_MUX), + "IPPROTO_ND": ValueOf(syscall.IPPROTO_ND), + "IPPROTO_NHRP": ValueOf(syscall.IPPROTO_NHRP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_NSP": ValueOf(syscall.IPPROTO_NSP), + "IPPROTO_NVPII": ValueOf(syscall.IPPROTO_NVPII), + "IPPROTO_OLD_DIVERT": ValueOf(syscall.IPPROTO_OLD_DIVERT), + "IPPROTO_OSPFIGP": ValueOf(syscall.IPPROTO_OSPFIGP), + "IPPROTO_PFSYNC": ValueOf(syscall.IPPROTO_PFSYNC), + "IPPROTO_PGM": ValueOf(syscall.IPPROTO_PGM), + "IPPROTO_PIGP": ValueOf(syscall.IPPROTO_PIGP), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PRM": ValueOf(syscall.IPPROTO_PRM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_PVP": ValueOf(syscall.IPPROTO_PVP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_RCCMON": ValueOf(syscall.IPPROTO_RCCMON), + "IPPROTO_RDP": ValueOf(syscall.IPPROTO_RDP), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_RVD": ValueOf(syscall.IPPROTO_RVD), + "IPPROTO_SATEXPAK": ValueOf(syscall.IPPROTO_SATEXPAK), + "IPPROTO_SATMON": ValueOf(syscall.IPPROTO_SATMON), + "IPPROTO_SCCSP": ValueOf(syscall.IPPROTO_SCCSP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_SDRP": ValueOf(syscall.IPPROTO_SDRP), + "IPPROTO_SEND": ValueOf(syscall.IPPROTO_SEND), + "IPPROTO_SEP": ValueOf(syscall.IPPROTO_SEP), + "IPPROTO_SKIP": ValueOf(syscall.IPPROTO_SKIP), + "IPPROTO_SPACER": ValueOf(syscall.IPPROTO_SPACER), + "IPPROTO_SRPC": ValueOf(syscall.IPPROTO_SRPC), + "IPPROTO_ST": ValueOf(syscall.IPPROTO_ST), + "IPPROTO_SVMTP": ValueOf(syscall.IPPROTO_SVMTP), + "IPPROTO_SWIPE": ValueOf(syscall.IPPROTO_SWIPE), + "IPPROTO_TCF": ValueOf(syscall.IPPROTO_TCF), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TLSP": ValueOf(syscall.IPPROTO_TLSP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_TPXX": ValueOf(syscall.IPPROTO_TPXX), + "IPPROTO_TRUNK1": ValueOf(syscall.IPPROTO_TRUNK1), + "IPPROTO_TRUNK2": ValueOf(syscall.IPPROTO_TRUNK2), + "IPPROTO_TTP": ValueOf(syscall.IPPROTO_TTP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_VINES": ValueOf(syscall.IPPROTO_VINES), + "IPPROTO_VISA": ValueOf(syscall.IPPROTO_VISA), + "IPPROTO_VMTP": ValueOf(syscall.IPPROTO_VMTP), + "IPPROTO_WBEXPAK": ValueOf(syscall.IPPROTO_WBEXPAK), + "IPPROTO_WBMON": ValueOf(syscall.IPPROTO_WBMON), + "IPPROTO_WSN": ValueOf(syscall.IPPROTO_WSN), + "IPPROTO_XNET": ValueOf(syscall.IPPROTO_XNET), + "IPPROTO_XTP": ValueOf(syscall.IPPROTO_XTP), + "IPV6_AUTOFLOWLABEL": ValueOf(syscall.IPV6_AUTOFLOWLABEL), + "IPV6_BINDANY": ValueOf(syscall.IPV6_BINDANY), + "IPV6_BINDV6ONLY": ValueOf(syscall.IPV6_BINDV6ONLY), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DEFAULT_MULTICAST_HOPS": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_HOPS), + "IPV6_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_LOOP), + "IPV6_DEFHLIM": ValueOf(syscall.IPV6_DEFHLIM), + "IPV6_DONTFRAG": ValueOf(syscall.IPV6_DONTFRAG), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_FAITH": ValueOf(syscall.IPV6_FAITH), + "IPV6_FLOWINFO_MASK": ValueOf(uint32(syscall.IPV6_FLOWINFO_MASK)), + "IPV6_FLOWLABEL_MASK": ValueOf(uint32(syscall.IPV6_FLOWLABEL_MASK)), + "IPV6_FRAGTTL": ValueOf(syscall.IPV6_FRAGTTL), + "IPV6_FW_ADD": ValueOf(syscall.IPV6_FW_ADD), + "IPV6_FW_DEL": ValueOf(syscall.IPV6_FW_DEL), + "IPV6_FW_FLUSH": ValueOf(syscall.IPV6_FW_FLUSH), + "IPV6_FW_GET": ValueOf(syscall.IPV6_FW_GET), + "IPV6_FW_ZERO": ValueOf(syscall.IPV6_FW_ZERO), + "IPV6_HLIMDEC": ValueOf(syscall.IPV6_HLIMDEC), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MAXHLIM": ValueOf(syscall.IPV6_MAXHLIM), + "IPV6_MAXOPTHDR": ValueOf(syscall.IPV6_MAXOPTHDR), + "IPV6_MAXPACKET": ValueOf(syscall.IPV6_MAXPACKET), + "IPV6_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IPV6_MAX_GROUP_SRC_FILTER), + "IPV6_MAX_MEMBERSHIPS": ValueOf(syscall.IPV6_MAX_MEMBERSHIPS), + "IPV6_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IPV6_MAX_SOCK_SRC_FILTER), + "IPV6_MIN_MEMBERSHIPS": ValueOf(syscall.IPV6_MIN_MEMBERSHIPS), + "IPV6_MMTU": ValueOf(syscall.IPV6_MMTU), + "IPV6_MSFILTER": ValueOf(syscall.IPV6_MSFILTER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PATHMTU": ValueOf(syscall.IPV6_PATHMTU), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PORTRANGE": ValueOf(syscall.IPV6_PORTRANGE), + "IPV6_PORTRANGE_DEFAULT": ValueOf(syscall.IPV6_PORTRANGE_DEFAULT), + "IPV6_PORTRANGE_HIGH": ValueOf(syscall.IPV6_PORTRANGE_HIGH), + "IPV6_PORTRANGE_LOW": ValueOf(syscall.IPV6_PORTRANGE_LOW), + "IPV6_PREFER_TEMPADDR": ValueOf(syscall.IPV6_PREFER_TEMPADDR), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPATHMTU": ValueOf(syscall.IPV6_RECVPATHMTU), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_SOCKOPT_RESERVED1": ValueOf(syscall.IPV6_SOCKOPT_RESERVED1), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_USE_MIN_MTU": ValueOf(syscall.IPV6_USE_MIN_MTU), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_VERSION": ValueOf(syscall.IPV6_VERSION), + "IPV6_VERSION_MASK": ValueOf(syscall.IPV6_VERSION_MASK), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BINDANY": ValueOf(syscall.IP_BINDANY), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DONTFRAG": ValueOf(syscall.IP_DONTFRAG), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_DUMMYNET3": ValueOf(syscall.IP_DUMMYNET3), + "IP_DUMMYNET_CONFIGURE": ValueOf(syscall.IP_DUMMYNET_CONFIGURE), + "IP_DUMMYNET_DEL": ValueOf(syscall.IP_DUMMYNET_DEL), + "IP_DUMMYNET_FLUSH": ValueOf(syscall.IP_DUMMYNET_FLUSH), + "IP_DUMMYNET_GET": ValueOf(syscall.IP_DUMMYNET_GET), + "IP_FAITH": ValueOf(syscall.IP_FAITH), + "IP_FW3": ValueOf(syscall.IP_FW3), + "IP_FW_ADD": ValueOf(syscall.IP_FW_ADD), + "IP_FW_DEL": ValueOf(syscall.IP_FW_DEL), + "IP_FW_FLUSH": ValueOf(syscall.IP_FW_FLUSH), + "IP_FW_GET": ValueOf(syscall.IP_FW_GET), + "IP_FW_NAT_CFG": ValueOf(syscall.IP_FW_NAT_CFG), + "IP_FW_NAT_DEL": ValueOf(syscall.IP_FW_NAT_DEL), + "IP_FW_NAT_GET_CONFIG": ValueOf(syscall.IP_FW_NAT_GET_CONFIG), + "IP_FW_NAT_GET_LOG": ValueOf(syscall.IP_FW_NAT_GET_LOG), + "IP_FW_RESETLOG": ValueOf(syscall.IP_FW_RESETLOG), + "IP_FW_TABLE_ADD": ValueOf(syscall.IP_FW_TABLE_ADD), + "IP_FW_TABLE_DEL": ValueOf(syscall.IP_FW_TABLE_DEL), + "IP_FW_TABLE_FLUSH": ValueOf(syscall.IP_FW_TABLE_FLUSH), + "IP_FW_TABLE_GETSIZE": ValueOf(syscall.IP_FW_TABLE_GETSIZE), + "IP_FW_TABLE_LIST": ValueOf(syscall.IP_FW_TABLE_LIST), + "IP_FW_ZERO": ValueOf(syscall.IP_FW_ZERO), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IP_MAX_GROUP_SRC_FILTER), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MAX_SOCK_MUTE_FILTER": ValueOf(syscall.IP_MAX_SOCK_MUTE_FILTER), + "IP_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IP_MAX_SOCK_SRC_FILTER), + "IP_MAX_SOURCE_FILTER": ValueOf(syscall.IP_MAX_SOURCE_FILTER), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MIN_MEMBERSHIPS": ValueOf(syscall.IP_MIN_MEMBERSHIPS), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_MULTICAST_VIF": ValueOf(syscall.IP_MULTICAST_VIF), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_ONESBCAST": ValueOf(syscall.IP_ONESBCAST), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_PORTRANGE": ValueOf(syscall.IP_PORTRANGE), + "IP_PORTRANGE_DEFAULT": ValueOf(syscall.IP_PORTRANGE_DEFAULT), + "IP_PORTRANGE_HIGH": ValueOf(syscall.IP_PORTRANGE_HIGH), + "IP_PORTRANGE_LOW": ValueOf(syscall.IP_PORTRANGE_LOW), + "IP_RECVDSTADDR": ValueOf(syscall.IP_RECVDSTADDR), + "IP_RECVIF": ValueOf(syscall.IP_RECVIF), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_RSVP_OFF": ValueOf(syscall.IP_RSVP_OFF), + "IP_RSVP_ON": ValueOf(syscall.IP_RSVP_ON), + "IP_RSVP_VIF_OFF": ValueOf(syscall.IP_RSVP_VIF_OFF), + "IP_RSVP_VIF_ON": ValueOf(syscall.IP_RSVP_VIF_ON), + "IP_SENDSRCADDR": ValueOf(syscall.IP_SENDSRCADDR), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "Issetugid": ValueOf(syscall.Issetugid), + "Kevent": ValueOf(syscall.Kevent), + "Kill": ValueOf(syscall.Kill), + "Kqueue": ValueOf(syscall.Kqueue), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Lstat": ValueOf(syscall.Lstat), + "MADV_AUTOSYNC": ValueOf(syscall.MADV_AUTOSYNC), + "MADV_CORE": ValueOf(syscall.MADV_CORE), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_FREE": ValueOf(syscall.MADV_FREE), + "MADV_NOCORE": ValueOf(syscall.MADV_NOCORE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_NOSYNC": ValueOf(syscall.MADV_NOSYNC), + "MADV_PROTECT": ValueOf(syscall.MADV_PROTECT), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_ALIGNED_SUPER": ValueOf(syscall.MAP_ALIGNED_SUPER), + "MAP_ALIGNMENT_MASK": ValueOf(syscall.MAP_ALIGNMENT_MASK), + "MAP_ALIGNMENT_SHIFT": ValueOf(syscall.MAP_ALIGNMENT_SHIFT), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_COPY": ValueOf(syscall.MAP_COPY), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_HASSEMAPHORE": ValueOf(syscall.MAP_HASSEMAPHORE), + "MAP_NOCORE": ValueOf(syscall.MAP_NOCORE), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_NOSYNC": ValueOf(syscall.MAP_NOSYNC), + "MAP_PREFAULT_READ": ValueOf(syscall.MAP_PREFAULT_READ), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_RENAME": ValueOf(syscall.MAP_RENAME), + "MAP_RESERVED0080": ValueOf(syscall.MAP_RESERVED0080), + "MAP_RESERVED0100": ValueOf(syscall.MAP_RESERVED0100), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_STACK": ValueOf(syscall.MAP_STACK), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_COMPAT": ValueOf(syscall.MSG_COMPAT), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOF": ValueOf(syscall.MSG_EOF), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_NBIO": ValueOf(syscall.MSG_NBIO), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_NOTIFICATION": ValueOf(syscall.MSG_NOTIFICATION), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mmap": ValueOf(syscall.Mmap), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NET_RT_DUMP": ValueOf(syscall.NET_RT_DUMP), + "NET_RT_FLAGS": ValueOf(syscall.NET_RT_FLAGS), + "NET_RT_IFLIST": ValueOf(syscall.NET_RT_IFLIST), + "NET_RT_IFLISTL": ValueOf(syscall.NET_RT_IFLISTL), + "NET_RT_IFMALIST": ValueOf(syscall.NET_RT_IFMALIST), + "NET_RT_MAXID": ValueOf(syscall.NET_RT_MAXID), + "NOFLSH": ValueOf(uint32(syscall.NOFLSH)), + "NOTE_ATTRIB": ValueOf(syscall.NOTE_ATTRIB), + "NOTE_CHILD": ValueOf(syscall.NOTE_CHILD), + "NOTE_DELETE": ValueOf(syscall.NOTE_DELETE), + "NOTE_EXEC": ValueOf(syscall.NOTE_EXEC), + "NOTE_EXIT": ValueOf(uint32(syscall.NOTE_EXIT)), + "NOTE_EXTEND": ValueOf(syscall.NOTE_EXTEND), + "NOTE_FFAND": ValueOf(syscall.NOTE_FFAND), + "NOTE_FFCOPY": ValueOf(uint32(syscall.NOTE_FFCOPY)), + "NOTE_FFCTRLMASK": ValueOf(uint32(syscall.NOTE_FFCTRLMASK)), + "NOTE_FFLAGSMASK": ValueOf(syscall.NOTE_FFLAGSMASK), + "NOTE_FFNOP": ValueOf(syscall.NOTE_FFNOP), + "NOTE_FFOR": ValueOf(uint32(syscall.NOTE_FFOR)), + "NOTE_FORK": ValueOf(syscall.NOTE_FORK), + "NOTE_LINK": ValueOf(syscall.NOTE_LINK), + "NOTE_LOWAT": ValueOf(syscall.NOTE_LOWAT), + "NOTE_PCTRLMASK": ValueOf(uint32(syscall.NOTE_PCTRLMASK)), + "NOTE_PDATAMASK": ValueOf(syscall.NOTE_PDATAMASK), + "NOTE_RENAME": ValueOf(syscall.NOTE_RENAME), + "NOTE_REVOKE": ValueOf(syscall.NOTE_REVOKE), + "NOTE_TRACK": ValueOf(syscall.NOTE_TRACK), + "NOTE_TRACKERR": ValueOf(syscall.NOTE_TRACKERR), + "NOTE_TRIGGER": ValueOf(syscall.NOTE_TRIGGER), + "NOTE_WRITE": ValueOf(syscall.NOTE_WRITE), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "ONOEOT": ValueOf(syscall.ONOEOT), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_EXEC": ValueOf(syscall.O_EXEC), + "O_EXLOCK": ValueOf(syscall.O_EXLOCK), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_SHLOCK": ValueOf(syscall.O_SHLOCK), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_TTY_INIT": ValueOf(syscall.O_TTY_INIT), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseRoutingMessage": ValueOf(syscall.ParseRoutingMessage), + "ParseRoutingSockaddr": ValueOf(syscall.ParseRoutingSockaddr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "Pathconf": ValueOf(syscall.Pathconf), + "Pipe": ValueOf(syscall.Pipe), + "Pread": ValueOf(syscall.Pread), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(int64(syscall.RLIM_INFINITY)), + "RTAX_AUTHOR": ValueOf(syscall.RTAX_AUTHOR), + "RTAX_BRD": ValueOf(syscall.RTAX_BRD), + "RTAX_DST": ValueOf(syscall.RTAX_DST), + "RTAX_GATEWAY": ValueOf(syscall.RTAX_GATEWAY), + "RTAX_GENMASK": ValueOf(syscall.RTAX_GENMASK), + "RTAX_IFA": ValueOf(syscall.RTAX_IFA), + "RTAX_IFP": ValueOf(syscall.RTAX_IFP), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_NETMASK": ValueOf(syscall.RTAX_NETMASK), + "RTA_AUTHOR": ValueOf(syscall.RTA_AUTHOR), + "RTA_BRD": ValueOf(syscall.RTA_BRD), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_GENMASK": ValueOf(syscall.RTA_GENMASK), + "RTA_IFA": ValueOf(syscall.RTA_IFA), + "RTA_IFP": ValueOf(syscall.RTA_IFP), + "RTA_NETMASK": ValueOf(syscall.RTA_NETMASK), + "RTF_BLACKHOLE": ValueOf(syscall.RTF_BLACKHOLE), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_DONE": ValueOf(syscall.RTF_DONE), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FMASK": ValueOf(syscall.RTF_FMASK), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_GWFLAG_COMPAT": ValueOf(uint32(syscall.RTF_GWFLAG_COMPAT)), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_LLDATA": ValueOf(syscall.RTF_LLDATA), + "RTF_LLINFO": ValueOf(syscall.RTF_LLINFO), + "RTF_LOCAL": ValueOf(syscall.RTF_LOCAL), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_PINNED": ValueOf(syscall.RTF_PINNED), + "RTF_PRCLONING": ValueOf(syscall.RTF_PRCLONING), + "RTF_PROTO1": ValueOf(syscall.RTF_PROTO1), + "RTF_PROTO2": ValueOf(syscall.RTF_PROTO2), + "RTF_PROTO3": ValueOf(syscall.RTF_PROTO3), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_RNH_LOCKED": ValueOf(syscall.RTF_RNH_LOCKED), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_STICKY": ValueOf(syscall.RTF_STICKY), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_ADD": ValueOf(syscall.RTM_ADD), + "RTM_CHANGE": ValueOf(syscall.RTM_CHANGE), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELETE": ValueOf(syscall.RTM_DELETE), + "RTM_DELMADDR": ValueOf(syscall.RTM_DELMADDR), + "RTM_GET": ValueOf(syscall.RTM_GET), + "RTM_IEEE80211": ValueOf(syscall.RTM_IEEE80211), + "RTM_IFANNOUNCE": ValueOf(syscall.RTM_IFANNOUNCE), + "RTM_IFINFO": ValueOf(syscall.RTM_IFINFO), + "RTM_LOCK": ValueOf(syscall.RTM_LOCK), + "RTM_LOSING": ValueOf(syscall.RTM_LOSING), + "RTM_MISS": ValueOf(syscall.RTM_MISS), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWMADDR": ValueOf(syscall.RTM_NEWMADDR), + "RTM_OLDADD": ValueOf(syscall.RTM_OLDADD), + "RTM_OLDDEL": ValueOf(syscall.RTM_OLDDEL), + "RTM_REDIRECT": ValueOf(syscall.RTM_REDIRECT), + "RTM_RESOLVE": ValueOf(syscall.RTM_RESOLVE), + "RTM_RTTUNIT": ValueOf(syscall.RTM_RTTUNIT), + "RTM_VERSION": ValueOf(syscall.RTM_VERSION), + "RTV_EXPIRE": ValueOf(syscall.RTV_EXPIRE), + "RTV_HOPCOUNT": ValueOf(syscall.RTV_HOPCOUNT), + "RTV_MTU": ValueOf(syscall.RTV_MTU), + "RTV_RPIPE": ValueOf(syscall.RTV_RPIPE), + "RTV_RTT": ValueOf(syscall.RTV_RTT), + "RTV_RTTVAR": ValueOf(syscall.RTV_RTTVAR), + "RTV_SPIPE": ValueOf(syscall.RTV_SPIPE), + "RTV_SSTHRESH": ValueOf(syscall.RTV_SSTHRESH), + "RTV_WEIGHT": ValueOf(syscall.RTV_WEIGHT), + "RT_CACHING_CONTEXT": ValueOf(syscall.RT_CACHING_CONTEXT), + "RT_DEFAULT_FIB": ValueOf(syscall.RT_DEFAULT_FIB), + "RT_NORTREF": ValueOf(syscall.RT_NORTREF), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Rename": ValueOf(syscall.Rename), + "Revoke": ValueOf(syscall.Revoke), + "Rmdir": ValueOf(syscall.Rmdir), + "RouteRIB": ValueOf(syscall.RouteRIB), + "SCM_BINTIME": ValueOf(syscall.SCM_BINTIME), + "SCM_CREDS": ValueOf(syscall.SCM_CREDS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGEMT": ValueOf(syscall.SIGEMT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINFO": ValueOf(syscall.SIGINFO), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGLIBRT": ValueOf(syscall.SIGLIBRT), + "SIGLWP": ValueOf(syscall.SIGLWP), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTHR": ValueOf(syscall.SIGTHR), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDMULTI": ValueOf(uint32(syscall.SIOCADDMULTI)), + "SIOCADDRT": ValueOf(uint32(syscall.SIOCADDRT)), + "SIOCAIFADDR": ValueOf(uint32(syscall.SIOCAIFADDR)), + "SIOCAIFGROUP": ValueOf(uint32(syscall.SIOCAIFGROUP)), + "SIOCALIFADDR": ValueOf(uint32(syscall.SIOCALIFADDR)), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDELMULTI": ValueOf(uint32(syscall.SIOCDELMULTI)), + "SIOCDELRT": ValueOf(uint32(syscall.SIOCDELRT)), + "SIOCDIFADDR": ValueOf(uint32(syscall.SIOCDIFADDR)), + "SIOCDIFGROUP": ValueOf(uint32(syscall.SIOCDIFGROUP)), + "SIOCDIFPHYADDR": ValueOf(uint32(syscall.SIOCDIFPHYADDR)), + "SIOCDLIFADDR": ValueOf(uint32(syscall.SIOCDLIFADDR)), + "SIOCGDRVSPEC": ValueOf(uint32(syscall.SIOCGDRVSPEC)), + "SIOCGETSGCNT": ValueOf(uint32(syscall.SIOCGETSGCNT)), + "SIOCGETVIFCNT": ValueOf(uint32(syscall.SIOCGETVIFCNT)), + "SIOCGHIWAT": ValueOf(syscall.SIOCGHIWAT), + "SIOCGIFADDR": ValueOf(uint32(syscall.SIOCGIFADDR)), + "SIOCGIFBRDADDR": ValueOf(uint32(syscall.SIOCGIFBRDADDR)), + "SIOCGIFCAP": ValueOf(uint32(syscall.SIOCGIFCAP)), + "SIOCGIFCONF": ValueOf(uint32(syscall.SIOCGIFCONF)), + "SIOCGIFDESCR": ValueOf(uint32(syscall.SIOCGIFDESCR)), + "SIOCGIFDSTADDR": ValueOf(uint32(syscall.SIOCGIFDSTADDR)), + "SIOCGIFFIB": ValueOf(uint32(syscall.SIOCGIFFIB)), + "SIOCGIFFLAGS": ValueOf(uint32(syscall.SIOCGIFFLAGS)), + "SIOCGIFGENERIC": ValueOf(uint32(syscall.SIOCGIFGENERIC)), + "SIOCGIFGMEMB": ValueOf(uint32(syscall.SIOCGIFGMEMB)), + "SIOCGIFGROUP": ValueOf(uint32(syscall.SIOCGIFGROUP)), + "SIOCGIFINDEX": ValueOf(uint32(syscall.SIOCGIFINDEX)), + "SIOCGIFMAC": ValueOf(uint32(syscall.SIOCGIFMAC)), + "SIOCGIFMEDIA": ValueOf(uint32(syscall.SIOCGIFMEDIA)), + "SIOCGIFMETRIC": ValueOf(uint32(syscall.SIOCGIFMETRIC)), + "SIOCGIFMTU": ValueOf(uint32(syscall.SIOCGIFMTU)), + "SIOCGIFNETMASK": ValueOf(uint32(syscall.SIOCGIFNETMASK)), + "SIOCGIFPDSTADDR": ValueOf(uint32(syscall.SIOCGIFPDSTADDR)), + "SIOCGIFPHYS": ValueOf(uint32(syscall.SIOCGIFPHYS)), + "SIOCGIFPSRCADDR": ValueOf(uint32(syscall.SIOCGIFPSRCADDR)), + "SIOCGIFSTATUS": ValueOf(uint32(syscall.SIOCGIFSTATUS)), + "SIOCGLIFADDR": ValueOf(uint32(syscall.SIOCGLIFADDR)), + "SIOCGLIFPHYADDR": ValueOf(uint32(syscall.SIOCGLIFPHYADDR)), + "SIOCGLOWAT": ValueOf(syscall.SIOCGLOWAT), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGPRIVATE_0": ValueOf(uint32(syscall.SIOCGPRIVATE_0)), + "SIOCGPRIVATE_1": ValueOf(uint32(syscall.SIOCGPRIVATE_1)), + "SIOCIFCREATE": ValueOf(uint32(syscall.SIOCIFCREATE)), + "SIOCIFCREATE2": ValueOf(uint32(syscall.SIOCIFCREATE2)), + "SIOCIFDESTROY": ValueOf(uint32(syscall.SIOCIFDESTROY)), + "SIOCIFGCLONERS": ValueOf(uint32(syscall.SIOCIFGCLONERS)), + "SIOCSDRVSPEC": ValueOf(uint32(syscall.SIOCSDRVSPEC)), + "SIOCSHIWAT": ValueOf(uint32(syscall.SIOCSHIWAT)), + "SIOCSIFADDR": ValueOf(uint32(syscall.SIOCSIFADDR)), + "SIOCSIFBRDADDR": ValueOf(uint32(syscall.SIOCSIFBRDADDR)), + "SIOCSIFCAP": ValueOf(uint32(syscall.SIOCSIFCAP)), + "SIOCSIFDESCR": ValueOf(uint32(syscall.SIOCSIFDESCR)), + "SIOCSIFDSTADDR": ValueOf(uint32(syscall.SIOCSIFDSTADDR)), + "SIOCSIFFIB": ValueOf(uint32(syscall.SIOCSIFFIB)), + "SIOCSIFFLAGS": ValueOf(uint32(syscall.SIOCSIFFLAGS)), + "SIOCSIFGENERIC": ValueOf(uint32(syscall.SIOCSIFGENERIC)), + "SIOCSIFLLADDR": ValueOf(uint32(syscall.SIOCSIFLLADDR)), + "SIOCSIFMAC": ValueOf(uint32(syscall.SIOCSIFMAC)), + "SIOCSIFMEDIA": ValueOf(uint32(syscall.SIOCSIFMEDIA)), + "SIOCSIFMETRIC": ValueOf(uint32(syscall.SIOCSIFMETRIC)), + "SIOCSIFMTU": ValueOf(uint32(syscall.SIOCSIFMTU)), + "SIOCSIFNAME": ValueOf(uint32(syscall.SIOCSIFNAME)), + "SIOCSIFNETMASK": ValueOf(uint32(syscall.SIOCSIFNETMASK)), + "SIOCSIFPHYADDR": ValueOf(uint32(syscall.SIOCSIFPHYADDR)), + "SIOCSIFPHYS": ValueOf(uint32(syscall.SIOCSIFPHYS)), + "SIOCSIFRVNET": ValueOf(uint32(syscall.SIOCSIFRVNET)), + "SIOCSIFVNET": ValueOf(uint32(syscall.SIOCSIFVNET)), + "SIOCSLIFPHYADDR": ValueOf(uint32(syscall.SIOCSLIFPHYADDR)), + "SIOCSLOWAT": ValueOf(uint32(syscall.SIOCSLOWAT)), + "SIOCSPGRP": ValueOf(uint32(syscall.SIOCSPGRP)), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_MAXADDRLEN": ValueOf(syscall.SOCK_MAXADDRLEN), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ACCEPTFILTER": ValueOf(syscall.SO_ACCEPTFILTER), + "SO_BINTIME": ValueOf(syscall.SO_BINTIME), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LABEL": ValueOf(syscall.SO_LABEL), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_LISTENINCQLEN": ValueOf(syscall.SO_LISTENINCQLEN), + "SO_LISTENQLEN": ValueOf(syscall.SO_LISTENQLEN), + "SO_LISTENQLIMIT": ValueOf(syscall.SO_LISTENQLIMIT), + "SO_NOSIGPIPE": ValueOf(syscall.SO_NOSIGPIPE), + "SO_NO_DDP": ValueOf(syscall.SO_NO_DDP), + "SO_NO_OFFLOAD": ValueOf(syscall.SO_NO_OFFLOAD), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PEERLABEL": ValueOf(syscall.SO_PEERLABEL), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_PROTOTYPE": ValueOf(syscall.SO_PROTOTYPE), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_REUSEPORT": ValueOf(syscall.SO_REUSEPORT), + "SO_SETFIB": ValueOf(syscall.SO_SETFIB), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SO_USELOOPBACK": ValueOf(syscall.SO_USELOOPBACK), + "SO_USER_COOKIE": ValueOf(syscall.SO_USER_COOKIE), + "SO_VENDOR": ValueOf(uint32(syscall.SO_VENDOR)), + "SYS_ABORT2": ValueOf(syscall.SYS_ABORT2), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT4": ValueOf(syscall.SYS_ACCEPT4), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADJTIME": ValueOf(syscall.SYS_ADJTIME), + "SYS_AUDIT": ValueOf(syscall.SYS_AUDIT), + "SYS_AUDITCTL": ValueOf(syscall.SYS_AUDITCTL), + "SYS_AUDITON": ValueOf(syscall.SYS_AUDITON), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BINDAT": ValueOf(syscall.SYS_BINDAT), + "SYS_CAP_ENTER": ValueOf(syscall.SYS_CAP_ENTER), + "SYS_CAP_GETMODE": ValueOf(syscall.SYS_CAP_GETMODE), + "SYS_CAP_GETRIGHTS": ValueOf(syscall.SYS_CAP_GETRIGHTS), + "SYS_CAP_NEW": ValueOf(syscall.SYS_CAP_NEW), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHFLAGS": ValueOf(syscall.SYS_CHFLAGS), + "SYS_CHFLAGSAT": ValueOf(syscall.SYS_CHFLAGSAT), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_GETCPUCLOCKID2": ValueOf(syscall.SYS_CLOCK_GETCPUCLOCKID2), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CLOSEFROM": ValueOf(syscall.SYS_CLOSEFROM), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CONNECTAT": ValueOf(syscall.SYS_CONNECTAT), + "SYS_CPUSET": ValueOf(syscall.SYS_CPUSET), + "SYS_CPUSET_GETAFFINITY": ValueOf(syscall.SYS_CPUSET_GETAFFINITY), + "SYS_CPUSET_GETID": ValueOf(syscall.SYS_CPUSET_GETID), + "SYS_CPUSET_SETAFFINITY": ValueOf(syscall.SYS_CPUSET_SETAFFINITY), + "SYS_CPUSET_SETID": ValueOf(syscall.SYS_CPUSET_SETID), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_EACCESS": ValueOf(syscall.SYS_EACCESS), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXTATTRCTL": ValueOf(syscall.SYS_EXTATTRCTL), + "SYS_EXTATTR_DELETE_FD": ValueOf(syscall.SYS_EXTATTR_DELETE_FD), + "SYS_EXTATTR_DELETE_FILE": ValueOf(syscall.SYS_EXTATTR_DELETE_FILE), + "SYS_EXTATTR_DELETE_LINK": ValueOf(syscall.SYS_EXTATTR_DELETE_LINK), + "SYS_EXTATTR_GET_FD": ValueOf(syscall.SYS_EXTATTR_GET_FD), + "SYS_EXTATTR_GET_FILE": ValueOf(syscall.SYS_EXTATTR_GET_FILE), + "SYS_EXTATTR_GET_LINK": ValueOf(syscall.SYS_EXTATTR_GET_LINK), + "SYS_EXTATTR_LIST_FD": ValueOf(syscall.SYS_EXTATTR_LIST_FD), + "SYS_EXTATTR_LIST_FILE": ValueOf(syscall.SYS_EXTATTR_LIST_FILE), + "SYS_EXTATTR_LIST_LINK": ValueOf(syscall.SYS_EXTATTR_LIST_LINK), + "SYS_EXTATTR_SET_FD": ValueOf(syscall.SYS_EXTATTR_SET_FD), + "SYS_EXTATTR_SET_FILE": ValueOf(syscall.SYS_EXTATTR_SET_FILE), + "SYS_EXTATTR_SET_LINK": ValueOf(syscall.SYS_EXTATTR_SET_LINK), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHFLAGS": ValueOf(syscall.SYS_FCHFLAGS), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FEXECVE": ValueOf(syscall.SYS_FEXECVE), + "SYS_FFCLOCK_GETCOUNTER": ValueOf(syscall.SYS_FFCLOCK_GETCOUNTER), + "SYS_FFCLOCK_GETESTIMATE": ValueOf(syscall.SYS_FFCLOCK_GETESTIMATE), + "SYS_FFCLOCK_SETESTIMATE": ValueOf(syscall.SYS_FFCLOCK_SETESTIMATE), + "SYS_FHOPEN": ValueOf(syscall.SYS_FHOPEN), + "SYS_FHSTAT": ValueOf(syscall.SYS_FHSTAT), + "SYS_FHSTATFS": ValueOf(syscall.SYS_FHSTATFS), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FPATHCONF": ValueOf(syscall.SYS_FPATHCONF), + "SYS_FREEBSD6_FTRUNCATE": ValueOf(syscall.SYS_FREEBSD6_FTRUNCATE), + "SYS_FREEBSD6_LSEEK": ValueOf(syscall.SYS_FREEBSD6_LSEEK), + "SYS_FREEBSD6_MMAP": ValueOf(syscall.SYS_FREEBSD6_MMAP), + "SYS_FREEBSD6_PREAD": ValueOf(syscall.SYS_FREEBSD6_PREAD), + "SYS_FREEBSD6_PWRITE": ValueOf(syscall.SYS_FREEBSD6_PWRITE), + "SYS_FREEBSD6_TRUNCATE": ValueOf(syscall.SYS_FREEBSD6_TRUNCATE), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTATAT": ValueOf(syscall.SYS_FSTATAT), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTIMES": ValueOf(syscall.SYS_FUTIMES), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETAUDIT": ValueOf(syscall.SYS_GETAUDIT), + "SYS_GETAUDIT_ADDR": ValueOf(syscall.SYS_GETAUDIT_ADDR), + "SYS_GETAUID": ValueOf(syscall.SYS_GETAUID), + "SYS_GETCONTEXT": ValueOf(syscall.SYS_GETCONTEXT), + "SYS_GETDENTS": ValueOf(syscall.SYS_GETDENTS), + "SYS_GETDIRENTRIES": ValueOf(syscall.SYS_GETDIRENTRIES), + "SYS_GETDTABLESIZE": ValueOf(syscall.SYS_GETDTABLESIZE), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETFH": ValueOf(syscall.SYS_GETFH), + "SYS_GETFSSTAT": ValueOf(syscall.SYS_GETFSSTAT), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETLOGIN": ValueOf(syscall.SYS_GETLOGIN), + "SYS_GETLOGINCLASS": ValueOf(syscall.SYS_GETLOGINCLASS), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_ISSETUGID": ValueOf(syscall.SYS_ISSETUGID), + "SYS_JAIL": ValueOf(syscall.SYS_JAIL), + "SYS_JAIL_ATTACH": ValueOf(syscall.SYS_JAIL_ATTACH), + "SYS_JAIL_GET": ValueOf(syscall.SYS_JAIL_GET), + "SYS_JAIL_REMOVE": ValueOf(syscall.SYS_JAIL_REMOVE), + "SYS_JAIL_SET": ValueOf(syscall.SYS_JAIL_SET), + "SYS_KENV": ValueOf(syscall.SYS_KENV), + "SYS_KEVENT": ValueOf(syscall.SYS_KEVENT), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_KLDFIND": ValueOf(syscall.SYS_KLDFIND), + "SYS_KLDFIRSTMOD": ValueOf(syscall.SYS_KLDFIRSTMOD), + "SYS_KLDLOAD": ValueOf(syscall.SYS_KLDLOAD), + "SYS_KLDNEXT": ValueOf(syscall.SYS_KLDNEXT), + "SYS_KLDSTAT": ValueOf(syscall.SYS_KLDSTAT), + "SYS_KLDSYM": ValueOf(syscall.SYS_KLDSYM), + "SYS_KLDUNLOAD": ValueOf(syscall.SYS_KLDUNLOAD), + "SYS_KLDUNLOADF": ValueOf(syscall.SYS_KLDUNLOADF), + "SYS_KQUEUE": ValueOf(syscall.SYS_KQUEUE), + "SYS_KTIMER_CREATE": ValueOf(syscall.SYS_KTIMER_CREATE), + "SYS_KTIMER_DELETE": ValueOf(syscall.SYS_KTIMER_DELETE), + "SYS_KTIMER_GETOVERRUN": ValueOf(syscall.SYS_KTIMER_GETOVERRUN), + "SYS_KTIMER_GETTIME": ValueOf(syscall.SYS_KTIMER_GETTIME), + "SYS_KTIMER_SETTIME": ValueOf(syscall.SYS_KTIMER_SETTIME), + "SYS_KTRACE": ValueOf(syscall.SYS_KTRACE), + "SYS_LCHFLAGS": ValueOf(syscall.SYS_LCHFLAGS), + "SYS_LCHMOD": ValueOf(syscall.SYS_LCHMOD), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LGETFH": ValueOf(syscall.SYS_LGETFH), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LPATHCONF": ValueOf(syscall.SYS_LPATHCONF), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LUTIMES": ValueOf(syscall.SYS_LUTIMES), + "SYS_MAC_SYSCALL": ValueOf(syscall.SYS_MAC_SYSCALL), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MINHERIT": ValueOf(syscall.SYS_MINHERIT), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKFIFO": ValueOf(syscall.SYS_MKFIFO), + "SYS_MKFIFOAT": ValueOf(syscall.SYS_MKFIFOAT), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MODFIND": ValueOf(syscall.SYS_MODFIND), + "SYS_MODFNEXT": ValueOf(syscall.SYS_MODFNEXT), + "SYS_MODNEXT": ValueOf(syscall.SYS_MODNEXT), + "SYS_MODSTAT": ValueOf(syscall.SYS_MODSTAT), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NFSTAT": ValueOf(syscall.SYS_NFSTAT), + "SYS_NLSTAT": ValueOf(syscall.SYS_NLSTAT), + "SYS_NMOUNT": ValueOf(syscall.SYS_NMOUNT), + "SYS_NSTAT": ValueOf(syscall.SYS_NSTAT), + "SYS_NTP_ADJTIME": ValueOf(syscall.SYS_NTP_ADJTIME), + "SYS_NTP_GETTIME": ValueOf(syscall.SYS_NTP_GETTIME), + "SYS_OBREAK": ValueOf(syscall.SYS_OBREAK), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_OPENBSD_POLL": ValueOf(syscall.SYS_OPENBSD_POLL), + "SYS_OVADVISE": ValueOf(syscall.SYS_OVADVISE), + "SYS_PATHCONF": ValueOf(syscall.SYS_PATHCONF), + "SYS_PDFORK": ValueOf(syscall.SYS_PDFORK), + "SYS_PDGETPID": ValueOf(syscall.SYS_PDGETPID), + "SYS_PDKILL": ValueOf(syscall.SYS_PDKILL), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_POSIX_FADVISE": ValueOf(syscall.SYS_POSIX_FADVISE), + "SYS_POSIX_FALLOCATE": ValueOf(syscall.SYS_POSIX_FALLOCATE), + "SYS_POSIX_OPENPT": ValueOf(syscall.SYS_POSIX_OPENPT), + "SYS_PREAD": ValueOf(syscall.SYS_PREAD), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PROCCTL": ValueOf(syscall.SYS_PROCCTL), + "SYS_PROFIL": ValueOf(syscall.SYS_PROFIL), + "SYS_PSELECT": ValueOf(syscall.SYS_PSELECT), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE": ValueOf(syscall.SYS_PWRITE), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_RCTL_ADD_RULE": ValueOf(syscall.SYS_RCTL_ADD_RULE), + "SYS_RCTL_GET_LIMITS": ValueOf(syscall.SYS_RCTL_GET_LIMITS), + "SYS_RCTL_GET_RACCT": ValueOf(syscall.SYS_RCTL_GET_RACCT), + "SYS_RCTL_GET_RULES": ValueOf(syscall.SYS_RCTL_GET_RULES), + "SYS_RCTL_REMOVE_RULE": ValueOf(syscall.SYS_RCTL_REMOVE_RULE), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_REVOKE": ValueOf(syscall.SYS_REVOKE), + "SYS_RFORK": ValueOf(syscall.SYS_RFORK), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_RTPRIO": ValueOf(syscall.SYS_RTPRIO), + "SYS_RTPRIO_THREAD": ValueOf(syscall.SYS_RTPRIO_THREAD), + "SYS_SBRK": ValueOf(syscall.SYS_SBRK), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SCTP_GENERIC_RECVMSG": ValueOf(syscall.SYS_SCTP_GENERIC_RECVMSG), + "SYS_SCTP_GENERIC_SENDMSG": ValueOf(syscall.SYS_SCTP_GENERIC_SENDMSG), + "SYS_SCTP_GENERIC_SENDMSG_IOV": ValueOf(syscall.SYS_SCTP_GENERIC_SENDMSG_IOV), + "SYS_SCTP_PEELOFF": ValueOf(syscall.SYS_SCTP_PEELOFF), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SETAUDIT": ValueOf(syscall.SYS_SETAUDIT), + "SYS_SETAUDIT_ADDR": ValueOf(syscall.SYS_SETAUDIT_ADDR), + "SYS_SETAUID": ValueOf(syscall.SYS_SETAUID), + "SYS_SETCONTEXT": ValueOf(syscall.SYS_SETCONTEXT), + "SYS_SETEGID": ValueOf(syscall.SYS_SETEGID), + "SYS_SETEUID": ValueOf(syscall.SYS_SETEUID), + "SYS_SETFIB": ValueOf(syscall.SYS_SETFIB), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETLOGIN": ValueOf(syscall.SYS_SETLOGIN), + "SYS_SETLOGINCLASS": ValueOf(syscall.SYS_SETLOGINCLASS), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SHM_OPEN": ValueOf(syscall.SYS_SHM_OPEN), + "SYS_SHM_UNLINK": ValueOf(syscall.SYS_SHM_UNLINK), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGQUEUE": ValueOf(syscall.SYS_SIGQUEUE), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SIGTIMEDWAIT": ValueOf(syscall.SYS_SIGTIMEDWAIT), + "SYS_SIGWAIT": ValueOf(syscall.SYS_SIGWAIT), + "SYS_SIGWAITINFO": ValueOf(syscall.SYS_SIGWAITINFO), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_SSTK": ValueOf(syscall.SYS_SSTK), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_SWAPCONTEXT": ValueOf(syscall.SYS_SWAPCONTEXT), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYSARCH": ValueOf(syscall.SYS_SYSARCH), + "SYS_THR_CREATE": ValueOf(syscall.SYS_THR_CREATE), + "SYS_THR_EXIT": ValueOf(syscall.SYS_THR_EXIT), + "SYS_THR_KILL": ValueOf(syscall.SYS_THR_KILL), + "SYS_THR_KILL2": ValueOf(syscall.SYS_THR_KILL2), + "SYS_THR_NEW": ValueOf(syscall.SYS_THR_NEW), + "SYS_THR_SELF": ValueOf(syscall.SYS_THR_SELF), + "SYS_THR_SET_NAME": ValueOf(syscall.SYS_THR_SET_NAME), + "SYS_THR_SUSPEND": ValueOf(syscall.SYS_THR_SUSPEND), + "SYS_THR_WAKE": ValueOf(syscall.SYS_THR_WAKE), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UNDELETE": ValueOf(syscall.SYS_UNDELETE), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNMOUNT": ValueOf(syscall.SYS_UNMOUNT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_UTRACE": ValueOf(syscall.SYS_UTRACE), + "SYS_UUIDGEN": ValueOf(syscall.SYS_UUIDGEN), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAIT6": ValueOf(syscall.SYS_WAIT6), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS_YIELD": ValueOf(syscall.SYS_YIELD), + "SYS__UMTX_LOCK": ValueOf(syscall.SYS__UMTX_LOCK), + "SYS__UMTX_OP": ValueOf(syscall.SYS__UMTX_OP), + "SYS__UMTX_UNLOCK": ValueOf(syscall.SYS__UMTX_UNLOCK), + "SYS___ACL_ACLCHECK_FD": ValueOf(syscall.SYS___ACL_ACLCHECK_FD), + "SYS___ACL_ACLCHECK_FILE": ValueOf(syscall.SYS___ACL_ACLCHECK_FILE), + "SYS___ACL_ACLCHECK_LINK": ValueOf(syscall.SYS___ACL_ACLCHECK_LINK), + "SYS___ACL_DELETE_FD": ValueOf(syscall.SYS___ACL_DELETE_FD), + "SYS___ACL_DELETE_FILE": ValueOf(syscall.SYS___ACL_DELETE_FILE), + "SYS___ACL_DELETE_LINK": ValueOf(syscall.SYS___ACL_DELETE_LINK), + "SYS___ACL_GET_FD": ValueOf(syscall.SYS___ACL_GET_FD), + "SYS___ACL_GET_FILE": ValueOf(syscall.SYS___ACL_GET_FILE), + "SYS___ACL_GET_LINK": ValueOf(syscall.SYS___ACL_GET_LINK), + "SYS___ACL_SET_FD": ValueOf(syscall.SYS___ACL_SET_FD), + "SYS___ACL_SET_FILE": ValueOf(syscall.SYS___ACL_SET_FILE), + "SYS___ACL_SET_LINK": ValueOf(syscall.SYS___ACL_SET_LINK), + "SYS___GETCWD": ValueOf(syscall.SYS___GETCWD), + "SYS___MAC_EXECVE": ValueOf(syscall.SYS___MAC_EXECVE), + "SYS___MAC_GET_FD": ValueOf(syscall.SYS___MAC_GET_FD), + "SYS___MAC_GET_FILE": ValueOf(syscall.SYS___MAC_GET_FILE), + "SYS___MAC_GET_LINK": ValueOf(syscall.SYS___MAC_GET_LINK), + "SYS___MAC_GET_PID": ValueOf(syscall.SYS___MAC_GET_PID), + "SYS___MAC_GET_PROC": ValueOf(syscall.SYS___MAC_GET_PROC), + "SYS___MAC_SET_FD": ValueOf(syscall.SYS___MAC_SET_FD), + "SYS___MAC_SET_FILE": ValueOf(syscall.SYS___MAC_SET_FILE), + "SYS___MAC_SET_LINK": ValueOf(syscall.SYS___MAC_SET_LINK), + "SYS___MAC_SET_PROC": ValueOf(syscall.SYS___MAC_SET_PROC), + "SYS___SETUGID": ValueOf(syscall.SYS___SETUGID), + "SYS___SYSCTL": ValueOf(syscall.SYS___SYSCTL), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetBpf": ValueOf(syscall.SetBpf), + "SetBpfBuflen": ValueOf(syscall.SetBpfBuflen), + "SetBpfDatalink": ValueOf(syscall.SetBpfDatalink), + "SetBpfHeadercmpl": ValueOf(syscall.SetBpfHeadercmpl), + "SetBpfImmediate": ValueOf(syscall.SetBpfImmediate), + "SetBpfInterface": ValueOf(syscall.SetBpfInterface), + "SetBpfPromisc": ValueOf(syscall.SetBpfPromisc), + "SetBpfTimeout": ValueOf(syscall.SetBpfTimeout), + "SetKevent": ValueOf(syscall.SetKevent), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setegid": ValueOf(syscall.Setegid), + "Setenv": ValueOf(syscall.Setenv), + "Seteuid": ValueOf(syscall.Seteuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Setlogin": ValueOf(syscall.Setlogin), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofBpfHdr": ValueOf(syscall.SizeofBpfHdr), + "SizeofBpfInsn": ValueOf(syscall.SizeofBpfInsn), + "SizeofBpfProgram": ValueOf(syscall.SizeofBpfProgram), + "SizeofBpfStat": ValueOf(syscall.SizeofBpfStat), + "SizeofBpfVersion": ValueOf(syscall.SizeofBpfVersion), + "SizeofBpfZbuf": ValueOf(syscall.SizeofBpfZbuf), + "SizeofBpfZbufHeader": ValueOf(syscall.SizeofBpfZbufHeader), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAnnounceMsghdr": ValueOf(syscall.SizeofIfAnnounceMsghdr), + "SizeofIfData": ValueOf(syscall.SizeofIfData), + "SizeofIfMsghdr": ValueOf(syscall.SizeofIfMsghdr), + "SizeofIfaMsghdr": ValueOf(syscall.SizeofIfaMsghdr), + "SizeofIfmaMsghdr": ValueOf(syscall.SizeofIfmaMsghdr), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofRtMetrics": ValueOf(syscall.SizeofRtMetrics), + "SizeofRtMsghdr": ValueOf(syscall.SizeofRtMsghdr), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrDatalink": ValueOf(syscall.SizeofSockaddrDatalink), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Syscall9": ValueOf(syscall.Syscall9), + "Sysctl": ValueOf(syscall.Sysctl), + "SysctlUint32": ValueOf(syscall.SysctlUint32), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CA_NAME_MAX": ValueOf(syscall.TCP_CA_NAME_MAX), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINIT": ValueOf(syscall.TCP_KEEPINIT), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_MAXBURST": ValueOf(syscall.TCP_MAXBURST), + "TCP_MAXHLEN": ValueOf(syscall.TCP_MAXHLEN), + "TCP_MAXOLEN": ValueOf(syscall.TCP_MAXOLEN), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_SACK": ValueOf(syscall.TCP_MAX_SACK), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MINMSS": ValueOf(syscall.TCP_MINMSS), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_NOOPT": ValueOf(syscall.TCP_NOOPT), + "TCP_NOPUSH": ValueOf(syscall.TCP_NOPUSH), + "TCP_VENDOR": ValueOf(uint32(syscall.TCP_VENDOR)), + "TCSAFLUSH": ValueOf(syscall.TCSAFLUSH), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCDTR": ValueOf(syscall.TIOCCDTR), + "TIOCCONS": ValueOf(uint32(syscall.TIOCCONS)), + "TIOCDRAIN": ValueOf(syscall.TIOCDRAIN), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCEXT": ValueOf(uint32(syscall.TIOCEXT)), + "TIOCFLUSH": ValueOf(uint32(syscall.TIOCFLUSH)), + "TIOCGDRAINWAIT": ValueOf(syscall.TIOCGDRAINWAIT), + "TIOCGETA": ValueOf(syscall.TIOCGETA), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPTN": ValueOf(syscall.TIOCGPTN), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCMBIC": ValueOf(uint32(syscall.TIOCMBIC)), + "TIOCMBIS": ValueOf(uint32(syscall.TIOCMBIS)), + "TIOCMGDTRWAIT": ValueOf(syscall.TIOCMGDTRWAIT), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMSDTRWAIT": ValueOf(uint32(syscall.TIOCMSDTRWAIT)), + "TIOCMSET": ValueOf(uint32(syscall.TIOCMSET)), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DCD": ValueOf(syscall.TIOCM_DCD), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(uint32(syscall.TIOCPKT)), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCPTMASTER": ValueOf(syscall.TIOCPTMASTER), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSDRAINWAIT": ValueOf(uint32(syscall.TIOCSDRAINWAIT)), + "TIOCSDTR": ValueOf(syscall.TIOCSDTR), + "TIOCSETA": ValueOf(uint32(syscall.TIOCSETA)), + "TIOCSETAF": ValueOf(uint32(syscall.TIOCSETAF)), + "TIOCSETAW": ValueOf(uint32(syscall.TIOCSETAW)), + "TIOCSETD": ValueOf(uint32(syscall.TIOCSETD)), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSPGRP": ValueOf(uint32(syscall.TIOCSPGRP)), + "TIOCSTART": ValueOf(syscall.TIOCSTART), + "TIOCSTAT": ValueOf(syscall.TIOCSTAT), + "TIOCSTI": ValueOf(uint32(syscall.TIOCSTI)), + "TIOCSTOP": ValueOf(syscall.TIOCSTOP), + "TIOCSWINSZ": ValueOf(uint32(syscall.TIOCSWINSZ)), + "TIOCTIMESTAMP": ValueOf(syscall.TIOCTIMESTAMP), + "TIOCUCNTL": ValueOf(uint32(syscall.TIOCUCNTL)), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Undelete": ValueOf(syscall.Undelete), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VDSUSP": ValueOf(syscall.VDSUSP), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VERASE2": ValueOf(syscall.VERASE2), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTATUS": ValueOf(syscall.VSTATUS), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WCOREFLAG": ValueOf(syscall.WCOREFLAG), + "WEXITED": ValueOf(syscall.WEXITED), + "WLINUXCLONE": ValueOf(uint32(syscall.WLINUXCLONE)), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WTRAPPED": ValueOf(syscall.WTRAPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + },Types: map[string]Type{ + "BpfHdr": TypeOf((*syscall.BpfHdr)(nil)).Elem(), + "BpfInsn": TypeOf((*syscall.BpfInsn)(nil)).Elem(), + "BpfProgram": TypeOf((*syscall.BpfProgram)(nil)).Elem(), + "BpfStat": TypeOf((*syscall.BpfStat)(nil)).Elem(), + "BpfVersion": TypeOf((*syscall.BpfVersion)(nil)).Elem(), + "BpfZbuf": TypeOf((*syscall.BpfZbuf)(nil)).Elem(), + "BpfZbufHeader": TypeOf((*syscall.BpfZbufHeader)(nil)).Elem(), + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAnnounceMsghdr": TypeOf((*syscall.IfAnnounceMsghdr)(nil)).Elem(), + "IfData": TypeOf((*syscall.IfData)(nil)).Elem(), + "IfMsghdr": TypeOf((*syscall.IfMsghdr)(nil)).Elem(), + "IfaMsghdr": TypeOf((*syscall.IfaMsghdr)(nil)).Elem(), + "IfmaMsghdr": TypeOf((*syscall.IfmaMsghdr)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InterfaceAddrMessage": TypeOf((*syscall.InterfaceAddrMessage)(nil)).Elem(), + "InterfaceAnnounceMessage": TypeOf((*syscall.InterfaceAnnounceMessage)(nil)).Elem(), + "InterfaceMessage": TypeOf((*syscall.InterfaceMessage)(nil)).Elem(), + "InterfaceMulticastAddrMessage": TypeOf((*syscall.InterfaceMulticastAddrMessage)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Kevent_t": TypeOf((*syscall.Kevent_t)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrDatalink": TypeOf((*syscall.RawSockaddrDatalink)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RouteMessage": TypeOf((*syscall.RouteMessage)(nil)).Elem(), + "RoutingMessage": TypeOf((*syscall.RoutingMessage)(nil)).Elem(), + "RtMetrics": TypeOf((*syscall.RtMetrics)(nil)).Elem(), + "RtMsghdr": TypeOf((*syscall.RtMsghdr)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrDatalink": TypeOf((*syscall.SockaddrDatalink)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + },Untypeds: map[string]string{ + "AF_APPLETALK": "int:16", + "AF_ARP": "int:35", + "AF_ATM": "int:30", + "AF_BLUETOOTH": "int:36", + "AF_CCITT": "int:10", + "AF_CHAOS": "int:5", + "AF_CNT": "int:21", + "AF_COIP": "int:20", + "AF_DATAKIT": "int:9", + "AF_DECnet": "int:12", + "AF_DLI": "int:13", + "AF_E164": "int:26", + "AF_ECMA": "int:8", + "AF_HYLINK": "int:15", + "AF_IEEE80211": "int:37", + "AF_IMPLINK": "int:3", + "AF_INET": "int:2", + "AF_INET6": "int:28", + "AF_INET6_SDP": "int:42", + "AF_INET_SDP": "int:40", + "AF_IPX": "int:23", + "AF_ISDN": "int:26", + "AF_ISO": "int:7", + "AF_LAT": "int:14", + "AF_LINK": "int:18", + "AF_LOCAL": "int:1", + "AF_MAX": "int:42", + "AF_NATM": "int:29", + "AF_NETBIOS": "int:6", + "AF_NETGRAPH": "int:32", + "AF_OSI": "int:7", + "AF_PUP": "int:4", + "AF_ROUTE": "int:17", + "AF_SCLUSTER": "int:34", + "AF_SIP": "int:24", + "AF_SLOW": "int:33", + "AF_SNA": "int:11", + "AF_UNIX": "int:1", + "AF_UNSPEC": "int:0", + "AF_VENDOR00": "int:39", + "AF_VENDOR01": "int:41", + "AF_VENDOR02": "int:43", + "AF_VENDOR03": "int:45", + "AF_VENDOR04": "int:47", + "AF_VENDOR05": "int:49", + "AF_VENDOR06": "int:51", + "AF_VENDOR07": "int:53", + "AF_VENDOR08": "int:55", + "AF_VENDOR09": "int:57", + "AF_VENDOR10": "int:59", + "AF_VENDOR11": "int:61", + "AF_VENDOR12": "int:63", + "AF_VENDOR13": "int:65", + "AF_VENDOR14": "int:67", + "AF_VENDOR15": "int:69", + "AF_VENDOR16": "int:71", + "AF_VENDOR17": "int:73", + "AF_VENDOR18": "int:75", + "AF_VENDOR19": "int:77", + "AF_VENDOR20": "int:79", + "AF_VENDOR21": "int:81", + "AF_VENDOR22": "int:83", + "AF_VENDOR23": "int:85", + "AF_VENDOR24": "int:87", + "AF_VENDOR25": "int:89", + "AF_VENDOR26": "int:91", + "AF_VENDOR27": "int:93", + "AF_VENDOR28": "int:95", + "AF_VENDOR29": "int:97", + "AF_VENDOR30": "int:99", + "AF_VENDOR31": "int:101", + "AF_VENDOR32": "int:103", + "AF_VENDOR33": "int:105", + "AF_VENDOR34": "int:107", + "AF_VENDOR35": "int:109", + "AF_VENDOR36": "int:111", + "AF_VENDOR37": "int:113", + "AF_VENDOR38": "int:115", + "AF_VENDOR39": "int:117", + "AF_VENDOR40": "int:119", + "AF_VENDOR41": "int:121", + "AF_VENDOR42": "int:123", + "AF_VENDOR43": "int:125", + "AF_VENDOR44": "int:127", + "AF_VENDOR45": "int:129", + "AF_VENDOR46": "int:131", + "AF_VENDOR47": "int:133", + "B0": "int:0", + "B110": "int:110", + "B115200": "int:115200", + "B1200": "int:1200", + "B134": "int:134", + "B14400": "int:14400", + "B150": "int:150", + "B1800": "int:1800", + "B19200": "int:19200", + "B200": "int:200", + "B230400": "int:230400", + "B2400": "int:2400", + "B28800": "int:28800", + "B300": "int:300", + "B38400": "int:38400", + "B460800": "int:460800", + "B4800": "int:4800", + "B50": "int:50", + "B57600": "int:57600", + "B600": "int:600", + "B7200": "int:7200", + "B75": "int:75", + "B76800": "int:76800", + "B921600": "int:921600", + "B9600": "int:9600", + "BIOCFEEDBACK": "int:2147762812", + "BIOCFLUSH": "int:536887912", + "BIOCGBLEN": "int:1074020966", + "BIOCGDIRECTION": "int:1074020982", + "BIOCGDLT": "int:1074020970", + "BIOCGDLTLIST": "int:3221766777", + "BIOCGETBUFMODE": "int:1074020989", + "BIOCGETIF": "int:1075855979", + "BIOCGETZMAX": "int:1074020991", + "BIOCGHDRCMPLT": "int:1074020980", + "BIOCGRSIG": "int:1074020978", + "BIOCGRTIMEOUT": "int:1074283118", + "BIOCGSEESENT": "int:1074020982", + "BIOCGSTATS": "int:1074283119", + "BIOCGTSTAMP": "int:1074020995", + "BIOCIMMEDIATE": "int:2147762800", + "BIOCLOCK": "int:536887930", + "BIOCPROMISC": "int:536887913", + "BIOCROTZBUF": "int:1074545280", + "BIOCSBLEN": "int:3221504614", + "BIOCSDIRECTION": "int:2147762807", + "BIOCSDLT": "int:2147762808", + "BIOCSETBUFMODE": "int:2147762814", + "BIOCSETF": "int:2148024935", + "BIOCSETFNR": "int:2148024962", + "BIOCSETIF": "int:2149597804", + "BIOCSETWF": "int:2148024955", + "BIOCSETZBUF": "int:2148287105", + "BIOCSHDRCMPLT": "int:2147762805", + "BIOCSRSIG": "int:2147762803", + "BIOCSRTIMEOUT": "int:2148024941", + "BIOCSSEESENT": "int:2147762807", + "BIOCSTSTAMP": "int:2147762820", + "BIOCVERSION": "int:1074020977", + "BPF_A": "int:16", + "BPF_ABS": "int:32", + "BPF_ADD": "int:0", + "BPF_ALIGNMENT": "int:4", + "BPF_ALU": "int:4", + "BPF_AND": "int:80", + "BPF_B": "int:16", + "BPF_BUFMODE_BUFFER": "int:1", + "BPF_BUFMODE_ZBUF": "int:2", + "BPF_DIV": "int:48", + "BPF_H": "int:8", + "BPF_IMM": "int:0", + "BPF_IND": "int:64", + "BPF_JA": "int:0", + "BPF_JEQ": "int:16", + "BPF_JGE": "int:48", + "BPF_JGT": "int:32", + "BPF_JMP": "int:5", + "BPF_JSET": "int:64", + "BPF_K": "int:0", + "BPF_LD": "int:0", + "BPF_LDX": "int:1", + "BPF_LEN": "int:128", + "BPF_LSH": "int:96", + "BPF_MAJOR_VERSION": "int:1", + "BPF_MAXBUFSIZE": "int:524288", + "BPF_MAXINSNS": "int:512", + "BPF_MEM": "int:96", + "BPF_MEMWORDS": "int:16", + "BPF_MINBUFSIZE": "int:32", + "BPF_MINOR_VERSION": "int:1", + "BPF_MISC": "int:7", + "BPF_MSH": "int:160", + "BPF_MUL": "int:32", + "BPF_NEG": "int:128", + "BPF_OR": "int:64", + "BPF_RELEASE": "int:199606", + "BPF_RET": "int:6", + "BPF_RSH": "int:112", + "BPF_ST": "int:2", + "BPF_STX": "int:3", + "BPF_SUB": "int:16", + "BPF_TAX": "int:0", + "BPF_TXA": "int:128", + "BPF_T_BINTIME": "int:2", + "BPF_T_BINTIME_FAST": "int:258", + "BPF_T_BINTIME_MONOTONIC": "int:514", + "BPF_T_BINTIME_MONOTONIC_FAST": "int:770", + "BPF_T_FAST": "int:256", + "BPF_T_FLAG_MASK": "int:768", + "BPF_T_FORMAT_MASK": "int:3", + "BPF_T_MICROTIME": "int:0", + "BPF_T_MICROTIME_FAST": "int:256", + "BPF_T_MICROTIME_MONOTONIC": "int:512", + "BPF_T_MICROTIME_MONOTONIC_FAST": "int:768", + "BPF_T_MONOTONIC": "int:512", + "BPF_T_MONOTONIC_FAST": "int:768", + "BPF_T_NANOTIME": "int:1", + "BPF_T_NANOTIME_FAST": "int:257", + "BPF_T_NANOTIME_MONOTONIC": "int:513", + "BPF_T_NANOTIME_MONOTONIC_FAST": "int:769", + "BPF_T_NONE": "int:3", + "BPF_T_NORMAL": "int:0", + "BPF_W": "int:0", + "BPF_X": "int:8", + "BRKINT": "int:2", + "CFLUSH": "int:15", + "CLOCAL": "int:32768", + "CREAD": "int:2048", + "CS5": "int:0", + "CS6": "int:256", + "CS7": "int:512", + "CS8": "int:768", + "CSIZE": "int:768", + "CSTART": "int:17", + "CSTATUS": "int:20", + "CSTOP": "int:19", + "CSTOPB": "int:1024", + "CSUSP": "int:26", + "CTL_MAXNAME": "int:24", + "CTL_NET": "int:4", + "DLT_A429": "int:184", + "DLT_A653_ICM": "int:185", + "DLT_AIRONET_HEADER": "int:120", + "DLT_AOS": "int:222", + "DLT_APPLE_IP_OVER_IEEE1394": "int:138", + "DLT_ARCNET": "int:7", + "DLT_ARCNET_LINUX": "int:129", + "DLT_ATM_CLIP": "int:19", + "DLT_ATM_RFC1483": "int:11", + "DLT_AURORA": "int:126", + "DLT_AX25": "int:3", + "DLT_AX25_KISS": "int:202", + "DLT_BACNET_MS_TP": "int:165", + "DLT_BLUETOOTH_HCI_H4": "int:187", + "DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "int:201", + "DLT_CAN20B": "int:190", + "DLT_CAN_SOCKETCAN": "int:227", + "DLT_CHAOS": "int:5", + "DLT_CHDLC": "int:104", + "DLT_CISCO_IOS": "int:118", + "DLT_C_HDLC": "int:104", + "DLT_C_HDLC_WITH_DIR": "int:205", + "DLT_DBUS": "int:231", + "DLT_DECT": "int:221", + "DLT_DOCSIS": "int:143", + "DLT_DVB_CI": "int:235", + "DLT_ECONET": "int:115", + "DLT_EN10MB": "int:1", + "DLT_EN3MB": "int:2", + "DLT_ENC": "int:109", + "DLT_ERF": "int:197", + "DLT_ERF_ETH": "int:175", + "DLT_ERF_POS": "int:176", + "DLT_FC_2": "int:224", + "DLT_FC_2_WITH_FRAME_DELIMS": "int:225", + "DLT_FDDI": "int:10", + "DLT_FLEXRAY": "int:210", + "DLT_FRELAY": "int:107", + "DLT_FRELAY_WITH_DIR": "int:206", + "DLT_GCOM_SERIAL": "int:173", + "DLT_GCOM_T1E1": "int:172", + "DLT_GPF_F": "int:171", + "DLT_GPF_T": "int:170", + "DLT_GPRS_LLC": "int:169", + "DLT_GSMTAP_ABIS": "int:218", + "DLT_GSMTAP_UM": "int:217", + "DLT_HHDLC": "int:121", + "DLT_IBM_SN": "int:146", + "DLT_IBM_SP": "int:145", + "DLT_IEEE802": "int:6", + "DLT_IEEE802_11": "int:105", + "DLT_IEEE802_11_RADIO": "int:127", + "DLT_IEEE802_11_RADIO_AVS": "int:163", + "DLT_IEEE802_15_4": "int:195", + "DLT_IEEE802_15_4_LINUX": "int:191", + "DLT_IEEE802_15_4_NOFCS": "int:230", + "DLT_IEEE802_15_4_NONASK_PHY": "int:215", + "DLT_IEEE802_16_MAC_CPS": "int:188", + "DLT_IEEE802_16_MAC_CPS_RADIO": "int:193", + "DLT_IPFILTER": "int:116", + "DLT_IPMB": "int:199", + "DLT_IPMB_LINUX": "int:209", + "DLT_IPNET": "int:226", + "DLT_IPOIB": "int:242", + "DLT_IPV4": "int:228", + "DLT_IPV6": "int:229", + "DLT_IP_OVER_FC": "int:122", + "DLT_JUNIPER_ATM1": "int:137", + "DLT_JUNIPER_ATM2": "int:135", + "DLT_JUNIPER_ATM_CEMIC": "int:238", + "DLT_JUNIPER_CHDLC": "int:181", + "DLT_JUNIPER_ES": "int:132", + "DLT_JUNIPER_ETHER": "int:178", + "DLT_JUNIPER_FIBRECHANNEL": "int:234", + "DLT_JUNIPER_FRELAY": "int:180", + "DLT_JUNIPER_GGSN": "int:133", + "DLT_JUNIPER_ISM": "int:194", + "DLT_JUNIPER_MFR": "int:134", + "DLT_JUNIPER_MLFR": "int:131", + "DLT_JUNIPER_MLPPP": "int:130", + "DLT_JUNIPER_MONITOR": "int:164", + "DLT_JUNIPER_PIC_PEER": "int:174", + "DLT_JUNIPER_PPP": "int:179", + "DLT_JUNIPER_PPPOE": "int:167", + "DLT_JUNIPER_PPPOE_ATM": "int:168", + "DLT_JUNIPER_SERVICES": "int:136", + "DLT_JUNIPER_SRX_E2E": "int:233", + "DLT_JUNIPER_ST": "int:200", + "DLT_JUNIPER_VP": "int:183", + "DLT_JUNIPER_VS": "int:232", + "DLT_LAPB_WITH_DIR": "int:207", + "DLT_LAPD": "int:203", + "DLT_LIN": "int:212", + "DLT_LINUX_EVDEV": "int:216", + "DLT_LINUX_IRDA": "int:144", + "DLT_LINUX_LAPD": "int:177", + "DLT_LINUX_PPP_WITHDIRECTION": "int:166", + "DLT_LINUX_SLL": "int:113", + "DLT_LOOP": "int:108", + "DLT_LTALK": "int:114", + "DLT_MATCHING_MAX": "int:246", + "DLT_MATCHING_MIN": "int:104", + "DLT_MFR": "int:182", + "DLT_MOST": "int:211", + "DLT_MPEG_2_TS": "int:243", + "DLT_MPLS": "int:219", + "DLT_MTP2": "int:140", + "DLT_MTP2_WITH_PHDR": "int:139", + "DLT_MTP3": "int:141", + "DLT_MUX27010": "int:236", + "DLT_NETANALYZER": "int:240", + "DLT_NETANALYZER_TRANSPARENT": "int:241", + "DLT_NFC_LLCP": "int:245", + "DLT_NFLOG": "int:239", + "DLT_NG40": "int:244", + "DLT_NULL": "int:0", + "DLT_PCI_EXP": "int:125", + "DLT_PFLOG": "int:117", + "DLT_PFSYNC": "int:121", + "DLT_PPI": "int:192", + "DLT_PPP": "int:9", + "DLT_PPP_BSDOS": "int:16", + "DLT_PPP_ETHER": "int:51", + "DLT_PPP_PPPD": "int:166", + "DLT_PPP_SERIAL": "int:50", + "DLT_PPP_WITH_DIR": "int:204", + "DLT_PPP_WITH_DIRECTION": "int:166", + "DLT_PRISM_HEADER": "int:119", + "DLT_PRONET": "int:4", + "DLT_RAIF1": "int:198", + "DLT_RAW": "int:12", + "DLT_RIO": "int:124", + "DLT_SCCP": "int:142", + "DLT_SITA": "int:196", + "DLT_SLIP": "int:8", + "DLT_SLIP_BSDOS": "int:15", + "DLT_STANAG_5066_D_PDU": "int:237", + "DLT_SUNATM": "int:123", + "DLT_SYMANTEC_FIREWALL": "int:99", + "DLT_TZSP": "int:128", + "DLT_USB": "int:186", + "DLT_USB_LINUX": "int:189", + "DLT_USB_LINUX_MMAPPED": "int:220", + "DLT_USER0": "int:147", + "DLT_USER1": "int:148", + "DLT_USER10": "int:157", + "DLT_USER11": "int:158", + "DLT_USER12": "int:159", + "DLT_USER13": "int:160", + "DLT_USER14": "int:161", + "DLT_USER15": "int:162", + "DLT_USER2": "int:149", + "DLT_USER3": "int:150", + "DLT_USER4": "int:151", + "DLT_USER5": "int:152", + "DLT_USER6": "int:153", + "DLT_USER7": "int:154", + "DLT_USER8": "int:155", + "DLT_USER9": "int:156", + "DLT_WIHART": "int:223", + "DLT_X2E_SERIAL": "int:213", + "DLT_X2E_XORAYA": "int:214", + "DT_BLK": "int:6", + "DT_CHR": "int:2", + "DT_DIR": "int:4", + "DT_FIFO": "int:1", + "DT_LNK": "int:10", + "DT_REG": "int:8", + "DT_SOCK": "int:12", + "DT_UNKNOWN": "int:0", + "DT_WHT": "int:14", + "ECHO": "int:8", + "ECHOCTL": "int:64", + "ECHOE": "int:2", + "ECHOK": "int:4", + "ECHOKE": "int:1", + "ECHONL": "int:16", + "ECHOPRT": "int:32", + "EVFILT_AIO": "int:-3", + "EVFILT_FS": "int:-9", + "EVFILT_LIO": "int:-10", + "EVFILT_PROC": "int:-5", + "EVFILT_READ": "int:-1", + "EVFILT_SIGNAL": "int:-6", + "EVFILT_SYSCOUNT": "int:11", + "EVFILT_TIMER": "int:-7", + "EVFILT_USER": "int:-11", + "EVFILT_VNODE": "int:-4", + "EVFILT_WRITE": "int:-2", + "EV_ADD": "int:1", + "EV_CLEAR": "int:32", + "EV_DELETE": "int:2", + "EV_DISABLE": "int:8", + "EV_DISPATCH": "int:128", + "EV_DROP": "int:4096", + "EV_ENABLE": "int:4", + "EV_EOF": "int:32768", + "EV_ERROR": "int:16384", + "EV_FLAG1": "int:8192", + "EV_ONESHOT": "int:16", + "EV_RECEIPT": "int:64", + "EV_SYSFLAGS": "int:61440", + "EXTA": "int:19200", + "EXTB": "int:38400", + "EXTPROC": "int:2048", + "FD_CLOEXEC": "int:1", + "FD_SETSIZE": "int:1024", + "FLUSHO": "int:8388608", + "F_CANCEL": "int:5", + "F_DUP2FD": "int:10", + "F_DUP2FD_CLOEXEC": "int:18", + "F_DUPFD": "int:0", + "F_DUPFD_CLOEXEC": "int:17", + "F_GETFD": "int:1", + "F_GETFL": "int:3", + "F_GETLK": "int:11", + "F_GETOWN": "int:5", + "F_OGETLK": "int:7", + "F_OK": "int:0", + "F_OSETLK": "int:8", + "F_OSETLKW": "int:9", + "F_RDAHEAD": "int:16", + "F_RDLCK": "int:1", + "F_READAHEAD": "int:15", + "F_SETFD": "int:2", + "F_SETFL": "int:4", + "F_SETLK": "int:12", + "F_SETLKW": "int:13", + "F_SETLK_REMOTE": "int:14", + "F_SETOWN": "int:6", + "F_UNLCK": "int:2", + "F_UNLCKSYS": "int:4", + "F_WRLCK": "int:3", + "HUPCL": "int:16384", + "ICANON": "int:256", + "ICMP6_FILTER": "int:18", + "ICRNL": "int:256", + "IEXTEN": "int:1024", + "IFAN_ARRIVAL": "int:0", + "IFAN_DEPARTURE": "int:1", + "IFF_ALLMULTI": "int:512", + "IFF_ALTPHYS": "int:16384", + "IFF_BROADCAST": "int:2", + "IFF_CANTCHANGE": "int:2199410", + "IFF_CANTCONFIG": "int:65536", + "IFF_DEBUG": "int:4", + "IFF_DRV_OACTIVE": "int:1024", + "IFF_DRV_RUNNING": "int:64", + "IFF_DYING": "int:2097152", + "IFF_LINK0": "int:4096", + "IFF_LINK1": "int:8192", + "IFF_LINK2": "int:16384", + "IFF_LOOPBACK": "int:8", + "IFF_MONITOR": "int:262144", + "IFF_MULTICAST": "int:32768", + "IFF_NOARP": "int:128", + "IFF_OACTIVE": "int:1024", + "IFF_POINTOPOINT": "int:16", + "IFF_PPROMISC": "int:131072", + "IFF_PROMISC": "int:256", + "IFF_RENAMING": "int:4194304", + "IFF_RUNNING": "int:64", + "IFF_SIMPLEX": "int:2048", + "IFF_SMART": "int:32", + "IFF_STATICARP": "int:524288", + "IFF_UP": "int:1", + "IFNAMSIZ": "int:16", + "IFT_1822": "int:2", + "IFT_A12MPPSWITCH": "int:130", + "IFT_AAL2": "int:187", + "IFT_AAL5": "int:49", + "IFT_ADSL": "int:94", + "IFT_AFLANE8023": "int:59", + "IFT_AFLANE8025": "int:60", + "IFT_ARAP": "int:88", + "IFT_ARCNET": "int:35", + "IFT_ARCNETPLUS": "int:36", + "IFT_ASYNC": "int:84", + "IFT_ATM": "int:37", + "IFT_ATMDXI": "int:105", + "IFT_ATMFUNI": "int:106", + "IFT_ATMIMA": "int:107", + "IFT_ATMLOGICAL": "int:80", + "IFT_ATMRADIO": "int:189", + "IFT_ATMSUBINTERFACE": "int:134", + "IFT_ATMVCIENDPT": "int:194", + "IFT_ATMVIRTUAL": "int:149", + "IFT_BGPPOLICYACCOUNTING": "int:162", + "IFT_BRIDGE": "int:209", + "IFT_BSC": "int:83", + "IFT_CARP": "int:248", + "IFT_CCTEMUL": "int:61", + "IFT_CEPT": "int:19", + "IFT_CES": "int:133", + "IFT_CHANNEL": "int:70", + "IFT_CNR": "int:85", + "IFT_COFFEE": "int:132", + "IFT_COMPOSITELINK": "int:155", + "IFT_DCN": "int:141", + "IFT_DIGITALPOWERLINE": "int:138", + "IFT_DIGITALWRAPPEROVERHEADCHANNEL": "int:186", + "IFT_DLSW": "int:74", + "IFT_DOCSCABLEDOWNSTREAM": "int:128", + "IFT_DOCSCABLEMACLAYER": "int:127", + "IFT_DOCSCABLEUPSTREAM": "int:129", + "IFT_DS0": "int:81", + "IFT_DS0BUNDLE": "int:82", + "IFT_DS1FDL": "int:170", + "IFT_DS3": "int:30", + "IFT_DTM": "int:140", + "IFT_DVBASILN": "int:172", + "IFT_DVBASIOUT": "int:173", + "IFT_DVBRCCDOWNSTREAM": "int:147", + "IFT_DVBRCCMACLAYER": "int:146", + "IFT_DVBRCCUPSTREAM": "int:148", + "IFT_ENC": "int:244", + "IFT_EON": "int:25", + "IFT_EPLRS": "int:87", + "IFT_ESCON": "int:73", + "IFT_ETHER": "int:6", + "IFT_FAITH": "int:242", + "IFT_FAST": "int:125", + "IFT_FASTETHER": "int:62", + "IFT_FASTETHERFX": "int:69", + "IFT_FDDI": "int:15", + "IFT_FIBRECHANNEL": "int:56", + "IFT_FRAMERELAYINTERCONNECT": "int:58", + "IFT_FRAMERELAYMPI": "int:92", + "IFT_FRDLCIENDPT": "int:193", + "IFT_FRELAY": "int:32", + "IFT_FRELAYDCE": "int:44", + "IFT_FRF16MFRBUNDLE": "int:163", + "IFT_FRFORWARD": "int:158", + "IFT_G703AT2MB": "int:67", + "IFT_G703AT64K": "int:66", + "IFT_GIF": "int:240", + "IFT_GIGABITETHERNET": "int:117", + "IFT_GR303IDT": "int:178", + "IFT_GR303RDT": "int:177", + "IFT_H323GATEKEEPER": "int:164", + "IFT_H323PROXY": "int:165", + "IFT_HDH1822": "int:3", + "IFT_HDLC": "int:118", + "IFT_HDSL2": "int:168", + "IFT_HIPERLAN2": "int:183", + "IFT_HIPPI": "int:47", + "IFT_HIPPIINTERFACE": "int:57", + "IFT_HOSTPAD": "int:90", + "IFT_HSSI": "int:46", + "IFT_HY": "int:14", + "IFT_IBM370PARCHAN": "int:72", + "IFT_IDSL": "int:154", + "IFT_IEEE1394": "int:144", + "IFT_IEEE80211": "int:71", + "IFT_IEEE80212": "int:55", + "IFT_IEEE8023ADLAG": "int:161", + "IFT_IFGSN": "int:145", + "IFT_IMT": "int:190", + "IFT_INFINIBAND": "int:199", + "IFT_INTERLEAVE": "int:124", + "IFT_IP": "int:126", + "IFT_IPFORWARD": "int:142", + "IFT_IPOVERATM": "int:114", + "IFT_IPOVERCDLC": "int:109", + "IFT_IPOVERCLAW": "int:110", + "IFT_IPSWITCH": "int:78", + "IFT_IPXIP": "int:249", + "IFT_ISDN": "int:63", + "IFT_ISDNBASIC": "int:20", + "IFT_ISDNPRIMARY": "int:21", + "IFT_ISDNS": "int:75", + "IFT_ISDNU": "int:76", + "IFT_ISO88022LLC": "int:41", + "IFT_ISO88023": "int:7", + "IFT_ISO88024": "int:8", + "IFT_ISO88025": "int:9", + "IFT_ISO88025CRFPINT": "int:98", + "IFT_ISO88025DTR": "int:86", + "IFT_ISO88025FIBER": "int:115", + "IFT_ISO88026": "int:10", + "IFT_ISUP": "int:179", + "IFT_L2VLAN": "int:135", + "IFT_L3IPVLAN": "int:136", + "IFT_L3IPXVLAN": "int:137", + "IFT_LAPB": "int:16", + "IFT_LAPD": "int:77", + "IFT_LAPF": "int:119", + "IFT_LOCALTALK": "int:42", + "IFT_LOOP": "int:24", + "IFT_MEDIAMAILOVERIP": "int:139", + "IFT_MFSIGLINK": "int:167", + "IFT_MIOX25": "int:38", + "IFT_MODEM": "int:48", + "IFT_MPC": "int:113", + "IFT_MPLS": "int:166", + "IFT_MPLSTUNNEL": "int:150", + "IFT_MSDSL": "int:143", + "IFT_MVL": "int:191", + "IFT_MYRINET": "int:99", + "IFT_NFAS": "int:175", + "IFT_NSIP": "int:27", + "IFT_OPTICALCHANNEL": "int:195", + "IFT_OPTICALTRANSPORT": "int:196", + "IFT_OTHER": "int:1", + "IFT_P10": "int:12", + "IFT_P80": "int:13", + "IFT_PARA": "int:34", + "IFT_PFLOG": "int:246", + "IFT_PFSYNC": "int:247", + "IFT_PLC": "int:174", + "IFT_POS": "int:171", + "IFT_PPP": "int:23", + "IFT_PPPMULTILINKBUNDLE": "int:108", + "IFT_PROPBWAP2MP": "int:184", + "IFT_PROPCNLS": "int:89", + "IFT_PROPDOCSWIRELESSDOWNSTREAM": "int:181", + "IFT_PROPDOCSWIRELESSMACLAYER": "int:180", + "IFT_PROPDOCSWIRELESSUPSTREAM": "int:182", + "IFT_PROPMUX": "int:54", + "IFT_PROPVIRTUAL": "int:53", + "IFT_PROPWIRELESSP2P": "int:157", + "IFT_PTPSERIAL": "int:22", + "IFT_PVC": "int:241", + "IFT_QLLC": "int:68", + "IFT_RADIOMAC": "int:188", + "IFT_RADSL": "int:95", + "IFT_REACHDSL": "int:192", + "IFT_RFC1483": "int:159", + "IFT_RS232": "int:33", + "IFT_RSRB": "int:79", + "IFT_SDLC": "int:17", + "IFT_SDSL": "int:96", + "IFT_SHDSL": "int:169", + "IFT_SIP": "int:31", + "IFT_SLIP": "int:28", + "IFT_SMDSDXI": "int:43", + "IFT_SMDSICIP": "int:52", + "IFT_SONET": "int:39", + "IFT_SONETOVERHEADCHANNEL": "int:185", + "IFT_SONETPATH": "int:50", + "IFT_SONETVT": "int:51", + "IFT_SRP": "int:151", + "IFT_SS7SIGLINK": "int:156", + "IFT_STACKTOSTACK": "int:111", + "IFT_STARLAN": "int:11", + "IFT_STF": "int:215", + "IFT_T1": "int:18", + "IFT_TDLC": "int:116", + "IFT_TERMPAD": "int:91", + "IFT_TR008": "int:176", + "IFT_TRANSPHDLC": "int:123", + "IFT_TUNNEL": "int:131", + "IFT_ULTRA": "int:29", + "IFT_USB": "int:160", + "IFT_V11": "int:64", + "IFT_V35": "int:45", + "IFT_V36": "int:65", + "IFT_V37": "int:120", + "IFT_VDSL": "int:97", + "IFT_VIRTUALIPADDRESS": "int:112", + "IFT_VOICEEM": "int:100", + "IFT_VOICEENCAP": "int:103", + "IFT_VOICEFXO": "int:101", + "IFT_VOICEFXS": "int:102", + "IFT_VOICEOVERATM": "int:152", + "IFT_VOICEOVERFRAMERELAY": "int:153", + "IFT_VOICEOVERIP": "int:104", + "IFT_X213": "int:93", + "IFT_X25": "int:5", + "IFT_X25DDN": "int:4", + "IFT_X25HUNTGROUP": "int:122", + "IFT_X25MLP": "int:121", + "IFT_X25PLE": "int:40", + "IFT_XETHER": "int:26", + "IGNBRK": "int:1", + "IGNCR": "int:128", + "IGNPAR": "int:4", + "IMAXBEL": "int:8192", + "INLCR": "int:64", + "INPCK": "int:16", + "IN_CLASSA_HOST": "int:16777215", + "IN_CLASSA_MAX": "int:128", + "IN_CLASSA_NET": "int:4278190080", + "IN_CLASSA_NSHIFT": "int:24", + "IN_CLASSB_HOST": "int:65535", + "IN_CLASSB_MAX": "int:65536", + "IN_CLASSB_NET": "int:4294901760", + "IN_CLASSB_NSHIFT": "int:16", + "IN_CLASSC_HOST": "int:255", + "IN_CLASSC_NET": "int:4294967040", + "IN_CLASSC_NSHIFT": "int:8", + "IN_CLASSD_HOST": "int:268435455", + "IN_CLASSD_NET": "int:4026531840", + "IN_CLASSD_NSHIFT": "int:28", + "IN_LOOPBACKNET": "int:127", + "IN_RFC3021_MASK": "int:4294967294", + "IPPROTO_3PC": "int:34", + "IPPROTO_ADFS": "int:68", + "IPPROTO_AH": "int:51", + "IPPROTO_AHIP": "int:61", + "IPPROTO_APES": "int:99", + "IPPROTO_ARGUS": "int:13", + "IPPROTO_AX25": "int:93", + "IPPROTO_BHA": "int:49", + "IPPROTO_BLT": "int:30", + "IPPROTO_BRSATMON": "int:76", + "IPPROTO_CARP": "int:112", + "IPPROTO_CFTP": "int:62", + "IPPROTO_CHAOS": "int:16", + "IPPROTO_CMTP": "int:38", + "IPPROTO_CPHB": "int:73", + "IPPROTO_CPNX": "int:72", + "IPPROTO_DDP": "int:37", + "IPPROTO_DGP": "int:86", + "IPPROTO_DIVERT": "int:258", + "IPPROTO_DONE": "int:257", + "IPPROTO_DSTOPTS": "int:60", + "IPPROTO_EGP": "int:8", + "IPPROTO_EMCON": "int:14", + "IPPROTO_ENCAP": "int:98", + "IPPROTO_EON": "int:80", + "IPPROTO_ESP": "int:50", + "IPPROTO_ETHERIP": "int:97", + "IPPROTO_FRAGMENT": "int:44", + "IPPROTO_GGP": "int:3", + "IPPROTO_GMTP": "int:100", + "IPPROTO_GRE": "int:47", + "IPPROTO_HELLO": "int:63", + "IPPROTO_HMP": "int:20", + "IPPROTO_HOPOPTS": "int:0", + "IPPROTO_ICMP": "int:1", + "IPPROTO_ICMPV6": "int:58", + "IPPROTO_IDP": "int:22", + "IPPROTO_IDPR": "int:35", + "IPPROTO_IDRP": "int:45", + "IPPROTO_IGMP": "int:2", + "IPPROTO_IGP": "int:85", + "IPPROTO_IGRP": "int:88", + "IPPROTO_IL": "int:40", + "IPPROTO_INLSP": "int:52", + "IPPROTO_INP": "int:32", + "IPPROTO_IP": "int:0", + "IPPROTO_IPCOMP": "int:108", + "IPPROTO_IPCV": "int:71", + "IPPROTO_IPEIP": "int:94", + "IPPROTO_IPIP": "int:4", + "IPPROTO_IPPC": "int:67", + "IPPROTO_IPV4": "int:4", + "IPPROTO_IPV6": "int:41", + "IPPROTO_IRTP": "int:28", + "IPPROTO_KRYPTOLAN": "int:65", + "IPPROTO_LARP": "int:91", + "IPPROTO_LEAF1": "int:25", + "IPPROTO_LEAF2": "int:26", + "IPPROTO_MAX": "int:256", + "IPPROTO_MAXID": "int:52", + "IPPROTO_MEAS": "int:19", + "IPPROTO_MH": "int:135", + "IPPROTO_MHRP": "int:48", + "IPPROTO_MICP": "int:95", + "IPPROTO_MOBILE": "int:55", + "IPPROTO_MPLS": "int:137", + "IPPROTO_MTP": "int:92", + "IPPROTO_MUX": "int:18", + "IPPROTO_ND": "int:77", + "IPPROTO_NHRP": "int:54", + "IPPROTO_NONE": "int:59", + "IPPROTO_NSP": "int:31", + "IPPROTO_NVPII": "int:11", + "IPPROTO_OLD_DIVERT": "int:254", + "IPPROTO_OSPFIGP": "int:89", + "IPPROTO_PFSYNC": "int:240", + "IPPROTO_PGM": "int:113", + "IPPROTO_PIGP": "int:9", + "IPPROTO_PIM": "int:103", + "IPPROTO_PRM": "int:21", + "IPPROTO_PUP": "int:12", + "IPPROTO_PVP": "int:75", + "IPPROTO_RAW": "int:255", + "IPPROTO_RCCMON": "int:10", + "IPPROTO_RDP": "int:27", + "IPPROTO_ROUTING": "int:43", + "IPPROTO_RSVP": "int:46", + "IPPROTO_RVD": "int:66", + "IPPROTO_SATEXPAK": "int:64", + "IPPROTO_SATMON": "int:69", + "IPPROTO_SCCSP": "int:96", + "IPPROTO_SCTP": "int:132", + "IPPROTO_SDRP": "int:42", + "IPPROTO_SEND": "int:259", + "IPPROTO_SEP": "int:33", + "IPPROTO_SKIP": "int:57", + "IPPROTO_SPACER": "int:32767", + "IPPROTO_SRPC": "int:90", + "IPPROTO_ST": "int:7", + "IPPROTO_SVMTP": "int:82", + "IPPROTO_SWIPE": "int:53", + "IPPROTO_TCF": "int:87", + "IPPROTO_TCP": "int:6", + "IPPROTO_TLSP": "int:56", + "IPPROTO_TP": "int:29", + "IPPROTO_TPXX": "int:39", + "IPPROTO_TRUNK1": "int:23", + "IPPROTO_TRUNK2": "int:24", + "IPPROTO_TTP": "int:84", + "IPPROTO_UDP": "int:17", + "IPPROTO_VINES": "int:83", + "IPPROTO_VISA": "int:70", + "IPPROTO_VMTP": "int:81", + "IPPROTO_WBEXPAK": "int:79", + "IPPROTO_WBMON": "int:78", + "IPPROTO_WSN": "int:74", + "IPPROTO_XNET": "int:15", + "IPPROTO_XTP": "int:36", + "IPV6_AUTOFLOWLABEL": "int:59", + "IPV6_BINDANY": "int:64", + "IPV6_BINDV6ONLY": "int:27", + "IPV6_CHECKSUM": "int:26", + "IPV6_DEFAULT_MULTICAST_HOPS": "int:1", + "IPV6_DEFAULT_MULTICAST_LOOP": "int:1", + "IPV6_DEFHLIM": "int:64", + "IPV6_DONTFRAG": "int:62", + "IPV6_DSTOPTS": "int:50", + "IPV6_FAITH": "int:29", + "IPV6_FLOWINFO_MASK": "int:4294967055", + "IPV6_FLOWLABEL_MASK": "int:4294905600", + "IPV6_FRAGTTL": "int:120", + "IPV6_FW_ADD": "int:30", + "IPV6_FW_DEL": "int:31", + "IPV6_FW_FLUSH": "int:32", + "IPV6_FW_GET": "int:34", + "IPV6_FW_ZERO": "int:33", + "IPV6_HLIMDEC": "int:1", + "IPV6_HOPLIMIT": "int:47", + "IPV6_HOPOPTS": "int:49", + "IPV6_IPSEC_POLICY": "int:28", + "IPV6_JOIN_GROUP": "int:12", + "IPV6_LEAVE_GROUP": "int:13", + "IPV6_MAXHLIM": "int:255", + "IPV6_MAXOPTHDR": "int:2048", + "IPV6_MAXPACKET": "int:65535", + "IPV6_MAX_GROUP_SRC_FILTER": "int:512", + "IPV6_MAX_MEMBERSHIPS": "int:4095", + "IPV6_MAX_SOCK_SRC_FILTER": "int:128", + "IPV6_MIN_MEMBERSHIPS": "int:31", + "IPV6_MMTU": "int:1280", + "IPV6_MSFILTER": "int:74", + "IPV6_MULTICAST_HOPS": "int:10", + "IPV6_MULTICAST_IF": "int:9", + "IPV6_MULTICAST_LOOP": "int:11", + "IPV6_NEXTHOP": "int:48", + "IPV6_PATHMTU": "int:44", + "IPV6_PKTINFO": "int:46", + "IPV6_PORTRANGE": "int:14", + "IPV6_PORTRANGE_DEFAULT": "int:0", + "IPV6_PORTRANGE_HIGH": "int:1", + "IPV6_PORTRANGE_LOW": "int:2", + "IPV6_PREFER_TEMPADDR": "int:63", + "IPV6_RECVDSTOPTS": "int:40", + "IPV6_RECVHOPLIMIT": "int:37", + "IPV6_RECVHOPOPTS": "int:39", + "IPV6_RECVPATHMTU": "int:43", + "IPV6_RECVPKTINFO": "int:36", + "IPV6_RECVRTHDR": "int:38", + "IPV6_RECVTCLASS": "int:57", + "IPV6_RTHDR": "int:51", + "IPV6_RTHDRDSTOPTS": "int:35", + "IPV6_RTHDR_LOOSE": "int:0", + "IPV6_RTHDR_STRICT": "int:1", + "IPV6_RTHDR_TYPE_0": "int:0", + "IPV6_SOCKOPT_RESERVED1": "int:3", + "IPV6_TCLASS": "int:61", + "IPV6_UNICAST_HOPS": "int:4", + "IPV6_USE_MIN_MTU": "int:42", + "IPV6_V6ONLY": "int:27", + "IPV6_VERSION": "int:96", + "IPV6_VERSION_MASK": "int:240", + "IP_ADD_MEMBERSHIP": "int:12", + "IP_ADD_SOURCE_MEMBERSHIP": "int:70", + "IP_BINDANY": "int:24", + "IP_BLOCK_SOURCE": "int:72", + "IP_DEFAULT_MULTICAST_LOOP": "int:1", + "IP_DEFAULT_MULTICAST_TTL": "int:1", + "IP_DF": "int:16384", + "IP_DONTFRAG": "int:67", + "IP_DROP_MEMBERSHIP": "int:13", + "IP_DROP_SOURCE_MEMBERSHIP": "int:71", + "IP_DUMMYNET3": "int:49", + "IP_DUMMYNET_CONFIGURE": "int:60", + "IP_DUMMYNET_DEL": "int:61", + "IP_DUMMYNET_FLUSH": "int:62", + "IP_DUMMYNET_GET": "int:64", + "IP_FAITH": "int:22", + "IP_FW3": "int:48", + "IP_FW_ADD": "int:50", + "IP_FW_DEL": "int:51", + "IP_FW_FLUSH": "int:52", + "IP_FW_GET": "int:54", + "IP_FW_NAT_CFG": "int:56", + "IP_FW_NAT_DEL": "int:57", + "IP_FW_NAT_GET_CONFIG": "int:58", + "IP_FW_NAT_GET_LOG": "int:59", + "IP_FW_RESETLOG": "int:55", + "IP_FW_TABLE_ADD": "int:40", + "IP_FW_TABLE_DEL": "int:41", + "IP_FW_TABLE_FLUSH": "int:42", + "IP_FW_TABLE_GETSIZE": "int:43", + "IP_FW_TABLE_LIST": "int:44", + "IP_FW_ZERO": "int:53", + "IP_HDRINCL": "int:2", + "IP_IPSEC_POLICY": "int:21", + "IP_MAXPACKET": "int:65535", + "IP_MAX_GROUP_SRC_FILTER": "int:512", + "IP_MAX_MEMBERSHIPS": "int:4095", + "IP_MAX_SOCK_MUTE_FILTER": "int:128", + "IP_MAX_SOCK_SRC_FILTER": "int:128", + "IP_MAX_SOURCE_FILTER": "int:1024", + "IP_MF": "int:8192", + "IP_MINTTL": "int:66", + "IP_MIN_MEMBERSHIPS": "int:31", + "IP_MSFILTER": "int:74", + "IP_MSS": "int:576", + "IP_MULTICAST_IF": "int:9", + "IP_MULTICAST_LOOP": "int:11", + "IP_MULTICAST_TTL": "int:10", + "IP_MULTICAST_VIF": "int:14", + "IP_OFFMASK": "int:8191", + "IP_ONESBCAST": "int:23", + "IP_OPTIONS": "int:1", + "IP_PORTRANGE": "int:19", + "IP_PORTRANGE_DEFAULT": "int:0", + "IP_PORTRANGE_HIGH": "int:1", + "IP_PORTRANGE_LOW": "int:2", + "IP_RECVDSTADDR": "int:7", + "IP_RECVIF": "int:20", + "IP_RECVOPTS": "int:5", + "IP_RECVRETOPTS": "int:6", + "IP_RECVTOS": "int:68", + "IP_RECVTTL": "int:65", + "IP_RETOPTS": "int:8", + "IP_RF": "int:32768", + "IP_RSVP_OFF": "int:16", + "IP_RSVP_ON": "int:15", + "IP_RSVP_VIF_OFF": "int:18", + "IP_RSVP_VIF_ON": "int:17", + "IP_SENDSRCADDR": "int:7", + "IP_TOS": "int:3", + "IP_TTL": "int:4", + "IP_UNBLOCK_SOURCE": "int:73", + "ISIG": "int:128", + "ISTRIP": "int:32", + "IXANY": "int:2048", + "IXOFF": "int:1024", + "IXON": "int:512", + "ImplementsGetwd": "bool:false", + "LOCK_EX": "int:2", + "LOCK_NB": "int:4", + "LOCK_SH": "int:1", + "LOCK_UN": "int:8", + "MADV_AUTOSYNC": "int:7", + "MADV_CORE": "int:9", + "MADV_DONTNEED": "int:4", + "MADV_FREE": "int:5", + "MADV_NOCORE": "int:8", + "MADV_NORMAL": "int:0", + "MADV_NOSYNC": "int:6", + "MADV_PROTECT": "int:10", + "MADV_RANDOM": "int:1", + "MADV_SEQUENTIAL": "int:2", + "MADV_WILLNEED": "int:3", + "MAP_ALIGNED_SUPER": "int:16777216", + "MAP_ALIGNMENT_MASK": "int:-16777216", + "MAP_ALIGNMENT_SHIFT": "int:24", + "MAP_ANON": "int:4096", + "MAP_ANONYMOUS": "int:4096", + "MAP_COPY": "int:2", + "MAP_FILE": "int:0", + "MAP_FIXED": "int:16", + "MAP_HASSEMAPHORE": "int:512", + "MAP_NOCORE": "int:131072", + "MAP_NORESERVE": "int:64", + "MAP_NOSYNC": "int:2048", + "MAP_PREFAULT_READ": "int:262144", + "MAP_PRIVATE": "int:2", + "MAP_RENAME": "int:32", + "MAP_RESERVED0080": "int:128", + "MAP_RESERVED0100": "int:256", + "MAP_SHARED": "int:1", + "MAP_STACK": "int:1024", + "MCL_CURRENT": "int:1", + "MCL_FUTURE": "int:2", + "MSG_CMSG_CLOEXEC": "int:262144", + "MSG_COMPAT": "int:32768", + "MSG_CTRUNC": "int:32", + "MSG_DONTROUTE": "int:4", + "MSG_DONTWAIT": "int:128", + "MSG_EOF": "int:256", + "MSG_EOR": "int:8", + "MSG_NBIO": "int:16384", + "MSG_NOSIGNAL": "int:131072", + "MSG_NOTIFICATION": "int:8192", + "MSG_OOB": "int:1", + "MSG_PEEK": "int:2", + "MSG_TRUNC": "int:16", + "MSG_WAITALL": "int:64", + "MS_ASYNC": "int:1", + "MS_INVALIDATE": "int:2", + "MS_SYNC": "int:0", + "NAME_MAX": "int:255", + "NET_RT_DUMP": "int:1", + "NET_RT_FLAGS": "int:2", + "NET_RT_IFLIST": "int:3", + "NET_RT_IFLISTL": "int:5", + "NET_RT_IFMALIST": "int:4", + "NET_RT_MAXID": "int:6", + "NOFLSH": "int:2147483648", + "NOTE_ATTRIB": "int:8", + "NOTE_CHILD": "int:4", + "NOTE_DELETE": "int:1", + "NOTE_EXEC": "int:536870912", + "NOTE_EXIT": "int:2147483648", + "NOTE_EXTEND": "int:4", + "NOTE_FFAND": "int:1073741824", + "NOTE_FFCOPY": "int:3221225472", + "NOTE_FFCTRLMASK": "int:3221225472", + "NOTE_FFLAGSMASK": "int:16777215", + "NOTE_FFNOP": "int:0", + "NOTE_FFOR": "int:2147483648", + "NOTE_FORK": "int:1073741824", + "NOTE_LINK": "int:16", + "NOTE_LOWAT": "int:1", + "NOTE_PCTRLMASK": "int:4026531840", + "NOTE_PDATAMASK": "int:1048575", + "NOTE_RENAME": "int:32", + "NOTE_REVOKE": "int:64", + "NOTE_TRACK": "int:1", + "NOTE_TRACKERR": "int:2", + "NOTE_TRIGGER": "int:16777216", + "NOTE_WRITE": "int:2", + "OCRNL": "int:16", + "ONLCR": "int:2", + "ONLRET": "int:64", + "ONOCR": "int:32", + "ONOEOT": "int:8", + "OPOST": "int:1", + "O_ACCMODE": "int:3", + "O_APPEND": "int:8", + "O_ASYNC": "int:64", + "O_CLOEXEC": "int:1048576", + "O_CREAT": "int:512", + "O_DIRECT": "int:65536", + "O_DIRECTORY": "int:131072", + "O_EXCL": "int:2048", + "O_EXEC": "int:262144", + "O_EXLOCK": "int:32", + "O_FSYNC": "int:128", + "O_NDELAY": "int:4", + "O_NOCTTY": "int:32768", + "O_NOFOLLOW": "int:256", + "O_NONBLOCK": "int:4", + "O_RDONLY": "int:0", + "O_RDWR": "int:2", + "O_SHLOCK": "int:16", + "O_SYNC": "int:128", + "O_TRUNC": "int:1024", + "O_TTY_INIT": "int:524288", + "O_WRONLY": "int:1", + "PARENB": "int:4096", + "PARMRK": "int:8", + "PARODD": "int:8192", + "PENDIN": "int:536870912", + "PRIO_PGRP": "int:1", + "PRIO_PROCESS": "int:0", + "PRIO_USER": "int:2", + "PROT_EXEC": "int:4", + "PROT_NONE": "int:0", + "PROT_READ": "int:1", + "PROT_WRITE": "int:2", + "PTRACE_CONT": "int:7", + "PTRACE_KILL": "int:8", + "PTRACE_TRACEME": "int:0", + "RLIMIT_AS": "int:10", + "RLIMIT_CORE": "int:4", + "RLIMIT_CPU": "int:0", + "RLIMIT_DATA": "int:2", + "RLIMIT_FSIZE": "int:1", + "RLIMIT_NOFILE": "int:8", + "RLIMIT_STACK": "int:3", + "RLIM_INFINITY": "int:9223372036854775807", + "RTAX_AUTHOR": "int:6", + "RTAX_BRD": "int:7", + "RTAX_DST": "int:0", + "RTAX_GATEWAY": "int:1", + "RTAX_GENMASK": "int:3", + "RTAX_IFA": "int:5", + "RTAX_IFP": "int:4", + "RTAX_MAX": "int:8", + "RTAX_NETMASK": "int:2", + "RTA_AUTHOR": "int:64", + "RTA_BRD": "int:128", + "RTA_DST": "int:1", + "RTA_GATEWAY": "int:2", + "RTA_GENMASK": "int:8", + "RTA_IFA": "int:32", + "RTA_IFP": "int:16", + "RTA_NETMASK": "int:4", + "RTF_BLACKHOLE": "int:4096", + "RTF_BROADCAST": "int:4194304", + "RTF_DONE": "int:64", + "RTF_DYNAMIC": "int:16", + "RTF_FMASK": "int:268752904", + "RTF_GATEWAY": "int:2", + "RTF_GWFLAG_COMPAT": "int:2147483648", + "RTF_HOST": "int:4", + "RTF_LLDATA": "int:1024", + "RTF_LLINFO": "int:1024", + "RTF_LOCAL": "int:2097152", + "RTF_MODIFIED": "int:32", + "RTF_MULTICAST": "int:8388608", + "RTF_PINNED": "int:1048576", + "RTF_PRCLONING": "int:65536", + "RTF_PROTO1": "int:32768", + "RTF_PROTO2": "int:16384", + "RTF_PROTO3": "int:262144", + "RTF_REJECT": "int:8", + "RTF_RNH_LOCKED": "int:1073741824", + "RTF_STATIC": "int:2048", + "RTF_STICKY": "int:268435456", + "RTF_UP": "int:1", + "RTF_XRESOLVE": "int:512", + "RTM_ADD": "int:1", + "RTM_CHANGE": "int:3", + "RTM_DELADDR": "int:13", + "RTM_DELETE": "int:2", + "RTM_DELMADDR": "int:16", + "RTM_GET": "int:4", + "RTM_IEEE80211": "int:18", + "RTM_IFANNOUNCE": "int:17", + "RTM_IFINFO": "int:14", + "RTM_LOCK": "int:8", + "RTM_LOSING": "int:5", + "RTM_MISS": "int:7", + "RTM_NEWADDR": "int:12", + "RTM_NEWMADDR": "int:15", + "RTM_OLDADD": "int:9", + "RTM_OLDDEL": "int:10", + "RTM_REDIRECT": "int:6", + "RTM_RESOLVE": "int:11", + "RTM_RTTUNIT": "int:1000000", + "RTM_VERSION": "int:5", + "RTV_EXPIRE": "int:4", + "RTV_HOPCOUNT": "int:2", + "RTV_MTU": "int:1", + "RTV_RPIPE": "int:8", + "RTV_RTT": "int:64", + "RTV_RTTVAR": "int:128", + "RTV_SPIPE": "int:16", + "RTV_SSTHRESH": "int:32", + "RTV_WEIGHT": "int:256", + "RT_CACHING_CONTEXT": "int:1", + "RT_DEFAULT_FIB": "int:0", + "RT_NORTREF": "int:2", + "RUSAGE_CHILDREN": "int:-1", + "RUSAGE_SELF": "int:0", + "RUSAGE_THREAD": "int:1", + "SCM_BINTIME": "int:4", + "SCM_CREDS": "int:3", + "SCM_RIGHTS": "int:1", + "SCM_TIMESTAMP": "int:2", + "SHUT_RD": "int:0", + "SHUT_RDWR": "int:2", + "SHUT_WR": "int:1", + "SIOCADDMULTI": "int:2149607729", + "SIOCADDRT": "int:2150658570", + "SIOCAIFADDR": "int:2151704858", + "SIOCAIFGROUP": "int:2149869959", + "SIOCALIFADDR": "int:2165860635", + "SIOCATMARK": "int:1074033415", + "SIOCDELMULTI": "int:2149607730", + "SIOCDELRT": "int:2150658571", + "SIOCDIFADDR": "int:2149607705", + "SIOCDIFGROUP": "int:2149869961", + "SIOCDIFPHYADDR": "int:2149607753", + "SIOCDLIFADDR": "int:2165860637", + "SIOCGDRVSPEC": "int:3223087483", + "SIOCGETSGCNT": "int:3222565392", + "SIOCGETVIFCNT": "int:3222565391", + "SIOCGHIWAT": "int:1074033409", + "SIOCGIFADDR": "int:3223349537", + "SIOCGIFBRDADDR": "int:3223349539", + "SIOCGIFCAP": "int:3223349535", + "SIOCGIFCONF": "int:3221776676", + "SIOCGIFDESCR": "int:3223349546", + "SIOCGIFDSTADDR": "int:3223349538", + "SIOCGIFFIB": "int:3223349596", + "SIOCGIFFLAGS": "int:3223349521", + "SIOCGIFGENERIC": "int:3223349562", + "SIOCGIFGMEMB": "int:3223611786", + "SIOCGIFGROUP": "int:3223611784", + "SIOCGIFINDEX": "int:3223349536", + "SIOCGIFMAC": "int:3223349542", + "SIOCGIFMEDIA": "int:3223873848", + "SIOCGIFMETRIC": "int:3223349527", + "SIOCGIFMTU": "int:3223349555", + "SIOCGIFNETMASK": "int:3223349541", + "SIOCGIFPDSTADDR": "int:3223349576", + "SIOCGIFPHYS": "int:3223349557", + "SIOCGIFPSRCADDR": "int:3223349575", + "SIOCGIFSTATUS": "int:3274795323", + "SIOCGLIFADDR": "int:3239602460", + "SIOCGLIFPHYADDR": "int:3239602507", + "SIOCGLOWAT": "int:1074033411", + "SIOCGPGRP": "int:1074033417", + "SIOCGPRIVATE_0": "int:3223349584", + "SIOCGPRIVATE_1": "int:3223349585", + "SIOCIFCREATE": "int:3223349626", + "SIOCIFCREATE2": "int:3223349628", + "SIOCIFDESTROY": "int:2149607801", + "SIOCIFGCLONERS": "int:3222038904", + "SIOCSDRVSPEC": "int:2149345659", + "SIOCSHIWAT": "int:2147775232", + "SIOCSIFADDR": "int:2149607692", + "SIOCSIFBRDADDR": "int:2149607699", + "SIOCSIFCAP": "int:2149607710", + "SIOCSIFDESCR": "int:2149607721", + "SIOCSIFDSTADDR": "int:2149607694", + "SIOCSIFFIB": "int:2149607773", + "SIOCSIFFLAGS": "int:2149607696", + "SIOCSIFGENERIC": "int:2149607737", + "SIOCSIFLLADDR": "int:2149607740", + "SIOCSIFMAC": "int:2149607719", + "SIOCSIFMEDIA": "int:3223349559", + "SIOCSIFMETRIC": "int:2149607704", + "SIOCSIFMTU": "int:2149607732", + "SIOCSIFNAME": "int:2149607720", + "SIOCSIFNETMASK": "int:2149607702", + "SIOCSIFPHYADDR": "int:2151704902", + "SIOCSIFPHYS": "int:2149607734", + "SIOCSIFRVNET": "int:3223349595", + "SIOCSIFVNET": "int:3223349594", + "SIOCSLIFPHYADDR": "int:2165860682", + "SIOCSLOWAT": "int:2147775234", + "SIOCSPGRP": "int:2147775240", + "SOCK_CLOEXEC": "int:268435456", + "SOCK_DGRAM": "int:2", + "SOCK_MAXADDRLEN": "int:255", + "SOCK_NONBLOCK": "int:536870912", + "SOCK_RAW": "int:3", + "SOCK_RDM": "int:4", + "SOCK_SEQPACKET": "int:5", + "SOCK_STREAM": "int:1", + "SOL_SOCKET": "int:65535", + "SOMAXCONN": "int:128", + "SO_ACCEPTCONN": "int:2", + "SO_ACCEPTFILTER": "int:4096", + "SO_BINTIME": "int:8192", + "SO_BROADCAST": "int:32", + "SO_DEBUG": "int:1", + "SO_DONTROUTE": "int:16", + "SO_ERROR": "int:4103", + "SO_KEEPALIVE": "int:8", + "SO_LABEL": "int:4105", + "SO_LINGER": "int:128", + "SO_LISTENINCQLEN": "int:4115", + "SO_LISTENQLEN": "int:4114", + "SO_LISTENQLIMIT": "int:4113", + "SO_NOSIGPIPE": "int:2048", + "SO_NO_DDP": "int:32768", + "SO_NO_OFFLOAD": "int:16384", + "SO_OOBINLINE": "int:256", + "SO_PEERLABEL": "int:4112", + "SO_PROTOCOL": "int:4118", + "SO_PROTOTYPE": "int:4118", + "SO_RCVBUF": "int:4098", + "SO_RCVLOWAT": "int:4100", + "SO_RCVTIMEO": "int:4102", + "SO_REUSEADDR": "int:4", + "SO_REUSEPORT": "int:512", + "SO_SETFIB": "int:4116", + "SO_SNDBUF": "int:4097", + "SO_SNDLOWAT": "int:4099", + "SO_SNDTIMEO": "int:4101", + "SO_TIMESTAMP": "int:1024", + "SO_TYPE": "int:4104", + "SO_USELOOPBACK": "int:64", + "SO_USER_COOKIE": "int:4117", + "SO_VENDOR": "int:2147483648", + "SYS_ABORT2": "int:463", + "SYS_ACCEPT": "int:30", + "SYS_ACCEPT4": "int:541", + "SYS_ACCESS": "int:33", + "SYS_ACCT": "int:51", + "SYS_ADJTIME": "int:140", + "SYS_AUDIT": "int:445", + "SYS_AUDITCTL": "int:453", + "SYS_AUDITON": "int:446", + "SYS_BIND": "int:104", + "SYS_BINDAT": "int:538", + "SYS_CAP_ENTER": "int:516", + "SYS_CAP_GETMODE": "int:517", + "SYS_CAP_GETRIGHTS": "int:515", + "SYS_CAP_NEW": "int:514", + "SYS_CHDIR": "int:12", + "SYS_CHFLAGS": "int:34", + "SYS_CHFLAGSAT": "int:540", + "SYS_CHMOD": "int:15", + "SYS_CHOWN": "int:16", + "SYS_CHROOT": "int:61", + "SYS_CLOCK_GETCPUCLOCKID2": "int:247", + "SYS_CLOCK_GETRES": "int:234", + "SYS_CLOCK_GETTIME": "int:232", + "SYS_CLOCK_SETTIME": "int:233", + "SYS_CLOSE": "int:6", + "SYS_CLOSEFROM": "int:509", + "SYS_CONNECT": "int:98", + "SYS_CONNECTAT": "int:539", + "SYS_CPUSET": "int:484", + "SYS_CPUSET_GETAFFINITY": "int:487", + "SYS_CPUSET_GETID": "int:486", + "SYS_CPUSET_SETAFFINITY": "int:488", + "SYS_CPUSET_SETID": "int:485", + "SYS_DUP": "int:41", + "SYS_DUP2": "int:90", + "SYS_EACCESS": "int:376", + "SYS_EXECVE": "int:59", + "SYS_EXIT": "int:1", + "SYS_EXTATTRCTL": "int:355", + "SYS_EXTATTR_DELETE_FD": "int:373", + "SYS_EXTATTR_DELETE_FILE": "int:358", + "SYS_EXTATTR_DELETE_LINK": "int:414", + "SYS_EXTATTR_GET_FD": "int:372", + "SYS_EXTATTR_GET_FILE": "int:357", + "SYS_EXTATTR_GET_LINK": "int:413", + "SYS_EXTATTR_LIST_FD": "int:437", + "SYS_EXTATTR_LIST_FILE": "int:438", + "SYS_EXTATTR_LIST_LINK": "int:439", + "SYS_EXTATTR_SET_FD": "int:371", + "SYS_EXTATTR_SET_FILE": "int:356", + "SYS_EXTATTR_SET_LINK": "int:412", + "SYS_FACCESSAT": "int:489", + "SYS_FCHDIR": "int:13", + "SYS_FCHFLAGS": "int:35", + "SYS_FCHMOD": "int:124", + "SYS_FCHMODAT": "int:490", + "SYS_FCHOWN": "int:123", + "SYS_FCHOWNAT": "int:491", + "SYS_FCNTL": "int:92", + "SYS_FEXECVE": "int:492", + "SYS_FFCLOCK_GETCOUNTER": "int:241", + "SYS_FFCLOCK_GETESTIMATE": "int:243", + "SYS_FFCLOCK_SETESTIMATE": "int:242", + "SYS_FHOPEN": "int:298", + "SYS_FHSTAT": "int:299", + "SYS_FHSTATFS": "int:398", + "SYS_FLOCK": "int:131", + "SYS_FORK": "int:2", + "SYS_FPATHCONF": "int:192", + "SYS_FREEBSD6_FTRUNCATE": "int:201", + "SYS_FREEBSD6_LSEEK": "int:199", + "SYS_FREEBSD6_MMAP": "int:197", + "SYS_FREEBSD6_PREAD": "int:173", + "SYS_FREEBSD6_PWRITE": "int:174", + "SYS_FREEBSD6_TRUNCATE": "int:200", + "SYS_FSTAT": "int:189", + "SYS_FSTATAT": "int:493", + "SYS_FSTATFS": "int:397", + "SYS_FSYNC": "int:95", + "SYS_FTRUNCATE": "int:480", + "SYS_FUTIMES": "int:206", + "SYS_FUTIMESAT": "int:494", + "SYS_GETAUDIT": "int:449", + "SYS_GETAUDIT_ADDR": "int:451", + "SYS_GETAUID": "int:447", + "SYS_GETCONTEXT": "int:421", + "SYS_GETDENTS": "int:272", + "SYS_GETDIRENTRIES": "int:196", + "SYS_GETDTABLESIZE": "int:89", + "SYS_GETEGID": "int:43", + "SYS_GETEUID": "int:25", + "SYS_GETFH": "int:161", + "SYS_GETFSSTAT": "int:395", + "SYS_GETGID": "int:47", + "SYS_GETGROUPS": "int:79", + "SYS_GETITIMER": "int:86", + "SYS_GETLOGIN": "int:49", + "SYS_GETLOGINCLASS": "int:523", + "SYS_GETPEERNAME": "int:31", + "SYS_GETPGID": "int:207", + "SYS_GETPGRP": "int:81", + "SYS_GETPID": "int:20", + "SYS_GETPPID": "int:39", + "SYS_GETPRIORITY": "int:100", + "SYS_GETRESGID": "int:361", + "SYS_GETRESUID": "int:360", + "SYS_GETRLIMIT": "int:194", + "SYS_GETRUSAGE": "int:117", + "SYS_GETSID": "int:310", + "SYS_GETSOCKNAME": "int:32", + "SYS_GETSOCKOPT": "int:118", + "SYS_GETTIMEOFDAY": "int:116", + "SYS_GETUID": "int:24", + "SYS_IOCTL": "int:54", + "SYS_ISSETUGID": "int:253", + "SYS_JAIL": "int:338", + "SYS_JAIL_ATTACH": "int:436", + "SYS_JAIL_GET": "int:506", + "SYS_JAIL_REMOVE": "int:508", + "SYS_JAIL_SET": "int:507", + "SYS_KENV": "int:390", + "SYS_KEVENT": "int:363", + "SYS_KILL": "int:37", + "SYS_KLDFIND": "int:306", + "SYS_KLDFIRSTMOD": "int:309", + "SYS_KLDLOAD": "int:304", + "SYS_KLDNEXT": "int:307", + "SYS_KLDSTAT": "int:308", + "SYS_KLDSYM": "int:337", + "SYS_KLDUNLOAD": "int:305", + "SYS_KLDUNLOADF": "int:444", + "SYS_KQUEUE": "int:362", + "SYS_KTIMER_CREATE": "int:235", + "SYS_KTIMER_DELETE": "int:236", + "SYS_KTIMER_GETOVERRUN": "int:239", + "SYS_KTIMER_GETTIME": "int:238", + "SYS_KTIMER_SETTIME": "int:237", + "SYS_KTRACE": "int:45", + "SYS_LCHFLAGS": "int:391", + "SYS_LCHMOD": "int:274", + "SYS_LCHOWN": "int:254", + "SYS_LGETFH": "int:160", + "SYS_LINK": "int:9", + "SYS_LINKAT": "int:495", + "SYS_LISTEN": "int:106", + "SYS_LPATHCONF": "int:513", + "SYS_LSEEK": "int:478", + "SYS_LSTAT": "int:190", + "SYS_LUTIMES": "int:276", + "SYS_MAC_SYSCALL": "int:394", + "SYS_MADVISE": "int:75", + "SYS_MINCORE": "int:78", + "SYS_MINHERIT": "int:250", + "SYS_MKDIR": "int:136", + "SYS_MKDIRAT": "int:496", + "SYS_MKFIFO": "int:132", + "SYS_MKFIFOAT": "int:497", + "SYS_MKNOD": "int:14", + "SYS_MKNODAT": "int:498", + "SYS_MLOCK": "int:203", + "SYS_MLOCKALL": "int:324", + "SYS_MMAP": "int:477", + "SYS_MODFIND": "int:303", + "SYS_MODFNEXT": "int:302", + "SYS_MODNEXT": "int:300", + "SYS_MODSTAT": "int:301", + "SYS_MOUNT": "int:21", + "SYS_MPROTECT": "int:74", + "SYS_MSYNC": "int:65", + "SYS_MUNLOCK": "int:204", + "SYS_MUNLOCKALL": "int:325", + "SYS_MUNMAP": "int:73", + "SYS_NANOSLEEP": "int:240", + "SYS_NFSTAT": "int:279", + "SYS_NLSTAT": "int:280", + "SYS_NMOUNT": "int:378", + "SYS_NSTAT": "int:278", + "SYS_NTP_ADJTIME": "int:176", + "SYS_NTP_GETTIME": "int:248", + "SYS_OBREAK": "int:17", + "SYS_OPEN": "int:5", + "SYS_OPENAT": "int:499", + "SYS_OPENBSD_POLL": "int:252", + "SYS_OVADVISE": "int:72", + "SYS_PATHCONF": "int:191", + "SYS_PDFORK": "int:518", + "SYS_PDGETPID": "int:520", + "SYS_PDKILL": "int:519", + "SYS_PIPE": "int:42", + "SYS_PIPE2": "int:542", + "SYS_POLL": "int:209", + "SYS_POSIX_FADVISE": "int:531", + "SYS_POSIX_FALLOCATE": "int:530", + "SYS_POSIX_OPENPT": "int:504", + "SYS_PREAD": "int:475", + "SYS_PREADV": "int:289", + "SYS_PROCCTL": "int:544", + "SYS_PROFIL": "int:44", + "SYS_PSELECT": "int:522", + "SYS_PTRACE": "int:26", + "SYS_PWRITE": "int:476", + "SYS_PWRITEV": "int:290", + "SYS_QUOTACTL": "int:148", + "SYS_RCTL_ADD_RULE": "int:528", + "SYS_RCTL_GET_LIMITS": "int:527", + "SYS_RCTL_GET_RACCT": "int:525", + "SYS_RCTL_GET_RULES": "int:526", + "SYS_RCTL_REMOVE_RULE": "int:529", + "SYS_READ": "int:3", + "SYS_READLINK": "int:58", + "SYS_READLINKAT": "int:500", + "SYS_READV": "int:120", + "SYS_REBOOT": "int:55", + "SYS_RECVFROM": "int:29", + "SYS_RECVMSG": "int:27", + "SYS_RENAME": "int:128", + "SYS_RENAMEAT": "int:501", + "SYS_REVOKE": "int:56", + "SYS_RFORK": "int:251", + "SYS_RMDIR": "int:137", + "SYS_RTPRIO": "int:166", + "SYS_RTPRIO_THREAD": "int:466", + "SYS_SBRK": "int:69", + "SYS_SCHED_GETPARAM": "int:328", + "SYS_SCHED_GETSCHEDULER": "int:330", + "SYS_SCHED_GET_PRIORITY_MAX": "int:332", + "SYS_SCHED_GET_PRIORITY_MIN": "int:333", + "SYS_SCHED_RR_GET_INTERVAL": "int:334", + "SYS_SCHED_SETPARAM": "int:327", + "SYS_SCHED_SETSCHEDULER": "int:329", + "SYS_SCHED_YIELD": "int:331", + "SYS_SCTP_GENERIC_RECVMSG": "int:474", + "SYS_SCTP_GENERIC_SENDMSG": "int:472", + "SYS_SCTP_GENERIC_SENDMSG_IOV": "int:473", + "SYS_SCTP_PEELOFF": "int:471", + "SYS_SELECT": "int:93", + "SYS_SENDFILE": "int:393", + "SYS_SENDMSG": "int:28", + "SYS_SENDTO": "int:133", + "SYS_SETAUDIT": "int:450", + "SYS_SETAUDIT_ADDR": "int:452", + "SYS_SETAUID": "int:448", + "SYS_SETCONTEXT": "int:422", + "SYS_SETEGID": "int:182", + "SYS_SETEUID": "int:183", + "SYS_SETFIB": "int:175", + "SYS_SETGID": "int:181", + "SYS_SETGROUPS": "int:80", + "SYS_SETITIMER": "int:83", + "SYS_SETLOGIN": "int:50", + "SYS_SETLOGINCLASS": "int:524", + "SYS_SETPGID": "int:82", + "SYS_SETPRIORITY": "int:96", + "SYS_SETREGID": "int:127", + "SYS_SETRESGID": "int:312", + "SYS_SETRESUID": "int:311", + "SYS_SETREUID": "int:126", + "SYS_SETRLIMIT": "int:195", + "SYS_SETSID": "int:147", + "SYS_SETSOCKOPT": "int:105", + "SYS_SETTIMEOFDAY": "int:122", + "SYS_SETUID": "int:23", + "SYS_SHM_OPEN": "int:482", + "SYS_SHM_UNLINK": "int:483", + "SYS_SHUTDOWN": "int:134", + "SYS_SIGACTION": "int:416", + "SYS_SIGALTSTACK": "int:53", + "SYS_SIGPENDING": "int:343", + "SYS_SIGPROCMASK": "int:340", + "SYS_SIGQUEUE": "int:456", + "SYS_SIGRETURN": "int:417", + "SYS_SIGSUSPEND": "int:341", + "SYS_SIGTIMEDWAIT": "int:345", + "SYS_SIGWAIT": "int:429", + "SYS_SIGWAITINFO": "int:346", + "SYS_SOCKET": "int:97", + "SYS_SOCKETPAIR": "int:135", + "SYS_SSTK": "int:70", + "SYS_STAT": "int:188", + "SYS_STATFS": "int:396", + "SYS_SWAPCONTEXT": "int:423", + "SYS_SWAPOFF": "int:424", + "SYS_SWAPON": "int:85", + "SYS_SYMLINK": "int:57", + "SYS_SYMLINKAT": "int:502", + "SYS_SYNC": "int:36", + "SYS_SYSARCH": "int:165", + "SYS_THR_CREATE": "int:430", + "SYS_THR_EXIT": "int:431", + "SYS_THR_KILL": "int:433", + "SYS_THR_KILL2": "int:481", + "SYS_THR_NEW": "int:455", + "SYS_THR_SELF": "int:432", + "SYS_THR_SET_NAME": "int:464", + "SYS_THR_SUSPEND": "int:442", + "SYS_THR_WAKE": "int:443", + "SYS_TRUNCATE": "int:479", + "SYS_UMASK": "int:60", + "SYS_UNDELETE": "int:205", + "SYS_UNLINK": "int:10", + "SYS_UNLINKAT": "int:503", + "SYS_UNMOUNT": "int:22", + "SYS_UTIMES": "int:138", + "SYS_UTRACE": "int:335", + "SYS_UUIDGEN": "int:392", + "SYS_VFORK": "int:66", + "SYS_WAIT4": "int:7", + "SYS_WAIT6": "int:532", + "SYS_WRITE": "int:4", + "SYS_WRITEV": "int:121", + "SYS_YIELD": "int:321", + "SYS__UMTX_LOCK": "int:434", + "SYS__UMTX_OP": "int:454", + "SYS__UMTX_UNLOCK": "int:435", + "SYS___ACL_ACLCHECK_FD": "int:354", + "SYS___ACL_ACLCHECK_FILE": "int:353", + "SYS___ACL_ACLCHECK_LINK": "int:428", + "SYS___ACL_DELETE_FD": "int:352", + "SYS___ACL_DELETE_FILE": "int:351", + "SYS___ACL_DELETE_LINK": "int:427", + "SYS___ACL_GET_FD": "int:349", + "SYS___ACL_GET_FILE": "int:347", + "SYS___ACL_GET_LINK": "int:425", + "SYS___ACL_SET_FD": "int:350", + "SYS___ACL_SET_FILE": "int:348", + "SYS___ACL_SET_LINK": "int:426", + "SYS___GETCWD": "int:326", + "SYS___MAC_EXECVE": "int:415", + "SYS___MAC_GET_FD": "int:386", + "SYS___MAC_GET_FILE": "int:387", + "SYS___MAC_GET_LINK": "int:410", + "SYS___MAC_GET_PID": "int:409", + "SYS___MAC_GET_PROC": "int:384", + "SYS___MAC_SET_FD": "int:388", + "SYS___MAC_SET_FILE": "int:389", + "SYS___MAC_SET_LINK": "int:411", + "SYS___MAC_SET_PROC": "int:385", + "SYS___SETUGID": "int:374", + "SYS___SYSCTL": "int:202", + "S_IFBLK": "int:24576", + "S_IFCHR": "int:8192", + "S_IFDIR": "int:16384", + "S_IFIFO": "int:4096", + "S_IFLNK": "int:40960", + "S_IFMT": "int:61440", + "S_IFREG": "int:32768", + "S_IFSOCK": "int:49152", + "S_IRUSR": "int:256", + "S_ISGID": "int:1024", + "S_ISUID": "int:2048", + "S_ISVTX": "int:512", + "S_IWUSR": "int:128", + "S_IXUSR": "int:64", + "SizeofBpfHdr": "int:20", + "SizeofBpfInsn": "int:8", + "SizeofBpfProgram": "int:8", + "SizeofBpfStat": "int:8", + "SizeofBpfVersion": "int:4", + "SizeofBpfZbuf": "int:12", + "SizeofBpfZbufHeader": "int:32", + "SizeofCmsghdr": "int:12", + "SizeofICMPv6Filter": "int:32", + "SizeofIPMreq": "int:8", + "SizeofIPMreqn": "int:12", + "SizeofIPv6MTUInfo": "int:32", + "SizeofIPv6Mreq": "int:20", + "SizeofIfAnnounceMsghdr": "int:24", + "SizeofIfData": "int:80", + "SizeofIfMsghdr": "int:96", + "SizeofIfaMsghdr": "int:20", + "SizeofIfmaMsghdr": "int:16", + "SizeofInet6Pktinfo": "int:20", + "SizeofLinger": "int:8", + "SizeofMsghdr": "int:28", + "SizeofRtMetrics": "int:56", + "SizeofRtMsghdr": "int:92", + "SizeofSockaddrAny": "int:108", + "SizeofSockaddrDatalink": "int:54", + "SizeofSockaddrInet4": "int:16", + "SizeofSockaddrInet6": "int:28", + "SizeofSockaddrUnix": "int:106", + "TCIFLUSH": "int:1", + "TCIOFLUSH": "int:3", + "TCOFLUSH": "int:2", + "TCP_CA_NAME_MAX": "int:16", + "TCP_CONGESTION": "int:64", + "TCP_INFO": "int:32", + "TCP_KEEPCNT": "int:1024", + "TCP_KEEPIDLE": "int:256", + "TCP_KEEPINIT": "int:128", + "TCP_KEEPINTVL": "int:512", + "TCP_MAXBURST": "int:4", + "TCP_MAXHLEN": "int:60", + "TCP_MAXOLEN": "int:40", + "TCP_MAXSEG": "int:2", + "TCP_MAXWIN": "int:65535", + "TCP_MAX_SACK": "int:4", + "TCP_MAX_WINSHIFT": "int:14", + "TCP_MD5SIG": "int:16", + "TCP_MINMSS": "int:216", + "TCP_MSS": "int:536", + "TCP_NODELAY": "int:1", + "TCP_NOOPT": "int:8", + "TCP_NOPUSH": "int:4", + "TCP_VENDOR": "int:2147483648", + "TCSAFLUSH": "int:2", + "TIOCCBRK": "int:536900730", + "TIOCCDTR": "int:536900728", + "TIOCCONS": "int:2147775586", + "TIOCDRAIN": "int:536900702", + "TIOCEXCL": "int:536900621", + "TIOCEXT": "int:2147775584", + "TIOCFLUSH": "int:2147775504", + "TIOCGDRAINWAIT": "int:1074033750", + "TIOCGETA": "int:1076655123", + "TIOCGETD": "int:1074033690", + "TIOCGPGRP": "int:1074033783", + "TIOCGPTN": "int:1074033679", + "TIOCGSID": "int:1074033763", + "TIOCGWINSZ": "int:1074295912", + "TIOCMBIC": "int:2147775595", + "TIOCMBIS": "int:2147775596", + "TIOCMGDTRWAIT": "int:1074033754", + "TIOCMGET": "int:1074033770", + "TIOCMSDTRWAIT": "int:2147775579", + "TIOCMSET": "int:2147775597", + "TIOCM_CAR": "int:64", + "TIOCM_CD": "int:64", + "TIOCM_CTS": "int:32", + "TIOCM_DCD": "int:64", + "TIOCM_DSR": "int:256", + "TIOCM_DTR": "int:2", + "TIOCM_LE": "int:1", + "TIOCM_RI": "int:128", + "TIOCM_RNG": "int:128", + "TIOCM_RTS": "int:4", + "TIOCM_SR": "int:16", + "TIOCM_ST": "int:8", + "TIOCNOTTY": "int:536900721", + "TIOCNXCL": "int:536900622", + "TIOCOUTQ": "int:1074033779", + "TIOCPKT": "int:2147775600", + "TIOCPKT_DATA": "int:0", + "TIOCPKT_DOSTOP": "int:32", + "TIOCPKT_FLUSHREAD": "int:1", + "TIOCPKT_FLUSHWRITE": "int:2", + "TIOCPKT_IOCTL": "int:64", + "TIOCPKT_NOSTOP": "int:16", + "TIOCPKT_START": "int:8", + "TIOCPKT_STOP": "int:4", + "TIOCPTMASTER": "int:536900636", + "TIOCSBRK": "int:536900731", + "TIOCSCTTY": "int:536900705", + "TIOCSDRAINWAIT": "int:2147775575", + "TIOCSDTR": "int:536900729", + "TIOCSETA": "int:2150396948", + "TIOCSETAF": "int:2150396950", + "TIOCSETAW": "int:2150396949", + "TIOCSETD": "int:2147775515", + "TIOCSIG": "int:537162847", + "TIOCSPGRP": "int:2147775606", + "TIOCSTART": "int:536900718", + "TIOCSTAT": "int:536900709", + "TIOCSTI": "int:2147578994", + "TIOCSTOP": "int:536900719", + "TIOCSWINSZ": "int:2148037735", + "TIOCTIMESTAMP": "int:1074295897", + "TIOCUCNTL": "int:2147775590", + "TOSTOP": "int:4194304", + "VDISCARD": "int:15", + "VDSUSP": "int:11", + "VEOF": "int:0", + "VEOL": "int:1", + "VEOL2": "int:2", + "VERASE": "int:3", + "VERASE2": "int:7", + "VINTR": "int:8", + "VKILL": "int:5", + "VLNEXT": "int:14", + "VMIN": "int:16", + "VQUIT": "int:9", + "VREPRINT": "int:6", + "VSTART": "int:12", + "VSTATUS": "int:18", + "VSTOP": "int:13", + "VSUSP": "int:10", + "VTIME": "int:17", + "VWERASE": "int:4", + "WCONTINUED": "int:4", + "WCOREFLAG": "int:128", + "WEXITED": "int:16", + "WLINUXCLONE": "int:2147483648", + "WNOHANG": "int:1", + "WNOWAIT": "int:8", + "WSTOPPED": "int:2", + "WTRAPPED": "int:32", + "WUNTRACED": "int:2", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_amd64.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_amd64.go new file mode 100644 index 0000000..a66c112 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_freebsd_amd64.go @@ -0,0 +1,4029 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +// reflection: allow interpreted code to import "syscall" +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ARP": ValueOf(syscall.AF_ARP), + "AF_ATM": ValueOf(syscall.AF_ATM), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_CCITT": ValueOf(syscall.AF_CCITT), + "AF_CHAOS": ValueOf(syscall.AF_CHAOS), + "AF_CNT": ValueOf(syscall.AF_CNT), + "AF_COIP": ValueOf(syscall.AF_COIP), + "AF_DATAKIT": ValueOf(syscall.AF_DATAKIT), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_DLI": ValueOf(syscall.AF_DLI), + "AF_E164": ValueOf(syscall.AF_E164), + "AF_ECMA": ValueOf(syscall.AF_ECMA), + "AF_HYLINK": ValueOf(syscall.AF_HYLINK), + "AF_IEEE80211": ValueOf(syscall.AF_IEEE80211), + "AF_IMPLINK": ValueOf(syscall.AF_IMPLINK), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_INET6_SDP": ValueOf(syscall.AF_INET6_SDP), + "AF_INET_SDP": ValueOf(syscall.AF_INET_SDP), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_ISO": ValueOf(syscall.AF_ISO), + "AF_LAT": ValueOf(syscall.AF_LAT), + "AF_LINK": ValueOf(syscall.AF_LINK), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NATM": ValueOf(syscall.AF_NATM), + "AF_NETBIOS": ValueOf(syscall.AF_NETBIOS), + "AF_NETGRAPH": ValueOf(syscall.AF_NETGRAPH), + "AF_OSI": ValueOf(syscall.AF_OSI), + "AF_PUP": ValueOf(syscall.AF_PUP), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_SCLUSTER": ValueOf(syscall.AF_SCLUSTER), + "AF_SIP": ValueOf(syscall.AF_SIP), + "AF_SLOW": ValueOf(syscall.AF_SLOW), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_VENDOR00": ValueOf(syscall.AF_VENDOR00), + "AF_VENDOR01": ValueOf(syscall.AF_VENDOR01), + "AF_VENDOR02": ValueOf(syscall.AF_VENDOR02), + "AF_VENDOR03": ValueOf(syscall.AF_VENDOR03), + "AF_VENDOR04": ValueOf(syscall.AF_VENDOR04), + "AF_VENDOR05": ValueOf(syscall.AF_VENDOR05), + "AF_VENDOR06": ValueOf(syscall.AF_VENDOR06), + "AF_VENDOR07": ValueOf(syscall.AF_VENDOR07), + "AF_VENDOR08": ValueOf(syscall.AF_VENDOR08), + "AF_VENDOR09": ValueOf(syscall.AF_VENDOR09), + "AF_VENDOR10": ValueOf(syscall.AF_VENDOR10), + "AF_VENDOR11": ValueOf(syscall.AF_VENDOR11), + "AF_VENDOR12": ValueOf(syscall.AF_VENDOR12), + "AF_VENDOR13": ValueOf(syscall.AF_VENDOR13), + "AF_VENDOR14": ValueOf(syscall.AF_VENDOR14), + "AF_VENDOR15": ValueOf(syscall.AF_VENDOR15), + "AF_VENDOR16": ValueOf(syscall.AF_VENDOR16), + "AF_VENDOR17": ValueOf(syscall.AF_VENDOR17), + "AF_VENDOR18": ValueOf(syscall.AF_VENDOR18), + "AF_VENDOR19": ValueOf(syscall.AF_VENDOR19), + "AF_VENDOR20": ValueOf(syscall.AF_VENDOR20), + "AF_VENDOR21": ValueOf(syscall.AF_VENDOR21), + "AF_VENDOR22": ValueOf(syscall.AF_VENDOR22), + "AF_VENDOR23": ValueOf(syscall.AF_VENDOR23), + "AF_VENDOR24": ValueOf(syscall.AF_VENDOR24), + "AF_VENDOR25": ValueOf(syscall.AF_VENDOR25), + "AF_VENDOR26": ValueOf(syscall.AF_VENDOR26), + "AF_VENDOR27": ValueOf(syscall.AF_VENDOR27), + "AF_VENDOR28": ValueOf(syscall.AF_VENDOR28), + "AF_VENDOR29": ValueOf(syscall.AF_VENDOR29), + "AF_VENDOR30": ValueOf(syscall.AF_VENDOR30), + "AF_VENDOR31": ValueOf(syscall.AF_VENDOR31), + "AF_VENDOR32": ValueOf(syscall.AF_VENDOR32), + "AF_VENDOR33": ValueOf(syscall.AF_VENDOR33), + "AF_VENDOR34": ValueOf(syscall.AF_VENDOR34), + "AF_VENDOR35": ValueOf(syscall.AF_VENDOR35), + "AF_VENDOR36": ValueOf(syscall.AF_VENDOR36), + "AF_VENDOR37": ValueOf(syscall.AF_VENDOR37), + "AF_VENDOR38": ValueOf(syscall.AF_VENDOR38), + "AF_VENDOR39": ValueOf(syscall.AF_VENDOR39), + "AF_VENDOR40": ValueOf(syscall.AF_VENDOR40), + "AF_VENDOR41": ValueOf(syscall.AF_VENDOR41), + "AF_VENDOR42": ValueOf(syscall.AF_VENDOR42), + "AF_VENDOR43": ValueOf(syscall.AF_VENDOR43), + "AF_VENDOR44": ValueOf(syscall.AF_VENDOR44), + "AF_VENDOR45": ValueOf(syscall.AF_VENDOR45), + "AF_VENDOR46": ValueOf(syscall.AF_VENDOR46), + "AF_VENDOR47": ValueOf(syscall.AF_VENDOR47), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Adjtime": ValueOf(syscall.Adjtime), + "B0": ValueOf(syscall.B0), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B14400": ValueOf(syscall.B14400), + "B150": ValueOf(syscall.B150), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B28800": ValueOf(syscall.B28800), + "B300": ValueOf(syscall.B300), + "B38400": ValueOf(syscall.B38400), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B57600": ValueOf(syscall.B57600), + "B600": ValueOf(syscall.B600), + "B7200": ValueOf(syscall.B7200), + "B75": ValueOf(syscall.B75), + "B76800": ValueOf(syscall.B76800), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BIOCFEEDBACK": ValueOf(uint32(syscall.BIOCFEEDBACK)), + "BIOCFLUSH": ValueOf(syscall.BIOCFLUSH), + "BIOCGBLEN": ValueOf(syscall.BIOCGBLEN), + "BIOCGDIRECTION": ValueOf(syscall.BIOCGDIRECTION), + "BIOCGDLT": ValueOf(syscall.BIOCGDLT), + "BIOCGDLTLIST": ValueOf(uint32(syscall.BIOCGDLTLIST)), + "BIOCGETBUFMODE": ValueOf(syscall.BIOCGETBUFMODE), + "BIOCGETIF": ValueOf(syscall.BIOCGETIF), + "BIOCGETZMAX": ValueOf(syscall.BIOCGETZMAX), + "BIOCGHDRCMPLT": ValueOf(syscall.BIOCGHDRCMPLT), + "BIOCGRSIG": ValueOf(syscall.BIOCGRSIG), + "BIOCGRTIMEOUT": ValueOf(syscall.BIOCGRTIMEOUT), + "BIOCGSEESENT": ValueOf(syscall.BIOCGSEESENT), + "BIOCGSTATS": ValueOf(syscall.BIOCGSTATS), + "BIOCGTSTAMP": ValueOf(syscall.BIOCGTSTAMP), + "BIOCIMMEDIATE": ValueOf(uint32(syscall.BIOCIMMEDIATE)), + "BIOCLOCK": ValueOf(syscall.BIOCLOCK), + "BIOCPROMISC": ValueOf(syscall.BIOCPROMISC), + "BIOCROTZBUF": ValueOf(syscall.BIOCROTZBUF), + "BIOCSBLEN": ValueOf(uint32(syscall.BIOCSBLEN)), + "BIOCSDIRECTION": ValueOf(uint32(syscall.BIOCSDIRECTION)), + "BIOCSDLT": ValueOf(uint32(syscall.BIOCSDLT)), + "BIOCSETBUFMODE": ValueOf(uint32(syscall.BIOCSETBUFMODE)), + "BIOCSETF": ValueOf(uint32(syscall.BIOCSETF)), + "BIOCSETFNR": ValueOf(uint32(syscall.BIOCSETFNR)), + "BIOCSETIF": ValueOf(uint32(syscall.BIOCSETIF)), + "BIOCSETWF": ValueOf(uint32(syscall.BIOCSETWF)), + "BIOCSETZBUF": ValueOf(uint32(syscall.BIOCSETZBUF)), + "BIOCSHDRCMPLT": ValueOf(uint32(syscall.BIOCSHDRCMPLT)), + "BIOCSRSIG": ValueOf(uint32(syscall.BIOCSRSIG)), + "BIOCSRTIMEOUT": ValueOf(uint32(syscall.BIOCSRTIMEOUT)), + "BIOCSSEESENT": ValueOf(uint32(syscall.BIOCSSEESENT)), + "BIOCSTSTAMP": ValueOf(uint32(syscall.BIOCSTSTAMP)), + "BIOCVERSION": ValueOf(syscall.BIOCVERSION), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALIGNMENT": ValueOf(syscall.BPF_ALIGNMENT), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_BUFMODE_BUFFER": ValueOf(syscall.BPF_BUFMODE_BUFFER), + "BPF_BUFMODE_ZBUF": ValueOf(syscall.BPF_BUFMODE_ZBUF), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXBUFSIZE": ValueOf(syscall.BPF_MAXBUFSIZE), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINBUFSIZE": ValueOf(syscall.BPF_MINBUFSIZE), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RELEASE": ValueOf(syscall.BPF_RELEASE), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_T_BINTIME": ValueOf(syscall.BPF_T_BINTIME), + "BPF_T_BINTIME_FAST": ValueOf(syscall.BPF_T_BINTIME_FAST), + "BPF_T_BINTIME_MONOTONIC": ValueOf(syscall.BPF_T_BINTIME_MONOTONIC), + "BPF_T_BINTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_BINTIME_MONOTONIC_FAST), + "BPF_T_FAST": ValueOf(syscall.BPF_T_FAST), + "BPF_T_FLAG_MASK": ValueOf(syscall.BPF_T_FLAG_MASK), + "BPF_T_FORMAT_MASK": ValueOf(syscall.BPF_T_FORMAT_MASK), + "BPF_T_MICROTIME": ValueOf(syscall.BPF_T_MICROTIME), + "BPF_T_MICROTIME_FAST": ValueOf(syscall.BPF_T_MICROTIME_FAST), + "BPF_T_MICROTIME_MONOTONIC": ValueOf(syscall.BPF_T_MICROTIME_MONOTONIC), + "BPF_T_MICROTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_MICROTIME_MONOTONIC_FAST), + "BPF_T_MONOTONIC": ValueOf(syscall.BPF_T_MONOTONIC), + "BPF_T_MONOTONIC_FAST": ValueOf(syscall.BPF_T_MONOTONIC_FAST), + "BPF_T_NANOTIME": ValueOf(syscall.BPF_T_NANOTIME), + "BPF_T_NANOTIME_FAST": ValueOf(syscall.BPF_T_NANOTIME_FAST), + "BPF_T_NANOTIME_MONOTONIC": ValueOf(syscall.BPF_T_NANOTIME_MONOTONIC), + "BPF_T_NANOTIME_MONOTONIC_FAST": ValueOf(syscall.BPF_T_NANOTIME_MONOTONIC_FAST), + "BPF_T_NONE": ValueOf(syscall.BPF_T_NONE), + "BPF_T_NORMAL": ValueOf(syscall.BPF_T_NORMAL), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BpfBuflen": ValueOf(syscall.BpfBuflen), + "BpfDatalink": ValueOf(syscall.BpfDatalink), + "BpfHeadercmpl": ValueOf(syscall.BpfHeadercmpl), + "BpfInterface": ValueOf(syscall.BpfInterface), + "BpfJump": ValueOf(syscall.BpfJump), + "BpfStats": ValueOf(syscall.BpfStats), + "BpfStmt": ValueOf(syscall.BpfStmt), + "BpfTimeout": ValueOf(syscall.BpfTimeout), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CFLUSH": ValueOf(syscall.CFLUSH), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTART": ValueOf(syscall.CSTART), + "CSTATUS": ValueOf(syscall.CSTATUS), + "CSTOP": ValueOf(syscall.CSTOP), + "CSTOPB": ValueOf(syscall.CSTOPB), + "CSUSP": ValueOf(syscall.CSUSP), + "CTL_MAXNAME": ValueOf(syscall.CTL_MAXNAME), + "CTL_NET": ValueOf(syscall.CTL_NET), + "Chdir": ValueOf(syscall.Chdir), + "CheckBpfVersion": ValueOf(syscall.CheckBpfVersion), + "Chflags": ValueOf(syscall.Chflags), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "DLT_A429": ValueOf(syscall.DLT_A429), + "DLT_A653_ICM": ValueOf(syscall.DLT_A653_ICM), + "DLT_AIRONET_HEADER": ValueOf(syscall.DLT_AIRONET_HEADER), + "DLT_AOS": ValueOf(syscall.DLT_AOS), + "DLT_APPLE_IP_OVER_IEEE1394": ValueOf(syscall.DLT_APPLE_IP_OVER_IEEE1394), + "DLT_ARCNET": ValueOf(syscall.DLT_ARCNET), + "DLT_ARCNET_LINUX": ValueOf(syscall.DLT_ARCNET_LINUX), + "DLT_ATM_CLIP": ValueOf(syscall.DLT_ATM_CLIP), + "DLT_ATM_RFC1483": ValueOf(syscall.DLT_ATM_RFC1483), + "DLT_AURORA": ValueOf(syscall.DLT_AURORA), + "DLT_AX25": ValueOf(syscall.DLT_AX25), + "DLT_AX25_KISS": ValueOf(syscall.DLT_AX25_KISS), + "DLT_BACNET_MS_TP": ValueOf(syscall.DLT_BACNET_MS_TP), + "DLT_BLUETOOTH_HCI_H4": ValueOf(syscall.DLT_BLUETOOTH_HCI_H4), + "DLT_BLUETOOTH_HCI_H4_WITH_PHDR": ValueOf(syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR), + "DLT_CAN20B": ValueOf(syscall.DLT_CAN20B), + "DLT_CAN_SOCKETCAN": ValueOf(syscall.DLT_CAN_SOCKETCAN), + "DLT_CHAOS": ValueOf(syscall.DLT_CHAOS), + "DLT_CHDLC": ValueOf(syscall.DLT_CHDLC), + "DLT_CISCO_IOS": ValueOf(syscall.DLT_CISCO_IOS), + "DLT_C_HDLC": ValueOf(syscall.DLT_C_HDLC), + "DLT_C_HDLC_WITH_DIR": ValueOf(syscall.DLT_C_HDLC_WITH_DIR), + "DLT_DBUS": ValueOf(syscall.DLT_DBUS), + "DLT_DECT": ValueOf(syscall.DLT_DECT), + "DLT_DOCSIS": ValueOf(syscall.DLT_DOCSIS), + "DLT_DVB_CI": ValueOf(syscall.DLT_DVB_CI), + "DLT_ECONET": ValueOf(syscall.DLT_ECONET), + "DLT_EN10MB": ValueOf(syscall.DLT_EN10MB), + "DLT_EN3MB": ValueOf(syscall.DLT_EN3MB), + "DLT_ENC": ValueOf(syscall.DLT_ENC), + "DLT_ERF": ValueOf(syscall.DLT_ERF), + "DLT_ERF_ETH": ValueOf(syscall.DLT_ERF_ETH), + "DLT_ERF_POS": ValueOf(syscall.DLT_ERF_POS), + "DLT_FC_2": ValueOf(syscall.DLT_FC_2), + "DLT_FC_2_WITH_FRAME_DELIMS": ValueOf(syscall.DLT_FC_2_WITH_FRAME_DELIMS), + "DLT_FDDI": ValueOf(syscall.DLT_FDDI), + "DLT_FLEXRAY": ValueOf(syscall.DLT_FLEXRAY), + "DLT_FRELAY": ValueOf(syscall.DLT_FRELAY), + "DLT_FRELAY_WITH_DIR": ValueOf(syscall.DLT_FRELAY_WITH_DIR), + "DLT_GCOM_SERIAL": ValueOf(syscall.DLT_GCOM_SERIAL), + "DLT_GCOM_T1E1": ValueOf(syscall.DLT_GCOM_T1E1), + "DLT_GPF_F": ValueOf(syscall.DLT_GPF_F), + "DLT_GPF_T": ValueOf(syscall.DLT_GPF_T), + "DLT_GPRS_LLC": ValueOf(syscall.DLT_GPRS_LLC), + "DLT_GSMTAP_ABIS": ValueOf(syscall.DLT_GSMTAP_ABIS), + "DLT_GSMTAP_UM": ValueOf(syscall.DLT_GSMTAP_UM), + "DLT_HHDLC": ValueOf(syscall.DLT_HHDLC), + "DLT_IBM_SN": ValueOf(syscall.DLT_IBM_SN), + "DLT_IBM_SP": ValueOf(syscall.DLT_IBM_SP), + "DLT_IEEE802": ValueOf(syscall.DLT_IEEE802), + "DLT_IEEE802_11": ValueOf(syscall.DLT_IEEE802_11), + "DLT_IEEE802_11_RADIO": ValueOf(syscall.DLT_IEEE802_11_RADIO), + "DLT_IEEE802_11_RADIO_AVS": ValueOf(syscall.DLT_IEEE802_11_RADIO_AVS), + "DLT_IEEE802_15_4": ValueOf(syscall.DLT_IEEE802_15_4), + "DLT_IEEE802_15_4_LINUX": ValueOf(syscall.DLT_IEEE802_15_4_LINUX), + "DLT_IEEE802_15_4_NOFCS": ValueOf(syscall.DLT_IEEE802_15_4_NOFCS), + "DLT_IEEE802_15_4_NONASK_PHY": ValueOf(syscall.DLT_IEEE802_15_4_NONASK_PHY), + "DLT_IEEE802_16_MAC_CPS": ValueOf(syscall.DLT_IEEE802_16_MAC_CPS), + "DLT_IEEE802_16_MAC_CPS_RADIO": ValueOf(syscall.DLT_IEEE802_16_MAC_CPS_RADIO), + "DLT_IPFILTER": ValueOf(syscall.DLT_IPFILTER), + "DLT_IPMB": ValueOf(syscall.DLT_IPMB), + "DLT_IPMB_LINUX": ValueOf(syscall.DLT_IPMB_LINUX), + "DLT_IPNET": ValueOf(syscall.DLT_IPNET), + "DLT_IPOIB": ValueOf(syscall.DLT_IPOIB), + "DLT_IPV4": ValueOf(syscall.DLT_IPV4), + "DLT_IPV6": ValueOf(syscall.DLT_IPV6), + "DLT_IP_OVER_FC": ValueOf(syscall.DLT_IP_OVER_FC), + "DLT_JUNIPER_ATM1": ValueOf(syscall.DLT_JUNIPER_ATM1), + "DLT_JUNIPER_ATM2": ValueOf(syscall.DLT_JUNIPER_ATM2), + "DLT_JUNIPER_ATM_CEMIC": ValueOf(syscall.DLT_JUNIPER_ATM_CEMIC), + "DLT_JUNIPER_CHDLC": ValueOf(syscall.DLT_JUNIPER_CHDLC), + "DLT_JUNIPER_ES": ValueOf(syscall.DLT_JUNIPER_ES), + "DLT_JUNIPER_ETHER": ValueOf(syscall.DLT_JUNIPER_ETHER), + "DLT_JUNIPER_FIBRECHANNEL": ValueOf(syscall.DLT_JUNIPER_FIBRECHANNEL), + "DLT_JUNIPER_FRELAY": ValueOf(syscall.DLT_JUNIPER_FRELAY), + "DLT_JUNIPER_GGSN": ValueOf(syscall.DLT_JUNIPER_GGSN), + "DLT_JUNIPER_ISM": ValueOf(syscall.DLT_JUNIPER_ISM), + "DLT_JUNIPER_MFR": ValueOf(syscall.DLT_JUNIPER_MFR), + "DLT_JUNIPER_MLFR": ValueOf(syscall.DLT_JUNIPER_MLFR), + "DLT_JUNIPER_MLPPP": ValueOf(syscall.DLT_JUNIPER_MLPPP), + "DLT_JUNIPER_MONITOR": ValueOf(syscall.DLT_JUNIPER_MONITOR), + "DLT_JUNIPER_PIC_PEER": ValueOf(syscall.DLT_JUNIPER_PIC_PEER), + "DLT_JUNIPER_PPP": ValueOf(syscall.DLT_JUNIPER_PPP), + "DLT_JUNIPER_PPPOE": ValueOf(syscall.DLT_JUNIPER_PPPOE), + "DLT_JUNIPER_PPPOE_ATM": ValueOf(syscall.DLT_JUNIPER_PPPOE_ATM), + "DLT_JUNIPER_SERVICES": ValueOf(syscall.DLT_JUNIPER_SERVICES), + "DLT_JUNIPER_SRX_E2E": ValueOf(syscall.DLT_JUNIPER_SRX_E2E), + "DLT_JUNIPER_ST": ValueOf(syscall.DLT_JUNIPER_ST), + "DLT_JUNIPER_VP": ValueOf(syscall.DLT_JUNIPER_VP), + "DLT_JUNIPER_VS": ValueOf(syscall.DLT_JUNIPER_VS), + "DLT_LAPB_WITH_DIR": ValueOf(syscall.DLT_LAPB_WITH_DIR), + "DLT_LAPD": ValueOf(syscall.DLT_LAPD), + "DLT_LIN": ValueOf(syscall.DLT_LIN), + "DLT_LINUX_EVDEV": ValueOf(syscall.DLT_LINUX_EVDEV), + "DLT_LINUX_IRDA": ValueOf(syscall.DLT_LINUX_IRDA), + "DLT_LINUX_LAPD": ValueOf(syscall.DLT_LINUX_LAPD), + "DLT_LINUX_PPP_WITHDIRECTION": ValueOf(syscall.DLT_LINUX_PPP_WITHDIRECTION), + "DLT_LINUX_SLL": ValueOf(syscall.DLT_LINUX_SLL), + "DLT_LOOP": ValueOf(syscall.DLT_LOOP), + "DLT_LTALK": ValueOf(syscall.DLT_LTALK), + "DLT_MATCHING_MAX": ValueOf(syscall.DLT_MATCHING_MAX), + "DLT_MATCHING_MIN": ValueOf(syscall.DLT_MATCHING_MIN), + "DLT_MFR": ValueOf(syscall.DLT_MFR), + "DLT_MOST": ValueOf(syscall.DLT_MOST), + "DLT_MPEG_2_TS": ValueOf(syscall.DLT_MPEG_2_TS), + "DLT_MPLS": ValueOf(syscall.DLT_MPLS), + "DLT_MTP2": ValueOf(syscall.DLT_MTP2), + "DLT_MTP2_WITH_PHDR": ValueOf(syscall.DLT_MTP2_WITH_PHDR), + "DLT_MTP3": ValueOf(syscall.DLT_MTP3), + "DLT_MUX27010": ValueOf(syscall.DLT_MUX27010), + "DLT_NETANALYZER": ValueOf(syscall.DLT_NETANALYZER), + "DLT_NETANALYZER_TRANSPARENT": ValueOf(syscall.DLT_NETANALYZER_TRANSPARENT), + "DLT_NFC_LLCP": ValueOf(syscall.DLT_NFC_LLCP), + "DLT_NFLOG": ValueOf(syscall.DLT_NFLOG), + "DLT_NG40": ValueOf(syscall.DLT_NG40), + "DLT_NULL": ValueOf(syscall.DLT_NULL), + "DLT_PCI_EXP": ValueOf(syscall.DLT_PCI_EXP), + "DLT_PFLOG": ValueOf(syscall.DLT_PFLOG), + "DLT_PFSYNC": ValueOf(syscall.DLT_PFSYNC), + "DLT_PPI": ValueOf(syscall.DLT_PPI), + "DLT_PPP": ValueOf(syscall.DLT_PPP), + "DLT_PPP_BSDOS": ValueOf(syscall.DLT_PPP_BSDOS), + "DLT_PPP_ETHER": ValueOf(syscall.DLT_PPP_ETHER), + "DLT_PPP_PPPD": ValueOf(syscall.DLT_PPP_PPPD), + "DLT_PPP_SERIAL": ValueOf(syscall.DLT_PPP_SERIAL), + "DLT_PPP_WITH_DIR": ValueOf(syscall.DLT_PPP_WITH_DIR), + "DLT_PPP_WITH_DIRECTION": ValueOf(syscall.DLT_PPP_WITH_DIRECTION), + "DLT_PRISM_HEADER": ValueOf(syscall.DLT_PRISM_HEADER), + "DLT_PRONET": ValueOf(syscall.DLT_PRONET), + "DLT_RAIF1": ValueOf(syscall.DLT_RAIF1), + "DLT_RAW": ValueOf(syscall.DLT_RAW), + "DLT_RIO": ValueOf(syscall.DLT_RIO), + "DLT_SCCP": ValueOf(syscall.DLT_SCCP), + "DLT_SITA": ValueOf(syscall.DLT_SITA), + "DLT_SLIP": ValueOf(syscall.DLT_SLIP), + "DLT_SLIP_BSDOS": ValueOf(syscall.DLT_SLIP_BSDOS), + "DLT_STANAG_5066_D_PDU": ValueOf(syscall.DLT_STANAG_5066_D_PDU), + "DLT_SUNATM": ValueOf(syscall.DLT_SUNATM), + "DLT_SYMANTEC_FIREWALL": ValueOf(syscall.DLT_SYMANTEC_FIREWALL), + "DLT_TZSP": ValueOf(syscall.DLT_TZSP), + "DLT_USB": ValueOf(syscall.DLT_USB), + "DLT_USB_LINUX": ValueOf(syscall.DLT_USB_LINUX), + "DLT_USB_LINUX_MMAPPED": ValueOf(syscall.DLT_USB_LINUX_MMAPPED), + "DLT_USER0": ValueOf(syscall.DLT_USER0), + "DLT_USER1": ValueOf(syscall.DLT_USER1), + "DLT_USER10": ValueOf(syscall.DLT_USER10), + "DLT_USER11": ValueOf(syscall.DLT_USER11), + "DLT_USER12": ValueOf(syscall.DLT_USER12), + "DLT_USER13": ValueOf(syscall.DLT_USER13), + "DLT_USER14": ValueOf(syscall.DLT_USER14), + "DLT_USER15": ValueOf(syscall.DLT_USER15), + "DLT_USER2": ValueOf(syscall.DLT_USER2), + "DLT_USER3": ValueOf(syscall.DLT_USER3), + "DLT_USER4": ValueOf(syscall.DLT_USER4), + "DLT_USER5": ValueOf(syscall.DLT_USER5), + "DLT_USER6": ValueOf(syscall.DLT_USER6), + "DLT_USER7": ValueOf(syscall.DLT_USER7), + "DLT_USER8": ValueOf(syscall.DLT_USER8), + "DLT_USER9": ValueOf(syscall.DLT_USER9), + "DLT_WIHART": ValueOf(syscall.DLT_WIHART), + "DLT_X2E_SERIAL": ValueOf(syscall.DLT_X2E_SERIAL), + "DLT_X2E_XORAYA": ValueOf(syscall.DLT_X2E_XORAYA), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EAUTH": ValueOf(syscall.EAUTH), + "EBADF": ValueOf(syscall.EBADF), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADRPC": ValueOf(syscall.EBADRPC), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECAPMODE": ValueOf(syscall.ECAPMODE), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOOFUS": ValueOf(syscall.EDOOFUS), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EFTYPE": ValueOf(syscall.EFTYPE), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "ELAST": ValueOf(syscall.ELAST), + "ELOOP": ValueOf(syscall.ELOOP), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENEEDAUTH": ValueOf(syscall.ENEEDAUTH), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOATTR": ValueOf(syscall.ENOATTR), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCAPABLE": ValueOf(syscall.ENOTCAPABLE), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPROCLIM": ValueOf(syscall.EPROCLIM), + "EPROCUNAVAIL": ValueOf(syscall.EPROCUNAVAIL), + "EPROGMISMATCH": ValueOf(syscall.EPROGMISMATCH), + "EPROGUNAVAIL": ValueOf(syscall.EPROGUNAVAIL), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EROFS": ValueOf(syscall.EROFS), + "ERPCMISMATCH": ValueOf(syscall.ERPCMISMATCH), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESTALE": ValueOf(syscall.ESTALE), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUSERS": ValueOf(syscall.EUSERS), + "EVFILT_AIO": ValueOf(syscall.EVFILT_AIO), + "EVFILT_FS": ValueOf(syscall.EVFILT_FS), + "EVFILT_LIO": ValueOf(syscall.EVFILT_LIO), + "EVFILT_PROC": ValueOf(syscall.EVFILT_PROC), + "EVFILT_READ": ValueOf(syscall.EVFILT_READ), + "EVFILT_SIGNAL": ValueOf(syscall.EVFILT_SIGNAL), + "EVFILT_SYSCOUNT": ValueOf(syscall.EVFILT_SYSCOUNT), + "EVFILT_TIMER": ValueOf(syscall.EVFILT_TIMER), + "EVFILT_USER": ValueOf(syscall.EVFILT_USER), + "EVFILT_VNODE": ValueOf(syscall.EVFILT_VNODE), + "EVFILT_WRITE": ValueOf(syscall.EVFILT_WRITE), + "EV_ADD": ValueOf(syscall.EV_ADD), + "EV_CLEAR": ValueOf(syscall.EV_CLEAR), + "EV_DELETE": ValueOf(syscall.EV_DELETE), + "EV_DISABLE": ValueOf(syscall.EV_DISABLE), + "EV_DISPATCH": ValueOf(syscall.EV_DISPATCH), + "EV_DROP": ValueOf(syscall.EV_DROP), + "EV_ENABLE": ValueOf(syscall.EV_ENABLE), + "EV_EOF": ValueOf(syscall.EV_EOF), + "EV_ERROR": ValueOf(syscall.EV_ERROR), + "EV_FLAG1": ValueOf(syscall.EV_FLAG1), + "EV_ONESHOT": ValueOf(syscall.EV_ONESHOT), + "EV_RECEIPT": ValueOf(syscall.EV_RECEIPT), + "EV_SYSFLAGS": ValueOf(syscall.EV_SYSFLAGS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXTA": ValueOf(syscall.EXTA), + "EXTB": ValueOf(syscall.EXTB), + "EXTPROC": ValueOf(syscall.EXTPROC), + "Environ": ValueOf(syscall.Environ), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_CANCEL": ValueOf(syscall.F_CANCEL), + "F_DUP2FD": ValueOf(syscall.F_DUP2FD), + "F_DUP2FD_CLOEXEC": ValueOf(syscall.F_DUP2FD_CLOEXEC), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_OGETLK": ValueOf(syscall.F_OGETLK), + "F_OK": ValueOf(syscall.F_OK), + "F_OSETLK": ValueOf(syscall.F_OSETLK), + "F_OSETLKW": ValueOf(syscall.F_OSETLKW), + "F_RDAHEAD": ValueOf(syscall.F_RDAHEAD), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_READAHEAD": ValueOf(syscall.F_READAHEAD), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLK_REMOTE": ValueOf(syscall.F_SETLK_REMOTE), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_UNLCKSYS": ValueOf(syscall.F_UNLCKSYS), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchflags": ValueOf(syscall.Fchflags), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchown": ValueOf(syscall.Fchown), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Flock": ValueOf(syscall.Flock), + "FlushBpf": ValueOf(syscall.FlushBpf), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fpathconf": ValueOf(syscall.Fpathconf), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Getdirentries": ValueOf(syscall.Getdirentries), + "Getdtablesize": ValueOf(syscall.Getdtablesize), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getfsstat": ValueOf(syscall.Getfsstat), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsid": ValueOf(syscall.Getsid), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptByte": ValueOf(syscall.GetsockoptByte), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMP6_FILTER": ValueOf(syscall.ICMP6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFAN_ARRIVAL": ValueOf(syscall.IFAN_ARRIVAL), + "IFAN_DEPARTURE": ValueOf(syscall.IFAN_DEPARTURE), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_ALTPHYS": ValueOf(syscall.IFF_ALTPHYS), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_CANTCHANGE": ValueOf(syscall.IFF_CANTCHANGE), + "IFF_CANTCONFIG": ValueOf(syscall.IFF_CANTCONFIG), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DRV_OACTIVE": ValueOf(syscall.IFF_DRV_OACTIVE), + "IFF_DRV_RUNNING": ValueOf(syscall.IFF_DRV_RUNNING), + "IFF_DYING": ValueOf(syscall.IFF_DYING), + "IFF_LINK0": ValueOf(syscall.IFF_LINK0), + "IFF_LINK1": ValueOf(syscall.IFF_LINK1), + "IFF_LINK2": ValueOf(syscall.IFF_LINK2), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MONITOR": ValueOf(syscall.IFF_MONITOR), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_OACTIVE": ValueOf(syscall.IFF_OACTIVE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PPROMISC": ValueOf(syscall.IFF_PPROMISC), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RENAMING": ValueOf(syscall.IFF_RENAMING), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SIMPLEX": ValueOf(syscall.IFF_SIMPLEX), + "IFF_SMART": ValueOf(syscall.IFF_SMART), + "IFF_STATICARP": ValueOf(syscall.IFF_STATICARP), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IFT_1822": ValueOf(syscall.IFT_1822), + "IFT_A12MPPSWITCH": ValueOf(syscall.IFT_A12MPPSWITCH), + "IFT_AAL2": ValueOf(syscall.IFT_AAL2), + "IFT_AAL5": ValueOf(syscall.IFT_AAL5), + "IFT_ADSL": ValueOf(syscall.IFT_ADSL), + "IFT_AFLANE8023": ValueOf(syscall.IFT_AFLANE8023), + "IFT_AFLANE8025": ValueOf(syscall.IFT_AFLANE8025), + "IFT_ARAP": ValueOf(syscall.IFT_ARAP), + "IFT_ARCNET": ValueOf(syscall.IFT_ARCNET), + "IFT_ARCNETPLUS": ValueOf(syscall.IFT_ARCNETPLUS), + "IFT_ASYNC": ValueOf(syscall.IFT_ASYNC), + "IFT_ATM": ValueOf(syscall.IFT_ATM), + "IFT_ATMDXI": ValueOf(syscall.IFT_ATMDXI), + "IFT_ATMFUNI": ValueOf(syscall.IFT_ATMFUNI), + "IFT_ATMIMA": ValueOf(syscall.IFT_ATMIMA), + "IFT_ATMLOGICAL": ValueOf(syscall.IFT_ATMLOGICAL), + "IFT_ATMRADIO": ValueOf(syscall.IFT_ATMRADIO), + "IFT_ATMSUBINTERFACE": ValueOf(syscall.IFT_ATMSUBINTERFACE), + "IFT_ATMVCIENDPT": ValueOf(syscall.IFT_ATMVCIENDPT), + "IFT_ATMVIRTUAL": ValueOf(syscall.IFT_ATMVIRTUAL), + "IFT_BGPPOLICYACCOUNTING": ValueOf(syscall.IFT_BGPPOLICYACCOUNTING), + "IFT_BRIDGE": ValueOf(syscall.IFT_BRIDGE), + "IFT_BSC": ValueOf(syscall.IFT_BSC), + "IFT_CARP": ValueOf(syscall.IFT_CARP), + "IFT_CCTEMUL": ValueOf(syscall.IFT_CCTEMUL), + "IFT_CEPT": ValueOf(syscall.IFT_CEPT), + "IFT_CES": ValueOf(syscall.IFT_CES), + "IFT_CHANNEL": ValueOf(syscall.IFT_CHANNEL), + "IFT_CNR": ValueOf(syscall.IFT_CNR), + "IFT_COFFEE": ValueOf(syscall.IFT_COFFEE), + "IFT_COMPOSITELINK": ValueOf(syscall.IFT_COMPOSITELINK), + "IFT_DCN": ValueOf(syscall.IFT_DCN), + "IFT_DIGITALPOWERLINE": ValueOf(syscall.IFT_DIGITALPOWERLINE), + "IFT_DIGITALWRAPPEROVERHEADCHANNEL": ValueOf(syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL), + "IFT_DLSW": ValueOf(syscall.IFT_DLSW), + "IFT_DOCSCABLEDOWNSTREAM": ValueOf(syscall.IFT_DOCSCABLEDOWNSTREAM), + "IFT_DOCSCABLEMACLAYER": ValueOf(syscall.IFT_DOCSCABLEMACLAYER), + "IFT_DOCSCABLEUPSTREAM": ValueOf(syscall.IFT_DOCSCABLEUPSTREAM), + "IFT_DS0": ValueOf(syscall.IFT_DS0), + "IFT_DS0BUNDLE": ValueOf(syscall.IFT_DS0BUNDLE), + "IFT_DS1FDL": ValueOf(syscall.IFT_DS1FDL), + "IFT_DS3": ValueOf(syscall.IFT_DS3), + "IFT_DTM": ValueOf(syscall.IFT_DTM), + "IFT_DVBASILN": ValueOf(syscall.IFT_DVBASILN), + "IFT_DVBASIOUT": ValueOf(syscall.IFT_DVBASIOUT), + "IFT_DVBRCCDOWNSTREAM": ValueOf(syscall.IFT_DVBRCCDOWNSTREAM), + "IFT_DVBRCCMACLAYER": ValueOf(syscall.IFT_DVBRCCMACLAYER), + "IFT_DVBRCCUPSTREAM": ValueOf(syscall.IFT_DVBRCCUPSTREAM), + "IFT_ENC": ValueOf(syscall.IFT_ENC), + "IFT_EON": ValueOf(syscall.IFT_EON), + "IFT_EPLRS": ValueOf(syscall.IFT_EPLRS), + "IFT_ESCON": ValueOf(syscall.IFT_ESCON), + "IFT_ETHER": ValueOf(syscall.IFT_ETHER), + "IFT_FAITH": ValueOf(syscall.IFT_FAITH), + "IFT_FAST": ValueOf(syscall.IFT_FAST), + "IFT_FASTETHER": ValueOf(syscall.IFT_FASTETHER), + "IFT_FASTETHERFX": ValueOf(syscall.IFT_FASTETHERFX), + "IFT_FDDI": ValueOf(syscall.IFT_FDDI), + "IFT_FIBRECHANNEL": ValueOf(syscall.IFT_FIBRECHANNEL), + "IFT_FRAMERELAYINTERCONNECT": ValueOf(syscall.IFT_FRAMERELAYINTERCONNECT), + "IFT_FRAMERELAYMPI": ValueOf(syscall.IFT_FRAMERELAYMPI), + "IFT_FRDLCIENDPT": ValueOf(syscall.IFT_FRDLCIENDPT), + "IFT_FRELAY": ValueOf(syscall.IFT_FRELAY), + "IFT_FRELAYDCE": ValueOf(syscall.IFT_FRELAYDCE), + "IFT_FRF16MFRBUNDLE": ValueOf(syscall.IFT_FRF16MFRBUNDLE), + "IFT_FRFORWARD": ValueOf(syscall.IFT_FRFORWARD), + "IFT_G703AT2MB": ValueOf(syscall.IFT_G703AT2MB), + "IFT_G703AT64K": ValueOf(syscall.IFT_G703AT64K), + "IFT_GIF": ValueOf(syscall.IFT_GIF), + "IFT_GIGABITETHERNET": ValueOf(syscall.IFT_GIGABITETHERNET), + "IFT_GR303IDT": ValueOf(syscall.IFT_GR303IDT), + "IFT_GR303RDT": ValueOf(syscall.IFT_GR303RDT), + "IFT_H323GATEKEEPER": ValueOf(syscall.IFT_H323GATEKEEPER), + "IFT_H323PROXY": ValueOf(syscall.IFT_H323PROXY), + "IFT_HDH1822": ValueOf(syscall.IFT_HDH1822), + "IFT_HDLC": ValueOf(syscall.IFT_HDLC), + "IFT_HDSL2": ValueOf(syscall.IFT_HDSL2), + "IFT_HIPERLAN2": ValueOf(syscall.IFT_HIPERLAN2), + "IFT_HIPPI": ValueOf(syscall.IFT_HIPPI), + "IFT_HIPPIINTERFACE": ValueOf(syscall.IFT_HIPPIINTERFACE), + "IFT_HOSTPAD": ValueOf(syscall.IFT_HOSTPAD), + "IFT_HSSI": ValueOf(syscall.IFT_HSSI), + "IFT_HY": ValueOf(syscall.IFT_HY), + "IFT_IBM370PARCHAN": ValueOf(syscall.IFT_IBM370PARCHAN), + "IFT_IDSL": ValueOf(syscall.IFT_IDSL), + "IFT_IEEE1394": ValueOf(syscall.IFT_IEEE1394), + "IFT_IEEE80211": ValueOf(syscall.IFT_IEEE80211), + "IFT_IEEE80212": ValueOf(syscall.IFT_IEEE80212), + "IFT_IEEE8023ADLAG": ValueOf(syscall.IFT_IEEE8023ADLAG), + "IFT_IFGSN": ValueOf(syscall.IFT_IFGSN), + "IFT_IMT": ValueOf(syscall.IFT_IMT), + "IFT_INFINIBAND": ValueOf(syscall.IFT_INFINIBAND), + "IFT_INTERLEAVE": ValueOf(syscall.IFT_INTERLEAVE), + "IFT_IP": ValueOf(syscall.IFT_IP), + "IFT_IPFORWARD": ValueOf(syscall.IFT_IPFORWARD), + "IFT_IPOVERATM": ValueOf(syscall.IFT_IPOVERATM), + "IFT_IPOVERCDLC": ValueOf(syscall.IFT_IPOVERCDLC), + "IFT_IPOVERCLAW": ValueOf(syscall.IFT_IPOVERCLAW), + "IFT_IPSWITCH": ValueOf(syscall.IFT_IPSWITCH), + "IFT_IPXIP": ValueOf(syscall.IFT_IPXIP), + "IFT_ISDN": ValueOf(syscall.IFT_ISDN), + "IFT_ISDNBASIC": ValueOf(syscall.IFT_ISDNBASIC), + "IFT_ISDNPRIMARY": ValueOf(syscall.IFT_ISDNPRIMARY), + "IFT_ISDNS": ValueOf(syscall.IFT_ISDNS), + "IFT_ISDNU": ValueOf(syscall.IFT_ISDNU), + "IFT_ISO88022LLC": ValueOf(syscall.IFT_ISO88022LLC), + "IFT_ISO88023": ValueOf(syscall.IFT_ISO88023), + "IFT_ISO88024": ValueOf(syscall.IFT_ISO88024), + "IFT_ISO88025": ValueOf(syscall.IFT_ISO88025), + "IFT_ISO88025CRFPINT": ValueOf(syscall.IFT_ISO88025CRFPINT), + "IFT_ISO88025DTR": ValueOf(syscall.IFT_ISO88025DTR), + "IFT_ISO88025FIBER": ValueOf(syscall.IFT_ISO88025FIBER), + "IFT_ISO88026": ValueOf(syscall.IFT_ISO88026), + "IFT_ISUP": ValueOf(syscall.IFT_ISUP), + "IFT_L2VLAN": ValueOf(syscall.IFT_L2VLAN), + "IFT_L3IPVLAN": ValueOf(syscall.IFT_L3IPVLAN), + "IFT_L3IPXVLAN": ValueOf(syscall.IFT_L3IPXVLAN), + "IFT_LAPB": ValueOf(syscall.IFT_LAPB), + "IFT_LAPD": ValueOf(syscall.IFT_LAPD), + "IFT_LAPF": ValueOf(syscall.IFT_LAPF), + "IFT_LOCALTALK": ValueOf(syscall.IFT_LOCALTALK), + "IFT_LOOP": ValueOf(syscall.IFT_LOOP), + "IFT_MEDIAMAILOVERIP": ValueOf(syscall.IFT_MEDIAMAILOVERIP), + "IFT_MFSIGLINK": ValueOf(syscall.IFT_MFSIGLINK), + "IFT_MIOX25": ValueOf(syscall.IFT_MIOX25), + "IFT_MODEM": ValueOf(syscall.IFT_MODEM), + "IFT_MPC": ValueOf(syscall.IFT_MPC), + "IFT_MPLS": ValueOf(syscall.IFT_MPLS), + "IFT_MPLSTUNNEL": ValueOf(syscall.IFT_MPLSTUNNEL), + "IFT_MSDSL": ValueOf(syscall.IFT_MSDSL), + "IFT_MVL": ValueOf(syscall.IFT_MVL), + "IFT_MYRINET": ValueOf(syscall.IFT_MYRINET), + "IFT_NFAS": ValueOf(syscall.IFT_NFAS), + "IFT_NSIP": ValueOf(syscall.IFT_NSIP), + "IFT_OPTICALCHANNEL": ValueOf(syscall.IFT_OPTICALCHANNEL), + "IFT_OPTICALTRANSPORT": ValueOf(syscall.IFT_OPTICALTRANSPORT), + "IFT_OTHER": ValueOf(syscall.IFT_OTHER), + "IFT_P10": ValueOf(syscall.IFT_P10), + "IFT_P80": ValueOf(syscall.IFT_P80), + "IFT_PARA": ValueOf(syscall.IFT_PARA), + "IFT_PFLOG": ValueOf(syscall.IFT_PFLOG), + "IFT_PFSYNC": ValueOf(syscall.IFT_PFSYNC), + "IFT_PLC": ValueOf(syscall.IFT_PLC), + "IFT_POS": ValueOf(syscall.IFT_POS), + "IFT_PPP": ValueOf(syscall.IFT_PPP), + "IFT_PPPMULTILINKBUNDLE": ValueOf(syscall.IFT_PPPMULTILINKBUNDLE), + "IFT_PROPBWAP2MP": ValueOf(syscall.IFT_PROPBWAP2MP), + "IFT_PROPCNLS": ValueOf(syscall.IFT_PROPCNLS), + "IFT_PROPDOCSWIRELESSDOWNSTREAM": ValueOf(syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM), + "IFT_PROPDOCSWIRELESSMACLAYER": ValueOf(syscall.IFT_PROPDOCSWIRELESSMACLAYER), + "IFT_PROPDOCSWIRELESSUPSTREAM": ValueOf(syscall.IFT_PROPDOCSWIRELESSUPSTREAM), + "IFT_PROPMUX": ValueOf(syscall.IFT_PROPMUX), + "IFT_PROPVIRTUAL": ValueOf(syscall.IFT_PROPVIRTUAL), + "IFT_PROPWIRELESSP2P": ValueOf(syscall.IFT_PROPWIRELESSP2P), + "IFT_PTPSERIAL": ValueOf(syscall.IFT_PTPSERIAL), + "IFT_PVC": ValueOf(syscall.IFT_PVC), + "IFT_QLLC": ValueOf(syscall.IFT_QLLC), + "IFT_RADIOMAC": ValueOf(syscall.IFT_RADIOMAC), + "IFT_RADSL": ValueOf(syscall.IFT_RADSL), + "IFT_REACHDSL": ValueOf(syscall.IFT_REACHDSL), + "IFT_RFC1483": ValueOf(syscall.IFT_RFC1483), + "IFT_RS232": ValueOf(syscall.IFT_RS232), + "IFT_RSRB": ValueOf(syscall.IFT_RSRB), + "IFT_SDLC": ValueOf(syscall.IFT_SDLC), + "IFT_SDSL": ValueOf(syscall.IFT_SDSL), + "IFT_SHDSL": ValueOf(syscall.IFT_SHDSL), + "IFT_SIP": ValueOf(syscall.IFT_SIP), + "IFT_SLIP": ValueOf(syscall.IFT_SLIP), + "IFT_SMDSDXI": ValueOf(syscall.IFT_SMDSDXI), + "IFT_SMDSICIP": ValueOf(syscall.IFT_SMDSICIP), + "IFT_SONET": ValueOf(syscall.IFT_SONET), + "IFT_SONETOVERHEADCHANNEL": ValueOf(syscall.IFT_SONETOVERHEADCHANNEL), + "IFT_SONETPATH": ValueOf(syscall.IFT_SONETPATH), + "IFT_SONETVT": ValueOf(syscall.IFT_SONETVT), + "IFT_SRP": ValueOf(syscall.IFT_SRP), + "IFT_SS7SIGLINK": ValueOf(syscall.IFT_SS7SIGLINK), + "IFT_STACKTOSTACK": ValueOf(syscall.IFT_STACKTOSTACK), + "IFT_STARLAN": ValueOf(syscall.IFT_STARLAN), + "IFT_STF": ValueOf(syscall.IFT_STF), + "IFT_T1": ValueOf(syscall.IFT_T1), + "IFT_TDLC": ValueOf(syscall.IFT_TDLC), + "IFT_TERMPAD": ValueOf(syscall.IFT_TERMPAD), + "IFT_TR008": ValueOf(syscall.IFT_TR008), + "IFT_TRANSPHDLC": ValueOf(syscall.IFT_TRANSPHDLC), + "IFT_TUNNEL": ValueOf(syscall.IFT_TUNNEL), + "IFT_ULTRA": ValueOf(syscall.IFT_ULTRA), + "IFT_USB": ValueOf(syscall.IFT_USB), + "IFT_V11": ValueOf(syscall.IFT_V11), + "IFT_V35": ValueOf(syscall.IFT_V35), + "IFT_V36": ValueOf(syscall.IFT_V36), + "IFT_V37": ValueOf(syscall.IFT_V37), + "IFT_VDSL": ValueOf(syscall.IFT_VDSL), + "IFT_VIRTUALIPADDRESS": ValueOf(syscall.IFT_VIRTUALIPADDRESS), + "IFT_VOICEEM": ValueOf(syscall.IFT_VOICEEM), + "IFT_VOICEENCAP": ValueOf(syscall.IFT_VOICEENCAP), + "IFT_VOICEFXO": ValueOf(syscall.IFT_VOICEFXO), + "IFT_VOICEFXS": ValueOf(syscall.IFT_VOICEFXS), + "IFT_VOICEOVERATM": ValueOf(syscall.IFT_VOICEOVERATM), + "IFT_VOICEOVERFRAMERELAY": ValueOf(syscall.IFT_VOICEOVERFRAMERELAY), + "IFT_VOICEOVERIP": ValueOf(syscall.IFT_VOICEOVERIP), + "IFT_X213": ValueOf(syscall.IFT_X213), + "IFT_X25": ValueOf(syscall.IFT_X25), + "IFT_X25DDN": ValueOf(syscall.IFT_X25DDN), + "IFT_X25HUNTGROUP": ValueOf(syscall.IFT_X25HUNTGROUP), + "IFT_X25MLP": ValueOf(syscall.IFT_X25MLP), + "IFT_X25PLE": ValueOf(syscall.IFT_X25PLE), + "IFT_XETHER": ValueOf(syscall.IFT_XETHER), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLASSD_HOST": ValueOf(syscall.IN_CLASSD_HOST), + "IN_CLASSD_NET": ValueOf(uint32(syscall.IN_CLASSD_NET)), + "IN_CLASSD_NSHIFT": ValueOf(syscall.IN_CLASSD_NSHIFT), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_RFC3021_MASK": ValueOf(uint32(syscall.IN_RFC3021_MASK)), + "IPPROTO_3PC": ValueOf(syscall.IPPROTO_3PC), + "IPPROTO_ADFS": ValueOf(syscall.IPPROTO_ADFS), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_AHIP": ValueOf(syscall.IPPROTO_AHIP), + "IPPROTO_APES": ValueOf(syscall.IPPROTO_APES), + "IPPROTO_ARGUS": ValueOf(syscall.IPPROTO_ARGUS), + "IPPROTO_AX25": ValueOf(syscall.IPPROTO_AX25), + "IPPROTO_BHA": ValueOf(syscall.IPPROTO_BHA), + "IPPROTO_BLT": ValueOf(syscall.IPPROTO_BLT), + "IPPROTO_BRSATMON": ValueOf(syscall.IPPROTO_BRSATMON), + "IPPROTO_CARP": ValueOf(syscall.IPPROTO_CARP), + "IPPROTO_CFTP": ValueOf(syscall.IPPROTO_CFTP), + "IPPROTO_CHAOS": ValueOf(syscall.IPPROTO_CHAOS), + "IPPROTO_CMTP": ValueOf(syscall.IPPROTO_CMTP), + "IPPROTO_CPHB": ValueOf(syscall.IPPROTO_CPHB), + "IPPROTO_CPNX": ValueOf(syscall.IPPROTO_CPNX), + "IPPROTO_DDP": ValueOf(syscall.IPPROTO_DDP), + "IPPROTO_DGP": ValueOf(syscall.IPPROTO_DGP), + "IPPROTO_DIVERT": ValueOf(syscall.IPPROTO_DIVERT), + "IPPROTO_DONE": ValueOf(syscall.IPPROTO_DONE), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_EMCON": ValueOf(syscall.IPPROTO_EMCON), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_EON": ValueOf(syscall.IPPROTO_EON), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_ETHERIP": ValueOf(syscall.IPPROTO_ETHERIP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GGP": ValueOf(syscall.IPPROTO_GGP), + "IPPROTO_GMTP": ValueOf(syscall.IPPROTO_GMTP), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HELLO": ValueOf(syscall.IPPROTO_HELLO), + "IPPROTO_HMP": ValueOf(syscall.IPPROTO_HMP), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IDPR": ValueOf(syscall.IPPROTO_IDPR), + "IPPROTO_IDRP": ValueOf(syscall.IPPROTO_IDRP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IGP": ValueOf(syscall.IPPROTO_IGP), + "IPPROTO_IGRP": ValueOf(syscall.IPPROTO_IGRP), + "IPPROTO_IL": ValueOf(syscall.IPPROTO_IL), + "IPPROTO_INLSP": ValueOf(syscall.IPPROTO_INLSP), + "IPPROTO_INP": ValueOf(syscall.IPPROTO_INP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPCOMP": ValueOf(syscall.IPPROTO_IPCOMP), + "IPPROTO_IPCV": ValueOf(syscall.IPPROTO_IPCV), + "IPPROTO_IPEIP": ValueOf(syscall.IPPROTO_IPEIP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPPC": ValueOf(syscall.IPPROTO_IPPC), + "IPPROTO_IPV4": ValueOf(syscall.IPPROTO_IPV4), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_IRTP": ValueOf(syscall.IPPROTO_IRTP), + "IPPROTO_KRYPTOLAN": ValueOf(syscall.IPPROTO_KRYPTOLAN), + "IPPROTO_LARP": ValueOf(syscall.IPPROTO_LARP), + "IPPROTO_LEAF1": ValueOf(syscall.IPPROTO_LEAF1), + "IPPROTO_LEAF2": ValueOf(syscall.IPPROTO_LEAF2), + "IPPROTO_MAX": ValueOf(syscall.IPPROTO_MAX), + "IPPROTO_MAXID": ValueOf(syscall.IPPROTO_MAXID), + "IPPROTO_MEAS": ValueOf(syscall.IPPROTO_MEAS), + "IPPROTO_MH": ValueOf(syscall.IPPROTO_MH), + "IPPROTO_MHRP": ValueOf(syscall.IPPROTO_MHRP), + "IPPROTO_MICP": ValueOf(syscall.IPPROTO_MICP), + "IPPROTO_MOBILE": ValueOf(syscall.IPPROTO_MOBILE), + "IPPROTO_MPLS": ValueOf(syscall.IPPROTO_MPLS), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_MUX": ValueOf(syscall.IPPROTO_MUX), + "IPPROTO_ND": ValueOf(syscall.IPPROTO_ND), + "IPPROTO_NHRP": ValueOf(syscall.IPPROTO_NHRP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_NSP": ValueOf(syscall.IPPROTO_NSP), + "IPPROTO_NVPII": ValueOf(syscall.IPPROTO_NVPII), + "IPPROTO_OLD_DIVERT": ValueOf(syscall.IPPROTO_OLD_DIVERT), + "IPPROTO_OSPFIGP": ValueOf(syscall.IPPROTO_OSPFIGP), + "IPPROTO_PFSYNC": ValueOf(syscall.IPPROTO_PFSYNC), + "IPPROTO_PGM": ValueOf(syscall.IPPROTO_PGM), + "IPPROTO_PIGP": ValueOf(syscall.IPPROTO_PIGP), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PRM": ValueOf(syscall.IPPROTO_PRM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_PVP": ValueOf(syscall.IPPROTO_PVP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_RCCMON": ValueOf(syscall.IPPROTO_RCCMON), + "IPPROTO_RDP": ValueOf(syscall.IPPROTO_RDP), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_RVD": ValueOf(syscall.IPPROTO_RVD), + "IPPROTO_SATEXPAK": ValueOf(syscall.IPPROTO_SATEXPAK), + "IPPROTO_SATMON": ValueOf(syscall.IPPROTO_SATMON), + "IPPROTO_SCCSP": ValueOf(syscall.IPPROTO_SCCSP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_SDRP": ValueOf(syscall.IPPROTO_SDRP), + "IPPROTO_SEND": ValueOf(syscall.IPPROTO_SEND), + "IPPROTO_SEP": ValueOf(syscall.IPPROTO_SEP), + "IPPROTO_SKIP": ValueOf(syscall.IPPROTO_SKIP), + "IPPROTO_SPACER": ValueOf(syscall.IPPROTO_SPACER), + "IPPROTO_SRPC": ValueOf(syscall.IPPROTO_SRPC), + "IPPROTO_ST": ValueOf(syscall.IPPROTO_ST), + "IPPROTO_SVMTP": ValueOf(syscall.IPPROTO_SVMTP), + "IPPROTO_SWIPE": ValueOf(syscall.IPPROTO_SWIPE), + "IPPROTO_TCF": ValueOf(syscall.IPPROTO_TCF), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TLSP": ValueOf(syscall.IPPROTO_TLSP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_TPXX": ValueOf(syscall.IPPROTO_TPXX), + "IPPROTO_TRUNK1": ValueOf(syscall.IPPROTO_TRUNK1), + "IPPROTO_TRUNK2": ValueOf(syscall.IPPROTO_TRUNK2), + "IPPROTO_TTP": ValueOf(syscall.IPPROTO_TTP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_VINES": ValueOf(syscall.IPPROTO_VINES), + "IPPROTO_VISA": ValueOf(syscall.IPPROTO_VISA), + "IPPROTO_VMTP": ValueOf(syscall.IPPROTO_VMTP), + "IPPROTO_WBEXPAK": ValueOf(syscall.IPPROTO_WBEXPAK), + "IPPROTO_WBMON": ValueOf(syscall.IPPROTO_WBMON), + "IPPROTO_WSN": ValueOf(syscall.IPPROTO_WSN), + "IPPROTO_XNET": ValueOf(syscall.IPPROTO_XNET), + "IPPROTO_XTP": ValueOf(syscall.IPPROTO_XTP), + "IPV6_AUTOFLOWLABEL": ValueOf(syscall.IPV6_AUTOFLOWLABEL), + "IPV6_BINDANY": ValueOf(syscall.IPV6_BINDANY), + "IPV6_BINDV6ONLY": ValueOf(syscall.IPV6_BINDV6ONLY), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DEFAULT_MULTICAST_HOPS": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_HOPS), + "IPV6_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IPV6_DEFAULT_MULTICAST_LOOP), + "IPV6_DEFHLIM": ValueOf(syscall.IPV6_DEFHLIM), + "IPV6_DONTFRAG": ValueOf(syscall.IPV6_DONTFRAG), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_FAITH": ValueOf(syscall.IPV6_FAITH), + "IPV6_FLOWINFO_MASK": ValueOf(uint32(syscall.IPV6_FLOWINFO_MASK)), + "IPV6_FLOWLABEL_MASK": ValueOf(uint32(syscall.IPV6_FLOWLABEL_MASK)), + "IPV6_FRAGTTL": ValueOf(syscall.IPV6_FRAGTTL), + "IPV6_FW_ADD": ValueOf(syscall.IPV6_FW_ADD), + "IPV6_FW_DEL": ValueOf(syscall.IPV6_FW_DEL), + "IPV6_FW_FLUSH": ValueOf(syscall.IPV6_FW_FLUSH), + "IPV6_FW_GET": ValueOf(syscall.IPV6_FW_GET), + "IPV6_FW_ZERO": ValueOf(syscall.IPV6_FW_ZERO), + "IPV6_HLIMDEC": ValueOf(syscall.IPV6_HLIMDEC), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MAXHLIM": ValueOf(syscall.IPV6_MAXHLIM), + "IPV6_MAXOPTHDR": ValueOf(syscall.IPV6_MAXOPTHDR), + "IPV6_MAXPACKET": ValueOf(syscall.IPV6_MAXPACKET), + "IPV6_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IPV6_MAX_GROUP_SRC_FILTER), + "IPV6_MAX_MEMBERSHIPS": ValueOf(syscall.IPV6_MAX_MEMBERSHIPS), + "IPV6_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IPV6_MAX_SOCK_SRC_FILTER), + "IPV6_MIN_MEMBERSHIPS": ValueOf(syscall.IPV6_MIN_MEMBERSHIPS), + "IPV6_MMTU": ValueOf(syscall.IPV6_MMTU), + "IPV6_MSFILTER": ValueOf(syscall.IPV6_MSFILTER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PATHMTU": ValueOf(syscall.IPV6_PATHMTU), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PORTRANGE": ValueOf(syscall.IPV6_PORTRANGE), + "IPV6_PORTRANGE_DEFAULT": ValueOf(syscall.IPV6_PORTRANGE_DEFAULT), + "IPV6_PORTRANGE_HIGH": ValueOf(syscall.IPV6_PORTRANGE_HIGH), + "IPV6_PORTRANGE_LOW": ValueOf(syscall.IPV6_PORTRANGE_LOW), + "IPV6_PREFER_TEMPADDR": ValueOf(syscall.IPV6_PREFER_TEMPADDR), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPATHMTU": ValueOf(syscall.IPV6_RECVPATHMTU), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_SOCKOPT_RESERVED1": ValueOf(syscall.IPV6_SOCKOPT_RESERVED1), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_USE_MIN_MTU": ValueOf(syscall.IPV6_USE_MIN_MTU), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_VERSION": ValueOf(syscall.IPV6_VERSION), + "IPV6_VERSION_MASK": ValueOf(syscall.IPV6_VERSION_MASK), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BINDANY": ValueOf(syscall.IP_BINDANY), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DONTFRAG": ValueOf(syscall.IP_DONTFRAG), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_DUMMYNET3": ValueOf(syscall.IP_DUMMYNET3), + "IP_DUMMYNET_CONFIGURE": ValueOf(syscall.IP_DUMMYNET_CONFIGURE), + "IP_DUMMYNET_DEL": ValueOf(syscall.IP_DUMMYNET_DEL), + "IP_DUMMYNET_FLUSH": ValueOf(syscall.IP_DUMMYNET_FLUSH), + "IP_DUMMYNET_GET": ValueOf(syscall.IP_DUMMYNET_GET), + "IP_FAITH": ValueOf(syscall.IP_FAITH), + "IP_FW3": ValueOf(syscall.IP_FW3), + "IP_FW_ADD": ValueOf(syscall.IP_FW_ADD), + "IP_FW_DEL": ValueOf(syscall.IP_FW_DEL), + "IP_FW_FLUSH": ValueOf(syscall.IP_FW_FLUSH), + "IP_FW_GET": ValueOf(syscall.IP_FW_GET), + "IP_FW_NAT_CFG": ValueOf(syscall.IP_FW_NAT_CFG), + "IP_FW_NAT_DEL": ValueOf(syscall.IP_FW_NAT_DEL), + "IP_FW_NAT_GET_CONFIG": ValueOf(syscall.IP_FW_NAT_GET_CONFIG), + "IP_FW_NAT_GET_LOG": ValueOf(syscall.IP_FW_NAT_GET_LOG), + "IP_FW_RESETLOG": ValueOf(syscall.IP_FW_RESETLOG), + "IP_FW_TABLE_ADD": ValueOf(syscall.IP_FW_TABLE_ADD), + "IP_FW_TABLE_DEL": ValueOf(syscall.IP_FW_TABLE_DEL), + "IP_FW_TABLE_FLUSH": ValueOf(syscall.IP_FW_TABLE_FLUSH), + "IP_FW_TABLE_GETSIZE": ValueOf(syscall.IP_FW_TABLE_GETSIZE), + "IP_FW_TABLE_LIST": ValueOf(syscall.IP_FW_TABLE_LIST), + "IP_FW_ZERO": ValueOf(syscall.IP_FW_ZERO), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_GROUP_SRC_FILTER": ValueOf(syscall.IP_MAX_GROUP_SRC_FILTER), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MAX_SOCK_MUTE_FILTER": ValueOf(syscall.IP_MAX_SOCK_MUTE_FILTER), + "IP_MAX_SOCK_SRC_FILTER": ValueOf(syscall.IP_MAX_SOCK_SRC_FILTER), + "IP_MAX_SOURCE_FILTER": ValueOf(syscall.IP_MAX_SOURCE_FILTER), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MIN_MEMBERSHIPS": ValueOf(syscall.IP_MIN_MEMBERSHIPS), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_MULTICAST_VIF": ValueOf(syscall.IP_MULTICAST_VIF), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_ONESBCAST": ValueOf(syscall.IP_ONESBCAST), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_PORTRANGE": ValueOf(syscall.IP_PORTRANGE), + "IP_PORTRANGE_DEFAULT": ValueOf(syscall.IP_PORTRANGE_DEFAULT), + "IP_PORTRANGE_HIGH": ValueOf(syscall.IP_PORTRANGE_HIGH), + "IP_PORTRANGE_LOW": ValueOf(syscall.IP_PORTRANGE_LOW), + "IP_RECVDSTADDR": ValueOf(syscall.IP_RECVDSTADDR), + "IP_RECVIF": ValueOf(syscall.IP_RECVIF), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_RSVP_OFF": ValueOf(syscall.IP_RSVP_OFF), + "IP_RSVP_ON": ValueOf(syscall.IP_RSVP_ON), + "IP_RSVP_VIF_OFF": ValueOf(syscall.IP_RSVP_VIF_OFF), + "IP_RSVP_VIF_ON": ValueOf(syscall.IP_RSVP_VIF_ON), + "IP_SENDSRCADDR": ValueOf(syscall.IP_SENDSRCADDR), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "Issetugid": ValueOf(syscall.Issetugid), + "Kevent": ValueOf(syscall.Kevent), + "Kill": ValueOf(syscall.Kill), + "Kqueue": ValueOf(syscall.Kqueue), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Lstat": ValueOf(syscall.Lstat), + "MADV_AUTOSYNC": ValueOf(syscall.MADV_AUTOSYNC), + "MADV_CORE": ValueOf(syscall.MADV_CORE), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_FREE": ValueOf(syscall.MADV_FREE), + "MADV_NOCORE": ValueOf(syscall.MADV_NOCORE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_NOSYNC": ValueOf(syscall.MADV_NOSYNC), + "MADV_PROTECT": ValueOf(syscall.MADV_PROTECT), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_32BIT": ValueOf(syscall.MAP_32BIT), + "MAP_ALIGNED_SUPER": ValueOf(syscall.MAP_ALIGNED_SUPER), + "MAP_ALIGNMENT_MASK": ValueOf(syscall.MAP_ALIGNMENT_MASK), + "MAP_ALIGNMENT_SHIFT": ValueOf(syscall.MAP_ALIGNMENT_SHIFT), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_COPY": ValueOf(syscall.MAP_COPY), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_HASSEMAPHORE": ValueOf(syscall.MAP_HASSEMAPHORE), + "MAP_NOCORE": ValueOf(syscall.MAP_NOCORE), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_NOSYNC": ValueOf(syscall.MAP_NOSYNC), + "MAP_PREFAULT_READ": ValueOf(syscall.MAP_PREFAULT_READ), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_RENAME": ValueOf(syscall.MAP_RENAME), + "MAP_RESERVED0080": ValueOf(syscall.MAP_RESERVED0080), + "MAP_RESERVED0100": ValueOf(syscall.MAP_RESERVED0100), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_STACK": ValueOf(syscall.MAP_STACK), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_COMPAT": ValueOf(syscall.MSG_COMPAT), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOF": ValueOf(syscall.MSG_EOF), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_NBIO": ValueOf(syscall.MSG_NBIO), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_NOTIFICATION": ValueOf(syscall.MSG_NOTIFICATION), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mmap": ValueOf(syscall.Mmap), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NET_RT_DUMP": ValueOf(syscall.NET_RT_DUMP), + "NET_RT_FLAGS": ValueOf(syscall.NET_RT_FLAGS), + "NET_RT_IFLIST": ValueOf(syscall.NET_RT_IFLIST), + "NET_RT_IFLISTL": ValueOf(syscall.NET_RT_IFLISTL), + "NET_RT_IFMALIST": ValueOf(syscall.NET_RT_IFMALIST), + "NET_RT_MAXID": ValueOf(syscall.NET_RT_MAXID), + "NOFLSH": ValueOf(uint32(syscall.NOFLSH)), + "NOTE_ATTRIB": ValueOf(syscall.NOTE_ATTRIB), + "NOTE_CHILD": ValueOf(syscall.NOTE_CHILD), + "NOTE_DELETE": ValueOf(syscall.NOTE_DELETE), + "NOTE_EXEC": ValueOf(syscall.NOTE_EXEC), + "NOTE_EXIT": ValueOf(uint32(syscall.NOTE_EXIT)), + "NOTE_EXTEND": ValueOf(syscall.NOTE_EXTEND), + "NOTE_FFAND": ValueOf(syscall.NOTE_FFAND), + "NOTE_FFCOPY": ValueOf(uint32(syscall.NOTE_FFCOPY)), + "NOTE_FFCTRLMASK": ValueOf(uint32(syscall.NOTE_FFCTRLMASK)), + "NOTE_FFLAGSMASK": ValueOf(syscall.NOTE_FFLAGSMASK), + "NOTE_FFNOP": ValueOf(syscall.NOTE_FFNOP), + "NOTE_FFOR": ValueOf(uint32(syscall.NOTE_FFOR)), + "NOTE_FORK": ValueOf(syscall.NOTE_FORK), + "NOTE_LINK": ValueOf(syscall.NOTE_LINK), + "NOTE_LOWAT": ValueOf(syscall.NOTE_LOWAT), + "NOTE_PCTRLMASK": ValueOf(uint32(syscall.NOTE_PCTRLMASK)), + "NOTE_PDATAMASK": ValueOf(syscall.NOTE_PDATAMASK), + "NOTE_RENAME": ValueOf(syscall.NOTE_RENAME), + "NOTE_REVOKE": ValueOf(syscall.NOTE_REVOKE), + "NOTE_TRACK": ValueOf(syscall.NOTE_TRACK), + "NOTE_TRACKERR": ValueOf(syscall.NOTE_TRACKERR), + "NOTE_TRIGGER": ValueOf(syscall.NOTE_TRIGGER), + "NOTE_WRITE": ValueOf(syscall.NOTE_WRITE), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "ONOEOT": ValueOf(syscall.ONOEOT), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_EXEC": ValueOf(syscall.O_EXEC), + "O_EXLOCK": ValueOf(syscall.O_EXLOCK), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_SHLOCK": ValueOf(syscall.O_SHLOCK), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_TTY_INIT": ValueOf(syscall.O_TTY_INIT), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseRoutingMessage": ValueOf(syscall.ParseRoutingMessage), + "ParseRoutingSockaddr": ValueOf(syscall.ParseRoutingSockaddr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "Pathconf": ValueOf(syscall.Pathconf), + "Pipe": ValueOf(syscall.Pipe), + "Pread": ValueOf(syscall.Pread), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(int64(syscall.RLIM_INFINITY)), + "RTAX_AUTHOR": ValueOf(syscall.RTAX_AUTHOR), + "RTAX_BRD": ValueOf(syscall.RTAX_BRD), + "RTAX_DST": ValueOf(syscall.RTAX_DST), + "RTAX_GATEWAY": ValueOf(syscall.RTAX_GATEWAY), + "RTAX_GENMASK": ValueOf(syscall.RTAX_GENMASK), + "RTAX_IFA": ValueOf(syscall.RTAX_IFA), + "RTAX_IFP": ValueOf(syscall.RTAX_IFP), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_NETMASK": ValueOf(syscall.RTAX_NETMASK), + "RTA_AUTHOR": ValueOf(syscall.RTA_AUTHOR), + "RTA_BRD": ValueOf(syscall.RTA_BRD), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_GENMASK": ValueOf(syscall.RTA_GENMASK), + "RTA_IFA": ValueOf(syscall.RTA_IFA), + "RTA_IFP": ValueOf(syscall.RTA_IFP), + "RTA_NETMASK": ValueOf(syscall.RTA_NETMASK), + "RTF_BLACKHOLE": ValueOf(syscall.RTF_BLACKHOLE), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_DONE": ValueOf(syscall.RTF_DONE), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FMASK": ValueOf(syscall.RTF_FMASK), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_GWFLAG_COMPAT": ValueOf(uint32(syscall.RTF_GWFLAG_COMPAT)), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_LLDATA": ValueOf(syscall.RTF_LLDATA), + "RTF_LLINFO": ValueOf(syscall.RTF_LLINFO), + "RTF_LOCAL": ValueOf(syscall.RTF_LOCAL), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_PINNED": ValueOf(syscall.RTF_PINNED), + "RTF_PRCLONING": ValueOf(syscall.RTF_PRCLONING), + "RTF_PROTO1": ValueOf(syscall.RTF_PROTO1), + "RTF_PROTO2": ValueOf(syscall.RTF_PROTO2), + "RTF_PROTO3": ValueOf(syscall.RTF_PROTO3), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_RNH_LOCKED": ValueOf(syscall.RTF_RNH_LOCKED), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_STICKY": ValueOf(syscall.RTF_STICKY), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_ADD": ValueOf(syscall.RTM_ADD), + "RTM_CHANGE": ValueOf(syscall.RTM_CHANGE), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELETE": ValueOf(syscall.RTM_DELETE), + "RTM_DELMADDR": ValueOf(syscall.RTM_DELMADDR), + "RTM_GET": ValueOf(syscall.RTM_GET), + "RTM_IEEE80211": ValueOf(syscall.RTM_IEEE80211), + "RTM_IFANNOUNCE": ValueOf(syscall.RTM_IFANNOUNCE), + "RTM_IFINFO": ValueOf(syscall.RTM_IFINFO), + "RTM_LOCK": ValueOf(syscall.RTM_LOCK), + "RTM_LOSING": ValueOf(syscall.RTM_LOSING), + "RTM_MISS": ValueOf(syscall.RTM_MISS), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWMADDR": ValueOf(syscall.RTM_NEWMADDR), + "RTM_OLDADD": ValueOf(syscall.RTM_OLDADD), + "RTM_OLDDEL": ValueOf(syscall.RTM_OLDDEL), + "RTM_REDIRECT": ValueOf(syscall.RTM_REDIRECT), + "RTM_RESOLVE": ValueOf(syscall.RTM_RESOLVE), + "RTM_RTTUNIT": ValueOf(syscall.RTM_RTTUNIT), + "RTM_VERSION": ValueOf(syscall.RTM_VERSION), + "RTV_EXPIRE": ValueOf(syscall.RTV_EXPIRE), + "RTV_HOPCOUNT": ValueOf(syscall.RTV_HOPCOUNT), + "RTV_MTU": ValueOf(syscall.RTV_MTU), + "RTV_RPIPE": ValueOf(syscall.RTV_RPIPE), + "RTV_RTT": ValueOf(syscall.RTV_RTT), + "RTV_RTTVAR": ValueOf(syscall.RTV_RTTVAR), + "RTV_SPIPE": ValueOf(syscall.RTV_SPIPE), + "RTV_SSTHRESH": ValueOf(syscall.RTV_SSTHRESH), + "RTV_WEIGHT": ValueOf(syscall.RTV_WEIGHT), + "RT_CACHING_CONTEXT": ValueOf(syscall.RT_CACHING_CONTEXT), + "RT_DEFAULT_FIB": ValueOf(syscall.RT_DEFAULT_FIB), + "RT_NORTREF": ValueOf(syscall.RT_NORTREF), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Rename": ValueOf(syscall.Rename), + "Revoke": ValueOf(syscall.Revoke), + "Rmdir": ValueOf(syscall.Rmdir), + "RouteRIB": ValueOf(syscall.RouteRIB), + "SCM_BINTIME": ValueOf(syscall.SCM_BINTIME), + "SCM_CREDS": ValueOf(syscall.SCM_CREDS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGEMT": ValueOf(syscall.SIGEMT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINFO": ValueOf(syscall.SIGINFO), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGLIBRT": ValueOf(syscall.SIGLIBRT), + "SIGLWP": ValueOf(syscall.SIGLWP), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTHR": ValueOf(syscall.SIGTHR), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDMULTI": ValueOf(uint32(syscall.SIOCADDMULTI)), + "SIOCADDRT": ValueOf(uint32(syscall.SIOCADDRT)), + "SIOCAIFADDR": ValueOf(uint32(syscall.SIOCAIFADDR)), + "SIOCAIFGROUP": ValueOf(uint32(syscall.SIOCAIFGROUP)), + "SIOCALIFADDR": ValueOf(uint32(syscall.SIOCALIFADDR)), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDELMULTI": ValueOf(uint32(syscall.SIOCDELMULTI)), + "SIOCDELRT": ValueOf(uint32(syscall.SIOCDELRT)), + "SIOCDIFADDR": ValueOf(uint32(syscall.SIOCDIFADDR)), + "SIOCDIFGROUP": ValueOf(uint32(syscall.SIOCDIFGROUP)), + "SIOCDIFPHYADDR": ValueOf(uint32(syscall.SIOCDIFPHYADDR)), + "SIOCDLIFADDR": ValueOf(uint32(syscall.SIOCDLIFADDR)), + "SIOCGDRVSPEC": ValueOf(uint32(syscall.SIOCGDRVSPEC)), + "SIOCGETSGCNT": ValueOf(uint32(syscall.SIOCGETSGCNT)), + "SIOCGETVIFCNT": ValueOf(uint32(syscall.SIOCGETVIFCNT)), + "SIOCGHIWAT": ValueOf(syscall.SIOCGHIWAT), + "SIOCGIFADDR": ValueOf(uint32(syscall.SIOCGIFADDR)), + "SIOCGIFBRDADDR": ValueOf(uint32(syscall.SIOCGIFBRDADDR)), + "SIOCGIFCAP": ValueOf(uint32(syscall.SIOCGIFCAP)), + "SIOCGIFCONF": ValueOf(uint32(syscall.SIOCGIFCONF)), + "SIOCGIFDESCR": ValueOf(uint32(syscall.SIOCGIFDESCR)), + "SIOCGIFDSTADDR": ValueOf(uint32(syscall.SIOCGIFDSTADDR)), + "SIOCGIFFIB": ValueOf(uint32(syscall.SIOCGIFFIB)), + "SIOCGIFFLAGS": ValueOf(uint32(syscall.SIOCGIFFLAGS)), + "SIOCGIFGENERIC": ValueOf(uint32(syscall.SIOCGIFGENERIC)), + "SIOCGIFGMEMB": ValueOf(uint32(syscall.SIOCGIFGMEMB)), + "SIOCGIFGROUP": ValueOf(uint32(syscall.SIOCGIFGROUP)), + "SIOCGIFINDEX": ValueOf(uint32(syscall.SIOCGIFINDEX)), + "SIOCGIFMAC": ValueOf(uint32(syscall.SIOCGIFMAC)), + "SIOCGIFMEDIA": ValueOf(uint32(syscall.SIOCGIFMEDIA)), + "SIOCGIFMETRIC": ValueOf(uint32(syscall.SIOCGIFMETRIC)), + "SIOCGIFMTU": ValueOf(uint32(syscall.SIOCGIFMTU)), + "SIOCGIFNETMASK": ValueOf(uint32(syscall.SIOCGIFNETMASK)), + "SIOCGIFPDSTADDR": ValueOf(uint32(syscall.SIOCGIFPDSTADDR)), + "SIOCGIFPHYS": ValueOf(uint32(syscall.SIOCGIFPHYS)), + "SIOCGIFPSRCADDR": ValueOf(uint32(syscall.SIOCGIFPSRCADDR)), + "SIOCGIFSTATUS": ValueOf(uint32(syscall.SIOCGIFSTATUS)), + "SIOCGLIFADDR": ValueOf(uint32(syscall.SIOCGLIFADDR)), + "SIOCGLIFPHYADDR": ValueOf(uint32(syscall.SIOCGLIFPHYADDR)), + "SIOCGLOWAT": ValueOf(syscall.SIOCGLOWAT), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGPRIVATE_0": ValueOf(uint32(syscall.SIOCGPRIVATE_0)), + "SIOCGPRIVATE_1": ValueOf(uint32(syscall.SIOCGPRIVATE_1)), + "SIOCIFCREATE": ValueOf(uint32(syscall.SIOCIFCREATE)), + "SIOCIFCREATE2": ValueOf(uint32(syscall.SIOCIFCREATE2)), + "SIOCIFDESTROY": ValueOf(uint32(syscall.SIOCIFDESTROY)), + "SIOCIFGCLONERS": ValueOf(uint32(syscall.SIOCIFGCLONERS)), + "SIOCSDRVSPEC": ValueOf(uint32(syscall.SIOCSDRVSPEC)), + "SIOCSHIWAT": ValueOf(uint32(syscall.SIOCSHIWAT)), + "SIOCSIFADDR": ValueOf(uint32(syscall.SIOCSIFADDR)), + "SIOCSIFBRDADDR": ValueOf(uint32(syscall.SIOCSIFBRDADDR)), + "SIOCSIFCAP": ValueOf(uint32(syscall.SIOCSIFCAP)), + "SIOCSIFDESCR": ValueOf(uint32(syscall.SIOCSIFDESCR)), + "SIOCSIFDSTADDR": ValueOf(uint32(syscall.SIOCSIFDSTADDR)), + "SIOCSIFFIB": ValueOf(uint32(syscall.SIOCSIFFIB)), + "SIOCSIFFLAGS": ValueOf(uint32(syscall.SIOCSIFFLAGS)), + "SIOCSIFGENERIC": ValueOf(uint32(syscall.SIOCSIFGENERIC)), + "SIOCSIFLLADDR": ValueOf(uint32(syscall.SIOCSIFLLADDR)), + "SIOCSIFMAC": ValueOf(uint32(syscall.SIOCSIFMAC)), + "SIOCSIFMEDIA": ValueOf(uint32(syscall.SIOCSIFMEDIA)), + "SIOCSIFMETRIC": ValueOf(uint32(syscall.SIOCSIFMETRIC)), + "SIOCSIFMTU": ValueOf(uint32(syscall.SIOCSIFMTU)), + "SIOCSIFNAME": ValueOf(uint32(syscall.SIOCSIFNAME)), + "SIOCSIFNETMASK": ValueOf(uint32(syscall.SIOCSIFNETMASK)), + "SIOCSIFPHYADDR": ValueOf(uint32(syscall.SIOCSIFPHYADDR)), + "SIOCSIFPHYS": ValueOf(uint32(syscall.SIOCSIFPHYS)), + "SIOCSIFRVNET": ValueOf(uint32(syscall.SIOCSIFRVNET)), + "SIOCSIFVNET": ValueOf(uint32(syscall.SIOCSIFVNET)), + "SIOCSLIFPHYADDR": ValueOf(uint32(syscall.SIOCSLIFPHYADDR)), + "SIOCSLOWAT": ValueOf(uint32(syscall.SIOCSLOWAT)), + "SIOCSPGRP": ValueOf(uint32(syscall.SIOCSPGRP)), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_MAXADDRLEN": ValueOf(syscall.SOCK_MAXADDRLEN), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ACCEPTFILTER": ValueOf(syscall.SO_ACCEPTFILTER), + "SO_BINTIME": ValueOf(syscall.SO_BINTIME), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LABEL": ValueOf(syscall.SO_LABEL), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_LISTENINCQLEN": ValueOf(syscall.SO_LISTENINCQLEN), + "SO_LISTENQLEN": ValueOf(syscall.SO_LISTENQLEN), + "SO_LISTENQLIMIT": ValueOf(syscall.SO_LISTENQLIMIT), + "SO_NOSIGPIPE": ValueOf(syscall.SO_NOSIGPIPE), + "SO_NO_DDP": ValueOf(syscall.SO_NO_DDP), + "SO_NO_OFFLOAD": ValueOf(syscall.SO_NO_OFFLOAD), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PEERLABEL": ValueOf(syscall.SO_PEERLABEL), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_PROTOTYPE": ValueOf(syscall.SO_PROTOTYPE), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_REUSEPORT": ValueOf(syscall.SO_REUSEPORT), + "SO_SETFIB": ValueOf(syscall.SO_SETFIB), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SO_USELOOPBACK": ValueOf(syscall.SO_USELOOPBACK), + "SO_USER_COOKIE": ValueOf(syscall.SO_USER_COOKIE), + "SO_VENDOR": ValueOf(uint32(syscall.SO_VENDOR)), + "SYS_ABORT2": ValueOf(syscall.SYS_ABORT2), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT4": ValueOf(syscall.SYS_ACCEPT4), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADJTIME": ValueOf(syscall.SYS_ADJTIME), + "SYS_AUDIT": ValueOf(syscall.SYS_AUDIT), + "SYS_AUDITCTL": ValueOf(syscall.SYS_AUDITCTL), + "SYS_AUDITON": ValueOf(syscall.SYS_AUDITON), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BINDAT": ValueOf(syscall.SYS_BINDAT), + "SYS_CAP_ENTER": ValueOf(syscall.SYS_CAP_ENTER), + "SYS_CAP_GETMODE": ValueOf(syscall.SYS_CAP_GETMODE), + "SYS_CAP_GETRIGHTS": ValueOf(syscall.SYS_CAP_GETRIGHTS), + "SYS_CAP_NEW": ValueOf(syscall.SYS_CAP_NEW), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHFLAGS": ValueOf(syscall.SYS_CHFLAGS), + "SYS_CHFLAGSAT": ValueOf(syscall.SYS_CHFLAGSAT), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_GETCPUCLOCKID2": ValueOf(syscall.SYS_CLOCK_GETCPUCLOCKID2), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CLOSEFROM": ValueOf(syscall.SYS_CLOSEFROM), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CONNECTAT": ValueOf(syscall.SYS_CONNECTAT), + "SYS_CPUSET": ValueOf(syscall.SYS_CPUSET), + "SYS_CPUSET_GETAFFINITY": ValueOf(syscall.SYS_CPUSET_GETAFFINITY), + "SYS_CPUSET_GETID": ValueOf(syscall.SYS_CPUSET_GETID), + "SYS_CPUSET_SETAFFINITY": ValueOf(syscall.SYS_CPUSET_SETAFFINITY), + "SYS_CPUSET_SETID": ValueOf(syscall.SYS_CPUSET_SETID), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_EACCESS": ValueOf(syscall.SYS_EACCESS), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXTATTRCTL": ValueOf(syscall.SYS_EXTATTRCTL), + "SYS_EXTATTR_DELETE_FD": ValueOf(syscall.SYS_EXTATTR_DELETE_FD), + "SYS_EXTATTR_DELETE_FILE": ValueOf(syscall.SYS_EXTATTR_DELETE_FILE), + "SYS_EXTATTR_DELETE_LINK": ValueOf(syscall.SYS_EXTATTR_DELETE_LINK), + "SYS_EXTATTR_GET_FD": ValueOf(syscall.SYS_EXTATTR_GET_FD), + "SYS_EXTATTR_GET_FILE": ValueOf(syscall.SYS_EXTATTR_GET_FILE), + "SYS_EXTATTR_GET_LINK": ValueOf(syscall.SYS_EXTATTR_GET_LINK), + "SYS_EXTATTR_LIST_FD": ValueOf(syscall.SYS_EXTATTR_LIST_FD), + "SYS_EXTATTR_LIST_FILE": ValueOf(syscall.SYS_EXTATTR_LIST_FILE), + "SYS_EXTATTR_LIST_LINK": ValueOf(syscall.SYS_EXTATTR_LIST_LINK), + "SYS_EXTATTR_SET_FD": ValueOf(syscall.SYS_EXTATTR_SET_FD), + "SYS_EXTATTR_SET_FILE": ValueOf(syscall.SYS_EXTATTR_SET_FILE), + "SYS_EXTATTR_SET_LINK": ValueOf(syscall.SYS_EXTATTR_SET_LINK), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHFLAGS": ValueOf(syscall.SYS_FCHFLAGS), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FEXECVE": ValueOf(syscall.SYS_FEXECVE), + "SYS_FFCLOCK_GETCOUNTER": ValueOf(syscall.SYS_FFCLOCK_GETCOUNTER), + "SYS_FFCLOCK_GETESTIMATE": ValueOf(syscall.SYS_FFCLOCK_GETESTIMATE), + "SYS_FFCLOCK_SETESTIMATE": ValueOf(syscall.SYS_FFCLOCK_SETESTIMATE), + "SYS_FHOPEN": ValueOf(syscall.SYS_FHOPEN), + "SYS_FHSTAT": ValueOf(syscall.SYS_FHSTAT), + "SYS_FHSTATFS": ValueOf(syscall.SYS_FHSTATFS), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FPATHCONF": ValueOf(syscall.SYS_FPATHCONF), + "SYS_FREEBSD6_FTRUNCATE": ValueOf(syscall.SYS_FREEBSD6_FTRUNCATE), + "SYS_FREEBSD6_LSEEK": ValueOf(syscall.SYS_FREEBSD6_LSEEK), + "SYS_FREEBSD6_MMAP": ValueOf(syscall.SYS_FREEBSD6_MMAP), + "SYS_FREEBSD6_PREAD": ValueOf(syscall.SYS_FREEBSD6_PREAD), + "SYS_FREEBSD6_PWRITE": ValueOf(syscall.SYS_FREEBSD6_PWRITE), + "SYS_FREEBSD6_TRUNCATE": ValueOf(syscall.SYS_FREEBSD6_TRUNCATE), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTATAT": ValueOf(syscall.SYS_FSTATAT), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTIMES": ValueOf(syscall.SYS_FUTIMES), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETAUDIT": ValueOf(syscall.SYS_GETAUDIT), + "SYS_GETAUDIT_ADDR": ValueOf(syscall.SYS_GETAUDIT_ADDR), + "SYS_GETAUID": ValueOf(syscall.SYS_GETAUID), + "SYS_GETCONTEXT": ValueOf(syscall.SYS_GETCONTEXT), + "SYS_GETDENTS": ValueOf(syscall.SYS_GETDENTS), + "SYS_GETDIRENTRIES": ValueOf(syscall.SYS_GETDIRENTRIES), + "SYS_GETDTABLESIZE": ValueOf(syscall.SYS_GETDTABLESIZE), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETFH": ValueOf(syscall.SYS_GETFH), + "SYS_GETFSSTAT": ValueOf(syscall.SYS_GETFSSTAT), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETLOGIN": ValueOf(syscall.SYS_GETLOGIN), + "SYS_GETLOGINCLASS": ValueOf(syscall.SYS_GETLOGINCLASS), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_ISSETUGID": ValueOf(syscall.SYS_ISSETUGID), + "SYS_JAIL": ValueOf(syscall.SYS_JAIL), + "SYS_JAIL_ATTACH": ValueOf(syscall.SYS_JAIL_ATTACH), + "SYS_JAIL_GET": ValueOf(syscall.SYS_JAIL_GET), + "SYS_JAIL_REMOVE": ValueOf(syscall.SYS_JAIL_REMOVE), + "SYS_JAIL_SET": ValueOf(syscall.SYS_JAIL_SET), + "SYS_KENV": ValueOf(syscall.SYS_KENV), + "SYS_KEVENT": ValueOf(syscall.SYS_KEVENT), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_KLDFIND": ValueOf(syscall.SYS_KLDFIND), + "SYS_KLDFIRSTMOD": ValueOf(syscall.SYS_KLDFIRSTMOD), + "SYS_KLDLOAD": ValueOf(syscall.SYS_KLDLOAD), + "SYS_KLDNEXT": ValueOf(syscall.SYS_KLDNEXT), + "SYS_KLDSTAT": ValueOf(syscall.SYS_KLDSTAT), + "SYS_KLDSYM": ValueOf(syscall.SYS_KLDSYM), + "SYS_KLDUNLOAD": ValueOf(syscall.SYS_KLDUNLOAD), + "SYS_KLDUNLOADF": ValueOf(syscall.SYS_KLDUNLOADF), + "SYS_KQUEUE": ValueOf(syscall.SYS_KQUEUE), + "SYS_KTIMER_CREATE": ValueOf(syscall.SYS_KTIMER_CREATE), + "SYS_KTIMER_DELETE": ValueOf(syscall.SYS_KTIMER_DELETE), + "SYS_KTIMER_GETOVERRUN": ValueOf(syscall.SYS_KTIMER_GETOVERRUN), + "SYS_KTIMER_GETTIME": ValueOf(syscall.SYS_KTIMER_GETTIME), + "SYS_KTIMER_SETTIME": ValueOf(syscall.SYS_KTIMER_SETTIME), + "SYS_KTRACE": ValueOf(syscall.SYS_KTRACE), + "SYS_LCHFLAGS": ValueOf(syscall.SYS_LCHFLAGS), + "SYS_LCHMOD": ValueOf(syscall.SYS_LCHMOD), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LGETFH": ValueOf(syscall.SYS_LGETFH), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LPATHCONF": ValueOf(syscall.SYS_LPATHCONF), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LUTIMES": ValueOf(syscall.SYS_LUTIMES), + "SYS_MAC_SYSCALL": ValueOf(syscall.SYS_MAC_SYSCALL), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MINHERIT": ValueOf(syscall.SYS_MINHERIT), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKFIFO": ValueOf(syscall.SYS_MKFIFO), + "SYS_MKFIFOAT": ValueOf(syscall.SYS_MKFIFOAT), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MODFIND": ValueOf(syscall.SYS_MODFIND), + "SYS_MODFNEXT": ValueOf(syscall.SYS_MODFNEXT), + "SYS_MODNEXT": ValueOf(syscall.SYS_MODNEXT), + "SYS_MODSTAT": ValueOf(syscall.SYS_MODSTAT), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NFSTAT": ValueOf(syscall.SYS_NFSTAT), + "SYS_NLSTAT": ValueOf(syscall.SYS_NLSTAT), + "SYS_NMOUNT": ValueOf(syscall.SYS_NMOUNT), + "SYS_NSTAT": ValueOf(syscall.SYS_NSTAT), + "SYS_NTP_ADJTIME": ValueOf(syscall.SYS_NTP_ADJTIME), + "SYS_NTP_GETTIME": ValueOf(syscall.SYS_NTP_GETTIME), + "SYS_OBREAK": ValueOf(syscall.SYS_OBREAK), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_OPENBSD_POLL": ValueOf(syscall.SYS_OPENBSD_POLL), + "SYS_OVADVISE": ValueOf(syscall.SYS_OVADVISE), + "SYS_PATHCONF": ValueOf(syscall.SYS_PATHCONF), + "SYS_PDFORK": ValueOf(syscall.SYS_PDFORK), + "SYS_PDGETPID": ValueOf(syscall.SYS_PDGETPID), + "SYS_PDKILL": ValueOf(syscall.SYS_PDKILL), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_POSIX_FADVISE": ValueOf(syscall.SYS_POSIX_FADVISE), + "SYS_POSIX_FALLOCATE": ValueOf(syscall.SYS_POSIX_FALLOCATE), + "SYS_POSIX_OPENPT": ValueOf(syscall.SYS_POSIX_OPENPT), + "SYS_PREAD": ValueOf(syscall.SYS_PREAD), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PROCCTL": ValueOf(syscall.SYS_PROCCTL), + "SYS_PROFIL": ValueOf(syscall.SYS_PROFIL), + "SYS_PSELECT": ValueOf(syscall.SYS_PSELECT), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE": ValueOf(syscall.SYS_PWRITE), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_RCTL_ADD_RULE": ValueOf(syscall.SYS_RCTL_ADD_RULE), + "SYS_RCTL_GET_LIMITS": ValueOf(syscall.SYS_RCTL_GET_LIMITS), + "SYS_RCTL_GET_RACCT": ValueOf(syscall.SYS_RCTL_GET_RACCT), + "SYS_RCTL_GET_RULES": ValueOf(syscall.SYS_RCTL_GET_RULES), + "SYS_RCTL_REMOVE_RULE": ValueOf(syscall.SYS_RCTL_REMOVE_RULE), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_REVOKE": ValueOf(syscall.SYS_REVOKE), + "SYS_RFORK": ValueOf(syscall.SYS_RFORK), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_RTPRIO": ValueOf(syscall.SYS_RTPRIO), + "SYS_RTPRIO_THREAD": ValueOf(syscall.SYS_RTPRIO_THREAD), + "SYS_SBRK": ValueOf(syscall.SYS_SBRK), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SCTP_GENERIC_RECVMSG": ValueOf(syscall.SYS_SCTP_GENERIC_RECVMSG), + "SYS_SCTP_GENERIC_SENDMSG": ValueOf(syscall.SYS_SCTP_GENERIC_SENDMSG), + "SYS_SCTP_GENERIC_SENDMSG_IOV": ValueOf(syscall.SYS_SCTP_GENERIC_SENDMSG_IOV), + "SYS_SCTP_PEELOFF": ValueOf(syscall.SYS_SCTP_PEELOFF), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SETAUDIT": ValueOf(syscall.SYS_SETAUDIT), + "SYS_SETAUDIT_ADDR": ValueOf(syscall.SYS_SETAUDIT_ADDR), + "SYS_SETAUID": ValueOf(syscall.SYS_SETAUID), + "SYS_SETCONTEXT": ValueOf(syscall.SYS_SETCONTEXT), + "SYS_SETEGID": ValueOf(syscall.SYS_SETEGID), + "SYS_SETEUID": ValueOf(syscall.SYS_SETEUID), + "SYS_SETFIB": ValueOf(syscall.SYS_SETFIB), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETLOGIN": ValueOf(syscall.SYS_SETLOGIN), + "SYS_SETLOGINCLASS": ValueOf(syscall.SYS_SETLOGINCLASS), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SHM_OPEN": ValueOf(syscall.SYS_SHM_OPEN), + "SYS_SHM_UNLINK": ValueOf(syscall.SYS_SHM_UNLINK), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGQUEUE": ValueOf(syscall.SYS_SIGQUEUE), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SIGTIMEDWAIT": ValueOf(syscall.SYS_SIGTIMEDWAIT), + "SYS_SIGWAIT": ValueOf(syscall.SYS_SIGWAIT), + "SYS_SIGWAITINFO": ValueOf(syscall.SYS_SIGWAITINFO), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_SSTK": ValueOf(syscall.SYS_SSTK), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_SWAPCONTEXT": ValueOf(syscall.SYS_SWAPCONTEXT), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYSARCH": ValueOf(syscall.SYS_SYSARCH), + "SYS_THR_CREATE": ValueOf(syscall.SYS_THR_CREATE), + "SYS_THR_EXIT": ValueOf(syscall.SYS_THR_EXIT), + "SYS_THR_KILL": ValueOf(syscall.SYS_THR_KILL), + "SYS_THR_KILL2": ValueOf(syscall.SYS_THR_KILL2), + "SYS_THR_NEW": ValueOf(syscall.SYS_THR_NEW), + "SYS_THR_SELF": ValueOf(syscall.SYS_THR_SELF), + "SYS_THR_SET_NAME": ValueOf(syscall.SYS_THR_SET_NAME), + "SYS_THR_SUSPEND": ValueOf(syscall.SYS_THR_SUSPEND), + "SYS_THR_WAKE": ValueOf(syscall.SYS_THR_WAKE), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UNDELETE": ValueOf(syscall.SYS_UNDELETE), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNMOUNT": ValueOf(syscall.SYS_UNMOUNT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_UTRACE": ValueOf(syscall.SYS_UTRACE), + "SYS_UUIDGEN": ValueOf(syscall.SYS_UUIDGEN), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAIT6": ValueOf(syscall.SYS_WAIT6), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS_YIELD": ValueOf(syscall.SYS_YIELD), + "SYS__UMTX_LOCK": ValueOf(syscall.SYS__UMTX_LOCK), + "SYS__UMTX_OP": ValueOf(syscall.SYS__UMTX_OP), + "SYS__UMTX_UNLOCK": ValueOf(syscall.SYS__UMTX_UNLOCK), + "SYS___ACL_ACLCHECK_FD": ValueOf(syscall.SYS___ACL_ACLCHECK_FD), + "SYS___ACL_ACLCHECK_FILE": ValueOf(syscall.SYS___ACL_ACLCHECK_FILE), + "SYS___ACL_ACLCHECK_LINK": ValueOf(syscall.SYS___ACL_ACLCHECK_LINK), + "SYS___ACL_DELETE_FD": ValueOf(syscall.SYS___ACL_DELETE_FD), + "SYS___ACL_DELETE_FILE": ValueOf(syscall.SYS___ACL_DELETE_FILE), + "SYS___ACL_DELETE_LINK": ValueOf(syscall.SYS___ACL_DELETE_LINK), + "SYS___ACL_GET_FD": ValueOf(syscall.SYS___ACL_GET_FD), + "SYS___ACL_GET_FILE": ValueOf(syscall.SYS___ACL_GET_FILE), + "SYS___ACL_GET_LINK": ValueOf(syscall.SYS___ACL_GET_LINK), + "SYS___ACL_SET_FD": ValueOf(syscall.SYS___ACL_SET_FD), + "SYS___ACL_SET_FILE": ValueOf(syscall.SYS___ACL_SET_FILE), + "SYS___ACL_SET_LINK": ValueOf(syscall.SYS___ACL_SET_LINK), + "SYS___GETCWD": ValueOf(syscall.SYS___GETCWD), + "SYS___MAC_EXECVE": ValueOf(syscall.SYS___MAC_EXECVE), + "SYS___MAC_GET_FD": ValueOf(syscall.SYS___MAC_GET_FD), + "SYS___MAC_GET_FILE": ValueOf(syscall.SYS___MAC_GET_FILE), + "SYS___MAC_GET_LINK": ValueOf(syscall.SYS___MAC_GET_LINK), + "SYS___MAC_GET_PID": ValueOf(syscall.SYS___MAC_GET_PID), + "SYS___MAC_GET_PROC": ValueOf(syscall.SYS___MAC_GET_PROC), + "SYS___MAC_SET_FD": ValueOf(syscall.SYS___MAC_SET_FD), + "SYS___MAC_SET_FILE": ValueOf(syscall.SYS___MAC_SET_FILE), + "SYS___MAC_SET_LINK": ValueOf(syscall.SYS___MAC_SET_LINK), + "SYS___MAC_SET_PROC": ValueOf(syscall.SYS___MAC_SET_PROC), + "SYS___SETUGID": ValueOf(syscall.SYS___SETUGID), + "SYS___SYSCTL": ValueOf(syscall.SYS___SYSCTL), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetBpf": ValueOf(syscall.SetBpf), + "SetBpfBuflen": ValueOf(syscall.SetBpfBuflen), + "SetBpfDatalink": ValueOf(syscall.SetBpfDatalink), + "SetBpfHeadercmpl": ValueOf(syscall.SetBpfHeadercmpl), + "SetBpfImmediate": ValueOf(syscall.SetBpfImmediate), + "SetBpfInterface": ValueOf(syscall.SetBpfInterface), + "SetBpfPromisc": ValueOf(syscall.SetBpfPromisc), + "SetBpfTimeout": ValueOf(syscall.SetBpfTimeout), + "SetKevent": ValueOf(syscall.SetKevent), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setegid": ValueOf(syscall.Setegid), + "Setenv": ValueOf(syscall.Setenv), + "Seteuid": ValueOf(syscall.Seteuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Setlogin": ValueOf(syscall.Setlogin), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofBpfHdr": ValueOf(syscall.SizeofBpfHdr), + "SizeofBpfInsn": ValueOf(syscall.SizeofBpfInsn), + "SizeofBpfProgram": ValueOf(syscall.SizeofBpfProgram), + "SizeofBpfStat": ValueOf(syscall.SizeofBpfStat), + "SizeofBpfVersion": ValueOf(syscall.SizeofBpfVersion), + "SizeofBpfZbuf": ValueOf(syscall.SizeofBpfZbuf), + "SizeofBpfZbufHeader": ValueOf(syscall.SizeofBpfZbufHeader), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAnnounceMsghdr": ValueOf(syscall.SizeofIfAnnounceMsghdr), + "SizeofIfData": ValueOf(syscall.SizeofIfData), + "SizeofIfMsghdr": ValueOf(syscall.SizeofIfMsghdr), + "SizeofIfaMsghdr": ValueOf(syscall.SizeofIfaMsghdr), + "SizeofIfmaMsghdr": ValueOf(syscall.SizeofIfmaMsghdr), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofRtMetrics": ValueOf(syscall.SizeofRtMetrics), + "SizeofRtMsghdr": ValueOf(syscall.SizeofRtMsghdr), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrDatalink": ValueOf(syscall.SizeofSockaddrDatalink), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Syscall9": ValueOf(syscall.Syscall9), + "Sysctl": ValueOf(syscall.Sysctl), + "SysctlUint32": ValueOf(syscall.SysctlUint32), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CA_NAME_MAX": ValueOf(syscall.TCP_CA_NAME_MAX), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINIT": ValueOf(syscall.TCP_KEEPINIT), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_MAXBURST": ValueOf(syscall.TCP_MAXBURST), + "TCP_MAXHLEN": ValueOf(syscall.TCP_MAXHLEN), + "TCP_MAXOLEN": ValueOf(syscall.TCP_MAXOLEN), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_SACK": ValueOf(syscall.TCP_MAX_SACK), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MINMSS": ValueOf(syscall.TCP_MINMSS), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_NOOPT": ValueOf(syscall.TCP_NOOPT), + "TCP_NOPUSH": ValueOf(syscall.TCP_NOPUSH), + "TCP_VENDOR": ValueOf(uint32(syscall.TCP_VENDOR)), + "TCSAFLUSH": ValueOf(syscall.TCSAFLUSH), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCDTR": ValueOf(syscall.TIOCCDTR), + "TIOCCONS": ValueOf(uint32(syscall.TIOCCONS)), + "TIOCDRAIN": ValueOf(syscall.TIOCDRAIN), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCEXT": ValueOf(uint32(syscall.TIOCEXT)), + "TIOCFLUSH": ValueOf(uint32(syscall.TIOCFLUSH)), + "TIOCGDRAINWAIT": ValueOf(syscall.TIOCGDRAINWAIT), + "TIOCGETA": ValueOf(syscall.TIOCGETA), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPTN": ValueOf(syscall.TIOCGPTN), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCMBIC": ValueOf(uint32(syscall.TIOCMBIC)), + "TIOCMBIS": ValueOf(uint32(syscall.TIOCMBIS)), + "TIOCMGDTRWAIT": ValueOf(syscall.TIOCMGDTRWAIT), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMSDTRWAIT": ValueOf(uint32(syscall.TIOCMSDTRWAIT)), + "TIOCMSET": ValueOf(uint32(syscall.TIOCMSET)), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DCD": ValueOf(syscall.TIOCM_DCD), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(uint32(syscall.TIOCPKT)), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCPTMASTER": ValueOf(syscall.TIOCPTMASTER), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSDRAINWAIT": ValueOf(uint32(syscall.TIOCSDRAINWAIT)), + "TIOCSDTR": ValueOf(syscall.TIOCSDTR), + "TIOCSETA": ValueOf(uint32(syscall.TIOCSETA)), + "TIOCSETAF": ValueOf(uint32(syscall.TIOCSETAF)), + "TIOCSETAW": ValueOf(uint32(syscall.TIOCSETAW)), + "TIOCSETD": ValueOf(uint32(syscall.TIOCSETD)), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSPGRP": ValueOf(uint32(syscall.TIOCSPGRP)), + "TIOCSTART": ValueOf(syscall.TIOCSTART), + "TIOCSTAT": ValueOf(syscall.TIOCSTAT), + "TIOCSTI": ValueOf(uint32(syscall.TIOCSTI)), + "TIOCSTOP": ValueOf(syscall.TIOCSTOP), + "TIOCSWINSZ": ValueOf(uint32(syscall.TIOCSWINSZ)), + "TIOCTIMESTAMP": ValueOf(syscall.TIOCTIMESTAMP), + "TIOCUCNTL": ValueOf(uint32(syscall.TIOCUCNTL)), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Undelete": ValueOf(syscall.Undelete), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VDSUSP": ValueOf(syscall.VDSUSP), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VERASE2": ValueOf(syscall.VERASE2), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTATUS": ValueOf(syscall.VSTATUS), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WCOREFLAG": ValueOf(syscall.WCOREFLAG), + "WEXITED": ValueOf(syscall.WEXITED), + "WLINUXCLONE": ValueOf(uint32(syscall.WLINUXCLONE)), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WTRAPPED": ValueOf(syscall.WTRAPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + },Types: map[string]Type{ + "BpfHdr": TypeOf((*syscall.BpfHdr)(nil)).Elem(), + "BpfInsn": TypeOf((*syscall.BpfInsn)(nil)).Elem(), + "BpfProgram": TypeOf((*syscall.BpfProgram)(nil)).Elem(), + "BpfStat": TypeOf((*syscall.BpfStat)(nil)).Elem(), + "BpfVersion": TypeOf((*syscall.BpfVersion)(nil)).Elem(), + "BpfZbuf": TypeOf((*syscall.BpfZbuf)(nil)).Elem(), + "BpfZbufHeader": TypeOf((*syscall.BpfZbufHeader)(nil)).Elem(), + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAnnounceMsghdr": TypeOf((*syscall.IfAnnounceMsghdr)(nil)).Elem(), + "IfData": TypeOf((*syscall.IfData)(nil)).Elem(), + "IfMsghdr": TypeOf((*syscall.IfMsghdr)(nil)).Elem(), + "IfaMsghdr": TypeOf((*syscall.IfaMsghdr)(nil)).Elem(), + "IfmaMsghdr": TypeOf((*syscall.IfmaMsghdr)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InterfaceAddrMessage": TypeOf((*syscall.InterfaceAddrMessage)(nil)).Elem(), + "InterfaceAnnounceMessage": TypeOf((*syscall.InterfaceAnnounceMessage)(nil)).Elem(), + "InterfaceMessage": TypeOf((*syscall.InterfaceMessage)(nil)).Elem(), + "InterfaceMulticastAddrMessage": TypeOf((*syscall.InterfaceMulticastAddrMessage)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Kevent_t": TypeOf((*syscall.Kevent_t)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrDatalink": TypeOf((*syscall.RawSockaddrDatalink)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RouteMessage": TypeOf((*syscall.RouteMessage)(nil)).Elem(), + "RoutingMessage": TypeOf((*syscall.RoutingMessage)(nil)).Elem(), + "RtMetrics": TypeOf((*syscall.RtMetrics)(nil)).Elem(), + "RtMsghdr": TypeOf((*syscall.RtMsghdr)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrDatalink": TypeOf((*syscall.SockaddrDatalink)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + },Untypeds: map[string]string{ + "AF_APPLETALK": "int:16", + "AF_ARP": "int:35", + "AF_ATM": "int:30", + "AF_BLUETOOTH": "int:36", + "AF_CCITT": "int:10", + "AF_CHAOS": "int:5", + "AF_CNT": "int:21", + "AF_COIP": "int:20", + "AF_DATAKIT": "int:9", + "AF_DECnet": "int:12", + "AF_DLI": "int:13", + "AF_E164": "int:26", + "AF_ECMA": "int:8", + "AF_HYLINK": "int:15", + "AF_IEEE80211": "int:37", + "AF_IMPLINK": "int:3", + "AF_INET": "int:2", + "AF_INET6": "int:28", + "AF_INET6_SDP": "int:42", + "AF_INET_SDP": "int:40", + "AF_IPX": "int:23", + "AF_ISDN": "int:26", + "AF_ISO": "int:7", + "AF_LAT": "int:14", + "AF_LINK": "int:18", + "AF_LOCAL": "int:1", + "AF_MAX": "int:42", + "AF_NATM": "int:29", + "AF_NETBIOS": "int:6", + "AF_NETGRAPH": "int:32", + "AF_OSI": "int:7", + "AF_PUP": "int:4", + "AF_ROUTE": "int:17", + "AF_SCLUSTER": "int:34", + "AF_SIP": "int:24", + "AF_SLOW": "int:33", + "AF_SNA": "int:11", + "AF_UNIX": "int:1", + "AF_UNSPEC": "int:0", + "AF_VENDOR00": "int:39", + "AF_VENDOR01": "int:41", + "AF_VENDOR02": "int:43", + "AF_VENDOR03": "int:45", + "AF_VENDOR04": "int:47", + "AF_VENDOR05": "int:49", + "AF_VENDOR06": "int:51", + "AF_VENDOR07": "int:53", + "AF_VENDOR08": "int:55", + "AF_VENDOR09": "int:57", + "AF_VENDOR10": "int:59", + "AF_VENDOR11": "int:61", + "AF_VENDOR12": "int:63", + "AF_VENDOR13": "int:65", + "AF_VENDOR14": "int:67", + "AF_VENDOR15": "int:69", + "AF_VENDOR16": "int:71", + "AF_VENDOR17": "int:73", + "AF_VENDOR18": "int:75", + "AF_VENDOR19": "int:77", + "AF_VENDOR20": "int:79", + "AF_VENDOR21": "int:81", + "AF_VENDOR22": "int:83", + "AF_VENDOR23": "int:85", + "AF_VENDOR24": "int:87", + "AF_VENDOR25": "int:89", + "AF_VENDOR26": "int:91", + "AF_VENDOR27": "int:93", + "AF_VENDOR28": "int:95", + "AF_VENDOR29": "int:97", + "AF_VENDOR30": "int:99", + "AF_VENDOR31": "int:101", + "AF_VENDOR32": "int:103", + "AF_VENDOR33": "int:105", + "AF_VENDOR34": "int:107", + "AF_VENDOR35": "int:109", + "AF_VENDOR36": "int:111", + "AF_VENDOR37": "int:113", + "AF_VENDOR38": "int:115", + "AF_VENDOR39": "int:117", + "AF_VENDOR40": "int:119", + "AF_VENDOR41": "int:121", + "AF_VENDOR42": "int:123", + "AF_VENDOR43": "int:125", + "AF_VENDOR44": "int:127", + "AF_VENDOR45": "int:129", + "AF_VENDOR46": "int:131", + "AF_VENDOR47": "int:133", + "B0": "int:0", + "B110": "int:110", + "B115200": "int:115200", + "B1200": "int:1200", + "B134": "int:134", + "B14400": "int:14400", + "B150": "int:150", + "B1800": "int:1800", + "B19200": "int:19200", + "B200": "int:200", + "B230400": "int:230400", + "B2400": "int:2400", + "B28800": "int:28800", + "B300": "int:300", + "B38400": "int:38400", + "B460800": "int:460800", + "B4800": "int:4800", + "B50": "int:50", + "B57600": "int:57600", + "B600": "int:600", + "B7200": "int:7200", + "B75": "int:75", + "B76800": "int:76800", + "B921600": "int:921600", + "B9600": "int:9600", + "BIOCFEEDBACK": "int:2147762812", + "BIOCFLUSH": "int:536887912", + "BIOCGBLEN": "int:1074020966", + "BIOCGDIRECTION": "int:1074020982", + "BIOCGDLT": "int:1074020970", + "BIOCGDLTLIST": "int:3222291065", + "BIOCGETBUFMODE": "int:1074020989", + "BIOCGETIF": "int:1075855979", + "BIOCGETZMAX": "int:1074283135", + "BIOCGHDRCMPLT": "int:1074020980", + "BIOCGRSIG": "int:1074020978", + "BIOCGRTIMEOUT": "int:1074807406", + "BIOCGSEESENT": "int:1074020982", + "BIOCGSTATS": "int:1074283119", + "BIOCGTSTAMP": "int:1074020995", + "BIOCIMMEDIATE": "int:2147762800", + "BIOCLOCK": "int:536887930", + "BIOCPROMISC": "int:536887913", + "BIOCROTZBUF": "int:1075331712", + "BIOCSBLEN": "int:3221504614", + "BIOCSDIRECTION": "int:2147762807", + "BIOCSDLT": "int:2147762808", + "BIOCSETBUFMODE": "int:2147762814", + "BIOCSETF": "int:2148549223", + "BIOCSETFNR": "int:2148549250", + "BIOCSETIF": "int:2149597804", + "BIOCSETWF": "int:2148549243", + "BIOCSETZBUF": "int:2149073537", + "BIOCSHDRCMPLT": "int:2147762805", + "BIOCSRSIG": "int:2147762803", + "BIOCSRTIMEOUT": "int:2148549229", + "BIOCSSEESENT": "int:2147762807", + "BIOCSTSTAMP": "int:2147762820", + "BIOCVERSION": "int:1074020977", + "BPF_A": "int:16", + "BPF_ABS": "int:32", + "BPF_ADD": "int:0", + "BPF_ALIGNMENT": "int:8", + "BPF_ALU": "int:4", + "BPF_AND": "int:80", + "BPF_B": "int:16", + "BPF_BUFMODE_BUFFER": "int:1", + "BPF_BUFMODE_ZBUF": "int:2", + "BPF_DIV": "int:48", + "BPF_H": "int:8", + "BPF_IMM": "int:0", + "BPF_IND": "int:64", + "BPF_JA": "int:0", + "BPF_JEQ": "int:16", + "BPF_JGE": "int:48", + "BPF_JGT": "int:32", + "BPF_JMP": "int:5", + "BPF_JSET": "int:64", + "BPF_K": "int:0", + "BPF_LD": "int:0", + "BPF_LDX": "int:1", + "BPF_LEN": "int:128", + "BPF_LSH": "int:96", + "BPF_MAJOR_VERSION": "int:1", + "BPF_MAXBUFSIZE": "int:524288", + "BPF_MAXINSNS": "int:512", + "BPF_MEM": "int:96", + "BPF_MEMWORDS": "int:16", + "BPF_MINBUFSIZE": "int:32", + "BPF_MINOR_VERSION": "int:1", + "BPF_MISC": "int:7", + "BPF_MSH": "int:160", + "BPF_MUL": "int:32", + "BPF_NEG": "int:128", + "BPF_OR": "int:64", + "BPF_RELEASE": "int:199606", + "BPF_RET": "int:6", + "BPF_RSH": "int:112", + "BPF_ST": "int:2", + "BPF_STX": "int:3", + "BPF_SUB": "int:16", + "BPF_TAX": "int:0", + "BPF_TXA": "int:128", + "BPF_T_BINTIME": "int:2", + "BPF_T_BINTIME_FAST": "int:258", + "BPF_T_BINTIME_MONOTONIC": "int:514", + "BPF_T_BINTIME_MONOTONIC_FAST": "int:770", + "BPF_T_FAST": "int:256", + "BPF_T_FLAG_MASK": "int:768", + "BPF_T_FORMAT_MASK": "int:3", + "BPF_T_MICROTIME": "int:0", + "BPF_T_MICROTIME_FAST": "int:256", + "BPF_T_MICROTIME_MONOTONIC": "int:512", + "BPF_T_MICROTIME_MONOTONIC_FAST": "int:768", + "BPF_T_MONOTONIC": "int:512", + "BPF_T_MONOTONIC_FAST": "int:768", + "BPF_T_NANOTIME": "int:1", + "BPF_T_NANOTIME_FAST": "int:257", + "BPF_T_NANOTIME_MONOTONIC": "int:513", + "BPF_T_NANOTIME_MONOTONIC_FAST": "int:769", + "BPF_T_NONE": "int:3", + "BPF_T_NORMAL": "int:0", + "BPF_W": "int:0", + "BPF_X": "int:8", + "BRKINT": "int:2", + "CFLUSH": "int:15", + "CLOCAL": "int:32768", + "CREAD": "int:2048", + "CS5": "int:0", + "CS6": "int:256", + "CS7": "int:512", + "CS8": "int:768", + "CSIZE": "int:768", + "CSTART": "int:17", + "CSTATUS": "int:20", + "CSTOP": "int:19", + "CSTOPB": "int:1024", + "CSUSP": "int:26", + "CTL_MAXNAME": "int:24", + "CTL_NET": "int:4", + "DLT_A429": "int:184", + "DLT_A653_ICM": "int:185", + "DLT_AIRONET_HEADER": "int:120", + "DLT_AOS": "int:222", + "DLT_APPLE_IP_OVER_IEEE1394": "int:138", + "DLT_ARCNET": "int:7", + "DLT_ARCNET_LINUX": "int:129", + "DLT_ATM_CLIP": "int:19", + "DLT_ATM_RFC1483": "int:11", + "DLT_AURORA": "int:126", + "DLT_AX25": "int:3", + "DLT_AX25_KISS": "int:202", + "DLT_BACNET_MS_TP": "int:165", + "DLT_BLUETOOTH_HCI_H4": "int:187", + "DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "int:201", + "DLT_CAN20B": "int:190", + "DLT_CAN_SOCKETCAN": "int:227", + "DLT_CHAOS": "int:5", + "DLT_CHDLC": "int:104", + "DLT_CISCO_IOS": "int:118", + "DLT_C_HDLC": "int:104", + "DLT_C_HDLC_WITH_DIR": "int:205", + "DLT_DBUS": "int:231", + "DLT_DECT": "int:221", + "DLT_DOCSIS": "int:143", + "DLT_DVB_CI": "int:235", + "DLT_ECONET": "int:115", + "DLT_EN10MB": "int:1", + "DLT_EN3MB": "int:2", + "DLT_ENC": "int:109", + "DLT_ERF": "int:197", + "DLT_ERF_ETH": "int:175", + "DLT_ERF_POS": "int:176", + "DLT_FC_2": "int:224", + "DLT_FC_2_WITH_FRAME_DELIMS": "int:225", + "DLT_FDDI": "int:10", + "DLT_FLEXRAY": "int:210", + "DLT_FRELAY": "int:107", + "DLT_FRELAY_WITH_DIR": "int:206", + "DLT_GCOM_SERIAL": "int:173", + "DLT_GCOM_T1E1": "int:172", + "DLT_GPF_F": "int:171", + "DLT_GPF_T": "int:170", + "DLT_GPRS_LLC": "int:169", + "DLT_GSMTAP_ABIS": "int:218", + "DLT_GSMTAP_UM": "int:217", + "DLT_HHDLC": "int:121", + "DLT_IBM_SN": "int:146", + "DLT_IBM_SP": "int:145", + "DLT_IEEE802": "int:6", + "DLT_IEEE802_11": "int:105", + "DLT_IEEE802_11_RADIO": "int:127", + "DLT_IEEE802_11_RADIO_AVS": "int:163", + "DLT_IEEE802_15_4": "int:195", + "DLT_IEEE802_15_4_LINUX": "int:191", + "DLT_IEEE802_15_4_NOFCS": "int:230", + "DLT_IEEE802_15_4_NONASK_PHY": "int:215", + "DLT_IEEE802_16_MAC_CPS": "int:188", + "DLT_IEEE802_16_MAC_CPS_RADIO": "int:193", + "DLT_IPFILTER": "int:116", + "DLT_IPMB": "int:199", + "DLT_IPMB_LINUX": "int:209", + "DLT_IPNET": "int:226", + "DLT_IPOIB": "int:242", + "DLT_IPV4": "int:228", + "DLT_IPV6": "int:229", + "DLT_IP_OVER_FC": "int:122", + "DLT_JUNIPER_ATM1": "int:137", + "DLT_JUNIPER_ATM2": "int:135", + "DLT_JUNIPER_ATM_CEMIC": "int:238", + "DLT_JUNIPER_CHDLC": "int:181", + "DLT_JUNIPER_ES": "int:132", + "DLT_JUNIPER_ETHER": "int:178", + "DLT_JUNIPER_FIBRECHANNEL": "int:234", + "DLT_JUNIPER_FRELAY": "int:180", + "DLT_JUNIPER_GGSN": "int:133", + "DLT_JUNIPER_ISM": "int:194", + "DLT_JUNIPER_MFR": "int:134", + "DLT_JUNIPER_MLFR": "int:131", + "DLT_JUNIPER_MLPPP": "int:130", + "DLT_JUNIPER_MONITOR": "int:164", + "DLT_JUNIPER_PIC_PEER": "int:174", + "DLT_JUNIPER_PPP": "int:179", + "DLT_JUNIPER_PPPOE": "int:167", + "DLT_JUNIPER_PPPOE_ATM": "int:168", + "DLT_JUNIPER_SERVICES": "int:136", + "DLT_JUNIPER_SRX_E2E": "int:233", + "DLT_JUNIPER_ST": "int:200", + "DLT_JUNIPER_VP": "int:183", + "DLT_JUNIPER_VS": "int:232", + "DLT_LAPB_WITH_DIR": "int:207", + "DLT_LAPD": "int:203", + "DLT_LIN": "int:212", + "DLT_LINUX_EVDEV": "int:216", + "DLT_LINUX_IRDA": "int:144", + "DLT_LINUX_LAPD": "int:177", + "DLT_LINUX_PPP_WITHDIRECTION": "int:166", + "DLT_LINUX_SLL": "int:113", + "DLT_LOOP": "int:108", + "DLT_LTALK": "int:114", + "DLT_MATCHING_MAX": "int:246", + "DLT_MATCHING_MIN": "int:104", + "DLT_MFR": "int:182", + "DLT_MOST": "int:211", + "DLT_MPEG_2_TS": "int:243", + "DLT_MPLS": "int:219", + "DLT_MTP2": "int:140", + "DLT_MTP2_WITH_PHDR": "int:139", + "DLT_MTP3": "int:141", + "DLT_MUX27010": "int:236", + "DLT_NETANALYZER": "int:240", + "DLT_NETANALYZER_TRANSPARENT": "int:241", + "DLT_NFC_LLCP": "int:245", + "DLT_NFLOG": "int:239", + "DLT_NG40": "int:244", + "DLT_NULL": "int:0", + "DLT_PCI_EXP": "int:125", + "DLT_PFLOG": "int:117", + "DLT_PFSYNC": "int:121", + "DLT_PPI": "int:192", + "DLT_PPP": "int:9", + "DLT_PPP_BSDOS": "int:16", + "DLT_PPP_ETHER": "int:51", + "DLT_PPP_PPPD": "int:166", + "DLT_PPP_SERIAL": "int:50", + "DLT_PPP_WITH_DIR": "int:204", + "DLT_PPP_WITH_DIRECTION": "int:166", + "DLT_PRISM_HEADER": "int:119", + "DLT_PRONET": "int:4", + "DLT_RAIF1": "int:198", + "DLT_RAW": "int:12", + "DLT_RIO": "int:124", + "DLT_SCCP": "int:142", + "DLT_SITA": "int:196", + "DLT_SLIP": "int:8", + "DLT_SLIP_BSDOS": "int:15", + "DLT_STANAG_5066_D_PDU": "int:237", + "DLT_SUNATM": "int:123", + "DLT_SYMANTEC_FIREWALL": "int:99", + "DLT_TZSP": "int:128", + "DLT_USB": "int:186", + "DLT_USB_LINUX": "int:189", + "DLT_USB_LINUX_MMAPPED": "int:220", + "DLT_USER0": "int:147", + "DLT_USER1": "int:148", + "DLT_USER10": "int:157", + "DLT_USER11": "int:158", + "DLT_USER12": "int:159", + "DLT_USER13": "int:160", + "DLT_USER14": "int:161", + "DLT_USER15": "int:162", + "DLT_USER2": "int:149", + "DLT_USER3": "int:150", + "DLT_USER4": "int:151", + "DLT_USER5": "int:152", + "DLT_USER6": "int:153", + "DLT_USER7": "int:154", + "DLT_USER8": "int:155", + "DLT_USER9": "int:156", + "DLT_WIHART": "int:223", + "DLT_X2E_SERIAL": "int:213", + "DLT_X2E_XORAYA": "int:214", + "DT_BLK": "int:6", + "DT_CHR": "int:2", + "DT_DIR": "int:4", + "DT_FIFO": "int:1", + "DT_LNK": "int:10", + "DT_REG": "int:8", + "DT_SOCK": "int:12", + "DT_UNKNOWN": "int:0", + "DT_WHT": "int:14", + "ECHO": "int:8", + "ECHOCTL": "int:64", + "ECHOE": "int:2", + "ECHOK": "int:4", + "ECHOKE": "int:1", + "ECHONL": "int:16", + "ECHOPRT": "int:32", + "EVFILT_AIO": "int:-3", + "EVFILT_FS": "int:-9", + "EVFILT_LIO": "int:-10", + "EVFILT_PROC": "int:-5", + "EVFILT_READ": "int:-1", + "EVFILT_SIGNAL": "int:-6", + "EVFILT_SYSCOUNT": "int:11", + "EVFILT_TIMER": "int:-7", + "EVFILT_USER": "int:-11", + "EVFILT_VNODE": "int:-4", + "EVFILT_WRITE": "int:-2", + "EV_ADD": "int:1", + "EV_CLEAR": "int:32", + "EV_DELETE": "int:2", + "EV_DISABLE": "int:8", + "EV_DISPATCH": "int:128", + "EV_DROP": "int:4096", + "EV_ENABLE": "int:4", + "EV_EOF": "int:32768", + "EV_ERROR": "int:16384", + "EV_FLAG1": "int:8192", + "EV_ONESHOT": "int:16", + "EV_RECEIPT": "int:64", + "EV_SYSFLAGS": "int:61440", + "EXTA": "int:19200", + "EXTB": "int:38400", + "EXTPROC": "int:2048", + "FD_CLOEXEC": "int:1", + "FD_SETSIZE": "int:1024", + "FLUSHO": "int:8388608", + "F_CANCEL": "int:5", + "F_DUP2FD": "int:10", + "F_DUP2FD_CLOEXEC": "int:18", + "F_DUPFD": "int:0", + "F_DUPFD_CLOEXEC": "int:17", + "F_GETFD": "int:1", + "F_GETFL": "int:3", + "F_GETLK": "int:11", + "F_GETOWN": "int:5", + "F_OGETLK": "int:7", + "F_OK": "int:0", + "F_OSETLK": "int:8", + "F_OSETLKW": "int:9", + "F_RDAHEAD": "int:16", + "F_RDLCK": "int:1", + "F_READAHEAD": "int:15", + "F_SETFD": "int:2", + "F_SETFL": "int:4", + "F_SETLK": "int:12", + "F_SETLKW": "int:13", + "F_SETLK_REMOTE": "int:14", + "F_SETOWN": "int:6", + "F_UNLCK": "int:2", + "F_UNLCKSYS": "int:4", + "F_WRLCK": "int:3", + "HUPCL": "int:16384", + "ICANON": "int:256", + "ICMP6_FILTER": "int:18", + "ICRNL": "int:256", + "IEXTEN": "int:1024", + "IFAN_ARRIVAL": "int:0", + "IFAN_DEPARTURE": "int:1", + "IFF_ALLMULTI": "int:512", + "IFF_ALTPHYS": "int:16384", + "IFF_BROADCAST": "int:2", + "IFF_CANTCHANGE": "int:2199410", + "IFF_CANTCONFIG": "int:65536", + "IFF_DEBUG": "int:4", + "IFF_DRV_OACTIVE": "int:1024", + "IFF_DRV_RUNNING": "int:64", + "IFF_DYING": "int:2097152", + "IFF_LINK0": "int:4096", + "IFF_LINK1": "int:8192", + "IFF_LINK2": "int:16384", + "IFF_LOOPBACK": "int:8", + "IFF_MONITOR": "int:262144", + "IFF_MULTICAST": "int:32768", + "IFF_NOARP": "int:128", + "IFF_OACTIVE": "int:1024", + "IFF_POINTOPOINT": "int:16", + "IFF_PPROMISC": "int:131072", + "IFF_PROMISC": "int:256", + "IFF_RENAMING": "int:4194304", + "IFF_RUNNING": "int:64", + "IFF_SIMPLEX": "int:2048", + "IFF_SMART": "int:32", + "IFF_STATICARP": "int:524288", + "IFF_UP": "int:1", + "IFNAMSIZ": "int:16", + "IFT_1822": "int:2", + "IFT_A12MPPSWITCH": "int:130", + "IFT_AAL2": "int:187", + "IFT_AAL5": "int:49", + "IFT_ADSL": "int:94", + "IFT_AFLANE8023": "int:59", + "IFT_AFLANE8025": "int:60", + "IFT_ARAP": "int:88", + "IFT_ARCNET": "int:35", + "IFT_ARCNETPLUS": "int:36", + "IFT_ASYNC": "int:84", + "IFT_ATM": "int:37", + "IFT_ATMDXI": "int:105", + "IFT_ATMFUNI": "int:106", + "IFT_ATMIMA": "int:107", + "IFT_ATMLOGICAL": "int:80", + "IFT_ATMRADIO": "int:189", + "IFT_ATMSUBINTERFACE": "int:134", + "IFT_ATMVCIENDPT": "int:194", + "IFT_ATMVIRTUAL": "int:149", + "IFT_BGPPOLICYACCOUNTING": "int:162", + "IFT_BRIDGE": "int:209", + "IFT_BSC": "int:83", + "IFT_CARP": "int:248", + "IFT_CCTEMUL": "int:61", + "IFT_CEPT": "int:19", + "IFT_CES": "int:133", + "IFT_CHANNEL": "int:70", + "IFT_CNR": "int:85", + "IFT_COFFEE": "int:132", + "IFT_COMPOSITELINK": "int:155", + "IFT_DCN": "int:141", + "IFT_DIGITALPOWERLINE": "int:138", + "IFT_DIGITALWRAPPEROVERHEADCHANNEL": "int:186", + "IFT_DLSW": "int:74", + "IFT_DOCSCABLEDOWNSTREAM": "int:128", + "IFT_DOCSCABLEMACLAYER": "int:127", + "IFT_DOCSCABLEUPSTREAM": "int:129", + "IFT_DS0": "int:81", + "IFT_DS0BUNDLE": "int:82", + "IFT_DS1FDL": "int:170", + "IFT_DS3": "int:30", + "IFT_DTM": "int:140", + "IFT_DVBASILN": "int:172", + "IFT_DVBASIOUT": "int:173", + "IFT_DVBRCCDOWNSTREAM": "int:147", + "IFT_DVBRCCMACLAYER": "int:146", + "IFT_DVBRCCUPSTREAM": "int:148", + "IFT_ENC": "int:244", + "IFT_EON": "int:25", + "IFT_EPLRS": "int:87", + "IFT_ESCON": "int:73", + "IFT_ETHER": "int:6", + "IFT_FAITH": "int:242", + "IFT_FAST": "int:125", + "IFT_FASTETHER": "int:62", + "IFT_FASTETHERFX": "int:69", + "IFT_FDDI": "int:15", + "IFT_FIBRECHANNEL": "int:56", + "IFT_FRAMERELAYINTERCONNECT": "int:58", + "IFT_FRAMERELAYMPI": "int:92", + "IFT_FRDLCIENDPT": "int:193", + "IFT_FRELAY": "int:32", + "IFT_FRELAYDCE": "int:44", + "IFT_FRF16MFRBUNDLE": "int:163", + "IFT_FRFORWARD": "int:158", + "IFT_G703AT2MB": "int:67", + "IFT_G703AT64K": "int:66", + "IFT_GIF": "int:240", + "IFT_GIGABITETHERNET": "int:117", + "IFT_GR303IDT": "int:178", + "IFT_GR303RDT": "int:177", + "IFT_H323GATEKEEPER": "int:164", + "IFT_H323PROXY": "int:165", + "IFT_HDH1822": "int:3", + "IFT_HDLC": "int:118", + "IFT_HDSL2": "int:168", + "IFT_HIPERLAN2": "int:183", + "IFT_HIPPI": "int:47", + "IFT_HIPPIINTERFACE": "int:57", + "IFT_HOSTPAD": "int:90", + "IFT_HSSI": "int:46", + "IFT_HY": "int:14", + "IFT_IBM370PARCHAN": "int:72", + "IFT_IDSL": "int:154", + "IFT_IEEE1394": "int:144", + "IFT_IEEE80211": "int:71", + "IFT_IEEE80212": "int:55", + "IFT_IEEE8023ADLAG": "int:161", + "IFT_IFGSN": "int:145", + "IFT_IMT": "int:190", + "IFT_INFINIBAND": "int:199", + "IFT_INTERLEAVE": "int:124", + "IFT_IP": "int:126", + "IFT_IPFORWARD": "int:142", + "IFT_IPOVERATM": "int:114", + "IFT_IPOVERCDLC": "int:109", + "IFT_IPOVERCLAW": "int:110", + "IFT_IPSWITCH": "int:78", + "IFT_IPXIP": "int:249", + "IFT_ISDN": "int:63", + "IFT_ISDNBASIC": "int:20", + "IFT_ISDNPRIMARY": "int:21", + "IFT_ISDNS": "int:75", + "IFT_ISDNU": "int:76", + "IFT_ISO88022LLC": "int:41", + "IFT_ISO88023": "int:7", + "IFT_ISO88024": "int:8", + "IFT_ISO88025": "int:9", + "IFT_ISO88025CRFPINT": "int:98", + "IFT_ISO88025DTR": "int:86", + "IFT_ISO88025FIBER": "int:115", + "IFT_ISO88026": "int:10", + "IFT_ISUP": "int:179", + "IFT_L2VLAN": "int:135", + "IFT_L3IPVLAN": "int:136", + "IFT_L3IPXVLAN": "int:137", + "IFT_LAPB": "int:16", + "IFT_LAPD": "int:77", + "IFT_LAPF": "int:119", + "IFT_LOCALTALK": "int:42", + "IFT_LOOP": "int:24", + "IFT_MEDIAMAILOVERIP": "int:139", + "IFT_MFSIGLINK": "int:167", + "IFT_MIOX25": "int:38", + "IFT_MODEM": "int:48", + "IFT_MPC": "int:113", + "IFT_MPLS": "int:166", + "IFT_MPLSTUNNEL": "int:150", + "IFT_MSDSL": "int:143", + "IFT_MVL": "int:191", + "IFT_MYRINET": "int:99", + "IFT_NFAS": "int:175", + "IFT_NSIP": "int:27", + "IFT_OPTICALCHANNEL": "int:195", + "IFT_OPTICALTRANSPORT": "int:196", + "IFT_OTHER": "int:1", + "IFT_P10": "int:12", + "IFT_P80": "int:13", + "IFT_PARA": "int:34", + "IFT_PFLOG": "int:246", + "IFT_PFSYNC": "int:247", + "IFT_PLC": "int:174", + "IFT_POS": "int:171", + "IFT_PPP": "int:23", + "IFT_PPPMULTILINKBUNDLE": "int:108", + "IFT_PROPBWAP2MP": "int:184", + "IFT_PROPCNLS": "int:89", + "IFT_PROPDOCSWIRELESSDOWNSTREAM": "int:181", + "IFT_PROPDOCSWIRELESSMACLAYER": "int:180", + "IFT_PROPDOCSWIRELESSUPSTREAM": "int:182", + "IFT_PROPMUX": "int:54", + "IFT_PROPVIRTUAL": "int:53", + "IFT_PROPWIRELESSP2P": "int:157", + "IFT_PTPSERIAL": "int:22", + "IFT_PVC": "int:241", + "IFT_QLLC": "int:68", + "IFT_RADIOMAC": "int:188", + "IFT_RADSL": "int:95", + "IFT_REACHDSL": "int:192", + "IFT_RFC1483": "int:159", + "IFT_RS232": "int:33", + "IFT_RSRB": "int:79", + "IFT_SDLC": "int:17", + "IFT_SDSL": "int:96", + "IFT_SHDSL": "int:169", + "IFT_SIP": "int:31", + "IFT_SLIP": "int:28", + "IFT_SMDSDXI": "int:43", + "IFT_SMDSICIP": "int:52", + "IFT_SONET": "int:39", + "IFT_SONETOVERHEADCHANNEL": "int:185", + "IFT_SONETPATH": "int:50", + "IFT_SONETVT": "int:51", + "IFT_SRP": "int:151", + "IFT_SS7SIGLINK": "int:156", + "IFT_STACKTOSTACK": "int:111", + "IFT_STARLAN": "int:11", + "IFT_STF": "int:215", + "IFT_T1": "int:18", + "IFT_TDLC": "int:116", + "IFT_TERMPAD": "int:91", + "IFT_TR008": "int:176", + "IFT_TRANSPHDLC": "int:123", + "IFT_TUNNEL": "int:131", + "IFT_ULTRA": "int:29", + "IFT_USB": "int:160", + "IFT_V11": "int:64", + "IFT_V35": "int:45", + "IFT_V36": "int:65", + "IFT_V37": "int:120", + "IFT_VDSL": "int:97", + "IFT_VIRTUALIPADDRESS": "int:112", + "IFT_VOICEEM": "int:100", + "IFT_VOICEENCAP": "int:103", + "IFT_VOICEFXO": "int:101", + "IFT_VOICEFXS": "int:102", + "IFT_VOICEOVERATM": "int:152", + "IFT_VOICEOVERFRAMERELAY": "int:153", + "IFT_VOICEOVERIP": "int:104", + "IFT_X213": "int:93", + "IFT_X25": "int:5", + "IFT_X25DDN": "int:4", + "IFT_X25HUNTGROUP": "int:122", + "IFT_X25MLP": "int:121", + "IFT_X25PLE": "int:40", + "IFT_XETHER": "int:26", + "IGNBRK": "int:1", + "IGNCR": "int:128", + "IGNPAR": "int:4", + "IMAXBEL": "int:8192", + "INLCR": "int:64", + "INPCK": "int:16", + "IN_CLASSA_HOST": "int:16777215", + "IN_CLASSA_MAX": "int:128", + "IN_CLASSA_NET": "int:4278190080", + "IN_CLASSA_NSHIFT": "int:24", + "IN_CLASSB_HOST": "int:65535", + "IN_CLASSB_MAX": "int:65536", + "IN_CLASSB_NET": "int:4294901760", + "IN_CLASSB_NSHIFT": "int:16", + "IN_CLASSC_HOST": "int:255", + "IN_CLASSC_NET": "int:4294967040", + "IN_CLASSC_NSHIFT": "int:8", + "IN_CLASSD_HOST": "int:268435455", + "IN_CLASSD_NET": "int:4026531840", + "IN_CLASSD_NSHIFT": "int:28", + "IN_LOOPBACKNET": "int:127", + "IN_RFC3021_MASK": "int:4294967294", + "IPPROTO_3PC": "int:34", + "IPPROTO_ADFS": "int:68", + "IPPROTO_AH": "int:51", + "IPPROTO_AHIP": "int:61", + "IPPROTO_APES": "int:99", + "IPPROTO_ARGUS": "int:13", + "IPPROTO_AX25": "int:93", + "IPPROTO_BHA": "int:49", + "IPPROTO_BLT": "int:30", + "IPPROTO_BRSATMON": "int:76", + "IPPROTO_CARP": "int:112", + "IPPROTO_CFTP": "int:62", + "IPPROTO_CHAOS": "int:16", + "IPPROTO_CMTP": "int:38", + "IPPROTO_CPHB": "int:73", + "IPPROTO_CPNX": "int:72", + "IPPROTO_DDP": "int:37", + "IPPROTO_DGP": "int:86", + "IPPROTO_DIVERT": "int:258", + "IPPROTO_DONE": "int:257", + "IPPROTO_DSTOPTS": "int:60", + "IPPROTO_EGP": "int:8", + "IPPROTO_EMCON": "int:14", + "IPPROTO_ENCAP": "int:98", + "IPPROTO_EON": "int:80", + "IPPROTO_ESP": "int:50", + "IPPROTO_ETHERIP": "int:97", + "IPPROTO_FRAGMENT": "int:44", + "IPPROTO_GGP": "int:3", + "IPPROTO_GMTP": "int:100", + "IPPROTO_GRE": "int:47", + "IPPROTO_HELLO": "int:63", + "IPPROTO_HMP": "int:20", + "IPPROTO_HOPOPTS": "int:0", + "IPPROTO_ICMP": "int:1", + "IPPROTO_ICMPV6": "int:58", + "IPPROTO_IDP": "int:22", + "IPPROTO_IDPR": "int:35", + "IPPROTO_IDRP": "int:45", + "IPPROTO_IGMP": "int:2", + "IPPROTO_IGP": "int:85", + "IPPROTO_IGRP": "int:88", + "IPPROTO_IL": "int:40", + "IPPROTO_INLSP": "int:52", + "IPPROTO_INP": "int:32", + "IPPROTO_IP": "int:0", + "IPPROTO_IPCOMP": "int:108", + "IPPROTO_IPCV": "int:71", + "IPPROTO_IPEIP": "int:94", + "IPPROTO_IPIP": "int:4", + "IPPROTO_IPPC": "int:67", + "IPPROTO_IPV4": "int:4", + "IPPROTO_IPV6": "int:41", + "IPPROTO_IRTP": "int:28", + "IPPROTO_KRYPTOLAN": "int:65", + "IPPROTO_LARP": "int:91", + "IPPROTO_LEAF1": "int:25", + "IPPROTO_LEAF2": "int:26", + "IPPROTO_MAX": "int:256", + "IPPROTO_MAXID": "int:52", + "IPPROTO_MEAS": "int:19", + "IPPROTO_MH": "int:135", + "IPPROTO_MHRP": "int:48", + "IPPROTO_MICP": "int:95", + "IPPROTO_MOBILE": "int:55", + "IPPROTO_MPLS": "int:137", + "IPPROTO_MTP": "int:92", + "IPPROTO_MUX": "int:18", + "IPPROTO_ND": "int:77", + "IPPROTO_NHRP": "int:54", + "IPPROTO_NONE": "int:59", + "IPPROTO_NSP": "int:31", + "IPPROTO_NVPII": "int:11", + "IPPROTO_OLD_DIVERT": "int:254", + "IPPROTO_OSPFIGP": "int:89", + "IPPROTO_PFSYNC": "int:240", + "IPPROTO_PGM": "int:113", + "IPPROTO_PIGP": "int:9", + "IPPROTO_PIM": "int:103", + "IPPROTO_PRM": "int:21", + "IPPROTO_PUP": "int:12", + "IPPROTO_PVP": "int:75", + "IPPROTO_RAW": "int:255", + "IPPROTO_RCCMON": "int:10", + "IPPROTO_RDP": "int:27", + "IPPROTO_ROUTING": "int:43", + "IPPROTO_RSVP": "int:46", + "IPPROTO_RVD": "int:66", + "IPPROTO_SATEXPAK": "int:64", + "IPPROTO_SATMON": "int:69", + "IPPROTO_SCCSP": "int:96", + "IPPROTO_SCTP": "int:132", + "IPPROTO_SDRP": "int:42", + "IPPROTO_SEND": "int:259", + "IPPROTO_SEP": "int:33", + "IPPROTO_SKIP": "int:57", + "IPPROTO_SPACER": "int:32767", + "IPPROTO_SRPC": "int:90", + "IPPROTO_ST": "int:7", + "IPPROTO_SVMTP": "int:82", + "IPPROTO_SWIPE": "int:53", + "IPPROTO_TCF": "int:87", + "IPPROTO_TCP": "int:6", + "IPPROTO_TLSP": "int:56", + "IPPROTO_TP": "int:29", + "IPPROTO_TPXX": "int:39", + "IPPROTO_TRUNK1": "int:23", + "IPPROTO_TRUNK2": "int:24", + "IPPROTO_TTP": "int:84", + "IPPROTO_UDP": "int:17", + "IPPROTO_VINES": "int:83", + "IPPROTO_VISA": "int:70", + "IPPROTO_VMTP": "int:81", + "IPPROTO_WBEXPAK": "int:79", + "IPPROTO_WBMON": "int:78", + "IPPROTO_WSN": "int:74", + "IPPROTO_XNET": "int:15", + "IPPROTO_XTP": "int:36", + "IPV6_AUTOFLOWLABEL": "int:59", + "IPV6_BINDANY": "int:64", + "IPV6_BINDV6ONLY": "int:27", + "IPV6_CHECKSUM": "int:26", + "IPV6_DEFAULT_MULTICAST_HOPS": "int:1", + "IPV6_DEFAULT_MULTICAST_LOOP": "int:1", + "IPV6_DEFHLIM": "int:64", + "IPV6_DONTFRAG": "int:62", + "IPV6_DSTOPTS": "int:50", + "IPV6_FAITH": "int:29", + "IPV6_FLOWINFO_MASK": "int:4294967055", + "IPV6_FLOWLABEL_MASK": "int:4294905600", + "IPV6_FRAGTTL": "int:120", + "IPV6_FW_ADD": "int:30", + "IPV6_FW_DEL": "int:31", + "IPV6_FW_FLUSH": "int:32", + "IPV6_FW_GET": "int:34", + "IPV6_FW_ZERO": "int:33", + "IPV6_HLIMDEC": "int:1", + "IPV6_HOPLIMIT": "int:47", + "IPV6_HOPOPTS": "int:49", + "IPV6_IPSEC_POLICY": "int:28", + "IPV6_JOIN_GROUP": "int:12", + "IPV6_LEAVE_GROUP": "int:13", + "IPV6_MAXHLIM": "int:255", + "IPV6_MAXOPTHDR": "int:2048", + "IPV6_MAXPACKET": "int:65535", + "IPV6_MAX_GROUP_SRC_FILTER": "int:512", + "IPV6_MAX_MEMBERSHIPS": "int:4095", + "IPV6_MAX_SOCK_SRC_FILTER": "int:128", + "IPV6_MIN_MEMBERSHIPS": "int:31", + "IPV6_MMTU": "int:1280", + "IPV6_MSFILTER": "int:74", + "IPV6_MULTICAST_HOPS": "int:10", + "IPV6_MULTICAST_IF": "int:9", + "IPV6_MULTICAST_LOOP": "int:11", + "IPV6_NEXTHOP": "int:48", + "IPV6_PATHMTU": "int:44", + "IPV6_PKTINFO": "int:46", + "IPV6_PORTRANGE": "int:14", + "IPV6_PORTRANGE_DEFAULT": "int:0", + "IPV6_PORTRANGE_HIGH": "int:1", + "IPV6_PORTRANGE_LOW": "int:2", + "IPV6_PREFER_TEMPADDR": "int:63", + "IPV6_RECVDSTOPTS": "int:40", + "IPV6_RECVHOPLIMIT": "int:37", + "IPV6_RECVHOPOPTS": "int:39", + "IPV6_RECVPATHMTU": "int:43", + "IPV6_RECVPKTINFO": "int:36", + "IPV6_RECVRTHDR": "int:38", + "IPV6_RECVTCLASS": "int:57", + "IPV6_RTHDR": "int:51", + "IPV6_RTHDRDSTOPTS": "int:35", + "IPV6_RTHDR_LOOSE": "int:0", + "IPV6_RTHDR_STRICT": "int:1", + "IPV6_RTHDR_TYPE_0": "int:0", + "IPV6_SOCKOPT_RESERVED1": "int:3", + "IPV6_TCLASS": "int:61", + "IPV6_UNICAST_HOPS": "int:4", + "IPV6_USE_MIN_MTU": "int:42", + "IPV6_V6ONLY": "int:27", + "IPV6_VERSION": "int:96", + "IPV6_VERSION_MASK": "int:240", + "IP_ADD_MEMBERSHIP": "int:12", + "IP_ADD_SOURCE_MEMBERSHIP": "int:70", + "IP_BINDANY": "int:24", + "IP_BLOCK_SOURCE": "int:72", + "IP_DEFAULT_MULTICAST_LOOP": "int:1", + "IP_DEFAULT_MULTICAST_TTL": "int:1", + "IP_DF": "int:16384", + "IP_DONTFRAG": "int:67", + "IP_DROP_MEMBERSHIP": "int:13", + "IP_DROP_SOURCE_MEMBERSHIP": "int:71", + "IP_DUMMYNET3": "int:49", + "IP_DUMMYNET_CONFIGURE": "int:60", + "IP_DUMMYNET_DEL": "int:61", + "IP_DUMMYNET_FLUSH": "int:62", + "IP_DUMMYNET_GET": "int:64", + "IP_FAITH": "int:22", + "IP_FW3": "int:48", + "IP_FW_ADD": "int:50", + "IP_FW_DEL": "int:51", + "IP_FW_FLUSH": "int:52", + "IP_FW_GET": "int:54", + "IP_FW_NAT_CFG": "int:56", + "IP_FW_NAT_DEL": "int:57", + "IP_FW_NAT_GET_CONFIG": "int:58", + "IP_FW_NAT_GET_LOG": "int:59", + "IP_FW_RESETLOG": "int:55", + "IP_FW_TABLE_ADD": "int:40", + "IP_FW_TABLE_DEL": "int:41", + "IP_FW_TABLE_FLUSH": "int:42", + "IP_FW_TABLE_GETSIZE": "int:43", + "IP_FW_TABLE_LIST": "int:44", + "IP_FW_ZERO": "int:53", + "IP_HDRINCL": "int:2", + "IP_IPSEC_POLICY": "int:21", + "IP_MAXPACKET": "int:65535", + "IP_MAX_GROUP_SRC_FILTER": "int:512", + "IP_MAX_MEMBERSHIPS": "int:4095", + "IP_MAX_SOCK_MUTE_FILTER": "int:128", + "IP_MAX_SOCK_SRC_FILTER": "int:128", + "IP_MAX_SOURCE_FILTER": "int:1024", + "IP_MF": "int:8192", + "IP_MINTTL": "int:66", + "IP_MIN_MEMBERSHIPS": "int:31", + "IP_MSFILTER": "int:74", + "IP_MSS": "int:576", + "IP_MULTICAST_IF": "int:9", + "IP_MULTICAST_LOOP": "int:11", + "IP_MULTICAST_TTL": "int:10", + "IP_MULTICAST_VIF": "int:14", + "IP_OFFMASK": "int:8191", + "IP_ONESBCAST": "int:23", + "IP_OPTIONS": "int:1", + "IP_PORTRANGE": "int:19", + "IP_PORTRANGE_DEFAULT": "int:0", + "IP_PORTRANGE_HIGH": "int:1", + "IP_PORTRANGE_LOW": "int:2", + "IP_RECVDSTADDR": "int:7", + "IP_RECVIF": "int:20", + "IP_RECVOPTS": "int:5", + "IP_RECVRETOPTS": "int:6", + "IP_RECVTOS": "int:68", + "IP_RECVTTL": "int:65", + "IP_RETOPTS": "int:8", + "IP_RF": "int:32768", + "IP_RSVP_OFF": "int:16", + "IP_RSVP_ON": "int:15", + "IP_RSVP_VIF_OFF": "int:18", + "IP_RSVP_VIF_ON": "int:17", + "IP_SENDSRCADDR": "int:7", + "IP_TOS": "int:3", + "IP_TTL": "int:4", + "IP_UNBLOCK_SOURCE": "int:73", + "ISIG": "int:128", + "ISTRIP": "int:32", + "IXANY": "int:2048", + "IXOFF": "int:1024", + "IXON": "int:512", + "ImplementsGetwd": "bool:false", + "LOCK_EX": "int:2", + "LOCK_NB": "int:4", + "LOCK_SH": "int:1", + "LOCK_UN": "int:8", + "MADV_AUTOSYNC": "int:7", + "MADV_CORE": "int:9", + "MADV_DONTNEED": "int:4", + "MADV_FREE": "int:5", + "MADV_NOCORE": "int:8", + "MADV_NORMAL": "int:0", + "MADV_NOSYNC": "int:6", + "MADV_PROTECT": "int:10", + "MADV_RANDOM": "int:1", + "MADV_SEQUENTIAL": "int:2", + "MADV_WILLNEED": "int:3", + "MAP_32BIT": "int:524288", + "MAP_ALIGNED_SUPER": "int:16777216", + "MAP_ALIGNMENT_MASK": "int:-16777216", + "MAP_ALIGNMENT_SHIFT": "int:24", + "MAP_ANON": "int:4096", + "MAP_ANONYMOUS": "int:4096", + "MAP_COPY": "int:2", + "MAP_FILE": "int:0", + "MAP_FIXED": "int:16", + "MAP_HASSEMAPHORE": "int:512", + "MAP_NOCORE": "int:131072", + "MAP_NORESERVE": "int:64", + "MAP_NOSYNC": "int:2048", + "MAP_PREFAULT_READ": "int:262144", + "MAP_PRIVATE": "int:2", + "MAP_RENAME": "int:32", + "MAP_RESERVED0080": "int:128", + "MAP_RESERVED0100": "int:256", + "MAP_SHARED": "int:1", + "MAP_STACK": "int:1024", + "MCL_CURRENT": "int:1", + "MCL_FUTURE": "int:2", + "MSG_CMSG_CLOEXEC": "int:262144", + "MSG_COMPAT": "int:32768", + "MSG_CTRUNC": "int:32", + "MSG_DONTROUTE": "int:4", + "MSG_DONTWAIT": "int:128", + "MSG_EOF": "int:256", + "MSG_EOR": "int:8", + "MSG_NBIO": "int:16384", + "MSG_NOSIGNAL": "int:131072", + "MSG_NOTIFICATION": "int:8192", + "MSG_OOB": "int:1", + "MSG_PEEK": "int:2", + "MSG_TRUNC": "int:16", + "MSG_WAITALL": "int:64", + "MS_ASYNC": "int:1", + "MS_INVALIDATE": "int:2", + "MS_SYNC": "int:0", + "NAME_MAX": "int:255", + "NET_RT_DUMP": "int:1", + "NET_RT_FLAGS": "int:2", + "NET_RT_IFLIST": "int:3", + "NET_RT_IFLISTL": "int:5", + "NET_RT_IFMALIST": "int:4", + "NET_RT_MAXID": "int:6", + "NOFLSH": "int:2147483648", + "NOTE_ATTRIB": "int:8", + "NOTE_CHILD": "int:4", + "NOTE_DELETE": "int:1", + "NOTE_EXEC": "int:536870912", + "NOTE_EXIT": "int:2147483648", + "NOTE_EXTEND": "int:4", + "NOTE_FFAND": "int:1073741824", + "NOTE_FFCOPY": "int:3221225472", + "NOTE_FFCTRLMASK": "int:3221225472", + "NOTE_FFLAGSMASK": "int:16777215", + "NOTE_FFNOP": "int:0", + "NOTE_FFOR": "int:2147483648", + "NOTE_FORK": "int:1073741824", + "NOTE_LINK": "int:16", + "NOTE_LOWAT": "int:1", + "NOTE_PCTRLMASK": "int:4026531840", + "NOTE_PDATAMASK": "int:1048575", + "NOTE_RENAME": "int:32", + "NOTE_REVOKE": "int:64", + "NOTE_TRACK": "int:1", + "NOTE_TRACKERR": "int:2", + "NOTE_TRIGGER": "int:16777216", + "NOTE_WRITE": "int:2", + "OCRNL": "int:16", + "ONLCR": "int:2", + "ONLRET": "int:64", + "ONOCR": "int:32", + "ONOEOT": "int:8", + "OPOST": "int:1", + "O_ACCMODE": "int:3", + "O_APPEND": "int:8", + "O_ASYNC": "int:64", + "O_CLOEXEC": "int:1048576", + "O_CREAT": "int:512", + "O_DIRECT": "int:65536", + "O_DIRECTORY": "int:131072", + "O_EXCL": "int:2048", + "O_EXEC": "int:262144", + "O_EXLOCK": "int:32", + "O_FSYNC": "int:128", + "O_NDELAY": "int:4", + "O_NOCTTY": "int:32768", + "O_NOFOLLOW": "int:256", + "O_NONBLOCK": "int:4", + "O_RDONLY": "int:0", + "O_RDWR": "int:2", + "O_SHLOCK": "int:16", + "O_SYNC": "int:128", + "O_TRUNC": "int:1024", + "O_TTY_INIT": "int:524288", + "O_WRONLY": "int:1", + "PARENB": "int:4096", + "PARMRK": "int:8", + "PARODD": "int:8192", + "PENDIN": "int:536870912", + "PRIO_PGRP": "int:1", + "PRIO_PROCESS": "int:0", + "PRIO_USER": "int:2", + "PROT_EXEC": "int:4", + "PROT_NONE": "int:0", + "PROT_READ": "int:1", + "PROT_WRITE": "int:2", + "PTRACE_CONT": "int:7", + "PTRACE_KILL": "int:8", + "PTRACE_TRACEME": "int:0", + "RLIMIT_AS": "int:10", + "RLIMIT_CORE": "int:4", + "RLIMIT_CPU": "int:0", + "RLIMIT_DATA": "int:2", + "RLIMIT_FSIZE": "int:1", + "RLIMIT_NOFILE": "int:8", + "RLIMIT_STACK": "int:3", + "RLIM_INFINITY": "int:9223372036854775807", + "RTAX_AUTHOR": "int:6", + "RTAX_BRD": "int:7", + "RTAX_DST": "int:0", + "RTAX_GATEWAY": "int:1", + "RTAX_GENMASK": "int:3", + "RTAX_IFA": "int:5", + "RTAX_IFP": "int:4", + "RTAX_MAX": "int:8", + "RTAX_NETMASK": "int:2", + "RTA_AUTHOR": "int:64", + "RTA_BRD": "int:128", + "RTA_DST": "int:1", + "RTA_GATEWAY": "int:2", + "RTA_GENMASK": "int:8", + "RTA_IFA": "int:32", + "RTA_IFP": "int:16", + "RTA_NETMASK": "int:4", + "RTF_BLACKHOLE": "int:4096", + "RTF_BROADCAST": "int:4194304", + "RTF_DONE": "int:64", + "RTF_DYNAMIC": "int:16", + "RTF_FMASK": "int:268752904", + "RTF_GATEWAY": "int:2", + "RTF_GWFLAG_COMPAT": "int:2147483648", + "RTF_HOST": "int:4", + "RTF_LLDATA": "int:1024", + "RTF_LLINFO": "int:1024", + "RTF_LOCAL": "int:2097152", + "RTF_MODIFIED": "int:32", + "RTF_MULTICAST": "int:8388608", + "RTF_PINNED": "int:1048576", + "RTF_PRCLONING": "int:65536", + "RTF_PROTO1": "int:32768", + "RTF_PROTO2": "int:16384", + "RTF_PROTO3": "int:262144", + "RTF_REJECT": "int:8", + "RTF_RNH_LOCKED": "int:1073741824", + "RTF_STATIC": "int:2048", + "RTF_STICKY": "int:268435456", + "RTF_UP": "int:1", + "RTF_XRESOLVE": "int:512", + "RTM_ADD": "int:1", + "RTM_CHANGE": "int:3", + "RTM_DELADDR": "int:13", + "RTM_DELETE": "int:2", + "RTM_DELMADDR": "int:16", + "RTM_GET": "int:4", + "RTM_IEEE80211": "int:18", + "RTM_IFANNOUNCE": "int:17", + "RTM_IFINFO": "int:14", + "RTM_LOCK": "int:8", + "RTM_LOSING": "int:5", + "RTM_MISS": "int:7", + "RTM_NEWADDR": "int:12", + "RTM_NEWMADDR": "int:15", + "RTM_OLDADD": "int:9", + "RTM_OLDDEL": "int:10", + "RTM_REDIRECT": "int:6", + "RTM_RESOLVE": "int:11", + "RTM_RTTUNIT": "int:1000000", + "RTM_VERSION": "int:5", + "RTV_EXPIRE": "int:4", + "RTV_HOPCOUNT": "int:2", + "RTV_MTU": "int:1", + "RTV_RPIPE": "int:8", + "RTV_RTT": "int:64", + "RTV_RTTVAR": "int:128", + "RTV_SPIPE": "int:16", + "RTV_SSTHRESH": "int:32", + "RTV_WEIGHT": "int:256", + "RT_CACHING_CONTEXT": "int:1", + "RT_DEFAULT_FIB": "int:0", + "RT_NORTREF": "int:2", + "RUSAGE_CHILDREN": "int:-1", + "RUSAGE_SELF": "int:0", + "RUSAGE_THREAD": "int:1", + "SCM_BINTIME": "int:4", + "SCM_CREDS": "int:3", + "SCM_RIGHTS": "int:1", + "SCM_TIMESTAMP": "int:2", + "SHUT_RD": "int:0", + "SHUT_RDWR": "int:2", + "SHUT_WR": "int:1", + "SIOCADDMULTI": "int:2149607729", + "SIOCADDRT": "int:2151707146", + "SIOCAIFADDR": "int:2151704858", + "SIOCAIFGROUP": "int:2150132103", + "SIOCALIFADDR": "int:2165860635", + "SIOCATMARK": "int:1074033415", + "SIOCDELMULTI": "int:2149607730", + "SIOCDELRT": "int:2151707147", + "SIOCDIFADDR": "int:2149607705", + "SIOCDIFGROUP": "int:2150132105", + "SIOCDIFPHYADDR": "int:2149607753", + "SIOCDLIFADDR": "int:2165860637", + "SIOCGDRVSPEC": "int:3223873915", + "SIOCGETSGCNT": "int:3223351824", + "SIOCGETVIFCNT": "int:3223876111", + "SIOCGHIWAT": "int:1074033409", + "SIOCGIFADDR": "int:3223349537", + "SIOCGIFBRDADDR": "int:3223349539", + "SIOCGIFCAP": "int:3223349535", + "SIOCGIFCONF": "int:3222300964", + "SIOCGIFDESCR": "int:3223349546", + "SIOCGIFDSTADDR": "int:3223349538", + "SIOCGIFFIB": "int:3223349596", + "SIOCGIFFLAGS": "int:3223349521", + "SIOCGIFGENERIC": "int:3223349562", + "SIOCGIFGMEMB": "int:3223873930", + "SIOCGIFGROUP": "int:3223873928", + "SIOCGIFINDEX": "int:3223349536", + "SIOCGIFMAC": "int:3223349542", + "SIOCGIFMEDIA": "int:3224398136", + "SIOCGIFMETRIC": "int:3223349527", + "SIOCGIFMTU": "int:3223349555", + "SIOCGIFNETMASK": "int:3223349541", + "SIOCGIFPDSTADDR": "int:3223349576", + "SIOCGIFPHYS": "int:3223349557", + "SIOCGIFPSRCADDR": "int:3223349575", + "SIOCGIFSTATUS": "int:3274795323", + "SIOCGLIFADDR": "int:3239602460", + "SIOCGLIFPHYADDR": "int:3239602507", + "SIOCGLOWAT": "int:1074033411", + "SIOCGPGRP": "int:1074033417", + "SIOCGPRIVATE_0": "int:3223349584", + "SIOCGPRIVATE_1": "int:3223349585", + "SIOCIFCREATE": "int:3223349626", + "SIOCIFCREATE2": "int:3223349628", + "SIOCIFDESTROY": "int:2149607801", + "SIOCIFGCLONERS": "int:3222301048", + "SIOCSDRVSPEC": "int:2150132091", + "SIOCSHIWAT": "int:2147775232", + "SIOCSIFADDR": "int:2149607692", + "SIOCSIFBRDADDR": "int:2149607699", + "SIOCSIFCAP": "int:2149607710", + "SIOCSIFDESCR": "int:2149607721", + "SIOCSIFDSTADDR": "int:2149607694", + "SIOCSIFFIB": "int:2149607773", + "SIOCSIFFLAGS": "int:2149607696", + "SIOCSIFGENERIC": "int:2149607737", + "SIOCSIFLLADDR": "int:2149607740", + "SIOCSIFMAC": "int:2149607719", + "SIOCSIFMEDIA": "int:3223349559", + "SIOCSIFMETRIC": "int:2149607704", + "SIOCSIFMTU": "int:2149607732", + "SIOCSIFNAME": "int:2149607720", + "SIOCSIFNETMASK": "int:2149607702", + "SIOCSIFPHYADDR": "int:2151704902", + "SIOCSIFPHYS": "int:2149607734", + "SIOCSIFRVNET": "int:3223349595", + "SIOCSIFVNET": "int:3223349594", + "SIOCSLIFPHYADDR": "int:2165860682", + "SIOCSLOWAT": "int:2147775234", + "SIOCSPGRP": "int:2147775240", + "SOCK_CLOEXEC": "int:268435456", + "SOCK_DGRAM": "int:2", + "SOCK_MAXADDRLEN": "int:255", + "SOCK_NONBLOCK": "int:536870912", + "SOCK_RAW": "int:3", + "SOCK_RDM": "int:4", + "SOCK_SEQPACKET": "int:5", + "SOCK_STREAM": "int:1", + "SOL_SOCKET": "int:65535", + "SOMAXCONN": "int:128", + "SO_ACCEPTCONN": "int:2", + "SO_ACCEPTFILTER": "int:4096", + "SO_BINTIME": "int:8192", + "SO_BROADCAST": "int:32", + "SO_DEBUG": "int:1", + "SO_DONTROUTE": "int:16", + "SO_ERROR": "int:4103", + "SO_KEEPALIVE": "int:8", + "SO_LABEL": "int:4105", + "SO_LINGER": "int:128", + "SO_LISTENINCQLEN": "int:4115", + "SO_LISTENQLEN": "int:4114", + "SO_LISTENQLIMIT": "int:4113", + "SO_NOSIGPIPE": "int:2048", + "SO_NO_DDP": "int:32768", + "SO_NO_OFFLOAD": "int:16384", + "SO_OOBINLINE": "int:256", + "SO_PEERLABEL": "int:4112", + "SO_PROTOCOL": "int:4118", + "SO_PROTOTYPE": "int:4118", + "SO_RCVBUF": "int:4098", + "SO_RCVLOWAT": "int:4100", + "SO_RCVTIMEO": "int:4102", + "SO_REUSEADDR": "int:4", + "SO_REUSEPORT": "int:512", + "SO_SETFIB": "int:4116", + "SO_SNDBUF": "int:4097", + "SO_SNDLOWAT": "int:4099", + "SO_SNDTIMEO": "int:4101", + "SO_TIMESTAMP": "int:1024", + "SO_TYPE": "int:4104", + "SO_USELOOPBACK": "int:64", + "SO_USER_COOKIE": "int:4117", + "SO_VENDOR": "int:2147483648", + "SYS_ABORT2": "int:463", + "SYS_ACCEPT": "int:30", + "SYS_ACCEPT4": "int:541", + "SYS_ACCESS": "int:33", + "SYS_ACCT": "int:51", + "SYS_ADJTIME": "int:140", + "SYS_AUDIT": "int:445", + "SYS_AUDITCTL": "int:453", + "SYS_AUDITON": "int:446", + "SYS_BIND": "int:104", + "SYS_BINDAT": "int:538", + "SYS_CAP_ENTER": "int:516", + "SYS_CAP_GETMODE": "int:517", + "SYS_CAP_GETRIGHTS": "int:515", + "SYS_CAP_NEW": "int:514", + "SYS_CHDIR": "int:12", + "SYS_CHFLAGS": "int:34", + "SYS_CHFLAGSAT": "int:540", + "SYS_CHMOD": "int:15", + "SYS_CHOWN": "int:16", + "SYS_CHROOT": "int:61", + "SYS_CLOCK_GETCPUCLOCKID2": "int:247", + "SYS_CLOCK_GETRES": "int:234", + "SYS_CLOCK_GETTIME": "int:232", + "SYS_CLOCK_SETTIME": "int:233", + "SYS_CLOSE": "int:6", + "SYS_CLOSEFROM": "int:509", + "SYS_CONNECT": "int:98", + "SYS_CONNECTAT": "int:539", + "SYS_CPUSET": "int:484", + "SYS_CPUSET_GETAFFINITY": "int:487", + "SYS_CPUSET_GETID": "int:486", + "SYS_CPUSET_SETAFFINITY": "int:488", + "SYS_CPUSET_SETID": "int:485", + "SYS_DUP": "int:41", + "SYS_DUP2": "int:90", + "SYS_EACCESS": "int:376", + "SYS_EXECVE": "int:59", + "SYS_EXIT": "int:1", + "SYS_EXTATTRCTL": "int:355", + "SYS_EXTATTR_DELETE_FD": "int:373", + "SYS_EXTATTR_DELETE_FILE": "int:358", + "SYS_EXTATTR_DELETE_LINK": "int:414", + "SYS_EXTATTR_GET_FD": "int:372", + "SYS_EXTATTR_GET_FILE": "int:357", + "SYS_EXTATTR_GET_LINK": "int:413", + "SYS_EXTATTR_LIST_FD": "int:437", + "SYS_EXTATTR_LIST_FILE": "int:438", + "SYS_EXTATTR_LIST_LINK": "int:439", + "SYS_EXTATTR_SET_FD": "int:371", + "SYS_EXTATTR_SET_FILE": "int:356", + "SYS_EXTATTR_SET_LINK": "int:412", + "SYS_FACCESSAT": "int:489", + "SYS_FCHDIR": "int:13", + "SYS_FCHFLAGS": "int:35", + "SYS_FCHMOD": "int:124", + "SYS_FCHMODAT": "int:490", + "SYS_FCHOWN": "int:123", + "SYS_FCHOWNAT": "int:491", + "SYS_FCNTL": "int:92", + "SYS_FEXECVE": "int:492", + "SYS_FFCLOCK_GETCOUNTER": "int:241", + "SYS_FFCLOCK_GETESTIMATE": "int:243", + "SYS_FFCLOCK_SETESTIMATE": "int:242", + "SYS_FHOPEN": "int:298", + "SYS_FHSTAT": "int:299", + "SYS_FHSTATFS": "int:398", + "SYS_FLOCK": "int:131", + "SYS_FORK": "int:2", + "SYS_FPATHCONF": "int:192", + "SYS_FREEBSD6_FTRUNCATE": "int:201", + "SYS_FREEBSD6_LSEEK": "int:199", + "SYS_FREEBSD6_MMAP": "int:197", + "SYS_FREEBSD6_PREAD": "int:173", + "SYS_FREEBSD6_PWRITE": "int:174", + "SYS_FREEBSD6_TRUNCATE": "int:200", + "SYS_FSTAT": "int:189", + "SYS_FSTATAT": "int:493", + "SYS_FSTATFS": "int:397", + "SYS_FSYNC": "int:95", + "SYS_FTRUNCATE": "int:480", + "SYS_FUTIMES": "int:206", + "SYS_FUTIMESAT": "int:494", + "SYS_GETAUDIT": "int:449", + "SYS_GETAUDIT_ADDR": "int:451", + "SYS_GETAUID": "int:447", + "SYS_GETCONTEXT": "int:421", + "SYS_GETDENTS": "int:272", + "SYS_GETDIRENTRIES": "int:196", + "SYS_GETDTABLESIZE": "int:89", + "SYS_GETEGID": "int:43", + "SYS_GETEUID": "int:25", + "SYS_GETFH": "int:161", + "SYS_GETFSSTAT": "int:395", + "SYS_GETGID": "int:47", + "SYS_GETGROUPS": "int:79", + "SYS_GETITIMER": "int:86", + "SYS_GETLOGIN": "int:49", + "SYS_GETLOGINCLASS": "int:523", + "SYS_GETPEERNAME": "int:31", + "SYS_GETPGID": "int:207", + "SYS_GETPGRP": "int:81", + "SYS_GETPID": "int:20", + "SYS_GETPPID": "int:39", + "SYS_GETPRIORITY": "int:100", + "SYS_GETRESGID": "int:361", + "SYS_GETRESUID": "int:360", + "SYS_GETRLIMIT": "int:194", + "SYS_GETRUSAGE": "int:117", + "SYS_GETSID": "int:310", + "SYS_GETSOCKNAME": "int:32", + "SYS_GETSOCKOPT": "int:118", + "SYS_GETTIMEOFDAY": "int:116", + "SYS_GETUID": "int:24", + "SYS_IOCTL": "int:54", + "SYS_ISSETUGID": "int:253", + "SYS_JAIL": "int:338", + "SYS_JAIL_ATTACH": "int:436", + "SYS_JAIL_GET": "int:506", + "SYS_JAIL_REMOVE": "int:508", + "SYS_JAIL_SET": "int:507", + "SYS_KENV": "int:390", + "SYS_KEVENT": "int:363", + "SYS_KILL": "int:37", + "SYS_KLDFIND": "int:306", + "SYS_KLDFIRSTMOD": "int:309", + "SYS_KLDLOAD": "int:304", + "SYS_KLDNEXT": "int:307", + "SYS_KLDSTAT": "int:308", + "SYS_KLDSYM": "int:337", + "SYS_KLDUNLOAD": "int:305", + "SYS_KLDUNLOADF": "int:444", + "SYS_KQUEUE": "int:362", + "SYS_KTIMER_CREATE": "int:235", + "SYS_KTIMER_DELETE": "int:236", + "SYS_KTIMER_GETOVERRUN": "int:239", + "SYS_KTIMER_GETTIME": "int:238", + "SYS_KTIMER_SETTIME": "int:237", + "SYS_KTRACE": "int:45", + "SYS_LCHFLAGS": "int:391", + "SYS_LCHMOD": "int:274", + "SYS_LCHOWN": "int:254", + "SYS_LGETFH": "int:160", + "SYS_LINK": "int:9", + "SYS_LINKAT": "int:495", + "SYS_LISTEN": "int:106", + "SYS_LPATHCONF": "int:513", + "SYS_LSEEK": "int:478", + "SYS_LSTAT": "int:190", + "SYS_LUTIMES": "int:276", + "SYS_MAC_SYSCALL": "int:394", + "SYS_MADVISE": "int:75", + "SYS_MINCORE": "int:78", + "SYS_MINHERIT": "int:250", + "SYS_MKDIR": "int:136", + "SYS_MKDIRAT": "int:496", + "SYS_MKFIFO": "int:132", + "SYS_MKFIFOAT": "int:497", + "SYS_MKNOD": "int:14", + "SYS_MKNODAT": "int:498", + "SYS_MLOCK": "int:203", + "SYS_MLOCKALL": "int:324", + "SYS_MMAP": "int:477", + "SYS_MODFIND": "int:303", + "SYS_MODFNEXT": "int:302", + "SYS_MODNEXT": "int:300", + "SYS_MODSTAT": "int:301", + "SYS_MOUNT": "int:21", + "SYS_MPROTECT": "int:74", + "SYS_MSYNC": "int:65", + "SYS_MUNLOCK": "int:204", + "SYS_MUNLOCKALL": "int:325", + "SYS_MUNMAP": "int:73", + "SYS_NANOSLEEP": "int:240", + "SYS_NFSTAT": "int:279", + "SYS_NLSTAT": "int:280", + "SYS_NMOUNT": "int:378", + "SYS_NSTAT": "int:278", + "SYS_NTP_ADJTIME": "int:176", + "SYS_NTP_GETTIME": "int:248", + "SYS_OBREAK": "int:17", + "SYS_OPEN": "int:5", + "SYS_OPENAT": "int:499", + "SYS_OPENBSD_POLL": "int:252", + "SYS_OVADVISE": "int:72", + "SYS_PATHCONF": "int:191", + "SYS_PDFORK": "int:518", + "SYS_PDGETPID": "int:520", + "SYS_PDKILL": "int:519", + "SYS_PIPE": "int:42", + "SYS_PIPE2": "int:542", + "SYS_POLL": "int:209", + "SYS_POSIX_FADVISE": "int:531", + "SYS_POSIX_FALLOCATE": "int:530", + "SYS_POSIX_OPENPT": "int:504", + "SYS_PREAD": "int:475", + "SYS_PREADV": "int:289", + "SYS_PROCCTL": "int:544", + "SYS_PROFIL": "int:44", + "SYS_PSELECT": "int:522", + "SYS_PTRACE": "int:26", + "SYS_PWRITE": "int:476", + "SYS_PWRITEV": "int:290", + "SYS_QUOTACTL": "int:148", + "SYS_RCTL_ADD_RULE": "int:528", + "SYS_RCTL_GET_LIMITS": "int:527", + "SYS_RCTL_GET_RACCT": "int:525", + "SYS_RCTL_GET_RULES": "int:526", + "SYS_RCTL_REMOVE_RULE": "int:529", + "SYS_READ": "int:3", + "SYS_READLINK": "int:58", + "SYS_READLINKAT": "int:500", + "SYS_READV": "int:120", + "SYS_REBOOT": "int:55", + "SYS_RECVFROM": "int:29", + "SYS_RECVMSG": "int:27", + "SYS_RENAME": "int:128", + "SYS_RENAMEAT": "int:501", + "SYS_REVOKE": "int:56", + "SYS_RFORK": "int:251", + "SYS_RMDIR": "int:137", + "SYS_RTPRIO": "int:166", + "SYS_RTPRIO_THREAD": "int:466", + "SYS_SBRK": "int:69", + "SYS_SCHED_GETPARAM": "int:328", + "SYS_SCHED_GETSCHEDULER": "int:330", + "SYS_SCHED_GET_PRIORITY_MAX": "int:332", + "SYS_SCHED_GET_PRIORITY_MIN": "int:333", + "SYS_SCHED_RR_GET_INTERVAL": "int:334", + "SYS_SCHED_SETPARAM": "int:327", + "SYS_SCHED_SETSCHEDULER": "int:329", + "SYS_SCHED_YIELD": "int:331", + "SYS_SCTP_GENERIC_RECVMSG": "int:474", + "SYS_SCTP_GENERIC_SENDMSG": "int:472", + "SYS_SCTP_GENERIC_SENDMSG_IOV": "int:473", + "SYS_SCTP_PEELOFF": "int:471", + "SYS_SELECT": "int:93", + "SYS_SENDFILE": "int:393", + "SYS_SENDMSG": "int:28", + "SYS_SENDTO": "int:133", + "SYS_SETAUDIT": "int:450", + "SYS_SETAUDIT_ADDR": "int:452", + "SYS_SETAUID": "int:448", + "SYS_SETCONTEXT": "int:422", + "SYS_SETEGID": "int:182", + "SYS_SETEUID": "int:183", + "SYS_SETFIB": "int:175", + "SYS_SETGID": "int:181", + "SYS_SETGROUPS": "int:80", + "SYS_SETITIMER": "int:83", + "SYS_SETLOGIN": "int:50", + "SYS_SETLOGINCLASS": "int:524", + "SYS_SETPGID": "int:82", + "SYS_SETPRIORITY": "int:96", + "SYS_SETREGID": "int:127", + "SYS_SETRESGID": "int:312", + "SYS_SETRESUID": "int:311", + "SYS_SETREUID": "int:126", + "SYS_SETRLIMIT": "int:195", + "SYS_SETSID": "int:147", + "SYS_SETSOCKOPT": "int:105", + "SYS_SETTIMEOFDAY": "int:122", + "SYS_SETUID": "int:23", + "SYS_SHM_OPEN": "int:482", + "SYS_SHM_UNLINK": "int:483", + "SYS_SHUTDOWN": "int:134", + "SYS_SIGACTION": "int:416", + "SYS_SIGALTSTACK": "int:53", + "SYS_SIGPENDING": "int:343", + "SYS_SIGPROCMASK": "int:340", + "SYS_SIGQUEUE": "int:456", + "SYS_SIGRETURN": "int:417", + "SYS_SIGSUSPEND": "int:341", + "SYS_SIGTIMEDWAIT": "int:345", + "SYS_SIGWAIT": "int:429", + "SYS_SIGWAITINFO": "int:346", + "SYS_SOCKET": "int:97", + "SYS_SOCKETPAIR": "int:135", + "SYS_SSTK": "int:70", + "SYS_STAT": "int:188", + "SYS_STATFS": "int:396", + "SYS_SWAPCONTEXT": "int:423", + "SYS_SWAPOFF": "int:424", + "SYS_SWAPON": "int:85", + "SYS_SYMLINK": "int:57", + "SYS_SYMLINKAT": "int:502", + "SYS_SYNC": "int:36", + "SYS_SYSARCH": "int:165", + "SYS_THR_CREATE": "int:430", + "SYS_THR_EXIT": "int:431", + "SYS_THR_KILL": "int:433", + "SYS_THR_KILL2": "int:481", + "SYS_THR_NEW": "int:455", + "SYS_THR_SELF": "int:432", + "SYS_THR_SET_NAME": "int:464", + "SYS_THR_SUSPEND": "int:442", + "SYS_THR_WAKE": "int:443", + "SYS_TRUNCATE": "int:479", + "SYS_UMASK": "int:60", + "SYS_UNDELETE": "int:205", + "SYS_UNLINK": "int:10", + "SYS_UNLINKAT": "int:503", + "SYS_UNMOUNT": "int:22", + "SYS_UTIMES": "int:138", + "SYS_UTRACE": "int:335", + "SYS_UUIDGEN": "int:392", + "SYS_VFORK": "int:66", + "SYS_WAIT4": "int:7", + "SYS_WAIT6": "int:532", + "SYS_WRITE": "int:4", + "SYS_WRITEV": "int:121", + "SYS_YIELD": "int:321", + "SYS__UMTX_LOCK": "int:434", + "SYS__UMTX_OP": "int:454", + "SYS__UMTX_UNLOCK": "int:435", + "SYS___ACL_ACLCHECK_FD": "int:354", + "SYS___ACL_ACLCHECK_FILE": "int:353", + "SYS___ACL_ACLCHECK_LINK": "int:428", + "SYS___ACL_DELETE_FD": "int:352", + "SYS___ACL_DELETE_FILE": "int:351", + "SYS___ACL_DELETE_LINK": "int:427", + "SYS___ACL_GET_FD": "int:349", + "SYS___ACL_GET_FILE": "int:347", + "SYS___ACL_GET_LINK": "int:425", + "SYS___ACL_SET_FD": "int:350", + "SYS___ACL_SET_FILE": "int:348", + "SYS___ACL_SET_LINK": "int:426", + "SYS___GETCWD": "int:326", + "SYS___MAC_EXECVE": "int:415", + "SYS___MAC_GET_FD": "int:386", + "SYS___MAC_GET_FILE": "int:387", + "SYS___MAC_GET_LINK": "int:410", + "SYS___MAC_GET_PID": "int:409", + "SYS___MAC_GET_PROC": "int:384", + "SYS___MAC_SET_FD": "int:388", + "SYS___MAC_SET_FILE": "int:389", + "SYS___MAC_SET_LINK": "int:411", + "SYS___MAC_SET_PROC": "int:385", + "SYS___SETUGID": "int:374", + "SYS___SYSCTL": "int:202", + "S_IFBLK": "int:24576", + "S_IFCHR": "int:8192", + "S_IFDIR": "int:16384", + "S_IFIFO": "int:4096", + "S_IFLNK": "int:40960", + "S_IFMT": "int:61440", + "S_IFREG": "int:32768", + "S_IFSOCK": "int:49152", + "S_IRUSR": "int:256", + "S_ISGID": "int:1024", + "S_ISUID": "int:2048", + "S_ISVTX": "int:512", + "S_IWUSR": "int:128", + "S_IXUSR": "int:64", + "SizeofBpfHdr": "int:32", + "SizeofBpfInsn": "int:8", + "SizeofBpfProgram": "int:16", + "SizeofBpfStat": "int:8", + "SizeofBpfVersion": "int:4", + "SizeofBpfZbuf": "int:24", + "SizeofBpfZbufHeader": "int:32", + "SizeofCmsghdr": "int:12", + "SizeofICMPv6Filter": "int:32", + "SizeofIPMreq": "int:8", + "SizeofIPMreqn": "int:12", + "SizeofIPv6MTUInfo": "int:32", + "SizeofIPv6Mreq": "int:20", + "SizeofIfAnnounceMsghdr": "int:24", + "SizeofIfData": "int:152", + "SizeofIfMsghdr": "int:168", + "SizeofIfaMsghdr": "int:20", + "SizeofIfmaMsghdr": "int:16", + "SizeofInet6Pktinfo": "int:20", + "SizeofLinger": "int:8", + "SizeofMsghdr": "int:48", + "SizeofRtMetrics": "int:112", + "SizeofRtMsghdr": "int:152", + "SizeofSockaddrAny": "int:108", + "SizeofSockaddrDatalink": "int:54", + "SizeofSockaddrInet4": "int:16", + "SizeofSockaddrInet6": "int:28", + "SizeofSockaddrUnix": "int:106", + "TCIFLUSH": "int:1", + "TCIOFLUSH": "int:3", + "TCOFLUSH": "int:2", + "TCP_CA_NAME_MAX": "int:16", + "TCP_CONGESTION": "int:64", + "TCP_INFO": "int:32", + "TCP_KEEPCNT": "int:1024", + "TCP_KEEPIDLE": "int:256", + "TCP_KEEPINIT": "int:128", + "TCP_KEEPINTVL": "int:512", + "TCP_MAXBURST": "int:4", + "TCP_MAXHLEN": "int:60", + "TCP_MAXOLEN": "int:40", + "TCP_MAXSEG": "int:2", + "TCP_MAXWIN": "int:65535", + "TCP_MAX_SACK": "int:4", + "TCP_MAX_WINSHIFT": "int:14", + "TCP_MD5SIG": "int:16", + "TCP_MINMSS": "int:216", + "TCP_MSS": "int:536", + "TCP_NODELAY": "int:1", + "TCP_NOOPT": "int:8", + "TCP_NOPUSH": "int:4", + "TCP_VENDOR": "int:2147483648", + "TCSAFLUSH": "int:2", + "TIOCCBRK": "int:536900730", + "TIOCCDTR": "int:536900728", + "TIOCCONS": "int:2147775586", + "TIOCDRAIN": "int:536900702", + "TIOCEXCL": "int:536900621", + "TIOCEXT": "int:2147775584", + "TIOCFLUSH": "int:2147775504", + "TIOCGDRAINWAIT": "int:1074033750", + "TIOCGETA": "int:1076655123", + "TIOCGETD": "int:1074033690", + "TIOCGPGRP": "int:1074033783", + "TIOCGPTN": "int:1074033679", + "TIOCGSID": "int:1074033763", + "TIOCGWINSZ": "int:1074295912", + "TIOCMBIC": "int:2147775595", + "TIOCMBIS": "int:2147775596", + "TIOCMGDTRWAIT": "int:1074033754", + "TIOCMGET": "int:1074033770", + "TIOCMSDTRWAIT": "int:2147775579", + "TIOCMSET": "int:2147775597", + "TIOCM_CAR": "int:64", + "TIOCM_CD": "int:64", + "TIOCM_CTS": "int:32", + "TIOCM_DCD": "int:64", + "TIOCM_DSR": "int:256", + "TIOCM_DTR": "int:2", + "TIOCM_LE": "int:1", + "TIOCM_RI": "int:128", + "TIOCM_RNG": "int:128", + "TIOCM_RTS": "int:4", + "TIOCM_SR": "int:16", + "TIOCM_ST": "int:8", + "TIOCNOTTY": "int:536900721", + "TIOCNXCL": "int:536900622", + "TIOCOUTQ": "int:1074033779", + "TIOCPKT": "int:2147775600", + "TIOCPKT_DATA": "int:0", + "TIOCPKT_DOSTOP": "int:32", + "TIOCPKT_FLUSHREAD": "int:1", + "TIOCPKT_FLUSHWRITE": "int:2", + "TIOCPKT_IOCTL": "int:64", + "TIOCPKT_NOSTOP": "int:16", + "TIOCPKT_START": "int:8", + "TIOCPKT_STOP": "int:4", + "TIOCPTMASTER": "int:536900636", + "TIOCSBRK": "int:536900731", + "TIOCSCTTY": "int:536900705", + "TIOCSDRAINWAIT": "int:2147775575", + "TIOCSDTR": "int:536900729", + "TIOCSETA": "int:2150396948", + "TIOCSETAF": "int:2150396950", + "TIOCSETAW": "int:2150396949", + "TIOCSETD": "int:2147775515", + "TIOCSIG": "int:537162847", + "TIOCSPGRP": "int:2147775606", + "TIOCSTART": "int:536900718", + "TIOCSTAT": "int:536900709", + "TIOCSTI": "int:2147578994", + "TIOCSTOP": "int:536900719", + "TIOCSWINSZ": "int:2148037735", + "TIOCTIMESTAMP": "int:1074820185", + "TIOCUCNTL": "int:2147775590", + "TOSTOP": "int:4194304", + "VDISCARD": "int:15", + "VDSUSP": "int:11", + "VEOF": "int:0", + "VEOL": "int:1", + "VEOL2": "int:2", + "VERASE": "int:3", + "VERASE2": "int:7", + "VINTR": "int:8", + "VKILL": "int:5", + "VLNEXT": "int:14", + "VMIN": "int:16", + "VQUIT": "int:9", + "VREPRINT": "int:6", + "VSTART": "int:12", + "VSTATUS": "int:18", + "VSTOP": "int:13", + "VSUSP": "int:10", + "VTIME": "int:17", + "VWERASE": "int:4", + "WCONTINUED": "int:4", + "WCOREFLAG": "int:128", + "WEXITED": "int:16", + "WLINUXCLONE": "int:2147483648", + "WNOHANG": "int:1", + "WNOWAIT": "int:8", + "WSTOPPED": "int:2", + "WTRAPPED": "int:32", + "WUNTRACED": "int:2", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_386.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_386.go new file mode 100644 index 0000000..4fd6da8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_386.go @@ -0,0 +1,3970 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +// reflection: allow interpreted code to import "syscall" +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_ALG": ValueOf(syscall.AF_ALG), + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ASH": ValueOf(syscall.AF_ASH), + "AF_ATMPVC": ValueOf(syscall.AF_ATMPVC), + "AF_ATMSVC": ValueOf(syscall.AF_ATMSVC), + "AF_AX25": ValueOf(syscall.AF_AX25), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_BRIDGE": ValueOf(syscall.AF_BRIDGE), + "AF_CAIF": ValueOf(syscall.AF_CAIF), + "AF_CAN": ValueOf(syscall.AF_CAN), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_ECONET": ValueOf(syscall.AF_ECONET), + "AF_FILE": ValueOf(syscall.AF_FILE), + "AF_IEEE802154": ValueOf(syscall.AF_IEEE802154), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_IRDA": ValueOf(syscall.AF_IRDA), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_IUCV": ValueOf(syscall.AF_IUCV), + "AF_KEY": ValueOf(syscall.AF_KEY), + "AF_LLC": ValueOf(syscall.AF_LLC), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NETBEUI": ValueOf(syscall.AF_NETBEUI), + "AF_NETLINK": ValueOf(syscall.AF_NETLINK), + "AF_NETROM": ValueOf(syscall.AF_NETROM), + "AF_PACKET": ValueOf(syscall.AF_PACKET), + "AF_PHONET": ValueOf(syscall.AF_PHONET), + "AF_PPPOX": ValueOf(syscall.AF_PPPOX), + "AF_RDS": ValueOf(syscall.AF_RDS), + "AF_ROSE": ValueOf(syscall.AF_ROSE), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_RXRPC": ValueOf(syscall.AF_RXRPC), + "AF_SECURITY": ValueOf(syscall.AF_SECURITY), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_TIPC": ValueOf(syscall.AF_TIPC), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_WANPIPE": ValueOf(syscall.AF_WANPIPE), + "AF_X25": ValueOf(syscall.AF_X25), + "ARPHRD_ADAPT": ValueOf(syscall.ARPHRD_ADAPT), + "ARPHRD_APPLETLK": ValueOf(syscall.ARPHRD_APPLETLK), + "ARPHRD_ARCNET": ValueOf(syscall.ARPHRD_ARCNET), + "ARPHRD_ASH": ValueOf(syscall.ARPHRD_ASH), + "ARPHRD_ATM": ValueOf(syscall.ARPHRD_ATM), + "ARPHRD_AX25": ValueOf(syscall.ARPHRD_AX25), + "ARPHRD_BIF": ValueOf(syscall.ARPHRD_BIF), + "ARPHRD_CHAOS": ValueOf(syscall.ARPHRD_CHAOS), + "ARPHRD_CISCO": ValueOf(syscall.ARPHRD_CISCO), + "ARPHRD_CSLIP": ValueOf(syscall.ARPHRD_CSLIP), + "ARPHRD_CSLIP6": ValueOf(syscall.ARPHRD_CSLIP6), + "ARPHRD_DDCMP": ValueOf(syscall.ARPHRD_DDCMP), + "ARPHRD_DLCI": ValueOf(syscall.ARPHRD_DLCI), + "ARPHRD_ECONET": ValueOf(syscall.ARPHRD_ECONET), + "ARPHRD_EETHER": ValueOf(syscall.ARPHRD_EETHER), + "ARPHRD_ETHER": ValueOf(syscall.ARPHRD_ETHER), + "ARPHRD_EUI64": ValueOf(syscall.ARPHRD_EUI64), + "ARPHRD_FCAL": ValueOf(syscall.ARPHRD_FCAL), + "ARPHRD_FCFABRIC": ValueOf(syscall.ARPHRD_FCFABRIC), + "ARPHRD_FCPL": ValueOf(syscall.ARPHRD_FCPL), + "ARPHRD_FCPP": ValueOf(syscall.ARPHRD_FCPP), + "ARPHRD_FDDI": ValueOf(syscall.ARPHRD_FDDI), + "ARPHRD_FRAD": ValueOf(syscall.ARPHRD_FRAD), + "ARPHRD_HDLC": ValueOf(syscall.ARPHRD_HDLC), + "ARPHRD_HIPPI": ValueOf(syscall.ARPHRD_HIPPI), + "ARPHRD_HWX25": ValueOf(syscall.ARPHRD_HWX25), + "ARPHRD_IEEE1394": ValueOf(syscall.ARPHRD_IEEE1394), + "ARPHRD_IEEE802": ValueOf(syscall.ARPHRD_IEEE802), + "ARPHRD_IEEE80211": ValueOf(syscall.ARPHRD_IEEE80211), + "ARPHRD_IEEE80211_PRISM": ValueOf(syscall.ARPHRD_IEEE80211_PRISM), + "ARPHRD_IEEE80211_RADIOTAP": ValueOf(syscall.ARPHRD_IEEE80211_RADIOTAP), + "ARPHRD_IEEE802154": ValueOf(syscall.ARPHRD_IEEE802154), + "ARPHRD_IEEE802154_PHY": ValueOf(syscall.ARPHRD_IEEE802154_PHY), + "ARPHRD_IEEE802_TR": ValueOf(syscall.ARPHRD_IEEE802_TR), + "ARPHRD_INFINIBAND": ValueOf(syscall.ARPHRD_INFINIBAND), + "ARPHRD_IPDDP": ValueOf(syscall.ARPHRD_IPDDP), + "ARPHRD_IPGRE": ValueOf(syscall.ARPHRD_IPGRE), + "ARPHRD_IRDA": ValueOf(syscall.ARPHRD_IRDA), + "ARPHRD_LAPB": ValueOf(syscall.ARPHRD_LAPB), + "ARPHRD_LOCALTLK": ValueOf(syscall.ARPHRD_LOCALTLK), + "ARPHRD_LOOPBACK": ValueOf(syscall.ARPHRD_LOOPBACK), + "ARPHRD_METRICOM": ValueOf(syscall.ARPHRD_METRICOM), + "ARPHRD_NETROM": ValueOf(syscall.ARPHRD_NETROM), + "ARPHRD_NONE": ValueOf(syscall.ARPHRD_NONE), + "ARPHRD_PIMREG": ValueOf(syscall.ARPHRD_PIMREG), + "ARPHRD_PPP": ValueOf(syscall.ARPHRD_PPP), + "ARPHRD_PRONET": ValueOf(syscall.ARPHRD_PRONET), + "ARPHRD_RAWHDLC": ValueOf(syscall.ARPHRD_RAWHDLC), + "ARPHRD_ROSE": ValueOf(syscall.ARPHRD_ROSE), + "ARPHRD_RSRVD": ValueOf(syscall.ARPHRD_RSRVD), + "ARPHRD_SIT": ValueOf(syscall.ARPHRD_SIT), + "ARPHRD_SKIP": ValueOf(syscall.ARPHRD_SKIP), + "ARPHRD_SLIP": ValueOf(syscall.ARPHRD_SLIP), + "ARPHRD_SLIP6": ValueOf(syscall.ARPHRD_SLIP6), + "ARPHRD_TUNNEL": ValueOf(syscall.ARPHRD_TUNNEL), + "ARPHRD_TUNNEL6": ValueOf(syscall.ARPHRD_TUNNEL6), + "ARPHRD_VOID": ValueOf(syscall.ARPHRD_VOID), + "ARPHRD_X25": ValueOf(syscall.ARPHRD_X25), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Acct": ValueOf(syscall.Acct), + "Adjtimex": ValueOf(syscall.Adjtimex), + "AttachLsf": ValueOf(syscall.AttachLsf), + "B0": ValueOf(syscall.B0), + "B1000000": ValueOf(syscall.B1000000), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1152000": ValueOf(syscall.B1152000), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B150": ValueOf(syscall.B150), + "B1500000": ValueOf(syscall.B1500000), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B2000000": ValueOf(syscall.B2000000), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B2500000": ValueOf(syscall.B2500000), + "B300": ValueOf(syscall.B300), + "B3000000": ValueOf(syscall.B3000000), + "B3500000": ValueOf(syscall.B3500000), + "B38400": ValueOf(syscall.B38400), + "B4000000": ValueOf(syscall.B4000000), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B500000": ValueOf(syscall.B500000), + "B57600": ValueOf(syscall.B57600), + "B576000": ValueOf(syscall.B576000), + "B600": ValueOf(syscall.B600), + "B75": ValueOf(syscall.B75), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BindToDevice": ValueOf(syscall.BindToDevice), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CLONE_CHILD_CLEARTID": ValueOf(syscall.CLONE_CHILD_CLEARTID), + "CLONE_CHILD_SETTID": ValueOf(syscall.CLONE_CHILD_SETTID), + "CLONE_DETACHED": ValueOf(syscall.CLONE_DETACHED), + "CLONE_FILES": ValueOf(syscall.CLONE_FILES), + "CLONE_FS": ValueOf(syscall.CLONE_FS), + "CLONE_IO": ValueOf(uint32(syscall.CLONE_IO)), + "CLONE_NEWIPC": ValueOf(syscall.CLONE_NEWIPC), + "CLONE_NEWNET": ValueOf(syscall.CLONE_NEWNET), + "CLONE_NEWNS": ValueOf(syscall.CLONE_NEWNS), + "CLONE_NEWPID": ValueOf(syscall.CLONE_NEWPID), + "CLONE_NEWUSER": ValueOf(syscall.CLONE_NEWUSER), + "CLONE_NEWUTS": ValueOf(syscall.CLONE_NEWUTS), + "CLONE_PARENT": ValueOf(syscall.CLONE_PARENT), + "CLONE_PARENT_SETTID": ValueOf(syscall.CLONE_PARENT_SETTID), + "CLONE_PTRACE": ValueOf(syscall.CLONE_PTRACE), + "CLONE_SETTLS": ValueOf(syscall.CLONE_SETTLS), + "CLONE_SIGHAND": ValueOf(syscall.CLONE_SIGHAND), + "CLONE_SYSVSEM": ValueOf(syscall.CLONE_SYSVSEM), + "CLONE_THREAD": ValueOf(syscall.CLONE_THREAD), + "CLONE_UNTRACED": ValueOf(syscall.CLONE_UNTRACED), + "CLONE_VFORK": ValueOf(syscall.CLONE_VFORK), + "CLONE_VM": ValueOf(syscall.CLONE_VM), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTOPB": ValueOf(syscall.CSTOPB), + "Chdir": ValueOf(syscall.Chdir), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "Creat": ValueOf(syscall.Creat), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "DetachLsf": ValueOf(syscall.DetachLsf), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "Dup3": ValueOf(syscall.Dup3), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EADV": ValueOf(syscall.EADV), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EBADE": ValueOf(syscall.EBADE), + "EBADF": ValueOf(syscall.EBADF), + "EBADFD": ValueOf(syscall.EBADFD), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADR": ValueOf(syscall.EBADR), + "EBADRQC": ValueOf(syscall.EBADRQC), + "EBADSLT": ValueOf(syscall.EBADSLT), + "EBFONT": ValueOf(syscall.EBFONT), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECHRNG": ValueOf(syscall.ECHRNG), + "ECOMM": ValueOf(syscall.ECOMM), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDEADLOCK": ValueOf(syscall.EDEADLOCK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOTDOT": ValueOf(syscall.EDOTDOT), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "EISNAM": ValueOf(syscall.EISNAM), + "EKEYEXPIRED": ValueOf(syscall.EKEYEXPIRED), + "EKEYREJECTED": ValueOf(syscall.EKEYREJECTED), + "EKEYREVOKED": ValueOf(syscall.EKEYREVOKED), + "EL2HLT": ValueOf(syscall.EL2HLT), + "EL2NSYNC": ValueOf(syscall.EL2NSYNC), + "EL3HLT": ValueOf(syscall.EL3HLT), + "EL3RST": ValueOf(syscall.EL3RST), + "ELIBACC": ValueOf(syscall.ELIBACC), + "ELIBBAD": ValueOf(syscall.ELIBBAD), + "ELIBEXEC": ValueOf(syscall.ELIBEXEC), + "ELIBMAX": ValueOf(syscall.ELIBMAX), + "ELIBSCN": ValueOf(syscall.ELIBSCN), + "ELNRNG": ValueOf(syscall.ELNRNG), + "ELOOP": ValueOf(syscall.ELOOP), + "EMEDIUMTYPE": ValueOf(syscall.EMEDIUMTYPE), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENAVAIL": ValueOf(syscall.ENAVAIL), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOANO": ValueOf(syscall.ENOANO), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENOCSI": ValueOf(syscall.ENOCSI), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOKEY": ValueOf(syscall.ENOKEY), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEDIUM": ValueOf(syscall.ENOMEDIUM), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENONET": ValueOf(syscall.ENONET), + "ENOPKG": ValueOf(syscall.ENOPKG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTNAM": ValueOf(syscall.ENOTNAM), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENOTUNIQ": ValueOf(syscall.ENOTUNIQ), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPOLLERR": ValueOf(syscall.EPOLLERR), + "EPOLLET": ValueOf(syscall.EPOLLET), + "EPOLLHUP": ValueOf(syscall.EPOLLHUP), + "EPOLLIN": ValueOf(syscall.EPOLLIN), + "EPOLLMSG": ValueOf(syscall.EPOLLMSG), + "EPOLLONESHOT": ValueOf(syscall.EPOLLONESHOT), + "EPOLLOUT": ValueOf(syscall.EPOLLOUT), + "EPOLLPRI": ValueOf(syscall.EPOLLPRI), + "EPOLLRDBAND": ValueOf(syscall.EPOLLRDBAND), + "EPOLLRDHUP": ValueOf(syscall.EPOLLRDHUP), + "EPOLLRDNORM": ValueOf(syscall.EPOLLRDNORM), + "EPOLLWRBAND": ValueOf(syscall.EPOLLWRBAND), + "EPOLLWRNORM": ValueOf(syscall.EPOLLWRNORM), + "EPOLL_CLOEXEC": ValueOf(syscall.EPOLL_CLOEXEC), + "EPOLL_CTL_ADD": ValueOf(syscall.EPOLL_CTL_ADD), + "EPOLL_CTL_DEL": ValueOf(syscall.EPOLL_CTL_DEL), + "EPOLL_CTL_MOD": ValueOf(syscall.EPOLL_CTL_MOD), + "EPOLL_NONBLOCK": ValueOf(syscall.EPOLL_NONBLOCK), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMCHG": ValueOf(syscall.EREMCHG), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EREMOTEIO": ValueOf(syscall.EREMOTEIO), + "ERESTART": ValueOf(syscall.ERESTART), + "ERFKILL": ValueOf(syscall.ERFKILL), + "EROFS": ValueOf(syscall.EROFS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESRMNT": ValueOf(syscall.ESRMNT), + "ESTALE": ValueOf(syscall.ESTALE), + "ESTRPIPE": ValueOf(syscall.ESTRPIPE), + "ETH_P_1588": ValueOf(syscall.ETH_P_1588), + "ETH_P_8021Q": ValueOf(syscall.ETH_P_8021Q), + "ETH_P_802_2": ValueOf(syscall.ETH_P_802_2), + "ETH_P_802_3": ValueOf(syscall.ETH_P_802_3), + "ETH_P_AARP": ValueOf(syscall.ETH_P_AARP), + "ETH_P_ALL": ValueOf(syscall.ETH_P_ALL), + "ETH_P_AOE": ValueOf(syscall.ETH_P_AOE), + "ETH_P_ARCNET": ValueOf(syscall.ETH_P_ARCNET), + "ETH_P_ARP": ValueOf(syscall.ETH_P_ARP), + "ETH_P_ATALK": ValueOf(syscall.ETH_P_ATALK), + "ETH_P_ATMFATE": ValueOf(syscall.ETH_P_ATMFATE), + "ETH_P_ATMMPOA": ValueOf(syscall.ETH_P_ATMMPOA), + "ETH_P_AX25": ValueOf(syscall.ETH_P_AX25), + "ETH_P_BPQ": ValueOf(syscall.ETH_P_BPQ), + "ETH_P_CAIF": ValueOf(syscall.ETH_P_CAIF), + "ETH_P_CAN": ValueOf(syscall.ETH_P_CAN), + "ETH_P_CONTROL": ValueOf(syscall.ETH_P_CONTROL), + "ETH_P_CUST": ValueOf(syscall.ETH_P_CUST), + "ETH_P_DDCMP": ValueOf(syscall.ETH_P_DDCMP), + "ETH_P_DEC": ValueOf(syscall.ETH_P_DEC), + "ETH_P_DIAG": ValueOf(syscall.ETH_P_DIAG), + "ETH_P_DNA_DL": ValueOf(syscall.ETH_P_DNA_DL), + "ETH_P_DNA_RC": ValueOf(syscall.ETH_P_DNA_RC), + "ETH_P_DNA_RT": ValueOf(syscall.ETH_P_DNA_RT), + "ETH_P_DSA": ValueOf(syscall.ETH_P_DSA), + "ETH_P_ECONET": ValueOf(syscall.ETH_P_ECONET), + "ETH_P_EDSA": ValueOf(syscall.ETH_P_EDSA), + "ETH_P_FCOE": ValueOf(syscall.ETH_P_FCOE), + "ETH_P_FIP": ValueOf(syscall.ETH_P_FIP), + "ETH_P_HDLC": ValueOf(syscall.ETH_P_HDLC), + "ETH_P_IEEE802154": ValueOf(syscall.ETH_P_IEEE802154), + "ETH_P_IEEEPUP": ValueOf(syscall.ETH_P_IEEEPUP), + "ETH_P_IEEEPUPAT": ValueOf(syscall.ETH_P_IEEEPUPAT), + "ETH_P_IP": ValueOf(syscall.ETH_P_IP), + "ETH_P_IPV6": ValueOf(syscall.ETH_P_IPV6), + "ETH_P_IPX": ValueOf(syscall.ETH_P_IPX), + "ETH_P_IRDA": ValueOf(syscall.ETH_P_IRDA), + "ETH_P_LAT": ValueOf(syscall.ETH_P_LAT), + "ETH_P_LINK_CTL": ValueOf(syscall.ETH_P_LINK_CTL), + "ETH_P_LOCALTALK": ValueOf(syscall.ETH_P_LOCALTALK), + "ETH_P_LOOP": ValueOf(syscall.ETH_P_LOOP), + "ETH_P_MOBITEX": ValueOf(syscall.ETH_P_MOBITEX), + "ETH_P_MPLS_MC": ValueOf(syscall.ETH_P_MPLS_MC), + "ETH_P_MPLS_UC": ValueOf(syscall.ETH_P_MPLS_UC), + "ETH_P_PAE": ValueOf(syscall.ETH_P_PAE), + "ETH_P_PAUSE": ValueOf(syscall.ETH_P_PAUSE), + "ETH_P_PHONET": ValueOf(syscall.ETH_P_PHONET), + "ETH_P_PPPTALK": ValueOf(syscall.ETH_P_PPPTALK), + "ETH_P_PPP_DISC": ValueOf(syscall.ETH_P_PPP_DISC), + "ETH_P_PPP_MP": ValueOf(syscall.ETH_P_PPP_MP), + "ETH_P_PPP_SES": ValueOf(syscall.ETH_P_PPP_SES), + "ETH_P_PUP": ValueOf(syscall.ETH_P_PUP), + "ETH_P_PUPAT": ValueOf(syscall.ETH_P_PUPAT), + "ETH_P_RARP": ValueOf(syscall.ETH_P_RARP), + "ETH_P_SCA": ValueOf(syscall.ETH_P_SCA), + "ETH_P_SLOW": ValueOf(syscall.ETH_P_SLOW), + "ETH_P_SNAP": ValueOf(syscall.ETH_P_SNAP), + "ETH_P_TEB": ValueOf(syscall.ETH_P_TEB), + "ETH_P_TIPC": ValueOf(syscall.ETH_P_TIPC), + "ETH_P_TRAILER": ValueOf(syscall.ETH_P_TRAILER), + "ETH_P_TR_802_2": ValueOf(syscall.ETH_P_TR_802_2), + "ETH_P_WAN_PPP": ValueOf(syscall.ETH_P_WAN_PPP), + "ETH_P_WCCP": ValueOf(syscall.ETH_P_WCCP), + "ETH_P_X25": ValueOf(syscall.ETH_P_X25), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUCLEAN": ValueOf(syscall.EUCLEAN), + "EUNATCH": ValueOf(syscall.EUNATCH), + "EUSERS": ValueOf(syscall.EUSERS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXFULL": ValueOf(syscall.EXFULL), + "Environ": ValueOf(syscall.Environ), + "EpollCreate": ValueOf(syscall.EpollCreate), + "EpollCreate1": ValueOf(syscall.EpollCreate1), + "EpollCtl": ValueOf(syscall.EpollCtl), + "EpollWait": ValueOf(syscall.EpollWait), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_EXLCK": ValueOf(syscall.F_EXLCK), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLEASE": ValueOf(syscall.F_GETLEASE), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLK64": ValueOf(syscall.F_GETLK64), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETOWN_EX": ValueOf(syscall.F_GETOWN_EX), + "F_GETPIPE_SZ": ValueOf(syscall.F_GETPIPE_SZ), + "F_GETSIG": ValueOf(syscall.F_GETSIG), + "F_LOCK": ValueOf(syscall.F_LOCK), + "F_NOTIFY": ValueOf(syscall.F_NOTIFY), + "F_OK": ValueOf(syscall.F_OK), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLEASE": ValueOf(syscall.F_SETLEASE), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLK64": ValueOf(syscall.F_SETLK64), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLKW64": ValueOf(syscall.F_SETLKW64), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETOWN_EX": ValueOf(syscall.F_SETOWN_EX), + "F_SETPIPE_SZ": ValueOf(syscall.F_SETPIPE_SZ), + "F_SETSIG": ValueOf(syscall.F_SETSIG), + "F_SHLCK": ValueOf(syscall.F_SHLCK), + "F_TEST": ValueOf(syscall.F_TEST), + "F_TLOCK": ValueOf(syscall.F_TLOCK), + "F_ULOCK": ValueOf(syscall.F_ULOCK), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Faccessat": ValueOf(syscall.Faccessat), + "Fallocate": ValueOf(syscall.Fallocate), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchmodat": ValueOf(syscall.Fchmodat), + "Fchown": ValueOf(syscall.Fchown), + "Fchownat": ValueOf(syscall.Fchownat), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Fdatasync": ValueOf(syscall.Fdatasync), + "Flock": ValueOf(syscall.Flock), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Futimesat": ValueOf(syscall.Futimesat), + "Getcwd": ValueOf(syscall.Getcwd), + "Getdents": ValueOf(syscall.Getdents), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "GetsockoptUcred": ValueOf(syscall.GetsockoptUcred), + "Gettid": ValueOf(syscall.Gettid), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "Getxattr": ValueOf(syscall.Getxattr), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMPV6_FILTER": ValueOf(syscall.ICMPV6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFA_ADDRESS": ValueOf(syscall.IFA_ADDRESS), + "IFA_ANYCAST": ValueOf(syscall.IFA_ANYCAST), + "IFA_BROADCAST": ValueOf(syscall.IFA_BROADCAST), + "IFA_CACHEINFO": ValueOf(syscall.IFA_CACHEINFO), + "IFA_F_DADFAILED": ValueOf(syscall.IFA_F_DADFAILED), + "IFA_F_DEPRECATED": ValueOf(syscall.IFA_F_DEPRECATED), + "IFA_F_HOMEADDRESS": ValueOf(syscall.IFA_F_HOMEADDRESS), + "IFA_F_NODAD": ValueOf(syscall.IFA_F_NODAD), + "IFA_F_OPTIMISTIC": ValueOf(syscall.IFA_F_OPTIMISTIC), + "IFA_F_PERMANENT": ValueOf(syscall.IFA_F_PERMANENT), + "IFA_F_SECONDARY": ValueOf(syscall.IFA_F_SECONDARY), + "IFA_F_TEMPORARY": ValueOf(syscall.IFA_F_TEMPORARY), + "IFA_F_TENTATIVE": ValueOf(syscall.IFA_F_TENTATIVE), + "IFA_LABEL": ValueOf(syscall.IFA_LABEL), + "IFA_LOCAL": ValueOf(syscall.IFA_LOCAL), + "IFA_MAX": ValueOf(syscall.IFA_MAX), + "IFA_MULTICAST": ValueOf(syscall.IFA_MULTICAST), + "IFA_UNSPEC": ValueOf(syscall.IFA_UNSPEC), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_AUTOMEDIA": ValueOf(syscall.IFF_AUTOMEDIA), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DYNAMIC": ValueOf(syscall.IFF_DYNAMIC), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MASTER": ValueOf(syscall.IFF_MASTER), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_NO_PI": ValueOf(syscall.IFF_NO_PI), + "IFF_ONE_QUEUE": ValueOf(syscall.IFF_ONE_QUEUE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PORTSEL": ValueOf(syscall.IFF_PORTSEL), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SLAVE": ValueOf(syscall.IFF_SLAVE), + "IFF_TAP": ValueOf(syscall.IFF_TAP), + "IFF_TUN": ValueOf(syscall.IFF_TUN), + "IFF_TUN_EXCL": ValueOf(syscall.IFF_TUN_EXCL), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFF_VNET_HDR": ValueOf(syscall.IFF_VNET_HDR), + "IFLA_ADDRESS": ValueOf(syscall.IFLA_ADDRESS), + "IFLA_BROADCAST": ValueOf(syscall.IFLA_BROADCAST), + "IFLA_COST": ValueOf(syscall.IFLA_COST), + "IFLA_IFALIAS": ValueOf(syscall.IFLA_IFALIAS), + "IFLA_IFNAME": ValueOf(syscall.IFLA_IFNAME), + "IFLA_LINK": ValueOf(syscall.IFLA_LINK), + "IFLA_LINKINFO": ValueOf(syscall.IFLA_LINKINFO), + "IFLA_LINKMODE": ValueOf(syscall.IFLA_LINKMODE), + "IFLA_MAP": ValueOf(syscall.IFLA_MAP), + "IFLA_MASTER": ValueOf(syscall.IFLA_MASTER), + "IFLA_MAX": ValueOf(syscall.IFLA_MAX), + "IFLA_MTU": ValueOf(syscall.IFLA_MTU), + "IFLA_NET_NS_PID": ValueOf(syscall.IFLA_NET_NS_PID), + "IFLA_OPERSTATE": ValueOf(syscall.IFLA_OPERSTATE), + "IFLA_PRIORITY": ValueOf(syscall.IFLA_PRIORITY), + "IFLA_PROTINFO": ValueOf(syscall.IFLA_PROTINFO), + "IFLA_QDISC": ValueOf(syscall.IFLA_QDISC), + "IFLA_STATS": ValueOf(syscall.IFLA_STATS), + "IFLA_TXQLEN": ValueOf(syscall.IFLA_TXQLEN), + "IFLA_UNSPEC": ValueOf(syscall.IFLA_UNSPEC), + "IFLA_WEIGHT": ValueOf(syscall.IFLA_WEIGHT), + "IFLA_WIRELESS": ValueOf(syscall.IFLA_WIRELESS), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_ACCESS": ValueOf(syscall.IN_ACCESS), + "IN_ALL_EVENTS": ValueOf(syscall.IN_ALL_EVENTS), + "IN_ATTRIB": ValueOf(syscall.IN_ATTRIB), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLOEXEC": ValueOf(syscall.IN_CLOEXEC), + "IN_CLOSE": ValueOf(syscall.IN_CLOSE), + "IN_CLOSE_NOWRITE": ValueOf(syscall.IN_CLOSE_NOWRITE), + "IN_CLOSE_WRITE": ValueOf(syscall.IN_CLOSE_WRITE), + "IN_CREATE": ValueOf(syscall.IN_CREATE), + "IN_DELETE": ValueOf(syscall.IN_DELETE), + "IN_DELETE_SELF": ValueOf(syscall.IN_DELETE_SELF), + "IN_DONT_FOLLOW": ValueOf(syscall.IN_DONT_FOLLOW), + "IN_EXCL_UNLINK": ValueOf(syscall.IN_EXCL_UNLINK), + "IN_IGNORED": ValueOf(syscall.IN_IGNORED), + "IN_ISDIR": ValueOf(syscall.IN_ISDIR), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_MASK_ADD": ValueOf(syscall.IN_MASK_ADD), + "IN_MODIFY": ValueOf(syscall.IN_MODIFY), + "IN_MOVE": ValueOf(syscall.IN_MOVE), + "IN_MOVED_FROM": ValueOf(syscall.IN_MOVED_FROM), + "IN_MOVED_TO": ValueOf(syscall.IN_MOVED_TO), + "IN_MOVE_SELF": ValueOf(syscall.IN_MOVE_SELF), + "IN_NONBLOCK": ValueOf(syscall.IN_NONBLOCK), + "IN_ONESHOT": ValueOf(uint32(syscall.IN_ONESHOT)), + "IN_ONLYDIR": ValueOf(syscall.IN_ONLYDIR), + "IN_OPEN": ValueOf(syscall.IN_OPEN), + "IN_Q_OVERFLOW": ValueOf(syscall.IN_Q_OVERFLOW), + "IN_UNMOUNT": ValueOf(syscall.IN_UNMOUNT), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_COMP": ValueOf(syscall.IPPROTO_COMP), + "IPPROTO_DCCP": ValueOf(syscall.IPPROTO_DCCP), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_UDPLITE": ValueOf(syscall.IPPROTO_UDPLITE), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_ADDRFORM": ValueOf(syscall.IPV6_ADDRFORM), + "IPV6_ADD_MEMBERSHIP": ValueOf(syscall.IPV6_ADD_MEMBERSHIP), + "IPV6_AUTHHDR": ValueOf(syscall.IPV6_AUTHHDR), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DROP_MEMBERSHIP": ValueOf(syscall.IPV6_DROP_MEMBERSHIP), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_ANYCAST": ValueOf(syscall.IPV6_JOIN_ANYCAST), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_ANYCAST": ValueOf(syscall.IPV6_LEAVE_ANYCAST), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MTU": ValueOf(syscall.IPV6_MTU), + "IPV6_MTU_DISCOVER": ValueOf(syscall.IPV6_MTU_DISCOVER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PMTUDISC_DO": ValueOf(syscall.IPV6_PMTUDISC_DO), + "IPV6_PMTUDISC_DONT": ValueOf(syscall.IPV6_PMTUDISC_DONT), + "IPV6_PMTUDISC_PROBE": ValueOf(syscall.IPV6_PMTUDISC_PROBE), + "IPV6_PMTUDISC_WANT": ValueOf(syscall.IPV6_PMTUDISC_WANT), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVERR": ValueOf(syscall.IPV6_RECVERR), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_ROUTER_ALERT": ValueOf(syscall.IPV6_ROUTER_ALERT), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_RXDSTOPTS": ValueOf(syscall.IPV6_RXDSTOPTS), + "IPV6_RXHOPOPTS": ValueOf(syscall.IPV6_RXHOPOPTS), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_XFRM_POLICY": ValueOf(syscall.IPV6_XFRM_POLICY), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_FREEBIND": ValueOf(syscall.IP_FREEBIND), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MTU": ValueOf(syscall.IP_MTU), + "IP_MTU_DISCOVER": ValueOf(syscall.IP_MTU_DISCOVER), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_ORIGDSTADDR": ValueOf(syscall.IP_ORIGDSTADDR), + "IP_PASSSEC": ValueOf(syscall.IP_PASSSEC), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PKTOPTIONS": ValueOf(syscall.IP_PKTOPTIONS), + "IP_PMTUDISC": ValueOf(syscall.IP_PMTUDISC), + "IP_PMTUDISC_DO": ValueOf(syscall.IP_PMTUDISC_DO), + "IP_PMTUDISC_DONT": ValueOf(syscall.IP_PMTUDISC_DONT), + "IP_PMTUDISC_PROBE": ValueOf(syscall.IP_PMTUDISC_PROBE), + "IP_PMTUDISC_WANT": ValueOf(syscall.IP_PMTUDISC_WANT), + "IP_RECVERR": ValueOf(syscall.IP_RECVERR), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVORIGDSTADDR": ValueOf(syscall.IP_RECVORIGDSTADDR), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_ROUTER_ALERT": ValueOf(syscall.IP_ROUTER_ALERT), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRANSPARENT": ValueOf(syscall.IP_TRANSPARENT), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "IP_XFRM_POLICY": ValueOf(syscall.IP_XFRM_POLICY), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUCLC": ValueOf(syscall.IUCLC), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "InotifyAddWatch": ValueOf(syscall.InotifyAddWatch), + "InotifyInit": ValueOf(syscall.InotifyInit), + "InotifyInit1": ValueOf(syscall.InotifyInit1), + "InotifyRmWatch": ValueOf(syscall.InotifyRmWatch), + "Ioperm": ValueOf(syscall.Ioperm), + "Iopl": ValueOf(syscall.Iopl), + "Kill": ValueOf(syscall.Kill), + "Klogctl": ValueOf(syscall.Klogctl), + "LINUX_REBOOT_CMD_CAD_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_CAD_OFF), + "LINUX_REBOOT_CMD_CAD_ON": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_CAD_ON)), + "LINUX_REBOOT_CMD_HALT": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_HALT)), + "LINUX_REBOOT_CMD_KEXEC": ValueOf(syscall.LINUX_REBOOT_CMD_KEXEC), + "LINUX_REBOOT_CMD_POWER_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_POWER_OFF), + "LINUX_REBOOT_CMD_RESTART": ValueOf(syscall.LINUX_REBOOT_CMD_RESTART), + "LINUX_REBOOT_CMD_RESTART2": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_RESTART2)), + "LINUX_REBOOT_CMD_SW_SUSPEND": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_SW_SUSPEND)), + "LINUX_REBOOT_MAGIC1": ValueOf(uint32(syscall.LINUX_REBOOT_MAGIC1)), + "LINUX_REBOOT_MAGIC2": ValueOf(syscall.LINUX_REBOOT_MAGIC2), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Listxattr": ValueOf(syscall.Listxattr), + "LsfJump": ValueOf(syscall.LsfJump), + "LsfSocket": ValueOf(syscall.LsfSocket), + "LsfStmt": ValueOf(syscall.LsfStmt), + "Lstat": ValueOf(syscall.Lstat), + "MADV_DOFORK": ValueOf(syscall.MADV_DOFORK), + "MADV_DONTFORK": ValueOf(syscall.MADV_DONTFORK), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_HUGEPAGE": ValueOf(syscall.MADV_HUGEPAGE), + "MADV_HWPOISON": ValueOf(syscall.MADV_HWPOISON), + "MADV_MERGEABLE": ValueOf(syscall.MADV_MERGEABLE), + "MADV_NOHUGEPAGE": ValueOf(syscall.MADV_NOHUGEPAGE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_REMOVE": ValueOf(syscall.MADV_REMOVE), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_UNMERGEABLE": ValueOf(syscall.MADV_UNMERGEABLE), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_32BIT": ValueOf(syscall.MAP_32BIT), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_DENYWRITE": ValueOf(syscall.MAP_DENYWRITE), + "MAP_EXECUTABLE": ValueOf(syscall.MAP_EXECUTABLE), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_GROWSDOWN": ValueOf(syscall.MAP_GROWSDOWN), + "MAP_HUGETLB": ValueOf(syscall.MAP_HUGETLB), + "MAP_LOCKED": ValueOf(syscall.MAP_LOCKED), + "MAP_NONBLOCK": ValueOf(syscall.MAP_NONBLOCK), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_POPULATE": ValueOf(syscall.MAP_POPULATE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_STACK": ValueOf(syscall.MAP_STACK), + "MAP_TYPE": ValueOf(syscall.MAP_TYPE), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MNT_DETACH": ValueOf(syscall.MNT_DETACH), + "MNT_EXPIRE": ValueOf(syscall.MNT_EXPIRE), + "MNT_FORCE": ValueOf(syscall.MNT_FORCE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_CONFIRM": ValueOf(syscall.MSG_CONFIRM), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_ERRQUEUE": ValueOf(syscall.MSG_ERRQUEUE), + "MSG_FASTOPEN": ValueOf(syscall.MSG_FASTOPEN), + "MSG_FIN": ValueOf(syscall.MSG_FIN), + "MSG_MORE": ValueOf(syscall.MSG_MORE), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_PROXY": ValueOf(syscall.MSG_PROXY), + "MSG_RST": ValueOf(syscall.MSG_RST), + "MSG_SYN": ValueOf(syscall.MSG_SYN), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_TRYHARD": ValueOf(syscall.MSG_TRYHARD), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITFORONE": ValueOf(syscall.MSG_WAITFORONE), + "MS_ACTIVE": ValueOf(syscall.MS_ACTIVE), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_BIND": ValueOf(syscall.MS_BIND), + "MS_DIRSYNC": ValueOf(syscall.MS_DIRSYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_I_VERSION": ValueOf(syscall.MS_I_VERSION), + "MS_KERNMOUNT": ValueOf(syscall.MS_KERNMOUNT), + "MS_MANDLOCK": ValueOf(syscall.MS_MANDLOCK), + "MS_MGC_MSK": ValueOf(uint32(syscall.MS_MGC_MSK)), + "MS_MGC_VAL": ValueOf(uint32(syscall.MS_MGC_VAL)), + "MS_MOVE": ValueOf(syscall.MS_MOVE), + "MS_NOATIME": ValueOf(syscall.MS_NOATIME), + "MS_NODEV": ValueOf(syscall.MS_NODEV), + "MS_NODIRATIME": ValueOf(syscall.MS_NODIRATIME), + "MS_NOEXEC": ValueOf(syscall.MS_NOEXEC), + "MS_NOSUID": ValueOf(syscall.MS_NOSUID), + "MS_NOUSER": ValueOf(syscall.MS_NOUSER), + "MS_POSIXACL": ValueOf(syscall.MS_POSIXACL), + "MS_PRIVATE": ValueOf(syscall.MS_PRIVATE), + "MS_RDONLY": ValueOf(syscall.MS_RDONLY), + "MS_REC": ValueOf(syscall.MS_REC), + "MS_RELATIME": ValueOf(syscall.MS_RELATIME), + "MS_REMOUNT": ValueOf(syscall.MS_REMOUNT), + "MS_RMT_MASK": ValueOf(syscall.MS_RMT_MASK), + "MS_SHARED": ValueOf(syscall.MS_SHARED), + "MS_SILENT": ValueOf(syscall.MS_SILENT), + "MS_SLAVE": ValueOf(syscall.MS_SLAVE), + "MS_STRICTATIME": ValueOf(syscall.MS_STRICTATIME), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "MS_SYNCHRONOUS": ValueOf(syscall.MS_SYNCHRONOUS), + "MS_UNBINDABLE": ValueOf(syscall.MS_UNBINDABLE), + "Madvise": ValueOf(syscall.Madvise), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkdirat": ValueOf(syscall.Mkdirat), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mknodat": ValueOf(syscall.Mknodat), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mount": ValueOf(syscall.Mount), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NETLINK_ADD_MEMBERSHIP": ValueOf(syscall.NETLINK_ADD_MEMBERSHIP), + "NETLINK_AUDIT": ValueOf(syscall.NETLINK_AUDIT), + "NETLINK_BROADCAST_ERROR": ValueOf(syscall.NETLINK_BROADCAST_ERROR), + "NETLINK_CONNECTOR": ValueOf(syscall.NETLINK_CONNECTOR), + "NETLINK_DNRTMSG": ValueOf(syscall.NETLINK_DNRTMSG), + "NETLINK_DROP_MEMBERSHIP": ValueOf(syscall.NETLINK_DROP_MEMBERSHIP), + "NETLINK_ECRYPTFS": ValueOf(syscall.NETLINK_ECRYPTFS), + "NETLINK_FIB_LOOKUP": ValueOf(syscall.NETLINK_FIB_LOOKUP), + "NETLINK_FIREWALL": ValueOf(syscall.NETLINK_FIREWALL), + "NETLINK_GENERIC": ValueOf(syscall.NETLINK_GENERIC), + "NETLINK_INET_DIAG": ValueOf(syscall.NETLINK_INET_DIAG), + "NETLINK_IP6_FW": ValueOf(syscall.NETLINK_IP6_FW), + "NETLINK_ISCSI": ValueOf(syscall.NETLINK_ISCSI), + "NETLINK_KOBJECT_UEVENT": ValueOf(syscall.NETLINK_KOBJECT_UEVENT), + "NETLINK_NETFILTER": ValueOf(syscall.NETLINK_NETFILTER), + "NETLINK_NFLOG": ValueOf(syscall.NETLINK_NFLOG), + "NETLINK_NO_ENOBUFS": ValueOf(syscall.NETLINK_NO_ENOBUFS), + "NETLINK_PKTINFO": ValueOf(syscall.NETLINK_PKTINFO), + "NETLINK_ROUTE": ValueOf(syscall.NETLINK_ROUTE), + "NETLINK_SCSITRANSPORT": ValueOf(syscall.NETLINK_SCSITRANSPORT), + "NETLINK_SELINUX": ValueOf(syscall.NETLINK_SELINUX), + "NETLINK_UNUSED": ValueOf(syscall.NETLINK_UNUSED), + "NETLINK_USERSOCK": ValueOf(syscall.NETLINK_USERSOCK), + "NETLINK_XFRM": ValueOf(syscall.NETLINK_XFRM), + "NLA_ALIGNTO": ValueOf(syscall.NLA_ALIGNTO), + "NLA_F_NESTED": ValueOf(syscall.NLA_F_NESTED), + "NLA_F_NET_BYTEORDER": ValueOf(syscall.NLA_F_NET_BYTEORDER), + "NLA_HDRLEN": ValueOf(syscall.NLA_HDRLEN), + "NLMSG_ALIGNTO": ValueOf(syscall.NLMSG_ALIGNTO), + "NLMSG_DONE": ValueOf(syscall.NLMSG_DONE), + "NLMSG_ERROR": ValueOf(syscall.NLMSG_ERROR), + "NLMSG_HDRLEN": ValueOf(syscall.NLMSG_HDRLEN), + "NLMSG_MIN_TYPE": ValueOf(syscall.NLMSG_MIN_TYPE), + "NLMSG_NOOP": ValueOf(syscall.NLMSG_NOOP), + "NLMSG_OVERRUN": ValueOf(syscall.NLMSG_OVERRUN), + "NLM_F_ACK": ValueOf(syscall.NLM_F_ACK), + "NLM_F_APPEND": ValueOf(syscall.NLM_F_APPEND), + "NLM_F_ATOMIC": ValueOf(syscall.NLM_F_ATOMIC), + "NLM_F_CREATE": ValueOf(syscall.NLM_F_CREATE), + "NLM_F_DUMP": ValueOf(syscall.NLM_F_DUMP), + "NLM_F_ECHO": ValueOf(syscall.NLM_F_ECHO), + "NLM_F_EXCL": ValueOf(syscall.NLM_F_EXCL), + "NLM_F_MATCH": ValueOf(syscall.NLM_F_MATCH), + "NLM_F_MULTI": ValueOf(syscall.NLM_F_MULTI), + "NLM_F_REPLACE": ValueOf(syscall.NLM_F_REPLACE), + "NLM_F_REQUEST": ValueOf(syscall.NLM_F_REQUEST), + "NLM_F_ROOT": ValueOf(syscall.NLM_F_ROOT), + "NOFLSH": ValueOf(syscall.NOFLSH), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NetlinkRIB": ValueOf(syscall.NetlinkRIB), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "OLCUC": ValueOf(syscall.OLCUC), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_LARGEFILE": ValueOf(syscall.O_LARGEFILE), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOATIME": ValueOf(syscall.O_NOATIME), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_RSYNC": ValueOf(syscall.O_RSYNC), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "Openat": ValueOf(syscall.Openat), + "PACKET_ADD_MEMBERSHIP": ValueOf(syscall.PACKET_ADD_MEMBERSHIP), + "PACKET_BROADCAST": ValueOf(syscall.PACKET_BROADCAST), + "PACKET_DROP_MEMBERSHIP": ValueOf(syscall.PACKET_DROP_MEMBERSHIP), + "PACKET_FASTROUTE": ValueOf(syscall.PACKET_FASTROUTE), + "PACKET_HOST": ValueOf(syscall.PACKET_HOST), + "PACKET_LOOPBACK": ValueOf(syscall.PACKET_LOOPBACK), + "PACKET_MR_ALLMULTI": ValueOf(syscall.PACKET_MR_ALLMULTI), + "PACKET_MR_MULTICAST": ValueOf(syscall.PACKET_MR_MULTICAST), + "PACKET_MR_PROMISC": ValueOf(syscall.PACKET_MR_PROMISC), + "PACKET_MULTICAST": ValueOf(syscall.PACKET_MULTICAST), + "PACKET_OTHERHOST": ValueOf(syscall.PACKET_OTHERHOST), + "PACKET_OUTGOING": ValueOf(syscall.PACKET_OUTGOING), + "PACKET_RECV_OUTPUT": ValueOf(syscall.PACKET_RECV_OUTPUT), + "PACKET_RX_RING": ValueOf(syscall.PACKET_RX_RING), + "PACKET_STATISTICS": ValueOf(syscall.PACKET_STATISTICS), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_GROWSDOWN": ValueOf(syscall.PROT_GROWSDOWN), + "PROT_GROWSUP": ValueOf(syscall.PROT_GROWSUP), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PR_CAPBSET_DROP": ValueOf(syscall.PR_CAPBSET_DROP), + "PR_CAPBSET_READ": ValueOf(syscall.PR_CAPBSET_READ), + "PR_ENDIAN_BIG": ValueOf(syscall.PR_ENDIAN_BIG), + "PR_ENDIAN_LITTLE": ValueOf(syscall.PR_ENDIAN_LITTLE), + "PR_ENDIAN_PPC_LITTLE": ValueOf(syscall.PR_ENDIAN_PPC_LITTLE), + "PR_FPEMU_NOPRINT": ValueOf(syscall.PR_FPEMU_NOPRINT), + "PR_FPEMU_SIGFPE": ValueOf(syscall.PR_FPEMU_SIGFPE), + "PR_FP_EXC_ASYNC": ValueOf(syscall.PR_FP_EXC_ASYNC), + "PR_FP_EXC_DISABLED": ValueOf(syscall.PR_FP_EXC_DISABLED), + "PR_FP_EXC_DIV": ValueOf(syscall.PR_FP_EXC_DIV), + "PR_FP_EXC_INV": ValueOf(syscall.PR_FP_EXC_INV), + "PR_FP_EXC_NONRECOV": ValueOf(syscall.PR_FP_EXC_NONRECOV), + "PR_FP_EXC_OVF": ValueOf(syscall.PR_FP_EXC_OVF), + "PR_FP_EXC_PRECISE": ValueOf(syscall.PR_FP_EXC_PRECISE), + "PR_FP_EXC_RES": ValueOf(syscall.PR_FP_EXC_RES), + "PR_FP_EXC_SW_ENABLE": ValueOf(syscall.PR_FP_EXC_SW_ENABLE), + "PR_FP_EXC_UND": ValueOf(syscall.PR_FP_EXC_UND), + "PR_GET_DUMPABLE": ValueOf(syscall.PR_GET_DUMPABLE), + "PR_GET_ENDIAN": ValueOf(syscall.PR_GET_ENDIAN), + "PR_GET_FPEMU": ValueOf(syscall.PR_GET_FPEMU), + "PR_GET_FPEXC": ValueOf(syscall.PR_GET_FPEXC), + "PR_GET_KEEPCAPS": ValueOf(syscall.PR_GET_KEEPCAPS), + "PR_GET_NAME": ValueOf(syscall.PR_GET_NAME), + "PR_GET_PDEATHSIG": ValueOf(syscall.PR_GET_PDEATHSIG), + "PR_GET_SECCOMP": ValueOf(syscall.PR_GET_SECCOMP), + "PR_GET_SECUREBITS": ValueOf(syscall.PR_GET_SECUREBITS), + "PR_GET_TIMERSLACK": ValueOf(syscall.PR_GET_TIMERSLACK), + "PR_GET_TIMING": ValueOf(syscall.PR_GET_TIMING), + "PR_GET_TSC": ValueOf(syscall.PR_GET_TSC), + "PR_GET_UNALIGN": ValueOf(syscall.PR_GET_UNALIGN), + "PR_MCE_KILL": ValueOf(syscall.PR_MCE_KILL), + "PR_MCE_KILL_CLEAR": ValueOf(syscall.PR_MCE_KILL_CLEAR), + "PR_MCE_KILL_DEFAULT": ValueOf(syscall.PR_MCE_KILL_DEFAULT), + "PR_MCE_KILL_EARLY": ValueOf(syscall.PR_MCE_KILL_EARLY), + "PR_MCE_KILL_GET": ValueOf(syscall.PR_MCE_KILL_GET), + "PR_MCE_KILL_LATE": ValueOf(syscall.PR_MCE_KILL_LATE), + "PR_MCE_KILL_SET": ValueOf(syscall.PR_MCE_KILL_SET), + "PR_SET_DUMPABLE": ValueOf(syscall.PR_SET_DUMPABLE), + "PR_SET_ENDIAN": ValueOf(syscall.PR_SET_ENDIAN), + "PR_SET_FPEMU": ValueOf(syscall.PR_SET_FPEMU), + "PR_SET_FPEXC": ValueOf(syscall.PR_SET_FPEXC), + "PR_SET_KEEPCAPS": ValueOf(syscall.PR_SET_KEEPCAPS), + "PR_SET_NAME": ValueOf(syscall.PR_SET_NAME), + "PR_SET_PDEATHSIG": ValueOf(syscall.PR_SET_PDEATHSIG), + "PR_SET_PTRACER": ValueOf(syscall.PR_SET_PTRACER), + "PR_SET_SECCOMP": ValueOf(syscall.PR_SET_SECCOMP), + "PR_SET_SECUREBITS": ValueOf(syscall.PR_SET_SECUREBITS), + "PR_SET_TIMERSLACK": ValueOf(syscall.PR_SET_TIMERSLACK), + "PR_SET_TIMING": ValueOf(syscall.PR_SET_TIMING), + "PR_SET_TSC": ValueOf(syscall.PR_SET_TSC), + "PR_SET_UNALIGN": ValueOf(syscall.PR_SET_UNALIGN), + "PR_TASK_PERF_EVENTS_DISABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_DISABLE), + "PR_TASK_PERF_EVENTS_ENABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_ENABLE), + "PR_TIMING_STATISTICAL": ValueOf(syscall.PR_TIMING_STATISTICAL), + "PR_TIMING_TIMESTAMP": ValueOf(syscall.PR_TIMING_TIMESTAMP), + "PR_TSC_ENABLE": ValueOf(syscall.PR_TSC_ENABLE), + "PR_TSC_SIGSEGV": ValueOf(syscall.PR_TSC_SIGSEGV), + "PR_UNALIGN_NOPRINT": ValueOf(syscall.PR_UNALIGN_NOPRINT), + "PR_UNALIGN_SIGBUS": ValueOf(syscall.PR_UNALIGN_SIGBUS), + "PTRACE_ATTACH": ValueOf(syscall.PTRACE_ATTACH), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_DETACH": ValueOf(syscall.PTRACE_DETACH), + "PTRACE_EVENT_CLONE": ValueOf(syscall.PTRACE_EVENT_CLONE), + "PTRACE_EVENT_EXEC": ValueOf(syscall.PTRACE_EVENT_EXEC), + "PTRACE_EVENT_EXIT": ValueOf(syscall.PTRACE_EVENT_EXIT), + "PTRACE_EVENT_FORK": ValueOf(syscall.PTRACE_EVENT_FORK), + "PTRACE_EVENT_VFORK": ValueOf(syscall.PTRACE_EVENT_VFORK), + "PTRACE_EVENT_VFORK_DONE": ValueOf(syscall.PTRACE_EVENT_VFORK_DONE), + "PTRACE_GETEVENTMSG": ValueOf(syscall.PTRACE_GETEVENTMSG), + "PTRACE_GETFPREGS": ValueOf(syscall.PTRACE_GETFPREGS), + "PTRACE_GETFPXREGS": ValueOf(syscall.PTRACE_GETFPXREGS), + "PTRACE_GETREGS": ValueOf(syscall.PTRACE_GETREGS), + "PTRACE_GETREGSET": ValueOf(syscall.PTRACE_GETREGSET), + "PTRACE_GETSIGINFO": ValueOf(syscall.PTRACE_GETSIGINFO), + "PTRACE_GET_THREAD_AREA": ValueOf(syscall.PTRACE_GET_THREAD_AREA), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_OLDSETOPTIONS": ValueOf(syscall.PTRACE_OLDSETOPTIONS), + "PTRACE_O_MASK": ValueOf(syscall.PTRACE_O_MASK), + "PTRACE_O_TRACECLONE": ValueOf(syscall.PTRACE_O_TRACECLONE), + "PTRACE_O_TRACEEXEC": ValueOf(syscall.PTRACE_O_TRACEEXEC), + "PTRACE_O_TRACEEXIT": ValueOf(syscall.PTRACE_O_TRACEEXIT), + "PTRACE_O_TRACEFORK": ValueOf(syscall.PTRACE_O_TRACEFORK), + "PTRACE_O_TRACESYSGOOD": ValueOf(syscall.PTRACE_O_TRACESYSGOOD), + "PTRACE_O_TRACEVFORK": ValueOf(syscall.PTRACE_O_TRACEVFORK), + "PTRACE_O_TRACEVFORKDONE": ValueOf(syscall.PTRACE_O_TRACEVFORKDONE), + "PTRACE_PEEKDATA": ValueOf(syscall.PTRACE_PEEKDATA), + "PTRACE_PEEKTEXT": ValueOf(syscall.PTRACE_PEEKTEXT), + "PTRACE_PEEKUSR": ValueOf(syscall.PTRACE_PEEKUSR), + "PTRACE_POKEDATA": ValueOf(syscall.PTRACE_POKEDATA), + "PTRACE_POKETEXT": ValueOf(syscall.PTRACE_POKETEXT), + "PTRACE_POKEUSR": ValueOf(syscall.PTRACE_POKEUSR), + "PTRACE_SETFPREGS": ValueOf(syscall.PTRACE_SETFPREGS), + "PTRACE_SETFPXREGS": ValueOf(syscall.PTRACE_SETFPXREGS), + "PTRACE_SETOPTIONS": ValueOf(syscall.PTRACE_SETOPTIONS), + "PTRACE_SETREGS": ValueOf(syscall.PTRACE_SETREGS), + "PTRACE_SETREGSET": ValueOf(syscall.PTRACE_SETREGSET), + "PTRACE_SETSIGINFO": ValueOf(syscall.PTRACE_SETSIGINFO), + "PTRACE_SET_THREAD_AREA": ValueOf(syscall.PTRACE_SET_THREAD_AREA), + "PTRACE_SINGLEBLOCK": ValueOf(syscall.PTRACE_SINGLEBLOCK), + "PTRACE_SINGLESTEP": ValueOf(syscall.PTRACE_SINGLESTEP), + "PTRACE_SYSCALL": ValueOf(syscall.PTRACE_SYSCALL), + "PTRACE_SYSEMU": ValueOf(syscall.PTRACE_SYSEMU), + "PTRACE_SYSEMU_SINGLESTEP": ValueOf(syscall.PTRACE_SYSEMU_SINGLESTEP), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseNetlinkMessage": ValueOf(syscall.ParseNetlinkMessage), + "ParseNetlinkRouteAttr": ValueOf(syscall.ParseNetlinkRouteAttr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixCredentials": ValueOf(syscall.ParseUnixCredentials), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "PathMax": ValueOf(syscall.PathMax), + "Pause": ValueOf(syscall.Pause), + "Pipe": ValueOf(syscall.Pipe), + "Pipe2": ValueOf(syscall.Pipe2), + "PivotRoot": ValueOf(syscall.PivotRoot), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceCont": ValueOf(syscall.PtraceCont), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "PtraceGetEventMsg": ValueOf(syscall.PtraceGetEventMsg), + "PtraceGetRegs": ValueOf(syscall.PtraceGetRegs), + "PtracePeekData": ValueOf(syscall.PtracePeekData), + "PtracePeekText": ValueOf(syscall.PtracePeekText), + "PtracePokeData": ValueOf(syscall.PtracePokeData), + "PtracePokeText": ValueOf(syscall.PtracePokeText), + "PtraceSetOptions": ValueOf(syscall.PtraceSetOptions), + "PtraceSetRegs": ValueOf(syscall.PtraceSetRegs), + "PtraceSingleStep": ValueOf(syscall.PtraceSingleStep), + "PtraceSyscall": ValueOf(syscall.PtraceSyscall), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(syscall.RLIM_INFINITY), + "RTAX_ADVMSS": ValueOf(syscall.RTAX_ADVMSS), + "RTAX_CWND": ValueOf(syscall.RTAX_CWND), + "RTAX_FEATURES": ValueOf(syscall.RTAX_FEATURES), + "RTAX_FEATURE_ALLFRAG": ValueOf(syscall.RTAX_FEATURE_ALLFRAG), + "RTAX_FEATURE_ECN": ValueOf(syscall.RTAX_FEATURE_ECN), + "RTAX_FEATURE_SACK": ValueOf(syscall.RTAX_FEATURE_SACK), + "RTAX_FEATURE_TIMESTAMP": ValueOf(syscall.RTAX_FEATURE_TIMESTAMP), + "RTAX_HOPLIMIT": ValueOf(syscall.RTAX_HOPLIMIT), + "RTAX_INITCWND": ValueOf(syscall.RTAX_INITCWND), + "RTAX_INITRWND": ValueOf(syscall.RTAX_INITRWND), + "RTAX_LOCK": ValueOf(syscall.RTAX_LOCK), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_MTU": ValueOf(syscall.RTAX_MTU), + "RTAX_REORDERING": ValueOf(syscall.RTAX_REORDERING), + "RTAX_RTO_MIN": ValueOf(syscall.RTAX_RTO_MIN), + "RTAX_RTT": ValueOf(syscall.RTAX_RTT), + "RTAX_RTTVAR": ValueOf(syscall.RTAX_RTTVAR), + "RTAX_SSTHRESH": ValueOf(syscall.RTAX_SSTHRESH), + "RTAX_UNSPEC": ValueOf(syscall.RTAX_UNSPEC), + "RTAX_WINDOW": ValueOf(syscall.RTAX_WINDOW), + "RTA_ALIGNTO": ValueOf(syscall.RTA_ALIGNTO), + "RTA_CACHEINFO": ValueOf(syscall.RTA_CACHEINFO), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_FLOW": ValueOf(syscall.RTA_FLOW), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_IIF": ValueOf(syscall.RTA_IIF), + "RTA_MAX": ValueOf(syscall.RTA_MAX), + "RTA_METRICS": ValueOf(syscall.RTA_METRICS), + "RTA_MULTIPATH": ValueOf(syscall.RTA_MULTIPATH), + "RTA_OIF": ValueOf(syscall.RTA_OIF), + "RTA_PREFSRC": ValueOf(syscall.RTA_PREFSRC), + "RTA_PRIORITY": ValueOf(syscall.RTA_PRIORITY), + "RTA_SRC": ValueOf(syscall.RTA_SRC), + "RTA_TABLE": ValueOf(syscall.RTA_TABLE), + "RTA_UNSPEC": ValueOf(syscall.RTA_UNSPEC), + "RTCF_DIRECTSRC": ValueOf(syscall.RTCF_DIRECTSRC), + "RTCF_DOREDIRECT": ValueOf(syscall.RTCF_DOREDIRECT), + "RTCF_LOG": ValueOf(syscall.RTCF_LOG), + "RTCF_MASQ": ValueOf(syscall.RTCF_MASQ), + "RTCF_NAT": ValueOf(syscall.RTCF_NAT), + "RTCF_VALVE": ValueOf(syscall.RTCF_VALVE), + "RTF_ADDRCLASSMASK": ValueOf(uint32(syscall.RTF_ADDRCLASSMASK)), + "RTF_ADDRCONF": ValueOf(syscall.RTF_ADDRCONF), + "RTF_ALLONLINK": ValueOf(syscall.RTF_ALLONLINK), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CACHE": ValueOf(syscall.RTF_CACHE), + "RTF_DEFAULT": ValueOf(syscall.RTF_DEFAULT), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FLOW": ValueOf(syscall.RTF_FLOW), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_INTERFACE": ValueOf(syscall.RTF_INTERFACE), + "RTF_IRTT": ValueOf(syscall.RTF_IRTT), + "RTF_LINKRT": ValueOf(syscall.RTF_LINKRT), + "RTF_LOCAL": ValueOf(uint32(syscall.RTF_LOCAL)), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MSS": ValueOf(syscall.RTF_MSS), + "RTF_MTU": ValueOf(syscall.RTF_MTU), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_NAT": ValueOf(syscall.RTF_NAT), + "RTF_NOFORWARD": ValueOf(syscall.RTF_NOFORWARD), + "RTF_NONEXTHOP": ValueOf(syscall.RTF_NONEXTHOP), + "RTF_NOPMTUDISC": ValueOf(syscall.RTF_NOPMTUDISC), + "RTF_POLICY": ValueOf(syscall.RTF_POLICY), + "RTF_REINSTATE": ValueOf(syscall.RTF_REINSTATE), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_THROW": ValueOf(syscall.RTF_THROW), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WINDOW": ValueOf(syscall.RTF_WINDOW), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_BASE": ValueOf(syscall.RTM_BASE), + "RTM_DELACTION": ValueOf(syscall.RTM_DELACTION), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELADDRLABEL": ValueOf(syscall.RTM_DELADDRLABEL), + "RTM_DELLINK": ValueOf(syscall.RTM_DELLINK), + "RTM_DELNEIGH": ValueOf(syscall.RTM_DELNEIGH), + "RTM_DELQDISC": ValueOf(syscall.RTM_DELQDISC), + "RTM_DELROUTE": ValueOf(syscall.RTM_DELROUTE), + "RTM_DELRULE": ValueOf(syscall.RTM_DELRULE), + "RTM_DELTCLASS": ValueOf(syscall.RTM_DELTCLASS), + "RTM_DELTFILTER": ValueOf(syscall.RTM_DELTFILTER), + "RTM_F_CLONED": ValueOf(syscall.RTM_F_CLONED), + "RTM_F_EQUALIZE": ValueOf(syscall.RTM_F_EQUALIZE), + "RTM_F_NOTIFY": ValueOf(syscall.RTM_F_NOTIFY), + "RTM_F_PREFIX": ValueOf(syscall.RTM_F_PREFIX), + "RTM_GETACTION": ValueOf(syscall.RTM_GETACTION), + "RTM_GETADDR": ValueOf(syscall.RTM_GETADDR), + "RTM_GETADDRLABEL": ValueOf(syscall.RTM_GETADDRLABEL), + "RTM_GETANYCAST": ValueOf(syscall.RTM_GETANYCAST), + "RTM_GETDCB": ValueOf(syscall.RTM_GETDCB), + "RTM_GETLINK": ValueOf(syscall.RTM_GETLINK), + "RTM_GETMULTICAST": ValueOf(syscall.RTM_GETMULTICAST), + "RTM_GETNEIGH": ValueOf(syscall.RTM_GETNEIGH), + "RTM_GETNEIGHTBL": ValueOf(syscall.RTM_GETNEIGHTBL), + "RTM_GETQDISC": ValueOf(syscall.RTM_GETQDISC), + "RTM_GETROUTE": ValueOf(syscall.RTM_GETROUTE), + "RTM_GETRULE": ValueOf(syscall.RTM_GETRULE), + "RTM_GETTCLASS": ValueOf(syscall.RTM_GETTCLASS), + "RTM_GETTFILTER": ValueOf(syscall.RTM_GETTFILTER), + "RTM_MAX": ValueOf(syscall.RTM_MAX), + "RTM_NEWACTION": ValueOf(syscall.RTM_NEWACTION), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWADDRLABEL": ValueOf(syscall.RTM_NEWADDRLABEL), + "RTM_NEWLINK": ValueOf(syscall.RTM_NEWLINK), + "RTM_NEWNDUSEROPT": ValueOf(syscall.RTM_NEWNDUSEROPT), + "RTM_NEWNEIGH": ValueOf(syscall.RTM_NEWNEIGH), + "RTM_NEWNEIGHTBL": ValueOf(syscall.RTM_NEWNEIGHTBL), + "RTM_NEWPREFIX": ValueOf(syscall.RTM_NEWPREFIX), + "RTM_NEWQDISC": ValueOf(syscall.RTM_NEWQDISC), + "RTM_NEWROUTE": ValueOf(syscall.RTM_NEWROUTE), + "RTM_NEWRULE": ValueOf(syscall.RTM_NEWRULE), + "RTM_NEWTCLASS": ValueOf(syscall.RTM_NEWTCLASS), + "RTM_NEWTFILTER": ValueOf(syscall.RTM_NEWTFILTER), + "RTM_NR_FAMILIES": ValueOf(syscall.RTM_NR_FAMILIES), + "RTM_NR_MSGTYPES": ValueOf(syscall.RTM_NR_MSGTYPES), + "RTM_SETDCB": ValueOf(syscall.RTM_SETDCB), + "RTM_SETLINK": ValueOf(syscall.RTM_SETLINK), + "RTM_SETNEIGHTBL": ValueOf(syscall.RTM_SETNEIGHTBL), + "RTNH_ALIGNTO": ValueOf(syscall.RTNH_ALIGNTO), + "RTNH_F_DEAD": ValueOf(syscall.RTNH_F_DEAD), + "RTNH_F_ONLINK": ValueOf(syscall.RTNH_F_ONLINK), + "RTNH_F_PERVASIVE": ValueOf(syscall.RTNH_F_PERVASIVE), + "RTNLGRP_IPV4_IFADDR": ValueOf(syscall.RTNLGRP_IPV4_IFADDR), + "RTNLGRP_IPV4_MROUTE": ValueOf(syscall.RTNLGRP_IPV4_MROUTE), + "RTNLGRP_IPV4_ROUTE": ValueOf(syscall.RTNLGRP_IPV4_ROUTE), + "RTNLGRP_IPV4_RULE": ValueOf(syscall.RTNLGRP_IPV4_RULE), + "RTNLGRP_IPV6_IFADDR": ValueOf(syscall.RTNLGRP_IPV6_IFADDR), + "RTNLGRP_IPV6_IFINFO": ValueOf(syscall.RTNLGRP_IPV6_IFINFO), + "RTNLGRP_IPV6_MROUTE": ValueOf(syscall.RTNLGRP_IPV6_MROUTE), + "RTNLGRP_IPV6_PREFIX": ValueOf(syscall.RTNLGRP_IPV6_PREFIX), + "RTNLGRP_IPV6_ROUTE": ValueOf(syscall.RTNLGRP_IPV6_ROUTE), + "RTNLGRP_IPV6_RULE": ValueOf(syscall.RTNLGRP_IPV6_RULE), + "RTNLGRP_LINK": ValueOf(syscall.RTNLGRP_LINK), + "RTNLGRP_ND_USEROPT": ValueOf(syscall.RTNLGRP_ND_USEROPT), + "RTNLGRP_NEIGH": ValueOf(syscall.RTNLGRP_NEIGH), + "RTNLGRP_NONE": ValueOf(syscall.RTNLGRP_NONE), + "RTNLGRP_NOTIFY": ValueOf(syscall.RTNLGRP_NOTIFY), + "RTNLGRP_TC": ValueOf(syscall.RTNLGRP_TC), + "RTN_ANYCAST": ValueOf(syscall.RTN_ANYCAST), + "RTN_BLACKHOLE": ValueOf(syscall.RTN_BLACKHOLE), + "RTN_BROADCAST": ValueOf(syscall.RTN_BROADCAST), + "RTN_LOCAL": ValueOf(syscall.RTN_LOCAL), + "RTN_MAX": ValueOf(syscall.RTN_MAX), + "RTN_MULTICAST": ValueOf(syscall.RTN_MULTICAST), + "RTN_NAT": ValueOf(syscall.RTN_NAT), + "RTN_PROHIBIT": ValueOf(syscall.RTN_PROHIBIT), + "RTN_THROW": ValueOf(syscall.RTN_THROW), + "RTN_UNICAST": ValueOf(syscall.RTN_UNICAST), + "RTN_UNREACHABLE": ValueOf(syscall.RTN_UNREACHABLE), + "RTN_UNSPEC": ValueOf(syscall.RTN_UNSPEC), + "RTN_XRESOLVE": ValueOf(syscall.RTN_XRESOLVE), + "RTPROT_BIRD": ValueOf(syscall.RTPROT_BIRD), + "RTPROT_BOOT": ValueOf(syscall.RTPROT_BOOT), + "RTPROT_DHCP": ValueOf(syscall.RTPROT_DHCP), + "RTPROT_DNROUTED": ValueOf(syscall.RTPROT_DNROUTED), + "RTPROT_GATED": ValueOf(syscall.RTPROT_GATED), + "RTPROT_KERNEL": ValueOf(syscall.RTPROT_KERNEL), + "RTPROT_MRT": ValueOf(syscall.RTPROT_MRT), + "RTPROT_NTK": ValueOf(syscall.RTPROT_NTK), + "RTPROT_RA": ValueOf(syscall.RTPROT_RA), + "RTPROT_REDIRECT": ValueOf(syscall.RTPROT_REDIRECT), + "RTPROT_STATIC": ValueOf(syscall.RTPROT_STATIC), + "RTPROT_UNSPEC": ValueOf(syscall.RTPROT_UNSPEC), + "RTPROT_XORP": ValueOf(syscall.RTPROT_XORP), + "RTPROT_ZEBRA": ValueOf(syscall.RTPROT_ZEBRA), + "RT_CLASS_DEFAULT": ValueOf(syscall.RT_CLASS_DEFAULT), + "RT_CLASS_LOCAL": ValueOf(syscall.RT_CLASS_LOCAL), + "RT_CLASS_MAIN": ValueOf(syscall.RT_CLASS_MAIN), + "RT_CLASS_MAX": ValueOf(syscall.RT_CLASS_MAX), + "RT_CLASS_UNSPEC": ValueOf(syscall.RT_CLASS_UNSPEC), + "RT_SCOPE_HOST": ValueOf(syscall.RT_SCOPE_HOST), + "RT_SCOPE_LINK": ValueOf(syscall.RT_SCOPE_LINK), + "RT_SCOPE_NOWHERE": ValueOf(syscall.RT_SCOPE_NOWHERE), + "RT_SCOPE_SITE": ValueOf(syscall.RT_SCOPE_SITE), + "RT_SCOPE_UNIVERSE": ValueOf(syscall.RT_SCOPE_UNIVERSE), + "RT_TABLE_COMPAT": ValueOf(syscall.RT_TABLE_COMPAT), + "RT_TABLE_DEFAULT": ValueOf(syscall.RT_TABLE_DEFAULT), + "RT_TABLE_LOCAL": ValueOf(syscall.RT_TABLE_LOCAL), + "RT_TABLE_MAIN": ValueOf(syscall.RT_TABLE_MAIN), + "RT_TABLE_MAX": ValueOf(uint32(syscall.RT_TABLE_MAX)), + "RT_TABLE_UNSPEC": ValueOf(syscall.RT_TABLE_UNSPEC), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Reboot": ValueOf(syscall.Reboot), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Removexattr": ValueOf(syscall.Removexattr), + "Rename": ValueOf(syscall.Rename), + "Renameat": ValueOf(syscall.Renameat), + "Rmdir": ValueOf(syscall.Rmdir), + "SCM_CREDENTIALS": ValueOf(syscall.SCM_CREDENTIALS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMPING": ValueOf(syscall.SCM_TIMESTAMPING), + "SCM_TIMESTAMPNS": ValueOf(syscall.SCM_TIMESTAMPNS), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCLD": ValueOf(syscall.SIGCLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPOLL": ValueOf(syscall.SIGPOLL), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGPWR": ValueOf(syscall.SIGPWR), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTKFLT": ValueOf(syscall.SIGSTKFLT), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGUNUSED": ValueOf(syscall.SIGUNUSED), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDDLCI": ValueOf(syscall.SIOCADDDLCI), + "SIOCADDMULTI": ValueOf(syscall.SIOCADDMULTI), + "SIOCADDRT": ValueOf(syscall.SIOCADDRT), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDARP": ValueOf(syscall.SIOCDARP), + "SIOCDELDLCI": ValueOf(syscall.SIOCDELDLCI), + "SIOCDELMULTI": ValueOf(syscall.SIOCDELMULTI), + "SIOCDELRT": ValueOf(syscall.SIOCDELRT), + "SIOCDEVPRIVATE": ValueOf(syscall.SIOCDEVPRIVATE), + "SIOCDIFADDR": ValueOf(syscall.SIOCDIFADDR), + "SIOCDRARP": ValueOf(syscall.SIOCDRARP), + "SIOCGARP": ValueOf(syscall.SIOCGARP), + "SIOCGIFADDR": ValueOf(syscall.SIOCGIFADDR), + "SIOCGIFBR": ValueOf(syscall.SIOCGIFBR), + "SIOCGIFBRDADDR": ValueOf(syscall.SIOCGIFBRDADDR), + "SIOCGIFCONF": ValueOf(syscall.SIOCGIFCONF), + "SIOCGIFCOUNT": ValueOf(syscall.SIOCGIFCOUNT), + "SIOCGIFDSTADDR": ValueOf(syscall.SIOCGIFDSTADDR), + "SIOCGIFENCAP": ValueOf(syscall.SIOCGIFENCAP), + "SIOCGIFFLAGS": ValueOf(syscall.SIOCGIFFLAGS), + "SIOCGIFHWADDR": ValueOf(syscall.SIOCGIFHWADDR), + "SIOCGIFINDEX": ValueOf(syscall.SIOCGIFINDEX), + "SIOCGIFMAP": ValueOf(syscall.SIOCGIFMAP), + "SIOCGIFMEM": ValueOf(syscall.SIOCGIFMEM), + "SIOCGIFMETRIC": ValueOf(syscall.SIOCGIFMETRIC), + "SIOCGIFMTU": ValueOf(syscall.SIOCGIFMTU), + "SIOCGIFNAME": ValueOf(syscall.SIOCGIFNAME), + "SIOCGIFNETMASK": ValueOf(syscall.SIOCGIFNETMASK), + "SIOCGIFPFLAGS": ValueOf(syscall.SIOCGIFPFLAGS), + "SIOCGIFSLAVE": ValueOf(syscall.SIOCGIFSLAVE), + "SIOCGIFTXQLEN": ValueOf(syscall.SIOCGIFTXQLEN), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGRARP": ValueOf(syscall.SIOCGRARP), + "SIOCGSTAMP": ValueOf(syscall.SIOCGSTAMP), + "SIOCGSTAMPNS": ValueOf(syscall.SIOCGSTAMPNS), + "SIOCPROTOPRIVATE": ValueOf(syscall.SIOCPROTOPRIVATE), + "SIOCRTMSG": ValueOf(syscall.SIOCRTMSG), + "SIOCSARP": ValueOf(syscall.SIOCSARP), + "SIOCSIFADDR": ValueOf(syscall.SIOCSIFADDR), + "SIOCSIFBR": ValueOf(syscall.SIOCSIFBR), + "SIOCSIFBRDADDR": ValueOf(syscall.SIOCSIFBRDADDR), + "SIOCSIFDSTADDR": ValueOf(syscall.SIOCSIFDSTADDR), + "SIOCSIFENCAP": ValueOf(syscall.SIOCSIFENCAP), + "SIOCSIFFLAGS": ValueOf(syscall.SIOCSIFFLAGS), + "SIOCSIFHWADDR": ValueOf(syscall.SIOCSIFHWADDR), + "SIOCSIFHWBROADCAST": ValueOf(syscall.SIOCSIFHWBROADCAST), + "SIOCSIFLINK": ValueOf(syscall.SIOCSIFLINK), + "SIOCSIFMAP": ValueOf(syscall.SIOCSIFMAP), + "SIOCSIFMEM": ValueOf(syscall.SIOCSIFMEM), + "SIOCSIFMETRIC": ValueOf(syscall.SIOCSIFMETRIC), + "SIOCSIFMTU": ValueOf(syscall.SIOCSIFMTU), + "SIOCSIFNAME": ValueOf(syscall.SIOCSIFNAME), + "SIOCSIFNETMASK": ValueOf(syscall.SIOCSIFNETMASK), + "SIOCSIFPFLAGS": ValueOf(syscall.SIOCSIFPFLAGS), + "SIOCSIFSLAVE": ValueOf(syscall.SIOCSIFSLAVE), + "SIOCSIFTXQLEN": ValueOf(syscall.SIOCSIFTXQLEN), + "SIOCSPGRP": ValueOf(syscall.SIOCSPGRP), + "SIOCSRARP": ValueOf(syscall.SIOCSRARP), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DCCP": ValueOf(syscall.SOCK_DCCP), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_PACKET": ValueOf(syscall.SOCK_PACKET), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_AAL": ValueOf(syscall.SOL_AAL), + "SOL_ATM": ValueOf(syscall.SOL_ATM), + "SOL_DECNET": ValueOf(syscall.SOL_DECNET), + "SOL_ICMPV6": ValueOf(syscall.SOL_ICMPV6), + "SOL_IP": ValueOf(syscall.SOL_IP), + "SOL_IPV6": ValueOf(syscall.SOL_IPV6), + "SOL_IRDA": ValueOf(syscall.SOL_IRDA), + "SOL_PACKET": ValueOf(syscall.SOL_PACKET), + "SOL_RAW": ValueOf(syscall.SOL_RAW), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOL_TCP": ValueOf(syscall.SOL_TCP), + "SOL_X25": ValueOf(syscall.SOL_X25), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ATTACH_FILTER": ValueOf(syscall.SO_ATTACH_FILTER), + "SO_BINDTODEVICE": ValueOf(syscall.SO_BINDTODEVICE), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_BSDCOMPAT": ValueOf(syscall.SO_BSDCOMPAT), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DETACH_FILTER": ValueOf(syscall.SO_DETACH_FILTER), + "SO_DOMAIN": ValueOf(syscall.SO_DOMAIN), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_MARK": ValueOf(syscall.SO_MARK), + "SO_NO_CHECK": ValueOf(syscall.SO_NO_CHECK), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PASSCRED": ValueOf(syscall.SO_PASSCRED), + "SO_PASSSEC": ValueOf(syscall.SO_PASSSEC), + "SO_PEERCRED": ValueOf(syscall.SO_PEERCRED), + "SO_PEERNAME": ValueOf(syscall.SO_PEERNAME), + "SO_PEERSEC": ValueOf(syscall.SO_PEERSEC), + "SO_PRIORITY": ValueOf(syscall.SO_PRIORITY), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVBUFFORCE": ValueOf(syscall.SO_RCVBUFFORCE), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_RXQ_OVFL": ValueOf(syscall.SO_RXQ_OVFL), + "SO_SECURITY_AUTHENTICATION": ValueOf(syscall.SO_SECURITY_AUTHENTICATION), + "SO_SECURITY_ENCRYPTION_NETWORK": ValueOf(syscall.SO_SECURITY_ENCRYPTION_NETWORK), + "SO_SECURITY_ENCRYPTION_TRANSPORT": ValueOf(syscall.SO_SECURITY_ENCRYPTION_TRANSPORT), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDBUFFORCE": ValueOf(syscall.SO_SNDBUFFORCE), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMPING": ValueOf(syscall.SO_TIMESTAMPING), + "SO_TIMESTAMPNS": ValueOf(syscall.SO_TIMESTAMPNS), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_KEY": ValueOf(syscall.SYS_ADD_KEY), + "SYS_ADJTIMEX": ValueOf(syscall.SYS_ADJTIMEX), + "SYS_AFS_SYSCALL": ValueOf(syscall.SYS_AFS_SYSCALL), + "SYS_ALARM": ValueOf(syscall.SYS_ALARM), + "SYS_BDFLUSH": ValueOf(syscall.SYS_BDFLUSH), + "SYS_BREAK": ValueOf(syscall.SYS_BREAK), + "SYS_BRK": ValueOf(syscall.SYS_BRK), + "SYS_CAPGET": ValueOf(syscall.SYS_CAPGET), + "SYS_CAPSET": ValueOf(syscall.SYS_CAPSET), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHOWN32": ValueOf(syscall.SYS_CHOWN32), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_NANOSLEEP": ValueOf(syscall.SYS_CLOCK_NANOSLEEP), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLONE": ValueOf(syscall.SYS_CLONE), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CREAT": ValueOf(syscall.SYS_CREAT), + "SYS_CREATE_MODULE": ValueOf(syscall.SYS_CREATE_MODULE), + "SYS_DELETE_MODULE": ValueOf(syscall.SYS_DELETE_MODULE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_DUP3": ValueOf(syscall.SYS_DUP3), + "SYS_EPOLL_CREATE": ValueOf(syscall.SYS_EPOLL_CREATE), + "SYS_EPOLL_CREATE1": ValueOf(syscall.SYS_EPOLL_CREATE1), + "SYS_EPOLL_CTL": ValueOf(syscall.SYS_EPOLL_CTL), + "SYS_EPOLL_PWAIT": ValueOf(syscall.SYS_EPOLL_PWAIT), + "SYS_EPOLL_WAIT": ValueOf(syscall.SYS_EPOLL_WAIT), + "SYS_EVENTFD": ValueOf(syscall.SYS_EVENTFD), + "SYS_EVENTFD2": ValueOf(syscall.SYS_EVENTFD2), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXIT_GROUP": ValueOf(syscall.SYS_EXIT_GROUP), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FADVISE64": ValueOf(syscall.SYS_FADVISE64), + "SYS_FADVISE64_64": ValueOf(syscall.SYS_FADVISE64_64), + "SYS_FALLOCATE": ValueOf(syscall.SYS_FALLOCATE), + "SYS_FANOTIFY_INIT": ValueOf(syscall.SYS_FANOTIFY_INIT), + "SYS_FANOTIFY_MARK": ValueOf(syscall.SYS_FANOTIFY_MARK), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWN32": ValueOf(syscall.SYS_FCHOWN32), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FCNTL64": ValueOf(syscall.SYS_FCNTL64), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTAT64": ValueOf(syscall.SYS_FSTAT64), + "SYS_FSTATAT64": ValueOf(syscall.SYS_FSTATAT64), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSTATFS64": ValueOf(syscall.SYS_FSTATFS64), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTIME": ValueOf(syscall.SYS_FTIME), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FTRUNCATE64": ValueOf(syscall.SYS_FTRUNCATE64), + "SYS_FUTEX": ValueOf(syscall.SYS_FUTEX), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETCPU": ValueOf(syscall.SYS_GETCPU), + "SYS_GETCWD": ValueOf(syscall.SYS_GETCWD), + "SYS_GETDENTS": ValueOf(syscall.SYS_GETDENTS), + "SYS_GETDENTS64": ValueOf(syscall.SYS_GETDENTS64), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEGID32": ValueOf(syscall.SYS_GETEGID32), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETEUID32": ValueOf(syscall.SYS_GETEUID32), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGID32": ValueOf(syscall.SYS_GETGID32), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETGROUPS32": ValueOf(syscall.SYS_GETGROUPS32), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPMSG": ValueOf(syscall.SYS_GETPMSG), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESGID32": ValueOf(syscall.SYS_GETRESGID32), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRESUID32": ValueOf(syscall.SYS_GETRESUID32), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETUID32": ValueOf(syscall.SYS_GETUID32), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_GET_KERNEL_SYMS": ValueOf(syscall.SYS_GET_KERNEL_SYMS), + "SYS_GET_MEMPOLICY": ValueOf(syscall.SYS_GET_MEMPOLICY), + "SYS_GET_ROBUST_LIST": ValueOf(syscall.SYS_GET_ROBUST_LIST), + "SYS_GET_THREAD_AREA": ValueOf(syscall.SYS_GET_THREAD_AREA), + "SYS_GTTY": ValueOf(syscall.SYS_GTTY), + "SYS_IDLE": ValueOf(syscall.SYS_IDLE), + "SYS_INIT_MODULE": ValueOf(syscall.SYS_INIT_MODULE), + "SYS_INOTIFY_ADD_WATCH": ValueOf(syscall.SYS_INOTIFY_ADD_WATCH), + "SYS_INOTIFY_INIT": ValueOf(syscall.SYS_INOTIFY_INIT), + "SYS_INOTIFY_INIT1": ValueOf(syscall.SYS_INOTIFY_INIT1), + "SYS_INOTIFY_RM_WATCH": ValueOf(syscall.SYS_INOTIFY_RM_WATCH), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPERM": ValueOf(syscall.SYS_IOPERM), + "SYS_IOPL": ValueOf(syscall.SYS_IOPL), + "SYS_IOPRIO_GET": ValueOf(syscall.SYS_IOPRIO_GET), + "SYS_IOPRIO_SET": ValueOf(syscall.SYS_IOPRIO_SET), + "SYS_IO_CANCEL": ValueOf(syscall.SYS_IO_CANCEL), + "SYS_IO_DESTROY": ValueOf(syscall.SYS_IO_DESTROY), + "SYS_IO_GETEVENTS": ValueOf(syscall.SYS_IO_GETEVENTS), + "SYS_IO_SETUP": ValueOf(syscall.SYS_IO_SETUP), + "SYS_IO_SUBMIT": ValueOf(syscall.SYS_IO_SUBMIT), + "SYS_IPC": ValueOf(syscall.SYS_IPC), + "SYS_KEXEC_LOAD": ValueOf(syscall.SYS_KEXEC_LOAD), + "SYS_KEYCTL": ValueOf(syscall.SYS_KEYCTL), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LCHOWN32": ValueOf(syscall.SYS_LCHOWN32), + "SYS_LGETXATTR": ValueOf(syscall.SYS_LGETXATTR), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LLISTXATTR": ValueOf(syscall.SYS_LLISTXATTR), + "SYS_LOCK": ValueOf(syscall.SYS_LOCK), + "SYS_LOOKUP_DCOOKIE": ValueOf(syscall.SYS_LOOKUP_DCOOKIE), + "SYS_LREMOVEXATTR": ValueOf(syscall.SYS_LREMOVEXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSETXATTR": ValueOf(syscall.SYS_LSETXATTR), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LSTAT64": ValueOf(syscall.SYS_LSTAT64), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MADVISE1": ValueOf(syscall.SYS_MADVISE1), + "SYS_MBIND": ValueOf(syscall.SYS_MBIND), + "SYS_MIGRATE_PAGES": ValueOf(syscall.SYS_MIGRATE_PAGES), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MMAP2": ValueOf(syscall.SYS_MMAP2), + "SYS_MODIFY_LDT": ValueOf(syscall.SYS_MODIFY_LDT), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MOVE_PAGES": ValueOf(syscall.SYS_MOVE_PAGES), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MPX": ValueOf(syscall.SYS_MPX), + "SYS_MQ_GETSETATTR": ValueOf(syscall.SYS_MQ_GETSETATTR), + "SYS_MQ_NOTIFY": ValueOf(syscall.SYS_MQ_NOTIFY), + "SYS_MQ_OPEN": ValueOf(syscall.SYS_MQ_OPEN), + "SYS_MQ_TIMEDRECEIVE": ValueOf(syscall.SYS_MQ_TIMEDRECEIVE), + "SYS_MQ_TIMEDSEND": ValueOf(syscall.SYS_MQ_TIMEDSEND), + "SYS_MQ_UNLINK": ValueOf(syscall.SYS_MQ_UNLINK), + "SYS_MREMAP": ValueOf(syscall.SYS_MREMAP), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NFSSERVCTL": ValueOf(syscall.SYS_NFSSERVCTL), + "SYS_NICE": ValueOf(syscall.SYS_NICE), + "SYS_OLDFSTAT": ValueOf(syscall.SYS_OLDFSTAT), + "SYS_OLDLSTAT": ValueOf(syscall.SYS_OLDLSTAT), + "SYS_OLDOLDUNAME": ValueOf(syscall.SYS_OLDOLDUNAME), + "SYS_OLDSTAT": ValueOf(syscall.SYS_OLDSTAT), + "SYS_OLDUNAME": ValueOf(syscall.SYS_OLDUNAME), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_PAUSE": ValueOf(syscall.SYS_PAUSE), + "SYS_PERF_EVENT_OPEN": ValueOf(syscall.SYS_PERF_EVENT_OPEN), + "SYS_PERSONALITY": ValueOf(syscall.SYS_PERSONALITY), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_PIVOT_ROOT": ValueOf(syscall.SYS_PIVOT_ROOT), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_PPOLL": ValueOf(syscall.SYS_PPOLL), + "SYS_PRCTL": ValueOf(syscall.SYS_PRCTL), + "SYS_PREAD64": ValueOf(syscall.SYS_PREAD64), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PRLIMIT64": ValueOf(syscall.SYS_PRLIMIT64), + "SYS_PROF": ValueOf(syscall.SYS_PROF), + "SYS_PROFIL": ValueOf(syscall.SYS_PROFIL), + "SYS_PSELECT6": ValueOf(syscall.SYS_PSELECT6), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PUTPMSG": ValueOf(syscall.SYS_PUTPMSG), + "SYS_PWRITE64": ValueOf(syscall.SYS_PWRITE64), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUERY_MODULE": ValueOf(syscall.SYS_QUERY_MODULE), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READAHEAD": ValueOf(syscall.SYS_READAHEAD), + "SYS_READDIR": ValueOf(syscall.SYS_READDIR), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVMMSG": ValueOf(syscall.SYS_RECVMMSG), + "SYS_REMAP_FILE_PAGES": ValueOf(syscall.SYS_REMAP_FILE_PAGES), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_REQUEST_KEY": ValueOf(syscall.SYS_REQUEST_KEY), + "SYS_RESTART_SYSCALL": ValueOf(syscall.SYS_RESTART_SYSCALL), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_RT_SIGACTION": ValueOf(syscall.SYS_RT_SIGACTION), + "SYS_RT_SIGPENDING": ValueOf(syscall.SYS_RT_SIGPENDING), + "SYS_RT_SIGPROCMASK": ValueOf(syscall.SYS_RT_SIGPROCMASK), + "SYS_RT_SIGQUEUEINFO": ValueOf(syscall.SYS_RT_SIGQUEUEINFO), + "SYS_RT_SIGRETURN": ValueOf(syscall.SYS_RT_SIGRETURN), + "SYS_RT_SIGSUSPEND": ValueOf(syscall.SYS_RT_SIGSUSPEND), + "SYS_RT_SIGTIMEDWAIT": ValueOf(syscall.SYS_RT_SIGTIMEDWAIT), + "SYS_RT_TGSIGQUEUEINFO": ValueOf(syscall.SYS_RT_TGSIGQUEUEINFO), + "SYS_SCHED_GETAFFINITY": ValueOf(syscall.SYS_SCHED_GETAFFINITY), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETAFFINITY": ValueOf(syscall.SYS_SCHED_SETAFFINITY), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDFILE64": ValueOf(syscall.SYS_SENDFILE64), + "SYS_SETDOMAINNAME": ValueOf(syscall.SYS_SETDOMAINNAME), + "SYS_SETFSGID": ValueOf(syscall.SYS_SETFSGID), + "SYS_SETFSGID32": ValueOf(syscall.SYS_SETFSGID32), + "SYS_SETFSUID": ValueOf(syscall.SYS_SETFSUID), + "SYS_SETFSUID32": ValueOf(syscall.SYS_SETFSUID32), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGID32": ValueOf(syscall.SYS_SETGID32), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETGROUPS32": ValueOf(syscall.SYS_SETGROUPS32), + "SYS_SETHOSTNAME": ValueOf(syscall.SYS_SETHOSTNAME), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETREGID32": ValueOf(syscall.SYS_SETREGID32), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESGID32": ValueOf(syscall.SYS_SETRESGID32), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETRESUID32": ValueOf(syscall.SYS_SETRESUID32), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETREUID32": ValueOf(syscall.SYS_SETREUID32), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETUID32": ValueOf(syscall.SYS_SETUID32), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SET_MEMPOLICY": ValueOf(syscall.SYS_SET_MEMPOLICY), + "SYS_SET_ROBUST_LIST": ValueOf(syscall.SYS_SET_ROBUST_LIST), + "SYS_SET_THREAD_AREA": ValueOf(syscall.SYS_SET_THREAD_AREA), + "SYS_SET_TID_ADDRESS": ValueOf(syscall.SYS_SET_TID_ADDRESS), + "SYS_SGETMASK": ValueOf(syscall.SYS_SGETMASK), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGNAL": ValueOf(syscall.SYS_SIGNAL), + "SYS_SIGNALFD": ValueOf(syscall.SYS_SIGNALFD), + "SYS_SIGNALFD4": ValueOf(syscall.SYS_SIGNALFD4), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SOCKETCALL": ValueOf(syscall.SYS_SOCKETCALL), + "SYS_SPLICE": ValueOf(syscall.SYS_SPLICE), + "SYS_SSETMASK": ValueOf(syscall.SYS_SSETMASK), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STAT64": ValueOf(syscall.SYS_STAT64), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_STATFS64": ValueOf(syscall.SYS_STATFS64), + "SYS_STIME": ValueOf(syscall.SYS_STIME), + "SYS_STTY": ValueOf(syscall.SYS_STTY), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYNC_FILE_RANGE": ValueOf(syscall.SYS_SYNC_FILE_RANGE), + "SYS_SYSFS": ValueOf(syscall.SYS_SYSFS), + "SYS_SYSINFO": ValueOf(syscall.SYS_SYSINFO), + "SYS_SYSLOG": ValueOf(syscall.SYS_SYSLOG), + "SYS_TEE": ValueOf(syscall.SYS_TEE), + "SYS_TGKILL": ValueOf(syscall.SYS_TGKILL), + "SYS_TIME": ValueOf(syscall.SYS_TIME), + "SYS_TIMERFD_CREATE": ValueOf(syscall.SYS_TIMERFD_CREATE), + "SYS_TIMERFD_GETTIME": ValueOf(syscall.SYS_TIMERFD_GETTIME), + "SYS_TIMERFD_SETTIME": ValueOf(syscall.SYS_TIMERFD_SETTIME), + "SYS_TIMER_CREATE": ValueOf(syscall.SYS_TIMER_CREATE), + "SYS_TIMER_DELETE": ValueOf(syscall.SYS_TIMER_DELETE), + "SYS_TIMER_GETOVERRUN": ValueOf(syscall.SYS_TIMER_GETOVERRUN), + "SYS_TIMER_GETTIME": ValueOf(syscall.SYS_TIMER_GETTIME), + "SYS_TIMER_SETTIME": ValueOf(syscall.SYS_TIMER_SETTIME), + "SYS_TIMES": ValueOf(syscall.SYS_TIMES), + "SYS_TKILL": ValueOf(syscall.SYS_TKILL), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_TRUNCATE64": ValueOf(syscall.SYS_TRUNCATE64), + "SYS_UGETRLIMIT": ValueOf(syscall.SYS_UGETRLIMIT), + "SYS_ULIMIT": ValueOf(syscall.SYS_ULIMIT), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMOUNT": ValueOf(syscall.SYS_UMOUNT), + "SYS_UMOUNT2": ValueOf(syscall.SYS_UMOUNT2), + "SYS_UNAME": ValueOf(syscall.SYS_UNAME), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNSHARE": ValueOf(syscall.SYS_UNSHARE), + "SYS_USELIB": ValueOf(syscall.SYS_USELIB), + "SYS_USTAT": ValueOf(syscall.SYS_USTAT), + "SYS_UTIME": ValueOf(syscall.SYS_UTIME), + "SYS_UTIMENSAT": ValueOf(syscall.SYS_UTIMENSAT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_VHANGUP": ValueOf(syscall.SYS_VHANGUP), + "SYS_VM86": ValueOf(syscall.SYS_VM86), + "SYS_VM86OLD": ValueOf(syscall.SYS_VM86OLD), + "SYS_VMSPLICE": ValueOf(syscall.SYS_VMSPLICE), + "SYS_VSERVER": ValueOf(syscall.SYS_VSERVER), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WAITPID": ValueOf(syscall.SYS_WAITPID), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS__LLSEEK": ValueOf(syscall.SYS__LLSEEK), + "SYS__NEWSELECT": ValueOf(syscall.SYS__NEWSELECT), + "SYS__SYSCTL": ValueOf(syscall.SYS__SYSCTL), + "S_BLKSIZE": ValueOf(syscall.S_BLKSIZE), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetLsfPromisc": ValueOf(syscall.SetLsfPromisc), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setdomainname": ValueOf(syscall.Setdomainname), + "Setenv": ValueOf(syscall.Setenv), + "Setfsgid": ValueOf(syscall.Setfsgid), + "Setfsuid": ValueOf(syscall.Setfsuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Sethostname": ValueOf(syscall.Sethostname), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setresgid": ValueOf(syscall.Setresgid), + "Setresuid": ValueOf(syscall.Setresuid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Setxattr": ValueOf(syscall.Setxattr), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAddrmsg": ValueOf(syscall.SizeofIfAddrmsg), + "SizeofIfInfomsg": ValueOf(syscall.SizeofIfInfomsg), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofInotifyEvent": ValueOf(syscall.SizeofInotifyEvent), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofNlAttr": ValueOf(syscall.SizeofNlAttr), + "SizeofNlMsgerr": ValueOf(syscall.SizeofNlMsgerr), + "SizeofNlMsghdr": ValueOf(syscall.SizeofNlMsghdr), + "SizeofRtAttr": ValueOf(syscall.SizeofRtAttr), + "SizeofRtGenmsg": ValueOf(syscall.SizeofRtGenmsg), + "SizeofRtMsg": ValueOf(syscall.SizeofRtMsg), + "SizeofRtNexthop": ValueOf(syscall.SizeofRtNexthop), + "SizeofSockFilter": ValueOf(syscall.SizeofSockFilter), + "SizeofSockFprog": ValueOf(syscall.SizeofSockFprog), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrLinklayer": ValueOf(syscall.SizeofSockaddrLinklayer), + "SizeofSockaddrNetlink": ValueOf(syscall.SizeofSockaddrNetlink), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SizeofTCPInfo": ValueOf(syscall.SizeofTCPInfo), + "SizeofUcred": ValueOf(syscall.SizeofUcred), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "Splice": ValueOf(syscall.Splice), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "SyncFileRange": ValueOf(syscall.SyncFileRange), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Sysinfo": ValueOf(syscall.Sysinfo), + "TCGETS": ValueOf(syscall.TCGETS), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_CORK": ValueOf(syscall.TCP_CORK), + "TCP_DEFER_ACCEPT": ValueOf(syscall.TCP_DEFER_ACCEPT), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_LINGER2": ValueOf(syscall.TCP_LINGER2), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MD5SIG_MAXKEYLEN": ValueOf(syscall.TCP_MD5SIG_MAXKEYLEN), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_QUICKACK": ValueOf(syscall.TCP_QUICKACK), + "TCP_SYNCNT": ValueOf(syscall.TCP_SYNCNT), + "TCP_WINDOW_CLAMP": ValueOf(syscall.TCP_WINDOW_CLAMP), + "TCSETS": ValueOf(syscall.TCSETS), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCONS": ValueOf(syscall.TIOCCONS), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCGDEV": ValueOf(uint32(syscall.TIOCGDEV)), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGICOUNT": ValueOf(syscall.TIOCGICOUNT), + "TIOCGLCKTRMIOS": ValueOf(syscall.TIOCGLCKTRMIOS), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPTN": ValueOf(uint32(syscall.TIOCGPTN)), + "TIOCGRS485": ValueOf(syscall.TIOCGRS485), + "TIOCGSERIAL": ValueOf(syscall.TIOCGSERIAL), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGSOFTCAR": ValueOf(syscall.TIOCGSOFTCAR), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCINQ": ValueOf(syscall.TIOCINQ), + "TIOCLINUX": ValueOf(syscall.TIOCLINUX), + "TIOCMBIC": ValueOf(syscall.TIOCMBIC), + "TIOCMBIS": ValueOf(syscall.TIOCMBIS), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMIWAIT": ValueOf(syscall.TIOCMIWAIT), + "TIOCMSET": ValueOf(syscall.TIOCMSET), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(syscall.TIOCPKT), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSERCONFIG": ValueOf(syscall.TIOCSERCONFIG), + "TIOCSERGETLSR": ValueOf(syscall.TIOCSERGETLSR), + "TIOCSERGETMULTI": ValueOf(syscall.TIOCSERGETMULTI), + "TIOCSERGSTRUCT": ValueOf(syscall.TIOCSERGSTRUCT), + "TIOCSERGWILD": ValueOf(syscall.TIOCSERGWILD), + "TIOCSERSETMULTI": ValueOf(syscall.TIOCSERSETMULTI), + "TIOCSERSWILD": ValueOf(syscall.TIOCSERSWILD), + "TIOCSER_TEMT": ValueOf(syscall.TIOCSER_TEMT), + "TIOCSETD": ValueOf(syscall.TIOCSETD), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSLCKTRMIOS": ValueOf(syscall.TIOCSLCKTRMIOS), + "TIOCSPGRP": ValueOf(syscall.TIOCSPGRP), + "TIOCSPTLCK": ValueOf(syscall.TIOCSPTLCK), + "TIOCSRS485": ValueOf(syscall.TIOCSRS485), + "TIOCSSERIAL": ValueOf(syscall.TIOCSSERIAL), + "TIOCSSOFTCAR": ValueOf(syscall.TIOCSSOFTCAR), + "TIOCSTI": ValueOf(syscall.TIOCSTI), + "TIOCSWINSZ": ValueOf(syscall.TIOCSWINSZ), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TUNATTACHFILTER": ValueOf(syscall.TUNATTACHFILTER), + "TUNDETACHFILTER": ValueOf(syscall.TUNDETACHFILTER), + "TUNGETFEATURES": ValueOf(uint32(syscall.TUNGETFEATURES)), + "TUNGETIFF": ValueOf(uint32(syscall.TUNGETIFF)), + "TUNGETSNDBUF": ValueOf(uint32(syscall.TUNGETSNDBUF)), + "TUNGETVNETHDRSZ": ValueOf(uint32(syscall.TUNGETVNETHDRSZ)), + "TUNSETDEBUG": ValueOf(syscall.TUNSETDEBUG), + "TUNSETGROUP": ValueOf(syscall.TUNSETGROUP), + "TUNSETIFF": ValueOf(syscall.TUNSETIFF), + "TUNSETLINK": ValueOf(syscall.TUNSETLINK), + "TUNSETNOCSUM": ValueOf(syscall.TUNSETNOCSUM), + "TUNSETOFFLOAD": ValueOf(syscall.TUNSETOFFLOAD), + "TUNSETOWNER": ValueOf(syscall.TUNSETOWNER), + "TUNSETPERSIST": ValueOf(syscall.TUNSETPERSIST), + "TUNSETSNDBUF": ValueOf(syscall.TUNSETSNDBUF), + "TUNSETTXFILTER": ValueOf(syscall.TUNSETTXFILTER), + "TUNSETVNETHDRSZ": ValueOf(syscall.TUNSETVNETHDRSZ), + "Tee": ValueOf(syscall.Tee), + "Tgkill": ValueOf(syscall.Tgkill), + "Time": ValueOf(syscall.Time), + "Times": ValueOf(syscall.Times), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Uname": ValueOf(syscall.Uname), + "UnixCredentials": ValueOf(syscall.UnixCredentials), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unlinkat": ValueOf(syscall.Unlinkat), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Unshare": ValueOf(syscall.Unshare), + "Ustat": ValueOf(syscall.Ustat), + "Utime": ValueOf(syscall.Utime), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VSWTC": ValueOf(syscall.VSWTC), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WALL": ValueOf(syscall.WALL), + "WCLONE": ValueOf(uint32(syscall.WCLONE)), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOTHREAD": ValueOf(syscall.WNOTHREAD), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + "XCASE": ValueOf(syscall.XCASE), + },Types: map[string]Type{ + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "EpollEvent": TypeOf((*syscall.EpollEvent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAddrmsg": TypeOf((*syscall.IfAddrmsg)(nil)).Elem(), + "IfInfomsg": TypeOf((*syscall.IfInfomsg)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InotifyEvent": TypeOf((*syscall.InotifyEvent)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "NetlinkMessage": TypeOf((*syscall.NetlinkMessage)(nil)).Elem(), + "NetlinkRouteAttr": TypeOf((*syscall.NetlinkRouteAttr)(nil)).Elem(), + "NetlinkRouteRequest": TypeOf((*syscall.NetlinkRouteRequest)(nil)).Elem(), + "NlAttr": TypeOf((*syscall.NlAttr)(nil)).Elem(), + "NlMsgerr": TypeOf((*syscall.NlMsgerr)(nil)).Elem(), + "NlMsghdr": TypeOf((*syscall.NlMsghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "PtraceRegs": TypeOf((*syscall.PtraceRegs)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrLinklayer": TypeOf((*syscall.RawSockaddrLinklayer)(nil)).Elem(), + "RawSockaddrNetlink": TypeOf((*syscall.RawSockaddrNetlink)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RtAttr": TypeOf((*syscall.RtAttr)(nil)).Elem(), + "RtGenmsg": TypeOf((*syscall.RtGenmsg)(nil)).Elem(), + "RtMsg": TypeOf((*syscall.RtMsg)(nil)).Elem(), + "RtNexthop": TypeOf((*syscall.RtNexthop)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "SockFilter": TypeOf((*syscall.SockFilter)(nil)).Elem(), + "SockFprog": TypeOf((*syscall.SockFprog)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrLinklayer": TypeOf((*syscall.SockaddrLinklayer)(nil)).Elem(), + "SockaddrNetlink": TypeOf((*syscall.SockaddrNetlink)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "SysProcIDMap": TypeOf((*syscall.SysProcIDMap)(nil)).Elem(), + "Sysinfo_t": TypeOf((*syscall.Sysinfo_t)(nil)).Elem(), + "TCPInfo": TypeOf((*syscall.TCPInfo)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Time_t": TypeOf((*syscall.Time_t)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timex": TypeOf((*syscall.Timex)(nil)).Elem(), + "Tms": TypeOf((*syscall.Tms)(nil)).Elem(), + "Ucred": TypeOf((*syscall.Ucred)(nil)).Elem(), + "Ustat_t": TypeOf((*syscall.Ustat_t)(nil)).Elem(), + "Utimbuf": TypeOf((*syscall.Utimbuf)(nil)).Elem(), + "Utsname": TypeOf((*syscall.Utsname)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + },Untypeds: map[string]string{ + "AF_ALG": "int:38", + "AF_APPLETALK": "int:5", + "AF_ASH": "int:18", + "AF_ATMPVC": "int:8", + "AF_ATMSVC": "int:20", + "AF_AX25": "int:3", + "AF_BLUETOOTH": "int:31", + "AF_BRIDGE": "int:7", + "AF_CAIF": "int:37", + "AF_CAN": "int:29", + "AF_DECnet": "int:12", + "AF_ECONET": "int:19", + "AF_FILE": "int:1", + "AF_IEEE802154": "int:36", + "AF_INET": "int:2", + "AF_INET6": "int:10", + "AF_IPX": "int:4", + "AF_IRDA": "int:23", + "AF_ISDN": "int:34", + "AF_IUCV": "int:32", + "AF_KEY": "int:15", + "AF_LLC": "int:26", + "AF_LOCAL": "int:1", + "AF_MAX": "int:39", + "AF_NETBEUI": "int:13", + "AF_NETLINK": "int:16", + "AF_NETROM": "int:6", + "AF_PACKET": "int:17", + "AF_PHONET": "int:35", + "AF_PPPOX": "int:24", + "AF_RDS": "int:21", + "AF_ROSE": "int:11", + "AF_ROUTE": "int:16", + "AF_RXRPC": "int:33", + "AF_SECURITY": "int:14", + "AF_SNA": "int:22", + "AF_TIPC": "int:30", + "AF_UNIX": "int:1", + "AF_UNSPEC": "int:0", + "AF_WANPIPE": "int:25", + "AF_X25": "int:9", + "ARPHRD_ADAPT": "int:264", + "ARPHRD_APPLETLK": "int:8", + "ARPHRD_ARCNET": "int:7", + "ARPHRD_ASH": "int:781", + "ARPHRD_ATM": "int:19", + "ARPHRD_AX25": "int:3", + "ARPHRD_BIF": "int:775", + "ARPHRD_CHAOS": "int:5", + "ARPHRD_CISCO": "int:513", + "ARPHRD_CSLIP": "int:257", + "ARPHRD_CSLIP6": "int:259", + "ARPHRD_DDCMP": "int:517", + "ARPHRD_DLCI": "int:15", + "ARPHRD_ECONET": "int:782", + "ARPHRD_EETHER": "int:2", + "ARPHRD_ETHER": "int:1", + "ARPHRD_EUI64": "int:27", + "ARPHRD_FCAL": "int:785", + "ARPHRD_FCFABRIC": "int:787", + "ARPHRD_FCPL": "int:786", + "ARPHRD_FCPP": "int:784", + "ARPHRD_FDDI": "int:774", + "ARPHRD_FRAD": "int:770", + "ARPHRD_HDLC": "int:513", + "ARPHRD_HIPPI": "int:780", + "ARPHRD_HWX25": "int:272", + "ARPHRD_IEEE1394": "int:24", + "ARPHRD_IEEE802": "int:6", + "ARPHRD_IEEE80211": "int:801", + "ARPHRD_IEEE80211_PRISM": "int:802", + "ARPHRD_IEEE80211_RADIOTAP": "int:803", + "ARPHRD_IEEE802154": "int:804", + "ARPHRD_IEEE802154_PHY": "int:805", + "ARPHRD_IEEE802_TR": "int:800", + "ARPHRD_INFINIBAND": "int:32", + "ARPHRD_IPDDP": "int:777", + "ARPHRD_IPGRE": "int:778", + "ARPHRD_IRDA": "int:783", + "ARPHRD_LAPB": "int:516", + "ARPHRD_LOCALTLK": "int:773", + "ARPHRD_LOOPBACK": "int:772", + "ARPHRD_METRICOM": "int:23", + "ARPHRD_NETROM": "int:0", + "ARPHRD_NONE": "int:65534", + "ARPHRD_PIMREG": "int:779", + "ARPHRD_PPP": "int:512", + "ARPHRD_PRONET": "int:4", + "ARPHRD_RAWHDLC": "int:518", + "ARPHRD_ROSE": "int:270", + "ARPHRD_RSRVD": "int:260", + "ARPHRD_SIT": "int:776", + "ARPHRD_SKIP": "int:771", + "ARPHRD_SLIP": "int:256", + "ARPHRD_SLIP6": "int:258", + "ARPHRD_TUNNEL": "int:768", + "ARPHRD_TUNNEL6": "int:769", + "ARPHRD_VOID": "int:65535", + "ARPHRD_X25": "int:271", + "B0": "int:0", + "B1000000": "int:4104", + "B110": "int:3", + "B115200": "int:4098", + "B1152000": "int:4105", + "B1200": "int:9", + "B134": "int:4", + "B150": "int:5", + "B1500000": "int:4106", + "B1800": "int:10", + "B19200": "int:14", + "B200": "int:6", + "B2000000": "int:4107", + "B230400": "int:4099", + "B2400": "int:11", + "B2500000": "int:4108", + "B300": "int:7", + "B3000000": "int:4109", + "B3500000": "int:4110", + "B38400": "int:15", + "B4000000": "int:4111", + "B460800": "int:4100", + "B4800": "int:12", + "B50": "int:1", + "B500000": "int:4101", + "B57600": "int:4097", + "B576000": "int:4102", + "B600": "int:8", + "B75": "int:2", + "B921600": "int:4103", + "B9600": "int:13", + "BPF_A": "int:16", + "BPF_ABS": "int:32", + "BPF_ADD": "int:0", + "BPF_ALU": "int:4", + "BPF_AND": "int:80", + "BPF_B": "int:16", + "BPF_DIV": "int:48", + "BPF_H": "int:8", + "BPF_IMM": "int:0", + "BPF_IND": "int:64", + "BPF_JA": "int:0", + "BPF_JEQ": "int:16", + "BPF_JGE": "int:48", + "BPF_JGT": "int:32", + "BPF_JMP": "int:5", + "BPF_JSET": "int:64", + "BPF_K": "int:0", + "BPF_LD": "int:0", + "BPF_LDX": "int:1", + "BPF_LEN": "int:128", + "BPF_LSH": "int:96", + "BPF_MAJOR_VERSION": "int:1", + "BPF_MAXINSNS": "int:4096", + "BPF_MEM": "int:96", + "BPF_MEMWORDS": "int:16", + "BPF_MINOR_VERSION": "int:1", + "BPF_MISC": "int:7", + "BPF_MSH": "int:160", + "BPF_MUL": "int:32", + "BPF_NEG": "int:128", + "BPF_OR": "int:64", + "BPF_RET": "int:6", + "BPF_RSH": "int:112", + "BPF_ST": "int:2", + "BPF_STX": "int:3", + "BPF_SUB": "int:16", + "BPF_TAX": "int:0", + "BPF_TXA": "int:128", + "BPF_W": "int:0", + "BPF_X": "int:8", + "BRKINT": "int:2", + "CLOCAL": "int:2048", + "CLONE_CHILD_CLEARTID": "int:2097152", + "CLONE_CHILD_SETTID": "int:16777216", + "CLONE_DETACHED": "int:4194304", + "CLONE_FILES": "int:1024", + "CLONE_FS": "int:512", + "CLONE_IO": "int:2147483648", + "CLONE_NEWIPC": "int:134217728", + "CLONE_NEWNET": "int:1073741824", + "CLONE_NEWNS": "int:131072", + "CLONE_NEWPID": "int:536870912", + "CLONE_NEWUSER": "int:268435456", + "CLONE_NEWUTS": "int:67108864", + "CLONE_PARENT": "int:32768", + "CLONE_PARENT_SETTID": "int:1048576", + "CLONE_PTRACE": "int:8192", + "CLONE_SETTLS": "int:524288", + "CLONE_SIGHAND": "int:2048", + "CLONE_SYSVSEM": "int:262144", + "CLONE_THREAD": "int:65536", + "CLONE_UNTRACED": "int:8388608", + "CLONE_VFORK": "int:16384", + "CLONE_VM": "int:256", + "CREAD": "int:128", + "CS5": "int:0", + "CS6": "int:16", + "CS7": "int:32", + "CS8": "int:48", + "CSIZE": "int:48", + "CSTOPB": "int:64", + "DT_BLK": "int:6", + "DT_CHR": "int:2", + "DT_DIR": "int:4", + "DT_FIFO": "int:1", + "DT_LNK": "int:10", + "DT_REG": "int:8", + "DT_SOCK": "int:12", + "DT_UNKNOWN": "int:0", + "DT_WHT": "int:14", + "ECHO": "int:8", + "ECHOCTL": "int:512", + "ECHOE": "int:16", + "ECHOK": "int:32", + "ECHOKE": "int:2048", + "ECHONL": "int:64", + "ECHOPRT": "int:1024", + "EPOLLERR": "int:8", + "EPOLLET": "int:-2147483648", + "EPOLLHUP": "int:16", + "EPOLLIN": "int:1", + "EPOLLMSG": "int:1024", + "EPOLLONESHOT": "int:1073741824", + "EPOLLOUT": "int:4", + "EPOLLPRI": "int:2", + "EPOLLRDBAND": "int:128", + "EPOLLRDHUP": "int:8192", + "EPOLLRDNORM": "int:64", + "EPOLLWRBAND": "int:512", + "EPOLLWRNORM": "int:256", + "EPOLL_CLOEXEC": "int:524288", + "EPOLL_CTL_ADD": "int:1", + "EPOLL_CTL_DEL": "int:2", + "EPOLL_CTL_MOD": "int:3", + "EPOLL_NONBLOCK": "int:2048", + "ETH_P_1588": "int:35063", + "ETH_P_8021Q": "int:33024", + "ETH_P_802_2": "int:4", + "ETH_P_802_3": "int:1", + "ETH_P_AARP": "int:33011", + "ETH_P_ALL": "int:3", + "ETH_P_AOE": "int:34978", + "ETH_P_ARCNET": "int:26", + "ETH_P_ARP": "int:2054", + "ETH_P_ATALK": "int:32923", + "ETH_P_ATMFATE": "int:34948", + "ETH_P_ATMMPOA": "int:34892", + "ETH_P_AX25": "int:2", + "ETH_P_BPQ": "int:2303", + "ETH_P_CAIF": "int:247", + "ETH_P_CAN": "int:12", + "ETH_P_CONTROL": "int:22", + "ETH_P_CUST": "int:24582", + "ETH_P_DDCMP": "int:6", + "ETH_P_DEC": "int:24576", + "ETH_P_DIAG": "int:24581", + "ETH_P_DNA_DL": "int:24577", + "ETH_P_DNA_RC": "int:24578", + "ETH_P_DNA_RT": "int:24579", + "ETH_P_DSA": "int:27", + "ETH_P_ECONET": "int:24", + "ETH_P_EDSA": "int:56026", + "ETH_P_FCOE": "int:35078", + "ETH_P_FIP": "int:35092", + "ETH_P_HDLC": "int:25", + "ETH_P_IEEE802154": "int:246", + "ETH_P_IEEEPUP": "int:2560", + "ETH_P_IEEEPUPAT": "int:2561", + "ETH_P_IP": "int:2048", + "ETH_P_IPV6": "int:34525", + "ETH_P_IPX": "int:33079", + "ETH_P_IRDA": "int:23", + "ETH_P_LAT": "int:24580", + "ETH_P_LINK_CTL": "int:34924", + "ETH_P_LOCALTALK": "int:9", + "ETH_P_LOOP": "int:96", + "ETH_P_MOBITEX": "int:21", + "ETH_P_MPLS_MC": "int:34888", + "ETH_P_MPLS_UC": "int:34887", + "ETH_P_PAE": "int:34958", + "ETH_P_PAUSE": "int:34824", + "ETH_P_PHONET": "int:245", + "ETH_P_PPPTALK": "int:16", + "ETH_P_PPP_DISC": "int:34915", + "ETH_P_PPP_MP": "int:8", + "ETH_P_PPP_SES": "int:34916", + "ETH_P_PUP": "int:512", + "ETH_P_PUPAT": "int:513", + "ETH_P_RARP": "int:32821", + "ETH_P_SCA": "int:24583", + "ETH_P_SLOW": "int:34825", + "ETH_P_SNAP": "int:5", + "ETH_P_TEB": "int:25944", + "ETH_P_TIPC": "int:35018", + "ETH_P_TRAILER": "int:28", + "ETH_P_TR_802_2": "int:17", + "ETH_P_WAN_PPP": "int:7", + "ETH_P_WCCP": "int:34878", + "ETH_P_X25": "int:2053", + "FD_CLOEXEC": "int:1", + "FD_SETSIZE": "int:1024", + "FLUSHO": "int:4096", + "F_DUPFD": "int:0", + "F_DUPFD_CLOEXEC": "int:1030", + "F_EXLCK": "int:4", + "F_GETFD": "int:1", + "F_GETFL": "int:3", + "F_GETLEASE": "int:1025", + "F_GETLK": "int:12", + "F_GETLK64": "int:12", + "F_GETOWN": "int:9", + "F_GETOWN_EX": "int:16", + "F_GETPIPE_SZ": "int:1032", + "F_GETSIG": "int:11", + "F_LOCK": "int:1", + "F_NOTIFY": "int:1026", + "F_OK": "int:0", + "F_RDLCK": "int:0", + "F_SETFD": "int:2", + "F_SETFL": "int:4", + "F_SETLEASE": "int:1024", + "F_SETLK": "int:13", + "F_SETLK64": "int:13", + "F_SETLKW": "int:14", + "F_SETLKW64": "int:14", + "F_SETOWN": "int:8", + "F_SETOWN_EX": "int:15", + "F_SETPIPE_SZ": "int:1031", + "F_SETSIG": "int:10", + "F_SHLCK": "int:8", + "F_TEST": "int:3", + "F_TLOCK": "int:2", + "F_ULOCK": "int:0", + "F_UNLCK": "int:2", + "F_WRLCK": "int:1", + "HUPCL": "int:1024", + "ICANON": "int:2", + "ICMPV6_FILTER": "int:1", + "ICRNL": "int:256", + "IEXTEN": "int:32768", + "IFA_ADDRESS": "int:1", + "IFA_ANYCAST": "int:5", + "IFA_BROADCAST": "int:4", + "IFA_CACHEINFO": "int:6", + "IFA_F_DADFAILED": "int:8", + "IFA_F_DEPRECATED": "int:32", + "IFA_F_HOMEADDRESS": "int:16", + "IFA_F_NODAD": "int:2", + "IFA_F_OPTIMISTIC": "int:4", + "IFA_F_PERMANENT": "int:128", + "IFA_F_SECONDARY": "int:1", + "IFA_F_TEMPORARY": "int:1", + "IFA_F_TENTATIVE": "int:64", + "IFA_LABEL": "int:3", + "IFA_LOCAL": "int:2", + "IFA_MAX": "int:7", + "IFA_MULTICAST": "int:7", + "IFA_UNSPEC": "int:0", + "IFF_ALLMULTI": "int:512", + "IFF_AUTOMEDIA": "int:16384", + "IFF_BROADCAST": "int:2", + "IFF_DEBUG": "int:4", + "IFF_DYNAMIC": "int:32768", + "IFF_LOOPBACK": "int:8", + "IFF_MASTER": "int:1024", + "IFF_MULTICAST": "int:4096", + "IFF_NOARP": "int:128", + "IFF_NOTRAILERS": "int:32", + "IFF_NO_PI": "int:4096", + "IFF_ONE_QUEUE": "int:8192", + "IFF_POINTOPOINT": "int:16", + "IFF_PORTSEL": "int:8192", + "IFF_PROMISC": "int:256", + "IFF_RUNNING": "int:64", + "IFF_SLAVE": "int:2048", + "IFF_TAP": "int:2", + "IFF_TUN": "int:1", + "IFF_TUN_EXCL": "int:32768", + "IFF_UP": "int:1", + "IFF_VNET_HDR": "int:16384", + "IFLA_ADDRESS": "int:1", + "IFLA_BROADCAST": "int:2", + "IFLA_COST": "int:8", + "IFLA_IFALIAS": "int:20", + "IFLA_IFNAME": "int:3", + "IFLA_LINK": "int:5", + "IFLA_LINKINFO": "int:18", + "IFLA_LINKMODE": "int:17", + "IFLA_MAP": "int:14", + "IFLA_MASTER": "int:10", + "IFLA_MAX": "int:29", + "IFLA_MTU": "int:4", + "IFLA_NET_NS_PID": "int:19", + "IFLA_OPERSTATE": "int:16", + "IFLA_PRIORITY": "int:9", + "IFLA_PROTINFO": "int:12", + "IFLA_QDISC": "int:6", + "IFLA_STATS": "int:7", + "IFLA_TXQLEN": "int:13", + "IFLA_UNSPEC": "int:0", + "IFLA_WEIGHT": "int:15", + "IFLA_WIRELESS": "int:11", + "IFNAMSIZ": "int:16", + "IGNBRK": "int:1", + "IGNCR": "int:128", + "IGNPAR": "int:4", + "IMAXBEL": "int:8192", + "INLCR": "int:64", + "INPCK": "int:16", + "IN_ACCESS": "int:1", + "IN_ALL_EVENTS": "int:4095", + "IN_ATTRIB": "int:4", + "IN_CLASSA_HOST": "int:16777215", + "IN_CLASSA_MAX": "int:128", + "IN_CLASSA_NET": "int:4278190080", + "IN_CLASSA_NSHIFT": "int:24", + "IN_CLASSB_HOST": "int:65535", + "IN_CLASSB_MAX": "int:65536", + "IN_CLASSB_NET": "int:4294901760", + "IN_CLASSB_NSHIFT": "int:16", + "IN_CLASSC_HOST": "int:255", + "IN_CLASSC_NET": "int:4294967040", + "IN_CLASSC_NSHIFT": "int:8", + "IN_CLOEXEC": "int:524288", + "IN_CLOSE": "int:24", + "IN_CLOSE_NOWRITE": "int:16", + "IN_CLOSE_WRITE": "int:8", + "IN_CREATE": "int:256", + "IN_DELETE": "int:512", + "IN_DELETE_SELF": "int:1024", + "IN_DONT_FOLLOW": "int:33554432", + "IN_EXCL_UNLINK": "int:67108864", + "IN_IGNORED": "int:32768", + "IN_ISDIR": "int:1073741824", + "IN_LOOPBACKNET": "int:127", + "IN_MASK_ADD": "int:536870912", + "IN_MODIFY": "int:2", + "IN_MOVE": "int:192", + "IN_MOVED_FROM": "int:64", + "IN_MOVED_TO": "int:128", + "IN_MOVE_SELF": "int:2048", + "IN_NONBLOCK": "int:2048", + "IN_ONESHOT": "int:2147483648", + "IN_ONLYDIR": "int:16777216", + "IN_OPEN": "int:32", + "IN_Q_OVERFLOW": "int:16384", + "IN_UNMOUNT": "int:8192", + "IPPROTO_AH": "int:51", + "IPPROTO_COMP": "int:108", + "IPPROTO_DCCP": "int:33", + "IPPROTO_DSTOPTS": "int:60", + "IPPROTO_EGP": "int:8", + "IPPROTO_ENCAP": "int:98", + "IPPROTO_ESP": "int:50", + "IPPROTO_FRAGMENT": "int:44", + "IPPROTO_GRE": "int:47", + "IPPROTO_HOPOPTS": "int:0", + "IPPROTO_ICMP": "int:1", + "IPPROTO_ICMPV6": "int:58", + "IPPROTO_IDP": "int:22", + "IPPROTO_IGMP": "int:2", + "IPPROTO_IP": "int:0", + "IPPROTO_IPIP": "int:4", + "IPPROTO_IPV6": "int:41", + "IPPROTO_MTP": "int:92", + "IPPROTO_NONE": "int:59", + "IPPROTO_PIM": "int:103", + "IPPROTO_PUP": "int:12", + "IPPROTO_RAW": "int:255", + "IPPROTO_ROUTING": "int:43", + "IPPROTO_RSVP": "int:46", + "IPPROTO_SCTP": "int:132", + "IPPROTO_TCP": "int:6", + "IPPROTO_TP": "int:29", + "IPPROTO_UDP": "int:17", + "IPPROTO_UDPLITE": "int:136", + "IPV6_2292DSTOPTS": "int:4", + "IPV6_2292HOPLIMIT": "int:8", + "IPV6_2292HOPOPTS": "int:3", + "IPV6_2292PKTINFO": "int:2", + "IPV6_2292PKTOPTIONS": "int:6", + "IPV6_2292RTHDR": "int:5", + "IPV6_ADDRFORM": "int:1", + "IPV6_ADD_MEMBERSHIP": "int:20", + "IPV6_AUTHHDR": "int:10", + "IPV6_CHECKSUM": "int:7", + "IPV6_DROP_MEMBERSHIP": "int:21", + "IPV6_DSTOPTS": "int:59", + "IPV6_HOPLIMIT": "int:52", + "IPV6_HOPOPTS": "int:54", + "IPV6_IPSEC_POLICY": "int:34", + "IPV6_JOIN_ANYCAST": "int:27", + "IPV6_JOIN_GROUP": "int:20", + "IPV6_LEAVE_ANYCAST": "int:28", + "IPV6_LEAVE_GROUP": "int:21", + "IPV6_MTU": "int:24", + "IPV6_MTU_DISCOVER": "int:23", + "IPV6_MULTICAST_HOPS": "int:18", + "IPV6_MULTICAST_IF": "int:17", + "IPV6_MULTICAST_LOOP": "int:19", + "IPV6_NEXTHOP": "int:9", + "IPV6_PKTINFO": "int:50", + "IPV6_PMTUDISC_DO": "int:2", + "IPV6_PMTUDISC_DONT": "int:0", + "IPV6_PMTUDISC_PROBE": "int:3", + "IPV6_PMTUDISC_WANT": "int:1", + "IPV6_RECVDSTOPTS": "int:58", + "IPV6_RECVERR": "int:25", + "IPV6_RECVHOPLIMIT": "int:51", + "IPV6_RECVHOPOPTS": "int:53", + "IPV6_RECVPKTINFO": "int:49", + "IPV6_RECVRTHDR": "int:56", + "IPV6_RECVTCLASS": "int:66", + "IPV6_ROUTER_ALERT": "int:22", + "IPV6_RTHDR": "int:57", + "IPV6_RTHDRDSTOPTS": "int:55", + "IPV6_RTHDR_LOOSE": "int:0", + "IPV6_RTHDR_STRICT": "int:1", + "IPV6_RTHDR_TYPE_0": "int:0", + "IPV6_RXDSTOPTS": "int:59", + "IPV6_RXHOPOPTS": "int:54", + "IPV6_TCLASS": "int:67", + "IPV6_UNICAST_HOPS": "int:16", + "IPV6_V6ONLY": "int:26", + "IPV6_XFRM_POLICY": "int:35", + "IP_ADD_MEMBERSHIP": "int:35", + "IP_ADD_SOURCE_MEMBERSHIP": "int:39", + "IP_BLOCK_SOURCE": "int:38", + "IP_DEFAULT_MULTICAST_LOOP": "int:1", + "IP_DEFAULT_MULTICAST_TTL": "int:1", + "IP_DF": "int:16384", + "IP_DROP_MEMBERSHIP": "int:36", + "IP_DROP_SOURCE_MEMBERSHIP": "int:40", + "IP_FREEBIND": "int:15", + "IP_HDRINCL": "int:3", + "IP_IPSEC_POLICY": "int:16", + "IP_MAXPACKET": "int:65535", + "IP_MAX_MEMBERSHIPS": "int:20", + "IP_MF": "int:8192", + "IP_MINTTL": "int:21", + "IP_MSFILTER": "int:41", + "IP_MSS": "int:576", + "IP_MTU": "int:14", + "IP_MTU_DISCOVER": "int:10", + "IP_MULTICAST_IF": "int:32", + "IP_MULTICAST_LOOP": "int:34", + "IP_MULTICAST_TTL": "int:33", + "IP_OFFMASK": "int:8191", + "IP_OPTIONS": "int:4", + "IP_ORIGDSTADDR": "int:20", + "IP_PASSSEC": "int:18", + "IP_PKTINFO": "int:8", + "IP_PKTOPTIONS": "int:9", + "IP_PMTUDISC": "int:10", + "IP_PMTUDISC_DO": "int:2", + "IP_PMTUDISC_DONT": "int:0", + "IP_PMTUDISC_PROBE": "int:3", + "IP_PMTUDISC_WANT": "int:1", + "IP_RECVERR": "int:11", + "IP_RECVOPTS": "int:6", + "IP_RECVORIGDSTADDR": "int:20", + "IP_RECVRETOPTS": "int:7", + "IP_RECVTOS": "int:13", + "IP_RECVTTL": "int:12", + "IP_RETOPTS": "int:7", + "IP_RF": "int:32768", + "IP_ROUTER_ALERT": "int:5", + "IP_TOS": "int:1", + "IP_TRANSPARENT": "int:19", + "IP_TTL": "int:2", + "IP_UNBLOCK_SOURCE": "int:37", + "IP_XFRM_POLICY": "int:17", + "ISIG": "int:1", + "ISTRIP": "int:32", + "IUCLC": "int:512", + "IUTF8": "int:16384", + "IXANY": "int:2048", + "IXOFF": "int:4096", + "IXON": "int:1024", + "ImplementsGetwd": "bool:true", + "LINUX_REBOOT_CMD_CAD_OFF": "int:0", + "LINUX_REBOOT_CMD_CAD_ON": "int:2309737967", + "LINUX_REBOOT_CMD_HALT": "int:3454992675", + "LINUX_REBOOT_CMD_KEXEC": "int:1163412803", + "LINUX_REBOOT_CMD_POWER_OFF": "int:1126301404", + "LINUX_REBOOT_CMD_RESTART": "int:19088743", + "LINUX_REBOOT_CMD_RESTART2": "int:2712847316", + "LINUX_REBOOT_CMD_SW_SUSPEND": "int:3489725666", + "LINUX_REBOOT_MAGIC1": "int:4276215469", + "LINUX_REBOOT_MAGIC2": "int:672274793", + "LOCK_EX": "int:2", + "LOCK_NB": "int:4", + "LOCK_SH": "int:1", + "LOCK_UN": "int:8", + "MADV_DOFORK": "int:11", + "MADV_DONTFORK": "int:10", + "MADV_DONTNEED": "int:4", + "MADV_HUGEPAGE": "int:14", + "MADV_HWPOISON": "int:100", + "MADV_MERGEABLE": "int:12", + "MADV_NOHUGEPAGE": "int:15", + "MADV_NORMAL": "int:0", + "MADV_RANDOM": "int:1", + "MADV_REMOVE": "int:9", + "MADV_SEQUENTIAL": "int:2", + "MADV_UNMERGEABLE": "int:13", + "MADV_WILLNEED": "int:3", + "MAP_32BIT": "int:64", + "MAP_ANON": "int:32", + "MAP_ANONYMOUS": "int:32", + "MAP_DENYWRITE": "int:2048", + "MAP_EXECUTABLE": "int:4096", + "MAP_FILE": "int:0", + "MAP_FIXED": "int:16", + "MAP_GROWSDOWN": "int:256", + "MAP_HUGETLB": "int:262144", + "MAP_LOCKED": "int:8192", + "MAP_NONBLOCK": "int:65536", + "MAP_NORESERVE": "int:16384", + "MAP_POPULATE": "int:32768", + "MAP_PRIVATE": "int:2", + "MAP_SHARED": "int:1", + "MAP_STACK": "int:131072", + "MAP_TYPE": "int:15", + "MCL_CURRENT": "int:1", + "MCL_FUTURE": "int:2", + "MNT_DETACH": "int:2", + "MNT_EXPIRE": "int:4", + "MNT_FORCE": "int:1", + "MSG_CMSG_CLOEXEC": "int:1073741824", + "MSG_CONFIRM": "int:2048", + "MSG_CTRUNC": "int:8", + "MSG_DONTROUTE": "int:4", + "MSG_DONTWAIT": "int:64", + "MSG_EOR": "int:128", + "MSG_ERRQUEUE": "int:8192", + "MSG_FASTOPEN": "int:536870912", + "MSG_FIN": "int:512", + "MSG_MORE": "int:32768", + "MSG_NOSIGNAL": "int:16384", + "MSG_OOB": "int:1", + "MSG_PEEK": "int:2", + "MSG_PROXY": "int:16", + "MSG_RST": "int:4096", + "MSG_SYN": "int:1024", + "MSG_TRUNC": "int:32", + "MSG_TRYHARD": "int:4", + "MSG_WAITALL": "int:256", + "MSG_WAITFORONE": "int:65536", + "MS_ACTIVE": "int:1073741824", + "MS_ASYNC": "int:1", + "MS_BIND": "int:4096", + "MS_DIRSYNC": "int:128", + "MS_INVALIDATE": "int:2", + "MS_I_VERSION": "int:8388608", + "MS_KERNMOUNT": "int:4194304", + "MS_MANDLOCK": "int:64", + "MS_MGC_MSK": "int:4294901760", + "MS_MGC_VAL": "int:3236757504", + "MS_MOVE": "int:8192", + "MS_NOATIME": "int:1024", + "MS_NODEV": "int:4", + "MS_NODIRATIME": "int:2048", + "MS_NOEXEC": "int:8", + "MS_NOSUID": "int:2", + "MS_NOUSER": "int:-2147483648", + "MS_POSIXACL": "int:65536", + "MS_PRIVATE": "int:262144", + "MS_RDONLY": "int:1", + "MS_REC": "int:16384", + "MS_RELATIME": "int:2097152", + "MS_REMOUNT": "int:32", + "MS_RMT_MASK": "int:8388689", + "MS_SHARED": "int:1048576", + "MS_SILENT": "int:32768", + "MS_SLAVE": "int:524288", + "MS_STRICTATIME": "int:16777216", + "MS_SYNC": "int:4", + "MS_SYNCHRONOUS": "int:16", + "MS_UNBINDABLE": "int:131072", + "NAME_MAX": "int:255", + "NETLINK_ADD_MEMBERSHIP": "int:1", + "NETLINK_AUDIT": "int:9", + "NETLINK_BROADCAST_ERROR": "int:4", + "NETLINK_CONNECTOR": "int:11", + "NETLINK_DNRTMSG": "int:14", + "NETLINK_DROP_MEMBERSHIP": "int:2", + "NETLINK_ECRYPTFS": "int:19", + "NETLINK_FIB_LOOKUP": "int:10", + "NETLINK_FIREWALL": "int:3", + "NETLINK_GENERIC": "int:16", + "NETLINK_INET_DIAG": "int:4", + "NETLINK_IP6_FW": "int:13", + "NETLINK_ISCSI": "int:8", + "NETLINK_KOBJECT_UEVENT": "int:15", + "NETLINK_NETFILTER": "int:12", + "NETLINK_NFLOG": "int:5", + "NETLINK_NO_ENOBUFS": "int:5", + "NETLINK_PKTINFO": "int:3", + "NETLINK_ROUTE": "int:0", + "NETLINK_SCSITRANSPORT": "int:18", + "NETLINK_SELINUX": "int:7", + "NETLINK_UNUSED": "int:1", + "NETLINK_USERSOCK": "int:2", + "NETLINK_XFRM": "int:6", + "NLA_ALIGNTO": "int:4", + "NLA_F_NESTED": "int:32768", + "NLA_F_NET_BYTEORDER": "int:16384", + "NLA_HDRLEN": "int:4", + "NLMSG_ALIGNTO": "int:4", + "NLMSG_DONE": "int:3", + "NLMSG_ERROR": "int:2", + "NLMSG_HDRLEN": "int:16", + "NLMSG_MIN_TYPE": "int:16", + "NLMSG_NOOP": "int:1", + "NLMSG_OVERRUN": "int:4", + "NLM_F_ACK": "int:4", + "NLM_F_APPEND": "int:2048", + "NLM_F_ATOMIC": "int:1024", + "NLM_F_CREATE": "int:1024", + "NLM_F_DUMP": "int:768", + "NLM_F_ECHO": "int:8", + "NLM_F_EXCL": "int:512", + "NLM_F_MATCH": "int:512", + "NLM_F_MULTI": "int:2", + "NLM_F_REPLACE": "int:256", + "NLM_F_REQUEST": "int:1", + "NLM_F_ROOT": "int:256", + "NOFLSH": "int:128", + "OCRNL": "int:8", + "OFDEL": "int:128", + "OFILL": "int:64", + "OLCUC": "int:2", + "ONLCR": "int:4", + "ONLRET": "int:32", + "ONOCR": "int:16", + "OPOST": "int:1", + "O_ACCMODE": "int:3", + "O_APPEND": "int:1024", + "O_ASYNC": "int:8192", + "O_CLOEXEC": "int:524288", + "O_CREAT": "int:64", + "O_DIRECT": "int:16384", + "O_DIRECTORY": "int:65536", + "O_DSYNC": "int:4096", + "O_EXCL": "int:128", + "O_FSYNC": "int:1052672", + "O_LARGEFILE": "int:32768", + "O_NDELAY": "int:2048", + "O_NOATIME": "int:262144", + "O_NOCTTY": "int:256", + "O_NOFOLLOW": "int:131072", + "O_NONBLOCK": "int:2048", + "O_RDONLY": "int:0", + "O_RDWR": "int:2", + "O_RSYNC": "int:1052672", + "O_SYNC": "int:1052672", + "O_TRUNC": "int:512", + "O_WRONLY": "int:1", + "PACKET_ADD_MEMBERSHIP": "int:1", + "PACKET_BROADCAST": "int:1", + "PACKET_DROP_MEMBERSHIP": "int:2", + "PACKET_FASTROUTE": "int:6", + "PACKET_HOST": "int:0", + "PACKET_LOOPBACK": "int:5", + "PACKET_MR_ALLMULTI": "int:2", + "PACKET_MR_MULTICAST": "int:0", + "PACKET_MR_PROMISC": "int:1", + "PACKET_MULTICAST": "int:2", + "PACKET_OTHERHOST": "int:3", + "PACKET_OUTGOING": "int:4", + "PACKET_RECV_OUTPUT": "int:3", + "PACKET_RX_RING": "int:5", + "PACKET_STATISTICS": "int:6", + "PARENB": "int:256", + "PARMRK": "int:8", + "PARODD": "int:512", + "PENDIN": "int:16384", + "PRIO_PGRP": "int:1", + "PRIO_PROCESS": "int:0", + "PRIO_USER": "int:2", + "PROT_EXEC": "int:4", + "PROT_GROWSDOWN": "int:16777216", + "PROT_GROWSUP": "int:33554432", + "PROT_NONE": "int:0", + "PROT_READ": "int:1", + "PROT_WRITE": "int:2", + "PR_CAPBSET_DROP": "int:24", + "PR_CAPBSET_READ": "int:23", + "PR_ENDIAN_BIG": "int:0", + "PR_ENDIAN_LITTLE": "int:1", + "PR_ENDIAN_PPC_LITTLE": "int:2", + "PR_FPEMU_NOPRINT": "int:1", + "PR_FPEMU_SIGFPE": "int:2", + "PR_FP_EXC_ASYNC": "int:2", + "PR_FP_EXC_DISABLED": "int:0", + "PR_FP_EXC_DIV": "int:65536", + "PR_FP_EXC_INV": "int:1048576", + "PR_FP_EXC_NONRECOV": "int:1", + "PR_FP_EXC_OVF": "int:131072", + "PR_FP_EXC_PRECISE": "int:3", + "PR_FP_EXC_RES": "int:524288", + "PR_FP_EXC_SW_ENABLE": "int:128", + "PR_FP_EXC_UND": "int:262144", + "PR_GET_DUMPABLE": "int:3", + "PR_GET_ENDIAN": "int:19", + "PR_GET_FPEMU": "int:9", + "PR_GET_FPEXC": "int:11", + "PR_GET_KEEPCAPS": "int:7", + "PR_GET_NAME": "int:16", + "PR_GET_PDEATHSIG": "int:2", + "PR_GET_SECCOMP": "int:21", + "PR_GET_SECUREBITS": "int:27", + "PR_GET_TIMERSLACK": "int:30", + "PR_GET_TIMING": "int:13", + "PR_GET_TSC": "int:25", + "PR_GET_UNALIGN": "int:5", + "PR_MCE_KILL": "int:33", + "PR_MCE_KILL_CLEAR": "int:0", + "PR_MCE_KILL_DEFAULT": "int:2", + "PR_MCE_KILL_EARLY": "int:1", + "PR_MCE_KILL_GET": "int:34", + "PR_MCE_KILL_LATE": "int:0", + "PR_MCE_KILL_SET": "int:1", + "PR_SET_DUMPABLE": "int:4", + "PR_SET_ENDIAN": "int:20", + "PR_SET_FPEMU": "int:10", + "PR_SET_FPEXC": "int:12", + "PR_SET_KEEPCAPS": "int:8", + "PR_SET_NAME": "int:15", + "PR_SET_PDEATHSIG": "int:1", + "PR_SET_PTRACER": "int:1499557217", + "PR_SET_SECCOMP": "int:22", + "PR_SET_SECUREBITS": "int:28", + "PR_SET_TIMERSLACK": "int:29", + "PR_SET_TIMING": "int:14", + "PR_SET_TSC": "int:26", + "PR_SET_UNALIGN": "int:6", + "PR_TASK_PERF_EVENTS_DISABLE": "int:31", + "PR_TASK_PERF_EVENTS_ENABLE": "int:32", + "PR_TIMING_STATISTICAL": "int:0", + "PR_TIMING_TIMESTAMP": "int:1", + "PR_TSC_ENABLE": "int:1", + "PR_TSC_SIGSEGV": "int:2", + "PR_UNALIGN_NOPRINT": "int:1", + "PR_UNALIGN_SIGBUS": "int:2", + "PTRACE_ATTACH": "int:16", + "PTRACE_CONT": "int:7", + "PTRACE_DETACH": "int:17", + "PTRACE_EVENT_CLONE": "int:3", + "PTRACE_EVENT_EXEC": "int:4", + "PTRACE_EVENT_EXIT": "int:6", + "PTRACE_EVENT_FORK": "int:1", + "PTRACE_EVENT_VFORK": "int:2", + "PTRACE_EVENT_VFORK_DONE": "int:5", + "PTRACE_GETEVENTMSG": "int:16897", + "PTRACE_GETFPREGS": "int:14", + "PTRACE_GETFPXREGS": "int:18", + "PTRACE_GETREGS": "int:12", + "PTRACE_GETREGSET": "int:16900", + "PTRACE_GETSIGINFO": "int:16898", + "PTRACE_GET_THREAD_AREA": "int:25", + "PTRACE_KILL": "int:8", + "PTRACE_OLDSETOPTIONS": "int:21", + "PTRACE_O_MASK": "int:127", + "PTRACE_O_TRACECLONE": "int:8", + "PTRACE_O_TRACEEXEC": "int:16", + "PTRACE_O_TRACEEXIT": "int:64", + "PTRACE_O_TRACEFORK": "int:2", + "PTRACE_O_TRACESYSGOOD": "int:1", + "PTRACE_O_TRACEVFORK": "int:4", + "PTRACE_O_TRACEVFORKDONE": "int:32", + "PTRACE_PEEKDATA": "int:2", + "PTRACE_PEEKTEXT": "int:1", + "PTRACE_PEEKUSR": "int:3", + "PTRACE_POKEDATA": "int:5", + "PTRACE_POKETEXT": "int:4", + "PTRACE_POKEUSR": "int:6", + "PTRACE_SETFPREGS": "int:15", + "PTRACE_SETFPXREGS": "int:19", + "PTRACE_SETOPTIONS": "int:16896", + "PTRACE_SETREGS": "int:13", + "PTRACE_SETREGSET": "int:16901", + "PTRACE_SETSIGINFO": "int:16899", + "PTRACE_SET_THREAD_AREA": "int:26", + "PTRACE_SINGLEBLOCK": "int:33", + "PTRACE_SINGLESTEP": "int:9", + "PTRACE_SYSCALL": "int:24", + "PTRACE_SYSEMU": "int:31", + "PTRACE_SYSEMU_SINGLESTEP": "int:32", + "PTRACE_TRACEME": "int:0", + "PathMax": "int:4096", + "RLIMIT_AS": "int:9", + "RLIMIT_CORE": "int:4", + "RLIMIT_CPU": "int:0", + "RLIMIT_DATA": "int:2", + "RLIMIT_FSIZE": "int:1", + "RLIMIT_NOFILE": "int:7", + "RLIMIT_STACK": "int:3", + "RLIM_INFINITY": "int:-1", + "RTAX_ADVMSS": "int:8", + "RTAX_CWND": "int:7", + "RTAX_FEATURES": "int:12", + "RTAX_FEATURE_ALLFRAG": "int:8", + "RTAX_FEATURE_ECN": "int:1", + "RTAX_FEATURE_SACK": "int:2", + "RTAX_FEATURE_TIMESTAMP": "int:4", + "RTAX_HOPLIMIT": "int:10", + "RTAX_INITCWND": "int:11", + "RTAX_INITRWND": "int:14", + "RTAX_LOCK": "int:1", + "RTAX_MAX": "int:14", + "RTAX_MTU": "int:2", + "RTAX_REORDERING": "int:9", + "RTAX_RTO_MIN": "int:13", + "RTAX_RTT": "int:4", + "RTAX_RTTVAR": "int:5", + "RTAX_SSTHRESH": "int:6", + "RTAX_UNSPEC": "int:0", + "RTAX_WINDOW": "int:3", + "RTA_ALIGNTO": "int:4", + "RTA_CACHEINFO": "int:12", + "RTA_DST": "int:1", + "RTA_FLOW": "int:11", + "RTA_GATEWAY": "int:5", + "RTA_IIF": "int:3", + "RTA_MAX": "int:16", + "RTA_METRICS": "int:8", + "RTA_MULTIPATH": "int:9", + "RTA_OIF": "int:4", + "RTA_PREFSRC": "int:7", + "RTA_PRIORITY": "int:6", + "RTA_SRC": "int:2", + "RTA_TABLE": "int:15", + "RTA_UNSPEC": "int:0", + "RTCF_DIRECTSRC": "int:67108864", + "RTCF_DOREDIRECT": "int:16777216", + "RTCF_LOG": "int:33554432", + "RTCF_MASQ": "int:4194304", + "RTCF_NAT": "int:8388608", + "RTCF_VALVE": "int:2097152", + "RTF_ADDRCLASSMASK": "int:4160749568", + "RTF_ADDRCONF": "int:262144", + "RTF_ALLONLINK": "int:131072", + "RTF_BROADCAST": "int:268435456", + "RTF_CACHE": "int:16777216", + "RTF_DEFAULT": "int:65536", + "RTF_DYNAMIC": "int:16", + "RTF_FLOW": "int:33554432", + "RTF_GATEWAY": "int:2", + "RTF_HOST": "int:4", + "RTF_INTERFACE": "int:1073741824", + "RTF_IRTT": "int:256", + "RTF_LINKRT": "int:1048576", + "RTF_LOCAL": "int:2147483648", + "RTF_MODIFIED": "int:32", + "RTF_MSS": "int:64", + "RTF_MTU": "int:64", + "RTF_MULTICAST": "int:536870912", + "RTF_NAT": "int:134217728", + "RTF_NOFORWARD": "int:4096", + "RTF_NONEXTHOP": "int:2097152", + "RTF_NOPMTUDISC": "int:16384", + "RTF_POLICY": "int:67108864", + "RTF_REINSTATE": "int:8", + "RTF_REJECT": "int:512", + "RTF_STATIC": "int:1024", + "RTF_THROW": "int:8192", + "RTF_UP": "int:1", + "RTF_WINDOW": "int:128", + "RTF_XRESOLVE": "int:2048", + "RTM_BASE": "int:16", + "RTM_DELACTION": "int:49", + "RTM_DELADDR": "int:21", + "RTM_DELADDRLABEL": "int:73", + "RTM_DELLINK": "int:17", + "RTM_DELNEIGH": "int:29", + "RTM_DELQDISC": "int:37", + "RTM_DELROUTE": "int:25", + "RTM_DELRULE": "int:33", + "RTM_DELTCLASS": "int:41", + "RTM_DELTFILTER": "int:45", + "RTM_F_CLONED": "int:512", + "RTM_F_EQUALIZE": "int:1024", + "RTM_F_NOTIFY": "int:256", + "RTM_F_PREFIX": "int:2048", + "RTM_GETACTION": "int:50", + "RTM_GETADDR": "int:22", + "RTM_GETADDRLABEL": "int:74", + "RTM_GETANYCAST": "int:62", + "RTM_GETDCB": "int:78", + "RTM_GETLINK": "int:18", + "RTM_GETMULTICAST": "int:58", + "RTM_GETNEIGH": "int:30", + "RTM_GETNEIGHTBL": "int:66", + "RTM_GETQDISC": "int:38", + "RTM_GETROUTE": "int:26", + "RTM_GETRULE": "int:34", + "RTM_GETTCLASS": "int:42", + "RTM_GETTFILTER": "int:46", + "RTM_MAX": "int:79", + "RTM_NEWACTION": "int:48", + "RTM_NEWADDR": "int:20", + "RTM_NEWADDRLABEL": "int:72", + "RTM_NEWLINK": "int:16", + "RTM_NEWNDUSEROPT": "int:68", + "RTM_NEWNEIGH": "int:28", + "RTM_NEWNEIGHTBL": "int:64", + "RTM_NEWPREFIX": "int:52", + "RTM_NEWQDISC": "int:36", + "RTM_NEWROUTE": "int:24", + "RTM_NEWRULE": "int:32", + "RTM_NEWTCLASS": "int:40", + "RTM_NEWTFILTER": "int:44", + "RTM_NR_FAMILIES": "int:16", + "RTM_NR_MSGTYPES": "int:64", + "RTM_SETDCB": "int:79", + "RTM_SETLINK": "int:19", + "RTM_SETNEIGHTBL": "int:67", + "RTNH_ALIGNTO": "int:4", + "RTNH_F_DEAD": "int:1", + "RTNH_F_ONLINK": "int:4", + "RTNH_F_PERVASIVE": "int:2", + "RTNLGRP_IPV4_IFADDR": "int:5", + "RTNLGRP_IPV4_MROUTE": "int:6", + "RTNLGRP_IPV4_ROUTE": "int:7", + "RTNLGRP_IPV4_RULE": "int:8", + "RTNLGRP_IPV6_IFADDR": "int:9", + "RTNLGRP_IPV6_IFINFO": "int:12", + "RTNLGRP_IPV6_MROUTE": "int:10", + "RTNLGRP_IPV6_PREFIX": "int:18", + "RTNLGRP_IPV6_ROUTE": "int:11", + "RTNLGRP_IPV6_RULE": "int:19", + "RTNLGRP_LINK": "int:1", + "RTNLGRP_ND_USEROPT": "int:20", + "RTNLGRP_NEIGH": "int:3", + "RTNLGRP_NONE": "int:0", + "RTNLGRP_NOTIFY": "int:2", + "RTNLGRP_TC": "int:4", + "RTN_ANYCAST": "int:4", + "RTN_BLACKHOLE": "int:6", + "RTN_BROADCAST": "int:3", + "RTN_LOCAL": "int:2", + "RTN_MAX": "int:11", + "RTN_MULTICAST": "int:5", + "RTN_NAT": "int:10", + "RTN_PROHIBIT": "int:8", + "RTN_THROW": "int:9", + "RTN_UNICAST": "int:1", + "RTN_UNREACHABLE": "int:7", + "RTN_UNSPEC": "int:0", + "RTN_XRESOLVE": "int:11", + "RTPROT_BIRD": "int:12", + "RTPROT_BOOT": "int:3", + "RTPROT_DHCP": "int:16", + "RTPROT_DNROUTED": "int:13", + "RTPROT_GATED": "int:8", + "RTPROT_KERNEL": "int:2", + "RTPROT_MRT": "int:10", + "RTPROT_NTK": "int:15", + "RTPROT_RA": "int:9", + "RTPROT_REDIRECT": "int:1", + "RTPROT_STATIC": "int:4", + "RTPROT_UNSPEC": "int:0", + "RTPROT_XORP": "int:14", + "RTPROT_ZEBRA": "int:11", + "RT_CLASS_DEFAULT": "int:253", + "RT_CLASS_LOCAL": "int:255", + "RT_CLASS_MAIN": "int:254", + "RT_CLASS_MAX": "int:255", + "RT_CLASS_UNSPEC": "int:0", + "RT_SCOPE_HOST": "int:254", + "RT_SCOPE_LINK": "int:253", + "RT_SCOPE_NOWHERE": "int:255", + "RT_SCOPE_SITE": "int:200", + "RT_SCOPE_UNIVERSE": "int:0", + "RT_TABLE_COMPAT": "int:252", + "RT_TABLE_DEFAULT": "int:253", + "RT_TABLE_LOCAL": "int:255", + "RT_TABLE_MAIN": "int:254", + "RT_TABLE_MAX": "int:4294967295", + "RT_TABLE_UNSPEC": "int:0", + "RUSAGE_CHILDREN": "int:-1", + "RUSAGE_SELF": "int:0", + "RUSAGE_THREAD": "int:1", + "SCM_CREDENTIALS": "int:2", + "SCM_RIGHTS": "int:1", + "SCM_TIMESTAMP": "int:29", + "SCM_TIMESTAMPING": "int:37", + "SCM_TIMESTAMPNS": "int:35", + "SHUT_RD": "int:0", + "SHUT_RDWR": "int:2", + "SHUT_WR": "int:1", + "SIOCADDDLCI": "int:35200", + "SIOCADDMULTI": "int:35121", + "SIOCADDRT": "int:35083", + "SIOCATMARK": "int:35077", + "SIOCDARP": "int:35155", + "SIOCDELDLCI": "int:35201", + "SIOCDELMULTI": "int:35122", + "SIOCDELRT": "int:35084", + "SIOCDEVPRIVATE": "int:35312", + "SIOCDIFADDR": "int:35126", + "SIOCDRARP": "int:35168", + "SIOCGARP": "int:35156", + "SIOCGIFADDR": "int:35093", + "SIOCGIFBR": "int:35136", + "SIOCGIFBRDADDR": "int:35097", + "SIOCGIFCONF": "int:35090", + "SIOCGIFCOUNT": "int:35128", + "SIOCGIFDSTADDR": "int:35095", + "SIOCGIFENCAP": "int:35109", + "SIOCGIFFLAGS": "int:35091", + "SIOCGIFHWADDR": "int:35111", + "SIOCGIFINDEX": "int:35123", + "SIOCGIFMAP": "int:35184", + "SIOCGIFMEM": "int:35103", + "SIOCGIFMETRIC": "int:35101", + "SIOCGIFMTU": "int:35105", + "SIOCGIFNAME": "int:35088", + "SIOCGIFNETMASK": "int:35099", + "SIOCGIFPFLAGS": "int:35125", + "SIOCGIFSLAVE": "int:35113", + "SIOCGIFTXQLEN": "int:35138", + "SIOCGPGRP": "int:35076", + "SIOCGRARP": "int:35169", + "SIOCGSTAMP": "int:35078", + "SIOCGSTAMPNS": "int:35079", + "SIOCPROTOPRIVATE": "int:35296", + "SIOCRTMSG": "int:35085", + "SIOCSARP": "int:35157", + "SIOCSIFADDR": "int:35094", + "SIOCSIFBR": "int:35137", + "SIOCSIFBRDADDR": "int:35098", + "SIOCSIFDSTADDR": "int:35096", + "SIOCSIFENCAP": "int:35110", + "SIOCSIFFLAGS": "int:35092", + "SIOCSIFHWADDR": "int:35108", + "SIOCSIFHWBROADCAST": "int:35127", + "SIOCSIFLINK": "int:35089", + "SIOCSIFMAP": "int:35185", + "SIOCSIFMEM": "int:35104", + "SIOCSIFMETRIC": "int:35102", + "SIOCSIFMTU": "int:35106", + "SIOCSIFNAME": "int:35107", + "SIOCSIFNETMASK": "int:35100", + "SIOCSIFPFLAGS": "int:35124", + "SIOCSIFSLAVE": "int:35120", + "SIOCSIFTXQLEN": "int:35139", + "SIOCSPGRP": "int:35074", + "SIOCSRARP": "int:35170", + "SOCK_CLOEXEC": "int:524288", + "SOCK_DCCP": "int:6", + "SOCK_DGRAM": "int:2", + "SOCK_NONBLOCK": "int:2048", + "SOCK_PACKET": "int:10", + "SOCK_RAW": "int:3", + "SOCK_RDM": "int:4", + "SOCK_SEQPACKET": "int:5", + "SOCK_STREAM": "int:1", + "SOL_AAL": "int:265", + "SOL_ATM": "int:264", + "SOL_DECNET": "int:261", + "SOL_ICMPV6": "int:58", + "SOL_IP": "int:0", + "SOL_IPV6": "int:41", + "SOL_IRDA": "int:266", + "SOL_PACKET": "int:263", + "SOL_RAW": "int:255", + "SOL_SOCKET": "int:1", + "SOL_TCP": "int:6", + "SOL_X25": "int:262", + "SOMAXCONN": "int:128", + "SO_ACCEPTCONN": "int:30", + "SO_ATTACH_FILTER": "int:26", + "SO_BINDTODEVICE": "int:25", + "SO_BROADCAST": "int:6", + "SO_BSDCOMPAT": "int:14", + "SO_DEBUG": "int:1", + "SO_DETACH_FILTER": "int:27", + "SO_DOMAIN": "int:39", + "SO_DONTROUTE": "int:5", + "SO_ERROR": "int:4", + "SO_KEEPALIVE": "int:9", + "SO_LINGER": "int:13", + "SO_MARK": "int:36", + "SO_NO_CHECK": "int:11", + "SO_OOBINLINE": "int:10", + "SO_PASSCRED": "int:16", + "SO_PASSSEC": "int:34", + "SO_PEERCRED": "int:17", + "SO_PEERNAME": "int:28", + "SO_PEERSEC": "int:31", + "SO_PRIORITY": "int:12", + "SO_PROTOCOL": "int:38", + "SO_RCVBUF": "int:8", + "SO_RCVBUFFORCE": "int:33", + "SO_RCVLOWAT": "int:18", + "SO_RCVTIMEO": "int:20", + "SO_REUSEADDR": "int:2", + "SO_RXQ_OVFL": "int:40", + "SO_SECURITY_AUTHENTICATION": "int:22", + "SO_SECURITY_ENCRYPTION_NETWORK": "int:24", + "SO_SECURITY_ENCRYPTION_TRANSPORT": "int:23", + "SO_SNDBUF": "int:7", + "SO_SNDBUFFORCE": "int:32", + "SO_SNDLOWAT": "int:19", + "SO_SNDTIMEO": "int:21", + "SO_TIMESTAMP": "int:29", + "SO_TIMESTAMPING": "int:37", + "SO_TIMESTAMPNS": "int:35", + "SO_TYPE": "int:3", + "SYS_ACCESS": "int:33", + "SYS_ACCT": "int:51", + "SYS_ADD_KEY": "int:286", + "SYS_ADJTIMEX": "int:124", + "SYS_AFS_SYSCALL": "int:137", + "SYS_ALARM": "int:27", + "SYS_BDFLUSH": "int:134", + "SYS_BREAK": "int:17", + "SYS_BRK": "int:45", + "SYS_CAPGET": "int:184", + "SYS_CAPSET": "int:185", + "SYS_CHDIR": "int:12", + "SYS_CHMOD": "int:15", + "SYS_CHOWN": "int:182", + "SYS_CHOWN32": "int:212", + "SYS_CHROOT": "int:61", + "SYS_CLOCK_GETRES": "int:266", + "SYS_CLOCK_GETTIME": "int:265", + "SYS_CLOCK_NANOSLEEP": "int:267", + "SYS_CLOCK_SETTIME": "int:264", + "SYS_CLONE": "int:120", + "SYS_CLOSE": "int:6", + "SYS_CREAT": "int:8", + "SYS_CREATE_MODULE": "int:127", + "SYS_DELETE_MODULE": "int:129", + "SYS_DUP": "int:41", + "SYS_DUP2": "int:63", + "SYS_DUP3": "int:330", + "SYS_EPOLL_CREATE": "int:254", + "SYS_EPOLL_CREATE1": "int:329", + "SYS_EPOLL_CTL": "int:255", + "SYS_EPOLL_PWAIT": "int:319", + "SYS_EPOLL_WAIT": "int:256", + "SYS_EVENTFD": "int:323", + "SYS_EVENTFD2": "int:328", + "SYS_EXECVE": "int:11", + "SYS_EXIT": "int:1", + "SYS_EXIT_GROUP": "int:252", + "SYS_FACCESSAT": "int:307", + "SYS_FADVISE64": "int:250", + "SYS_FADVISE64_64": "int:272", + "SYS_FALLOCATE": "int:324", + "SYS_FANOTIFY_INIT": "int:338", + "SYS_FANOTIFY_MARK": "int:339", + "SYS_FCHDIR": "int:133", + "SYS_FCHMOD": "int:94", + "SYS_FCHMODAT": "int:306", + "SYS_FCHOWN": "int:95", + "SYS_FCHOWN32": "int:207", + "SYS_FCHOWNAT": "int:298", + "SYS_FCNTL": "int:55", + "SYS_FCNTL64": "int:221", + "SYS_FDATASYNC": "int:148", + "SYS_FGETXATTR": "int:231", + "SYS_FLISTXATTR": "int:234", + "SYS_FLOCK": "int:143", + "SYS_FORK": "int:2", + "SYS_FREMOVEXATTR": "int:237", + "SYS_FSETXATTR": "int:228", + "SYS_FSTAT": "int:108", + "SYS_FSTAT64": "int:197", + "SYS_FSTATAT64": "int:300", + "SYS_FSTATFS": "int:100", + "SYS_FSTATFS64": "int:269", + "SYS_FSYNC": "int:118", + "SYS_FTIME": "int:35", + "SYS_FTRUNCATE": "int:93", + "SYS_FTRUNCATE64": "int:194", + "SYS_FUTEX": "int:240", + "SYS_FUTIMESAT": "int:299", + "SYS_GETCPU": "int:318", + "SYS_GETCWD": "int:183", + "SYS_GETDENTS": "int:141", + "SYS_GETDENTS64": "int:220", + "SYS_GETEGID": "int:50", + "SYS_GETEGID32": "int:202", + "SYS_GETEUID": "int:49", + "SYS_GETEUID32": "int:201", + "SYS_GETGID": "int:47", + "SYS_GETGID32": "int:200", + "SYS_GETGROUPS": "int:80", + "SYS_GETGROUPS32": "int:205", + "SYS_GETITIMER": "int:105", + "SYS_GETPGID": "int:132", + "SYS_GETPGRP": "int:65", + "SYS_GETPID": "int:20", + "SYS_GETPMSG": "int:188", + "SYS_GETPPID": "int:64", + "SYS_GETPRIORITY": "int:96", + "SYS_GETRESGID": "int:171", + "SYS_GETRESGID32": "int:211", + "SYS_GETRESUID": "int:165", + "SYS_GETRESUID32": "int:209", + "SYS_GETRLIMIT": "int:76", + "SYS_GETRUSAGE": "int:77", + "SYS_GETSID": "int:147", + "SYS_GETTID": "int:224", + "SYS_GETTIMEOFDAY": "int:78", + "SYS_GETUID": "int:24", + "SYS_GETUID32": "int:199", + "SYS_GETXATTR": "int:229", + "SYS_GET_KERNEL_SYMS": "int:130", + "SYS_GET_MEMPOLICY": "int:275", + "SYS_GET_ROBUST_LIST": "int:312", + "SYS_GET_THREAD_AREA": "int:244", + "SYS_GTTY": "int:32", + "SYS_IDLE": "int:112", + "SYS_INIT_MODULE": "int:128", + "SYS_INOTIFY_ADD_WATCH": "int:292", + "SYS_INOTIFY_INIT": "int:291", + "SYS_INOTIFY_INIT1": "int:332", + "SYS_INOTIFY_RM_WATCH": "int:293", + "SYS_IOCTL": "int:54", + "SYS_IOPERM": "int:101", + "SYS_IOPL": "int:110", + "SYS_IOPRIO_GET": "int:290", + "SYS_IOPRIO_SET": "int:289", + "SYS_IO_CANCEL": "int:249", + "SYS_IO_DESTROY": "int:246", + "SYS_IO_GETEVENTS": "int:247", + "SYS_IO_SETUP": "int:245", + "SYS_IO_SUBMIT": "int:248", + "SYS_IPC": "int:117", + "SYS_KEXEC_LOAD": "int:283", + "SYS_KEYCTL": "int:288", + "SYS_KILL": "int:37", + "SYS_LCHOWN": "int:16", + "SYS_LCHOWN32": "int:198", + "SYS_LGETXATTR": "int:230", + "SYS_LINK": "int:9", + "SYS_LINKAT": "int:303", + "SYS_LISTXATTR": "int:232", + "SYS_LLISTXATTR": "int:233", + "SYS_LOCK": "int:53", + "SYS_LOOKUP_DCOOKIE": "int:253", + "SYS_LREMOVEXATTR": "int:236", + "SYS_LSEEK": "int:19", + "SYS_LSETXATTR": "int:227", + "SYS_LSTAT": "int:107", + "SYS_LSTAT64": "int:196", + "SYS_MADVISE": "int:219", + "SYS_MADVISE1": "int:219", + "SYS_MBIND": "int:274", + "SYS_MIGRATE_PAGES": "int:294", + "SYS_MINCORE": "int:218", + "SYS_MKDIR": "int:39", + "SYS_MKDIRAT": "int:296", + "SYS_MKNOD": "int:14", + "SYS_MKNODAT": "int:297", + "SYS_MLOCK": "int:150", + "SYS_MLOCKALL": "int:152", + "SYS_MMAP": "int:90", + "SYS_MMAP2": "int:192", + "SYS_MODIFY_LDT": "int:123", + "SYS_MOUNT": "int:21", + "SYS_MOVE_PAGES": "int:317", + "SYS_MPROTECT": "int:125", + "SYS_MPX": "int:56", + "SYS_MQ_GETSETATTR": "int:282", + "SYS_MQ_NOTIFY": "int:281", + "SYS_MQ_OPEN": "int:277", + "SYS_MQ_TIMEDRECEIVE": "int:280", + "SYS_MQ_TIMEDSEND": "int:279", + "SYS_MQ_UNLINK": "int:278", + "SYS_MREMAP": "int:163", + "SYS_MSYNC": "int:144", + "SYS_MUNLOCK": "int:151", + "SYS_MUNLOCKALL": "int:153", + "SYS_MUNMAP": "int:91", + "SYS_NANOSLEEP": "int:162", + "SYS_NFSSERVCTL": "int:169", + "SYS_NICE": "int:34", + "SYS_OLDFSTAT": "int:28", + "SYS_OLDLSTAT": "int:84", + "SYS_OLDOLDUNAME": "int:59", + "SYS_OLDSTAT": "int:18", + "SYS_OLDUNAME": "int:109", + "SYS_OPEN": "int:5", + "SYS_OPENAT": "int:295", + "SYS_PAUSE": "int:29", + "SYS_PERF_EVENT_OPEN": "int:336", + "SYS_PERSONALITY": "int:136", + "SYS_PIPE": "int:42", + "SYS_PIPE2": "int:331", + "SYS_PIVOT_ROOT": "int:217", + "SYS_POLL": "int:168", + "SYS_PPOLL": "int:309", + "SYS_PRCTL": "int:172", + "SYS_PREAD64": "int:180", + "SYS_PREADV": "int:333", + "SYS_PRLIMIT64": "int:340", + "SYS_PROF": "int:44", + "SYS_PROFIL": "int:98", + "SYS_PSELECT6": "int:308", + "SYS_PTRACE": "int:26", + "SYS_PUTPMSG": "int:189", + "SYS_PWRITE64": "int:181", + "SYS_PWRITEV": "int:334", + "SYS_QUERY_MODULE": "int:167", + "SYS_QUOTACTL": "int:131", + "SYS_READ": "int:3", + "SYS_READAHEAD": "int:225", + "SYS_READDIR": "int:89", + "SYS_READLINK": "int:85", + "SYS_READLINKAT": "int:305", + "SYS_READV": "int:145", + "SYS_REBOOT": "int:88", + "SYS_RECVMMSG": "int:337", + "SYS_REMAP_FILE_PAGES": "int:257", + "SYS_REMOVEXATTR": "int:235", + "SYS_RENAME": "int:38", + "SYS_RENAMEAT": "int:302", + "SYS_REQUEST_KEY": "int:287", + "SYS_RESTART_SYSCALL": "int:0", + "SYS_RMDIR": "int:40", + "SYS_RT_SIGACTION": "int:174", + "SYS_RT_SIGPENDING": "int:176", + "SYS_RT_SIGPROCMASK": "int:175", + "SYS_RT_SIGQUEUEINFO": "int:178", + "SYS_RT_SIGRETURN": "int:173", + "SYS_RT_SIGSUSPEND": "int:179", + "SYS_RT_SIGTIMEDWAIT": "int:177", + "SYS_RT_TGSIGQUEUEINFO": "int:335", + "SYS_SCHED_GETAFFINITY": "int:242", + "SYS_SCHED_GETPARAM": "int:155", + "SYS_SCHED_GETSCHEDULER": "int:157", + "SYS_SCHED_GET_PRIORITY_MAX": "int:159", + "SYS_SCHED_GET_PRIORITY_MIN": "int:160", + "SYS_SCHED_RR_GET_INTERVAL": "int:161", + "SYS_SCHED_SETAFFINITY": "int:241", + "SYS_SCHED_SETPARAM": "int:154", + "SYS_SCHED_SETSCHEDULER": "int:156", + "SYS_SCHED_YIELD": "int:158", + "SYS_SELECT": "int:82", + "SYS_SENDFILE": "int:187", + "SYS_SENDFILE64": "int:239", + "SYS_SETDOMAINNAME": "int:121", + "SYS_SETFSGID": "int:139", + "SYS_SETFSGID32": "int:216", + "SYS_SETFSUID": "int:138", + "SYS_SETFSUID32": "int:215", + "SYS_SETGID": "int:46", + "SYS_SETGID32": "int:214", + "SYS_SETGROUPS": "int:81", + "SYS_SETGROUPS32": "int:206", + "SYS_SETHOSTNAME": "int:74", + "SYS_SETITIMER": "int:104", + "SYS_SETPGID": "int:57", + "SYS_SETPRIORITY": "int:97", + "SYS_SETREGID": "int:71", + "SYS_SETREGID32": "int:204", + "SYS_SETRESGID": "int:170", + "SYS_SETRESGID32": "int:210", + "SYS_SETRESUID": "int:164", + "SYS_SETRESUID32": "int:208", + "SYS_SETREUID": "int:70", + "SYS_SETREUID32": "int:203", + "SYS_SETRLIMIT": "int:75", + "SYS_SETSID": "int:66", + "SYS_SETTIMEOFDAY": "int:79", + "SYS_SETUID": "int:23", + "SYS_SETUID32": "int:213", + "SYS_SETXATTR": "int:226", + "SYS_SET_MEMPOLICY": "int:276", + "SYS_SET_ROBUST_LIST": "int:311", + "SYS_SET_THREAD_AREA": "int:243", + "SYS_SET_TID_ADDRESS": "int:258", + "SYS_SGETMASK": "int:68", + "SYS_SIGACTION": "int:67", + "SYS_SIGALTSTACK": "int:186", + "SYS_SIGNAL": "int:48", + "SYS_SIGNALFD": "int:321", + "SYS_SIGNALFD4": "int:327", + "SYS_SIGPENDING": "int:73", + "SYS_SIGPROCMASK": "int:126", + "SYS_SIGRETURN": "int:119", + "SYS_SIGSUSPEND": "int:72", + "SYS_SOCKETCALL": "int:102", + "SYS_SPLICE": "int:313", + "SYS_SSETMASK": "int:69", + "SYS_STAT": "int:106", + "SYS_STAT64": "int:195", + "SYS_STATFS": "int:99", + "SYS_STATFS64": "int:268", + "SYS_STIME": "int:25", + "SYS_STTY": "int:31", + "SYS_SWAPOFF": "int:115", + "SYS_SWAPON": "int:87", + "SYS_SYMLINK": "int:83", + "SYS_SYMLINKAT": "int:304", + "SYS_SYNC": "int:36", + "SYS_SYNC_FILE_RANGE": "int:314", + "SYS_SYSFS": "int:135", + "SYS_SYSINFO": "int:116", + "SYS_SYSLOG": "int:103", + "SYS_TEE": "int:315", + "SYS_TGKILL": "int:270", + "SYS_TIME": "int:13", + "SYS_TIMERFD_CREATE": "int:322", + "SYS_TIMERFD_GETTIME": "int:326", + "SYS_TIMERFD_SETTIME": "int:325", + "SYS_TIMER_CREATE": "int:259", + "SYS_TIMER_DELETE": "int:263", + "SYS_TIMER_GETOVERRUN": "int:262", + "SYS_TIMER_GETTIME": "int:261", + "SYS_TIMER_SETTIME": "int:260", + "SYS_TIMES": "int:43", + "SYS_TKILL": "int:238", + "SYS_TRUNCATE": "int:92", + "SYS_TRUNCATE64": "int:193", + "SYS_UGETRLIMIT": "int:191", + "SYS_ULIMIT": "int:58", + "SYS_UMASK": "int:60", + "SYS_UMOUNT": "int:22", + "SYS_UMOUNT2": "int:52", + "SYS_UNAME": "int:122", + "SYS_UNLINK": "int:10", + "SYS_UNLINKAT": "int:301", + "SYS_UNSHARE": "int:310", + "SYS_USELIB": "int:86", + "SYS_USTAT": "int:62", + "SYS_UTIME": "int:30", + "SYS_UTIMENSAT": "int:320", + "SYS_UTIMES": "int:271", + "SYS_VFORK": "int:190", + "SYS_VHANGUP": "int:111", + "SYS_VM86": "int:166", + "SYS_VM86OLD": "int:113", + "SYS_VMSPLICE": "int:316", + "SYS_VSERVER": "int:273", + "SYS_WAIT4": "int:114", + "SYS_WAITID": "int:284", + "SYS_WAITPID": "int:7", + "SYS_WRITE": "int:4", + "SYS_WRITEV": "int:146", + "SYS__LLSEEK": "int:140", + "SYS__NEWSELECT": "int:142", + "SYS__SYSCTL": "int:149", + "S_BLKSIZE": "int:512", + "S_IEXEC": "int:64", + "S_IFBLK": "int:24576", + "S_IFCHR": "int:8192", + "S_IFDIR": "int:16384", + "S_IFIFO": "int:4096", + "S_IFLNK": "int:40960", + "S_IFMT": "int:61440", + "S_IFREG": "int:32768", + "S_IFSOCK": "int:49152", + "S_IREAD": "int:256", + "S_IRGRP": "int:32", + "S_IROTH": "int:4", + "S_IRUSR": "int:256", + "S_IRWXG": "int:56", + "S_IRWXO": "int:7", + "S_IRWXU": "int:448", + "S_ISGID": "int:1024", + "S_ISUID": "int:2048", + "S_ISVTX": "int:512", + "S_IWGRP": "int:16", + "S_IWOTH": "int:2", + "S_IWRITE": "int:128", + "S_IWUSR": "int:128", + "S_IXGRP": "int:8", + "S_IXOTH": "int:1", + "S_IXUSR": "int:64", + "SizeofCmsghdr": "int:12", + "SizeofICMPv6Filter": "int:32", + "SizeofIPMreq": "int:8", + "SizeofIPMreqn": "int:12", + "SizeofIPv6MTUInfo": "int:32", + "SizeofIPv6Mreq": "int:20", + "SizeofIfAddrmsg": "int:8", + "SizeofIfInfomsg": "int:16", + "SizeofInet4Pktinfo": "int:12", + "SizeofInet6Pktinfo": "int:20", + "SizeofInotifyEvent": "int:16", + "SizeofLinger": "int:8", + "SizeofMsghdr": "int:28", + "SizeofNlAttr": "int:4", + "SizeofNlMsgerr": "int:20", + "SizeofNlMsghdr": "int:16", + "SizeofRtAttr": "int:4", + "SizeofRtGenmsg": "int:1", + "SizeofRtMsg": "int:12", + "SizeofRtNexthop": "int:8", + "SizeofSockFilter": "int:8", + "SizeofSockFprog": "int:8", + "SizeofSockaddrAny": "int:112", + "SizeofSockaddrInet4": "int:16", + "SizeofSockaddrInet6": "int:28", + "SizeofSockaddrLinklayer": "int:20", + "SizeofSockaddrNetlink": "int:12", + "SizeofSockaddrUnix": "int:110", + "SizeofTCPInfo": "int:104", + "SizeofUcred": "int:12", + "TCGETS": "int:21505", + "TCIFLUSH": "int:0", + "TCIOFLUSH": "int:2", + "TCOFLUSH": "int:1", + "TCP_CONGESTION": "int:13", + "TCP_CORK": "int:3", + "TCP_DEFER_ACCEPT": "int:9", + "TCP_INFO": "int:11", + "TCP_KEEPCNT": "int:6", + "TCP_KEEPIDLE": "int:4", + "TCP_KEEPINTVL": "int:5", + "TCP_LINGER2": "int:8", + "TCP_MAXSEG": "int:2", + "TCP_MAXWIN": "int:65535", + "TCP_MAX_WINSHIFT": "int:14", + "TCP_MD5SIG": "int:14", + "TCP_MD5SIG_MAXKEYLEN": "int:80", + "TCP_MSS": "int:512", + "TCP_NODELAY": "int:1", + "TCP_QUICKACK": "int:12", + "TCP_SYNCNT": "int:7", + "TCP_WINDOW_CLAMP": "int:10", + "TCSETS": "int:21506", + "TIOCCBRK": "int:21544", + "TIOCCONS": "int:21533", + "TIOCEXCL": "int:21516", + "TIOCGDEV": "int:2147767346", + "TIOCGETD": "int:21540", + "TIOCGICOUNT": "int:21597", + "TIOCGLCKTRMIOS": "int:21590", + "TIOCGPGRP": "int:21519", + "TIOCGPTN": "int:2147767344", + "TIOCGRS485": "int:21550", + "TIOCGSERIAL": "int:21534", + "TIOCGSID": "int:21545", + "TIOCGSOFTCAR": "int:21529", + "TIOCGWINSZ": "int:21523", + "TIOCINQ": "int:21531", + "TIOCLINUX": "int:21532", + "TIOCMBIC": "int:21527", + "TIOCMBIS": "int:21526", + "TIOCMGET": "int:21525", + "TIOCMIWAIT": "int:21596", + "TIOCMSET": "int:21528", + "TIOCM_CAR": "int:64", + "TIOCM_CD": "int:64", + "TIOCM_CTS": "int:32", + "TIOCM_DSR": "int:256", + "TIOCM_DTR": "int:2", + "TIOCM_LE": "int:1", + "TIOCM_RI": "int:128", + "TIOCM_RNG": "int:128", + "TIOCM_RTS": "int:4", + "TIOCM_SR": "int:16", + "TIOCM_ST": "int:8", + "TIOCNOTTY": "int:21538", + "TIOCNXCL": "int:21517", + "TIOCOUTQ": "int:21521", + "TIOCPKT": "int:21536", + "TIOCPKT_DATA": "int:0", + "TIOCPKT_DOSTOP": "int:32", + "TIOCPKT_FLUSHREAD": "int:1", + "TIOCPKT_FLUSHWRITE": "int:2", + "TIOCPKT_IOCTL": "int:64", + "TIOCPKT_NOSTOP": "int:16", + "TIOCPKT_START": "int:8", + "TIOCPKT_STOP": "int:4", + "TIOCSBRK": "int:21543", + "TIOCSCTTY": "int:21518", + "TIOCSERCONFIG": "int:21587", + "TIOCSERGETLSR": "int:21593", + "TIOCSERGETMULTI": "int:21594", + "TIOCSERGSTRUCT": "int:21592", + "TIOCSERGWILD": "int:21588", + "TIOCSERSETMULTI": "int:21595", + "TIOCSERSWILD": "int:21589", + "TIOCSER_TEMT": "int:1", + "TIOCSETD": "int:21539", + "TIOCSIG": "int:1074025526", + "TIOCSLCKTRMIOS": "int:21591", + "TIOCSPGRP": "int:21520", + "TIOCSPTLCK": "int:1074025521", + "TIOCSRS485": "int:21551", + "TIOCSSERIAL": "int:21535", + "TIOCSSOFTCAR": "int:21530", + "TIOCSTI": "int:21522", + "TIOCSWINSZ": "int:21524", + "TOSTOP": "int:256", + "TUNATTACHFILTER": "int:1074287829", + "TUNDETACHFILTER": "int:1074287830", + "TUNGETFEATURES": "int:2147767503", + "TUNGETIFF": "int:2147767506", + "TUNGETSNDBUF": "int:2147767507", + "TUNGETVNETHDRSZ": "int:2147767511", + "TUNSETDEBUG": "int:1074025673", + "TUNSETGROUP": "int:1074025678", + "TUNSETIFF": "int:1074025674", + "TUNSETLINK": "int:1074025677", + "TUNSETNOCSUM": "int:1074025672", + "TUNSETOFFLOAD": "int:1074025680", + "TUNSETOWNER": "int:1074025676", + "TUNSETPERSIST": "int:1074025675", + "TUNSETSNDBUF": "int:1074025684", + "TUNSETTXFILTER": "int:1074025681", + "TUNSETVNETHDRSZ": "int:1074025688", + "VDISCARD": "int:13", + "VEOF": "int:4", + "VEOL": "int:11", + "VEOL2": "int:16", + "VERASE": "int:2", + "VINTR": "int:0", + "VKILL": "int:3", + "VLNEXT": "int:15", + "VMIN": "int:6", + "VQUIT": "int:1", + "VREPRINT": "int:12", + "VSTART": "int:8", + "VSTOP": "int:9", + "VSUSP": "int:10", + "VSWTC": "int:7", + "VTIME": "int:5", + "VWERASE": "int:14", + "WALL": "int:1073741824", + "WCLONE": "int:2147483648", + "WCONTINUED": "int:8", + "WEXITED": "int:4", + "WNOHANG": "int:1", + "WNOTHREAD": "int:536870912", + "WNOWAIT": "int:16777216", + "WORDSIZE": "int:32", + "WSTOPPED": "int:2", + "WUNTRACED": "int:2", + "XCASE": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_amd64.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_amd64.go new file mode 100644 index 0000000..d3a6f88 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_amd64.go @@ -0,0 +1,3902 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +// reflection: allow interpreted code to import "syscall" +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_ALG": ValueOf(syscall.AF_ALG), + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ASH": ValueOf(syscall.AF_ASH), + "AF_ATMPVC": ValueOf(syscall.AF_ATMPVC), + "AF_ATMSVC": ValueOf(syscall.AF_ATMSVC), + "AF_AX25": ValueOf(syscall.AF_AX25), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_BRIDGE": ValueOf(syscall.AF_BRIDGE), + "AF_CAIF": ValueOf(syscall.AF_CAIF), + "AF_CAN": ValueOf(syscall.AF_CAN), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_ECONET": ValueOf(syscall.AF_ECONET), + "AF_FILE": ValueOf(syscall.AF_FILE), + "AF_IEEE802154": ValueOf(syscall.AF_IEEE802154), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_IRDA": ValueOf(syscall.AF_IRDA), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_IUCV": ValueOf(syscall.AF_IUCV), + "AF_KEY": ValueOf(syscall.AF_KEY), + "AF_LLC": ValueOf(syscall.AF_LLC), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NETBEUI": ValueOf(syscall.AF_NETBEUI), + "AF_NETLINK": ValueOf(syscall.AF_NETLINK), + "AF_NETROM": ValueOf(syscall.AF_NETROM), + "AF_PACKET": ValueOf(syscall.AF_PACKET), + "AF_PHONET": ValueOf(syscall.AF_PHONET), + "AF_PPPOX": ValueOf(syscall.AF_PPPOX), + "AF_RDS": ValueOf(syscall.AF_RDS), + "AF_ROSE": ValueOf(syscall.AF_ROSE), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_RXRPC": ValueOf(syscall.AF_RXRPC), + "AF_SECURITY": ValueOf(syscall.AF_SECURITY), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_TIPC": ValueOf(syscall.AF_TIPC), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_WANPIPE": ValueOf(syscall.AF_WANPIPE), + "AF_X25": ValueOf(syscall.AF_X25), + "ARPHRD_ADAPT": ValueOf(syscall.ARPHRD_ADAPT), + "ARPHRD_APPLETLK": ValueOf(syscall.ARPHRD_APPLETLK), + "ARPHRD_ARCNET": ValueOf(syscall.ARPHRD_ARCNET), + "ARPHRD_ASH": ValueOf(syscall.ARPHRD_ASH), + "ARPHRD_ATM": ValueOf(syscall.ARPHRD_ATM), + "ARPHRD_AX25": ValueOf(syscall.ARPHRD_AX25), + "ARPHRD_BIF": ValueOf(syscall.ARPHRD_BIF), + "ARPHRD_CHAOS": ValueOf(syscall.ARPHRD_CHAOS), + "ARPHRD_CISCO": ValueOf(syscall.ARPHRD_CISCO), + "ARPHRD_CSLIP": ValueOf(syscall.ARPHRD_CSLIP), + "ARPHRD_CSLIP6": ValueOf(syscall.ARPHRD_CSLIP6), + "ARPHRD_DDCMP": ValueOf(syscall.ARPHRD_DDCMP), + "ARPHRD_DLCI": ValueOf(syscall.ARPHRD_DLCI), + "ARPHRD_ECONET": ValueOf(syscall.ARPHRD_ECONET), + "ARPHRD_EETHER": ValueOf(syscall.ARPHRD_EETHER), + "ARPHRD_ETHER": ValueOf(syscall.ARPHRD_ETHER), + "ARPHRD_EUI64": ValueOf(syscall.ARPHRD_EUI64), + "ARPHRD_FCAL": ValueOf(syscall.ARPHRD_FCAL), + "ARPHRD_FCFABRIC": ValueOf(syscall.ARPHRD_FCFABRIC), + "ARPHRD_FCPL": ValueOf(syscall.ARPHRD_FCPL), + "ARPHRD_FCPP": ValueOf(syscall.ARPHRD_FCPP), + "ARPHRD_FDDI": ValueOf(syscall.ARPHRD_FDDI), + "ARPHRD_FRAD": ValueOf(syscall.ARPHRD_FRAD), + "ARPHRD_HDLC": ValueOf(syscall.ARPHRD_HDLC), + "ARPHRD_HIPPI": ValueOf(syscall.ARPHRD_HIPPI), + "ARPHRD_HWX25": ValueOf(syscall.ARPHRD_HWX25), + "ARPHRD_IEEE1394": ValueOf(syscall.ARPHRD_IEEE1394), + "ARPHRD_IEEE802": ValueOf(syscall.ARPHRD_IEEE802), + "ARPHRD_IEEE80211": ValueOf(syscall.ARPHRD_IEEE80211), + "ARPHRD_IEEE80211_PRISM": ValueOf(syscall.ARPHRD_IEEE80211_PRISM), + "ARPHRD_IEEE80211_RADIOTAP": ValueOf(syscall.ARPHRD_IEEE80211_RADIOTAP), + "ARPHRD_IEEE802154": ValueOf(syscall.ARPHRD_IEEE802154), + "ARPHRD_IEEE802154_PHY": ValueOf(syscall.ARPHRD_IEEE802154_PHY), + "ARPHRD_IEEE802_TR": ValueOf(syscall.ARPHRD_IEEE802_TR), + "ARPHRD_INFINIBAND": ValueOf(syscall.ARPHRD_INFINIBAND), + "ARPHRD_IPDDP": ValueOf(syscall.ARPHRD_IPDDP), + "ARPHRD_IPGRE": ValueOf(syscall.ARPHRD_IPGRE), + "ARPHRD_IRDA": ValueOf(syscall.ARPHRD_IRDA), + "ARPHRD_LAPB": ValueOf(syscall.ARPHRD_LAPB), + "ARPHRD_LOCALTLK": ValueOf(syscall.ARPHRD_LOCALTLK), + "ARPHRD_LOOPBACK": ValueOf(syscall.ARPHRD_LOOPBACK), + "ARPHRD_METRICOM": ValueOf(syscall.ARPHRD_METRICOM), + "ARPHRD_NETROM": ValueOf(syscall.ARPHRD_NETROM), + "ARPHRD_NONE": ValueOf(syscall.ARPHRD_NONE), + "ARPHRD_PIMREG": ValueOf(syscall.ARPHRD_PIMREG), + "ARPHRD_PPP": ValueOf(syscall.ARPHRD_PPP), + "ARPHRD_PRONET": ValueOf(syscall.ARPHRD_PRONET), + "ARPHRD_RAWHDLC": ValueOf(syscall.ARPHRD_RAWHDLC), + "ARPHRD_ROSE": ValueOf(syscall.ARPHRD_ROSE), + "ARPHRD_RSRVD": ValueOf(syscall.ARPHRD_RSRVD), + "ARPHRD_SIT": ValueOf(syscall.ARPHRD_SIT), + "ARPHRD_SKIP": ValueOf(syscall.ARPHRD_SKIP), + "ARPHRD_SLIP": ValueOf(syscall.ARPHRD_SLIP), + "ARPHRD_SLIP6": ValueOf(syscall.ARPHRD_SLIP6), + "ARPHRD_TUNNEL": ValueOf(syscall.ARPHRD_TUNNEL), + "ARPHRD_TUNNEL6": ValueOf(syscall.ARPHRD_TUNNEL6), + "ARPHRD_VOID": ValueOf(syscall.ARPHRD_VOID), + "ARPHRD_X25": ValueOf(syscall.ARPHRD_X25), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Acct": ValueOf(syscall.Acct), + "Adjtimex": ValueOf(syscall.Adjtimex), + "AttachLsf": ValueOf(syscall.AttachLsf), + "B0": ValueOf(syscall.B0), + "B1000000": ValueOf(syscall.B1000000), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1152000": ValueOf(syscall.B1152000), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B150": ValueOf(syscall.B150), + "B1500000": ValueOf(syscall.B1500000), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B2000000": ValueOf(syscall.B2000000), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B2500000": ValueOf(syscall.B2500000), + "B300": ValueOf(syscall.B300), + "B3000000": ValueOf(syscall.B3000000), + "B3500000": ValueOf(syscall.B3500000), + "B38400": ValueOf(syscall.B38400), + "B4000000": ValueOf(syscall.B4000000), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B500000": ValueOf(syscall.B500000), + "B57600": ValueOf(syscall.B57600), + "B576000": ValueOf(syscall.B576000), + "B600": ValueOf(syscall.B600), + "B75": ValueOf(syscall.B75), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BindToDevice": ValueOf(syscall.BindToDevice), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CLONE_CHILD_CLEARTID": ValueOf(syscall.CLONE_CHILD_CLEARTID), + "CLONE_CHILD_SETTID": ValueOf(syscall.CLONE_CHILD_SETTID), + "CLONE_DETACHED": ValueOf(syscall.CLONE_DETACHED), + "CLONE_FILES": ValueOf(syscall.CLONE_FILES), + "CLONE_FS": ValueOf(syscall.CLONE_FS), + "CLONE_IO": ValueOf(uint32(syscall.CLONE_IO)), + "CLONE_NEWIPC": ValueOf(syscall.CLONE_NEWIPC), + "CLONE_NEWNET": ValueOf(syscall.CLONE_NEWNET), + "CLONE_NEWNS": ValueOf(syscall.CLONE_NEWNS), + "CLONE_NEWPID": ValueOf(syscall.CLONE_NEWPID), + "CLONE_NEWUSER": ValueOf(syscall.CLONE_NEWUSER), + "CLONE_NEWUTS": ValueOf(syscall.CLONE_NEWUTS), + "CLONE_PARENT": ValueOf(syscall.CLONE_PARENT), + "CLONE_PARENT_SETTID": ValueOf(syscall.CLONE_PARENT_SETTID), + "CLONE_PTRACE": ValueOf(syscall.CLONE_PTRACE), + "CLONE_SETTLS": ValueOf(syscall.CLONE_SETTLS), + "CLONE_SIGHAND": ValueOf(syscall.CLONE_SIGHAND), + "CLONE_SYSVSEM": ValueOf(syscall.CLONE_SYSVSEM), + "CLONE_THREAD": ValueOf(syscall.CLONE_THREAD), + "CLONE_UNTRACED": ValueOf(syscall.CLONE_UNTRACED), + "CLONE_VFORK": ValueOf(syscall.CLONE_VFORK), + "CLONE_VM": ValueOf(syscall.CLONE_VM), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTOPB": ValueOf(syscall.CSTOPB), + "Chdir": ValueOf(syscall.Chdir), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "Creat": ValueOf(syscall.Creat), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "DetachLsf": ValueOf(syscall.DetachLsf), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "Dup3": ValueOf(syscall.Dup3), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EADV": ValueOf(syscall.EADV), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EBADE": ValueOf(syscall.EBADE), + "EBADF": ValueOf(syscall.EBADF), + "EBADFD": ValueOf(syscall.EBADFD), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADR": ValueOf(syscall.EBADR), + "EBADRQC": ValueOf(syscall.EBADRQC), + "EBADSLT": ValueOf(syscall.EBADSLT), + "EBFONT": ValueOf(syscall.EBFONT), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECHRNG": ValueOf(syscall.ECHRNG), + "ECOMM": ValueOf(syscall.ECOMM), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDEADLOCK": ValueOf(syscall.EDEADLOCK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOTDOT": ValueOf(syscall.EDOTDOT), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "EISNAM": ValueOf(syscall.EISNAM), + "EKEYEXPIRED": ValueOf(syscall.EKEYEXPIRED), + "EKEYREJECTED": ValueOf(syscall.EKEYREJECTED), + "EKEYREVOKED": ValueOf(syscall.EKEYREVOKED), + "EL2HLT": ValueOf(syscall.EL2HLT), + "EL2NSYNC": ValueOf(syscall.EL2NSYNC), + "EL3HLT": ValueOf(syscall.EL3HLT), + "EL3RST": ValueOf(syscall.EL3RST), + "ELIBACC": ValueOf(syscall.ELIBACC), + "ELIBBAD": ValueOf(syscall.ELIBBAD), + "ELIBEXEC": ValueOf(syscall.ELIBEXEC), + "ELIBMAX": ValueOf(syscall.ELIBMAX), + "ELIBSCN": ValueOf(syscall.ELIBSCN), + "ELNRNG": ValueOf(syscall.ELNRNG), + "ELOOP": ValueOf(syscall.ELOOP), + "EMEDIUMTYPE": ValueOf(syscall.EMEDIUMTYPE), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENAVAIL": ValueOf(syscall.ENAVAIL), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOANO": ValueOf(syscall.ENOANO), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENOCSI": ValueOf(syscall.ENOCSI), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOKEY": ValueOf(syscall.ENOKEY), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEDIUM": ValueOf(syscall.ENOMEDIUM), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENONET": ValueOf(syscall.ENONET), + "ENOPKG": ValueOf(syscall.ENOPKG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTNAM": ValueOf(syscall.ENOTNAM), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENOTUNIQ": ValueOf(syscall.ENOTUNIQ), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPOLLERR": ValueOf(syscall.EPOLLERR), + "EPOLLET": ValueOf(syscall.EPOLLET), + "EPOLLHUP": ValueOf(syscall.EPOLLHUP), + "EPOLLIN": ValueOf(syscall.EPOLLIN), + "EPOLLMSG": ValueOf(syscall.EPOLLMSG), + "EPOLLONESHOT": ValueOf(syscall.EPOLLONESHOT), + "EPOLLOUT": ValueOf(syscall.EPOLLOUT), + "EPOLLPRI": ValueOf(syscall.EPOLLPRI), + "EPOLLRDBAND": ValueOf(syscall.EPOLLRDBAND), + "EPOLLRDHUP": ValueOf(syscall.EPOLLRDHUP), + "EPOLLRDNORM": ValueOf(syscall.EPOLLRDNORM), + "EPOLLWRBAND": ValueOf(syscall.EPOLLWRBAND), + "EPOLLWRNORM": ValueOf(syscall.EPOLLWRNORM), + "EPOLL_CLOEXEC": ValueOf(syscall.EPOLL_CLOEXEC), + "EPOLL_CTL_ADD": ValueOf(syscall.EPOLL_CTL_ADD), + "EPOLL_CTL_DEL": ValueOf(syscall.EPOLL_CTL_DEL), + "EPOLL_CTL_MOD": ValueOf(syscall.EPOLL_CTL_MOD), + "EPOLL_NONBLOCK": ValueOf(syscall.EPOLL_NONBLOCK), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMCHG": ValueOf(syscall.EREMCHG), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EREMOTEIO": ValueOf(syscall.EREMOTEIO), + "ERESTART": ValueOf(syscall.ERESTART), + "ERFKILL": ValueOf(syscall.ERFKILL), + "EROFS": ValueOf(syscall.EROFS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESRMNT": ValueOf(syscall.ESRMNT), + "ESTALE": ValueOf(syscall.ESTALE), + "ESTRPIPE": ValueOf(syscall.ESTRPIPE), + "ETH_P_1588": ValueOf(syscall.ETH_P_1588), + "ETH_P_8021Q": ValueOf(syscall.ETH_P_8021Q), + "ETH_P_802_2": ValueOf(syscall.ETH_P_802_2), + "ETH_P_802_3": ValueOf(syscall.ETH_P_802_3), + "ETH_P_AARP": ValueOf(syscall.ETH_P_AARP), + "ETH_P_ALL": ValueOf(syscall.ETH_P_ALL), + "ETH_P_AOE": ValueOf(syscall.ETH_P_AOE), + "ETH_P_ARCNET": ValueOf(syscall.ETH_P_ARCNET), + "ETH_P_ARP": ValueOf(syscall.ETH_P_ARP), + "ETH_P_ATALK": ValueOf(syscall.ETH_P_ATALK), + "ETH_P_ATMFATE": ValueOf(syscall.ETH_P_ATMFATE), + "ETH_P_ATMMPOA": ValueOf(syscall.ETH_P_ATMMPOA), + "ETH_P_AX25": ValueOf(syscall.ETH_P_AX25), + "ETH_P_BPQ": ValueOf(syscall.ETH_P_BPQ), + "ETH_P_CAIF": ValueOf(syscall.ETH_P_CAIF), + "ETH_P_CAN": ValueOf(syscall.ETH_P_CAN), + "ETH_P_CONTROL": ValueOf(syscall.ETH_P_CONTROL), + "ETH_P_CUST": ValueOf(syscall.ETH_P_CUST), + "ETH_P_DDCMP": ValueOf(syscall.ETH_P_DDCMP), + "ETH_P_DEC": ValueOf(syscall.ETH_P_DEC), + "ETH_P_DIAG": ValueOf(syscall.ETH_P_DIAG), + "ETH_P_DNA_DL": ValueOf(syscall.ETH_P_DNA_DL), + "ETH_P_DNA_RC": ValueOf(syscall.ETH_P_DNA_RC), + "ETH_P_DNA_RT": ValueOf(syscall.ETH_P_DNA_RT), + "ETH_P_DSA": ValueOf(syscall.ETH_P_DSA), + "ETH_P_ECONET": ValueOf(syscall.ETH_P_ECONET), + "ETH_P_EDSA": ValueOf(syscall.ETH_P_EDSA), + "ETH_P_FCOE": ValueOf(syscall.ETH_P_FCOE), + "ETH_P_FIP": ValueOf(syscall.ETH_P_FIP), + "ETH_P_HDLC": ValueOf(syscall.ETH_P_HDLC), + "ETH_P_IEEE802154": ValueOf(syscall.ETH_P_IEEE802154), + "ETH_P_IEEEPUP": ValueOf(syscall.ETH_P_IEEEPUP), + "ETH_P_IEEEPUPAT": ValueOf(syscall.ETH_P_IEEEPUPAT), + "ETH_P_IP": ValueOf(syscall.ETH_P_IP), + "ETH_P_IPV6": ValueOf(syscall.ETH_P_IPV6), + "ETH_P_IPX": ValueOf(syscall.ETH_P_IPX), + "ETH_P_IRDA": ValueOf(syscall.ETH_P_IRDA), + "ETH_P_LAT": ValueOf(syscall.ETH_P_LAT), + "ETH_P_LINK_CTL": ValueOf(syscall.ETH_P_LINK_CTL), + "ETH_P_LOCALTALK": ValueOf(syscall.ETH_P_LOCALTALK), + "ETH_P_LOOP": ValueOf(syscall.ETH_P_LOOP), + "ETH_P_MOBITEX": ValueOf(syscall.ETH_P_MOBITEX), + "ETH_P_MPLS_MC": ValueOf(syscall.ETH_P_MPLS_MC), + "ETH_P_MPLS_UC": ValueOf(syscall.ETH_P_MPLS_UC), + "ETH_P_PAE": ValueOf(syscall.ETH_P_PAE), + "ETH_P_PAUSE": ValueOf(syscall.ETH_P_PAUSE), + "ETH_P_PHONET": ValueOf(syscall.ETH_P_PHONET), + "ETH_P_PPPTALK": ValueOf(syscall.ETH_P_PPPTALK), + "ETH_P_PPP_DISC": ValueOf(syscall.ETH_P_PPP_DISC), + "ETH_P_PPP_MP": ValueOf(syscall.ETH_P_PPP_MP), + "ETH_P_PPP_SES": ValueOf(syscall.ETH_P_PPP_SES), + "ETH_P_PUP": ValueOf(syscall.ETH_P_PUP), + "ETH_P_PUPAT": ValueOf(syscall.ETH_P_PUPAT), + "ETH_P_RARP": ValueOf(syscall.ETH_P_RARP), + "ETH_P_SCA": ValueOf(syscall.ETH_P_SCA), + "ETH_P_SLOW": ValueOf(syscall.ETH_P_SLOW), + "ETH_P_SNAP": ValueOf(syscall.ETH_P_SNAP), + "ETH_P_TEB": ValueOf(syscall.ETH_P_TEB), + "ETH_P_TIPC": ValueOf(syscall.ETH_P_TIPC), + "ETH_P_TRAILER": ValueOf(syscall.ETH_P_TRAILER), + "ETH_P_TR_802_2": ValueOf(syscall.ETH_P_TR_802_2), + "ETH_P_WAN_PPP": ValueOf(syscall.ETH_P_WAN_PPP), + "ETH_P_WCCP": ValueOf(syscall.ETH_P_WCCP), + "ETH_P_X25": ValueOf(syscall.ETH_P_X25), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUCLEAN": ValueOf(syscall.EUCLEAN), + "EUNATCH": ValueOf(syscall.EUNATCH), + "EUSERS": ValueOf(syscall.EUSERS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXFULL": ValueOf(syscall.EXFULL), + "Environ": ValueOf(syscall.Environ), + "EpollCreate": ValueOf(syscall.EpollCreate), + "EpollCreate1": ValueOf(syscall.EpollCreate1), + "EpollCtl": ValueOf(syscall.EpollCtl), + "EpollWait": ValueOf(syscall.EpollWait), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_EXLCK": ValueOf(syscall.F_EXLCK), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLEASE": ValueOf(syscall.F_GETLEASE), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLK64": ValueOf(syscall.F_GETLK64), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETOWN_EX": ValueOf(syscall.F_GETOWN_EX), + "F_GETPIPE_SZ": ValueOf(syscall.F_GETPIPE_SZ), + "F_GETSIG": ValueOf(syscall.F_GETSIG), + "F_LOCK": ValueOf(syscall.F_LOCK), + "F_NOTIFY": ValueOf(syscall.F_NOTIFY), + "F_OK": ValueOf(syscall.F_OK), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLEASE": ValueOf(syscall.F_SETLEASE), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLK64": ValueOf(syscall.F_SETLK64), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLKW64": ValueOf(syscall.F_SETLKW64), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETOWN_EX": ValueOf(syscall.F_SETOWN_EX), + "F_SETPIPE_SZ": ValueOf(syscall.F_SETPIPE_SZ), + "F_SETSIG": ValueOf(syscall.F_SETSIG), + "F_SHLCK": ValueOf(syscall.F_SHLCK), + "F_TEST": ValueOf(syscall.F_TEST), + "F_TLOCK": ValueOf(syscall.F_TLOCK), + "F_ULOCK": ValueOf(syscall.F_ULOCK), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Faccessat": ValueOf(syscall.Faccessat), + "Fallocate": ValueOf(syscall.Fallocate), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchmodat": ValueOf(syscall.Fchmodat), + "Fchown": ValueOf(syscall.Fchown), + "Fchownat": ValueOf(syscall.Fchownat), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Fdatasync": ValueOf(syscall.Fdatasync), + "Flock": ValueOf(syscall.Flock), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Futimesat": ValueOf(syscall.Futimesat), + "Getcwd": ValueOf(syscall.Getcwd), + "Getdents": ValueOf(syscall.Getdents), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "GetsockoptUcred": ValueOf(syscall.GetsockoptUcred), + "Gettid": ValueOf(syscall.Gettid), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "Getxattr": ValueOf(syscall.Getxattr), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMPV6_FILTER": ValueOf(syscall.ICMPV6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFA_ADDRESS": ValueOf(syscall.IFA_ADDRESS), + "IFA_ANYCAST": ValueOf(syscall.IFA_ANYCAST), + "IFA_BROADCAST": ValueOf(syscall.IFA_BROADCAST), + "IFA_CACHEINFO": ValueOf(syscall.IFA_CACHEINFO), + "IFA_F_DADFAILED": ValueOf(syscall.IFA_F_DADFAILED), + "IFA_F_DEPRECATED": ValueOf(syscall.IFA_F_DEPRECATED), + "IFA_F_HOMEADDRESS": ValueOf(syscall.IFA_F_HOMEADDRESS), + "IFA_F_NODAD": ValueOf(syscall.IFA_F_NODAD), + "IFA_F_OPTIMISTIC": ValueOf(syscall.IFA_F_OPTIMISTIC), + "IFA_F_PERMANENT": ValueOf(syscall.IFA_F_PERMANENT), + "IFA_F_SECONDARY": ValueOf(syscall.IFA_F_SECONDARY), + "IFA_F_TEMPORARY": ValueOf(syscall.IFA_F_TEMPORARY), + "IFA_F_TENTATIVE": ValueOf(syscall.IFA_F_TENTATIVE), + "IFA_LABEL": ValueOf(syscall.IFA_LABEL), + "IFA_LOCAL": ValueOf(syscall.IFA_LOCAL), + "IFA_MAX": ValueOf(syscall.IFA_MAX), + "IFA_MULTICAST": ValueOf(syscall.IFA_MULTICAST), + "IFA_UNSPEC": ValueOf(syscall.IFA_UNSPEC), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_AUTOMEDIA": ValueOf(syscall.IFF_AUTOMEDIA), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DYNAMIC": ValueOf(syscall.IFF_DYNAMIC), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MASTER": ValueOf(syscall.IFF_MASTER), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_NO_PI": ValueOf(syscall.IFF_NO_PI), + "IFF_ONE_QUEUE": ValueOf(syscall.IFF_ONE_QUEUE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PORTSEL": ValueOf(syscall.IFF_PORTSEL), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SLAVE": ValueOf(syscall.IFF_SLAVE), + "IFF_TAP": ValueOf(syscall.IFF_TAP), + "IFF_TUN": ValueOf(syscall.IFF_TUN), + "IFF_TUN_EXCL": ValueOf(syscall.IFF_TUN_EXCL), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFF_VNET_HDR": ValueOf(syscall.IFF_VNET_HDR), + "IFLA_ADDRESS": ValueOf(syscall.IFLA_ADDRESS), + "IFLA_BROADCAST": ValueOf(syscall.IFLA_BROADCAST), + "IFLA_COST": ValueOf(syscall.IFLA_COST), + "IFLA_IFALIAS": ValueOf(syscall.IFLA_IFALIAS), + "IFLA_IFNAME": ValueOf(syscall.IFLA_IFNAME), + "IFLA_LINK": ValueOf(syscall.IFLA_LINK), + "IFLA_LINKINFO": ValueOf(syscall.IFLA_LINKINFO), + "IFLA_LINKMODE": ValueOf(syscall.IFLA_LINKMODE), + "IFLA_MAP": ValueOf(syscall.IFLA_MAP), + "IFLA_MASTER": ValueOf(syscall.IFLA_MASTER), + "IFLA_MAX": ValueOf(syscall.IFLA_MAX), + "IFLA_MTU": ValueOf(syscall.IFLA_MTU), + "IFLA_NET_NS_PID": ValueOf(syscall.IFLA_NET_NS_PID), + "IFLA_OPERSTATE": ValueOf(syscall.IFLA_OPERSTATE), + "IFLA_PRIORITY": ValueOf(syscall.IFLA_PRIORITY), + "IFLA_PROTINFO": ValueOf(syscall.IFLA_PROTINFO), + "IFLA_QDISC": ValueOf(syscall.IFLA_QDISC), + "IFLA_STATS": ValueOf(syscall.IFLA_STATS), + "IFLA_TXQLEN": ValueOf(syscall.IFLA_TXQLEN), + "IFLA_UNSPEC": ValueOf(syscall.IFLA_UNSPEC), + "IFLA_WEIGHT": ValueOf(syscall.IFLA_WEIGHT), + "IFLA_WIRELESS": ValueOf(syscall.IFLA_WIRELESS), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_ACCESS": ValueOf(syscall.IN_ACCESS), + "IN_ALL_EVENTS": ValueOf(syscall.IN_ALL_EVENTS), + "IN_ATTRIB": ValueOf(syscall.IN_ATTRIB), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLOEXEC": ValueOf(syscall.IN_CLOEXEC), + "IN_CLOSE": ValueOf(syscall.IN_CLOSE), + "IN_CLOSE_NOWRITE": ValueOf(syscall.IN_CLOSE_NOWRITE), + "IN_CLOSE_WRITE": ValueOf(syscall.IN_CLOSE_WRITE), + "IN_CREATE": ValueOf(syscall.IN_CREATE), + "IN_DELETE": ValueOf(syscall.IN_DELETE), + "IN_DELETE_SELF": ValueOf(syscall.IN_DELETE_SELF), + "IN_DONT_FOLLOW": ValueOf(syscall.IN_DONT_FOLLOW), + "IN_EXCL_UNLINK": ValueOf(syscall.IN_EXCL_UNLINK), + "IN_IGNORED": ValueOf(syscall.IN_IGNORED), + "IN_ISDIR": ValueOf(syscall.IN_ISDIR), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_MASK_ADD": ValueOf(syscall.IN_MASK_ADD), + "IN_MODIFY": ValueOf(syscall.IN_MODIFY), + "IN_MOVE": ValueOf(syscall.IN_MOVE), + "IN_MOVED_FROM": ValueOf(syscall.IN_MOVED_FROM), + "IN_MOVED_TO": ValueOf(syscall.IN_MOVED_TO), + "IN_MOVE_SELF": ValueOf(syscall.IN_MOVE_SELF), + "IN_NONBLOCK": ValueOf(syscall.IN_NONBLOCK), + "IN_ONESHOT": ValueOf(uint32(syscall.IN_ONESHOT)), + "IN_ONLYDIR": ValueOf(syscall.IN_ONLYDIR), + "IN_OPEN": ValueOf(syscall.IN_OPEN), + "IN_Q_OVERFLOW": ValueOf(syscall.IN_Q_OVERFLOW), + "IN_UNMOUNT": ValueOf(syscall.IN_UNMOUNT), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_COMP": ValueOf(syscall.IPPROTO_COMP), + "IPPROTO_DCCP": ValueOf(syscall.IPPROTO_DCCP), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_UDPLITE": ValueOf(syscall.IPPROTO_UDPLITE), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_ADDRFORM": ValueOf(syscall.IPV6_ADDRFORM), + "IPV6_ADD_MEMBERSHIP": ValueOf(syscall.IPV6_ADD_MEMBERSHIP), + "IPV6_AUTHHDR": ValueOf(syscall.IPV6_AUTHHDR), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DROP_MEMBERSHIP": ValueOf(syscall.IPV6_DROP_MEMBERSHIP), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_ANYCAST": ValueOf(syscall.IPV6_JOIN_ANYCAST), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_ANYCAST": ValueOf(syscall.IPV6_LEAVE_ANYCAST), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MTU": ValueOf(syscall.IPV6_MTU), + "IPV6_MTU_DISCOVER": ValueOf(syscall.IPV6_MTU_DISCOVER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PMTUDISC_DO": ValueOf(syscall.IPV6_PMTUDISC_DO), + "IPV6_PMTUDISC_DONT": ValueOf(syscall.IPV6_PMTUDISC_DONT), + "IPV6_PMTUDISC_PROBE": ValueOf(syscall.IPV6_PMTUDISC_PROBE), + "IPV6_PMTUDISC_WANT": ValueOf(syscall.IPV6_PMTUDISC_WANT), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVERR": ValueOf(syscall.IPV6_RECVERR), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_ROUTER_ALERT": ValueOf(syscall.IPV6_ROUTER_ALERT), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_RXDSTOPTS": ValueOf(syscall.IPV6_RXDSTOPTS), + "IPV6_RXHOPOPTS": ValueOf(syscall.IPV6_RXHOPOPTS), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_XFRM_POLICY": ValueOf(syscall.IPV6_XFRM_POLICY), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_FREEBIND": ValueOf(syscall.IP_FREEBIND), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MTU": ValueOf(syscall.IP_MTU), + "IP_MTU_DISCOVER": ValueOf(syscall.IP_MTU_DISCOVER), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_ORIGDSTADDR": ValueOf(syscall.IP_ORIGDSTADDR), + "IP_PASSSEC": ValueOf(syscall.IP_PASSSEC), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PKTOPTIONS": ValueOf(syscall.IP_PKTOPTIONS), + "IP_PMTUDISC": ValueOf(syscall.IP_PMTUDISC), + "IP_PMTUDISC_DO": ValueOf(syscall.IP_PMTUDISC_DO), + "IP_PMTUDISC_DONT": ValueOf(syscall.IP_PMTUDISC_DONT), + "IP_PMTUDISC_PROBE": ValueOf(syscall.IP_PMTUDISC_PROBE), + "IP_PMTUDISC_WANT": ValueOf(syscall.IP_PMTUDISC_WANT), + "IP_RECVERR": ValueOf(syscall.IP_RECVERR), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVORIGDSTADDR": ValueOf(syscall.IP_RECVORIGDSTADDR), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_ROUTER_ALERT": ValueOf(syscall.IP_ROUTER_ALERT), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRANSPARENT": ValueOf(syscall.IP_TRANSPARENT), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "IP_XFRM_POLICY": ValueOf(syscall.IP_XFRM_POLICY), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUCLC": ValueOf(syscall.IUCLC), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "InotifyAddWatch": ValueOf(syscall.InotifyAddWatch), + "InotifyInit": ValueOf(syscall.InotifyInit), + "InotifyInit1": ValueOf(syscall.InotifyInit1), + "InotifyRmWatch": ValueOf(syscall.InotifyRmWatch), + "Ioperm": ValueOf(syscall.Ioperm), + "Iopl": ValueOf(syscall.Iopl), + "Kill": ValueOf(syscall.Kill), + "Klogctl": ValueOf(syscall.Klogctl), + "LINUX_REBOOT_CMD_CAD_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_CAD_OFF), + "LINUX_REBOOT_CMD_CAD_ON": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_CAD_ON)), + "LINUX_REBOOT_CMD_HALT": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_HALT)), + "LINUX_REBOOT_CMD_KEXEC": ValueOf(syscall.LINUX_REBOOT_CMD_KEXEC), + "LINUX_REBOOT_CMD_POWER_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_POWER_OFF), + "LINUX_REBOOT_CMD_RESTART": ValueOf(syscall.LINUX_REBOOT_CMD_RESTART), + "LINUX_REBOOT_CMD_RESTART2": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_RESTART2)), + "LINUX_REBOOT_CMD_SW_SUSPEND": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_SW_SUSPEND)), + "LINUX_REBOOT_MAGIC1": ValueOf(uint32(syscall.LINUX_REBOOT_MAGIC1)), + "LINUX_REBOOT_MAGIC2": ValueOf(syscall.LINUX_REBOOT_MAGIC2), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Listxattr": ValueOf(syscall.Listxattr), + "LsfJump": ValueOf(syscall.LsfJump), + "LsfSocket": ValueOf(syscall.LsfSocket), + "LsfStmt": ValueOf(syscall.LsfStmt), + "Lstat": ValueOf(syscall.Lstat), + "MADV_DOFORK": ValueOf(syscall.MADV_DOFORK), + "MADV_DONTFORK": ValueOf(syscall.MADV_DONTFORK), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_HUGEPAGE": ValueOf(syscall.MADV_HUGEPAGE), + "MADV_HWPOISON": ValueOf(syscall.MADV_HWPOISON), + "MADV_MERGEABLE": ValueOf(syscall.MADV_MERGEABLE), + "MADV_NOHUGEPAGE": ValueOf(syscall.MADV_NOHUGEPAGE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_REMOVE": ValueOf(syscall.MADV_REMOVE), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_UNMERGEABLE": ValueOf(syscall.MADV_UNMERGEABLE), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_32BIT": ValueOf(syscall.MAP_32BIT), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_DENYWRITE": ValueOf(syscall.MAP_DENYWRITE), + "MAP_EXECUTABLE": ValueOf(syscall.MAP_EXECUTABLE), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_GROWSDOWN": ValueOf(syscall.MAP_GROWSDOWN), + "MAP_HUGETLB": ValueOf(syscall.MAP_HUGETLB), + "MAP_LOCKED": ValueOf(syscall.MAP_LOCKED), + "MAP_NONBLOCK": ValueOf(syscall.MAP_NONBLOCK), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_POPULATE": ValueOf(syscall.MAP_POPULATE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_STACK": ValueOf(syscall.MAP_STACK), + "MAP_TYPE": ValueOf(syscall.MAP_TYPE), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MNT_DETACH": ValueOf(syscall.MNT_DETACH), + "MNT_EXPIRE": ValueOf(syscall.MNT_EXPIRE), + "MNT_FORCE": ValueOf(syscall.MNT_FORCE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_CONFIRM": ValueOf(syscall.MSG_CONFIRM), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_ERRQUEUE": ValueOf(syscall.MSG_ERRQUEUE), + "MSG_FASTOPEN": ValueOf(syscall.MSG_FASTOPEN), + "MSG_FIN": ValueOf(syscall.MSG_FIN), + "MSG_MORE": ValueOf(syscall.MSG_MORE), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_PROXY": ValueOf(syscall.MSG_PROXY), + "MSG_RST": ValueOf(syscall.MSG_RST), + "MSG_SYN": ValueOf(syscall.MSG_SYN), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_TRYHARD": ValueOf(syscall.MSG_TRYHARD), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITFORONE": ValueOf(syscall.MSG_WAITFORONE), + "MS_ACTIVE": ValueOf(syscall.MS_ACTIVE), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_BIND": ValueOf(syscall.MS_BIND), + "MS_DIRSYNC": ValueOf(syscall.MS_DIRSYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_I_VERSION": ValueOf(syscall.MS_I_VERSION), + "MS_KERNMOUNT": ValueOf(syscall.MS_KERNMOUNT), + "MS_MANDLOCK": ValueOf(syscall.MS_MANDLOCK), + "MS_MGC_MSK": ValueOf(uint32(syscall.MS_MGC_MSK)), + "MS_MGC_VAL": ValueOf(uint32(syscall.MS_MGC_VAL)), + "MS_MOVE": ValueOf(syscall.MS_MOVE), + "MS_NOATIME": ValueOf(syscall.MS_NOATIME), + "MS_NODEV": ValueOf(syscall.MS_NODEV), + "MS_NODIRATIME": ValueOf(syscall.MS_NODIRATIME), + "MS_NOEXEC": ValueOf(syscall.MS_NOEXEC), + "MS_NOSUID": ValueOf(syscall.MS_NOSUID), + "MS_NOUSER": ValueOf(syscall.MS_NOUSER), + "MS_POSIXACL": ValueOf(syscall.MS_POSIXACL), + "MS_PRIVATE": ValueOf(syscall.MS_PRIVATE), + "MS_RDONLY": ValueOf(syscall.MS_RDONLY), + "MS_REC": ValueOf(syscall.MS_REC), + "MS_RELATIME": ValueOf(syscall.MS_RELATIME), + "MS_REMOUNT": ValueOf(syscall.MS_REMOUNT), + "MS_RMT_MASK": ValueOf(syscall.MS_RMT_MASK), + "MS_SHARED": ValueOf(syscall.MS_SHARED), + "MS_SILENT": ValueOf(syscall.MS_SILENT), + "MS_SLAVE": ValueOf(syscall.MS_SLAVE), + "MS_STRICTATIME": ValueOf(syscall.MS_STRICTATIME), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "MS_SYNCHRONOUS": ValueOf(syscall.MS_SYNCHRONOUS), + "MS_UNBINDABLE": ValueOf(syscall.MS_UNBINDABLE), + "Madvise": ValueOf(syscall.Madvise), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkdirat": ValueOf(syscall.Mkdirat), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mknodat": ValueOf(syscall.Mknodat), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mount": ValueOf(syscall.Mount), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NETLINK_ADD_MEMBERSHIP": ValueOf(syscall.NETLINK_ADD_MEMBERSHIP), + "NETLINK_AUDIT": ValueOf(syscall.NETLINK_AUDIT), + "NETLINK_BROADCAST_ERROR": ValueOf(syscall.NETLINK_BROADCAST_ERROR), + "NETLINK_CONNECTOR": ValueOf(syscall.NETLINK_CONNECTOR), + "NETLINK_DNRTMSG": ValueOf(syscall.NETLINK_DNRTMSG), + "NETLINK_DROP_MEMBERSHIP": ValueOf(syscall.NETLINK_DROP_MEMBERSHIP), + "NETLINK_ECRYPTFS": ValueOf(syscall.NETLINK_ECRYPTFS), + "NETLINK_FIB_LOOKUP": ValueOf(syscall.NETLINK_FIB_LOOKUP), + "NETLINK_FIREWALL": ValueOf(syscall.NETLINK_FIREWALL), + "NETLINK_GENERIC": ValueOf(syscall.NETLINK_GENERIC), + "NETLINK_INET_DIAG": ValueOf(syscall.NETLINK_INET_DIAG), + "NETLINK_IP6_FW": ValueOf(syscall.NETLINK_IP6_FW), + "NETLINK_ISCSI": ValueOf(syscall.NETLINK_ISCSI), + "NETLINK_KOBJECT_UEVENT": ValueOf(syscall.NETLINK_KOBJECT_UEVENT), + "NETLINK_NETFILTER": ValueOf(syscall.NETLINK_NETFILTER), + "NETLINK_NFLOG": ValueOf(syscall.NETLINK_NFLOG), + "NETLINK_NO_ENOBUFS": ValueOf(syscall.NETLINK_NO_ENOBUFS), + "NETLINK_PKTINFO": ValueOf(syscall.NETLINK_PKTINFO), + "NETLINK_ROUTE": ValueOf(syscall.NETLINK_ROUTE), + "NETLINK_SCSITRANSPORT": ValueOf(syscall.NETLINK_SCSITRANSPORT), + "NETLINK_SELINUX": ValueOf(syscall.NETLINK_SELINUX), + "NETLINK_UNUSED": ValueOf(syscall.NETLINK_UNUSED), + "NETLINK_USERSOCK": ValueOf(syscall.NETLINK_USERSOCK), + "NETLINK_XFRM": ValueOf(syscall.NETLINK_XFRM), + "NLA_ALIGNTO": ValueOf(syscall.NLA_ALIGNTO), + "NLA_F_NESTED": ValueOf(syscall.NLA_F_NESTED), + "NLA_F_NET_BYTEORDER": ValueOf(syscall.NLA_F_NET_BYTEORDER), + "NLA_HDRLEN": ValueOf(syscall.NLA_HDRLEN), + "NLMSG_ALIGNTO": ValueOf(syscall.NLMSG_ALIGNTO), + "NLMSG_DONE": ValueOf(syscall.NLMSG_DONE), + "NLMSG_ERROR": ValueOf(syscall.NLMSG_ERROR), + "NLMSG_HDRLEN": ValueOf(syscall.NLMSG_HDRLEN), + "NLMSG_MIN_TYPE": ValueOf(syscall.NLMSG_MIN_TYPE), + "NLMSG_NOOP": ValueOf(syscall.NLMSG_NOOP), + "NLMSG_OVERRUN": ValueOf(syscall.NLMSG_OVERRUN), + "NLM_F_ACK": ValueOf(syscall.NLM_F_ACK), + "NLM_F_APPEND": ValueOf(syscall.NLM_F_APPEND), + "NLM_F_ATOMIC": ValueOf(syscall.NLM_F_ATOMIC), + "NLM_F_CREATE": ValueOf(syscall.NLM_F_CREATE), + "NLM_F_DUMP": ValueOf(syscall.NLM_F_DUMP), + "NLM_F_ECHO": ValueOf(syscall.NLM_F_ECHO), + "NLM_F_EXCL": ValueOf(syscall.NLM_F_EXCL), + "NLM_F_MATCH": ValueOf(syscall.NLM_F_MATCH), + "NLM_F_MULTI": ValueOf(syscall.NLM_F_MULTI), + "NLM_F_REPLACE": ValueOf(syscall.NLM_F_REPLACE), + "NLM_F_REQUEST": ValueOf(syscall.NLM_F_REQUEST), + "NLM_F_ROOT": ValueOf(syscall.NLM_F_ROOT), + "NOFLSH": ValueOf(syscall.NOFLSH), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NetlinkRIB": ValueOf(syscall.NetlinkRIB), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "OLCUC": ValueOf(syscall.OLCUC), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_LARGEFILE": ValueOf(syscall.O_LARGEFILE), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOATIME": ValueOf(syscall.O_NOATIME), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_RSYNC": ValueOf(syscall.O_RSYNC), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "Openat": ValueOf(syscall.Openat), + "PACKET_ADD_MEMBERSHIP": ValueOf(syscall.PACKET_ADD_MEMBERSHIP), + "PACKET_BROADCAST": ValueOf(syscall.PACKET_BROADCAST), + "PACKET_DROP_MEMBERSHIP": ValueOf(syscall.PACKET_DROP_MEMBERSHIP), + "PACKET_FASTROUTE": ValueOf(syscall.PACKET_FASTROUTE), + "PACKET_HOST": ValueOf(syscall.PACKET_HOST), + "PACKET_LOOPBACK": ValueOf(syscall.PACKET_LOOPBACK), + "PACKET_MR_ALLMULTI": ValueOf(syscall.PACKET_MR_ALLMULTI), + "PACKET_MR_MULTICAST": ValueOf(syscall.PACKET_MR_MULTICAST), + "PACKET_MR_PROMISC": ValueOf(syscall.PACKET_MR_PROMISC), + "PACKET_MULTICAST": ValueOf(syscall.PACKET_MULTICAST), + "PACKET_OTHERHOST": ValueOf(syscall.PACKET_OTHERHOST), + "PACKET_OUTGOING": ValueOf(syscall.PACKET_OUTGOING), + "PACKET_RECV_OUTPUT": ValueOf(syscall.PACKET_RECV_OUTPUT), + "PACKET_RX_RING": ValueOf(syscall.PACKET_RX_RING), + "PACKET_STATISTICS": ValueOf(syscall.PACKET_STATISTICS), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_GROWSDOWN": ValueOf(syscall.PROT_GROWSDOWN), + "PROT_GROWSUP": ValueOf(syscall.PROT_GROWSUP), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PR_CAPBSET_DROP": ValueOf(syscall.PR_CAPBSET_DROP), + "PR_CAPBSET_READ": ValueOf(syscall.PR_CAPBSET_READ), + "PR_ENDIAN_BIG": ValueOf(syscall.PR_ENDIAN_BIG), + "PR_ENDIAN_LITTLE": ValueOf(syscall.PR_ENDIAN_LITTLE), + "PR_ENDIAN_PPC_LITTLE": ValueOf(syscall.PR_ENDIAN_PPC_LITTLE), + "PR_FPEMU_NOPRINT": ValueOf(syscall.PR_FPEMU_NOPRINT), + "PR_FPEMU_SIGFPE": ValueOf(syscall.PR_FPEMU_SIGFPE), + "PR_FP_EXC_ASYNC": ValueOf(syscall.PR_FP_EXC_ASYNC), + "PR_FP_EXC_DISABLED": ValueOf(syscall.PR_FP_EXC_DISABLED), + "PR_FP_EXC_DIV": ValueOf(syscall.PR_FP_EXC_DIV), + "PR_FP_EXC_INV": ValueOf(syscall.PR_FP_EXC_INV), + "PR_FP_EXC_NONRECOV": ValueOf(syscall.PR_FP_EXC_NONRECOV), + "PR_FP_EXC_OVF": ValueOf(syscall.PR_FP_EXC_OVF), + "PR_FP_EXC_PRECISE": ValueOf(syscall.PR_FP_EXC_PRECISE), + "PR_FP_EXC_RES": ValueOf(syscall.PR_FP_EXC_RES), + "PR_FP_EXC_SW_ENABLE": ValueOf(syscall.PR_FP_EXC_SW_ENABLE), + "PR_FP_EXC_UND": ValueOf(syscall.PR_FP_EXC_UND), + "PR_GET_DUMPABLE": ValueOf(syscall.PR_GET_DUMPABLE), + "PR_GET_ENDIAN": ValueOf(syscall.PR_GET_ENDIAN), + "PR_GET_FPEMU": ValueOf(syscall.PR_GET_FPEMU), + "PR_GET_FPEXC": ValueOf(syscall.PR_GET_FPEXC), + "PR_GET_KEEPCAPS": ValueOf(syscall.PR_GET_KEEPCAPS), + "PR_GET_NAME": ValueOf(syscall.PR_GET_NAME), + "PR_GET_PDEATHSIG": ValueOf(syscall.PR_GET_PDEATHSIG), + "PR_GET_SECCOMP": ValueOf(syscall.PR_GET_SECCOMP), + "PR_GET_SECUREBITS": ValueOf(syscall.PR_GET_SECUREBITS), + "PR_GET_TIMERSLACK": ValueOf(syscall.PR_GET_TIMERSLACK), + "PR_GET_TIMING": ValueOf(syscall.PR_GET_TIMING), + "PR_GET_TSC": ValueOf(syscall.PR_GET_TSC), + "PR_GET_UNALIGN": ValueOf(syscall.PR_GET_UNALIGN), + "PR_MCE_KILL": ValueOf(syscall.PR_MCE_KILL), + "PR_MCE_KILL_CLEAR": ValueOf(syscall.PR_MCE_KILL_CLEAR), + "PR_MCE_KILL_DEFAULT": ValueOf(syscall.PR_MCE_KILL_DEFAULT), + "PR_MCE_KILL_EARLY": ValueOf(syscall.PR_MCE_KILL_EARLY), + "PR_MCE_KILL_GET": ValueOf(syscall.PR_MCE_KILL_GET), + "PR_MCE_KILL_LATE": ValueOf(syscall.PR_MCE_KILL_LATE), + "PR_MCE_KILL_SET": ValueOf(syscall.PR_MCE_KILL_SET), + "PR_SET_DUMPABLE": ValueOf(syscall.PR_SET_DUMPABLE), + "PR_SET_ENDIAN": ValueOf(syscall.PR_SET_ENDIAN), + "PR_SET_FPEMU": ValueOf(syscall.PR_SET_FPEMU), + "PR_SET_FPEXC": ValueOf(syscall.PR_SET_FPEXC), + "PR_SET_KEEPCAPS": ValueOf(syscall.PR_SET_KEEPCAPS), + "PR_SET_NAME": ValueOf(syscall.PR_SET_NAME), + "PR_SET_PDEATHSIG": ValueOf(syscall.PR_SET_PDEATHSIG), + "PR_SET_PTRACER": ValueOf(syscall.PR_SET_PTRACER), + "PR_SET_SECCOMP": ValueOf(syscall.PR_SET_SECCOMP), + "PR_SET_SECUREBITS": ValueOf(syscall.PR_SET_SECUREBITS), + "PR_SET_TIMERSLACK": ValueOf(syscall.PR_SET_TIMERSLACK), + "PR_SET_TIMING": ValueOf(syscall.PR_SET_TIMING), + "PR_SET_TSC": ValueOf(syscall.PR_SET_TSC), + "PR_SET_UNALIGN": ValueOf(syscall.PR_SET_UNALIGN), + "PR_TASK_PERF_EVENTS_DISABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_DISABLE), + "PR_TASK_PERF_EVENTS_ENABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_ENABLE), + "PR_TIMING_STATISTICAL": ValueOf(syscall.PR_TIMING_STATISTICAL), + "PR_TIMING_TIMESTAMP": ValueOf(syscall.PR_TIMING_TIMESTAMP), + "PR_TSC_ENABLE": ValueOf(syscall.PR_TSC_ENABLE), + "PR_TSC_SIGSEGV": ValueOf(syscall.PR_TSC_SIGSEGV), + "PR_UNALIGN_NOPRINT": ValueOf(syscall.PR_UNALIGN_NOPRINT), + "PR_UNALIGN_SIGBUS": ValueOf(syscall.PR_UNALIGN_SIGBUS), + "PTRACE_ARCH_PRCTL": ValueOf(syscall.PTRACE_ARCH_PRCTL), + "PTRACE_ATTACH": ValueOf(syscall.PTRACE_ATTACH), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_DETACH": ValueOf(syscall.PTRACE_DETACH), + "PTRACE_EVENT_CLONE": ValueOf(syscall.PTRACE_EVENT_CLONE), + "PTRACE_EVENT_EXEC": ValueOf(syscall.PTRACE_EVENT_EXEC), + "PTRACE_EVENT_EXIT": ValueOf(syscall.PTRACE_EVENT_EXIT), + "PTRACE_EVENT_FORK": ValueOf(syscall.PTRACE_EVENT_FORK), + "PTRACE_EVENT_VFORK": ValueOf(syscall.PTRACE_EVENT_VFORK), + "PTRACE_EVENT_VFORK_DONE": ValueOf(syscall.PTRACE_EVENT_VFORK_DONE), + "PTRACE_GETEVENTMSG": ValueOf(syscall.PTRACE_GETEVENTMSG), + "PTRACE_GETFPREGS": ValueOf(syscall.PTRACE_GETFPREGS), + "PTRACE_GETFPXREGS": ValueOf(syscall.PTRACE_GETFPXREGS), + "PTRACE_GETREGS": ValueOf(syscall.PTRACE_GETREGS), + "PTRACE_GETREGSET": ValueOf(syscall.PTRACE_GETREGSET), + "PTRACE_GETSIGINFO": ValueOf(syscall.PTRACE_GETSIGINFO), + "PTRACE_GET_THREAD_AREA": ValueOf(syscall.PTRACE_GET_THREAD_AREA), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_OLDSETOPTIONS": ValueOf(syscall.PTRACE_OLDSETOPTIONS), + "PTRACE_O_MASK": ValueOf(syscall.PTRACE_O_MASK), + "PTRACE_O_TRACECLONE": ValueOf(syscall.PTRACE_O_TRACECLONE), + "PTRACE_O_TRACEEXEC": ValueOf(syscall.PTRACE_O_TRACEEXEC), + "PTRACE_O_TRACEEXIT": ValueOf(syscall.PTRACE_O_TRACEEXIT), + "PTRACE_O_TRACEFORK": ValueOf(syscall.PTRACE_O_TRACEFORK), + "PTRACE_O_TRACESYSGOOD": ValueOf(syscall.PTRACE_O_TRACESYSGOOD), + "PTRACE_O_TRACEVFORK": ValueOf(syscall.PTRACE_O_TRACEVFORK), + "PTRACE_O_TRACEVFORKDONE": ValueOf(syscall.PTRACE_O_TRACEVFORKDONE), + "PTRACE_PEEKDATA": ValueOf(syscall.PTRACE_PEEKDATA), + "PTRACE_PEEKTEXT": ValueOf(syscall.PTRACE_PEEKTEXT), + "PTRACE_PEEKUSR": ValueOf(syscall.PTRACE_PEEKUSR), + "PTRACE_POKEDATA": ValueOf(syscall.PTRACE_POKEDATA), + "PTRACE_POKETEXT": ValueOf(syscall.PTRACE_POKETEXT), + "PTRACE_POKEUSR": ValueOf(syscall.PTRACE_POKEUSR), + "PTRACE_SETFPREGS": ValueOf(syscall.PTRACE_SETFPREGS), + "PTRACE_SETFPXREGS": ValueOf(syscall.PTRACE_SETFPXREGS), + "PTRACE_SETOPTIONS": ValueOf(syscall.PTRACE_SETOPTIONS), + "PTRACE_SETREGS": ValueOf(syscall.PTRACE_SETREGS), + "PTRACE_SETREGSET": ValueOf(syscall.PTRACE_SETREGSET), + "PTRACE_SETSIGINFO": ValueOf(syscall.PTRACE_SETSIGINFO), + "PTRACE_SET_THREAD_AREA": ValueOf(syscall.PTRACE_SET_THREAD_AREA), + "PTRACE_SINGLEBLOCK": ValueOf(syscall.PTRACE_SINGLEBLOCK), + "PTRACE_SINGLESTEP": ValueOf(syscall.PTRACE_SINGLESTEP), + "PTRACE_SYSCALL": ValueOf(syscall.PTRACE_SYSCALL), + "PTRACE_SYSEMU": ValueOf(syscall.PTRACE_SYSEMU), + "PTRACE_SYSEMU_SINGLESTEP": ValueOf(syscall.PTRACE_SYSEMU_SINGLESTEP), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseNetlinkMessage": ValueOf(syscall.ParseNetlinkMessage), + "ParseNetlinkRouteAttr": ValueOf(syscall.ParseNetlinkRouteAttr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixCredentials": ValueOf(syscall.ParseUnixCredentials), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "PathMax": ValueOf(syscall.PathMax), + "Pause": ValueOf(syscall.Pause), + "Pipe": ValueOf(syscall.Pipe), + "Pipe2": ValueOf(syscall.Pipe2), + "PivotRoot": ValueOf(syscall.PivotRoot), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceCont": ValueOf(syscall.PtraceCont), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "PtraceGetEventMsg": ValueOf(syscall.PtraceGetEventMsg), + "PtraceGetRegs": ValueOf(syscall.PtraceGetRegs), + "PtracePeekData": ValueOf(syscall.PtracePeekData), + "PtracePeekText": ValueOf(syscall.PtracePeekText), + "PtracePokeData": ValueOf(syscall.PtracePokeData), + "PtracePokeText": ValueOf(syscall.PtracePokeText), + "PtraceSetOptions": ValueOf(syscall.PtraceSetOptions), + "PtraceSetRegs": ValueOf(syscall.PtraceSetRegs), + "PtraceSingleStep": ValueOf(syscall.PtraceSingleStep), + "PtraceSyscall": ValueOf(syscall.PtraceSyscall), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(syscall.RLIM_INFINITY), + "RTAX_ADVMSS": ValueOf(syscall.RTAX_ADVMSS), + "RTAX_CWND": ValueOf(syscall.RTAX_CWND), + "RTAX_FEATURES": ValueOf(syscall.RTAX_FEATURES), + "RTAX_FEATURE_ALLFRAG": ValueOf(syscall.RTAX_FEATURE_ALLFRAG), + "RTAX_FEATURE_ECN": ValueOf(syscall.RTAX_FEATURE_ECN), + "RTAX_FEATURE_SACK": ValueOf(syscall.RTAX_FEATURE_SACK), + "RTAX_FEATURE_TIMESTAMP": ValueOf(syscall.RTAX_FEATURE_TIMESTAMP), + "RTAX_HOPLIMIT": ValueOf(syscall.RTAX_HOPLIMIT), + "RTAX_INITCWND": ValueOf(syscall.RTAX_INITCWND), + "RTAX_INITRWND": ValueOf(syscall.RTAX_INITRWND), + "RTAX_LOCK": ValueOf(syscall.RTAX_LOCK), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_MTU": ValueOf(syscall.RTAX_MTU), + "RTAX_REORDERING": ValueOf(syscall.RTAX_REORDERING), + "RTAX_RTO_MIN": ValueOf(syscall.RTAX_RTO_MIN), + "RTAX_RTT": ValueOf(syscall.RTAX_RTT), + "RTAX_RTTVAR": ValueOf(syscall.RTAX_RTTVAR), + "RTAX_SSTHRESH": ValueOf(syscall.RTAX_SSTHRESH), + "RTAX_UNSPEC": ValueOf(syscall.RTAX_UNSPEC), + "RTAX_WINDOW": ValueOf(syscall.RTAX_WINDOW), + "RTA_ALIGNTO": ValueOf(syscall.RTA_ALIGNTO), + "RTA_CACHEINFO": ValueOf(syscall.RTA_CACHEINFO), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_FLOW": ValueOf(syscall.RTA_FLOW), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_IIF": ValueOf(syscall.RTA_IIF), + "RTA_MAX": ValueOf(syscall.RTA_MAX), + "RTA_METRICS": ValueOf(syscall.RTA_METRICS), + "RTA_MULTIPATH": ValueOf(syscall.RTA_MULTIPATH), + "RTA_OIF": ValueOf(syscall.RTA_OIF), + "RTA_PREFSRC": ValueOf(syscall.RTA_PREFSRC), + "RTA_PRIORITY": ValueOf(syscall.RTA_PRIORITY), + "RTA_SRC": ValueOf(syscall.RTA_SRC), + "RTA_TABLE": ValueOf(syscall.RTA_TABLE), + "RTA_UNSPEC": ValueOf(syscall.RTA_UNSPEC), + "RTCF_DIRECTSRC": ValueOf(syscall.RTCF_DIRECTSRC), + "RTCF_DOREDIRECT": ValueOf(syscall.RTCF_DOREDIRECT), + "RTCF_LOG": ValueOf(syscall.RTCF_LOG), + "RTCF_MASQ": ValueOf(syscall.RTCF_MASQ), + "RTCF_NAT": ValueOf(syscall.RTCF_NAT), + "RTCF_VALVE": ValueOf(syscall.RTCF_VALVE), + "RTF_ADDRCLASSMASK": ValueOf(uint32(syscall.RTF_ADDRCLASSMASK)), + "RTF_ADDRCONF": ValueOf(syscall.RTF_ADDRCONF), + "RTF_ALLONLINK": ValueOf(syscall.RTF_ALLONLINK), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CACHE": ValueOf(syscall.RTF_CACHE), + "RTF_DEFAULT": ValueOf(syscall.RTF_DEFAULT), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FLOW": ValueOf(syscall.RTF_FLOW), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_INTERFACE": ValueOf(syscall.RTF_INTERFACE), + "RTF_IRTT": ValueOf(syscall.RTF_IRTT), + "RTF_LINKRT": ValueOf(syscall.RTF_LINKRT), + "RTF_LOCAL": ValueOf(uint32(syscall.RTF_LOCAL)), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MSS": ValueOf(syscall.RTF_MSS), + "RTF_MTU": ValueOf(syscall.RTF_MTU), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_NAT": ValueOf(syscall.RTF_NAT), + "RTF_NOFORWARD": ValueOf(syscall.RTF_NOFORWARD), + "RTF_NONEXTHOP": ValueOf(syscall.RTF_NONEXTHOP), + "RTF_NOPMTUDISC": ValueOf(syscall.RTF_NOPMTUDISC), + "RTF_POLICY": ValueOf(syscall.RTF_POLICY), + "RTF_REINSTATE": ValueOf(syscall.RTF_REINSTATE), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_THROW": ValueOf(syscall.RTF_THROW), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WINDOW": ValueOf(syscall.RTF_WINDOW), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_BASE": ValueOf(syscall.RTM_BASE), + "RTM_DELACTION": ValueOf(syscall.RTM_DELACTION), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELADDRLABEL": ValueOf(syscall.RTM_DELADDRLABEL), + "RTM_DELLINK": ValueOf(syscall.RTM_DELLINK), + "RTM_DELNEIGH": ValueOf(syscall.RTM_DELNEIGH), + "RTM_DELQDISC": ValueOf(syscall.RTM_DELQDISC), + "RTM_DELROUTE": ValueOf(syscall.RTM_DELROUTE), + "RTM_DELRULE": ValueOf(syscall.RTM_DELRULE), + "RTM_DELTCLASS": ValueOf(syscall.RTM_DELTCLASS), + "RTM_DELTFILTER": ValueOf(syscall.RTM_DELTFILTER), + "RTM_F_CLONED": ValueOf(syscall.RTM_F_CLONED), + "RTM_F_EQUALIZE": ValueOf(syscall.RTM_F_EQUALIZE), + "RTM_F_NOTIFY": ValueOf(syscall.RTM_F_NOTIFY), + "RTM_F_PREFIX": ValueOf(syscall.RTM_F_PREFIX), + "RTM_GETACTION": ValueOf(syscall.RTM_GETACTION), + "RTM_GETADDR": ValueOf(syscall.RTM_GETADDR), + "RTM_GETADDRLABEL": ValueOf(syscall.RTM_GETADDRLABEL), + "RTM_GETANYCAST": ValueOf(syscall.RTM_GETANYCAST), + "RTM_GETDCB": ValueOf(syscall.RTM_GETDCB), + "RTM_GETLINK": ValueOf(syscall.RTM_GETLINK), + "RTM_GETMULTICAST": ValueOf(syscall.RTM_GETMULTICAST), + "RTM_GETNEIGH": ValueOf(syscall.RTM_GETNEIGH), + "RTM_GETNEIGHTBL": ValueOf(syscall.RTM_GETNEIGHTBL), + "RTM_GETQDISC": ValueOf(syscall.RTM_GETQDISC), + "RTM_GETROUTE": ValueOf(syscall.RTM_GETROUTE), + "RTM_GETRULE": ValueOf(syscall.RTM_GETRULE), + "RTM_GETTCLASS": ValueOf(syscall.RTM_GETTCLASS), + "RTM_GETTFILTER": ValueOf(syscall.RTM_GETTFILTER), + "RTM_MAX": ValueOf(syscall.RTM_MAX), + "RTM_NEWACTION": ValueOf(syscall.RTM_NEWACTION), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWADDRLABEL": ValueOf(syscall.RTM_NEWADDRLABEL), + "RTM_NEWLINK": ValueOf(syscall.RTM_NEWLINK), + "RTM_NEWNDUSEROPT": ValueOf(syscall.RTM_NEWNDUSEROPT), + "RTM_NEWNEIGH": ValueOf(syscall.RTM_NEWNEIGH), + "RTM_NEWNEIGHTBL": ValueOf(syscall.RTM_NEWNEIGHTBL), + "RTM_NEWPREFIX": ValueOf(syscall.RTM_NEWPREFIX), + "RTM_NEWQDISC": ValueOf(syscall.RTM_NEWQDISC), + "RTM_NEWROUTE": ValueOf(syscall.RTM_NEWROUTE), + "RTM_NEWRULE": ValueOf(syscall.RTM_NEWRULE), + "RTM_NEWTCLASS": ValueOf(syscall.RTM_NEWTCLASS), + "RTM_NEWTFILTER": ValueOf(syscall.RTM_NEWTFILTER), + "RTM_NR_FAMILIES": ValueOf(syscall.RTM_NR_FAMILIES), + "RTM_NR_MSGTYPES": ValueOf(syscall.RTM_NR_MSGTYPES), + "RTM_SETDCB": ValueOf(syscall.RTM_SETDCB), + "RTM_SETLINK": ValueOf(syscall.RTM_SETLINK), + "RTM_SETNEIGHTBL": ValueOf(syscall.RTM_SETNEIGHTBL), + "RTNH_ALIGNTO": ValueOf(syscall.RTNH_ALIGNTO), + "RTNH_F_DEAD": ValueOf(syscall.RTNH_F_DEAD), + "RTNH_F_ONLINK": ValueOf(syscall.RTNH_F_ONLINK), + "RTNH_F_PERVASIVE": ValueOf(syscall.RTNH_F_PERVASIVE), + "RTNLGRP_IPV4_IFADDR": ValueOf(syscall.RTNLGRP_IPV4_IFADDR), + "RTNLGRP_IPV4_MROUTE": ValueOf(syscall.RTNLGRP_IPV4_MROUTE), + "RTNLGRP_IPV4_ROUTE": ValueOf(syscall.RTNLGRP_IPV4_ROUTE), + "RTNLGRP_IPV4_RULE": ValueOf(syscall.RTNLGRP_IPV4_RULE), + "RTNLGRP_IPV6_IFADDR": ValueOf(syscall.RTNLGRP_IPV6_IFADDR), + "RTNLGRP_IPV6_IFINFO": ValueOf(syscall.RTNLGRP_IPV6_IFINFO), + "RTNLGRP_IPV6_MROUTE": ValueOf(syscall.RTNLGRP_IPV6_MROUTE), + "RTNLGRP_IPV6_PREFIX": ValueOf(syscall.RTNLGRP_IPV6_PREFIX), + "RTNLGRP_IPV6_ROUTE": ValueOf(syscall.RTNLGRP_IPV6_ROUTE), + "RTNLGRP_IPV6_RULE": ValueOf(syscall.RTNLGRP_IPV6_RULE), + "RTNLGRP_LINK": ValueOf(syscall.RTNLGRP_LINK), + "RTNLGRP_ND_USEROPT": ValueOf(syscall.RTNLGRP_ND_USEROPT), + "RTNLGRP_NEIGH": ValueOf(syscall.RTNLGRP_NEIGH), + "RTNLGRP_NONE": ValueOf(syscall.RTNLGRP_NONE), + "RTNLGRP_NOTIFY": ValueOf(syscall.RTNLGRP_NOTIFY), + "RTNLGRP_TC": ValueOf(syscall.RTNLGRP_TC), + "RTN_ANYCAST": ValueOf(syscall.RTN_ANYCAST), + "RTN_BLACKHOLE": ValueOf(syscall.RTN_BLACKHOLE), + "RTN_BROADCAST": ValueOf(syscall.RTN_BROADCAST), + "RTN_LOCAL": ValueOf(syscall.RTN_LOCAL), + "RTN_MAX": ValueOf(syscall.RTN_MAX), + "RTN_MULTICAST": ValueOf(syscall.RTN_MULTICAST), + "RTN_NAT": ValueOf(syscall.RTN_NAT), + "RTN_PROHIBIT": ValueOf(syscall.RTN_PROHIBIT), + "RTN_THROW": ValueOf(syscall.RTN_THROW), + "RTN_UNICAST": ValueOf(syscall.RTN_UNICAST), + "RTN_UNREACHABLE": ValueOf(syscall.RTN_UNREACHABLE), + "RTN_UNSPEC": ValueOf(syscall.RTN_UNSPEC), + "RTN_XRESOLVE": ValueOf(syscall.RTN_XRESOLVE), + "RTPROT_BIRD": ValueOf(syscall.RTPROT_BIRD), + "RTPROT_BOOT": ValueOf(syscall.RTPROT_BOOT), + "RTPROT_DHCP": ValueOf(syscall.RTPROT_DHCP), + "RTPROT_DNROUTED": ValueOf(syscall.RTPROT_DNROUTED), + "RTPROT_GATED": ValueOf(syscall.RTPROT_GATED), + "RTPROT_KERNEL": ValueOf(syscall.RTPROT_KERNEL), + "RTPROT_MRT": ValueOf(syscall.RTPROT_MRT), + "RTPROT_NTK": ValueOf(syscall.RTPROT_NTK), + "RTPROT_RA": ValueOf(syscall.RTPROT_RA), + "RTPROT_REDIRECT": ValueOf(syscall.RTPROT_REDIRECT), + "RTPROT_STATIC": ValueOf(syscall.RTPROT_STATIC), + "RTPROT_UNSPEC": ValueOf(syscall.RTPROT_UNSPEC), + "RTPROT_XORP": ValueOf(syscall.RTPROT_XORP), + "RTPROT_ZEBRA": ValueOf(syscall.RTPROT_ZEBRA), + "RT_CLASS_DEFAULT": ValueOf(syscall.RT_CLASS_DEFAULT), + "RT_CLASS_LOCAL": ValueOf(syscall.RT_CLASS_LOCAL), + "RT_CLASS_MAIN": ValueOf(syscall.RT_CLASS_MAIN), + "RT_CLASS_MAX": ValueOf(syscall.RT_CLASS_MAX), + "RT_CLASS_UNSPEC": ValueOf(syscall.RT_CLASS_UNSPEC), + "RT_SCOPE_HOST": ValueOf(syscall.RT_SCOPE_HOST), + "RT_SCOPE_LINK": ValueOf(syscall.RT_SCOPE_LINK), + "RT_SCOPE_NOWHERE": ValueOf(syscall.RT_SCOPE_NOWHERE), + "RT_SCOPE_SITE": ValueOf(syscall.RT_SCOPE_SITE), + "RT_SCOPE_UNIVERSE": ValueOf(syscall.RT_SCOPE_UNIVERSE), + "RT_TABLE_COMPAT": ValueOf(syscall.RT_TABLE_COMPAT), + "RT_TABLE_DEFAULT": ValueOf(syscall.RT_TABLE_DEFAULT), + "RT_TABLE_LOCAL": ValueOf(syscall.RT_TABLE_LOCAL), + "RT_TABLE_MAIN": ValueOf(syscall.RT_TABLE_MAIN), + "RT_TABLE_MAX": ValueOf(uint32(syscall.RT_TABLE_MAX)), + "RT_TABLE_UNSPEC": ValueOf(syscall.RT_TABLE_UNSPEC), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Reboot": ValueOf(syscall.Reboot), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Removexattr": ValueOf(syscall.Removexattr), + "Rename": ValueOf(syscall.Rename), + "Renameat": ValueOf(syscall.Renameat), + "Rmdir": ValueOf(syscall.Rmdir), + "SCM_CREDENTIALS": ValueOf(syscall.SCM_CREDENTIALS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMPING": ValueOf(syscall.SCM_TIMESTAMPING), + "SCM_TIMESTAMPNS": ValueOf(syscall.SCM_TIMESTAMPNS), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCLD": ValueOf(syscall.SIGCLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPOLL": ValueOf(syscall.SIGPOLL), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGPWR": ValueOf(syscall.SIGPWR), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTKFLT": ValueOf(syscall.SIGSTKFLT), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGUNUSED": ValueOf(syscall.SIGUNUSED), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDDLCI": ValueOf(syscall.SIOCADDDLCI), + "SIOCADDMULTI": ValueOf(syscall.SIOCADDMULTI), + "SIOCADDRT": ValueOf(syscall.SIOCADDRT), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDARP": ValueOf(syscall.SIOCDARP), + "SIOCDELDLCI": ValueOf(syscall.SIOCDELDLCI), + "SIOCDELMULTI": ValueOf(syscall.SIOCDELMULTI), + "SIOCDELRT": ValueOf(syscall.SIOCDELRT), + "SIOCDEVPRIVATE": ValueOf(syscall.SIOCDEVPRIVATE), + "SIOCDIFADDR": ValueOf(syscall.SIOCDIFADDR), + "SIOCDRARP": ValueOf(syscall.SIOCDRARP), + "SIOCGARP": ValueOf(syscall.SIOCGARP), + "SIOCGIFADDR": ValueOf(syscall.SIOCGIFADDR), + "SIOCGIFBR": ValueOf(syscall.SIOCGIFBR), + "SIOCGIFBRDADDR": ValueOf(syscall.SIOCGIFBRDADDR), + "SIOCGIFCONF": ValueOf(syscall.SIOCGIFCONF), + "SIOCGIFCOUNT": ValueOf(syscall.SIOCGIFCOUNT), + "SIOCGIFDSTADDR": ValueOf(syscall.SIOCGIFDSTADDR), + "SIOCGIFENCAP": ValueOf(syscall.SIOCGIFENCAP), + "SIOCGIFFLAGS": ValueOf(syscall.SIOCGIFFLAGS), + "SIOCGIFHWADDR": ValueOf(syscall.SIOCGIFHWADDR), + "SIOCGIFINDEX": ValueOf(syscall.SIOCGIFINDEX), + "SIOCGIFMAP": ValueOf(syscall.SIOCGIFMAP), + "SIOCGIFMEM": ValueOf(syscall.SIOCGIFMEM), + "SIOCGIFMETRIC": ValueOf(syscall.SIOCGIFMETRIC), + "SIOCGIFMTU": ValueOf(syscall.SIOCGIFMTU), + "SIOCGIFNAME": ValueOf(syscall.SIOCGIFNAME), + "SIOCGIFNETMASK": ValueOf(syscall.SIOCGIFNETMASK), + "SIOCGIFPFLAGS": ValueOf(syscall.SIOCGIFPFLAGS), + "SIOCGIFSLAVE": ValueOf(syscall.SIOCGIFSLAVE), + "SIOCGIFTXQLEN": ValueOf(syscall.SIOCGIFTXQLEN), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGRARP": ValueOf(syscall.SIOCGRARP), + "SIOCGSTAMP": ValueOf(syscall.SIOCGSTAMP), + "SIOCGSTAMPNS": ValueOf(syscall.SIOCGSTAMPNS), + "SIOCPROTOPRIVATE": ValueOf(syscall.SIOCPROTOPRIVATE), + "SIOCRTMSG": ValueOf(syscall.SIOCRTMSG), + "SIOCSARP": ValueOf(syscall.SIOCSARP), + "SIOCSIFADDR": ValueOf(syscall.SIOCSIFADDR), + "SIOCSIFBR": ValueOf(syscall.SIOCSIFBR), + "SIOCSIFBRDADDR": ValueOf(syscall.SIOCSIFBRDADDR), + "SIOCSIFDSTADDR": ValueOf(syscall.SIOCSIFDSTADDR), + "SIOCSIFENCAP": ValueOf(syscall.SIOCSIFENCAP), + "SIOCSIFFLAGS": ValueOf(syscall.SIOCSIFFLAGS), + "SIOCSIFHWADDR": ValueOf(syscall.SIOCSIFHWADDR), + "SIOCSIFHWBROADCAST": ValueOf(syscall.SIOCSIFHWBROADCAST), + "SIOCSIFLINK": ValueOf(syscall.SIOCSIFLINK), + "SIOCSIFMAP": ValueOf(syscall.SIOCSIFMAP), + "SIOCSIFMEM": ValueOf(syscall.SIOCSIFMEM), + "SIOCSIFMETRIC": ValueOf(syscall.SIOCSIFMETRIC), + "SIOCSIFMTU": ValueOf(syscall.SIOCSIFMTU), + "SIOCSIFNAME": ValueOf(syscall.SIOCSIFNAME), + "SIOCSIFNETMASK": ValueOf(syscall.SIOCSIFNETMASK), + "SIOCSIFPFLAGS": ValueOf(syscall.SIOCSIFPFLAGS), + "SIOCSIFSLAVE": ValueOf(syscall.SIOCSIFSLAVE), + "SIOCSIFTXQLEN": ValueOf(syscall.SIOCSIFTXQLEN), + "SIOCSPGRP": ValueOf(syscall.SIOCSPGRP), + "SIOCSRARP": ValueOf(syscall.SIOCSRARP), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DCCP": ValueOf(syscall.SOCK_DCCP), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_PACKET": ValueOf(syscall.SOCK_PACKET), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_AAL": ValueOf(syscall.SOL_AAL), + "SOL_ATM": ValueOf(syscall.SOL_ATM), + "SOL_DECNET": ValueOf(syscall.SOL_DECNET), + "SOL_ICMPV6": ValueOf(syscall.SOL_ICMPV6), + "SOL_IP": ValueOf(syscall.SOL_IP), + "SOL_IPV6": ValueOf(syscall.SOL_IPV6), + "SOL_IRDA": ValueOf(syscall.SOL_IRDA), + "SOL_PACKET": ValueOf(syscall.SOL_PACKET), + "SOL_RAW": ValueOf(syscall.SOL_RAW), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOL_TCP": ValueOf(syscall.SOL_TCP), + "SOL_X25": ValueOf(syscall.SOL_X25), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ATTACH_FILTER": ValueOf(syscall.SO_ATTACH_FILTER), + "SO_BINDTODEVICE": ValueOf(syscall.SO_BINDTODEVICE), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_BSDCOMPAT": ValueOf(syscall.SO_BSDCOMPAT), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DETACH_FILTER": ValueOf(syscall.SO_DETACH_FILTER), + "SO_DOMAIN": ValueOf(syscall.SO_DOMAIN), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_MARK": ValueOf(syscall.SO_MARK), + "SO_NO_CHECK": ValueOf(syscall.SO_NO_CHECK), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PASSCRED": ValueOf(syscall.SO_PASSCRED), + "SO_PASSSEC": ValueOf(syscall.SO_PASSSEC), + "SO_PEERCRED": ValueOf(syscall.SO_PEERCRED), + "SO_PEERNAME": ValueOf(syscall.SO_PEERNAME), + "SO_PEERSEC": ValueOf(syscall.SO_PEERSEC), + "SO_PRIORITY": ValueOf(syscall.SO_PRIORITY), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVBUFFORCE": ValueOf(syscall.SO_RCVBUFFORCE), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_RXQ_OVFL": ValueOf(syscall.SO_RXQ_OVFL), + "SO_SECURITY_AUTHENTICATION": ValueOf(syscall.SO_SECURITY_AUTHENTICATION), + "SO_SECURITY_ENCRYPTION_NETWORK": ValueOf(syscall.SO_SECURITY_ENCRYPTION_NETWORK), + "SO_SECURITY_ENCRYPTION_TRANSPORT": ValueOf(syscall.SO_SECURITY_ENCRYPTION_TRANSPORT), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDBUFFORCE": ValueOf(syscall.SO_SNDBUFFORCE), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMPING": ValueOf(syscall.SO_TIMESTAMPING), + "SO_TIMESTAMPNS": ValueOf(syscall.SO_TIMESTAMPNS), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT4": ValueOf(syscall.SYS_ACCEPT4), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_KEY": ValueOf(syscall.SYS_ADD_KEY), + "SYS_ADJTIMEX": ValueOf(syscall.SYS_ADJTIMEX), + "SYS_AFS_SYSCALL": ValueOf(syscall.SYS_AFS_SYSCALL), + "SYS_ALARM": ValueOf(syscall.SYS_ALARM), + "SYS_ARCH_PRCTL": ValueOf(syscall.SYS_ARCH_PRCTL), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BRK": ValueOf(syscall.SYS_BRK), + "SYS_CAPGET": ValueOf(syscall.SYS_CAPGET), + "SYS_CAPSET": ValueOf(syscall.SYS_CAPSET), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_NANOSLEEP": ValueOf(syscall.SYS_CLOCK_NANOSLEEP), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLONE": ValueOf(syscall.SYS_CLONE), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CREAT": ValueOf(syscall.SYS_CREAT), + "SYS_CREATE_MODULE": ValueOf(syscall.SYS_CREATE_MODULE), + "SYS_DELETE_MODULE": ValueOf(syscall.SYS_DELETE_MODULE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_DUP3": ValueOf(syscall.SYS_DUP3), + "SYS_EPOLL_CREATE": ValueOf(syscall.SYS_EPOLL_CREATE), + "SYS_EPOLL_CREATE1": ValueOf(syscall.SYS_EPOLL_CREATE1), + "SYS_EPOLL_CTL": ValueOf(syscall.SYS_EPOLL_CTL), + "SYS_EPOLL_CTL_OLD": ValueOf(syscall.SYS_EPOLL_CTL_OLD), + "SYS_EPOLL_PWAIT": ValueOf(syscall.SYS_EPOLL_PWAIT), + "SYS_EPOLL_WAIT": ValueOf(syscall.SYS_EPOLL_WAIT), + "SYS_EPOLL_WAIT_OLD": ValueOf(syscall.SYS_EPOLL_WAIT_OLD), + "SYS_EVENTFD": ValueOf(syscall.SYS_EVENTFD), + "SYS_EVENTFD2": ValueOf(syscall.SYS_EVENTFD2), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXIT_GROUP": ValueOf(syscall.SYS_EXIT_GROUP), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FADVISE64": ValueOf(syscall.SYS_FADVISE64), + "SYS_FALLOCATE": ValueOf(syscall.SYS_FALLOCATE), + "SYS_FANOTIFY_INIT": ValueOf(syscall.SYS_FANOTIFY_INIT), + "SYS_FANOTIFY_MARK": ValueOf(syscall.SYS_FANOTIFY_MARK), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTEX": ValueOf(syscall.SYS_FUTEX), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETCWD": ValueOf(syscall.SYS_GETCWD), + "SYS_GETDENTS": ValueOf(syscall.SYS_GETDENTS), + "SYS_GETDENTS64": ValueOf(syscall.SYS_GETDENTS64), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPMSG": ValueOf(syscall.SYS_GETPMSG), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_GET_KERNEL_SYMS": ValueOf(syscall.SYS_GET_KERNEL_SYMS), + "SYS_GET_MEMPOLICY": ValueOf(syscall.SYS_GET_MEMPOLICY), + "SYS_GET_ROBUST_LIST": ValueOf(syscall.SYS_GET_ROBUST_LIST), + "SYS_GET_THREAD_AREA": ValueOf(syscall.SYS_GET_THREAD_AREA), + "SYS_INIT_MODULE": ValueOf(syscall.SYS_INIT_MODULE), + "SYS_INOTIFY_ADD_WATCH": ValueOf(syscall.SYS_INOTIFY_ADD_WATCH), + "SYS_INOTIFY_INIT": ValueOf(syscall.SYS_INOTIFY_INIT), + "SYS_INOTIFY_INIT1": ValueOf(syscall.SYS_INOTIFY_INIT1), + "SYS_INOTIFY_RM_WATCH": ValueOf(syscall.SYS_INOTIFY_RM_WATCH), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPERM": ValueOf(syscall.SYS_IOPERM), + "SYS_IOPL": ValueOf(syscall.SYS_IOPL), + "SYS_IOPRIO_GET": ValueOf(syscall.SYS_IOPRIO_GET), + "SYS_IOPRIO_SET": ValueOf(syscall.SYS_IOPRIO_SET), + "SYS_IO_CANCEL": ValueOf(syscall.SYS_IO_CANCEL), + "SYS_IO_DESTROY": ValueOf(syscall.SYS_IO_DESTROY), + "SYS_IO_GETEVENTS": ValueOf(syscall.SYS_IO_GETEVENTS), + "SYS_IO_SETUP": ValueOf(syscall.SYS_IO_SETUP), + "SYS_IO_SUBMIT": ValueOf(syscall.SYS_IO_SUBMIT), + "SYS_KEXEC_LOAD": ValueOf(syscall.SYS_KEXEC_LOAD), + "SYS_KEYCTL": ValueOf(syscall.SYS_KEYCTL), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LGETXATTR": ValueOf(syscall.SYS_LGETXATTR), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LLISTXATTR": ValueOf(syscall.SYS_LLISTXATTR), + "SYS_LOOKUP_DCOOKIE": ValueOf(syscall.SYS_LOOKUP_DCOOKIE), + "SYS_LREMOVEXATTR": ValueOf(syscall.SYS_LREMOVEXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSETXATTR": ValueOf(syscall.SYS_LSETXATTR), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MBIND": ValueOf(syscall.SYS_MBIND), + "SYS_MIGRATE_PAGES": ValueOf(syscall.SYS_MIGRATE_PAGES), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MODIFY_LDT": ValueOf(syscall.SYS_MODIFY_LDT), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MOVE_PAGES": ValueOf(syscall.SYS_MOVE_PAGES), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MQ_GETSETATTR": ValueOf(syscall.SYS_MQ_GETSETATTR), + "SYS_MQ_NOTIFY": ValueOf(syscall.SYS_MQ_NOTIFY), + "SYS_MQ_OPEN": ValueOf(syscall.SYS_MQ_OPEN), + "SYS_MQ_TIMEDRECEIVE": ValueOf(syscall.SYS_MQ_TIMEDRECEIVE), + "SYS_MQ_TIMEDSEND": ValueOf(syscall.SYS_MQ_TIMEDSEND), + "SYS_MQ_UNLINK": ValueOf(syscall.SYS_MQ_UNLINK), + "SYS_MREMAP": ValueOf(syscall.SYS_MREMAP), + "SYS_MSGCTL": ValueOf(syscall.SYS_MSGCTL), + "SYS_MSGGET": ValueOf(syscall.SYS_MSGGET), + "SYS_MSGRCV": ValueOf(syscall.SYS_MSGRCV), + "SYS_MSGSND": ValueOf(syscall.SYS_MSGSND), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NEWFSTATAT": ValueOf(syscall.SYS_NEWFSTATAT), + "SYS_NFSSERVCTL": ValueOf(syscall.SYS_NFSSERVCTL), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_PAUSE": ValueOf(syscall.SYS_PAUSE), + "SYS_PERF_EVENT_OPEN": ValueOf(syscall.SYS_PERF_EVENT_OPEN), + "SYS_PERSONALITY": ValueOf(syscall.SYS_PERSONALITY), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_PIVOT_ROOT": ValueOf(syscall.SYS_PIVOT_ROOT), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_PPOLL": ValueOf(syscall.SYS_PPOLL), + "SYS_PRCTL": ValueOf(syscall.SYS_PRCTL), + "SYS_PREAD64": ValueOf(syscall.SYS_PREAD64), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PRLIMIT64": ValueOf(syscall.SYS_PRLIMIT64), + "SYS_PSELECT6": ValueOf(syscall.SYS_PSELECT6), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PUTPMSG": ValueOf(syscall.SYS_PUTPMSG), + "SYS_PWRITE64": ValueOf(syscall.SYS_PWRITE64), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUERY_MODULE": ValueOf(syscall.SYS_QUERY_MODULE), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READAHEAD": ValueOf(syscall.SYS_READAHEAD), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVMMSG": ValueOf(syscall.SYS_RECVMMSG), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_REMAP_FILE_PAGES": ValueOf(syscall.SYS_REMAP_FILE_PAGES), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_REQUEST_KEY": ValueOf(syscall.SYS_REQUEST_KEY), + "SYS_RESTART_SYSCALL": ValueOf(syscall.SYS_RESTART_SYSCALL), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_RT_SIGACTION": ValueOf(syscall.SYS_RT_SIGACTION), + "SYS_RT_SIGPENDING": ValueOf(syscall.SYS_RT_SIGPENDING), + "SYS_RT_SIGPROCMASK": ValueOf(syscall.SYS_RT_SIGPROCMASK), + "SYS_RT_SIGQUEUEINFO": ValueOf(syscall.SYS_RT_SIGQUEUEINFO), + "SYS_RT_SIGRETURN": ValueOf(syscall.SYS_RT_SIGRETURN), + "SYS_RT_SIGSUSPEND": ValueOf(syscall.SYS_RT_SIGSUSPEND), + "SYS_RT_SIGTIMEDWAIT": ValueOf(syscall.SYS_RT_SIGTIMEDWAIT), + "SYS_RT_TGSIGQUEUEINFO": ValueOf(syscall.SYS_RT_TGSIGQUEUEINFO), + "SYS_SCHED_GETAFFINITY": ValueOf(syscall.SYS_SCHED_GETAFFINITY), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETAFFINITY": ValueOf(syscall.SYS_SCHED_SETAFFINITY), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SECURITY": ValueOf(syscall.SYS_SECURITY), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SEMCTL": ValueOf(syscall.SYS_SEMCTL), + "SYS_SEMGET": ValueOf(syscall.SYS_SEMGET), + "SYS_SEMOP": ValueOf(syscall.SYS_SEMOP), + "SYS_SEMTIMEDOP": ValueOf(syscall.SYS_SEMTIMEDOP), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SETDOMAINNAME": ValueOf(syscall.SYS_SETDOMAINNAME), + "SYS_SETFSGID": ValueOf(syscall.SYS_SETFSGID), + "SYS_SETFSUID": ValueOf(syscall.SYS_SETFSUID), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETHOSTNAME": ValueOf(syscall.SYS_SETHOSTNAME), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SET_MEMPOLICY": ValueOf(syscall.SYS_SET_MEMPOLICY), + "SYS_SET_ROBUST_LIST": ValueOf(syscall.SYS_SET_ROBUST_LIST), + "SYS_SET_THREAD_AREA": ValueOf(syscall.SYS_SET_THREAD_AREA), + "SYS_SET_TID_ADDRESS": ValueOf(syscall.SYS_SET_TID_ADDRESS), + "SYS_SHMAT": ValueOf(syscall.SYS_SHMAT), + "SYS_SHMCTL": ValueOf(syscall.SYS_SHMCTL), + "SYS_SHMDT": ValueOf(syscall.SYS_SHMDT), + "SYS_SHMGET": ValueOf(syscall.SYS_SHMGET), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGNALFD": ValueOf(syscall.SYS_SIGNALFD), + "SYS_SIGNALFD4": ValueOf(syscall.SYS_SIGNALFD4), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_SPLICE": ValueOf(syscall.SYS_SPLICE), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYNC_FILE_RANGE": ValueOf(syscall.SYS_SYNC_FILE_RANGE), + "SYS_SYSFS": ValueOf(syscall.SYS_SYSFS), + "SYS_SYSINFO": ValueOf(syscall.SYS_SYSINFO), + "SYS_SYSLOG": ValueOf(syscall.SYS_SYSLOG), + "SYS_TEE": ValueOf(syscall.SYS_TEE), + "SYS_TGKILL": ValueOf(syscall.SYS_TGKILL), + "SYS_TIME": ValueOf(syscall.SYS_TIME), + "SYS_TIMERFD_CREATE": ValueOf(syscall.SYS_TIMERFD_CREATE), + "SYS_TIMERFD_GETTIME": ValueOf(syscall.SYS_TIMERFD_GETTIME), + "SYS_TIMERFD_SETTIME": ValueOf(syscall.SYS_TIMERFD_SETTIME), + "SYS_TIMER_CREATE": ValueOf(syscall.SYS_TIMER_CREATE), + "SYS_TIMER_DELETE": ValueOf(syscall.SYS_TIMER_DELETE), + "SYS_TIMER_GETOVERRUN": ValueOf(syscall.SYS_TIMER_GETOVERRUN), + "SYS_TIMER_GETTIME": ValueOf(syscall.SYS_TIMER_GETTIME), + "SYS_TIMER_SETTIME": ValueOf(syscall.SYS_TIMER_SETTIME), + "SYS_TIMES": ValueOf(syscall.SYS_TIMES), + "SYS_TKILL": ValueOf(syscall.SYS_TKILL), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_TUXCALL": ValueOf(syscall.SYS_TUXCALL), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMOUNT2": ValueOf(syscall.SYS_UMOUNT2), + "SYS_UNAME": ValueOf(syscall.SYS_UNAME), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNSHARE": ValueOf(syscall.SYS_UNSHARE), + "SYS_USELIB": ValueOf(syscall.SYS_USELIB), + "SYS_USTAT": ValueOf(syscall.SYS_USTAT), + "SYS_UTIME": ValueOf(syscall.SYS_UTIME), + "SYS_UTIMENSAT": ValueOf(syscall.SYS_UTIMENSAT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_VHANGUP": ValueOf(syscall.SYS_VHANGUP), + "SYS_VMSPLICE": ValueOf(syscall.SYS_VMSPLICE), + "SYS_VSERVER": ValueOf(syscall.SYS_VSERVER), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS__SYSCTL": ValueOf(syscall.SYS__SYSCTL), + "S_BLKSIZE": ValueOf(syscall.S_BLKSIZE), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetLsfPromisc": ValueOf(syscall.SetLsfPromisc), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setdomainname": ValueOf(syscall.Setdomainname), + "Setenv": ValueOf(syscall.Setenv), + "Setfsgid": ValueOf(syscall.Setfsgid), + "Setfsuid": ValueOf(syscall.Setfsuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Sethostname": ValueOf(syscall.Sethostname), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setresgid": ValueOf(syscall.Setresgid), + "Setresuid": ValueOf(syscall.Setresuid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Setxattr": ValueOf(syscall.Setxattr), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAddrmsg": ValueOf(syscall.SizeofIfAddrmsg), + "SizeofIfInfomsg": ValueOf(syscall.SizeofIfInfomsg), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofInotifyEvent": ValueOf(syscall.SizeofInotifyEvent), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofNlAttr": ValueOf(syscall.SizeofNlAttr), + "SizeofNlMsgerr": ValueOf(syscall.SizeofNlMsgerr), + "SizeofNlMsghdr": ValueOf(syscall.SizeofNlMsghdr), + "SizeofRtAttr": ValueOf(syscall.SizeofRtAttr), + "SizeofRtGenmsg": ValueOf(syscall.SizeofRtGenmsg), + "SizeofRtMsg": ValueOf(syscall.SizeofRtMsg), + "SizeofRtNexthop": ValueOf(syscall.SizeofRtNexthop), + "SizeofSockFilter": ValueOf(syscall.SizeofSockFilter), + "SizeofSockFprog": ValueOf(syscall.SizeofSockFprog), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrLinklayer": ValueOf(syscall.SizeofSockaddrLinklayer), + "SizeofSockaddrNetlink": ValueOf(syscall.SizeofSockaddrNetlink), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SizeofTCPInfo": ValueOf(syscall.SizeofTCPInfo), + "SizeofUcred": ValueOf(syscall.SizeofUcred), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "Splice": ValueOf(syscall.Splice), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "SyncFileRange": ValueOf(syscall.SyncFileRange), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Sysinfo": ValueOf(syscall.Sysinfo), + "TCGETS": ValueOf(syscall.TCGETS), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_CORK": ValueOf(syscall.TCP_CORK), + "TCP_DEFER_ACCEPT": ValueOf(syscall.TCP_DEFER_ACCEPT), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_LINGER2": ValueOf(syscall.TCP_LINGER2), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MD5SIG_MAXKEYLEN": ValueOf(syscall.TCP_MD5SIG_MAXKEYLEN), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_QUICKACK": ValueOf(syscall.TCP_QUICKACK), + "TCP_SYNCNT": ValueOf(syscall.TCP_SYNCNT), + "TCP_WINDOW_CLAMP": ValueOf(syscall.TCP_WINDOW_CLAMP), + "TCSETS": ValueOf(syscall.TCSETS), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCONS": ValueOf(syscall.TIOCCONS), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCGDEV": ValueOf(uint32(syscall.TIOCGDEV)), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGICOUNT": ValueOf(syscall.TIOCGICOUNT), + "TIOCGLCKTRMIOS": ValueOf(syscall.TIOCGLCKTRMIOS), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPTN": ValueOf(uint32(syscall.TIOCGPTN)), + "TIOCGRS485": ValueOf(syscall.TIOCGRS485), + "TIOCGSERIAL": ValueOf(syscall.TIOCGSERIAL), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGSOFTCAR": ValueOf(syscall.TIOCGSOFTCAR), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCINQ": ValueOf(syscall.TIOCINQ), + "TIOCLINUX": ValueOf(syscall.TIOCLINUX), + "TIOCMBIC": ValueOf(syscall.TIOCMBIC), + "TIOCMBIS": ValueOf(syscall.TIOCMBIS), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMIWAIT": ValueOf(syscall.TIOCMIWAIT), + "TIOCMSET": ValueOf(syscall.TIOCMSET), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(syscall.TIOCPKT), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSERCONFIG": ValueOf(syscall.TIOCSERCONFIG), + "TIOCSERGETLSR": ValueOf(syscall.TIOCSERGETLSR), + "TIOCSERGETMULTI": ValueOf(syscall.TIOCSERGETMULTI), + "TIOCSERGSTRUCT": ValueOf(syscall.TIOCSERGSTRUCT), + "TIOCSERGWILD": ValueOf(syscall.TIOCSERGWILD), + "TIOCSERSETMULTI": ValueOf(syscall.TIOCSERSETMULTI), + "TIOCSERSWILD": ValueOf(syscall.TIOCSERSWILD), + "TIOCSER_TEMT": ValueOf(syscall.TIOCSER_TEMT), + "TIOCSETD": ValueOf(syscall.TIOCSETD), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSLCKTRMIOS": ValueOf(syscall.TIOCSLCKTRMIOS), + "TIOCSPGRP": ValueOf(syscall.TIOCSPGRP), + "TIOCSPTLCK": ValueOf(syscall.TIOCSPTLCK), + "TIOCSRS485": ValueOf(syscall.TIOCSRS485), + "TIOCSSERIAL": ValueOf(syscall.TIOCSSERIAL), + "TIOCSSOFTCAR": ValueOf(syscall.TIOCSSOFTCAR), + "TIOCSTI": ValueOf(syscall.TIOCSTI), + "TIOCSWINSZ": ValueOf(syscall.TIOCSWINSZ), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TUNATTACHFILTER": ValueOf(syscall.TUNATTACHFILTER), + "TUNDETACHFILTER": ValueOf(syscall.TUNDETACHFILTER), + "TUNGETFEATURES": ValueOf(uint32(syscall.TUNGETFEATURES)), + "TUNGETIFF": ValueOf(uint32(syscall.TUNGETIFF)), + "TUNGETSNDBUF": ValueOf(uint32(syscall.TUNGETSNDBUF)), + "TUNGETVNETHDRSZ": ValueOf(uint32(syscall.TUNGETVNETHDRSZ)), + "TUNSETDEBUG": ValueOf(syscall.TUNSETDEBUG), + "TUNSETGROUP": ValueOf(syscall.TUNSETGROUP), + "TUNSETIFF": ValueOf(syscall.TUNSETIFF), + "TUNSETLINK": ValueOf(syscall.TUNSETLINK), + "TUNSETNOCSUM": ValueOf(syscall.TUNSETNOCSUM), + "TUNSETOFFLOAD": ValueOf(syscall.TUNSETOFFLOAD), + "TUNSETOWNER": ValueOf(syscall.TUNSETOWNER), + "TUNSETPERSIST": ValueOf(syscall.TUNSETPERSIST), + "TUNSETSNDBUF": ValueOf(syscall.TUNSETSNDBUF), + "TUNSETTXFILTER": ValueOf(syscall.TUNSETTXFILTER), + "TUNSETVNETHDRSZ": ValueOf(syscall.TUNSETVNETHDRSZ), + "Tee": ValueOf(syscall.Tee), + "Tgkill": ValueOf(syscall.Tgkill), + "Time": ValueOf(syscall.Time), + "Times": ValueOf(syscall.Times), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Uname": ValueOf(syscall.Uname), + "UnixCredentials": ValueOf(syscall.UnixCredentials), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unlinkat": ValueOf(syscall.Unlinkat), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Unshare": ValueOf(syscall.Unshare), + "Ustat": ValueOf(syscall.Ustat), + "Utime": ValueOf(syscall.Utime), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VSWTC": ValueOf(syscall.VSWTC), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WALL": ValueOf(syscall.WALL), + "WCLONE": ValueOf(uint32(syscall.WCLONE)), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOTHREAD": ValueOf(syscall.WNOTHREAD), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + "XCASE": ValueOf(syscall.XCASE), + },Types: map[string]Type{ + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "EpollEvent": TypeOf((*syscall.EpollEvent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAddrmsg": TypeOf((*syscall.IfAddrmsg)(nil)).Elem(), + "IfInfomsg": TypeOf((*syscall.IfInfomsg)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InotifyEvent": TypeOf((*syscall.InotifyEvent)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "NetlinkMessage": TypeOf((*syscall.NetlinkMessage)(nil)).Elem(), + "NetlinkRouteAttr": TypeOf((*syscall.NetlinkRouteAttr)(nil)).Elem(), + "NetlinkRouteRequest": TypeOf((*syscall.NetlinkRouteRequest)(nil)).Elem(), + "NlAttr": TypeOf((*syscall.NlAttr)(nil)).Elem(), + "NlMsgerr": TypeOf((*syscall.NlMsgerr)(nil)).Elem(), + "NlMsghdr": TypeOf((*syscall.NlMsghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "PtraceRegs": TypeOf((*syscall.PtraceRegs)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrLinklayer": TypeOf((*syscall.RawSockaddrLinklayer)(nil)).Elem(), + "RawSockaddrNetlink": TypeOf((*syscall.RawSockaddrNetlink)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RtAttr": TypeOf((*syscall.RtAttr)(nil)).Elem(), + "RtGenmsg": TypeOf((*syscall.RtGenmsg)(nil)).Elem(), + "RtMsg": TypeOf((*syscall.RtMsg)(nil)).Elem(), + "RtNexthop": TypeOf((*syscall.RtNexthop)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "SockFilter": TypeOf((*syscall.SockFilter)(nil)).Elem(), + "SockFprog": TypeOf((*syscall.SockFprog)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrLinklayer": TypeOf((*syscall.SockaddrLinklayer)(nil)).Elem(), + "SockaddrNetlink": TypeOf((*syscall.SockaddrNetlink)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "SysProcIDMap": TypeOf((*syscall.SysProcIDMap)(nil)).Elem(), + "Sysinfo_t": TypeOf((*syscall.Sysinfo_t)(nil)).Elem(), + "TCPInfo": TypeOf((*syscall.TCPInfo)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Time_t": TypeOf((*syscall.Time_t)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timex": TypeOf((*syscall.Timex)(nil)).Elem(), + "Tms": TypeOf((*syscall.Tms)(nil)).Elem(), + "Ucred": TypeOf((*syscall.Ucred)(nil)).Elem(), + "Ustat_t": TypeOf((*syscall.Ustat_t)(nil)).Elem(), + "Utimbuf": TypeOf((*syscall.Utimbuf)(nil)).Elem(), + "Utsname": TypeOf((*syscall.Utsname)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + },Untypeds: map[string]string{ + "AF_ALG": "int:38", + "AF_APPLETALK": "int:5", + "AF_ASH": "int:18", + "AF_ATMPVC": "int:8", + "AF_ATMSVC": "int:20", + "AF_AX25": "int:3", + "AF_BLUETOOTH": "int:31", + "AF_BRIDGE": "int:7", + "AF_CAIF": "int:37", + "AF_CAN": "int:29", + "AF_DECnet": "int:12", + "AF_ECONET": "int:19", + "AF_FILE": "int:1", + "AF_IEEE802154": "int:36", + "AF_INET": "int:2", + "AF_INET6": "int:10", + "AF_IPX": "int:4", + "AF_IRDA": "int:23", + "AF_ISDN": "int:34", + "AF_IUCV": "int:32", + "AF_KEY": "int:15", + "AF_LLC": "int:26", + "AF_LOCAL": "int:1", + "AF_MAX": "int:39", + "AF_NETBEUI": "int:13", + "AF_NETLINK": "int:16", + "AF_NETROM": "int:6", + "AF_PACKET": "int:17", + "AF_PHONET": "int:35", + "AF_PPPOX": "int:24", + "AF_RDS": "int:21", + "AF_ROSE": "int:11", + "AF_ROUTE": "int:16", + "AF_RXRPC": "int:33", + "AF_SECURITY": "int:14", + "AF_SNA": "int:22", + "AF_TIPC": "int:30", + "AF_UNIX": "int:1", + "AF_UNSPEC": "int:0", + "AF_WANPIPE": "int:25", + "AF_X25": "int:9", + "ARPHRD_ADAPT": "int:264", + "ARPHRD_APPLETLK": "int:8", + "ARPHRD_ARCNET": "int:7", + "ARPHRD_ASH": "int:781", + "ARPHRD_ATM": "int:19", + "ARPHRD_AX25": "int:3", + "ARPHRD_BIF": "int:775", + "ARPHRD_CHAOS": "int:5", + "ARPHRD_CISCO": "int:513", + "ARPHRD_CSLIP": "int:257", + "ARPHRD_CSLIP6": "int:259", + "ARPHRD_DDCMP": "int:517", + "ARPHRD_DLCI": "int:15", + "ARPHRD_ECONET": "int:782", + "ARPHRD_EETHER": "int:2", + "ARPHRD_ETHER": "int:1", + "ARPHRD_EUI64": "int:27", + "ARPHRD_FCAL": "int:785", + "ARPHRD_FCFABRIC": "int:787", + "ARPHRD_FCPL": "int:786", + "ARPHRD_FCPP": "int:784", + "ARPHRD_FDDI": "int:774", + "ARPHRD_FRAD": "int:770", + "ARPHRD_HDLC": "int:513", + "ARPHRD_HIPPI": "int:780", + "ARPHRD_HWX25": "int:272", + "ARPHRD_IEEE1394": "int:24", + "ARPHRD_IEEE802": "int:6", + "ARPHRD_IEEE80211": "int:801", + "ARPHRD_IEEE80211_PRISM": "int:802", + "ARPHRD_IEEE80211_RADIOTAP": "int:803", + "ARPHRD_IEEE802154": "int:804", + "ARPHRD_IEEE802154_PHY": "int:805", + "ARPHRD_IEEE802_TR": "int:800", + "ARPHRD_INFINIBAND": "int:32", + "ARPHRD_IPDDP": "int:777", + "ARPHRD_IPGRE": "int:778", + "ARPHRD_IRDA": "int:783", + "ARPHRD_LAPB": "int:516", + "ARPHRD_LOCALTLK": "int:773", + "ARPHRD_LOOPBACK": "int:772", + "ARPHRD_METRICOM": "int:23", + "ARPHRD_NETROM": "int:0", + "ARPHRD_NONE": "int:65534", + "ARPHRD_PIMREG": "int:779", + "ARPHRD_PPP": "int:512", + "ARPHRD_PRONET": "int:4", + "ARPHRD_RAWHDLC": "int:518", + "ARPHRD_ROSE": "int:270", + "ARPHRD_RSRVD": "int:260", + "ARPHRD_SIT": "int:776", + "ARPHRD_SKIP": "int:771", + "ARPHRD_SLIP": "int:256", + "ARPHRD_SLIP6": "int:258", + "ARPHRD_TUNNEL": "int:768", + "ARPHRD_TUNNEL6": "int:769", + "ARPHRD_VOID": "int:65535", + "ARPHRD_X25": "int:271", + "B0": "int:0", + "B1000000": "int:4104", + "B110": "int:3", + "B115200": "int:4098", + "B1152000": "int:4105", + "B1200": "int:9", + "B134": "int:4", + "B150": "int:5", + "B1500000": "int:4106", + "B1800": "int:10", + "B19200": "int:14", + "B200": "int:6", + "B2000000": "int:4107", + "B230400": "int:4099", + "B2400": "int:11", + "B2500000": "int:4108", + "B300": "int:7", + "B3000000": "int:4109", + "B3500000": "int:4110", + "B38400": "int:15", + "B4000000": "int:4111", + "B460800": "int:4100", + "B4800": "int:12", + "B50": "int:1", + "B500000": "int:4101", + "B57600": "int:4097", + "B576000": "int:4102", + "B600": "int:8", + "B75": "int:2", + "B921600": "int:4103", + "B9600": "int:13", + "BPF_A": "int:16", + "BPF_ABS": "int:32", + "BPF_ADD": "int:0", + "BPF_ALU": "int:4", + "BPF_AND": "int:80", + "BPF_B": "int:16", + "BPF_DIV": "int:48", + "BPF_H": "int:8", + "BPF_IMM": "int:0", + "BPF_IND": "int:64", + "BPF_JA": "int:0", + "BPF_JEQ": "int:16", + "BPF_JGE": "int:48", + "BPF_JGT": "int:32", + "BPF_JMP": "int:5", + "BPF_JSET": "int:64", + "BPF_K": "int:0", + "BPF_LD": "int:0", + "BPF_LDX": "int:1", + "BPF_LEN": "int:128", + "BPF_LSH": "int:96", + "BPF_MAJOR_VERSION": "int:1", + "BPF_MAXINSNS": "int:4096", + "BPF_MEM": "int:96", + "BPF_MEMWORDS": "int:16", + "BPF_MINOR_VERSION": "int:1", + "BPF_MISC": "int:7", + "BPF_MSH": "int:160", + "BPF_MUL": "int:32", + "BPF_NEG": "int:128", + "BPF_OR": "int:64", + "BPF_RET": "int:6", + "BPF_RSH": "int:112", + "BPF_ST": "int:2", + "BPF_STX": "int:3", + "BPF_SUB": "int:16", + "BPF_TAX": "int:0", + "BPF_TXA": "int:128", + "BPF_W": "int:0", + "BPF_X": "int:8", + "BRKINT": "int:2", + "CLOCAL": "int:2048", + "CLONE_CHILD_CLEARTID": "int:2097152", + "CLONE_CHILD_SETTID": "int:16777216", + "CLONE_DETACHED": "int:4194304", + "CLONE_FILES": "int:1024", + "CLONE_FS": "int:512", + "CLONE_IO": "int:2147483648", + "CLONE_NEWIPC": "int:134217728", + "CLONE_NEWNET": "int:1073741824", + "CLONE_NEWNS": "int:131072", + "CLONE_NEWPID": "int:536870912", + "CLONE_NEWUSER": "int:268435456", + "CLONE_NEWUTS": "int:67108864", + "CLONE_PARENT": "int:32768", + "CLONE_PARENT_SETTID": "int:1048576", + "CLONE_PTRACE": "int:8192", + "CLONE_SETTLS": "int:524288", + "CLONE_SIGHAND": "int:2048", + "CLONE_SYSVSEM": "int:262144", + "CLONE_THREAD": "int:65536", + "CLONE_UNTRACED": "int:8388608", + "CLONE_VFORK": "int:16384", + "CLONE_VM": "int:256", + "CREAD": "int:128", + "CS5": "int:0", + "CS6": "int:16", + "CS7": "int:32", + "CS8": "int:48", + "CSIZE": "int:48", + "CSTOPB": "int:64", + "DT_BLK": "int:6", + "DT_CHR": "int:2", + "DT_DIR": "int:4", + "DT_FIFO": "int:1", + "DT_LNK": "int:10", + "DT_REG": "int:8", + "DT_SOCK": "int:12", + "DT_UNKNOWN": "int:0", + "DT_WHT": "int:14", + "ECHO": "int:8", + "ECHOCTL": "int:512", + "ECHOE": "int:16", + "ECHOK": "int:32", + "ECHOKE": "int:2048", + "ECHONL": "int:64", + "ECHOPRT": "int:1024", + "EPOLLERR": "int:8", + "EPOLLET": "int:-2147483648", + "EPOLLHUP": "int:16", + "EPOLLIN": "int:1", + "EPOLLMSG": "int:1024", + "EPOLLONESHOT": "int:1073741824", + "EPOLLOUT": "int:4", + "EPOLLPRI": "int:2", + "EPOLLRDBAND": "int:128", + "EPOLLRDHUP": "int:8192", + "EPOLLRDNORM": "int:64", + "EPOLLWRBAND": "int:512", + "EPOLLWRNORM": "int:256", + "EPOLL_CLOEXEC": "int:524288", + "EPOLL_CTL_ADD": "int:1", + "EPOLL_CTL_DEL": "int:2", + "EPOLL_CTL_MOD": "int:3", + "EPOLL_NONBLOCK": "int:2048", + "ETH_P_1588": "int:35063", + "ETH_P_8021Q": "int:33024", + "ETH_P_802_2": "int:4", + "ETH_P_802_3": "int:1", + "ETH_P_AARP": "int:33011", + "ETH_P_ALL": "int:3", + "ETH_P_AOE": "int:34978", + "ETH_P_ARCNET": "int:26", + "ETH_P_ARP": "int:2054", + "ETH_P_ATALK": "int:32923", + "ETH_P_ATMFATE": "int:34948", + "ETH_P_ATMMPOA": "int:34892", + "ETH_P_AX25": "int:2", + "ETH_P_BPQ": "int:2303", + "ETH_P_CAIF": "int:247", + "ETH_P_CAN": "int:12", + "ETH_P_CONTROL": "int:22", + "ETH_P_CUST": "int:24582", + "ETH_P_DDCMP": "int:6", + "ETH_P_DEC": "int:24576", + "ETH_P_DIAG": "int:24581", + "ETH_P_DNA_DL": "int:24577", + "ETH_P_DNA_RC": "int:24578", + "ETH_P_DNA_RT": "int:24579", + "ETH_P_DSA": "int:27", + "ETH_P_ECONET": "int:24", + "ETH_P_EDSA": "int:56026", + "ETH_P_FCOE": "int:35078", + "ETH_P_FIP": "int:35092", + "ETH_P_HDLC": "int:25", + "ETH_P_IEEE802154": "int:246", + "ETH_P_IEEEPUP": "int:2560", + "ETH_P_IEEEPUPAT": "int:2561", + "ETH_P_IP": "int:2048", + "ETH_P_IPV6": "int:34525", + "ETH_P_IPX": "int:33079", + "ETH_P_IRDA": "int:23", + "ETH_P_LAT": "int:24580", + "ETH_P_LINK_CTL": "int:34924", + "ETH_P_LOCALTALK": "int:9", + "ETH_P_LOOP": "int:96", + "ETH_P_MOBITEX": "int:21", + "ETH_P_MPLS_MC": "int:34888", + "ETH_P_MPLS_UC": "int:34887", + "ETH_P_PAE": "int:34958", + "ETH_P_PAUSE": "int:34824", + "ETH_P_PHONET": "int:245", + "ETH_P_PPPTALK": "int:16", + "ETH_P_PPP_DISC": "int:34915", + "ETH_P_PPP_MP": "int:8", + "ETH_P_PPP_SES": "int:34916", + "ETH_P_PUP": "int:512", + "ETH_P_PUPAT": "int:513", + "ETH_P_RARP": "int:32821", + "ETH_P_SCA": "int:24583", + "ETH_P_SLOW": "int:34825", + "ETH_P_SNAP": "int:5", + "ETH_P_TEB": "int:25944", + "ETH_P_TIPC": "int:35018", + "ETH_P_TRAILER": "int:28", + "ETH_P_TR_802_2": "int:17", + "ETH_P_WAN_PPP": "int:7", + "ETH_P_WCCP": "int:34878", + "ETH_P_X25": "int:2053", + "FD_CLOEXEC": "int:1", + "FD_SETSIZE": "int:1024", + "FLUSHO": "int:4096", + "F_DUPFD": "int:0", + "F_DUPFD_CLOEXEC": "int:1030", + "F_EXLCK": "int:4", + "F_GETFD": "int:1", + "F_GETFL": "int:3", + "F_GETLEASE": "int:1025", + "F_GETLK": "int:5", + "F_GETLK64": "int:5", + "F_GETOWN": "int:9", + "F_GETOWN_EX": "int:16", + "F_GETPIPE_SZ": "int:1032", + "F_GETSIG": "int:11", + "F_LOCK": "int:1", + "F_NOTIFY": "int:1026", + "F_OK": "int:0", + "F_RDLCK": "int:0", + "F_SETFD": "int:2", + "F_SETFL": "int:4", + "F_SETLEASE": "int:1024", + "F_SETLK": "int:6", + "F_SETLK64": "int:6", + "F_SETLKW": "int:7", + "F_SETLKW64": "int:7", + "F_SETOWN": "int:8", + "F_SETOWN_EX": "int:15", + "F_SETPIPE_SZ": "int:1031", + "F_SETSIG": "int:10", + "F_SHLCK": "int:8", + "F_TEST": "int:3", + "F_TLOCK": "int:2", + "F_ULOCK": "int:0", + "F_UNLCK": "int:2", + "F_WRLCK": "int:1", + "HUPCL": "int:1024", + "ICANON": "int:2", + "ICMPV6_FILTER": "int:1", + "ICRNL": "int:256", + "IEXTEN": "int:32768", + "IFA_ADDRESS": "int:1", + "IFA_ANYCAST": "int:5", + "IFA_BROADCAST": "int:4", + "IFA_CACHEINFO": "int:6", + "IFA_F_DADFAILED": "int:8", + "IFA_F_DEPRECATED": "int:32", + "IFA_F_HOMEADDRESS": "int:16", + "IFA_F_NODAD": "int:2", + "IFA_F_OPTIMISTIC": "int:4", + "IFA_F_PERMANENT": "int:128", + "IFA_F_SECONDARY": "int:1", + "IFA_F_TEMPORARY": "int:1", + "IFA_F_TENTATIVE": "int:64", + "IFA_LABEL": "int:3", + "IFA_LOCAL": "int:2", + "IFA_MAX": "int:7", + "IFA_MULTICAST": "int:7", + "IFA_UNSPEC": "int:0", + "IFF_ALLMULTI": "int:512", + "IFF_AUTOMEDIA": "int:16384", + "IFF_BROADCAST": "int:2", + "IFF_DEBUG": "int:4", + "IFF_DYNAMIC": "int:32768", + "IFF_LOOPBACK": "int:8", + "IFF_MASTER": "int:1024", + "IFF_MULTICAST": "int:4096", + "IFF_NOARP": "int:128", + "IFF_NOTRAILERS": "int:32", + "IFF_NO_PI": "int:4096", + "IFF_ONE_QUEUE": "int:8192", + "IFF_POINTOPOINT": "int:16", + "IFF_PORTSEL": "int:8192", + "IFF_PROMISC": "int:256", + "IFF_RUNNING": "int:64", + "IFF_SLAVE": "int:2048", + "IFF_TAP": "int:2", + "IFF_TUN": "int:1", + "IFF_TUN_EXCL": "int:32768", + "IFF_UP": "int:1", + "IFF_VNET_HDR": "int:16384", + "IFLA_ADDRESS": "int:1", + "IFLA_BROADCAST": "int:2", + "IFLA_COST": "int:8", + "IFLA_IFALIAS": "int:20", + "IFLA_IFNAME": "int:3", + "IFLA_LINK": "int:5", + "IFLA_LINKINFO": "int:18", + "IFLA_LINKMODE": "int:17", + "IFLA_MAP": "int:14", + "IFLA_MASTER": "int:10", + "IFLA_MAX": "int:29", + "IFLA_MTU": "int:4", + "IFLA_NET_NS_PID": "int:19", + "IFLA_OPERSTATE": "int:16", + "IFLA_PRIORITY": "int:9", + "IFLA_PROTINFO": "int:12", + "IFLA_QDISC": "int:6", + "IFLA_STATS": "int:7", + "IFLA_TXQLEN": "int:13", + "IFLA_UNSPEC": "int:0", + "IFLA_WEIGHT": "int:15", + "IFLA_WIRELESS": "int:11", + "IFNAMSIZ": "int:16", + "IGNBRK": "int:1", + "IGNCR": "int:128", + "IGNPAR": "int:4", + "IMAXBEL": "int:8192", + "INLCR": "int:64", + "INPCK": "int:16", + "IN_ACCESS": "int:1", + "IN_ALL_EVENTS": "int:4095", + "IN_ATTRIB": "int:4", + "IN_CLASSA_HOST": "int:16777215", + "IN_CLASSA_MAX": "int:128", + "IN_CLASSA_NET": "int:4278190080", + "IN_CLASSA_NSHIFT": "int:24", + "IN_CLASSB_HOST": "int:65535", + "IN_CLASSB_MAX": "int:65536", + "IN_CLASSB_NET": "int:4294901760", + "IN_CLASSB_NSHIFT": "int:16", + "IN_CLASSC_HOST": "int:255", + "IN_CLASSC_NET": "int:4294967040", + "IN_CLASSC_NSHIFT": "int:8", + "IN_CLOEXEC": "int:524288", + "IN_CLOSE": "int:24", + "IN_CLOSE_NOWRITE": "int:16", + "IN_CLOSE_WRITE": "int:8", + "IN_CREATE": "int:256", + "IN_DELETE": "int:512", + "IN_DELETE_SELF": "int:1024", + "IN_DONT_FOLLOW": "int:33554432", + "IN_EXCL_UNLINK": "int:67108864", + "IN_IGNORED": "int:32768", + "IN_ISDIR": "int:1073741824", + "IN_LOOPBACKNET": "int:127", + "IN_MASK_ADD": "int:536870912", + "IN_MODIFY": "int:2", + "IN_MOVE": "int:192", + "IN_MOVED_FROM": "int:64", + "IN_MOVED_TO": "int:128", + "IN_MOVE_SELF": "int:2048", + "IN_NONBLOCK": "int:2048", + "IN_ONESHOT": "int:2147483648", + "IN_ONLYDIR": "int:16777216", + "IN_OPEN": "int:32", + "IN_Q_OVERFLOW": "int:16384", + "IN_UNMOUNT": "int:8192", + "IPPROTO_AH": "int:51", + "IPPROTO_COMP": "int:108", + "IPPROTO_DCCP": "int:33", + "IPPROTO_DSTOPTS": "int:60", + "IPPROTO_EGP": "int:8", + "IPPROTO_ENCAP": "int:98", + "IPPROTO_ESP": "int:50", + "IPPROTO_FRAGMENT": "int:44", + "IPPROTO_GRE": "int:47", + "IPPROTO_HOPOPTS": "int:0", + "IPPROTO_ICMP": "int:1", + "IPPROTO_ICMPV6": "int:58", + "IPPROTO_IDP": "int:22", + "IPPROTO_IGMP": "int:2", + "IPPROTO_IP": "int:0", + "IPPROTO_IPIP": "int:4", + "IPPROTO_IPV6": "int:41", + "IPPROTO_MTP": "int:92", + "IPPROTO_NONE": "int:59", + "IPPROTO_PIM": "int:103", + "IPPROTO_PUP": "int:12", + "IPPROTO_RAW": "int:255", + "IPPROTO_ROUTING": "int:43", + "IPPROTO_RSVP": "int:46", + "IPPROTO_SCTP": "int:132", + "IPPROTO_TCP": "int:6", + "IPPROTO_TP": "int:29", + "IPPROTO_UDP": "int:17", + "IPPROTO_UDPLITE": "int:136", + "IPV6_2292DSTOPTS": "int:4", + "IPV6_2292HOPLIMIT": "int:8", + "IPV6_2292HOPOPTS": "int:3", + "IPV6_2292PKTINFO": "int:2", + "IPV6_2292PKTOPTIONS": "int:6", + "IPV6_2292RTHDR": "int:5", + "IPV6_ADDRFORM": "int:1", + "IPV6_ADD_MEMBERSHIP": "int:20", + "IPV6_AUTHHDR": "int:10", + "IPV6_CHECKSUM": "int:7", + "IPV6_DROP_MEMBERSHIP": "int:21", + "IPV6_DSTOPTS": "int:59", + "IPV6_HOPLIMIT": "int:52", + "IPV6_HOPOPTS": "int:54", + "IPV6_IPSEC_POLICY": "int:34", + "IPV6_JOIN_ANYCAST": "int:27", + "IPV6_JOIN_GROUP": "int:20", + "IPV6_LEAVE_ANYCAST": "int:28", + "IPV6_LEAVE_GROUP": "int:21", + "IPV6_MTU": "int:24", + "IPV6_MTU_DISCOVER": "int:23", + "IPV6_MULTICAST_HOPS": "int:18", + "IPV6_MULTICAST_IF": "int:17", + "IPV6_MULTICAST_LOOP": "int:19", + "IPV6_NEXTHOP": "int:9", + "IPV6_PKTINFO": "int:50", + "IPV6_PMTUDISC_DO": "int:2", + "IPV6_PMTUDISC_DONT": "int:0", + "IPV6_PMTUDISC_PROBE": "int:3", + "IPV6_PMTUDISC_WANT": "int:1", + "IPV6_RECVDSTOPTS": "int:58", + "IPV6_RECVERR": "int:25", + "IPV6_RECVHOPLIMIT": "int:51", + "IPV6_RECVHOPOPTS": "int:53", + "IPV6_RECVPKTINFO": "int:49", + "IPV6_RECVRTHDR": "int:56", + "IPV6_RECVTCLASS": "int:66", + "IPV6_ROUTER_ALERT": "int:22", + "IPV6_RTHDR": "int:57", + "IPV6_RTHDRDSTOPTS": "int:55", + "IPV6_RTHDR_LOOSE": "int:0", + "IPV6_RTHDR_STRICT": "int:1", + "IPV6_RTHDR_TYPE_0": "int:0", + "IPV6_RXDSTOPTS": "int:59", + "IPV6_RXHOPOPTS": "int:54", + "IPV6_TCLASS": "int:67", + "IPV6_UNICAST_HOPS": "int:16", + "IPV6_V6ONLY": "int:26", + "IPV6_XFRM_POLICY": "int:35", + "IP_ADD_MEMBERSHIP": "int:35", + "IP_ADD_SOURCE_MEMBERSHIP": "int:39", + "IP_BLOCK_SOURCE": "int:38", + "IP_DEFAULT_MULTICAST_LOOP": "int:1", + "IP_DEFAULT_MULTICAST_TTL": "int:1", + "IP_DF": "int:16384", + "IP_DROP_MEMBERSHIP": "int:36", + "IP_DROP_SOURCE_MEMBERSHIP": "int:40", + "IP_FREEBIND": "int:15", + "IP_HDRINCL": "int:3", + "IP_IPSEC_POLICY": "int:16", + "IP_MAXPACKET": "int:65535", + "IP_MAX_MEMBERSHIPS": "int:20", + "IP_MF": "int:8192", + "IP_MINTTL": "int:21", + "IP_MSFILTER": "int:41", + "IP_MSS": "int:576", + "IP_MTU": "int:14", + "IP_MTU_DISCOVER": "int:10", + "IP_MULTICAST_IF": "int:32", + "IP_MULTICAST_LOOP": "int:34", + "IP_MULTICAST_TTL": "int:33", + "IP_OFFMASK": "int:8191", + "IP_OPTIONS": "int:4", + "IP_ORIGDSTADDR": "int:20", + "IP_PASSSEC": "int:18", + "IP_PKTINFO": "int:8", + "IP_PKTOPTIONS": "int:9", + "IP_PMTUDISC": "int:10", + "IP_PMTUDISC_DO": "int:2", + "IP_PMTUDISC_DONT": "int:0", + "IP_PMTUDISC_PROBE": "int:3", + "IP_PMTUDISC_WANT": "int:1", + "IP_RECVERR": "int:11", + "IP_RECVOPTS": "int:6", + "IP_RECVORIGDSTADDR": "int:20", + "IP_RECVRETOPTS": "int:7", + "IP_RECVTOS": "int:13", + "IP_RECVTTL": "int:12", + "IP_RETOPTS": "int:7", + "IP_RF": "int:32768", + "IP_ROUTER_ALERT": "int:5", + "IP_TOS": "int:1", + "IP_TRANSPARENT": "int:19", + "IP_TTL": "int:2", + "IP_UNBLOCK_SOURCE": "int:37", + "IP_XFRM_POLICY": "int:17", + "ISIG": "int:1", + "ISTRIP": "int:32", + "IUCLC": "int:512", + "IUTF8": "int:16384", + "IXANY": "int:2048", + "IXOFF": "int:4096", + "IXON": "int:1024", + "ImplementsGetwd": "bool:true", + "LINUX_REBOOT_CMD_CAD_OFF": "int:0", + "LINUX_REBOOT_CMD_CAD_ON": "int:2309737967", + "LINUX_REBOOT_CMD_HALT": "int:3454992675", + "LINUX_REBOOT_CMD_KEXEC": "int:1163412803", + "LINUX_REBOOT_CMD_POWER_OFF": "int:1126301404", + "LINUX_REBOOT_CMD_RESTART": "int:19088743", + "LINUX_REBOOT_CMD_RESTART2": "int:2712847316", + "LINUX_REBOOT_CMD_SW_SUSPEND": "int:3489725666", + "LINUX_REBOOT_MAGIC1": "int:4276215469", + "LINUX_REBOOT_MAGIC2": "int:672274793", + "LOCK_EX": "int:2", + "LOCK_NB": "int:4", + "LOCK_SH": "int:1", + "LOCK_UN": "int:8", + "MADV_DOFORK": "int:11", + "MADV_DONTFORK": "int:10", + "MADV_DONTNEED": "int:4", + "MADV_HUGEPAGE": "int:14", + "MADV_HWPOISON": "int:100", + "MADV_MERGEABLE": "int:12", + "MADV_NOHUGEPAGE": "int:15", + "MADV_NORMAL": "int:0", + "MADV_RANDOM": "int:1", + "MADV_REMOVE": "int:9", + "MADV_SEQUENTIAL": "int:2", + "MADV_UNMERGEABLE": "int:13", + "MADV_WILLNEED": "int:3", + "MAP_32BIT": "int:64", + "MAP_ANON": "int:32", + "MAP_ANONYMOUS": "int:32", + "MAP_DENYWRITE": "int:2048", + "MAP_EXECUTABLE": "int:4096", + "MAP_FILE": "int:0", + "MAP_FIXED": "int:16", + "MAP_GROWSDOWN": "int:256", + "MAP_HUGETLB": "int:262144", + "MAP_LOCKED": "int:8192", + "MAP_NONBLOCK": "int:65536", + "MAP_NORESERVE": "int:16384", + "MAP_POPULATE": "int:32768", + "MAP_PRIVATE": "int:2", + "MAP_SHARED": "int:1", + "MAP_STACK": "int:131072", + "MAP_TYPE": "int:15", + "MCL_CURRENT": "int:1", + "MCL_FUTURE": "int:2", + "MNT_DETACH": "int:2", + "MNT_EXPIRE": "int:4", + "MNT_FORCE": "int:1", + "MSG_CMSG_CLOEXEC": "int:1073741824", + "MSG_CONFIRM": "int:2048", + "MSG_CTRUNC": "int:8", + "MSG_DONTROUTE": "int:4", + "MSG_DONTWAIT": "int:64", + "MSG_EOR": "int:128", + "MSG_ERRQUEUE": "int:8192", + "MSG_FASTOPEN": "int:536870912", + "MSG_FIN": "int:512", + "MSG_MORE": "int:32768", + "MSG_NOSIGNAL": "int:16384", + "MSG_OOB": "int:1", + "MSG_PEEK": "int:2", + "MSG_PROXY": "int:16", + "MSG_RST": "int:4096", + "MSG_SYN": "int:1024", + "MSG_TRUNC": "int:32", + "MSG_TRYHARD": "int:4", + "MSG_WAITALL": "int:256", + "MSG_WAITFORONE": "int:65536", + "MS_ACTIVE": "int:1073741824", + "MS_ASYNC": "int:1", + "MS_BIND": "int:4096", + "MS_DIRSYNC": "int:128", + "MS_INVALIDATE": "int:2", + "MS_I_VERSION": "int:8388608", + "MS_KERNMOUNT": "int:4194304", + "MS_MANDLOCK": "int:64", + "MS_MGC_MSK": "int:4294901760", + "MS_MGC_VAL": "int:3236757504", + "MS_MOVE": "int:8192", + "MS_NOATIME": "int:1024", + "MS_NODEV": "int:4", + "MS_NODIRATIME": "int:2048", + "MS_NOEXEC": "int:8", + "MS_NOSUID": "int:2", + "MS_NOUSER": "int:-2147483648", + "MS_POSIXACL": "int:65536", + "MS_PRIVATE": "int:262144", + "MS_RDONLY": "int:1", + "MS_REC": "int:16384", + "MS_RELATIME": "int:2097152", + "MS_REMOUNT": "int:32", + "MS_RMT_MASK": "int:8388689", + "MS_SHARED": "int:1048576", + "MS_SILENT": "int:32768", + "MS_SLAVE": "int:524288", + "MS_STRICTATIME": "int:16777216", + "MS_SYNC": "int:4", + "MS_SYNCHRONOUS": "int:16", + "MS_UNBINDABLE": "int:131072", + "NAME_MAX": "int:255", + "NETLINK_ADD_MEMBERSHIP": "int:1", + "NETLINK_AUDIT": "int:9", + "NETLINK_BROADCAST_ERROR": "int:4", + "NETLINK_CONNECTOR": "int:11", + "NETLINK_DNRTMSG": "int:14", + "NETLINK_DROP_MEMBERSHIP": "int:2", + "NETLINK_ECRYPTFS": "int:19", + "NETLINK_FIB_LOOKUP": "int:10", + "NETLINK_FIREWALL": "int:3", + "NETLINK_GENERIC": "int:16", + "NETLINK_INET_DIAG": "int:4", + "NETLINK_IP6_FW": "int:13", + "NETLINK_ISCSI": "int:8", + "NETLINK_KOBJECT_UEVENT": "int:15", + "NETLINK_NETFILTER": "int:12", + "NETLINK_NFLOG": "int:5", + "NETLINK_NO_ENOBUFS": "int:5", + "NETLINK_PKTINFO": "int:3", + "NETLINK_ROUTE": "int:0", + "NETLINK_SCSITRANSPORT": "int:18", + "NETLINK_SELINUX": "int:7", + "NETLINK_UNUSED": "int:1", + "NETLINK_USERSOCK": "int:2", + "NETLINK_XFRM": "int:6", + "NLA_ALIGNTO": "int:4", + "NLA_F_NESTED": "int:32768", + "NLA_F_NET_BYTEORDER": "int:16384", + "NLA_HDRLEN": "int:4", + "NLMSG_ALIGNTO": "int:4", + "NLMSG_DONE": "int:3", + "NLMSG_ERROR": "int:2", + "NLMSG_HDRLEN": "int:16", + "NLMSG_MIN_TYPE": "int:16", + "NLMSG_NOOP": "int:1", + "NLMSG_OVERRUN": "int:4", + "NLM_F_ACK": "int:4", + "NLM_F_APPEND": "int:2048", + "NLM_F_ATOMIC": "int:1024", + "NLM_F_CREATE": "int:1024", + "NLM_F_DUMP": "int:768", + "NLM_F_ECHO": "int:8", + "NLM_F_EXCL": "int:512", + "NLM_F_MATCH": "int:512", + "NLM_F_MULTI": "int:2", + "NLM_F_REPLACE": "int:256", + "NLM_F_REQUEST": "int:1", + "NLM_F_ROOT": "int:256", + "NOFLSH": "int:128", + "OCRNL": "int:8", + "OFDEL": "int:128", + "OFILL": "int:64", + "OLCUC": "int:2", + "ONLCR": "int:4", + "ONLRET": "int:32", + "ONOCR": "int:16", + "OPOST": "int:1", + "O_ACCMODE": "int:3", + "O_APPEND": "int:1024", + "O_ASYNC": "int:8192", + "O_CLOEXEC": "int:524288", + "O_CREAT": "int:64", + "O_DIRECT": "int:16384", + "O_DIRECTORY": "int:65536", + "O_DSYNC": "int:4096", + "O_EXCL": "int:128", + "O_FSYNC": "int:1052672", + "O_LARGEFILE": "int:0", + "O_NDELAY": "int:2048", + "O_NOATIME": "int:262144", + "O_NOCTTY": "int:256", + "O_NOFOLLOW": "int:131072", + "O_NONBLOCK": "int:2048", + "O_RDONLY": "int:0", + "O_RDWR": "int:2", + "O_RSYNC": "int:1052672", + "O_SYNC": "int:1052672", + "O_TRUNC": "int:512", + "O_WRONLY": "int:1", + "PACKET_ADD_MEMBERSHIP": "int:1", + "PACKET_BROADCAST": "int:1", + "PACKET_DROP_MEMBERSHIP": "int:2", + "PACKET_FASTROUTE": "int:6", + "PACKET_HOST": "int:0", + "PACKET_LOOPBACK": "int:5", + "PACKET_MR_ALLMULTI": "int:2", + "PACKET_MR_MULTICAST": "int:0", + "PACKET_MR_PROMISC": "int:1", + "PACKET_MULTICAST": "int:2", + "PACKET_OTHERHOST": "int:3", + "PACKET_OUTGOING": "int:4", + "PACKET_RECV_OUTPUT": "int:3", + "PACKET_RX_RING": "int:5", + "PACKET_STATISTICS": "int:6", + "PARENB": "int:256", + "PARMRK": "int:8", + "PARODD": "int:512", + "PENDIN": "int:16384", + "PRIO_PGRP": "int:1", + "PRIO_PROCESS": "int:0", + "PRIO_USER": "int:2", + "PROT_EXEC": "int:4", + "PROT_GROWSDOWN": "int:16777216", + "PROT_GROWSUP": "int:33554432", + "PROT_NONE": "int:0", + "PROT_READ": "int:1", + "PROT_WRITE": "int:2", + "PR_CAPBSET_DROP": "int:24", + "PR_CAPBSET_READ": "int:23", + "PR_ENDIAN_BIG": "int:0", + "PR_ENDIAN_LITTLE": "int:1", + "PR_ENDIAN_PPC_LITTLE": "int:2", + "PR_FPEMU_NOPRINT": "int:1", + "PR_FPEMU_SIGFPE": "int:2", + "PR_FP_EXC_ASYNC": "int:2", + "PR_FP_EXC_DISABLED": "int:0", + "PR_FP_EXC_DIV": "int:65536", + "PR_FP_EXC_INV": "int:1048576", + "PR_FP_EXC_NONRECOV": "int:1", + "PR_FP_EXC_OVF": "int:131072", + "PR_FP_EXC_PRECISE": "int:3", + "PR_FP_EXC_RES": "int:524288", + "PR_FP_EXC_SW_ENABLE": "int:128", + "PR_FP_EXC_UND": "int:262144", + "PR_GET_DUMPABLE": "int:3", + "PR_GET_ENDIAN": "int:19", + "PR_GET_FPEMU": "int:9", + "PR_GET_FPEXC": "int:11", + "PR_GET_KEEPCAPS": "int:7", + "PR_GET_NAME": "int:16", + "PR_GET_PDEATHSIG": "int:2", + "PR_GET_SECCOMP": "int:21", + "PR_GET_SECUREBITS": "int:27", + "PR_GET_TIMERSLACK": "int:30", + "PR_GET_TIMING": "int:13", + "PR_GET_TSC": "int:25", + "PR_GET_UNALIGN": "int:5", + "PR_MCE_KILL": "int:33", + "PR_MCE_KILL_CLEAR": "int:0", + "PR_MCE_KILL_DEFAULT": "int:2", + "PR_MCE_KILL_EARLY": "int:1", + "PR_MCE_KILL_GET": "int:34", + "PR_MCE_KILL_LATE": "int:0", + "PR_MCE_KILL_SET": "int:1", + "PR_SET_DUMPABLE": "int:4", + "PR_SET_ENDIAN": "int:20", + "PR_SET_FPEMU": "int:10", + "PR_SET_FPEXC": "int:12", + "PR_SET_KEEPCAPS": "int:8", + "PR_SET_NAME": "int:15", + "PR_SET_PDEATHSIG": "int:1", + "PR_SET_PTRACER": "int:1499557217", + "PR_SET_SECCOMP": "int:22", + "PR_SET_SECUREBITS": "int:28", + "PR_SET_TIMERSLACK": "int:29", + "PR_SET_TIMING": "int:14", + "PR_SET_TSC": "int:26", + "PR_SET_UNALIGN": "int:6", + "PR_TASK_PERF_EVENTS_DISABLE": "int:31", + "PR_TASK_PERF_EVENTS_ENABLE": "int:32", + "PR_TIMING_STATISTICAL": "int:0", + "PR_TIMING_TIMESTAMP": "int:1", + "PR_TSC_ENABLE": "int:1", + "PR_TSC_SIGSEGV": "int:2", + "PR_UNALIGN_NOPRINT": "int:1", + "PR_UNALIGN_SIGBUS": "int:2", + "PTRACE_ARCH_PRCTL": "int:30", + "PTRACE_ATTACH": "int:16", + "PTRACE_CONT": "int:7", + "PTRACE_DETACH": "int:17", + "PTRACE_EVENT_CLONE": "int:3", + "PTRACE_EVENT_EXEC": "int:4", + "PTRACE_EVENT_EXIT": "int:6", + "PTRACE_EVENT_FORK": "int:1", + "PTRACE_EVENT_VFORK": "int:2", + "PTRACE_EVENT_VFORK_DONE": "int:5", + "PTRACE_GETEVENTMSG": "int:16897", + "PTRACE_GETFPREGS": "int:14", + "PTRACE_GETFPXREGS": "int:18", + "PTRACE_GETREGS": "int:12", + "PTRACE_GETREGSET": "int:16900", + "PTRACE_GETSIGINFO": "int:16898", + "PTRACE_GET_THREAD_AREA": "int:25", + "PTRACE_KILL": "int:8", + "PTRACE_OLDSETOPTIONS": "int:21", + "PTRACE_O_MASK": "int:127", + "PTRACE_O_TRACECLONE": "int:8", + "PTRACE_O_TRACEEXEC": "int:16", + "PTRACE_O_TRACEEXIT": "int:64", + "PTRACE_O_TRACEFORK": "int:2", + "PTRACE_O_TRACESYSGOOD": "int:1", + "PTRACE_O_TRACEVFORK": "int:4", + "PTRACE_O_TRACEVFORKDONE": "int:32", + "PTRACE_PEEKDATA": "int:2", + "PTRACE_PEEKTEXT": "int:1", + "PTRACE_PEEKUSR": "int:3", + "PTRACE_POKEDATA": "int:5", + "PTRACE_POKETEXT": "int:4", + "PTRACE_POKEUSR": "int:6", + "PTRACE_SETFPREGS": "int:15", + "PTRACE_SETFPXREGS": "int:19", + "PTRACE_SETOPTIONS": "int:16896", + "PTRACE_SETREGS": "int:13", + "PTRACE_SETREGSET": "int:16901", + "PTRACE_SETSIGINFO": "int:16899", + "PTRACE_SET_THREAD_AREA": "int:26", + "PTRACE_SINGLEBLOCK": "int:33", + "PTRACE_SINGLESTEP": "int:9", + "PTRACE_SYSCALL": "int:24", + "PTRACE_SYSEMU": "int:31", + "PTRACE_SYSEMU_SINGLESTEP": "int:32", + "PTRACE_TRACEME": "int:0", + "PathMax": "int:4096", + "RLIMIT_AS": "int:9", + "RLIMIT_CORE": "int:4", + "RLIMIT_CPU": "int:0", + "RLIMIT_DATA": "int:2", + "RLIMIT_FSIZE": "int:1", + "RLIMIT_NOFILE": "int:7", + "RLIMIT_STACK": "int:3", + "RLIM_INFINITY": "int:-1", + "RTAX_ADVMSS": "int:8", + "RTAX_CWND": "int:7", + "RTAX_FEATURES": "int:12", + "RTAX_FEATURE_ALLFRAG": "int:8", + "RTAX_FEATURE_ECN": "int:1", + "RTAX_FEATURE_SACK": "int:2", + "RTAX_FEATURE_TIMESTAMP": "int:4", + "RTAX_HOPLIMIT": "int:10", + "RTAX_INITCWND": "int:11", + "RTAX_INITRWND": "int:14", + "RTAX_LOCK": "int:1", + "RTAX_MAX": "int:14", + "RTAX_MTU": "int:2", + "RTAX_REORDERING": "int:9", + "RTAX_RTO_MIN": "int:13", + "RTAX_RTT": "int:4", + "RTAX_RTTVAR": "int:5", + "RTAX_SSTHRESH": "int:6", + "RTAX_UNSPEC": "int:0", + "RTAX_WINDOW": "int:3", + "RTA_ALIGNTO": "int:4", + "RTA_CACHEINFO": "int:12", + "RTA_DST": "int:1", + "RTA_FLOW": "int:11", + "RTA_GATEWAY": "int:5", + "RTA_IIF": "int:3", + "RTA_MAX": "int:16", + "RTA_METRICS": "int:8", + "RTA_MULTIPATH": "int:9", + "RTA_OIF": "int:4", + "RTA_PREFSRC": "int:7", + "RTA_PRIORITY": "int:6", + "RTA_SRC": "int:2", + "RTA_TABLE": "int:15", + "RTA_UNSPEC": "int:0", + "RTCF_DIRECTSRC": "int:67108864", + "RTCF_DOREDIRECT": "int:16777216", + "RTCF_LOG": "int:33554432", + "RTCF_MASQ": "int:4194304", + "RTCF_NAT": "int:8388608", + "RTCF_VALVE": "int:2097152", + "RTF_ADDRCLASSMASK": "int:4160749568", + "RTF_ADDRCONF": "int:262144", + "RTF_ALLONLINK": "int:131072", + "RTF_BROADCAST": "int:268435456", + "RTF_CACHE": "int:16777216", + "RTF_DEFAULT": "int:65536", + "RTF_DYNAMIC": "int:16", + "RTF_FLOW": "int:33554432", + "RTF_GATEWAY": "int:2", + "RTF_HOST": "int:4", + "RTF_INTERFACE": "int:1073741824", + "RTF_IRTT": "int:256", + "RTF_LINKRT": "int:1048576", + "RTF_LOCAL": "int:2147483648", + "RTF_MODIFIED": "int:32", + "RTF_MSS": "int:64", + "RTF_MTU": "int:64", + "RTF_MULTICAST": "int:536870912", + "RTF_NAT": "int:134217728", + "RTF_NOFORWARD": "int:4096", + "RTF_NONEXTHOP": "int:2097152", + "RTF_NOPMTUDISC": "int:16384", + "RTF_POLICY": "int:67108864", + "RTF_REINSTATE": "int:8", + "RTF_REJECT": "int:512", + "RTF_STATIC": "int:1024", + "RTF_THROW": "int:8192", + "RTF_UP": "int:1", + "RTF_WINDOW": "int:128", + "RTF_XRESOLVE": "int:2048", + "RTM_BASE": "int:16", + "RTM_DELACTION": "int:49", + "RTM_DELADDR": "int:21", + "RTM_DELADDRLABEL": "int:73", + "RTM_DELLINK": "int:17", + "RTM_DELNEIGH": "int:29", + "RTM_DELQDISC": "int:37", + "RTM_DELROUTE": "int:25", + "RTM_DELRULE": "int:33", + "RTM_DELTCLASS": "int:41", + "RTM_DELTFILTER": "int:45", + "RTM_F_CLONED": "int:512", + "RTM_F_EQUALIZE": "int:1024", + "RTM_F_NOTIFY": "int:256", + "RTM_F_PREFIX": "int:2048", + "RTM_GETACTION": "int:50", + "RTM_GETADDR": "int:22", + "RTM_GETADDRLABEL": "int:74", + "RTM_GETANYCAST": "int:62", + "RTM_GETDCB": "int:78", + "RTM_GETLINK": "int:18", + "RTM_GETMULTICAST": "int:58", + "RTM_GETNEIGH": "int:30", + "RTM_GETNEIGHTBL": "int:66", + "RTM_GETQDISC": "int:38", + "RTM_GETROUTE": "int:26", + "RTM_GETRULE": "int:34", + "RTM_GETTCLASS": "int:42", + "RTM_GETTFILTER": "int:46", + "RTM_MAX": "int:79", + "RTM_NEWACTION": "int:48", + "RTM_NEWADDR": "int:20", + "RTM_NEWADDRLABEL": "int:72", + "RTM_NEWLINK": "int:16", + "RTM_NEWNDUSEROPT": "int:68", + "RTM_NEWNEIGH": "int:28", + "RTM_NEWNEIGHTBL": "int:64", + "RTM_NEWPREFIX": "int:52", + "RTM_NEWQDISC": "int:36", + "RTM_NEWROUTE": "int:24", + "RTM_NEWRULE": "int:32", + "RTM_NEWTCLASS": "int:40", + "RTM_NEWTFILTER": "int:44", + "RTM_NR_FAMILIES": "int:16", + "RTM_NR_MSGTYPES": "int:64", + "RTM_SETDCB": "int:79", + "RTM_SETLINK": "int:19", + "RTM_SETNEIGHTBL": "int:67", + "RTNH_ALIGNTO": "int:4", + "RTNH_F_DEAD": "int:1", + "RTNH_F_ONLINK": "int:4", + "RTNH_F_PERVASIVE": "int:2", + "RTNLGRP_IPV4_IFADDR": "int:5", + "RTNLGRP_IPV4_MROUTE": "int:6", + "RTNLGRP_IPV4_ROUTE": "int:7", + "RTNLGRP_IPV4_RULE": "int:8", + "RTNLGRP_IPV6_IFADDR": "int:9", + "RTNLGRP_IPV6_IFINFO": "int:12", + "RTNLGRP_IPV6_MROUTE": "int:10", + "RTNLGRP_IPV6_PREFIX": "int:18", + "RTNLGRP_IPV6_ROUTE": "int:11", + "RTNLGRP_IPV6_RULE": "int:19", + "RTNLGRP_LINK": "int:1", + "RTNLGRP_ND_USEROPT": "int:20", + "RTNLGRP_NEIGH": "int:3", + "RTNLGRP_NONE": "int:0", + "RTNLGRP_NOTIFY": "int:2", + "RTNLGRP_TC": "int:4", + "RTN_ANYCAST": "int:4", + "RTN_BLACKHOLE": "int:6", + "RTN_BROADCAST": "int:3", + "RTN_LOCAL": "int:2", + "RTN_MAX": "int:11", + "RTN_MULTICAST": "int:5", + "RTN_NAT": "int:10", + "RTN_PROHIBIT": "int:8", + "RTN_THROW": "int:9", + "RTN_UNICAST": "int:1", + "RTN_UNREACHABLE": "int:7", + "RTN_UNSPEC": "int:0", + "RTN_XRESOLVE": "int:11", + "RTPROT_BIRD": "int:12", + "RTPROT_BOOT": "int:3", + "RTPROT_DHCP": "int:16", + "RTPROT_DNROUTED": "int:13", + "RTPROT_GATED": "int:8", + "RTPROT_KERNEL": "int:2", + "RTPROT_MRT": "int:10", + "RTPROT_NTK": "int:15", + "RTPROT_RA": "int:9", + "RTPROT_REDIRECT": "int:1", + "RTPROT_STATIC": "int:4", + "RTPROT_UNSPEC": "int:0", + "RTPROT_XORP": "int:14", + "RTPROT_ZEBRA": "int:11", + "RT_CLASS_DEFAULT": "int:253", + "RT_CLASS_LOCAL": "int:255", + "RT_CLASS_MAIN": "int:254", + "RT_CLASS_MAX": "int:255", + "RT_CLASS_UNSPEC": "int:0", + "RT_SCOPE_HOST": "int:254", + "RT_SCOPE_LINK": "int:253", + "RT_SCOPE_NOWHERE": "int:255", + "RT_SCOPE_SITE": "int:200", + "RT_SCOPE_UNIVERSE": "int:0", + "RT_TABLE_COMPAT": "int:252", + "RT_TABLE_DEFAULT": "int:253", + "RT_TABLE_LOCAL": "int:255", + "RT_TABLE_MAIN": "int:254", + "RT_TABLE_MAX": "int:4294967295", + "RT_TABLE_UNSPEC": "int:0", + "RUSAGE_CHILDREN": "int:-1", + "RUSAGE_SELF": "int:0", + "RUSAGE_THREAD": "int:1", + "SCM_CREDENTIALS": "int:2", + "SCM_RIGHTS": "int:1", + "SCM_TIMESTAMP": "int:29", + "SCM_TIMESTAMPING": "int:37", + "SCM_TIMESTAMPNS": "int:35", + "SHUT_RD": "int:0", + "SHUT_RDWR": "int:2", + "SHUT_WR": "int:1", + "SIOCADDDLCI": "int:35200", + "SIOCADDMULTI": "int:35121", + "SIOCADDRT": "int:35083", + "SIOCATMARK": "int:35077", + "SIOCDARP": "int:35155", + "SIOCDELDLCI": "int:35201", + "SIOCDELMULTI": "int:35122", + "SIOCDELRT": "int:35084", + "SIOCDEVPRIVATE": "int:35312", + "SIOCDIFADDR": "int:35126", + "SIOCDRARP": "int:35168", + "SIOCGARP": "int:35156", + "SIOCGIFADDR": "int:35093", + "SIOCGIFBR": "int:35136", + "SIOCGIFBRDADDR": "int:35097", + "SIOCGIFCONF": "int:35090", + "SIOCGIFCOUNT": "int:35128", + "SIOCGIFDSTADDR": "int:35095", + "SIOCGIFENCAP": "int:35109", + "SIOCGIFFLAGS": "int:35091", + "SIOCGIFHWADDR": "int:35111", + "SIOCGIFINDEX": "int:35123", + "SIOCGIFMAP": "int:35184", + "SIOCGIFMEM": "int:35103", + "SIOCGIFMETRIC": "int:35101", + "SIOCGIFMTU": "int:35105", + "SIOCGIFNAME": "int:35088", + "SIOCGIFNETMASK": "int:35099", + "SIOCGIFPFLAGS": "int:35125", + "SIOCGIFSLAVE": "int:35113", + "SIOCGIFTXQLEN": "int:35138", + "SIOCGPGRP": "int:35076", + "SIOCGRARP": "int:35169", + "SIOCGSTAMP": "int:35078", + "SIOCGSTAMPNS": "int:35079", + "SIOCPROTOPRIVATE": "int:35296", + "SIOCRTMSG": "int:35085", + "SIOCSARP": "int:35157", + "SIOCSIFADDR": "int:35094", + "SIOCSIFBR": "int:35137", + "SIOCSIFBRDADDR": "int:35098", + "SIOCSIFDSTADDR": "int:35096", + "SIOCSIFENCAP": "int:35110", + "SIOCSIFFLAGS": "int:35092", + "SIOCSIFHWADDR": "int:35108", + "SIOCSIFHWBROADCAST": "int:35127", + "SIOCSIFLINK": "int:35089", + "SIOCSIFMAP": "int:35185", + "SIOCSIFMEM": "int:35104", + "SIOCSIFMETRIC": "int:35102", + "SIOCSIFMTU": "int:35106", + "SIOCSIFNAME": "int:35107", + "SIOCSIFNETMASK": "int:35100", + "SIOCSIFPFLAGS": "int:35124", + "SIOCSIFSLAVE": "int:35120", + "SIOCSIFTXQLEN": "int:35139", + "SIOCSPGRP": "int:35074", + "SIOCSRARP": "int:35170", + "SOCK_CLOEXEC": "int:524288", + "SOCK_DCCP": "int:6", + "SOCK_DGRAM": "int:2", + "SOCK_NONBLOCK": "int:2048", + "SOCK_PACKET": "int:10", + "SOCK_RAW": "int:3", + "SOCK_RDM": "int:4", + "SOCK_SEQPACKET": "int:5", + "SOCK_STREAM": "int:1", + "SOL_AAL": "int:265", + "SOL_ATM": "int:264", + "SOL_DECNET": "int:261", + "SOL_ICMPV6": "int:58", + "SOL_IP": "int:0", + "SOL_IPV6": "int:41", + "SOL_IRDA": "int:266", + "SOL_PACKET": "int:263", + "SOL_RAW": "int:255", + "SOL_SOCKET": "int:1", + "SOL_TCP": "int:6", + "SOL_X25": "int:262", + "SOMAXCONN": "int:128", + "SO_ACCEPTCONN": "int:30", + "SO_ATTACH_FILTER": "int:26", + "SO_BINDTODEVICE": "int:25", + "SO_BROADCAST": "int:6", + "SO_BSDCOMPAT": "int:14", + "SO_DEBUG": "int:1", + "SO_DETACH_FILTER": "int:27", + "SO_DOMAIN": "int:39", + "SO_DONTROUTE": "int:5", + "SO_ERROR": "int:4", + "SO_KEEPALIVE": "int:9", + "SO_LINGER": "int:13", + "SO_MARK": "int:36", + "SO_NO_CHECK": "int:11", + "SO_OOBINLINE": "int:10", + "SO_PASSCRED": "int:16", + "SO_PASSSEC": "int:34", + "SO_PEERCRED": "int:17", + "SO_PEERNAME": "int:28", + "SO_PEERSEC": "int:31", + "SO_PRIORITY": "int:12", + "SO_PROTOCOL": "int:38", + "SO_RCVBUF": "int:8", + "SO_RCVBUFFORCE": "int:33", + "SO_RCVLOWAT": "int:18", + "SO_RCVTIMEO": "int:20", + "SO_REUSEADDR": "int:2", + "SO_RXQ_OVFL": "int:40", + "SO_SECURITY_AUTHENTICATION": "int:22", + "SO_SECURITY_ENCRYPTION_NETWORK": "int:24", + "SO_SECURITY_ENCRYPTION_TRANSPORT": "int:23", + "SO_SNDBUF": "int:7", + "SO_SNDBUFFORCE": "int:32", + "SO_SNDLOWAT": "int:19", + "SO_SNDTIMEO": "int:21", + "SO_TIMESTAMP": "int:29", + "SO_TIMESTAMPING": "int:37", + "SO_TIMESTAMPNS": "int:35", + "SO_TYPE": "int:3", + "SYS_ACCEPT": "int:43", + "SYS_ACCEPT4": "int:288", + "SYS_ACCESS": "int:21", + "SYS_ACCT": "int:163", + "SYS_ADD_KEY": "int:248", + "SYS_ADJTIMEX": "int:159", + "SYS_AFS_SYSCALL": "int:183", + "SYS_ALARM": "int:37", + "SYS_ARCH_PRCTL": "int:158", + "SYS_BIND": "int:49", + "SYS_BRK": "int:12", + "SYS_CAPGET": "int:125", + "SYS_CAPSET": "int:126", + "SYS_CHDIR": "int:80", + "SYS_CHMOD": "int:90", + "SYS_CHOWN": "int:92", + "SYS_CHROOT": "int:161", + "SYS_CLOCK_GETRES": "int:229", + "SYS_CLOCK_GETTIME": "int:228", + "SYS_CLOCK_NANOSLEEP": "int:230", + "SYS_CLOCK_SETTIME": "int:227", + "SYS_CLONE": "int:56", + "SYS_CLOSE": "int:3", + "SYS_CONNECT": "int:42", + "SYS_CREAT": "int:85", + "SYS_CREATE_MODULE": "int:174", + "SYS_DELETE_MODULE": "int:176", + "SYS_DUP": "int:32", + "SYS_DUP2": "int:33", + "SYS_DUP3": "int:292", + "SYS_EPOLL_CREATE": "int:213", + "SYS_EPOLL_CREATE1": "int:291", + "SYS_EPOLL_CTL": "int:233", + "SYS_EPOLL_CTL_OLD": "int:214", + "SYS_EPOLL_PWAIT": "int:281", + "SYS_EPOLL_WAIT": "int:232", + "SYS_EPOLL_WAIT_OLD": "int:215", + "SYS_EVENTFD": "int:284", + "SYS_EVENTFD2": "int:290", + "SYS_EXECVE": "int:59", + "SYS_EXIT": "int:60", + "SYS_EXIT_GROUP": "int:231", + "SYS_FACCESSAT": "int:269", + "SYS_FADVISE64": "int:221", + "SYS_FALLOCATE": "int:285", + "SYS_FANOTIFY_INIT": "int:300", + "SYS_FANOTIFY_MARK": "int:301", + "SYS_FCHDIR": "int:81", + "SYS_FCHMOD": "int:91", + "SYS_FCHMODAT": "int:268", + "SYS_FCHOWN": "int:93", + "SYS_FCHOWNAT": "int:260", + "SYS_FCNTL": "int:72", + "SYS_FDATASYNC": "int:75", + "SYS_FGETXATTR": "int:193", + "SYS_FLISTXATTR": "int:196", + "SYS_FLOCK": "int:73", + "SYS_FORK": "int:57", + "SYS_FREMOVEXATTR": "int:199", + "SYS_FSETXATTR": "int:190", + "SYS_FSTAT": "int:5", + "SYS_FSTATFS": "int:138", + "SYS_FSYNC": "int:74", + "SYS_FTRUNCATE": "int:77", + "SYS_FUTEX": "int:202", + "SYS_FUTIMESAT": "int:261", + "SYS_GETCWD": "int:79", + "SYS_GETDENTS": "int:78", + "SYS_GETDENTS64": "int:217", + "SYS_GETEGID": "int:108", + "SYS_GETEUID": "int:107", + "SYS_GETGID": "int:104", + "SYS_GETGROUPS": "int:115", + "SYS_GETITIMER": "int:36", + "SYS_GETPEERNAME": "int:52", + "SYS_GETPGID": "int:121", + "SYS_GETPGRP": "int:111", + "SYS_GETPID": "int:39", + "SYS_GETPMSG": "int:181", + "SYS_GETPPID": "int:110", + "SYS_GETPRIORITY": "int:140", + "SYS_GETRESGID": "int:120", + "SYS_GETRESUID": "int:118", + "SYS_GETRLIMIT": "int:97", + "SYS_GETRUSAGE": "int:98", + "SYS_GETSID": "int:124", + "SYS_GETSOCKNAME": "int:51", + "SYS_GETSOCKOPT": "int:55", + "SYS_GETTID": "int:186", + "SYS_GETTIMEOFDAY": "int:96", + "SYS_GETUID": "int:102", + "SYS_GETXATTR": "int:191", + "SYS_GET_KERNEL_SYMS": "int:177", + "SYS_GET_MEMPOLICY": "int:239", + "SYS_GET_ROBUST_LIST": "int:274", + "SYS_GET_THREAD_AREA": "int:211", + "SYS_INIT_MODULE": "int:175", + "SYS_INOTIFY_ADD_WATCH": "int:254", + "SYS_INOTIFY_INIT": "int:253", + "SYS_INOTIFY_INIT1": "int:294", + "SYS_INOTIFY_RM_WATCH": "int:255", + "SYS_IOCTL": "int:16", + "SYS_IOPERM": "int:173", + "SYS_IOPL": "int:172", + "SYS_IOPRIO_GET": "int:252", + "SYS_IOPRIO_SET": "int:251", + "SYS_IO_CANCEL": "int:210", + "SYS_IO_DESTROY": "int:207", + "SYS_IO_GETEVENTS": "int:208", + "SYS_IO_SETUP": "int:206", + "SYS_IO_SUBMIT": "int:209", + "SYS_KEXEC_LOAD": "int:246", + "SYS_KEYCTL": "int:250", + "SYS_KILL": "int:62", + "SYS_LCHOWN": "int:94", + "SYS_LGETXATTR": "int:192", + "SYS_LINK": "int:86", + "SYS_LINKAT": "int:265", + "SYS_LISTEN": "int:50", + "SYS_LISTXATTR": "int:194", + "SYS_LLISTXATTR": "int:195", + "SYS_LOOKUP_DCOOKIE": "int:212", + "SYS_LREMOVEXATTR": "int:198", + "SYS_LSEEK": "int:8", + "SYS_LSETXATTR": "int:189", + "SYS_LSTAT": "int:6", + "SYS_MADVISE": "int:28", + "SYS_MBIND": "int:237", + "SYS_MIGRATE_PAGES": "int:256", + "SYS_MINCORE": "int:27", + "SYS_MKDIR": "int:83", + "SYS_MKDIRAT": "int:258", + "SYS_MKNOD": "int:133", + "SYS_MKNODAT": "int:259", + "SYS_MLOCK": "int:149", + "SYS_MLOCKALL": "int:151", + "SYS_MMAP": "int:9", + "SYS_MODIFY_LDT": "int:154", + "SYS_MOUNT": "int:165", + "SYS_MOVE_PAGES": "int:279", + "SYS_MPROTECT": "int:10", + "SYS_MQ_GETSETATTR": "int:245", + "SYS_MQ_NOTIFY": "int:244", + "SYS_MQ_OPEN": "int:240", + "SYS_MQ_TIMEDRECEIVE": "int:243", + "SYS_MQ_TIMEDSEND": "int:242", + "SYS_MQ_UNLINK": "int:241", + "SYS_MREMAP": "int:25", + "SYS_MSGCTL": "int:71", + "SYS_MSGGET": "int:68", + "SYS_MSGRCV": "int:70", + "SYS_MSGSND": "int:69", + "SYS_MSYNC": "int:26", + "SYS_MUNLOCK": "int:150", + "SYS_MUNLOCKALL": "int:152", + "SYS_MUNMAP": "int:11", + "SYS_NANOSLEEP": "int:35", + "SYS_NEWFSTATAT": "int:262", + "SYS_NFSSERVCTL": "int:180", + "SYS_OPEN": "int:2", + "SYS_OPENAT": "int:257", + "SYS_PAUSE": "int:34", + "SYS_PERF_EVENT_OPEN": "int:298", + "SYS_PERSONALITY": "int:135", + "SYS_PIPE": "int:22", + "SYS_PIPE2": "int:293", + "SYS_PIVOT_ROOT": "int:155", + "SYS_POLL": "int:7", + "SYS_PPOLL": "int:271", + "SYS_PRCTL": "int:157", + "SYS_PREAD64": "int:17", + "SYS_PREADV": "int:295", + "SYS_PRLIMIT64": "int:302", + "SYS_PSELECT6": "int:270", + "SYS_PTRACE": "int:101", + "SYS_PUTPMSG": "int:182", + "SYS_PWRITE64": "int:18", + "SYS_PWRITEV": "int:296", + "SYS_QUERY_MODULE": "int:178", + "SYS_QUOTACTL": "int:179", + "SYS_READ": "int:0", + "SYS_READAHEAD": "int:187", + "SYS_READLINK": "int:89", + "SYS_READLINKAT": "int:267", + "SYS_READV": "int:19", + "SYS_REBOOT": "int:169", + "SYS_RECVFROM": "int:45", + "SYS_RECVMMSG": "int:299", + "SYS_RECVMSG": "int:47", + "SYS_REMAP_FILE_PAGES": "int:216", + "SYS_REMOVEXATTR": "int:197", + "SYS_RENAME": "int:82", + "SYS_RENAMEAT": "int:264", + "SYS_REQUEST_KEY": "int:249", + "SYS_RESTART_SYSCALL": "int:219", + "SYS_RMDIR": "int:84", + "SYS_RT_SIGACTION": "int:13", + "SYS_RT_SIGPENDING": "int:127", + "SYS_RT_SIGPROCMASK": "int:14", + "SYS_RT_SIGQUEUEINFO": "int:129", + "SYS_RT_SIGRETURN": "int:15", + "SYS_RT_SIGSUSPEND": "int:130", + "SYS_RT_SIGTIMEDWAIT": "int:128", + "SYS_RT_TGSIGQUEUEINFO": "int:297", + "SYS_SCHED_GETAFFINITY": "int:204", + "SYS_SCHED_GETPARAM": "int:143", + "SYS_SCHED_GETSCHEDULER": "int:145", + "SYS_SCHED_GET_PRIORITY_MAX": "int:146", + "SYS_SCHED_GET_PRIORITY_MIN": "int:147", + "SYS_SCHED_RR_GET_INTERVAL": "int:148", + "SYS_SCHED_SETAFFINITY": "int:203", + "SYS_SCHED_SETPARAM": "int:142", + "SYS_SCHED_SETSCHEDULER": "int:144", + "SYS_SCHED_YIELD": "int:24", + "SYS_SECURITY": "int:185", + "SYS_SELECT": "int:23", + "SYS_SEMCTL": "int:66", + "SYS_SEMGET": "int:64", + "SYS_SEMOP": "int:65", + "SYS_SEMTIMEDOP": "int:220", + "SYS_SENDFILE": "int:40", + "SYS_SENDMSG": "int:46", + "SYS_SENDTO": "int:44", + "SYS_SETDOMAINNAME": "int:171", + "SYS_SETFSGID": "int:123", + "SYS_SETFSUID": "int:122", + "SYS_SETGID": "int:106", + "SYS_SETGROUPS": "int:116", + "SYS_SETHOSTNAME": "int:170", + "SYS_SETITIMER": "int:38", + "SYS_SETPGID": "int:109", + "SYS_SETPRIORITY": "int:141", + "SYS_SETREGID": "int:114", + "SYS_SETRESGID": "int:119", + "SYS_SETRESUID": "int:117", + "SYS_SETREUID": "int:113", + "SYS_SETRLIMIT": "int:160", + "SYS_SETSID": "int:112", + "SYS_SETSOCKOPT": "int:54", + "SYS_SETTIMEOFDAY": "int:164", + "SYS_SETUID": "int:105", + "SYS_SETXATTR": "int:188", + "SYS_SET_MEMPOLICY": "int:238", + "SYS_SET_ROBUST_LIST": "int:273", + "SYS_SET_THREAD_AREA": "int:205", + "SYS_SET_TID_ADDRESS": "int:218", + "SYS_SHMAT": "int:30", + "SYS_SHMCTL": "int:31", + "SYS_SHMDT": "int:67", + "SYS_SHMGET": "int:29", + "SYS_SHUTDOWN": "int:48", + "SYS_SIGALTSTACK": "int:131", + "SYS_SIGNALFD": "int:282", + "SYS_SIGNALFD4": "int:289", + "SYS_SOCKET": "int:41", + "SYS_SOCKETPAIR": "int:53", + "SYS_SPLICE": "int:275", + "SYS_STAT": "int:4", + "SYS_STATFS": "int:137", + "SYS_SWAPOFF": "int:168", + "SYS_SWAPON": "int:167", + "SYS_SYMLINK": "int:88", + "SYS_SYMLINKAT": "int:266", + "SYS_SYNC": "int:162", + "SYS_SYNC_FILE_RANGE": "int:277", + "SYS_SYSFS": "int:139", + "SYS_SYSINFO": "int:99", + "SYS_SYSLOG": "int:103", + "SYS_TEE": "int:276", + "SYS_TGKILL": "int:234", + "SYS_TIME": "int:201", + "SYS_TIMERFD_CREATE": "int:283", + "SYS_TIMERFD_GETTIME": "int:287", + "SYS_TIMERFD_SETTIME": "int:286", + "SYS_TIMER_CREATE": "int:222", + "SYS_TIMER_DELETE": "int:226", + "SYS_TIMER_GETOVERRUN": "int:225", + "SYS_TIMER_GETTIME": "int:224", + "SYS_TIMER_SETTIME": "int:223", + "SYS_TIMES": "int:100", + "SYS_TKILL": "int:200", + "SYS_TRUNCATE": "int:76", + "SYS_TUXCALL": "int:184", + "SYS_UMASK": "int:95", + "SYS_UMOUNT2": "int:166", + "SYS_UNAME": "int:63", + "SYS_UNLINK": "int:87", + "SYS_UNLINKAT": "int:263", + "SYS_UNSHARE": "int:272", + "SYS_USELIB": "int:134", + "SYS_USTAT": "int:136", + "SYS_UTIME": "int:132", + "SYS_UTIMENSAT": "int:280", + "SYS_UTIMES": "int:235", + "SYS_VFORK": "int:58", + "SYS_VHANGUP": "int:153", + "SYS_VMSPLICE": "int:278", + "SYS_VSERVER": "int:236", + "SYS_WAIT4": "int:61", + "SYS_WAITID": "int:247", + "SYS_WRITE": "int:1", + "SYS_WRITEV": "int:20", + "SYS__SYSCTL": "int:156", + "S_BLKSIZE": "int:512", + "S_IEXEC": "int:64", + "S_IFBLK": "int:24576", + "S_IFCHR": "int:8192", + "S_IFDIR": "int:16384", + "S_IFIFO": "int:4096", + "S_IFLNK": "int:40960", + "S_IFMT": "int:61440", + "S_IFREG": "int:32768", + "S_IFSOCK": "int:49152", + "S_IREAD": "int:256", + "S_IRGRP": "int:32", + "S_IROTH": "int:4", + "S_IRUSR": "int:256", + "S_IRWXG": "int:56", + "S_IRWXO": "int:7", + "S_IRWXU": "int:448", + "S_ISGID": "int:1024", + "S_ISUID": "int:2048", + "S_ISVTX": "int:512", + "S_IWGRP": "int:16", + "S_IWOTH": "int:2", + "S_IWRITE": "int:128", + "S_IWUSR": "int:128", + "S_IXGRP": "int:8", + "S_IXOTH": "int:1", + "S_IXUSR": "int:64", + "SizeofCmsghdr": "int:16", + "SizeofICMPv6Filter": "int:32", + "SizeofIPMreq": "int:8", + "SizeofIPMreqn": "int:12", + "SizeofIPv6MTUInfo": "int:32", + "SizeofIPv6Mreq": "int:20", + "SizeofIfAddrmsg": "int:8", + "SizeofIfInfomsg": "int:16", + "SizeofInet4Pktinfo": "int:12", + "SizeofInet6Pktinfo": "int:20", + "SizeofInotifyEvent": "int:16", + "SizeofLinger": "int:8", + "SizeofMsghdr": "int:56", + "SizeofNlAttr": "int:4", + "SizeofNlMsgerr": "int:20", + "SizeofNlMsghdr": "int:16", + "SizeofRtAttr": "int:4", + "SizeofRtGenmsg": "int:1", + "SizeofRtMsg": "int:12", + "SizeofRtNexthop": "int:8", + "SizeofSockFilter": "int:8", + "SizeofSockFprog": "int:16", + "SizeofSockaddrAny": "int:112", + "SizeofSockaddrInet4": "int:16", + "SizeofSockaddrInet6": "int:28", + "SizeofSockaddrLinklayer": "int:20", + "SizeofSockaddrNetlink": "int:12", + "SizeofSockaddrUnix": "int:110", + "SizeofTCPInfo": "int:104", + "SizeofUcred": "int:12", + "TCGETS": "int:21505", + "TCIFLUSH": "int:0", + "TCIOFLUSH": "int:2", + "TCOFLUSH": "int:1", + "TCP_CONGESTION": "int:13", + "TCP_CORK": "int:3", + "TCP_DEFER_ACCEPT": "int:9", + "TCP_INFO": "int:11", + "TCP_KEEPCNT": "int:6", + "TCP_KEEPIDLE": "int:4", + "TCP_KEEPINTVL": "int:5", + "TCP_LINGER2": "int:8", + "TCP_MAXSEG": "int:2", + "TCP_MAXWIN": "int:65535", + "TCP_MAX_WINSHIFT": "int:14", + "TCP_MD5SIG": "int:14", + "TCP_MD5SIG_MAXKEYLEN": "int:80", + "TCP_MSS": "int:512", + "TCP_NODELAY": "int:1", + "TCP_QUICKACK": "int:12", + "TCP_SYNCNT": "int:7", + "TCP_WINDOW_CLAMP": "int:10", + "TCSETS": "int:21506", + "TIOCCBRK": "int:21544", + "TIOCCONS": "int:21533", + "TIOCEXCL": "int:21516", + "TIOCGDEV": "int:2147767346", + "TIOCGETD": "int:21540", + "TIOCGICOUNT": "int:21597", + "TIOCGLCKTRMIOS": "int:21590", + "TIOCGPGRP": "int:21519", + "TIOCGPTN": "int:2147767344", + "TIOCGRS485": "int:21550", + "TIOCGSERIAL": "int:21534", + "TIOCGSID": "int:21545", + "TIOCGSOFTCAR": "int:21529", + "TIOCGWINSZ": "int:21523", + "TIOCINQ": "int:21531", + "TIOCLINUX": "int:21532", + "TIOCMBIC": "int:21527", + "TIOCMBIS": "int:21526", + "TIOCMGET": "int:21525", + "TIOCMIWAIT": "int:21596", + "TIOCMSET": "int:21528", + "TIOCM_CAR": "int:64", + "TIOCM_CD": "int:64", + "TIOCM_CTS": "int:32", + "TIOCM_DSR": "int:256", + "TIOCM_DTR": "int:2", + "TIOCM_LE": "int:1", + "TIOCM_RI": "int:128", + "TIOCM_RNG": "int:128", + "TIOCM_RTS": "int:4", + "TIOCM_SR": "int:16", + "TIOCM_ST": "int:8", + "TIOCNOTTY": "int:21538", + "TIOCNXCL": "int:21517", + "TIOCOUTQ": "int:21521", + "TIOCPKT": "int:21536", + "TIOCPKT_DATA": "int:0", + "TIOCPKT_DOSTOP": "int:32", + "TIOCPKT_FLUSHREAD": "int:1", + "TIOCPKT_FLUSHWRITE": "int:2", + "TIOCPKT_IOCTL": "int:64", + "TIOCPKT_NOSTOP": "int:16", + "TIOCPKT_START": "int:8", + "TIOCPKT_STOP": "int:4", + "TIOCSBRK": "int:21543", + "TIOCSCTTY": "int:21518", + "TIOCSERCONFIG": "int:21587", + "TIOCSERGETLSR": "int:21593", + "TIOCSERGETMULTI": "int:21594", + "TIOCSERGSTRUCT": "int:21592", + "TIOCSERGWILD": "int:21588", + "TIOCSERSETMULTI": "int:21595", + "TIOCSERSWILD": "int:21589", + "TIOCSER_TEMT": "int:1", + "TIOCSETD": "int:21539", + "TIOCSIG": "int:1074025526", + "TIOCSLCKTRMIOS": "int:21591", + "TIOCSPGRP": "int:21520", + "TIOCSPTLCK": "int:1074025521", + "TIOCSRS485": "int:21551", + "TIOCSSERIAL": "int:21535", + "TIOCSSOFTCAR": "int:21530", + "TIOCSTI": "int:21522", + "TIOCSWINSZ": "int:21524", + "TOSTOP": "int:256", + "TUNATTACHFILTER": "int:1074812117", + "TUNDETACHFILTER": "int:1074812118", + "TUNGETFEATURES": "int:2147767503", + "TUNGETIFF": "int:2147767506", + "TUNGETSNDBUF": "int:2147767507", + "TUNGETVNETHDRSZ": "int:2147767511", + "TUNSETDEBUG": "int:1074025673", + "TUNSETGROUP": "int:1074025678", + "TUNSETIFF": "int:1074025674", + "TUNSETLINK": "int:1074025677", + "TUNSETNOCSUM": "int:1074025672", + "TUNSETOFFLOAD": "int:1074025680", + "TUNSETOWNER": "int:1074025676", + "TUNSETPERSIST": "int:1074025675", + "TUNSETSNDBUF": "int:1074025684", + "TUNSETTXFILTER": "int:1074025681", + "TUNSETVNETHDRSZ": "int:1074025688", + "VDISCARD": "int:13", + "VEOF": "int:4", + "VEOL": "int:11", + "VEOL2": "int:16", + "VERASE": "int:2", + "VINTR": "int:0", + "VKILL": "int:3", + "VLNEXT": "int:15", + "VMIN": "int:6", + "VQUIT": "int:1", + "VREPRINT": "int:12", + "VSTART": "int:8", + "VSTOP": "int:9", + "VSUSP": "int:10", + "VSWTC": "int:7", + "VTIME": "int:5", + "VWERASE": "int:14", + "WALL": "int:1073741824", + "WCLONE": "int:2147483648", + "WCONTINUED": "int:8", + "WEXITED": "int:4", + "WNOHANG": "int:1", + "WNOTHREAD": "int:536870912", + "WNOWAIT": "int:16777216", + "WORDSIZE": "int:64", + "WSTOPPED": "int:2", + "WUNTRACED": "int:2", + "XCASE": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm.go new file mode 100644 index 0000000..25589ad --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm.go @@ -0,0 +1,2249 @@ +// +build !gccgo + +// this file was generated by gomacro command: import "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_ALG": ValueOf(syscall.AF_ALG), + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ASH": ValueOf(syscall.AF_ASH), + "AF_ATMPVC": ValueOf(syscall.AF_ATMPVC), + "AF_ATMSVC": ValueOf(syscall.AF_ATMSVC), + "AF_AX25": ValueOf(syscall.AF_AX25), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_BRIDGE": ValueOf(syscall.AF_BRIDGE), + "AF_CAIF": ValueOf(syscall.AF_CAIF), + "AF_CAN": ValueOf(syscall.AF_CAN), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_ECONET": ValueOf(syscall.AF_ECONET), + "AF_FILE": ValueOf(syscall.AF_FILE), + "AF_IEEE802154": ValueOf(syscall.AF_IEEE802154), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_IRDA": ValueOf(syscall.AF_IRDA), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_IUCV": ValueOf(syscall.AF_IUCV), + "AF_KEY": ValueOf(syscall.AF_KEY), + "AF_LLC": ValueOf(syscall.AF_LLC), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NETBEUI": ValueOf(syscall.AF_NETBEUI), + "AF_NETLINK": ValueOf(syscall.AF_NETLINK), + "AF_NETROM": ValueOf(syscall.AF_NETROM), + "AF_PACKET": ValueOf(syscall.AF_PACKET), + "AF_PHONET": ValueOf(syscall.AF_PHONET), + "AF_PPPOX": ValueOf(syscall.AF_PPPOX), + "AF_RDS": ValueOf(syscall.AF_RDS), + "AF_ROSE": ValueOf(syscall.AF_ROSE), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_RXRPC": ValueOf(syscall.AF_RXRPC), + "AF_SECURITY": ValueOf(syscall.AF_SECURITY), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_TIPC": ValueOf(syscall.AF_TIPC), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_WANPIPE": ValueOf(syscall.AF_WANPIPE), + "AF_X25": ValueOf(syscall.AF_X25), + "ARPHRD_ADAPT": ValueOf(syscall.ARPHRD_ADAPT), + "ARPHRD_APPLETLK": ValueOf(syscall.ARPHRD_APPLETLK), + "ARPHRD_ARCNET": ValueOf(syscall.ARPHRD_ARCNET), + "ARPHRD_ASH": ValueOf(syscall.ARPHRD_ASH), + "ARPHRD_ATM": ValueOf(syscall.ARPHRD_ATM), + "ARPHRD_AX25": ValueOf(syscall.ARPHRD_AX25), + "ARPHRD_BIF": ValueOf(syscall.ARPHRD_BIF), + "ARPHRD_CHAOS": ValueOf(syscall.ARPHRD_CHAOS), + "ARPHRD_CISCO": ValueOf(syscall.ARPHRD_CISCO), + "ARPHRD_CSLIP": ValueOf(syscall.ARPHRD_CSLIP), + "ARPHRD_CSLIP6": ValueOf(syscall.ARPHRD_CSLIP6), + "ARPHRD_DDCMP": ValueOf(syscall.ARPHRD_DDCMP), + "ARPHRD_DLCI": ValueOf(syscall.ARPHRD_DLCI), + "ARPHRD_ECONET": ValueOf(syscall.ARPHRD_ECONET), + "ARPHRD_EETHER": ValueOf(syscall.ARPHRD_EETHER), + "ARPHRD_ETHER": ValueOf(syscall.ARPHRD_ETHER), + "ARPHRD_EUI64": ValueOf(syscall.ARPHRD_EUI64), + "ARPHRD_FCAL": ValueOf(syscall.ARPHRD_FCAL), + "ARPHRD_FCFABRIC": ValueOf(syscall.ARPHRD_FCFABRIC), + "ARPHRD_FCPL": ValueOf(syscall.ARPHRD_FCPL), + "ARPHRD_FCPP": ValueOf(syscall.ARPHRD_FCPP), + "ARPHRD_FDDI": ValueOf(syscall.ARPHRD_FDDI), + "ARPHRD_FRAD": ValueOf(syscall.ARPHRD_FRAD), + "ARPHRD_HDLC": ValueOf(syscall.ARPHRD_HDLC), + "ARPHRD_HIPPI": ValueOf(syscall.ARPHRD_HIPPI), + "ARPHRD_HWX25": ValueOf(syscall.ARPHRD_HWX25), + "ARPHRD_IEEE1394": ValueOf(syscall.ARPHRD_IEEE1394), + "ARPHRD_IEEE802": ValueOf(syscall.ARPHRD_IEEE802), + "ARPHRD_IEEE80211": ValueOf(syscall.ARPHRD_IEEE80211), + "ARPHRD_IEEE80211_PRISM": ValueOf(syscall.ARPHRD_IEEE80211_PRISM), + "ARPHRD_IEEE80211_RADIOTAP": ValueOf(syscall.ARPHRD_IEEE80211_RADIOTAP), + "ARPHRD_IEEE802154": ValueOf(syscall.ARPHRD_IEEE802154), + "ARPHRD_IEEE802154_PHY": ValueOf(syscall.ARPHRD_IEEE802154_PHY), + "ARPHRD_IEEE802_TR": ValueOf(syscall.ARPHRD_IEEE802_TR), + "ARPHRD_INFINIBAND": ValueOf(syscall.ARPHRD_INFINIBAND), + "ARPHRD_IPDDP": ValueOf(syscall.ARPHRD_IPDDP), + "ARPHRD_IPGRE": ValueOf(syscall.ARPHRD_IPGRE), + "ARPHRD_IRDA": ValueOf(syscall.ARPHRD_IRDA), + "ARPHRD_LAPB": ValueOf(syscall.ARPHRD_LAPB), + "ARPHRD_LOCALTLK": ValueOf(syscall.ARPHRD_LOCALTLK), + "ARPHRD_LOOPBACK": ValueOf(syscall.ARPHRD_LOOPBACK), + "ARPHRD_METRICOM": ValueOf(syscall.ARPHRD_METRICOM), + "ARPHRD_NETROM": ValueOf(syscall.ARPHRD_NETROM), + "ARPHRD_NONE": ValueOf(syscall.ARPHRD_NONE), + "ARPHRD_PIMREG": ValueOf(syscall.ARPHRD_PIMREG), + "ARPHRD_PPP": ValueOf(syscall.ARPHRD_PPP), + "ARPHRD_PRONET": ValueOf(syscall.ARPHRD_PRONET), + "ARPHRD_RAWHDLC": ValueOf(syscall.ARPHRD_RAWHDLC), + "ARPHRD_ROSE": ValueOf(syscall.ARPHRD_ROSE), + "ARPHRD_RSRVD": ValueOf(syscall.ARPHRD_RSRVD), + "ARPHRD_SIT": ValueOf(syscall.ARPHRD_SIT), + "ARPHRD_SKIP": ValueOf(syscall.ARPHRD_SKIP), + "ARPHRD_SLIP": ValueOf(syscall.ARPHRD_SLIP), + "ARPHRD_SLIP6": ValueOf(syscall.ARPHRD_SLIP6), + "ARPHRD_TUNNEL": ValueOf(syscall.ARPHRD_TUNNEL), + "ARPHRD_TUNNEL6": ValueOf(syscall.ARPHRD_TUNNEL6), + "ARPHRD_VOID": ValueOf(syscall.ARPHRD_VOID), + "ARPHRD_X25": ValueOf(syscall.ARPHRD_X25), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Acct": ValueOf(syscall.Acct), + "Adjtimex": ValueOf(syscall.Adjtimex), + "AttachLsf": ValueOf(syscall.AttachLsf), + "B0": ValueOf(syscall.B0), + "B1000000": ValueOf(syscall.B1000000), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1152000": ValueOf(syscall.B1152000), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B150": ValueOf(syscall.B150), + "B1500000": ValueOf(syscall.B1500000), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B2000000": ValueOf(syscall.B2000000), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B2500000": ValueOf(syscall.B2500000), + "B300": ValueOf(syscall.B300), + "B3000000": ValueOf(syscall.B3000000), + "B3500000": ValueOf(syscall.B3500000), + "B38400": ValueOf(syscall.B38400), + "B4000000": ValueOf(syscall.B4000000), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B500000": ValueOf(syscall.B500000), + "B57600": ValueOf(syscall.B57600), + "B576000": ValueOf(syscall.B576000), + "B600": ValueOf(syscall.B600), + "B75": ValueOf(syscall.B75), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BindToDevice": ValueOf(syscall.BindToDevice), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CLONE_CHILD_CLEARTID": ValueOf(syscall.CLONE_CHILD_CLEARTID), + "CLONE_CHILD_SETTID": ValueOf(syscall.CLONE_CHILD_SETTID), + "CLONE_DETACHED": ValueOf(syscall.CLONE_DETACHED), + "CLONE_FILES": ValueOf(syscall.CLONE_FILES), + "CLONE_FS": ValueOf(syscall.CLONE_FS), + "CLONE_IO": ValueOf(uint64(syscall.CLONE_IO)), + "CLONE_NEWIPC": ValueOf(syscall.CLONE_NEWIPC), + "CLONE_NEWNET": ValueOf(syscall.CLONE_NEWNET), + "CLONE_NEWNS": ValueOf(syscall.CLONE_NEWNS), + "CLONE_NEWPID": ValueOf(syscall.CLONE_NEWPID), + "CLONE_NEWUSER": ValueOf(syscall.CLONE_NEWUSER), + "CLONE_NEWUTS": ValueOf(syscall.CLONE_NEWUTS), + "CLONE_PARENT": ValueOf(syscall.CLONE_PARENT), + "CLONE_PARENT_SETTID": ValueOf(syscall.CLONE_PARENT_SETTID), + "CLONE_PTRACE": ValueOf(syscall.CLONE_PTRACE), + "CLONE_SETTLS": ValueOf(syscall.CLONE_SETTLS), + "CLONE_SIGHAND": ValueOf(syscall.CLONE_SIGHAND), + "CLONE_SYSVSEM": ValueOf(syscall.CLONE_SYSVSEM), + "CLONE_THREAD": ValueOf(syscall.CLONE_THREAD), + "CLONE_UNTRACED": ValueOf(syscall.CLONE_UNTRACED), + "CLONE_VFORK": ValueOf(syscall.CLONE_VFORK), + "CLONE_VM": ValueOf(syscall.CLONE_VM), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTOPB": ValueOf(syscall.CSTOPB), + "Chdir": ValueOf(syscall.Chdir), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "Creat": ValueOf(syscall.Creat), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "DetachLsf": ValueOf(syscall.DetachLsf), + "Dup": ValueOf(syscall.Dup), + "Dup2": ValueOf(syscall.Dup2), + "Dup3": ValueOf(syscall.Dup3), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EADV": ValueOf(syscall.EADV), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EBADE": ValueOf(syscall.EBADE), + "EBADF": ValueOf(syscall.EBADF), + "EBADFD": ValueOf(syscall.EBADFD), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADR": ValueOf(syscall.EBADR), + "EBADRQC": ValueOf(syscall.EBADRQC), + "EBADSLT": ValueOf(syscall.EBADSLT), + "EBFONT": ValueOf(syscall.EBFONT), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECHRNG": ValueOf(syscall.ECHRNG), + "ECOMM": ValueOf(syscall.ECOMM), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDEADLOCK": ValueOf(syscall.EDEADLOCK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOTDOT": ValueOf(syscall.EDOTDOT), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EHWPOISON": ValueOf(syscall.EHWPOISON), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "EISNAM": ValueOf(syscall.EISNAM), + "EKEYEXPIRED": ValueOf(syscall.EKEYEXPIRED), + "EKEYREJECTED": ValueOf(syscall.EKEYREJECTED), + "EKEYREVOKED": ValueOf(syscall.EKEYREVOKED), + "EL2HLT": ValueOf(syscall.EL2HLT), + "EL2NSYNC": ValueOf(syscall.EL2NSYNC), + "EL3HLT": ValueOf(syscall.EL3HLT), + "EL3RST": ValueOf(syscall.EL3RST), + "ELF_NGREG": ValueOf(syscall.ELF_NGREG), + "ELF_PRARGSZ": ValueOf(syscall.ELF_PRARGSZ), + "ELIBACC": ValueOf(syscall.ELIBACC), + "ELIBBAD": ValueOf(syscall.ELIBBAD), + "ELIBEXEC": ValueOf(syscall.ELIBEXEC), + "ELIBMAX": ValueOf(syscall.ELIBMAX), + "ELIBSCN": ValueOf(syscall.ELIBSCN), + "ELNRNG": ValueOf(syscall.ELNRNG), + "ELOOP": ValueOf(syscall.ELOOP), + "EMEDIUMTYPE": ValueOf(syscall.EMEDIUMTYPE), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENAVAIL": ValueOf(syscall.ENAVAIL), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOANO": ValueOf(syscall.ENOANO), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENOCSI": ValueOf(syscall.ENOCSI), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOKEY": ValueOf(syscall.ENOKEY), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEDIUM": ValueOf(syscall.ENOMEDIUM), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENONET": ValueOf(syscall.ENONET), + "ENOPKG": ValueOf(syscall.ENOPKG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTNAM": ValueOf(syscall.ENOTNAM), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENOTUNIQ": ValueOf(syscall.ENOTUNIQ), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPOLLERR": ValueOf(syscall.EPOLLERR), + "EPOLLET": ValueOf(syscall.EPOLLET), + "EPOLLHUP": ValueOf(syscall.EPOLLHUP), + "EPOLLIN": ValueOf(syscall.EPOLLIN), + "EPOLLMSG": ValueOf(syscall.EPOLLMSG), + "EPOLLONESHOT": ValueOf(syscall.EPOLLONESHOT), + "EPOLLOUT": ValueOf(syscall.EPOLLOUT), + "EPOLLPRI": ValueOf(syscall.EPOLLPRI), + "EPOLLRDBAND": ValueOf(syscall.EPOLLRDBAND), + "EPOLLRDHUP": ValueOf(syscall.EPOLLRDHUP), + "EPOLLRDNORM": ValueOf(syscall.EPOLLRDNORM), + "EPOLLWRBAND": ValueOf(syscall.EPOLLWRBAND), + "EPOLLWRNORM": ValueOf(syscall.EPOLLWRNORM), + "EPOLL_CLOEXEC": ValueOf(syscall.EPOLL_CLOEXEC), + "EPOLL_CTL_ADD": ValueOf(syscall.EPOLL_CTL_ADD), + "EPOLL_CTL_DEL": ValueOf(syscall.EPOLL_CTL_DEL), + "EPOLL_CTL_MOD": ValueOf(syscall.EPOLL_CTL_MOD), + "EPOLL_NONBLOCK": ValueOf(syscall.EPOLL_NONBLOCK), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMCHG": ValueOf(syscall.EREMCHG), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EREMOTEIO": ValueOf(syscall.EREMOTEIO), + "ERESTART": ValueOf(syscall.ERESTART), + "ERFKILL": ValueOf(syscall.ERFKILL), + "EROFS": ValueOf(syscall.EROFS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESRMNT": ValueOf(syscall.ESRMNT), + "ESTALE": ValueOf(syscall.ESTALE), + "ESTRPIPE": ValueOf(syscall.ESTRPIPE), + "ETH_P_1588": ValueOf(syscall.ETH_P_1588), + "ETH_P_8021Q": ValueOf(syscall.ETH_P_8021Q), + "ETH_P_802_2": ValueOf(syscall.ETH_P_802_2), + "ETH_P_802_3": ValueOf(syscall.ETH_P_802_3), + "ETH_P_AARP": ValueOf(syscall.ETH_P_AARP), + "ETH_P_ALL": ValueOf(syscall.ETH_P_ALL), + "ETH_P_AOE": ValueOf(syscall.ETH_P_AOE), + "ETH_P_ARCNET": ValueOf(syscall.ETH_P_ARCNET), + "ETH_P_ARP": ValueOf(syscall.ETH_P_ARP), + "ETH_P_ATALK": ValueOf(syscall.ETH_P_ATALK), + "ETH_P_ATMFATE": ValueOf(syscall.ETH_P_ATMFATE), + "ETH_P_ATMMPOA": ValueOf(syscall.ETH_P_ATMMPOA), + "ETH_P_AX25": ValueOf(syscall.ETH_P_AX25), + "ETH_P_BPQ": ValueOf(syscall.ETH_P_BPQ), + "ETH_P_CAIF": ValueOf(syscall.ETH_P_CAIF), + "ETH_P_CAN": ValueOf(syscall.ETH_P_CAN), + "ETH_P_CONTROL": ValueOf(syscall.ETH_P_CONTROL), + "ETH_P_CUST": ValueOf(syscall.ETH_P_CUST), + "ETH_P_DDCMP": ValueOf(syscall.ETH_P_DDCMP), + "ETH_P_DEC": ValueOf(syscall.ETH_P_DEC), + "ETH_P_DIAG": ValueOf(syscall.ETH_P_DIAG), + "ETH_P_DNA_DL": ValueOf(syscall.ETH_P_DNA_DL), + "ETH_P_DNA_RC": ValueOf(syscall.ETH_P_DNA_RC), + "ETH_P_DNA_RT": ValueOf(syscall.ETH_P_DNA_RT), + "ETH_P_DSA": ValueOf(syscall.ETH_P_DSA), + "ETH_P_ECONET": ValueOf(syscall.ETH_P_ECONET), + "ETH_P_EDSA": ValueOf(syscall.ETH_P_EDSA), + "ETH_P_FCOE": ValueOf(syscall.ETH_P_FCOE), + "ETH_P_FIP": ValueOf(syscall.ETH_P_FIP), + "ETH_P_HDLC": ValueOf(syscall.ETH_P_HDLC), + "ETH_P_IEEE802154": ValueOf(syscall.ETH_P_IEEE802154), + "ETH_P_IEEEPUP": ValueOf(syscall.ETH_P_IEEEPUP), + "ETH_P_IEEEPUPAT": ValueOf(syscall.ETH_P_IEEEPUPAT), + "ETH_P_IP": ValueOf(syscall.ETH_P_IP), + "ETH_P_IPV6": ValueOf(syscall.ETH_P_IPV6), + "ETH_P_IPX": ValueOf(syscall.ETH_P_IPX), + "ETH_P_IRDA": ValueOf(syscall.ETH_P_IRDA), + "ETH_P_LAT": ValueOf(syscall.ETH_P_LAT), + "ETH_P_LINK_CTL": ValueOf(syscall.ETH_P_LINK_CTL), + "ETH_P_LOCALTALK": ValueOf(syscall.ETH_P_LOCALTALK), + "ETH_P_LOOP": ValueOf(syscall.ETH_P_LOOP), + "ETH_P_MOBITEX": ValueOf(syscall.ETH_P_MOBITEX), + "ETH_P_MPLS_MC": ValueOf(syscall.ETH_P_MPLS_MC), + "ETH_P_MPLS_UC": ValueOf(syscall.ETH_P_MPLS_UC), + "ETH_P_PAE": ValueOf(syscall.ETH_P_PAE), + "ETH_P_PAUSE": ValueOf(syscall.ETH_P_PAUSE), + "ETH_P_PHONET": ValueOf(syscall.ETH_P_PHONET), + "ETH_P_PPPTALK": ValueOf(syscall.ETH_P_PPPTALK), + "ETH_P_PPP_DISC": ValueOf(syscall.ETH_P_PPP_DISC), + "ETH_P_PPP_MP": ValueOf(syscall.ETH_P_PPP_MP), + "ETH_P_PPP_SES": ValueOf(syscall.ETH_P_PPP_SES), + "ETH_P_PUP": ValueOf(syscall.ETH_P_PUP), + "ETH_P_PUPAT": ValueOf(syscall.ETH_P_PUPAT), + "ETH_P_RARP": ValueOf(syscall.ETH_P_RARP), + "ETH_P_SCA": ValueOf(syscall.ETH_P_SCA), + "ETH_P_SLOW": ValueOf(syscall.ETH_P_SLOW), + "ETH_P_SNAP": ValueOf(syscall.ETH_P_SNAP), + "ETH_P_TEB": ValueOf(syscall.ETH_P_TEB), + "ETH_P_TIPC": ValueOf(syscall.ETH_P_TIPC), + "ETH_P_TRAILER": ValueOf(syscall.ETH_P_TRAILER), + "ETH_P_TR_802_2": ValueOf(syscall.ETH_P_TR_802_2), + "ETH_P_WAN_PPP": ValueOf(syscall.ETH_P_WAN_PPP), + "ETH_P_WCCP": ValueOf(syscall.ETH_P_WCCP), + "ETH_P_X25": ValueOf(syscall.ETH_P_X25), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUCLEAN": ValueOf(syscall.EUCLEAN), + "EUNATCH": ValueOf(syscall.EUNATCH), + "EUSERS": ValueOf(syscall.EUSERS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXFULL": ValueOf(syscall.EXFULL), + "Environ": ValueOf(syscall.Environ), + "EpollCreate": ValueOf(syscall.EpollCreate), + "EpollCreate1": ValueOf(syscall.EpollCreate1), + "EpollCtl": ValueOf(syscall.EpollCtl), + "EpollWait": ValueOf(syscall.EpollWait), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_EXLCK": ValueOf(syscall.F_EXLCK), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLEASE": ValueOf(syscall.F_GETLEASE), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLK64": ValueOf(syscall.F_GETLK64), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETOWN_EX": ValueOf(syscall.F_GETOWN_EX), + "F_GETPIPE_SZ": ValueOf(syscall.F_GETPIPE_SZ), + "F_GETSIG": ValueOf(syscall.F_GETSIG), + "F_LOCK": ValueOf(syscall.F_LOCK), + "F_NOTIFY": ValueOf(syscall.F_NOTIFY), + "F_OK": ValueOf(syscall.F_OK), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLEASE": ValueOf(syscall.F_SETLEASE), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLK64": ValueOf(syscall.F_SETLK64), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLKW64": ValueOf(syscall.F_SETLKW64), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETOWN_EX": ValueOf(syscall.F_SETOWN_EX), + "F_SETPIPE_SZ": ValueOf(syscall.F_SETPIPE_SZ), + "F_SETSIG": ValueOf(syscall.F_SETSIG), + "F_SHLCK": ValueOf(syscall.F_SHLCK), + "F_TEST": ValueOf(syscall.F_TEST), + "F_TLOCK": ValueOf(syscall.F_TLOCK), + "F_ULOCK": ValueOf(syscall.F_ULOCK), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Faccessat": ValueOf(syscall.Faccessat), + "Fallocate": ValueOf(syscall.Fallocate), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchmodat": ValueOf(syscall.Fchmodat), + "Fchown": ValueOf(syscall.Fchown), + "Fchownat": ValueOf(syscall.Fchownat), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Fdatasync": ValueOf(syscall.Fdatasync), + "Flock": ValueOf(syscall.Flock), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fstat": ValueOf(syscall.Fstat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Futimesat": ValueOf(syscall.Futimesat), + "Getcwd": ValueOf(syscall.Getcwd), + "Getdents": ValueOf(syscall.Getdents), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "GetsockoptUcred": ValueOf(syscall.GetsockoptUcred), + "Gettid": ValueOf(syscall.Gettid), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "Getxattr": ValueOf(syscall.Getxattr), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMPV6_FILTER": ValueOf(syscall.ICMPV6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFA_ADDRESS": ValueOf(syscall.IFA_ADDRESS), + "IFA_ANYCAST": ValueOf(syscall.IFA_ANYCAST), + "IFA_BROADCAST": ValueOf(syscall.IFA_BROADCAST), + "IFA_CACHEINFO": ValueOf(syscall.IFA_CACHEINFO), + "IFA_F_DADFAILED": ValueOf(syscall.IFA_F_DADFAILED), + "IFA_F_DEPRECATED": ValueOf(syscall.IFA_F_DEPRECATED), + "IFA_F_HOMEADDRESS": ValueOf(syscall.IFA_F_HOMEADDRESS), + "IFA_F_NODAD": ValueOf(syscall.IFA_F_NODAD), + "IFA_F_OPTIMISTIC": ValueOf(syscall.IFA_F_OPTIMISTIC), + "IFA_F_PERMANENT": ValueOf(syscall.IFA_F_PERMANENT), + "IFA_F_SECONDARY": ValueOf(syscall.IFA_F_SECONDARY), + "IFA_F_TEMPORARY": ValueOf(syscall.IFA_F_TEMPORARY), + "IFA_F_TENTATIVE": ValueOf(syscall.IFA_F_TENTATIVE), + "IFA_LABEL": ValueOf(syscall.IFA_LABEL), + "IFA_LOCAL": ValueOf(syscall.IFA_LOCAL), + "IFA_MAX": ValueOf(syscall.IFA_MAX), + "IFA_MULTICAST": ValueOf(syscall.IFA_MULTICAST), + "IFA_UNSPEC": ValueOf(syscall.IFA_UNSPEC), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_AUTOMEDIA": ValueOf(syscall.IFF_AUTOMEDIA), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DYNAMIC": ValueOf(syscall.IFF_DYNAMIC), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MASTER": ValueOf(syscall.IFF_MASTER), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_NO_PI": ValueOf(syscall.IFF_NO_PI), + "IFF_ONE_QUEUE": ValueOf(syscall.IFF_ONE_QUEUE), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PORTSEL": ValueOf(syscall.IFF_PORTSEL), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SLAVE": ValueOf(syscall.IFF_SLAVE), + "IFF_TAP": ValueOf(syscall.IFF_TAP), + "IFF_TUN": ValueOf(syscall.IFF_TUN), + "IFF_TUN_EXCL": ValueOf(syscall.IFF_TUN_EXCL), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFF_VNET_HDR": ValueOf(syscall.IFF_VNET_HDR), + "IFLA_ADDRESS": ValueOf(syscall.IFLA_ADDRESS), + "IFLA_BROADCAST": ValueOf(syscall.IFLA_BROADCAST), + "IFLA_COST": ValueOf(syscall.IFLA_COST), + "IFLA_IFALIAS": ValueOf(syscall.IFLA_IFALIAS), + "IFLA_IFNAME": ValueOf(syscall.IFLA_IFNAME), + "IFLA_LINK": ValueOf(syscall.IFLA_LINK), + "IFLA_LINKINFO": ValueOf(syscall.IFLA_LINKINFO), + "IFLA_LINKMODE": ValueOf(syscall.IFLA_LINKMODE), + "IFLA_MAP": ValueOf(syscall.IFLA_MAP), + "IFLA_MASTER": ValueOf(syscall.IFLA_MASTER), + "IFLA_MAX": ValueOf(syscall.IFLA_MAX), + "IFLA_MTU": ValueOf(syscall.IFLA_MTU), + "IFLA_NET_NS_PID": ValueOf(syscall.IFLA_NET_NS_PID), + "IFLA_OPERSTATE": ValueOf(syscall.IFLA_OPERSTATE), + "IFLA_PRIORITY": ValueOf(syscall.IFLA_PRIORITY), + "IFLA_PROTINFO": ValueOf(syscall.IFLA_PROTINFO), + "IFLA_QDISC": ValueOf(syscall.IFLA_QDISC), + "IFLA_STATS": ValueOf(syscall.IFLA_STATS), + "IFLA_TXQLEN": ValueOf(syscall.IFLA_TXQLEN), + "IFLA_UNSPEC": ValueOf(syscall.IFLA_UNSPEC), + "IFLA_WEIGHT": ValueOf(syscall.IFLA_WEIGHT), + "IFLA_WIRELESS": ValueOf(syscall.IFLA_WIRELESS), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_ACCESS": ValueOf(syscall.IN_ACCESS), + "IN_ALL_EVENTS": ValueOf(syscall.IN_ALL_EVENTS), + "IN_ATTRIB": ValueOf(syscall.IN_ATTRIB), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint64(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint64(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint64(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLOEXEC": ValueOf(syscall.IN_CLOEXEC), + "IN_CLOSE": ValueOf(syscall.IN_CLOSE), + "IN_CLOSE_NOWRITE": ValueOf(syscall.IN_CLOSE_NOWRITE), + "IN_CLOSE_WRITE": ValueOf(syscall.IN_CLOSE_WRITE), + "IN_CREATE": ValueOf(syscall.IN_CREATE), + "IN_DELETE": ValueOf(syscall.IN_DELETE), + "IN_DELETE_SELF": ValueOf(syscall.IN_DELETE_SELF), + "IN_DONT_FOLLOW": ValueOf(syscall.IN_DONT_FOLLOW), + "IN_EXCL_UNLINK": ValueOf(syscall.IN_EXCL_UNLINK), + "IN_IGNORED": ValueOf(syscall.IN_IGNORED), + "IN_ISDIR": ValueOf(syscall.IN_ISDIR), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_MASK_ADD": ValueOf(syscall.IN_MASK_ADD), + "IN_MODIFY": ValueOf(syscall.IN_MODIFY), + "IN_MOVE": ValueOf(syscall.IN_MOVE), + "IN_MOVED_FROM": ValueOf(syscall.IN_MOVED_FROM), + "IN_MOVED_TO": ValueOf(syscall.IN_MOVED_TO), + "IN_MOVE_SELF": ValueOf(syscall.IN_MOVE_SELF), + "IN_NONBLOCK": ValueOf(syscall.IN_NONBLOCK), + "IN_ONESHOT": ValueOf(uint64(syscall.IN_ONESHOT)), + "IN_ONLYDIR": ValueOf(syscall.IN_ONLYDIR), + "IN_OPEN": ValueOf(syscall.IN_OPEN), + "IN_Q_OVERFLOW": ValueOf(syscall.IN_Q_OVERFLOW), + "IN_UNMOUNT": ValueOf(syscall.IN_UNMOUNT), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_COMP": ValueOf(syscall.IPPROTO_COMP), + "IPPROTO_DCCP": ValueOf(syscall.IPPROTO_DCCP), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_UDPLITE": ValueOf(syscall.IPPROTO_UDPLITE), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_ADDRFORM": ValueOf(syscall.IPV6_ADDRFORM), + "IPV6_ADD_MEMBERSHIP": ValueOf(syscall.IPV6_ADD_MEMBERSHIP), + "IPV6_AUTHHDR": ValueOf(syscall.IPV6_AUTHHDR), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DROP_MEMBERSHIP": ValueOf(syscall.IPV6_DROP_MEMBERSHIP), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_ANYCAST": ValueOf(syscall.IPV6_JOIN_ANYCAST), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_ANYCAST": ValueOf(syscall.IPV6_LEAVE_ANYCAST), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MTU": ValueOf(syscall.IPV6_MTU), + "IPV6_MTU_DISCOVER": ValueOf(syscall.IPV6_MTU_DISCOVER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PMTUDISC_DO": ValueOf(syscall.IPV6_PMTUDISC_DO), + "IPV6_PMTUDISC_DONT": ValueOf(syscall.IPV6_PMTUDISC_DONT), + "IPV6_PMTUDISC_PROBE": ValueOf(syscall.IPV6_PMTUDISC_PROBE), + "IPV6_PMTUDISC_WANT": ValueOf(syscall.IPV6_PMTUDISC_WANT), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVERR": ValueOf(syscall.IPV6_RECVERR), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_ROUTER_ALERT": ValueOf(syscall.IPV6_ROUTER_ALERT), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_RXDSTOPTS": ValueOf(syscall.IPV6_RXDSTOPTS), + "IPV6_RXHOPOPTS": ValueOf(syscall.IPV6_RXHOPOPTS), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_XFRM_POLICY": ValueOf(syscall.IPV6_XFRM_POLICY), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_FREEBIND": ValueOf(syscall.IP_FREEBIND), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MTU": ValueOf(syscall.IP_MTU), + "IP_MTU_DISCOVER": ValueOf(syscall.IP_MTU_DISCOVER), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_ORIGDSTADDR": ValueOf(syscall.IP_ORIGDSTADDR), + "IP_PASSSEC": ValueOf(syscall.IP_PASSSEC), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PKTOPTIONS": ValueOf(syscall.IP_PKTOPTIONS), + "IP_PMTUDISC": ValueOf(syscall.IP_PMTUDISC), + "IP_PMTUDISC_DO": ValueOf(syscall.IP_PMTUDISC_DO), + "IP_PMTUDISC_DONT": ValueOf(syscall.IP_PMTUDISC_DONT), + "IP_PMTUDISC_PROBE": ValueOf(syscall.IP_PMTUDISC_PROBE), + "IP_PMTUDISC_WANT": ValueOf(syscall.IP_PMTUDISC_WANT), + "IP_RECVERR": ValueOf(syscall.IP_RECVERR), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVORIGDSTADDR": ValueOf(syscall.IP_RECVORIGDSTADDR), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_ROUTER_ALERT": ValueOf(syscall.IP_ROUTER_ALERT), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRANSPARENT": ValueOf(syscall.IP_TRANSPARENT), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "IP_XFRM_POLICY": ValueOf(syscall.IP_XFRM_POLICY), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUCLC": ValueOf(syscall.IUCLC), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "InotifyAddWatch": ValueOf(syscall.InotifyAddWatch), + "InotifyInit": ValueOf(syscall.InotifyInit), + "InotifyInit1": ValueOf(syscall.InotifyInit1), + "InotifyRmWatch": ValueOf(syscall.InotifyRmWatch), + "Kill": ValueOf(syscall.Kill), + "Klogctl": ValueOf(syscall.Klogctl), + "LINUX_REBOOT_CMD_CAD_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_CAD_OFF), + "LINUX_REBOOT_CMD_CAD_ON": ValueOf(uint64(syscall.LINUX_REBOOT_CMD_CAD_ON)), + "LINUX_REBOOT_CMD_HALT": ValueOf(uint64(syscall.LINUX_REBOOT_CMD_HALT)), + "LINUX_REBOOT_CMD_KEXEC": ValueOf(syscall.LINUX_REBOOT_CMD_KEXEC), + "LINUX_REBOOT_CMD_POWER_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_POWER_OFF), + "LINUX_REBOOT_CMD_RESTART": ValueOf(syscall.LINUX_REBOOT_CMD_RESTART), + "LINUX_REBOOT_CMD_RESTART2": ValueOf(uint64(syscall.LINUX_REBOOT_CMD_RESTART2)), + "LINUX_REBOOT_CMD_SW_SUSPEND": ValueOf(uint64(syscall.LINUX_REBOOT_CMD_SW_SUSPEND)), + "LINUX_REBOOT_MAGIC1": ValueOf(uint64(syscall.LINUX_REBOOT_MAGIC1)), + "LINUX_REBOOT_MAGIC2": ValueOf(syscall.LINUX_REBOOT_MAGIC2), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Listxattr": ValueOf(syscall.Listxattr), + "LsfJump": ValueOf(syscall.LsfJump), + "LsfSocket": ValueOf(syscall.LsfSocket), + "LsfStmt": ValueOf(syscall.LsfStmt), + "Lstat": ValueOf(syscall.Lstat), + "MADV_DOFORK": ValueOf(syscall.MADV_DOFORK), + "MADV_DONTFORK": ValueOf(syscall.MADV_DONTFORK), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_HUGEPAGE": ValueOf(syscall.MADV_HUGEPAGE), + "MADV_HWPOISON": ValueOf(syscall.MADV_HWPOISON), + "MADV_MERGEABLE": ValueOf(syscall.MADV_MERGEABLE), + "MADV_NOHUGEPAGE": ValueOf(syscall.MADV_NOHUGEPAGE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_REMOVE": ValueOf(syscall.MADV_REMOVE), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_UNMERGEABLE": ValueOf(syscall.MADV_UNMERGEABLE), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_DENYWRITE": ValueOf(syscall.MAP_DENYWRITE), + "MAP_EXECUTABLE": ValueOf(syscall.MAP_EXECUTABLE), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_GROWSDOWN": ValueOf(syscall.MAP_GROWSDOWN), + "MAP_LOCKED": ValueOf(syscall.MAP_LOCKED), + "MAP_NONBLOCK": ValueOf(syscall.MAP_NONBLOCK), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_POPULATE": ValueOf(syscall.MAP_POPULATE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_TYPE": ValueOf(syscall.MAP_TYPE), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MNT_DETACH": ValueOf(syscall.MNT_DETACH), + "MNT_EXPIRE": ValueOf(syscall.MNT_EXPIRE), + "MNT_FORCE": ValueOf(syscall.MNT_FORCE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_CONFIRM": ValueOf(syscall.MSG_CONFIRM), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_ERRQUEUE": ValueOf(syscall.MSG_ERRQUEUE), + "MSG_FASTOPEN": ValueOf(syscall.MSG_FASTOPEN), + "MSG_FIN": ValueOf(syscall.MSG_FIN), + "MSG_MORE": ValueOf(syscall.MSG_MORE), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_PROXY": ValueOf(syscall.MSG_PROXY), + "MSG_RST": ValueOf(syscall.MSG_RST), + "MSG_SYN": ValueOf(syscall.MSG_SYN), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_TRYHARD": ValueOf(syscall.MSG_TRYHARD), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITFORONE": ValueOf(syscall.MSG_WAITFORONE), + "MS_ACTIVE": ValueOf(syscall.MS_ACTIVE), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_BIND": ValueOf(syscall.MS_BIND), + "MS_DIRSYNC": ValueOf(syscall.MS_DIRSYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_I_VERSION": ValueOf(syscall.MS_I_VERSION), + "MS_KERNMOUNT": ValueOf(syscall.MS_KERNMOUNT), + "MS_MANDLOCK": ValueOf(syscall.MS_MANDLOCK), + "MS_MGC_MSK": ValueOf(uint64(syscall.MS_MGC_MSK)), + "MS_MGC_VAL": ValueOf(uint64(syscall.MS_MGC_VAL)), + "MS_MOVE": ValueOf(syscall.MS_MOVE), + "MS_NOATIME": ValueOf(syscall.MS_NOATIME), + "MS_NODEV": ValueOf(syscall.MS_NODEV), + "MS_NODIRATIME": ValueOf(syscall.MS_NODIRATIME), + "MS_NOEXEC": ValueOf(syscall.MS_NOEXEC), + "MS_NOSUID": ValueOf(syscall.MS_NOSUID), + "MS_NOUSER": ValueOf(syscall.MS_NOUSER), + "MS_POSIXACL": ValueOf(syscall.MS_POSIXACL), + "MS_PRIVATE": ValueOf(syscall.MS_PRIVATE), + "MS_RDONLY": ValueOf(syscall.MS_RDONLY), + "MS_REC": ValueOf(syscall.MS_REC), + "MS_RELATIME": ValueOf(syscall.MS_RELATIME), + "MS_REMOUNT": ValueOf(syscall.MS_REMOUNT), + "MS_RMT_MASK": ValueOf(syscall.MS_RMT_MASK), + "MS_SHARED": ValueOf(syscall.MS_SHARED), + "MS_SILENT": ValueOf(syscall.MS_SILENT), + "MS_SLAVE": ValueOf(syscall.MS_SLAVE), + "MS_STRICTATIME": ValueOf(syscall.MS_STRICTATIME), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "MS_SYNCHRONOUS": ValueOf(syscall.MS_SYNCHRONOUS), + "MS_UNBINDABLE": ValueOf(syscall.MS_UNBINDABLE), + "Madvise": ValueOf(syscall.Madvise), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkdirat": ValueOf(syscall.Mkdirat), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mknodat": ValueOf(syscall.Mknodat), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mount": ValueOf(syscall.Mount), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NETLINK_ADD_MEMBERSHIP": ValueOf(syscall.NETLINK_ADD_MEMBERSHIP), + "NETLINK_AUDIT": ValueOf(syscall.NETLINK_AUDIT), + "NETLINK_BROADCAST_ERROR": ValueOf(syscall.NETLINK_BROADCAST_ERROR), + "NETLINK_CONNECTOR": ValueOf(syscall.NETLINK_CONNECTOR), + "NETLINK_DNRTMSG": ValueOf(syscall.NETLINK_DNRTMSG), + "NETLINK_DROP_MEMBERSHIP": ValueOf(syscall.NETLINK_DROP_MEMBERSHIP), + "NETLINK_ECRYPTFS": ValueOf(syscall.NETLINK_ECRYPTFS), + "NETLINK_FIB_LOOKUP": ValueOf(syscall.NETLINK_FIB_LOOKUP), + "NETLINK_FIREWALL": ValueOf(syscall.NETLINK_FIREWALL), + "NETLINK_GENERIC": ValueOf(syscall.NETLINK_GENERIC), + "NETLINK_INET_DIAG": ValueOf(syscall.NETLINK_INET_DIAG), + "NETLINK_IP6_FW": ValueOf(syscall.NETLINK_IP6_FW), + "NETLINK_ISCSI": ValueOf(syscall.NETLINK_ISCSI), + "NETLINK_KOBJECT_UEVENT": ValueOf(syscall.NETLINK_KOBJECT_UEVENT), + "NETLINK_NETFILTER": ValueOf(syscall.NETLINK_NETFILTER), + "NETLINK_NFLOG": ValueOf(syscall.NETLINK_NFLOG), + "NETLINK_NO_ENOBUFS": ValueOf(syscall.NETLINK_NO_ENOBUFS), + "NETLINK_PKTINFO": ValueOf(syscall.NETLINK_PKTINFO), + "NETLINK_RDMA": ValueOf(syscall.NETLINK_RDMA), + "NETLINK_ROUTE": ValueOf(syscall.NETLINK_ROUTE), + "NETLINK_SCSITRANSPORT": ValueOf(syscall.NETLINK_SCSITRANSPORT), + "NETLINK_SELINUX": ValueOf(syscall.NETLINK_SELINUX), + "NETLINK_UNUSED": ValueOf(syscall.NETLINK_UNUSED), + "NETLINK_USERSOCK": ValueOf(syscall.NETLINK_USERSOCK), + "NETLINK_XFRM": ValueOf(syscall.NETLINK_XFRM), + "NLA_ALIGNTO": ValueOf(syscall.NLA_ALIGNTO), + "NLA_F_NESTED": ValueOf(syscall.NLA_F_NESTED), + "NLA_F_NET_BYTEORDER": ValueOf(syscall.NLA_F_NET_BYTEORDER), + "NLA_HDRLEN": ValueOf(syscall.NLA_HDRLEN), + "NLMSG_ALIGNTO": ValueOf(syscall.NLMSG_ALIGNTO), + "NLMSG_DONE": ValueOf(syscall.NLMSG_DONE), + "NLMSG_ERROR": ValueOf(syscall.NLMSG_ERROR), + "NLMSG_HDRLEN": ValueOf(syscall.NLMSG_HDRLEN), + "NLMSG_MIN_TYPE": ValueOf(syscall.NLMSG_MIN_TYPE), + "NLMSG_NOOP": ValueOf(syscall.NLMSG_NOOP), + "NLMSG_OVERRUN": ValueOf(syscall.NLMSG_OVERRUN), + "NLM_F_ACK": ValueOf(syscall.NLM_F_ACK), + "NLM_F_APPEND": ValueOf(syscall.NLM_F_APPEND), + "NLM_F_ATOMIC": ValueOf(syscall.NLM_F_ATOMIC), + "NLM_F_CREATE": ValueOf(syscall.NLM_F_CREATE), + "NLM_F_DUMP": ValueOf(syscall.NLM_F_DUMP), + "NLM_F_ECHO": ValueOf(syscall.NLM_F_ECHO), + "NLM_F_EXCL": ValueOf(syscall.NLM_F_EXCL), + "NLM_F_MATCH": ValueOf(syscall.NLM_F_MATCH), + "NLM_F_MULTI": ValueOf(syscall.NLM_F_MULTI), + "NLM_F_REPLACE": ValueOf(syscall.NLM_F_REPLACE), + "NLM_F_REQUEST": ValueOf(syscall.NLM_F_REQUEST), + "NLM_F_ROOT": ValueOf(syscall.NLM_F_ROOT), + "NOFLSH": ValueOf(syscall.NOFLSH), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NetlinkRIB": ValueOf(syscall.NetlinkRIB), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "OLCUC": ValueOf(syscall.OLCUC), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_LARGEFILE": ValueOf(syscall.O_LARGEFILE), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOATIME": ValueOf(syscall.O_NOATIME), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_RSYNC": ValueOf(syscall.O_RSYNC), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "Openat": ValueOf(syscall.Openat), + "PACKET_ADD_MEMBERSHIP": ValueOf(syscall.PACKET_ADD_MEMBERSHIP), + "PACKET_BROADCAST": ValueOf(syscall.PACKET_BROADCAST), + "PACKET_DROP_MEMBERSHIP": ValueOf(syscall.PACKET_DROP_MEMBERSHIP), + "PACKET_FASTROUTE": ValueOf(syscall.PACKET_FASTROUTE), + "PACKET_HOST": ValueOf(syscall.PACKET_HOST), + "PACKET_LOOPBACK": ValueOf(syscall.PACKET_LOOPBACK), + "PACKET_MR_ALLMULTI": ValueOf(syscall.PACKET_MR_ALLMULTI), + "PACKET_MR_MULTICAST": ValueOf(syscall.PACKET_MR_MULTICAST), + "PACKET_MR_PROMISC": ValueOf(syscall.PACKET_MR_PROMISC), + "PACKET_MULTICAST": ValueOf(syscall.PACKET_MULTICAST), + "PACKET_OTHERHOST": ValueOf(syscall.PACKET_OTHERHOST), + "PACKET_OUTGOING": ValueOf(syscall.PACKET_OUTGOING), + "PACKET_RECV_OUTPUT": ValueOf(syscall.PACKET_RECV_OUTPUT), + "PACKET_RX_RING": ValueOf(syscall.PACKET_RX_RING), + "PACKET_STATISTICS": ValueOf(syscall.PACKET_STATISTICS), + "PARENB": ValueOf(syscall.PARENB), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_GROWSDOWN": ValueOf(syscall.PROT_GROWSDOWN), + "PROT_GROWSUP": ValueOf(syscall.PROT_GROWSUP), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PR_CAPBSET_DROP": ValueOf(syscall.PR_CAPBSET_DROP), + "PR_CAPBSET_READ": ValueOf(syscall.PR_CAPBSET_READ), + "PR_CLEAR_SECCOMP_FILTER": ValueOf(syscall.PR_CLEAR_SECCOMP_FILTER), + "PR_ENDIAN_BIG": ValueOf(syscall.PR_ENDIAN_BIG), + "PR_ENDIAN_LITTLE": ValueOf(syscall.PR_ENDIAN_LITTLE), + "PR_ENDIAN_PPC_LITTLE": ValueOf(syscall.PR_ENDIAN_PPC_LITTLE), + "PR_FPEMU_NOPRINT": ValueOf(syscall.PR_FPEMU_NOPRINT), + "PR_FPEMU_SIGFPE": ValueOf(syscall.PR_FPEMU_SIGFPE), + "PR_FP_EXC_ASYNC": ValueOf(syscall.PR_FP_EXC_ASYNC), + "PR_FP_EXC_DISABLED": ValueOf(syscall.PR_FP_EXC_DISABLED), + "PR_FP_EXC_DIV": ValueOf(syscall.PR_FP_EXC_DIV), + "PR_FP_EXC_INV": ValueOf(syscall.PR_FP_EXC_INV), + "PR_FP_EXC_NONRECOV": ValueOf(syscall.PR_FP_EXC_NONRECOV), + "PR_FP_EXC_OVF": ValueOf(syscall.PR_FP_EXC_OVF), + "PR_FP_EXC_PRECISE": ValueOf(syscall.PR_FP_EXC_PRECISE), + "PR_FP_EXC_RES": ValueOf(syscall.PR_FP_EXC_RES), + "PR_FP_EXC_SW_ENABLE": ValueOf(syscall.PR_FP_EXC_SW_ENABLE), + "PR_FP_EXC_UND": ValueOf(syscall.PR_FP_EXC_UND), + "PR_GET_DUMPABLE": ValueOf(syscall.PR_GET_DUMPABLE), + "PR_GET_ENDIAN": ValueOf(syscall.PR_GET_ENDIAN), + "PR_GET_FPEMU": ValueOf(syscall.PR_GET_FPEMU), + "PR_GET_FPEXC": ValueOf(syscall.PR_GET_FPEXC), + "PR_GET_KEEPCAPS": ValueOf(syscall.PR_GET_KEEPCAPS), + "PR_GET_NAME": ValueOf(syscall.PR_GET_NAME), + "PR_GET_PDEATHSIG": ValueOf(syscall.PR_GET_PDEATHSIG), + "PR_GET_SECCOMP": ValueOf(syscall.PR_GET_SECCOMP), + "PR_GET_SECCOMP_FILTER": ValueOf(syscall.PR_GET_SECCOMP_FILTER), + "PR_GET_SECUREBITS": ValueOf(syscall.PR_GET_SECUREBITS), + "PR_GET_TIMERSLACK": ValueOf(syscall.PR_GET_TIMERSLACK), + "PR_GET_TIMING": ValueOf(syscall.PR_GET_TIMING), + "PR_GET_TSC": ValueOf(syscall.PR_GET_TSC), + "PR_GET_UNALIGN": ValueOf(syscall.PR_GET_UNALIGN), + "PR_MCE_KILL": ValueOf(syscall.PR_MCE_KILL), + "PR_MCE_KILL_CLEAR": ValueOf(syscall.PR_MCE_KILL_CLEAR), + "PR_MCE_KILL_DEFAULT": ValueOf(syscall.PR_MCE_KILL_DEFAULT), + "PR_MCE_KILL_EARLY": ValueOf(syscall.PR_MCE_KILL_EARLY), + "PR_MCE_KILL_GET": ValueOf(syscall.PR_MCE_KILL_GET), + "PR_MCE_KILL_LATE": ValueOf(syscall.PR_MCE_KILL_LATE), + "PR_MCE_KILL_SET": ValueOf(syscall.PR_MCE_KILL_SET), + "PR_SECCOMP_FILTER_EVENT": ValueOf(syscall.PR_SECCOMP_FILTER_EVENT), + "PR_SECCOMP_FILTER_SYSCALL": ValueOf(syscall.PR_SECCOMP_FILTER_SYSCALL), + "PR_SET_DUMPABLE": ValueOf(syscall.PR_SET_DUMPABLE), + "PR_SET_ENDIAN": ValueOf(syscall.PR_SET_ENDIAN), + "PR_SET_FPEMU": ValueOf(syscall.PR_SET_FPEMU), + "PR_SET_FPEXC": ValueOf(syscall.PR_SET_FPEXC), + "PR_SET_KEEPCAPS": ValueOf(syscall.PR_SET_KEEPCAPS), + "PR_SET_NAME": ValueOf(syscall.PR_SET_NAME), + "PR_SET_PDEATHSIG": ValueOf(syscall.PR_SET_PDEATHSIG), + "PR_SET_PTRACER": ValueOf(syscall.PR_SET_PTRACER), + "PR_SET_SECCOMP": ValueOf(syscall.PR_SET_SECCOMP), + "PR_SET_SECCOMP_FILTER": ValueOf(syscall.PR_SET_SECCOMP_FILTER), + "PR_SET_SECUREBITS": ValueOf(syscall.PR_SET_SECUREBITS), + "PR_SET_TIMERSLACK": ValueOf(syscall.PR_SET_TIMERSLACK), + "PR_SET_TIMING": ValueOf(syscall.PR_SET_TIMING), + "PR_SET_TSC": ValueOf(syscall.PR_SET_TSC), + "PR_SET_UNALIGN": ValueOf(syscall.PR_SET_UNALIGN), + "PR_TASK_PERF_EVENTS_DISABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_DISABLE), + "PR_TASK_PERF_EVENTS_ENABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_ENABLE), + "PR_TIMING_STATISTICAL": ValueOf(syscall.PR_TIMING_STATISTICAL), + "PR_TIMING_TIMESTAMP": ValueOf(syscall.PR_TIMING_TIMESTAMP), + "PR_TSC_ENABLE": ValueOf(syscall.PR_TSC_ENABLE), + "PR_TSC_SIGSEGV": ValueOf(syscall.PR_TSC_SIGSEGV), + "PR_UNALIGN_NOPRINT": ValueOf(syscall.PR_UNALIGN_NOPRINT), + "PR_UNALIGN_SIGBUS": ValueOf(syscall.PR_UNALIGN_SIGBUS), + "PTRACE_ATTACH": ValueOf(syscall.PTRACE_ATTACH), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_DETACH": ValueOf(syscall.PTRACE_DETACH), + "PTRACE_EVENT_CLONE": ValueOf(syscall.PTRACE_EVENT_CLONE), + "PTRACE_EVENT_EXEC": ValueOf(syscall.PTRACE_EVENT_EXEC), + "PTRACE_EVENT_EXIT": ValueOf(syscall.PTRACE_EVENT_EXIT), + "PTRACE_EVENT_FORK": ValueOf(syscall.PTRACE_EVENT_FORK), + "PTRACE_EVENT_VFORK": ValueOf(syscall.PTRACE_EVENT_VFORK), + "PTRACE_EVENT_VFORK_DONE": ValueOf(syscall.PTRACE_EVENT_VFORK_DONE), + "PTRACE_GETCRUNCHREGS": ValueOf(syscall.PTRACE_GETCRUNCHREGS), + "PTRACE_GETEVENTMSG": ValueOf(syscall.PTRACE_GETEVENTMSG), + "PTRACE_GETFPREGS": ValueOf(syscall.PTRACE_GETFPREGS), + "PTRACE_GETHBPREGS": ValueOf(syscall.PTRACE_GETHBPREGS), + "PTRACE_GETREGS": ValueOf(syscall.PTRACE_GETREGS), + "PTRACE_GETREGSET": ValueOf(syscall.PTRACE_GETREGSET), + "PTRACE_GETSIGINFO": ValueOf(syscall.PTRACE_GETSIGINFO), + "PTRACE_GETVFPREGS": ValueOf(syscall.PTRACE_GETVFPREGS), + "PTRACE_GETWMMXREGS": ValueOf(syscall.PTRACE_GETWMMXREGS), + "PTRACE_GET_THREAD_AREA": ValueOf(syscall.PTRACE_GET_THREAD_AREA), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_OLDSETOPTIONS": ValueOf(syscall.PTRACE_OLDSETOPTIONS), + "PTRACE_O_MASK": ValueOf(syscall.PTRACE_O_MASK), + "PTRACE_O_TRACECLONE": ValueOf(syscall.PTRACE_O_TRACECLONE), + "PTRACE_O_TRACEEXEC": ValueOf(syscall.PTRACE_O_TRACEEXEC), + "PTRACE_O_TRACEEXIT": ValueOf(syscall.PTRACE_O_TRACEEXIT), + "PTRACE_O_TRACEFORK": ValueOf(syscall.PTRACE_O_TRACEFORK), + "PTRACE_O_TRACESYSGOOD": ValueOf(syscall.PTRACE_O_TRACESYSGOOD), + "PTRACE_O_TRACEVFORK": ValueOf(syscall.PTRACE_O_TRACEVFORK), + "PTRACE_O_TRACEVFORKDONE": ValueOf(syscall.PTRACE_O_TRACEVFORKDONE), + "PTRACE_PEEKDATA": ValueOf(syscall.PTRACE_PEEKDATA), + "PTRACE_PEEKTEXT": ValueOf(syscall.PTRACE_PEEKTEXT), + "PTRACE_PEEKUSR": ValueOf(syscall.PTRACE_PEEKUSR), + "PTRACE_POKEDATA": ValueOf(syscall.PTRACE_POKEDATA), + "PTRACE_POKETEXT": ValueOf(syscall.PTRACE_POKETEXT), + "PTRACE_POKEUSR": ValueOf(syscall.PTRACE_POKEUSR), + "PTRACE_SETCRUNCHREGS": ValueOf(syscall.PTRACE_SETCRUNCHREGS), + "PTRACE_SETFPREGS": ValueOf(syscall.PTRACE_SETFPREGS), + "PTRACE_SETHBPREGS": ValueOf(syscall.PTRACE_SETHBPREGS), + "PTRACE_SETOPTIONS": ValueOf(syscall.PTRACE_SETOPTIONS), + "PTRACE_SETREGS": ValueOf(syscall.PTRACE_SETREGS), + "PTRACE_SETREGSET": ValueOf(syscall.PTRACE_SETREGSET), + "PTRACE_SETSIGINFO": ValueOf(syscall.PTRACE_SETSIGINFO), + "PTRACE_SETVFPREGS": ValueOf(syscall.PTRACE_SETVFPREGS), + "PTRACE_SETWMMXREGS": ValueOf(syscall.PTRACE_SETWMMXREGS), + "PTRACE_SET_SYSCALL": ValueOf(syscall.PTRACE_SET_SYSCALL), + "PTRACE_SINGLESTEP": ValueOf(syscall.PTRACE_SINGLESTEP), + "PTRACE_SYSCALL": ValueOf(syscall.PTRACE_SYSCALL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "PT_DATA_ADDR": ValueOf(syscall.PT_DATA_ADDR), + "PT_TEXT_ADDR": ValueOf(syscall.PT_TEXT_ADDR), + "PT_TEXT_END_ADDR": ValueOf(syscall.PT_TEXT_END_ADDR), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseNetlinkMessage": ValueOf(syscall.ParseNetlinkMessage), + "ParseNetlinkRouteAttr": ValueOf(syscall.ParseNetlinkRouteAttr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixCredentials": ValueOf(syscall.ParseUnixCredentials), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "PathMax": ValueOf(syscall.PathMax), + "Pause": ValueOf(syscall.Pause), + "Pipe": ValueOf(syscall.Pipe), + "Pipe2": ValueOf(syscall.Pipe2), + "PivotRoot": ValueOf(syscall.PivotRoot), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceCont": ValueOf(syscall.PtraceCont), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "PtraceGetEventMsg": ValueOf(syscall.PtraceGetEventMsg), + "PtraceGetRegs": ValueOf(syscall.PtraceGetRegs), + "PtracePeekData": ValueOf(syscall.PtracePeekData), + "PtracePeekText": ValueOf(syscall.PtracePeekText), + "PtracePokeData": ValueOf(syscall.PtracePokeData), + "PtracePokeText": ValueOf(syscall.PtracePokeText), + "PtraceSetOptions": ValueOf(syscall.PtraceSetOptions), + "PtraceSetRegs": ValueOf(syscall.PtraceSetRegs), + "PtraceSingleStep": ValueOf(syscall.PtraceSingleStep), + "PtraceSyscall": ValueOf(syscall.PtraceSyscall), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(syscall.RLIM_INFINITY), + "RTAX_ADVMSS": ValueOf(syscall.RTAX_ADVMSS), + "RTAX_CWND": ValueOf(syscall.RTAX_CWND), + "RTAX_FEATURES": ValueOf(syscall.RTAX_FEATURES), + "RTAX_FEATURE_ALLFRAG": ValueOf(syscall.RTAX_FEATURE_ALLFRAG), + "RTAX_FEATURE_ECN": ValueOf(syscall.RTAX_FEATURE_ECN), + "RTAX_FEATURE_SACK": ValueOf(syscall.RTAX_FEATURE_SACK), + "RTAX_FEATURE_TIMESTAMP": ValueOf(syscall.RTAX_FEATURE_TIMESTAMP), + "RTAX_HOPLIMIT": ValueOf(syscall.RTAX_HOPLIMIT), + "RTAX_INITCWND": ValueOf(syscall.RTAX_INITCWND), + "RTAX_INITRWND": ValueOf(syscall.RTAX_INITRWND), + "RTAX_LOCK": ValueOf(syscall.RTAX_LOCK), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_MTU": ValueOf(syscall.RTAX_MTU), + "RTAX_REORDERING": ValueOf(syscall.RTAX_REORDERING), + "RTAX_RTO_MIN": ValueOf(syscall.RTAX_RTO_MIN), + "RTAX_RTT": ValueOf(syscall.RTAX_RTT), + "RTAX_RTTVAR": ValueOf(syscall.RTAX_RTTVAR), + "RTAX_SSTHRESH": ValueOf(syscall.RTAX_SSTHRESH), + "RTAX_UNSPEC": ValueOf(syscall.RTAX_UNSPEC), + "RTAX_WINDOW": ValueOf(syscall.RTAX_WINDOW), + "RTA_ALIGNTO": ValueOf(syscall.RTA_ALIGNTO), + "RTA_CACHEINFO": ValueOf(syscall.RTA_CACHEINFO), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_FLOW": ValueOf(syscall.RTA_FLOW), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_IIF": ValueOf(syscall.RTA_IIF), + "RTA_MAX": ValueOf(syscall.RTA_MAX), + "RTA_METRICS": ValueOf(syscall.RTA_METRICS), + "RTA_MULTIPATH": ValueOf(syscall.RTA_MULTIPATH), + "RTA_OIF": ValueOf(syscall.RTA_OIF), + "RTA_PREFSRC": ValueOf(syscall.RTA_PREFSRC), + "RTA_PRIORITY": ValueOf(syscall.RTA_PRIORITY), + "RTA_SRC": ValueOf(syscall.RTA_SRC), + "RTA_TABLE": ValueOf(syscall.RTA_TABLE), + "RTA_UNSPEC": ValueOf(syscall.RTA_UNSPEC), + "RTCF_DIRECTSRC": ValueOf(syscall.RTCF_DIRECTSRC), + "RTCF_DOREDIRECT": ValueOf(syscall.RTCF_DOREDIRECT), + "RTCF_LOG": ValueOf(syscall.RTCF_LOG), + "RTCF_MASQ": ValueOf(syscall.RTCF_MASQ), + "RTCF_NAT": ValueOf(syscall.RTCF_NAT), + "RTCF_VALVE": ValueOf(syscall.RTCF_VALVE), + "RTF_ADDRCLASSMASK": ValueOf(uint64(syscall.RTF_ADDRCLASSMASK)), + "RTF_ADDRCONF": ValueOf(syscall.RTF_ADDRCONF), + "RTF_ALLONLINK": ValueOf(syscall.RTF_ALLONLINK), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CACHE": ValueOf(syscall.RTF_CACHE), + "RTF_DEFAULT": ValueOf(syscall.RTF_DEFAULT), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FLOW": ValueOf(syscall.RTF_FLOW), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_INTERFACE": ValueOf(syscall.RTF_INTERFACE), + "RTF_IRTT": ValueOf(syscall.RTF_IRTT), + "RTF_LINKRT": ValueOf(syscall.RTF_LINKRT), + "RTF_LOCAL": ValueOf(uint64(syscall.RTF_LOCAL)), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MSS": ValueOf(syscall.RTF_MSS), + "RTF_MTU": ValueOf(syscall.RTF_MTU), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_NAT": ValueOf(syscall.RTF_NAT), + "RTF_NOFORWARD": ValueOf(syscall.RTF_NOFORWARD), + "RTF_NONEXTHOP": ValueOf(syscall.RTF_NONEXTHOP), + "RTF_NOPMTUDISC": ValueOf(syscall.RTF_NOPMTUDISC), + "RTF_POLICY": ValueOf(syscall.RTF_POLICY), + "RTF_REINSTATE": ValueOf(syscall.RTF_REINSTATE), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_THROW": ValueOf(syscall.RTF_THROW), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WINDOW": ValueOf(syscall.RTF_WINDOW), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_BASE": ValueOf(syscall.RTM_BASE), + "RTM_DELACTION": ValueOf(syscall.RTM_DELACTION), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELADDRLABEL": ValueOf(syscall.RTM_DELADDRLABEL), + "RTM_DELLINK": ValueOf(syscall.RTM_DELLINK), + "RTM_DELNEIGH": ValueOf(syscall.RTM_DELNEIGH), + "RTM_DELQDISC": ValueOf(syscall.RTM_DELQDISC), + "RTM_DELROUTE": ValueOf(syscall.RTM_DELROUTE), + "RTM_DELRULE": ValueOf(syscall.RTM_DELRULE), + "RTM_DELTCLASS": ValueOf(syscall.RTM_DELTCLASS), + "RTM_DELTFILTER": ValueOf(syscall.RTM_DELTFILTER), + "RTM_F_CLONED": ValueOf(syscall.RTM_F_CLONED), + "RTM_F_EQUALIZE": ValueOf(syscall.RTM_F_EQUALIZE), + "RTM_F_NOTIFY": ValueOf(syscall.RTM_F_NOTIFY), + "RTM_F_PREFIX": ValueOf(syscall.RTM_F_PREFIX), + "RTM_GETACTION": ValueOf(syscall.RTM_GETACTION), + "RTM_GETADDR": ValueOf(syscall.RTM_GETADDR), + "RTM_GETADDRLABEL": ValueOf(syscall.RTM_GETADDRLABEL), + "RTM_GETANYCAST": ValueOf(syscall.RTM_GETANYCAST), + "RTM_GETDCB": ValueOf(syscall.RTM_GETDCB), + "RTM_GETLINK": ValueOf(syscall.RTM_GETLINK), + "RTM_GETMULTICAST": ValueOf(syscall.RTM_GETMULTICAST), + "RTM_GETNEIGH": ValueOf(syscall.RTM_GETNEIGH), + "RTM_GETNEIGHTBL": ValueOf(syscall.RTM_GETNEIGHTBL), + "RTM_GETQDISC": ValueOf(syscall.RTM_GETQDISC), + "RTM_GETROUTE": ValueOf(syscall.RTM_GETROUTE), + "RTM_GETRULE": ValueOf(syscall.RTM_GETRULE), + "RTM_GETTCLASS": ValueOf(syscall.RTM_GETTCLASS), + "RTM_GETTFILTER": ValueOf(syscall.RTM_GETTFILTER), + "RTM_MAX": ValueOf(syscall.RTM_MAX), + "RTM_NEWACTION": ValueOf(syscall.RTM_NEWACTION), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWADDRLABEL": ValueOf(syscall.RTM_NEWADDRLABEL), + "RTM_NEWLINK": ValueOf(syscall.RTM_NEWLINK), + "RTM_NEWNDUSEROPT": ValueOf(syscall.RTM_NEWNDUSEROPT), + "RTM_NEWNEIGH": ValueOf(syscall.RTM_NEWNEIGH), + "RTM_NEWNEIGHTBL": ValueOf(syscall.RTM_NEWNEIGHTBL), + "RTM_NEWPREFIX": ValueOf(syscall.RTM_NEWPREFIX), + "RTM_NEWQDISC": ValueOf(syscall.RTM_NEWQDISC), + "RTM_NEWROUTE": ValueOf(syscall.RTM_NEWROUTE), + "RTM_NEWRULE": ValueOf(syscall.RTM_NEWRULE), + "RTM_NEWTCLASS": ValueOf(syscall.RTM_NEWTCLASS), + "RTM_NEWTFILTER": ValueOf(syscall.RTM_NEWTFILTER), + "RTM_NR_FAMILIES": ValueOf(syscall.RTM_NR_FAMILIES), + "RTM_NR_MSGTYPES": ValueOf(syscall.RTM_NR_MSGTYPES), + "RTM_SETDCB": ValueOf(syscall.RTM_SETDCB), + "RTM_SETLINK": ValueOf(syscall.RTM_SETLINK), + "RTM_SETNEIGHTBL": ValueOf(syscall.RTM_SETNEIGHTBL), + "RTNH_ALIGNTO": ValueOf(syscall.RTNH_ALIGNTO), + "RTNH_F_DEAD": ValueOf(syscall.RTNH_F_DEAD), + "RTNH_F_ONLINK": ValueOf(syscall.RTNH_F_ONLINK), + "RTNH_F_PERVASIVE": ValueOf(syscall.RTNH_F_PERVASIVE), + "RTNLGRP_IPV4_IFADDR": ValueOf(syscall.RTNLGRP_IPV4_IFADDR), + "RTNLGRP_IPV4_MROUTE": ValueOf(syscall.RTNLGRP_IPV4_MROUTE), + "RTNLGRP_IPV4_ROUTE": ValueOf(syscall.RTNLGRP_IPV4_ROUTE), + "RTNLGRP_IPV4_RULE": ValueOf(syscall.RTNLGRP_IPV4_RULE), + "RTNLGRP_IPV6_IFADDR": ValueOf(syscall.RTNLGRP_IPV6_IFADDR), + "RTNLGRP_IPV6_IFINFO": ValueOf(syscall.RTNLGRP_IPV6_IFINFO), + "RTNLGRP_IPV6_MROUTE": ValueOf(syscall.RTNLGRP_IPV6_MROUTE), + "RTNLGRP_IPV6_PREFIX": ValueOf(syscall.RTNLGRP_IPV6_PREFIX), + "RTNLGRP_IPV6_ROUTE": ValueOf(syscall.RTNLGRP_IPV6_ROUTE), + "RTNLGRP_IPV6_RULE": ValueOf(syscall.RTNLGRP_IPV6_RULE), + "RTNLGRP_LINK": ValueOf(syscall.RTNLGRP_LINK), + "RTNLGRP_ND_USEROPT": ValueOf(syscall.RTNLGRP_ND_USEROPT), + "RTNLGRP_NEIGH": ValueOf(syscall.RTNLGRP_NEIGH), + "RTNLGRP_NONE": ValueOf(syscall.RTNLGRP_NONE), + "RTNLGRP_NOTIFY": ValueOf(syscall.RTNLGRP_NOTIFY), + "RTNLGRP_TC": ValueOf(syscall.RTNLGRP_TC), + "RTN_ANYCAST": ValueOf(syscall.RTN_ANYCAST), + "RTN_BLACKHOLE": ValueOf(syscall.RTN_BLACKHOLE), + "RTN_BROADCAST": ValueOf(syscall.RTN_BROADCAST), + "RTN_LOCAL": ValueOf(syscall.RTN_LOCAL), + "RTN_MAX": ValueOf(syscall.RTN_MAX), + "RTN_MULTICAST": ValueOf(syscall.RTN_MULTICAST), + "RTN_NAT": ValueOf(syscall.RTN_NAT), + "RTN_PROHIBIT": ValueOf(syscall.RTN_PROHIBIT), + "RTN_THROW": ValueOf(syscall.RTN_THROW), + "RTN_UNICAST": ValueOf(syscall.RTN_UNICAST), + "RTN_UNREACHABLE": ValueOf(syscall.RTN_UNREACHABLE), + "RTN_UNSPEC": ValueOf(syscall.RTN_UNSPEC), + "RTN_XRESOLVE": ValueOf(syscall.RTN_XRESOLVE), + "RTPROT_BIRD": ValueOf(syscall.RTPROT_BIRD), + "RTPROT_BOOT": ValueOf(syscall.RTPROT_BOOT), + "RTPROT_DHCP": ValueOf(syscall.RTPROT_DHCP), + "RTPROT_DNROUTED": ValueOf(syscall.RTPROT_DNROUTED), + "RTPROT_GATED": ValueOf(syscall.RTPROT_GATED), + "RTPROT_KERNEL": ValueOf(syscall.RTPROT_KERNEL), + "RTPROT_MRT": ValueOf(syscall.RTPROT_MRT), + "RTPROT_NTK": ValueOf(syscall.RTPROT_NTK), + "RTPROT_RA": ValueOf(syscall.RTPROT_RA), + "RTPROT_REDIRECT": ValueOf(syscall.RTPROT_REDIRECT), + "RTPROT_STATIC": ValueOf(syscall.RTPROT_STATIC), + "RTPROT_UNSPEC": ValueOf(syscall.RTPROT_UNSPEC), + "RTPROT_XORP": ValueOf(syscall.RTPROT_XORP), + "RTPROT_ZEBRA": ValueOf(syscall.RTPROT_ZEBRA), + "RT_CLASS_DEFAULT": ValueOf(syscall.RT_CLASS_DEFAULT), + "RT_CLASS_LOCAL": ValueOf(syscall.RT_CLASS_LOCAL), + "RT_CLASS_MAIN": ValueOf(syscall.RT_CLASS_MAIN), + "RT_CLASS_MAX": ValueOf(syscall.RT_CLASS_MAX), + "RT_CLASS_UNSPEC": ValueOf(syscall.RT_CLASS_UNSPEC), + "RT_SCOPE_HOST": ValueOf(syscall.RT_SCOPE_HOST), + "RT_SCOPE_LINK": ValueOf(syscall.RT_SCOPE_LINK), + "RT_SCOPE_NOWHERE": ValueOf(syscall.RT_SCOPE_NOWHERE), + "RT_SCOPE_SITE": ValueOf(syscall.RT_SCOPE_SITE), + "RT_SCOPE_UNIVERSE": ValueOf(syscall.RT_SCOPE_UNIVERSE), + "RT_TABLE_COMPAT": ValueOf(syscall.RT_TABLE_COMPAT), + "RT_TABLE_DEFAULT": ValueOf(syscall.RT_TABLE_DEFAULT), + "RT_TABLE_LOCAL": ValueOf(syscall.RT_TABLE_LOCAL), + "RT_TABLE_MAIN": ValueOf(syscall.RT_TABLE_MAIN), + "RT_TABLE_MAX": ValueOf(uint64(syscall.RT_TABLE_MAX)), + "RT_TABLE_UNSPEC": ValueOf(syscall.RT_TABLE_UNSPEC), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Reboot": ValueOf(syscall.Reboot), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Removexattr": ValueOf(syscall.Removexattr), + "Rename": ValueOf(syscall.Rename), + "Renameat": ValueOf(syscall.Renameat), + "Rmdir": ValueOf(syscall.Rmdir), + "SCM_CREDENTIALS": ValueOf(syscall.SCM_CREDENTIALS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMPING": ValueOf(syscall.SCM_TIMESTAMPING), + "SCM_TIMESTAMPNS": ValueOf(syscall.SCM_TIMESTAMPNS), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCLD": ValueOf(syscall.SIGCLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPOLL": ValueOf(syscall.SIGPOLL), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGPWR": ValueOf(syscall.SIGPWR), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTKFLT": ValueOf(syscall.SIGSTKFLT), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGUNUSED": ValueOf(syscall.SIGUNUSED), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDDLCI": ValueOf(syscall.SIOCADDDLCI), + "SIOCADDMULTI": ValueOf(syscall.SIOCADDMULTI), + "SIOCADDRT": ValueOf(syscall.SIOCADDRT), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDARP": ValueOf(syscall.SIOCDARP), + "SIOCDELDLCI": ValueOf(syscall.SIOCDELDLCI), + "SIOCDELMULTI": ValueOf(syscall.SIOCDELMULTI), + "SIOCDELRT": ValueOf(syscall.SIOCDELRT), + "SIOCDEVPRIVATE": ValueOf(syscall.SIOCDEVPRIVATE), + "SIOCDIFADDR": ValueOf(syscall.SIOCDIFADDR), + "SIOCDRARP": ValueOf(syscall.SIOCDRARP), + "SIOCGARP": ValueOf(syscall.SIOCGARP), + "SIOCGIFADDR": ValueOf(syscall.SIOCGIFADDR), + "SIOCGIFBR": ValueOf(syscall.SIOCGIFBR), + "SIOCGIFBRDADDR": ValueOf(syscall.SIOCGIFBRDADDR), + "SIOCGIFCONF": ValueOf(syscall.SIOCGIFCONF), + "SIOCGIFCOUNT": ValueOf(syscall.SIOCGIFCOUNT), + "SIOCGIFDSTADDR": ValueOf(syscall.SIOCGIFDSTADDR), + "SIOCGIFENCAP": ValueOf(syscall.SIOCGIFENCAP), + "SIOCGIFFLAGS": ValueOf(syscall.SIOCGIFFLAGS), + "SIOCGIFHWADDR": ValueOf(syscall.SIOCGIFHWADDR), + "SIOCGIFINDEX": ValueOf(syscall.SIOCGIFINDEX), + "SIOCGIFMAP": ValueOf(syscall.SIOCGIFMAP), + "SIOCGIFMEM": ValueOf(syscall.SIOCGIFMEM), + "SIOCGIFMETRIC": ValueOf(syscall.SIOCGIFMETRIC), + "SIOCGIFMTU": ValueOf(syscall.SIOCGIFMTU), + "SIOCGIFNAME": ValueOf(syscall.SIOCGIFNAME), + "SIOCGIFNETMASK": ValueOf(syscall.SIOCGIFNETMASK), + "SIOCGIFPFLAGS": ValueOf(syscall.SIOCGIFPFLAGS), + "SIOCGIFSLAVE": ValueOf(syscall.SIOCGIFSLAVE), + "SIOCGIFTXQLEN": ValueOf(syscall.SIOCGIFTXQLEN), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGRARP": ValueOf(syscall.SIOCGRARP), + "SIOCGSTAMP": ValueOf(syscall.SIOCGSTAMP), + "SIOCGSTAMPNS": ValueOf(syscall.SIOCGSTAMPNS), + "SIOCPROTOPRIVATE": ValueOf(syscall.SIOCPROTOPRIVATE), + "SIOCRTMSG": ValueOf(syscall.SIOCRTMSG), + "SIOCSARP": ValueOf(syscall.SIOCSARP), + "SIOCSIFADDR": ValueOf(syscall.SIOCSIFADDR), + "SIOCSIFBR": ValueOf(syscall.SIOCSIFBR), + "SIOCSIFBRDADDR": ValueOf(syscall.SIOCSIFBRDADDR), + "SIOCSIFDSTADDR": ValueOf(syscall.SIOCSIFDSTADDR), + "SIOCSIFENCAP": ValueOf(syscall.SIOCSIFENCAP), + "SIOCSIFFLAGS": ValueOf(syscall.SIOCSIFFLAGS), + "SIOCSIFHWADDR": ValueOf(syscall.SIOCSIFHWADDR), + "SIOCSIFHWBROADCAST": ValueOf(syscall.SIOCSIFHWBROADCAST), + "SIOCSIFLINK": ValueOf(syscall.SIOCSIFLINK), + "SIOCSIFMAP": ValueOf(syscall.SIOCSIFMAP), + "SIOCSIFMEM": ValueOf(syscall.SIOCSIFMEM), + "SIOCSIFMETRIC": ValueOf(syscall.SIOCSIFMETRIC), + "SIOCSIFMTU": ValueOf(syscall.SIOCSIFMTU), + "SIOCSIFNAME": ValueOf(syscall.SIOCSIFNAME), + "SIOCSIFNETMASK": ValueOf(syscall.SIOCSIFNETMASK), + "SIOCSIFPFLAGS": ValueOf(syscall.SIOCSIFPFLAGS), + "SIOCSIFSLAVE": ValueOf(syscall.SIOCSIFSLAVE), + "SIOCSIFTXQLEN": ValueOf(syscall.SIOCSIFTXQLEN), + "SIOCSPGRP": ValueOf(syscall.SIOCSPGRP), + "SIOCSRARP": ValueOf(syscall.SIOCSRARP), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DCCP": ValueOf(syscall.SOCK_DCCP), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_PACKET": ValueOf(syscall.SOCK_PACKET), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_AAL": ValueOf(syscall.SOL_AAL), + "SOL_ATM": ValueOf(syscall.SOL_ATM), + "SOL_DECNET": ValueOf(syscall.SOL_DECNET), + "SOL_ICMPV6": ValueOf(syscall.SOL_ICMPV6), + "SOL_IP": ValueOf(syscall.SOL_IP), + "SOL_IPV6": ValueOf(syscall.SOL_IPV6), + "SOL_IRDA": ValueOf(syscall.SOL_IRDA), + "SOL_PACKET": ValueOf(syscall.SOL_PACKET), + "SOL_RAW": ValueOf(syscall.SOL_RAW), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOL_TCP": ValueOf(syscall.SOL_TCP), + "SOL_X25": ValueOf(syscall.SOL_X25), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ATTACH_FILTER": ValueOf(syscall.SO_ATTACH_FILTER), + "SO_BINDTODEVICE": ValueOf(syscall.SO_BINDTODEVICE), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_BSDCOMPAT": ValueOf(syscall.SO_BSDCOMPAT), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DETACH_FILTER": ValueOf(syscall.SO_DETACH_FILTER), + "SO_DOMAIN": ValueOf(syscall.SO_DOMAIN), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_MARK": ValueOf(syscall.SO_MARK), + "SO_NO_CHECK": ValueOf(syscall.SO_NO_CHECK), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PASSCRED": ValueOf(syscall.SO_PASSCRED), + "SO_PASSSEC": ValueOf(syscall.SO_PASSSEC), + "SO_PEERCRED": ValueOf(syscall.SO_PEERCRED), + "SO_PEERNAME": ValueOf(syscall.SO_PEERNAME), + "SO_PEERSEC": ValueOf(syscall.SO_PEERSEC), + "SO_PRIORITY": ValueOf(syscall.SO_PRIORITY), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVBUFFORCE": ValueOf(syscall.SO_RCVBUFFORCE), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_RXQ_OVFL": ValueOf(syscall.SO_RXQ_OVFL), + "SO_SECURITY_AUTHENTICATION": ValueOf(syscall.SO_SECURITY_AUTHENTICATION), + "SO_SECURITY_ENCRYPTION_NETWORK": ValueOf(syscall.SO_SECURITY_ENCRYPTION_NETWORK), + "SO_SECURITY_ENCRYPTION_TRANSPORT": ValueOf(syscall.SO_SECURITY_ENCRYPTION_TRANSPORT), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDBUFFORCE": ValueOf(syscall.SO_SNDBUFFORCE), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMPING": ValueOf(syscall.SO_TIMESTAMPING), + "SO_TIMESTAMPNS": ValueOf(syscall.SO_TIMESTAMPNS), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT4": ValueOf(syscall.SYS_ACCEPT4), + "SYS_ACCESS": ValueOf(syscall.SYS_ACCESS), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_KEY": ValueOf(syscall.SYS_ADD_KEY), + "SYS_ADJTIMEX": ValueOf(syscall.SYS_ADJTIMEX), + "SYS_ALARM": ValueOf(syscall.SYS_ALARM), + "SYS_ARM_FADVISE64_64": ValueOf(syscall.SYS_ARM_FADVISE64_64), + "SYS_ARM_SYNC_FILE_RANGE": ValueOf(syscall.SYS_ARM_SYNC_FILE_RANGE), + "SYS_BDFLUSH": ValueOf(syscall.SYS_BDFLUSH), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BRK": ValueOf(syscall.SYS_BRK), + "SYS_CAPGET": ValueOf(syscall.SYS_CAPGET), + "SYS_CAPSET": ValueOf(syscall.SYS_CAPSET), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHMOD": ValueOf(syscall.SYS_CHMOD), + "SYS_CHOWN": ValueOf(syscall.SYS_CHOWN), + "SYS_CHOWN32": ValueOf(syscall.SYS_CHOWN32), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_ADJTIME": ValueOf(syscall.SYS_CLOCK_ADJTIME), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_NANOSLEEP": ValueOf(syscall.SYS_CLOCK_NANOSLEEP), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLONE": ValueOf(syscall.SYS_CLONE), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_CREAT": ValueOf(syscall.SYS_CREAT), + "SYS_DELETE_MODULE": ValueOf(syscall.SYS_DELETE_MODULE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP2": ValueOf(syscall.SYS_DUP2), + "SYS_DUP3": ValueOf(syscall.SYS_DUP3), + "SYS_EPOLL_CREATE": ValueOf(syscall.SYS_EPOLL_CREATE), + "SYS_EPOLL_CREATE1": ValueOf(syscall.SYS_EPOLL_CREATE1), + "SYS_EPOLL_CTL": ValueOf(syscall.SYS_EPOLL_CTL), + "SYS_EPOLL_PWAIT": ValueOf(syscall.SYS_EPOLL_PWAIT), + "SYS_EPOLL_WAIT": ValueOf(syscall.SYS_EPOLL_WAIT), + "SYS_EVENTFD": ValueOf(syscall.SYS_EVENTFD), + "SYS_EVENTFD2": ValueOf(syscall.SYS_EVENTFD2), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXIT_GROUP": ValueOf(syscall.SYS_EXIT_GROUP), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FALLOCATE": ValueOf(syscall.SYS_FALLOCATE), + "SYS_FANOTIFY_INIT": ValueOf(syscall.SYS_FANOTIFY_INIT), + "SYS_FANOTIFY_MARK": ValueOf(syscall.SYS_FANOTIFY_MARK), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWN32": ValueOf(syscall.SYS_FCHOWN32), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FCNTL64": ValueOf(syscall.SYS_FCNTL64), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FORK": ValueOf(syscall.SYS_FORK), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTAT64": ValueOf(syscall.SYS_FSTAT64), + "SYS_FSTATAT64": ValueOf(syscall.SYS_FSTATAT64), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSTATFS64": ValueOf(syscall.SYS_FSTATFS64), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FTRUNCATE64": ValueOf(syscall.SYS_FTRUNCATE64), + "SYS_FUTEX": ValueOf(syscall.SYS_FUTEX), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETCPU": ValueOf(syscall.SYS_GETCPU), + "SYS_GETCWD": ValueOf(syscall.SYS_GETCWD), + "SYS_GETDENTS": ValueOf(syscall.SYS_GETDENTS), + "SYS_GETDENTS64": ValueOf(syscall.SYS_GETDENTS64), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEGID32": ValueOf(syscall.SYS_GETEGID32), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETEUID32": ValueOf(syscall.SYS_GETEUID32), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGID32": ValueOf(syscall.SYS_GETGID32), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETGROUPS32": ValueOf(syscall.SYS_GETGROUPS32), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESGID32": ValueOf(syscall.SYS_GETRESGID32), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRESUID32": ValueOf(syscall.SYS_GETRESUID32), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETUID32": ValueOf(syscall.SYS_GETUID32), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_GET_MEMPOLICY": ValueOf(syscall.SYS_GET_MEMPOLICY), + "SYS_GET_ROBUST_LIST": ValueOf(syscall.SYS_GET_ROBUST_LIST), + "SYS_INIT_MODULE": ValueOf(syscall.SYS_INIT_MODULE), + "SYS_INOTIFY_ADD_WATCH": ValueOf(syscall.SYS_INOTIFY_ADD_WATCH), + "SYS_INOTIFY_INIT": ValueOf(syscall.SYS_INOTIFY_INIT), + "SYS_INOTIFY_INIT1": ValueOf(syscall.SYS_INOTIFY_INIT1), + "SYS_INOTIFY_RM_WATCH": ValueOf(syscall.SYS_INOTIFY_RM_WATCH), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPRIO_GET": ValueOf(syscall.SYS_IOPRIO_GET), + "SYS_IOPRIO_SET": ValueOf(syscall.SYS_IOPRIO_SET), + "SYS_IO_CANCEL": ValueOf(syscall.SYS_IO_CANCEL), + "SYS_IO_DESTROY": ValueOf(syscall.SYS_IO_DESTROY), + "SYS_IO_GETEVENTS": ValueOf(syscall.SYS_IO_GETEVENTS), + "SYS_IO_SETUP": ValueOf(syscall.SYS_IO_SETUP), + "SYS_IO_SUBMIT": ValueOf(syscall.SYS_IO_SUBMIT), + "SYS_IPC": ValueOf(syscall.SYS_IPC), + "SYS_KEXEC_LOAD": ValueOf(syscall.SYS_KEXEC_LOAD), + "SYS_KEYCTL": ValueOf(syscall.SYS_KEYCTL), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LCHOWN32": ValueOf(syscall.SYS_LCHOWN32), + "SYS_LGETXATTR": ValueOf(syscall.SYS_LGETXATTR), + "SYS_LINK": ValueOf(syscall.SYS_LINK), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LLISTXATTR": ValueOf(syscall.SYS_LLISTXATTR), + "SYS_LOOKUP_DCOOKIE": ValueOf(syscall.SYS_LOOKUP_DCOOKIE), + "SYS_LREMOVEXATTR": ValueOf(syscall.SYS_LREMOVEXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSETXATTR": ValueOf(syscall.SYS_LSETXATTR), + "SYS_LSTAT": ValueOf(syscall.SYS_LSTAT), + "SYS_LSTAT64": ValueOf(syscall.SYS_LSTAT64), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MBIND": ValueOf(syscall.SYS_MBIND), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MKDIR": ValueOf(syscall.SYS_MKDIR), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKNOD": ValueOf(syscall.SYS_MKNOD), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MMAP2": ValueOf(syscall.SYS_MMAP2), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MOVE_PAGES": ValueOf(syscall.SYS_MOVE_PAGES), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MQ_GETSETATTR": ValueOf(syscall.SYS_MQ_GETSETATTR), + "SYS_MQ_NOTIFY": ValueOf(syscall.SYS_MQ_NOTIFY), + "SYS_MQ_OPEN": ValueOf(syscall.SYS_MQ_OPEN), + "SYS_MQ_TIMEDRECEIVE": ValueOf(syscall.SYS_MQ_TIMEDRECEIVE), + "SYS_MQ_TIMEDSEND": ValueOf(syscall.SYS_MQ_TIMEDSEND), + "SYS_MQ_UNLINK": ValueOf(syscall.SYS_MQ_UNLINK), + "SYS_MREMAP": ValueOf(syscall.SYS_MREMAP), + "SYS_MSGCTL": ValueOf(syscall.SYS_MSGCTL), + "SYS_MSGGET": ValueOf(syscall.SYS_MSGGET), + "SYS_MSGRCV": ValueOf(syscall.SYS_MSGRCV), + "SYS_MSGSND": ValueOf(syscall.SYS_MSGSND), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NAME_TO_HANDLE_AT": ValueOf(syscall.SYS_NAME_TO_HANDLE_AT), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NFSSERVCTL": ValueOf(syscall.SYS_NFSSERVCTL), + "SYS_NICE": ValueOf(syscall.SYS_NICE), + "SYS_OABI_SYSCALL_BASE": ValueOf(syscall.SYS_OABI_SYSCALL_BASE), + "SYS_OPEN": ValueOf(syscall.SYS_OPEN), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_OPEN_BY_HANDLE_AT": ValueOf(syscall.SYS_OPEN_BY_HANDLE_AT), + "SYS_PAUSE": ValueOf(syscall.SYS_PAUSE), + "SYS_PCICONFIG_IOBASE": ValueOf(syscall.SYS_PCICONFIG_IOBASE), + "SYS_PCICONFIG_READ": ValueOf(syscall.SYS_PCICONFIG_READ), + "SYS_PCICONFIG_WRITE": ValueOf(syscall.SYS_PCICONFIG_WRITE), + "SYS_PERF_EVENT_OPEN": ValueOf(syscall.SYS_PERF_EVENT_OPEN), + "SYS_PERSONALITY": ValueOf(syscall.SYS_PERSONALITY), + "SYS_PIPE": ValueOf(syscall.SYS_PIPE), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_PIVOT_ROOT": ValueOf(syscall.SYS_PIVOT_ROOT), + "SYS_POLL": ValueOf(syscall.SYS_POLL), + "SYS_PPOLL": ValueOf(syscall.SYS_PPOLL), + "SYS_PRCTL": ValueOf(syscall.SYS_PRCTL), + "SYS_PREAD64": ValueOf(syscall.SYS_PREAD64), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PRLIMIT64": ValueOf(syscall.SYS_PRLIMIT64), + "SYS_PROCESS_VM_READV": ValueOf(syscall.SYS_PROCESS_VM_READV), + "SYS_PROCESS_VM_WRITEV": ValueOf(syscall.SYS_PROCESS_VM_WRITEV), + "SYS_PSELECT6": ValueOf(syscall.SYS_PSELECT6), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE64": ValueOf(syscall.SYS_PWRITE64), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READAHEAD": ValueOf(syscall.SYS_READAHEAD), + "SYS_READDIR": ValueOf(syscall.SYS_READDIR), + "SYS_READLINK": ValueOf(syscall.SYS_READLINK), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECV": ValueOf(syscall.SYS_RECV), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVMMSG": ValueOf(syscall.SYS_RECVMMSG), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_REMAP_FILE_PAGES": ValueOf(syscall.SYS_REMAP_FILE_PAGES), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAME": ValueOf(syscall.SYS_RENAME), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_REQUEST_KEY": ValueOf(syscall.SYS_REQUEST_KEY), + "SYS_RESTART_SYSCALL": ValueOf(syscall.SYS_RESTART_SYSCALL), + "SYS_RMDIR": ValueOf(syscall.SYS_RMDIR), + "SYS_RT_SIGACTION": ValueOf(syscall.SYS_RT_SIGACTION), + "SYS_RT_SIGPENDING": ValueOf(syscall.SYS_RT_SIGPENDING), + "SYS_RT_SIGPROCMASK": ValueOf(syscall.SYS_RT_SIGPROCMASK), + "SYS_RT_SIGQUEUEINFO": ValueOf(syscall.SYS_RT_SIGQUEUEINFO), + "SYS_RT_SIGRETURN": ValueOf(syscall.SYS_RT_SIGRETURN), + "SYS_RT_SIGSUSPEND": ValueOf(syscall.SYS_RT_SIGSUSPEND), + "SYS_RT_SIGTIMEDWAIT": ValueOf(syscall.SYS_RT_SIGTIMEDWAIT), + "SYS_RT_TGSIGQUEUEINFO": ValueOf(syscall.SYS_RT_TGSIGQUEUEINFO), + "SYS_SCHED_GETAFFINITY": ValueOf(syscall.SYS_SCHED_GETAFFINITY), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETAFFINITY": ValueOf(syscall.SYS_SCHED_SETAFFINITY), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SELECT": ValueOf(syscall.SYS_SELECT), + "SYS_SEMCTL": ValueOf(syscall.SYS_SEMCTL), + "SYS_SEMGET": ValueOf(syscall.SYS_SEMGET), + "SYS_SEMOP": ValueOf(syscall.SYS_SEMOP), + "SYS_SEMTIMEDOP": ValueOf(syscall.SYS_SEMTIMEDOP), + "SYS_SEND": ValueOf(syscall.SYS_SEND), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDFILE64": ValueOf(syscall.SYS_SENDFILE64), + "SYS_SENDMMSG": ValueOf(syscall.SYS_SENDMMSG), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SETDOMAINNAME": ValueOf(syscall.SYS_SETDOMAINNAME), + "SYS_SETFSGID": ValueOf(syscall.SYS_SETFSGID), + "SYS_SETFSGID32": ValueOf(syscall.SYS_SETFSGID32), + "SYS_SETFSUID": ValueOf(syscall.SYS_SETFSUID), + "SYS_SETFSUID32": ValueOf(syscall.SYS_SETFSUID32), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGID32": ValueOf(syscall.SYS_SETGID32), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETGROUPS32": ValueOf(syscall.SYS_SETGROUPS32), + "SYS_SETHOSTNAME": ValueOf(syscall.SYS_SETHOSTNAME), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETNS": ValueOf(syscall.SYS_SETNS), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETREGID32": ValueOf(syscall.SYS_SETREGID32), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESGID32": ValueOf(syscall.SYS_SETRESGID32), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETRESUID32": ValueOf(syscall.SYS_SETRESUID32), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETREUID32": ValueOf(syscall.SYS_SETREUID32), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETUID32": ValueOf(syscall.SYS_SETUID32), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SET_MEMPOLICY": ValueOf(syscall.SYS_SET_MEMPOLICY), + "SYS_SET_ROBUST_LIST": ValueOf(syscall.SYS_SET_ROBUST_LIST), + "SYS_SET_TID_ADDRESS": ValueOf(syscall.SYS_SET_TID_ADDRESS), + "SYS_SHMAT": ValueOf(syscall.SYS_SHMAT), + "SYS_SHMCTL": ValueOf(syscall.SYS_SHMCTL), + "SYS_SHMDT": ValueOf(syscall.SYS_SHMDT), + "SYS_SHMGET": ValueOf(syscall.SYS_SHMGET), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGACTION": ValueOf(syscall.SYS_SIGACTION), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGNALFD": ValueOf(syscall.SYS_SIGNALFD), + "SYS_SIGNALFD4": ValueOf(syscall.SYS_SIGNALFD4), + "SYS_SIGPENDING": ValueOf(syscall.SYS_SIGPENDING), + "SYS_SIGPROCMASK": ValueOf(syscall.SYS_SIGPROCMASK), + "SYS_SIGRETURN": ValueOf(syscall.SYS_SIGRETURN), + "SYS_SIGSUSPEND": ValueOf(syscall.SYS_SIGSUSPEND), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETCALL": ValueOf(syscall.SYS_SOCKETCALL), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_SPLICE": ValueOf(syscall.SYS_SPLICE), + "SYS_STAT": ValueOf(syscall.SYS_STAT), + "SYS_STAT64": ValueOf(syscall.SYS_STAT64), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_STATFS64": ValueOf(syscall.SYS_STATFS64), + "SYS_STIME": ValueOf(syscall.SYS_STIME), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINK": ValueOf(syscall.SYS_SYMLINK), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYNCFS": ValueOf(syscall.SYS_SYNCFS), + "SYS_SYSCALL": ValueOf(syscall.SYS_SYSCALL), + "SYS_SYSCALL_BASE": ValueOf(syscall.SYS_SYSCALL_BASE), + "SYS_SYSFS": ValueOf(syscall.SYS_SYSFS), + "SYS_SYSINFO": ValueOf(syscall.SYS_SYSINFO), + "SYS_SYSLOG": ValueOf(syscall.SYS_SYSLOG), + "SYS_TEE": ValueOf(syscall.SYS_TEE), + "SYS_TGKILL": ValueOf(syscall.SYS_TGKILL), + "SYS_TIME": ValueOf(syscall.SYS_TIME), + "SYS_TIMERFD_CREATE": ValueOf(syscall.SYS_TIMERFD_CREATE), + "SYS_TIMERFD_GETTIME": ValueOf(syscall.SYS_TIMERFD_GETTIME), + "SYS_TIMERFD_SETTIME": ValueOf(syscall.SYS_TIMERFD_SETTIME), + "SYS_TIMER_CREATE": ValueOf(syscall.SYS_TIMER_CREATE), + "SYS_TIMER_DELETE": ValueOf(syscall.SYS_TIMER_DELETE), + "SYS_TIMER_GETOVERRUN": ValueOf(syscall.SYS_TIMER_GETOVERRUN), + "SYS_TIMER_GETTIME": ValueOf(syscall.SYS_TIMER_GETTIME), + "SYS_TIMER_SETTIME": ValueOf(syscall.SYS_TIMER_SETTIME), + "SYS_TIMES": ValueOf(syscall.SYS_TIMES), + "SYS_TKILL": ValueOf(syscall.SYS_TKILL), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_TRUNCATE64": ValueOf(syscall.SYS_TRUNCATE64), + "SYS_UGETRLIMIT": ValueOf(syscall.SYS_UGETRLIMIT), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMOUNT": ValueOf(syscall.SYS_UMOUNT), + "SYS_UMOUNT2": ValueOf(syscall.SYS_UMOUNT2), + "SYS_UNAME": ValueOf(syscall.SYS_UNAME), + "SYS_UNLINK": ValueOf(syscall.SYS_UNLINK), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNSHARE": ValueOf(syscall.SYS_UNSHARE), + "SYS_USELIB": ValueOf(syscall.SYS_USELIB), + "SYS_USTAT": ValueOf(syscall.SYS_USTAT), + "SYS_UTIME": ValueOf(syscall.SYS_UTIME), + "SYS_UTIMENSAT": ValueOf(syscall.SYS_UTIMENSAT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VFORK": ValueOf(syscall.SYS_VFORK), + "SYS_VHANGUP": ValueOf(syscall.SYS_VHANGUP), + "SYS_VMSPLICE": ValueOf(syscall.SYS_VMSPLICE), + "SYS_VSERVER": ValueOf(syscall.SYS_VSERVER), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "SYS__LLSEEK": ValueOf(syscall.SYS__LLSEEK), + "SYS__NEWSELECT": ValueOf(syscall.SYS__NEWSELECT), + "SYS__SYSCTL": ValueOf(syscall.SYS__SYSCTL), + "S_BLKSIZE": ValueOf(syscall.S_BLKSIZE), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetLsfPromisc": ValueOf(syscall.SetLsfPromisc), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setdomainname": ValueOf(syscall.Setdomainname), + "Setenv": ValueOf(syscall.Setenv), + "Setfsgid": ValueOf(syscall.Setfsgid), + "Setfsuid": ValueOf(syscall.Setfsuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Sethostname": ValueOf(syscall.Sethostname), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setresgid": ValueOf(syscall.Setresgid), + "Setresuid": ValueOf(syscall.Setresuid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Setxattr": ValueOf(syscall.Setxattr), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAddrmsg": ValueOf(syscall.SizeofIfAddrmsg), + "SizeofIfInfomsg": ValueOf(syscall.SizeofIfInfomsg), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofInotifyEvent": ValueOf(syscall.SizeofInotifyEvent), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofNlAttr": ValueOf(syscall.SizeofNlAttr), + "SizeofNlMsgerr": ValueOf(syscall.SizeofNlMsgerr), + "SizeofNlMsghdr": ValueOf(syscall.SizeofNlMsghdr), + "SizeofRtAttr": ValueOf(syscall.SizeofRtAttr), + "SizeofRtGenmsg": ValueOf(syscall.SizeofRtGenmsg), + "SizeofRtMsg": ValueOf(syscall.SizeofRtMsg), + "SizeofRtNexthop": ValueOf(syscall.SizeofRtNexthop), + "SizeofSockFilter": ValueOf(syscall.SizeofSockFilter), + "SizeofSockFprog": ValueOf(syscall.SizeofSockFprog), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrLinklayer": ValueOf(syscall.SizeofSockaddrLinklayer), + "SizeofSockaddrNetlink": ValueOf(syscall.SizeofSockaddrNetlink), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SizeofTCPInfo": ValueOf(syscall.SizeofTCPInfo), + "SizeofUcred": ValueOf(syscall.SizeofUcred), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "Splice": ValueOf(syscall.Splice), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Sysinfo": ValueOf(syscall.Sysinfo), + "TCGETS": ValueOf(syscall.TCGETS), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_CORK": ValueOf(syscall.TCP_CORK), + "TCP_DEFER_ACCEPT": ValueOf(syscall.TCP_DEFER_ACCEPT), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_LINGER2": ValueOf(syscall.TCP_LINGER2), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MD5SIG_MAXKEYLEN": ValueOf(syscall.TCP_MD5SIG_MAXKEYLEN), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_QUICKACK": ValueOf(syscall.TCP_QUICKACK), + "TCP_SYNCNT": ValueOf(syscall.TCP_SYNCNT), + "TCP_WINDOW_CLAMP": ValueOf(syscall.TCP_WINDOW_CLAMP), + "TCSETS": ValueOf(syscall.TCSETS), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCONS": ValueOf(syscall.TIOCCONS), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCGDEV": ValueOf(uint64(syscall.TIOCGDEV)), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGICOUNT": ValueOf(syscall.TIOCGICOUNT), + "TIOCGLCKTRMIOS": ValueOf(syscall.TIOCGLCKTRMIOS), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPTN": ValueOf(uint64(syscall.TIOCGPTN)), + "TIOCGRS485": ValueOf(syscall.TIOCGRS485), + "TIOCGSERIAL": ValueOf(syscall.TIOCGSERIAL), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGSOFTCAR": ValueOf(syscall.TIOCGSOFTCAR), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCINQ": ValueOf(syscall.TIOCINQ), + "TIOCLINUX": ValueOf(syscall.TIOCLINUX), + "TIOCMBIC": ValueOf(syscall.TIOCMBIC), + "TIOCMBIS": ValueOf(syscall.TIOCMBIS), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMIWAIT": ValueOf(syscall.TIOCMIWAIT), + "TIOCMSET": ValueOf(syscall.TIOCMSET), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(syscall.TIOCPKT), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSERCONFIG": ValueOf(syscall.TIOCSERCONFIG), + "TIOCSERGETLSR": ValueOf(syscall.TIOCSERGETLSR), + "TIOCSERGETMULTI": ValueOf(syscall.TIOCSERGETMULTI), + "TIOCSERGSTRUCT": ValueOf(syscall.TIOCSERGSTRUCT), + "TIOCSERGWILD": ValueOf(syscall.TIOCSERGWILD), + "TIOCSERSETMULTI": ValueOf(syscall.TIOCSERSETMULTI), + "TIOCSERSWILD": ValueOf(syscall.TIOCSERSWILD), + "TIOCSER_TEMT": ValueOf(syscall.TIOCSER_TEMT), + "TIOCSETD": ValueOf(syscall.TIOCSETD), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSLCKTRMIOS": ValueOf(syscall.TIOCSLCKTRMIOS), + "TIOCSPGRP": ValueOf(syscall.TIOCSPGRP), + "TIOCSPTLCK": ValueOf(syscall.TIOCSPTLCK), + "TIOCSRS485": ValueOf(syscall.TIOCSRS485), + "TIOCSSERIAL": ValueOf(syscall.TIOCSSERIAL), + "TIOCSSOFTCAR": ValueOf(syscall.TIOCSSOFTCAR), + "TIOCSTI": ValueOf(syscall.TIOCSTI), + "TIOCSWINSZ": ValueOf(syscall.TIOCSWINSZ), + "TIOCVHANGUP": ValueOf(syscall.TIOCVHANGUP), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TUNATTACHFILTER": ValueOf(syscall.TUNATTACHFILTER), + "TUNDETACHFILTER": ValueOf(syscall.TUNDETACHFILTER), + "TUNGETFEATURES": ValueOf(uint64(syscall.TUNGETFEATURES)), + "TUNGETIFF": ValueOf(uint64(syscall.TUNGETIFF)), + "TUNGETSNDBUF": ValueOf(uint64(syscall.TUNGETSNDBUF)), + "TUNGETVNETHDRSZ": ValueOf(uint64(syscall.TUNGETVNETHDRSZ)), + "TUNSETDEBUG": ValueOf(syscall.TUNSETDEBUG), + "TUNSETGROUP": ValueOf(syscall.TUNSETGROUP), + "TUNSETIFF": ValueOf(syscall.TUNSETIFF), + "TUNSETLINK": ValueOf(syscall.TUNSETLINK), + "TUNSETNOCSUM": ValueOf(syscall.TUNSETNOCSUM), + "TUNSETOFFLOAD": ValueOf(syscall.TUNSETOFFLOAD), + "TUNSETOWNER": ValueOf(syscall.TUNSETOWNER), + "TUNSETPERSIST": ValueOf(syscall.TUNSETPERSIST), + "TUNSETSNDBUF": ValueOf(syscall.TUNSETSNDBUF), + "TUNSETTXFILTER": ValueOf(syscall.TUNSETTXFILTER), + "TUNSETVNETHDRSZ": ValueOf(syscall.TUNSETVNETHDRSZ), + "Tee": ValueOf(syscall.Tee), + "Tgkill": ValueOf(syscall.Tgkill), + "Time": ValueOf(syscall.Time), + "Times": ValueOf(syscall.Times), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Uname": ValueOf(syscall.Uname), + "UnixCredentials": ValueOf(syscall.UnixCredentials), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unlinkat": ValueOf(syscall.Unlinkat), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Unshare": ValueOf(syscall.Unshare), + "Ustat": ValueOf(syscall.Ustat), + "Utime": ValueOf(syscall.Utime), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VSWTC": ValueOf(syscall.VSWTC), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WALL": ValueOf(syscall.WALL), + "WCLONE": ValueOf(uint64(syscall.WCLONE)), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOTHREAD": ValueOf(syscall.WNOTHREAD), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + "XCASE": ValueOf(syscall.XCASE), + }, + Types: map[string]Type{ + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "EpollEvent": TypeOf((*syscall.EpollEvent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAddrmsg": TypeOf((*syscall.IfAddrmsg)(nil)).Elem(), + "IfInfomsg": TypeOf((*syscall.IfInfomsg)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InotifyEvent": TypeOf((*syscall.InotifyEvent)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "NetlinkMessage": TypeOf((*syscall.NetlinkMessage)(nil)).Elem(), + "NetlinkRouteAttr": TypeOf((*syscall.NetlinkRouteAttr)(nil)).Elem(), + "NetlinkRouteRequest": TypeOf((*syscall.NetlinkRouteRequest)(nil)).Elem(), + "NlAttr": TypeOf((*syscall.NlAttr)(nil)).Elem(), + "NlMsgerr": TypeOf((*syscall.NlMsgerr)(nil)).Elem(), + "NlMsghdr": TypeOf((*syscall.NlMsghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "PtraceRegs": TypeOf((*syscall.PtraceRegs)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrLinklayer": TypeOf((*syscall.RawSockaddrLinklayer)(nil)).Elem(), + "RawSockaddrNetlink": TypeOf((*syscall.RawSockaddrNetlink)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RtAttr": TypeOf((*syscall.RtAttr)(nil)).Elem(), + "RtGenmsg": TypeOf((*syscall.RtGenmsg)(nil)).Elem(), + "RtMsg": TypeOf((*syscall.RtMsg)(nil)).Elem(), + "RtNexthop": TypeOf((*syscall.RtNexthop)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "SockFilter": TypeOf((*syscall.SockFilter)(nil)).Elem(), + "SockFprog": TypeOf((*syscall.SockFprog)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrLinklayer": TypeOf((*syscall.SockaddrLinklayer)(nil)).Elem(), + "SockaddrNetlink": TypeOf((*syscall.SockaddrNetlink)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "SysProcIDMap": TypeOf((*syscall.SysProcIDMap)(nil)).Elem(), + "Sysinfo_t": TypeOf((*syscall.Sysinfo_t)(nil)).Elem(), + "TCPInfo": TypeOf((*syscall.TCPInfo)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Time_t": TypeOf((*syscall.Time_t)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timex": TypeOf((*syscall.Timex)(nil)).Elem(), + "Tms": TypeOf((*syscall.Tms)(nil)).Elem(), + "Ucred": TypeOf((*syscall.Ucred)(nil)).Elem(), + "Ustat_t": TypeOf((*syscall.Ustat_t)(nil)).Elem(), + "Utimbuf": TypeOf((*syscall.Utimbuf)(nil)).Elem(), + "Utsname": TypeOf((*syscall.Utsname)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + }, + Proxies: map[string]Type{ + } } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm64.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm64.go new file mode 100644 index 0000000..db59c95 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_linux_arm64.go @@ -0,0 +1,4213 @@ +// +build !gccgo + +// this file was generated by gomacro command: import _b "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +// reflection: allow interpreted code to import "syscall" +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_ALG": ValueOf(syscall.AF_ALG), + "AF_APPLETALK": ValueOf(syscall.AF_APPLETALK), + "AF_ASH": ValueOf(syscall.AF_ASH), + "AF_ATMPVC": ValueOf(syscall.AF_ATMPVC), + "AF_ATMSVC": ValueOf(syscall.AF_ATMSVC), + "AF_AX25": ValueOf(syscall.AF_AX25), + "AF_BLUETOOTH": ValueOf(syscall.AF_BLUETOOTH), + "AF_BRIDGE": ValueOf(syscall.AF_BRIDGE), + "AF_CAIF": ValueOf(syscall.AF_CAIF), + "AF_CAN": ValueOf(syscall.AF_CAN), + "AF_DECnet": ValueOf(syscall.AF_DECnet), + "AF_ECONET": ValueOf(syscall.AF_ECONET), + "AF_FILE": ValueOf(syscall.AF_FILE), + "AF_IEEE802154": ValueOf(syscall.AF_IEEE802154), + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_IPX": ValueOf(syscall.AF_IPX), + "AF_IRDA": ValueOf(syscall.AF_IRDA), + "AF_ISDN": ValueOf(syscall.AF_ISDN), + "AF_IUCV": ValueOf(syscall.AF_IUCV), + "AF_KEY": ValueOf(syscall.AF_KEY), + "AF_LLC": ValueOf(syscall.AF_LLC), + "AF_LOCAL": ValueOf(syscall.AF_LOCAL), + "AF_MAX": ValueOf(syscall.AF_MAX), + "AF_NETBEUI": ValueOf(syscall.AF_NETBEUI), + "AF_NETLINK": ValueOf(syscall.AF_NETLINK), + "AF_NETROM": ValueOf(syscall.AF_NETROM), + "AF_NFC": ValueOf(syscall.AF_NFC), + "AF_PACKET": ValueOf(syscall.AF_PACKET), + "AF_PHONET": ValueOf(syscall.AF_PHONET), + "AF_PPPOX": ValueOf(syscall.AF_PPPOX), + "AF_RDS": ValueOf(syscall.AF_RDS), + "AF_ROSE": ValueOf(syscall.AF_ROSE), + "AF_ROUTE": ValueOf(syscall.AF_ROUTE), + "AF_RXRPC": ValueOf(syscall.AF_RXRPC), + "AF_SECURITY": ValueOf(syscall.AF_SECURITY), + "AF_SNA": ValueOf(syscall.AF_SNA), + "AF_TIPC": ValueOf(syscall.AF_TIPC), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AF_VSOCK": ValueOf(syscall.AF_VSOCK), + "AF_WANPIPE": ValueOf(syscall.AF_WANPIPE), + "AF_X25": ValueOf(syscall.AF_X25), + "ARPHRD_ADAPT": ValueOf(syscall.ARPHRD_ADAPT), + "ARPHRD_APPLETLK": ValueOf(syscall.ARPHRD_APPLETLK), + "ARPHRD_ARCNET": ValueOf(syscall.ARPHRD_ARCNET), + "ARPHRD_ASH": ValueOf(syscall.ARPHRD_ASH), + "ARPHRD_ATM": ValueOf(syscall.ARPHRD_ATM), + "ARPHRD_AX25": ValueOf(syscall.ARPHRD_AX25), + "ARPHRD_BIF": ValueOf(syscall.ARPHRD_BIF), + "ARPHRD_CAIF": ValueOf(syscall.ARPHRD_CAIF), + "ARPHRD_CAN": ValueOf(syscall.ARPHRD_CAN), + "ARPHRD_CHAOS": ValueOf(syscall.ARPHRD_CHAOS), + "ARPHRD_CISCO": ValueOf(syscall.ARPHRD_CISCO), + "ARPHRD_CSLIP": ValueOf(syscall.ARPHRD_CSLIP), + "ARPHRD_CSLIP6": ValueOf(syscall.ARPHRD_CSLIP6), + "ARPHRD_DDCMP": ValueOf(syscall.ARPHRD_DDCMP), + "ARPHRD_DLCI": ValueOf(syscall.ARPHRD_DLCI), + "ARPHRD_ECONET": ValueOf(syscall.ARPHRD_ECONET), + "ARPHRD_EETHER": ValueOf(syscall.ARPHRD_EETHER), + "ARPHRD_ETHER": ValueOf(syscall.ARPHRD_ETHER), + "ARPHRD_EUI64": ValueOf(syscall.ARPHRD_EUI64), + "ARPHRD_FCAL": ValueOf(syscall.ARPHRD_FCAL), + "ARPHRD_FCFABRIC": ValueOf(syscall.ARPHRD_FCFABRIC), + "ARPHRD_FCPL": ValueOf(syscall.ARPHRD_FCPL), + "ARPHRD_FCPP": ValueOf(syscall.ARPHRD_FCPP), + "ARPHRD_FDDI": ValueOf(syscall.ARPHRD_FDDI), + "ARPHRD_FRAD": ValueOf(syscall.ARPHRD_FRAD), + "ARPHRD_HDLC": ValueOf(syscall.ARPHRD_HDLC), + "ARPHRD_HIPPI": ValueOf(syscall.ARPHRD_HIPPI), + "ARPHRD_HWX25": ValueOf(syscall.ARPHRD_HWX25), + "ARPHRD_IEEE1394": ValueOf(syscall.ARPHRD_IEEE1394), + "ARPHRD_IEEE802": ValueOf(syscall.ARPHRD_IEEE802), + "ARPHRD_IEEE80211": ValueOf(syscall.ARPHRD_IEEE80211), + "ARPHRD_IEEE80211_PRISM": ValueOf(syscall.ARPHRD_IEEE80211_PRISM), + "ARPHRD_IEEE80211_RADIOTAP": ValueOf(syscall.ARPHRD_IEEE80211_RADIOTAP), + "ARPHRD_IEEE802154": ValueOf(syscall.ARPHRD_IEEE802154), + "ARPHRD_IEEE802154_MONITOR": ValueOf(syscall.ARPHRD_IEEE802154_MONITOR), + "ARPHRD_IEEE802_TR": ValueOf(syscall.ARPHRD_IEEE802_TR), + "ARPHRD_INFINIBAND": ValueOf(syscall.ARPHRD_INFINIBAND), + "ARPHRD_IP6GRE": ValueOf(syscall.ARPHRD_IP6GRE), + "ARPHRD_IPDDP": ValueOf(syscall.ARPHRD_IPDDP), + "ARPHRD_IPGRE": ValueOf(syscall.ARPHRD_IPGRE), + "ARPHRD_IRDA": ValueOf(syscall.ARPHRD_IRDA), + "ARPHRD_LAPB": ValueOf(syscall.ARPHRD_LAPB), + "ARPHRD_LOCALTLK": ValueOf(syscall.ARPHRD_LOCALTLK), + "ARPHRD_LOOPBACK": ValueOf(syscall.ARPHRD_LOOPBACK), + "ARPHRD_METRICOM": ValueOf(syscall.ARPHRD_METRICOM), + "ARPHRD_NETLINK": ValueOf(syscall.ARPHRD_NETLINK), + "ARPHRD_NETROM": ValueOf(syscall.ARPHRD_NETROM), + "ARPHRD_NONE": ValueOf(syscall.ARPHRD_NONE), + "ARPHRD_PHONET": ValueOf(syscall.ARPHRD_PHONET), + "ARPHRD_PHONET_PIPE": ValueOf(syscall.ARPHRD_PHONET_PIPE), + "ARPHRD_PIMREG": ValueOf(syscall.ARPHRD_PIMREG), + "ARPHRD_PPP": ValueOf(syscall.ARPHRD_PPP), + "ARPHRD_PRONET": ValueOf(syscall.ARPHRD_PRONET), + "ARPHRD_RAWHDLC": ValueOf(syscall.ARPHRD_RAWHDLC), + "ARPHRD_ROSE": ValueOf(syscall.ARPHRD_ROSE), + "ARPHRD_RSRVD": ValueOf(syscall.ARPHRD_RSRVD), + "ARPHRD_SIT": ValueOf(syscall.ARPHRD_SIT), + "ARPHRD_SKIP": ValueOf(syscall.ARPHRD_SKIP), + "ARPHRD_SLIP": ValueOf(syscall.ARPHRD_SLIP), + "ARPHRD_SLIP6": ValueOf(syscall.ARPHRD_SLIP6), + "ARPHRD_TUNNEL": ValueOf(syscall.ARPHRD_TUNNEL), + "ARPHRD_TUNNEL6": ValueOf(syscall.ARPHRD_TUNNEL6), + "ARPHRD_VOID": ValueOf(syscall.ARPHRD_VOID), + "ARPHRD_X25": ValueOf(syscall.ARPHRD_X25), + "Accept": ValueOf(syscall.Accept), + "Accept4": ValueOf(syscall.Accept4), + "Access": ValueOf(syscall.Access), + "Acct": ValueOf(syscall.Acct), + "Adjtimex": ValueOf(syscall.Adjtimex), + "AttachLsf": ValueOf(syscall.AttachLsf), + "B0": ValueOf(syscall.B0), + "B1000000": ValueOf(syscall.B1000000), + "B110": ValueOf(syscall.B110), + "B115200": ValueOf(syscall.B115200), + "B1152000": ValueOf(syscall.B1152000), + "B1200": ValueOf(syscall.B1200), + "B134": ValueOf(syscall.B134), + "B150": ValueOf(syscall.B150), + "B1500000": ValueOf(syscall.B1500000), + "B1800": ValueOf(syscall.B1800), + "B19200": ValueOf(syscall.B19200), + "B200": ValueOf(syscall.B200), + "B2000000": ValueOf(syscall.B2000000), + "B230400": ValueOf(syscall.B230400), + "B2400": ValueOf(syscall.B2400), + "B2500000": ValueOf(syscall.B2500000), + "B300": ValueOf(syscall.B300), + "B3000000": ValueOf(syscall.B3000000), + "B3500000": ValueOf(syscall.B3500000), + "B38400": ValueOf(syscall.B38400), + "B4000000": ValueOf(syscall.B4000000), + "B460800": ValueOf(syscall.B460800), + "B4800": ValueOf(syscall.B4800), + "B50": ValueOf(syscall.B50), + "B500000": ValueOf(syscall.B500000), + "B57600": ValueOf(syscall.B57600), + "B576000": ValueOf(syscall.B576000), + "B600": ValueOf(syscall.B600), + "B75": ValueOf(syscall.B75), + "B921600": ValueOf(syscall.B921600), + "B9600": ValueOf(syscall.B9600), + "BPF_A": ValueOf(syscall.BPF_A), + "BPF_ABS": ValueOf(syscall.BPF_ABS), + "BPF_ADD": ValueOf(syscall.BPF_ADD), + "BPF_ALU": ValueOf(syscall.BPF_ALU), + "BPF_AND": ValueOf(syscall.BPF_AND), + "BPF_B": ValueOf(syscall.BPF_B), + "BPF_DIV": ValueOf(syscall.BPF_DIV), + "BPF_H": ValueOf(syscall.BPF_H), + "BPF_IMM": ValueOf(syscall.BPF_IMM), + "BPF_IND": ValueOf(syscall.BPF_IND), + "BPF_JA": ValueOf(syscall.BPF_JA), + "BPF_JEQ": ValueOf(syscall.BPF_JEQ), + "BPF_JGE": ValueOf(syscall.BPF_JGE), + "BPF_JGT": ValueOf(syscall.BPF_JGT), + "BPF_JMP": ValueOf(syscall.BPF_JMP), + "BPF_JSET": ValueOf(syscall.BPF_JSET), + "BPF_K": ValueOf(syscall.BPF_K), + "BPF_LD": ValueOf(syscall.BPF_LD), + "BPF_LDX": ValueOf(syscall.BPF_LDX), + "BPF_LEN": ValueOf(syscall.BPF_LEN), + "BPF_LSH": ValueOf(syscall.BPF_LSH), + "BPF_MAJOR_VERSION": ValueOf(syscall.BPF_MAJOR_VERSION), + "BPF_MAXINSNS": ValueOf(syscall.BPF_MAXINSNS), + "BPF_MEM": ValueOf(syscall.BPF_MEM), + "BPF_MEMWORDS": ValueOf(syscall.BPF_MEMWORDS), + "BPF_MINOR_VERSION": ValueOf(syscall.BPF_MINOR_VERSION), + "BPF_MISC": ValueOf(syscall.BPF_MISC), + "BPF_MOD": ValueOf(syscall.BPF_MOD), + "BPF_MSH": ValueOf(syscall.BPF_MSH), + "BPF_MUL": ValueOf(syscall.BPF_MUL), + "BPF_NEG": ValueOf(syscall.BPF_NEG), + "BPF_OR": ValueOf(syscall.BPF_OR), + "BPF_RET": ValueOf(syscall.BPF_RET), + "BPF_RSH": ValueOf(syscall.BPF_RSH), + "BPF_ST": ValueOf(syscall.BPF_ST), + "BPF_STX": ValueOf(syscall.BPF_STX), + "BPF_SUB": ValueOf(syscall.BPF_SUB), + "BPF_TAX": ValueOf(syscall.BPF_TAX), + "BPF_TXA": ValueOf(syscall.BPF_TXA), + "BPF_W": ValueOf(syscall.BPF_W), + "BPF_X": ValueOf(syscall.BPF_X), + "BPF_XOR": ValueOf(syscall.BPF_XOR), + "BRKINT": ValueOf(syscall.BRKINT), + "Bind": ValueOf(syscall.Bind), + "BindToDevice": ValueOf(syscall.BindToDevice), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CFLUSH": ValueOf(syscall.CFLUSH), + "CLOCAL": ValueOf(syscall.CLOCAL), + "CLONE_CHILD_CLEARTID": ValueOf(syscall.CLONE_CHILD_CLEARTID), + "CLONE_CHILD_SETTID": ValueOf(syscall.CLONE_CHILD_SETTID), + "CLONE_DETACHED": ValueOf(syscall.CLONE_DETACHED), + "CLONE_FILES": ValueOf(syscall.CLONE_FILES), + "CLONE_FS": ValueOf(syscall.CLONE_FS), + "CLONE_IO": ValueOf(uint32(syscall.CLONE_IO)), + "CLONE_NEWIPC": ValueOf(syscall.CLONE_NEWIPC), + "CLONE_NEWNET": ValueOf(syscall.CLONE_NEWNET), + "CLONE_NEWNS": ValueOf(syscall.CLONE_NEWNS), + "CLONE_NEWPID": ValueOf(syscall.CLONE_NEWPID), + "CLONE_NEWUSER": ValueOf(syscall.CLONE_NEWUSER), + "CLONE_NEWUTS": ValueOf(syscall.CLONE_NEWUTS), + "CLONE_PARENT": ValueOf(syscall.CLONE_PARENT), + "CLONE_PARENT_SETTID": ValueOf(syscall.CLONE_PARENT_SETTID), + "CLONE_PTRACE": ValueOf(syscall.CLONE_PTRACE), + "CLONE_SETTLS": ValueOf(syscall.CLONE_SETTLS), + "CLONE_SIGHAND": ValueOf(syscall.CLONE_SIGHAND), + "CLONE_SYSVSEM": ValueOf(syscall.CLONE_SYSVSEM), + "CLONE_THREAD": ValueOf(syscall.CLONE_THREAD), + "CLONE_UNTRACED": ValueOf(syscall.CLONE_UNTRACED), + "CLONE_VFORK": ValueOf(syscall.CLONE_VFORK), + "CLONE_VM": ValueOf(syscall.CLONE_VM), + "CREAD": ValueOf(syscall.CREAD), + "CS5": ValueOf(syscall.CS5), + "CS6": ValueOf(syscall.CS6), + "CS7": ValueOf(syscall.CS7), + "CS8": ValueOf(syscall.CS8), + "CSIGNAL": ValueOf(syscall.CSIGNAL), + "CSIZE": ValueOf(syscall.CSIZE), + "CSTART": ValueOf(syscall.CSTART), + "CSTATUS": ValueOf(syscall.CSTATUS), + "CSTOP": ValueOf(syscall.CSTOP), + "CSTOPB": ValueOf(syscall.CSTOPB), + "CSUSP": ValueOf(syscall.CSUSP), + "Chdir": ValueOf(syscall.Chdir), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Chroot": ValueOf(syscall.Chroot), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "CmsgLen": ValueOf(syscall.CmsgLen), + "CmsgSpace": ValueOf(syscall.CmsgSpace), + "Connect": ValueOf(syscall.Connect), + "Creat": ValueOf(syscall.Creat), + "DT_BLK": ValueOf(syscall.DT_BLK), + "DT_CHR": ValueOf(syscall.DT_CHR), + "DT_DIR": ValueOf(syscall.DT_DIR), + "DT_FIFO": ValueOf(syscall.DT_FIFO), + "DT_LNK": ValueOf(syscall.DT_LNK), + "DT_REG": ValueOf(syscall.DT_REG), + "DT_SOCK": ValueOf(syscall.DT_SOCK), + "DT_UNKNOWN": ValueOf(syscall.DT_UNKNOWN), + "DT_WHT": ValueOf(syscall.DT_WHT), + "DetachLsf": ValueOf(syscall.DetachLsf), + "Dup": ValueOf(syscall.Dup), + "Dup3": ValueOf(syscall.Dup3), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EADV": ValueOf(syscall.EADV), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EBADE": ValueOf(syscall.EBADE), + "EBADF": ValueOf(syscall.EBADF), + "EBADFD": ValueOf(syscall.EBADFD), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADR": ValueOf(syscall.EBADR), + "EBADRQC": ValueOf(syscall.EBADRQC), + "EBADSLT": ValueOf(syscall.EBADSLT), + "EBFONT": ValueOf(syscall.EBFONT), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHO": ValueOf(syscall.ECHO), + "ECHOCTL": ValueOf(syscall.ECHOCTL), + "ECHOE": ValueOf(syscall.ECHOE), + "ECHOK": ValueOf(syscall.ECHOK), + "ECHOKE": ValueOf(syscall.ECHOKE), + "ECHONL": ValueOf(syscall.ECHONL), + "ECHOPRT": ValueOf(syscall.ECHOPRT), + "ECHRNG": ValueOf(syscall.ECHRNG), + "ECOMM": ValueOf(syscall.ECOMM), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDEADLOCK": ValueOf(syscall.EDEADLOCK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOTDOT": ValueOf(syscall.EDOTDOT), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EHWPOISON": ValueOf(syscall.EHWPOISON), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "EISNAM": ValueOf(syscall.EISNAM), + "EKEYEXPIRED": ValueOf(syscall.EKEYEXPIRED), + "EKEYREJECTED": ValueOf(syscall.EKEYREJECTED), + "EKEYREVOKED": ValueOf(syscall.EKEYREVOKED), + "EL2HLT": ValueOf(syscall.EL2HLT), + "EL2NSYNC": ValueOf(syscall.EL2NSYNC), + "EL3HLT": ValueOf(syscall.EL3HLT), + "EL3RST": ValueOf(syscall.EL3RST), + "ELIBACC": ValueOf(syscall.ELIBACC), + "ELIBBAD": ValueOf(syscall.ELIBBAD), + "ELIBEXEC": ValueOf(syscall.ELIBEXEC), + "ELIBMAX": ValueOf(syscall.ELIBMAX), + "ELIBSCN": ValueOf(syscall.ELIBSCN), + "ELNRNG": ValueOf(syscall.ELNRNG), + "ELOOP": ValueOf(syscall.ELOOP), + "EMEDIUMTYPE": ValueOf(syscall.EMEDIUMTYPE), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENAVAIL": ValueOf(syscall.ENAVAIL), + "ENCODING_DEFAULT": ValueOf(syscall.ENCODING_DEFAULT), + "ENCODING_FM_MARK": ValueOf(syscall.ENCODING_FM_MARK), + "ENCODING_FM_SPACE": ValueOf(syscall.ENCODING_FM_SPACE), + "ENCODING_MANCHESTER": ValueOf(syscall.ENCODING_MANCHESTER), + "ENCODING_NRZ": ValueOf(syscall.ENCODING_NRZ), + "ENCODING_NRZI": ValueOf(syscall.ENCODING_NRZI), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOANO": ValueOf(syscall.ENOANO), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENOCSI": ValueOf(syscall.ENOCSI), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOKEY": ValueOf(syscall.ENOKEY), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEDIUM": ValueOf(syscall.ENOMEDIUM), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENONET": ValueOf(syscall.ENONET), + "ENOPKG": ValueOf(syscall.ENOPKG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTNAM": ValueOf(syscall.ENOTNAM), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENOTUNIQ": ValueOf(syscall.ENOTUNIQ), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPOLLERR": ValueOf(syscall.EPOLLERR), + "EPOLLET": ValueOf(uint32(syscall.EPOLLET)), + "EPOLLHUP": ValueOf(syscall.EPOLLHUP), + "EPOLLIN": ValueOf(syscall.EPOLLIN), + "EPOLLMSG": ValueOf(syscall.EPOLLMSG), + "EPOLLONESHOT": ValueOf(syscall.EPOLLONESHOT), + "EPOLLOUT": ValueOf(syscall.EPOLLOUT), + "EPOLLPRI": ValueOf(syscall.EPOLLPRI), + "EPOLLRDBAND": ValueOf(syscall.EPOLLRDBAND), + "EPOLLRDHUP": ValueOf(syscall.EPOLLRDHUP), + "EPOLLRDNORM": ValueOf(syscall.EPOLLRDNORM), + "EPOLLWAKEUP": ValueOf(syscall.EPOLLWAKEUP), + "EPOLLWRBAND": ValueOf(syscall.EPOLLWRBAND), + "EPOLLWRNORM": ValueOf(syscall.EPOLLWRNORM), + "EPOLL_CLOEXEC": ValueOf(syscall.EPOLL_CLOEXEC), + "EPOLL_CTL_ADD": ValueOf(syscall.EPOLL_CTL_ADD), + "EPOLL_CTL_DEL": ValueOf(syscall.EPOLL_CTL_DEL), + "EPOLL_CTL_MOD": ValueOf(syscall.EPOLL_CTL_MOD), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMCHG": ValueOf(syscall.EREMCHG), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EREMOTEIO": ValueOf(syscall.EREMOTEIO), + "ERESTART": ValueOf(syscall.ERESTART), + "ERFKILL": ValueOf(syscall.ERFKILL), + "EROFS": ValueOf(syscall.EROFS), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESRMNT": ValueOf(syscall.ESRMNT), + "ESTALE": ValueOf(syscall.ESTALE), + "ESTRPIPE": ValueOf(syscall.ESTRPIPE), + "ETH_P_1588": ValueOf(syscall.ETH_P_1588), + "ETH_P_8021AD": ValueOf(syscall.ETH_P_8021AD), + "ETH_P_8021AH": ValueOf(syscall.ETH_P_8021AH), + "ETH_P_8021Q": ValueOf(syscall.ETH_P_8021Q), + "ETH_P_802_2": ValueOf(syscall.ETH_P_802_2), + "ETH_P_802_3": ValueOf(syscall.ETH_P_802_3), + "ETH_P_802_3_MIN": ValueOf(syscall.ETH_P_802_3_MIN), + "ETH_P_802_EX1": ValueOf(syscall.ETH_P_802_EX1), + "ETH_P_AARP": ValueOf(syscall.ETH_P_AARP), + "ETH_P_AF_IUCV": ValueOf(syscall.ETH_P_AF_IUCV), + "ETH_P_ALL": ValueOf(syscall.ETH_P_ALL), + "ETH_P_AOE": ValueOf(syscall.ETH_P_AOE), + "ETH_P_ARCNET": ValueOf(syscall.ETH_P_ARCNET), + "ETH_P_ARP": ValueOf(syscall.ETH_P_ARP), + "ETH_P_ATALK": ValueOf(syscall.ETH_P_ATALK), + "ETH_P_ATMFATE": ValueOf(syscall.ETH_P_ATMFATE), + "ETH_P_ATMMPOA": ValueOf(syscall.ETH_P_ATMMPOA), + "ETH_P_AX25": ValueOf(syscall.ETH_P_AX25), + "ETH_P_BATMAN": ValueOf(syscall.ETH_P_BATMAN), + "ETH_P_BPQ": ValueOf(syscall.ETH_P_BPQ), + "ETH_P_CAIF": ValueOf(syscall.ETH_P_CAIF), + "ETH_P_CAN": ValueOf(syscall.ETH_P_CAN), + "ETH_P_CANFD": ValueOf(syscall.ETH_P_CANFD), + "ETH_P_CONTROL": ValueOf(syscall.ETH_P_CONTROL), + "ETH_P_CUST": ValueOf(syscall.ETH_P_CUST), + "ETH_P_DDCMP": ValueOf(syscall.ETH_P_DDCMP), + "ETH_P_DEC": ValueOf(syscall.ETH_P_DEC), + "ETH_P_DIAG": ValueOf(syscall.ETH_P_DIAG), + "ETH_P_DNA_DL": ValueOf(syscall.ETH_P_DNA_DL), + "ETH_P_DNA_RC": ValueOf(syscall.ETH_P_DNA_RC), + "ETH_P_DNA_RT": ValueOf(syscall.ETH_P_DNA_RT), + "ETH_P_DSA": ValueOf(syscall.ETH_P_DSA), + "ETH_P_ECONET": ValueOf(syscall.ETH_P_ECONET), + "ETH_P_EDSA": ValueOf(syscall.ETH_P_EDSA), + "ETH_P_FCOE": ValueOf(syscall.ETH_P_FCOE), + "ETH_P_FIP": ValueOf(syscall.ETH_P_FIP), + "ETH_P_HDLC": ValueOf(syscall.ETH_P_HDLC), + "ETH_P_IEEE802154": ValueOf(syscall.ETH_P_IEEE802154), + "ETH_P_IEEEPUP": ValueOf(syscall.ETH_P_IEEEPUP), + "ETH_P_IEEEPUPAT": ValueOf(syscall.ETH_P_IEEEPUPAT), + "ETH_P_IP": ValueOf(syscall.ETH_P_IP), + "ETH_P_IPV6": ValueOf(syscall.ETH_P_IPV6), + "ETH_P_IPX": ValueOf(syscall.ETH_P_IPX), + "ETH_P_IRDA": ValueOf(syscall.ETH_P_IRDA), + "ETH_P_LAT": ValueOf(syscall.ETH_P_LAT), + "ETH_P_LINK_CTL": ValueOf(syscall.ETH_P_LINK_CTL), + "ETH_P_LOCALTALK": ValueOf(syscall.ETH_P_LOCALTALK), + "ETH_P_LOOP": ValueOf(syscall.ETH_P_LOOP), + "ETH_P_MOBITEX": ValueOf(syscall.ETH_P_MOBITEX), + "ETH_P_MPLS_MC": ValueOf(syscall.ETH_P_MPLS_MC), + "ETH_P_MPLS_UC": ValueOf(syscall.ETH_P_MPLS_UC), + "ETH_P_MVRP": ValueOf(syscall.ETH_P_MVRP), + "ETH_P_PAE": ValueOf(syscall.ETH_P_PAE), + "ETH_P_PAUSE": ValueOf(syscall.ETH_P_PAUSE), + "ETH_P_PHONET": ValueOf(syscall.ETH_P_PHONET), + "ETH_P_PPPTALK": ValueOf(syscall.ETH_P_PPPTALK), + "ETH_P_PPP_DISC": ValueOf(syscall.ETH_P_PPP_DISC), + "ETH_P_PPP_MP": ValueOf(syscall.ETH_P_PPP_MP), + "ETH_P_PPP_SES": ValueOf(syscall.ETH_P_PPP_SES), + "ETH_P_PRP": ValueOf(syscall.ETH_P_PRP), + "ETH_P_PUP": ValueOf(syscall.ETH_P_PUP), + "ETH_P_PUPAT": ValueOf(syscall.ETH_P_PUPAT), + "ETH_P_QINQ1": ValueOf(syscall.ETH_P_QINQ1), + "ETH_P_QINQ2": ValueOf(syscall.ETH_P_QINQ2), + "ETH_P_QINQ3": ValueOf(syscall.ETH_P_QINQ3), + "ETH_P_RARP": ValueOf(syscall.ETH_P_RARP), + "ETH_P_SCA": ValueOf(syscall.ETH_P_SCA), + "ETH_P_SLOW": ValueOf(syscall.ETH_P_SLOW), + "ETH_P_SNAP": ValueOf(syscall.ETH_P_SNAP), + "ETH_P_TDLS": ValueOf(syscall.ETH_P_TDLS), + "ETH_P_TEB": ValueOf(syscall.ETH_P_TEB), + "ETH_P_TIPC": ValueOf(syscall.ETH_P_TIPC), + "ETH_P_TRAILER": ValueOf(syscall.ETH_P_TRAILER), + "ETH_P_TR_802_2": ValueOf(syscall.ETH_P_TR_802_2), + "ETH_P_WAN_PPP": ValueOf(syscall.ETH_P_WAN_PPP), + "ETH_P_WCCP": ValueOf(syscall.ETH_P_WCCP), + "ETH_P_X25": ValueOf(syscall.ETH_P_X25), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUCLEAN": ValueOf(syscall.EUCLEAN), + "EUNATCH": ValueOf(syscall.EUNATCH), + "EUSERS": ValueOf(syscall.EUSERS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXFULL": ValueOf(syscall.EXFULL), + "EXTA": ValueOf(syscall.EXTA), + "EXTB": ValueOf(syscall.EXTB), + "EXTPROC": ValueOf(syscall.EXTPROC), + "Environ": ValueOf(syscall.Environ), + "EpollCreate": ValueOf(syscall.EpollCreate), + "EpollCreate1": ValueOf(syscall.EpollCreate1), + "EpollCtl": ValueOf(syscall.EpollCtl), + "EpollWait": ValueOf(syscall.EpollWait), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "FD_CLOEXEC": ValueOf(syscall.FD_CLOEXEC), + "FD_SETSIZE": ValueOf(syscall.FD_SETSIZE), + "FLUSHO": ValueOf(syscall.FLUSHO), + "F_DUPFD": ValueOf(syscall.F_DUPFD), + "F_DUPFD_CLOEXEC": ValueOf(syscall.F_DUPFD_CLOEXEC), + "F_EXLCK": ValueOf(syscall.F_EXLCK), + "F_GETFD": ValueOf(syscall.F_GETFD), + "F_GETFL": ValueOf(syscall.F_GETFL), + "F_GETLEASE": ValueOf(syscall.F_GETLEASE), + "F_GETLK": ValueOf(syscall.F_GETLK), + "F_GETLK64": ValueOf(syscall.F_GETLK64), + "F_GETOWN": ValueOf(syscall.F_GETOWN), + "F_GETOWN_EX": ValueOf(syscall.F_GETOWN_EX), + "F_GETPIPE_SZ": ValueOf(syscall.F_GETPIPE_SZ), + "F_GETSIG": ValueOf(syscall.F_GETSIG), + "F_LOCK": ValueOf(syscall.F_LOCK), + "F_NOTIFY": ValueOf(syscall.F_NOTIFY), + "F_OK": ValueOf(syscall.F_OK), + "F_RDLCK": ValueOf(syscall.F_RDLCK), + "F_SETFD": ValueOf(syscall.F_SETFD), + "F_SETFL": ValueOf(syscall.F_SETFL), + "F_SETLEASE": ValueOf(syscall.F_SETLEASE), + "F_SETLK": ValueOf(syscall.F_SETLK), + "F_SETLK64": ValueOf(syscall.F_SETLK64), + "F_SETLKW": ValueOf(syscall.F_SETLKW), + "F_SETLKW64": ValueOf(syscall.F_SETLKW64), + "F_SETOWN": ValueOf(syscall.F_SETOWN), + "F_SETOWN_EX": ValueOf(syscall.F_SETOWN_EX), + "F_SETPIPE_SZ": ValueOf(syscall.F_SETPIPE_SZ), + "F_SETSIG": ValueOf(syscall.F_SETSIG), + "F_SHLCK": ValueOf(syscall.F_SHLCK), + "F_TEST": ValueOf(syscall.F_TEST), + "F_TLOCK": ValueOf(syscall.F_TLOCK), + "F_ULOCK": ValueOf(syscall.F_ULOCK), + "F_UNLCK": ValueOf(syscall.F_UNLCK), + "F_WRLCK": ValueOf(syscall.F_WRLCK), + "Faccessat": ValueOf(syscall.Faccessat), + "Fallocate": ValueOf(syscall.Fallocate), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchmodat": ValueOf(syscall.Fchmodat), + "Fchown": ValueOf(syscall.Fchown), + "Fchownat": ValueOf(syscall.Fchownat), + "FcntlFlock": ValueOf(syscall.FcntlFlock), + "Fdatasync": ValueOf(syscall.Fdatasync), + "Flock": ValueOf(syscall.Flock), + "ForkExec": ValueOf(syscall.ForkExec), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "Fstat": ValueOf(syscall.Fstat), + "Fstatat": ValueOf(syscall.Fstatat), + "Fstatfs": ValueOf(syscall.Fstatfs), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "Futimes": ValueOf(syscall.Futimes), + "Futimesat": ValueOf(syscall.Futimesat), + "Getcwd": ValueOf(syscall.Getcwd), + "Getdents": ValueOf(syscall.Getdents), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpgid": ValueOf(syscall.Getpgid), + "Getpgrp": ValueOf(syscall.Getpgrp), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getpriority": ValueOf(syscall.Getpriority), + "Getrlimit": ValueOf(syscall.Getrlimit), + "Getrusage": ValueOf(syscall.Getrusage), + "Getsockname": ValueOf(syscall.Getsockname), + "GetsockoptICMPv6Filter": ValueOf(syscall.GetsockoptICMPv6Filter), + "GetsockoptIPMreq": ValueOf(syscall.GetsockoptIPMreq), + "GetsockoptIPMreqn": ValueOf(syscall.GetsockoptIPMreqn), + "GetsockoptIPv6MTUInfo": ValueOf(syscall.GetsockoptIPv6MTUInfo), + "GetsockoptIPv6Mreq": ValueOf(syscall.GetsockoptIPv6Mreq), + "GetsockoptInet4Addr": ValueOf(syscall.GetsockoptInet4Addr), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "GetsockoptUcred": ValueOf(syscall.GetsockoptUcred), + "Gettid": ValueOf(syscall.Gettid), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "Getxattr": ValueOf(syscall.Getxattr), + "HUPCL": ValueOf(syscall.HUPCL), + "ICANON": ValueOf(syscall.ICANON), + "ICMPV6_FILTER": ValueOf(syscall.ICMPV6_FILTER), + "ICRNL": ValueOf(syscall.ICRNL), + "IEXTEN": ValueOf(syscall.IEXTEN), + "IFA_ADDRESS": ValueOf(syscall.IFA_ADDRESS), + "IFA_ANYCAST": ValueOf(syscall.IFA_ANYCAST), + "IFA_BROADCAST": ValueOf(syscall.IFA_BROADCAST), + "IFA_CACHEINFO": ValueOf(syscall.IFA_CACHEINFO), + "IFA_F_DADFAILED": ValueOf(syscall.IFA_F_DADFAILED), + "IFA_F_DEPRECATED": ValueOf(syscall.IFA_F_DEPRECATED), + "IFA_F_HOMEADDRESS": ValueOf(syscall.IFA_F_HOMEADDRESS), + "IFA_F_NODAD": ValueOf(syscall.IFA_F_NODAD), + "IFA_F_OPTIMISTIC": ValueOf(syscall.IFA_F_OPTIMISTIC), + "IFA_F_PERMANENT": ValueOf(syscall.IFA_F_PERMANENT), + "IFA_F_SECONDARY": ValueOf(syscall.IFA_F_SECONDARY), + "IFA_F_TEMPORARY": ValueOf(syscall.IFA_F_TEMPORARY), + "IFA_F_TENTATIVE": ValueOf(syscall.IFA_F_TENTATIVE), + "IFA_LABEL": ValueOf(syscall.IFA_LABEL), + "IFA_LOCAL": ValueOf(syscall.IFA_LOCAL), + "IFA_MAX": ValueOf(syscall.IFA_MAX), + "IFA_MULTICAST": ValueOf(syscall.IFA_MULTICAST), + "IFA_UNSPEC": ValueOf(syscall.IFA_UNSPEC), + "IFF_802_1Q_VLAN": ValueOf(syscall.IFF_802_1Q_VLAN), + "IFF_ALLMULTI": ValueOf(syscall.IFF_ALLMULTI), + "IFF_ATTACH_QUEUE": ValueOf(syscall.IFF_ATTACH_QUEUE), + "IFF_AUTOMEDIA": ValueOf(syscall.IFF_AUTOMEDIA), + "IFF_BONDING": ValueOf(syscall.IFF_BONDING), + "IFF_BRIDGE_PORT": ValueOf(syscall.IFF_BRIDGE_PORT), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_DEBUG": ValueOf(syscall.IFF_DEBUG), + "IFF_DETACH_QUEUE": ValueOf(syscall.IFF_DETACH_QUEUE), + "IFF_DISABLE_NETPOLL": ValueOf(syscall.IFF_DISABLE_NETPOLL), + "IFF_DONT_BRIDGE": ValueOf(syscall.IFF_DONT_BRIDGE), + "IFF_DORMANT": ValueOf(syscall.IFF_DORMANT), + "IFF_DYNAMIC": ValueOf(syscall.IFF_DYNAMIC), + "IFF_EBRIDGE": ValueOf(syscall.IFF_EBRIDGE), + "IFF_ECHO": ValueOf(syscall.IFF_ECHO), + "IFF_ISATAP": ValueOf(syscall.IFF_ISATAP), + "IFF_LIVE_ADDR_CHANGE": ValueOf(syscall.IFF_LIVE_ADDR_CHANGE), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_LOWER_UP": ValueOf(syscall.IFF_LOWER_UP), + "IFF_MACVLAN": ValueOf(syscall.IFF_MACVLAN), + "IFF_MACVLAN_PORT": ValueOf(syscall.IFF_MACVLAN_PORT), + "IFF_MASTER": ValueOf(syscall.IFF_MASTER), + "IFF_MASTER_8023AD": ValueOf(syscall.IFF_MASTER_8023AD), + "IFF_MASTER_ALB": ValueOf(syscall.IFF_MASTER_ALB), + "IFF_MASTER_ARPMON": ValueOf(syscall.IFF_MASTER_ARPMON), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_MULTI_QUEUE": ValueOf(syscall.IFF_MULTI_QUEUE), + "IFF_NOARP": ValueOf(syscall.IFF_NOARP), + "IFF_NOFILTER": ValueOf(syscall.IFF_NOFILTER), + "IFF_NOTRAILERS": ValueOf(syscall.IFF_NOTRAILERS), + "IFF_NO_PI": ValueOf(syscall.IFF_NO_PI), + "IFF_ONE_QUEUE": ValueOf(syscall.IFF_ONE_QUEUE), + "IFF_OVS_DATAPATH": ValueOf(syscall.IFF_OVS_DATAPATH), + "IFF_PERSIST": ValueOf(syscall.IFF_PERSIST), + "IFF_POINTOPOINT": ValueOf(syscall.IFF_POINTOPOINT), + "IFF_PORTSEL": ValueOf(syscall.IFF_PORTSEL), + "IFF_PROMISC": ValueOf(syscall.IFF_PROMISC), + "IFF_RUNNING": ValueOf(syscall.IFF_RUNNING), + "IFF_SLAVE": ValueOf(syscall.IFF_SLAVE), + "IFF_SLAVE_INACTIVE": ValueOf(syscall.IFF_SLAVE_INACTIVE), + "IFF_SLAVE_NEEDARP": ValueOf(syscall.IFF_SLAVE_NEEDARP), + "IFF_SUPP_NOFCS": ValueOf(syscall.IFF_SUPP_NOFCS), + "IFF_TAP": ValueOf(syscall.IFF_TAP), + "IFF_TEAM_PORT": ValueOf(syscall.IFF_TEAM_PORT), + "IFF_TUN": ValueOf(syscall.IFF_TUN), + "IFF_TUN_EXCL": ValueOf(syscall.IFF_TUN_EXCL), + "IFF_TX_SKB_SHARING": ValueOf(syscall.IFF_TX_SKB_SHARING), + "IFF_UNICAST_FLT": ValueOf(syscall.IFF_UNICAST_FLT), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IFF_VNET_HDR": ValueOf(syscall.IFF_VNET_HDR), + "IFF_VOLATILE": ValueOf(syscall.IFF_VOLATILE), + "IFF_WAN_HDLC": ValueOf(syscall.IFF_WAN_HDLC), + "IFF_XMIT_DST_RELEASE": ValueOf(syscall.IFF_XMIT_DST_RELEASE), + "IFLA_ADDRESS": ValueOf(syscall.IFLA_ADDRESS), + "IFLA_BROADCAST": ValueOf(syscall.IFLA_BROADCAST), + "IFLA_COST": ValueOf(syscall.IFLA_COST), + "IFLA_IFALIAS": ValueOf(syscall.IFLA_IFALIAS), + "IFLA_IFNAME": ValueOf(syscall.IFLA_IFNAME), + "IFLA_LINK": ValueOf(syscall.IFLA_LINK), + "IFLA_LINKINFO": ValueOf(syscall.IFLA_LINKINFO), + "IFLA_LINKMODE": ValueOf(syscall.IFLA_LINKMODE), + "IFLA_MAP": ValueOf(syscall.IFLA_MAP), + "IFLA_MASTER": ValueOf(syscall.IFLA_MASTER), + "IFLA_MAX": ValueOf(syscall.IFLA_MAX), + "IFLA_MTU": ValueOf(syscall.IFLA_MTU), + "IFLA_NET_NS_PID": ValueOf(syscall.IFLA_NET_NS_PID), + "IFLA_OPERSTATE": ValueOf(syscall.IFLA_OPERSTATE), + "IFLA_PRIORITY": ValueOf(syscall.IFLA_PRIORITY), + "IFLA_PROTINFO": ValueOf(syscall.IFLA_PROTINFO), + "IFLA_QDISC": ValueOf(syscall.IFLA_QDISC), + "IFLA_STATS": ValueOf(syscall.IFLA_STATS), + "IFLA_TXQLEN": ValueOf(syscall.IFLA_TXQLEN), + "IFLA_UNSPEC": ValueOf(syscall.IFLA_UNSPEC), + "IFLA_WEIGHT": ValueOf(syscall.IFLA_WEIGHT), + "IFLA_WIRELESS": ValueOf(syscall.IFLA_WIRELESS), + "IFNAMSIZ": ValueOf(syscall.IFNAMSIZ), + "IGNBRK": ValueOf(syscall.IGNBRK), + "IGNCR": ValueOf(syscall.IGNCR), + "IGNPAR": ValueOf(syscall.IGNPAR), + "IMAXBEL": ValueOf(syscall.IMAXBEL), + "INLCR": ValueOf(syscall.INLCR), + "INPCK": ValueOf(syscall.INPCK), + "IN_ACCESS": ValueOf(syscall.IN_ACCESS), + "IN_ALL_EVENTS": ValueOf(syscall.IN_ALL_EVENTS), + "IN_ATTRIB": ValueOf(syscall.IN_ATTRIB), + "IN_CLASSA_HOST": ValueOf(syscall.IN_CLASSA_HOST), + "IN_CLASSA_MAX": ValueOf(syscall.IN_CLASSA_MAX), + "IN_CLASSA_NET": ValueOf(uint32(syscall.IN_CLASSA_NET)), + "IN_CLASSA_NSHIFT": ValueOf(syscall.IN_CLASSA_NSHIFT), + "IN_CLASSB_HOST": ValueOf(syscall.IN_CLASSB_HOST), + "IN_CLASSB_MAX": ValueOf(syscall.IN_CLASSB_MAX), + "IN_CLASSB_NET": ValueOf(uint32(syscall.IN_CLASSB_NET)), + "IN_CLASSB_NSHIFT": ValueOf(syscall.IN_CLASSB_NSHIFT), + "IN_CLASSC_HOST": ValueOf(syscall.IN_CLASSC_HOST), + "IN_CLASSC_NET": ValueOf(uint32(syscall.IN_CLASSC_NET)), + "IN_CLASSC_NSHIFT": ValueOf(syscall.IN_CLASSC_NSHIFT), + "IN_CLOEXEC": ValueOf(syscall.IN_CLOEXEC), + "IN_CLOSE": ValueOf(syscall.IN_CLOSE), + "IN_CLOSE_NOWRITE": ValueOf(syscall.IN_CLOSE_NOWRITE), + "IN_CLOSE_WRITE": ValueOf(syscall.IN_CLOSE_WRITE), + "IN_CREATE": ValueOf(syscall.IN_CREATE), + "IN_DELETE": ValueOf(syscall.IN_DELETE), + "IN_DELETE_SELF": ValueOf(syscall.IN_DELETE_SELF), + "IN_DONT_FOLLOW": ValueOf(syscall.IN_DONT_FOLLOW), + "IN_EXCL_UNLINK": ValueOf(syscall.IN_EXCL_UNLINK), + "IN_IGNORED": ValueOf(syscall.IN_IGNORED), + "IN_ISDIR": ValueOf(syscall.IN_ISDIR), + "IN_LOOPBACKNET": ValueOf(syscall.IN_LOOPBACKNET), + "IN_MASK_ADD": ValueOf(syscall.IN_MASK_ADD), + "IN_MODIFY": ValueOf(syscall.IN_MODIFY), + "IN_MOVE": ValueOf(syscall.IN_MOVE), + "IN_MOVED_FROM": ValueOf(syscall.IN_MOVED_FROM), + "IN_MOVED_TO": ValueOf(syscall.IN_MOVED_TO), + "IN_MOVE_SELF": ValueOf(syscall.IN_MOVE_SELF), + "IN_NONBLOCK": ValueOf(syscall.IN_NONBLOCK), + "IN_ONESHOT": ValueOf(uint32(syscall.IN_ONESHOT)), + "IN_ONLYDIR": ValueOf(syscall.IN_ONLYDIR), + "IN_OPEN": ValueOf(syscall.IN_OPEN), + "IN_Q_OVERFLOW": ValueOf(syscall.IN_Q_OVERFLOW), + "IN_UNMOUNT": ValueOf(syscall.IN_UNMOUNT), + "IPPROTO_AH": ValueOf(syscall.IPPROTO_AH), + "IPPROTO_BEETPH": ValueOf(syscall.IPPROTO_BEETPH), + "IPPROTO_COMP": ValueOf(syscall.IPPROTO_COMP), + "IPPROTO_DCCP": ValueOf(syscall.IPPROTO_DCCP), + "IPPROTO_DSTOPTS": ValueOf(syscall.IPPROTO_DSTOPTS), + "IPPROTO_EGP": ValueOf(syscall.IPPROTO_EGP), + "IPPROTO_ENCAP": ValueOf(syscall.IPPROTO_ENCAP), + "IPPROTO_ESP": ValueOf(syscall.IPPROTO_ESP), + "IPPROTO_FRAGMENT": ValueOf(syscall.IPPROTO_FRAGMENT), + "IPPROTO_GRE": ValueOf(syscall.IPPROTO_GRE), + "IPPROTO_HOPOPTS": ValueOf(syscall.IPPROTO_HOPOPTS), + "IPPROTO_ICMP": ValueOf(syscall.IPPROTO_ICMP), + "IPPROTO_ICMPV6": ValueOf(syscall.IPPROTO_ICMPV6), + "IPPROTO_IDP": ValueOf(syscall.IPPROTO_IDP), + "IPPROTO_IGMP": ValueOf(syscall.IPPROTO_IGMP), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPIP": ValueOf(syscall.IPPROTO_IPIP), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_MH": ValueOf(syscall.IPPROTO_MH), + "IPPROTO_MTP": ValueOf(syscall.IPPROTO_MTP), + "IPPROTO_NONE": ValueOf(syscall.IPPROTO_NONE), + "IPPROTO_PIM": ValueOf(syscall.IPPROTO_PIM), + "IPPROTO_PUP": ValueOf(syscall.IPPROTO_PUP), + "IPPROTO_RAW": ValueOf(syscall.IPPROTO_RAW), + "IPPROTO_ROUTING": ValueOf(syscall.IPPROTO_ROUTING), + "IPPROTO_RSVP": ValueOf(syscall.IPPROTO_RSVP), + "IPPROTO_SCTP": ValueOf(syscall.IPPROTO_SCTP), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_TP": ValueOf(syscall.IPPROTO_TP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPPROTO_UDPLITE": ValueOf(syscall.IPPROTO_UDPLITE), + "IPV6_2292DSTOPTS": ValueOf(syscall.IPV6_2292DSTOPTS), + "IPV6_2292HOPLIMIT": ValueOf(syscall.IPV6_2292HOPLIMIT), + "IPV6_2292HOPOPTS": ValueOf(syscall.IPV6_2292HOPOPTS), + "IPV6_2292PKTINFO": ValueOf(syscall.IPV6_2292PKTINFO), + "IPV6_2292PKTOPTIONS": ValueOf(syscall.IPV6_2292PKTOPTIONS), + "IPV6_2292RTHDR": ValueOf(syscall.IPV6_2292RTHDR), + "IPV6_ADDRFORM": ValueOf(syscall.IPV6_ADDRFORM), + "IPV6_ADD_MEMBERSHIP": ValueOf(syscall.IPV6_ADD_MEMBERSHIP), + "IPV6_AUTHHDR": ValueOf(syscall.IPV6_AUTHHDR), + "IPV6_CHECKSUM": ValueOf(syscall.IPV6_CHECKSUM), + "IPV6_DROP_MEMBERSHIP": ValueOf(syscall.IPV6_DROP_MEMBERSHIP), + "IPV6_DSTOPTS": ValueOf(syscall.IPV6_DSTOPTS), + "IPV6_HOPLIMIT": ValueOf(syscall.IPV6_HOPLIMIT), + "IPV6_HOPOPTS": ValueOf(syscall.IPV6_HOPOPTS), + "IPV6_IPSEC_POLICY": ValueOf(syscall.IPV6_IPSEC_POLICY), + "IPV6_JOIN_ANYCAST": ValueOf(syscall.IPV6_JOIN_ANYCAST), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_ANYCAST": ValueOf(syscall.IPV6_LEAVE_ANYCAST), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MTU": ValueOf(syscall.IPV6_MTU), + "IPV6_MTU_DISCOVER": ValueOf(syscall.IPV6_MTU_DISCOVER), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_NEXTHOP": ValueOf(syscall.IPV6_NEXTHOP), + "IPV6_PKTINFO": ValueOf(syscall.IPV6_PKTINFO), + "IPV6_PMTUDISC_DO": ValueOf(syscall.IPV6_PMTUDISC_DO), + "IPV6_PMTUDISC_DONT": ValueOf(syscall.IPV6_PMTUDISC_DONT), + "IPV6_PMTUDISC_PROBE": ValueOf(syscall.IPV6_PMTUDISC_PROBE), + "IPV6_PMTUDISC_WANT": ValueOf(syscall.IPV6_PMTUDISC_WANT), + "IPV6_RECVDSTOPTS": ValueOf(syscall.IPV6_RECVDSTOPTS), + "IPV6_RECVERR": ValueOf(syscall.IPV6_RECVERR), + "IPV6_RECVHOPLIMIT": ValueOf(syscall.IPV6_RECVHOPLIMIT), + "IPV6_RECVHOPOPTS": ValueOf(syscall.IPV6_RECVHOPOPTS), + "IPV6_RECVPKTINFO": ValueOf(syscall.IPV6_RECVPKTINFO), + "IPV6_RECVRTHDR": ValueOf(syscall.IPV6_RECVRTHDR), + "IPV6_RECVTCLASS": ValueOf(syscall.IPV6_RECVTCLASS), + "IPV6_ROUTER_ALERT": ValueOf(syscall.IPV6_ROUTER_ALERT), + "IPV6_RTHDR": ValueOf(syscall.IPV6_RTHDR), + "IPV6_RTHDRDSTOPTS": ValueOf(syscall.IPV6_RTHDRDSTOPTS), + "IPV6_RTHDR_LOOSE": ValueOf(syscall.IPV6_RTHDR_LOOSE), + "IPV6_RTHDR_STRICT": ValueOf(syscall.IPV6_RTHDR_STRICT), + "IPV6_RTHDR_TYPE_0": ValueOf(syscall.IPV6_RTHDR_TYPE_0), + "IPV6_RXDSTOPTS": ValueOf(syscall.IPV6_RXDSTOPTS), + "IPV6_RXHOPOPTS": ValueOf(syscall.IPV6_RXHOPOPTS), + "IPV6_TCLASS": ValueOf(syscall.IPV6_TCLASS), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IPV6_XFRM_POLICY": ValueOf(syscall.IPV6_XFRM_POLICY), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_ADD_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_ADD_SOURCE_MEMBERSHIP), + "IP_BLOCK_SOURCE": ValueOf(syscall.IP_BLOCK_SOURCE), + "IP_DEFAULT_MULTICAST_LOOP": ValueOf(syscall.IP_DEFAULT_MULTICAST_LOOP), + "IP_DEFAULT_MULTICAST_TTL": ValueOf(syscall.IP_DEFAULT_MULTICAST_TTL), + "IP_DF": ValueOf(syscall.IP_DF), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_DROP_SOURCE_MEMBERSHIP": ValueOf(syscall.IP_DROP_SOURCE_MEMBERSHIP), + "IP_FREEBIND": ValueOf(syscall.IP_FREEBIND), + "IP_HDRINCL": ValueOf(syscall.IP_HDRINCL), + "IP_IPSEC_POLICY": ValueOf(syscall.IP_IPSEC_POLICY), + "IP_MAXPACKET": ValueOf(syscall.IP_MAXPACKET), + "IP_MAX_MEMBERSHIPS": ValueOf(syscall.IP_MAX_MEMBERSHIPS), + "IP_MF": ValueOf(syscall.IP_MF), + "IP_MINTTL": ValueOf(syscall.IP_MINTTL), + "IP_MSFILTER": ValueOf(syscall.IP_MSFILTER), + "IP_MSS": ValueOf(syscall.IP_MSS), + "IP_MTU": ValueOf(syscall.IP_MTU), + "IP_MTU_DISCOVER": ValueOf(syscall.IP_MTU_DISCOVER), + "IP_MULTICAST_ALL": ValueOf(syscall.IP_MULTICAST_ALL), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_OFFMASK": ValueOf(syscall.IP_OFFMASK), + "IP_OPTIONS": ValueOf(syscall.IP_OPTIONS), + "IP_ORIGDSTADDR": ValueOf(syscall.IP_ORIGDSTADDR), + "IP_PASSSEC": ValueOf(syscall.IP_PASSSEC), + "IP_PKTINFO": ValueOf(syscall.IP_PKTINFO), + "IP_PKTOPTIONS": ValueOf(syscall.IP_PKTOPTIONS), + "IP_PMTUDISC": ValueOf(syscall.IP_PMTUDISC), + "IP_PMTUDISC_DO": ValueOf(syscall.IP_PMTUDISC_DO), + "IP_PMTUDISC_DONT": ValueOf(syscall.IP_PMTUDISC_DONT), + "IP_PMTUDISC_PROBE": ValueOf(syscall.IP_PMTUDISC_PROBE), + "IP_PMTUDISC_WANT": ValueOf(syscall.IP_PMTUDISC_WANT), + "IP_RECVERR": ValueOf(syscall.IP_RECVERR), + "IP_RECVOPTS": ValueOf(syscall.IP_RECVOPTS), + "IP_RECVORIGDSTADDR": ValueOf(syscall.IP_RECVORIGDSTADDR), + "IP_RECVRETOPTS": ValueOf(syscall.IP_RECVRETOPTS), + "IP_RECVTOS": ValueOf(syscall.IP_RECVTOS), + "IP_RECVTTL": ValueOf(syscall.IP_RECVTTL), + "IP_RETOPTS": ValueOf(syscall.IP_RETOPTS), + "IP_RF": ValueOf(syscall.IP_RF), + "IP_ROUTER_ALERT": ValueOf(syscall.IP_ROUTER_ALERT), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TRANSPARENT": ValueOf(syscall.IP_TRANSPARENT), + "IP_TTL": ValueOf(syscall.IP_TTL), + "IP_UNBLOCK_SOURCE": ValueOf(syscall.IP_UNBLOCK_SOURCE), + "IP_UNICAST_IF": ValueOf(syscall.IP_UNICAST_IF), + "IP_XFRM_POLICY": ValueOf(syscall.IP_XFRM_POLICY), + "ISIG": ValueOf(syscall.ISIG), + "ISTRIP": ValueOf(syscall.ISTRIP), + "IUCLC": ValueOf(syscall.IUCLC), + "IUTF8": ValueOf(syscall.IUTF8), + "IXANY": ValueOf(syscall.IXANY), + "IXOFF": ValueOf(syscall.IXOFF), + "IXON": ValueOf(syscall.IXON), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "InotifyAddWatch": ValueOf(syscall.InotifyAddWatch), + "InotifyInit": ValueOf(syscall.InotifyInit), + "InotifyInit1": ValueOf(syscall.InotifyInit1), + "InotifyRmWatch": ValueOf(syscall.InotifyRmWatch), + "Kill": ValueOf(syscall.Kill), + "Klogctl": ValueOf(syscall.Klogctl), + "LINUX_REBOOT_CMD_CAD_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_CAD_OFF), + "LINUX_REBOOT_CMD_CAD_ON": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_CAD_ON)), + "LINUX_REBOOT_CMD_HALT": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_HALT)), + "LINUX_REBOOT_CMD_KEXEC": ValueOf(syscall.LINUX_REBOOT_CMD_KEXEC), + "LINUX_REBOOT_CMD_POWER_OFF": ValueOf(syscall.LINUX_REBOOT_CMD_POWER_OFF), + "LINUX_REBOOT_CMD_RESTART": ValueOf(syscall.LINUX_REBOOT_CMD_RESTART), + "LINUX_REBOOT_CMD_RESTART2": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_RESTART2)), + "LINUX_REBOOT_CMD_SW_SUSPEND": ValueOf(uint32(syscall.LINUX_REBOOT_CMD_SW_SUSPEND)), + "LINUX_REBOOT_MAGIC1": ValueOf(uint32(syscall.LINUX_REBOOT_MAGIC1)), + "LINUX_REBOOT_MAGIC2": ValueOf(syscall.LINUX_REBOOT_MAGIC2), + "LOCK_EX": ValueOf(syscall.LOCK_EX), + "LOCK_NB": ValueOf(syscall.LOCK_NB), + "LOCK_SH": ValueOf(syscall.LOCK_SH), + "LOCK_UN": ValueOf(syscall.LOCK_UN), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "Listxattr": ValueOf(syscall.Listxattr), + "LsfJump": ValueOf(syscall.LsfJump), + "LsfSocket": ValueOf(syscall.LsfSocket), + "LsfStmt": ValueOf(syscall.LsfStmt), + "Lstat": ValueOf(syscall.Lstat), + "MADV_DODUMP": ValueOf(syscall.MADV_DODUMP), + "MADV_DOFORK": ValueOf(syscall.MADV_DOFORK), + "MADV_DONTDUMP": ValueOf(syscall.MADV_DONTDUMP), + "MADV_DONTFORK": ValueOf(syscall.MADV_DONTFORK), + "MADV_DONTNEED": ValueOf(syscall.MADV_DONTNEED), + "MADV_HUGEPAGE": ValueOf(syscall.MADV_HUGEPAGE), + "MADV_HWPOISON": ValueOf(syscall.MADV_HWPOISON), + "MADV_MERGEABLE": ValueOf(syscall.MADV_MERGEABLE), + "MADV_NOHUGEPAGE": ValueOf(syscall.MADV_NOHUGEPAGE), + "MADV_NORMAL": ValueOf(syscall.MADV_NORMAL), + "MADV_RANDOM": ValueOf(syscall.MADV_RANDOM), + "MADV_REMOVE": ValueOf(syscall.MADV_REMOVE), + "MADV_SEQUENTIAL": ValueOf(syscall.MADV_SEQUENTIAL), + "MADV_UNMERGEABLE": ValueOf(syscall.MADV_UNMERGEABLE), + "MADV_WILLNEED": ValueOf(syscall.MADV_WILLNEED), + "MAP_ANON": ValueOf(syscall.MAP_ANON), + "MAP_ANONYMOUS": ValueOf(syscall.MAP_ANONYMOUS), + "MAP_DENYWRITE": ValueOf(syscall.MAP_DENYWRITE), + "MAP_EXECUTABLE": ValueOf(syscall.MAP_EXECUTABLE), + "MAP_FILE": ValueOf(syscall.MAP_FILE), + "MAP_FIXED": ValueOf(syscall.MAP_FIXED), + "MAP_GROWSDOWN": ValueOf(syscall.MAP_GROWSDOWN), + "MAP_HUGETLB": ValueOf(syscall.MAP_HUGETLB), + "MAP_HUGE_MASK": ValueOf(syscall.MAP_HUGE_MASK), + "MAP_HUGE_SHIFT": ValueOf(syscall.MAP_HUGE_SHIFT), + "MAP_LOCKED": ValueOf(syscall.MAP_LOCKED), + "MAP_NONBLOCK": ValueOf(syscall.MAP_NONBLOCK), + "MAP_NORESERVE": ValueOf(syscall.MAP_NORESERVE), + "MAP_POPULATE": ValueOf(syscall.MAP_POPULATE), + "MAP_PRIVATE": ValueOf(syscall.MAP_PRIVATE), + "MAP_SHARED": ValueOf(syscall.MAP_SHARED), + "MAP_STACK": ValueOf(syscall.MAP_STACK), + "MAP_TYPE": ValueOf(syscall.MAP_TYPE), + "MCL_CURRENT": ValueOf(syscall.MCL_CURRENT), + "MCL_FUTURE": ValueOf(syscall.MCL_FUTURE), + "MNT_DETACH": ValueOf(syscall.MNT_DETACH), + "MNT_EXPIRE": ValueOf(syscall.MNT_EXPIRE), + "MNT_FORCE": ValueOf(syscall.MNT_FORCE), + "MSG_CMSG_CLOEXEC": ValueOf(syscall.MSG_CMSG_CLOEXEC), + "MSG_CONFIRM": ValueOf(syscall.MSG_CONFIRM), + "MSG_CTRUNC": ValueOf(syscall.MSG_CTRUNC), + "MSG_DONTROUTE": ValueOf(syscall.MSG_DONTROUTE), + "MSG_DONTWAIT": ValueOf(syscall.MSG_DONTWAIT), + "MSG_EOR": ValueOf(syscall.MSG_EOR), + "MSG_ERRQUEUE": ValueOf(syscall.MSG_ERRQUEUE), + "MSG_FASTOPEN": ValueOf(syscall.MSG_FASTOPEN), + "MSG_FIN": ValueOf(syscall.MSG_FIN), + "MSG_MORE": ValueOf(syscall.MSG_MORE), + "MSG_NOSIGNAL": ValueOf(syscall.MSG_NOSIGNAL), + "MSG_OOB": ValueOf(syscall.MSG_OOB), + "MSG_PEEK": ValueOf(syscall.MSG_PEEK), + "MSG_PROXY": ValueOf(syscall.MSG_PROXY), + "MSG_RST": ValueOf(syscall.MSG_RST), + "MSG_SYN": ValueOf(syscall.MSG_SYN), + "MSG_TRUNC": ValueOf(syscall.MSG_TRUNC), + "MSG_TRYHARD": ValueOf(syscall.MSG_TRYHARD), + "MSG_WAITALL": ValueOf(syscall.MSG_WAITALL), + "MSG_WAITFORONE": ValueOf(syscall.MSG_WAITFORONE), + "MS_ACTIVE": ValueOf(syscall.MS_ACTIVE), + "MS_ASYNC": ValueOf(syscall.MS_ASYNC), + "MS_BIND": ValueOf(syscall.MS_BIND), + "MS_DIRSYNC": ValueOf(syscall.MS_DIRSYNC), + "MS_INVALIDATE": ValueOf(syscall.MS_INVALIDATE), + "MS_I_VERSION": ValueOf(syscall.MS_I_VERSION), + "MS_KERNMOUNT": ValueOf(syscall.MS_KERNMOUNT), + "MS_MANDLOCK": ValueOf(syscall.MS_MANDLOCK), + "MS_MGC_MSK": ValueOf(uint32(syscall.MS_MGC_MSK)), + "MS_MGC_VAL": ValueOf(uint32(syscall.MS_MGC_VAL)), + "MS_MOVE": ValueOf(syscall.MS_MOVE), + "MS_NOATIME": ValueOf(syscall.MS_NOATIME), + "MS_NODEV": ValueOf(syscall.MS_NODEV), + "MS_NODIRATIME": ValueOf(syscall.MS_NODIRATIME), + "MS_NOEXEC": ValueOf(syscall.MS_NOEXEC), + "MS_NOSUID": ValueOf(syscall.MS_NOSUID), + "MS_NOUSER": ValueOf(syscall.MS_NOUSER), + "MS_POSIXACL": ValueOf(syscall.MS_POSIXACL), + "MS_PRIVATE": ValueOf(syscall.MS_PRIVATE), + "MS_RDONLY": ValueOf(syscall.MS_RDONLY), + "MS_REC": ValueOf(syscall.MS_REC), + "MS_RELATIME": ValueOf(syscall.MS_RELATIME), + "MS_REMOUNT": ValueOf(syscall.MS_REMOUNT), + "MS_RMT_MASK": ValueOf(syscall.MS_RMT_MASK), + "MS_SHARED": ValueOf(syscall.MS_SHARED), + "MS_SILENT": ValueOf(syscall.MS_SILENT), + "MS_SLAVE": ValueOf(syscall.MS_SLAVE), + "MS_STRICTATIME": ValueOf(syscall.MS_STRICTATIME), + "MS_SYNC": ValueOf(syscall.MS_SYNC), + "MS_SYNCHRONOUS": ValueOf(syscall.MS_SYNCHRONOUS), + "MS_UNBINDABLE": ValueOf(syscall.MS_UNBINDABLE), + "Madvise": ValueOf(syscall.Madvise), + "Mkdir": ValueOf(syscall.Mkdir), + "Mkdirat": ValueOf(syscall.Mkdirat), + "Mkfifo": ValueOf(syscall.Mkfifo), + "Mknod": ValueOf(syscall.Mknod), + "Mknodat": ValueOf(syscall.Mknodat), + "Mlock": ValueOf(syscall.Mlock), + "Mlockall": ValueOf(syscall.Mlockall), + "Mmap": ValueOf(syscall.Mmap), + "Mount": ValueOf(syscall.Mount), + "Mprotect": ValueOf(syscall.Mprotect), + "Munlock": ValueOf(syscall.Munlock), + "Munlockall": ValueOf(syscall.Munlockall), + "Munmap": ValueOf(syscall.Munmap), + "NAME_MAX": ValueOf(syscall.NAME_MAX), + "NETLINK_ADD_MEMBERSHIP": ValueOf(syscall.NETLINK_ADD_MEMBERSHIP), + "NETLINK_AUDIT": ValueOf(syscall.NETLINK_AUDIT), + "NETLINK_BROADCAST_ERROR": ValueOf(syscall.NETLINK_BROADCAST_ERROR), + "NETLINK_CONNECTOR": ValueOf(syscall.NETLINK_CONNECTOR), + "NETLINK_CRYPTO": ValueOf(syscall.NETLINK_CRYPTO), + "NETLINK_DNRTMSG": ValueOf(syscall.NETLINK_DNRTMSG), + "NETLINK_DROP_MEMBERSHIP": ValueOf(syscall.NETLINK_DROP_MEMBERSHIP), + "NETLINK_ECRYPTFS": ValueOf(syscall.NETLINK_ECRYPTFS), + "NETLINK_FIB_LOOKUP": ValueOf(syscall.NETLINK_FIB_LOOKUP), + "NETLINK_FIREWALL": ValueOf(syscall.NETLINK_FIREWALL), + "NETLINK_GENERIC": ValueOf(syscall.NETLINK_GENERIC), + "NETLINK_INET_DIAG": ValueOf(syscall.NETLINK_INET_DIAG), + "NETLINK_IP6_FW": ValueOf(syscall.NETLINK_IP6_FW), + "NETLINK_ISCSI": ValueOf(syscall.NETLINK_ISCSI), + "NETLINK_KOBJECT_UEVENT": ValueOf(syscall.NETLINK_KOBJECT_UEVENT), + "NETLINK_NETFILTER": ValueOf(syscall.NETLINK_NETFILTER), + "NETLINK_NFLOG": ValueOf(syscall.NETLINK_NFLOG), + "NETLINK_NO_ENOBUFS": ValueOf(syscall.NETLINK_NO_ENOBUFS), + "NETLINK_PKTINFO": ValueOf(syscall.NETLINK_PKTINFO), + "NETLINK_RDMA": ValueOf(syscall.NETLINK_RDMA), + "NETLINK_ROUTE": ValueOf(syscall.NETLINK_ROUTE), + "NETLINK_RX_RING": ValueOf(syscall.NETLINK_RX_RING), + "NETLINK_SCSITRANSPORT": ValueOf(syscall.NETLINK_SCSITRANSPORT), + "NETLINK_SELINUX": ValueOf(syscall.NETLINK_SELINUX), + "NETLINK_SOCK_DIAG": ValueOf(syscall.NETLINK_SOCK_DIAG), + "NETLINK_TX_RING": ValueOf(syscall.NETLINK_TX_RING), + "NETLINK_UNUSED": ValueOf(syscall.NETLINK_UNUSED), + "NETLINK_USERSOCK": ValueOf(syscall.NETLINK_USERSOCK), + "NETLINK_XFRM": ValueOf(syscall.NETLINK_XFRM), + "NLA_ALIGNTO": ValueOf(syscall.NLA_ALIGNTO), + "NLA_F_NESTED": ValueOf(syscall.NLA_F_NESTED), + "NLA_F_NET_BYTEORDER": ValueOf(syscall.NLA_F_NET_BYTEORDER), + "NLA_HDRLEN": ValueOf(syscall.NLA_HDRLEN), + "NLMSG_ALIGNTO": ValueOf(syscall.NLMSG_ALIGNTO), + "NLMSG_DONE": ValueOf(syscall.NLMSG_DONE), + "NLMSG_ERROR": ValueOf(syscall.NLMSG_ERROR), + "NLMSG_HDRLEN": ValueOf(syscall.NLMSG_HDRLEN), + "NLMSG_MIN_TYPE": ValueOf(syscall.NLMSG_MIN_TYPE), + "NLMSG_NOOP": ValueOf(syscall.NLMSG_NOOP), + "NLMSG_OVERRUN": ValueOf(syscall.NLMSG_OVERRUN), + "NLM_F_ACK": ValueOf(syscall.NLM_F_ACK), + "NLM_F_APPEND": ValueOf(syscall.NLM_F_APPEND), + "NLM_F_ATOMIC": ValueOf(syscall.NLM_F_ATOMIC), + "NLM_F_CREATE": ValueOf(syscall.NLM_F_CREATE), + "NLM_F_DUMP": ValueOf(syscall.NLM_F_DUMP), + "NLM_F_DUMP_INTR": ValueOf(syscall.NLM_F_DUMP_INTR), + "NLM_F_ECHO": ValueOf(syscall.NLM_F_ECHO), + "NLM_F_EXCL": ValueOf(syscall.NLM_F_EXCL), + "NLM_F_MATCH": ValueOf(syscall.NLM_F_MATCH), + "NLM_F_MULTI": ValueOf(syscall.NLM_F_MULTI), + "NLM_F_REPLACE": ValueOf(syscall.NLM_F_REPLACE), + "NLM_F_REQUEST": ValueOf(syscall.NLM_F_REQUEST), + "NLM_F_ROOT": ValueOf(syscall.NLM_F_ROOT), + "NOFLSH": ValueOf(syscall.NOFLSH), + "Nanosleep": ValueOf(syscall.Nanosleep), + "NetlinkRIB": ValueOf(syscall.NetlinkRIB), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "OCRNL": ValueOf(syscall.OCRNL), + "OFDEL": ValueOf(syscall.OFDEL), + "OFILL": ValueOf(syscall.OFILL), + "OLCUC": ValueOf(syscall.OLCUC), + "ONLCR": ValueOf(syscall.ONLCR), + "ONLRET": ValueOf(syscall.ONLRET), + "ONOCR": ValueOf(syscall.ONOCR), + "OPOST": ValueOf(syscall.OPOST), + "O_ACCMODE": ValueOf(syscall.O_ACCMODE), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_DIRECT": ValueOf(syscall.O_DIRECT), + "O_DIRECTORY": ValueOf(syscall.O_DIRECTORY), + "O_DSYNC": ValueOf(syscall.O_DSYNC), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_FSYNC": ValueOf(syscall.O_FSYNC), + "O_LARGEFILE": ValueOf(syscall.O_LARGEFILE), + "O_NDELAY": ValueOf(syscall.O_NDELAY), + "O_NOATIME": ValueOf(syscall.O_NOATIME), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NOFOLLOW": ValueOf(syscall.O_NOFOLLOW), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_PATH": ValueOf(syscall.O_PATH), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_RSYNC": ValueOf(syscall.O_RSYNC), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TMPFILE": ValueOf(syscall.O_TMPFILE), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "Openat": ValueOf(syscall.Openat), + "PACKET_ADD_MEMBERSHIP": ValueOf(syscall.PACKET_ADD_MEMBERSHIP), + "PACKET_AUXDATA": ValueOf(syscall.PACKET_AUXDATA), + "PACKET_BROADCAST": ValueOf(syscall.PACKET_BROADCAST), + "PACKET_COPY_THRESH": ValueOf(syscall.PACKET_COPY_THRESH), + "PACKET_DROP_MEMBERSHIP": ValueOf(syscall.PACKET_DROP_MEMBERSHIP), + "PACKET_FANOUT": ValueOf(syscall.PACKET_FANOUT), + "PACKET_FANOUT_CPU": ValueOf(syscall.PACKET_FANOUT_CPU), + "PACKET_FANOUT_FLAG_DEFRAG": ValueOf(syscall.PACKET_FANOUT_FLAG_DEFRAG), + "PACKET_FANOUT_FLAG_ROLLOVER": ValueOf(syscall.PACKET_FANOUT_FLAG_ROLLOVER), + "PACKET_FANOUT_HASH": ValueOf(syscall.PACKET_FANOUT_HASH), + "PACKET_FANOUT_LB": ValueOf(syscall.PACKET_FANOUT_LB), + "PACKET_FANOUT_RND": ValueOf(syscall.PACKET_FANOUT_RND), + "PACKET_FANOUT_ROLLOVER": ValueOf(syscall.PACKET_FANOUT_ROLLOVER), + "PACKET_FASTROUTE": ValueOf(syscall.PACKET_FASTROUTE), + "PACKET_HDRLEN": ValueOf(syscall.PACKET_HDRLEN), + "PACKET_HOST": ValueOf(syscall.PACKET_HOST), + "PACKET_LOOPBACK": ValueOf(syscall.PACKET_LOOPBACK), + "PACKET_LOSS": ValueOf(syscall.PACKET_LOSS), + "PACKET_MR_ALLMULTI": ValueOf(syscall.PACKET_MR_ALLMULTI), + "PACKET_MR_MULTICAST": ValueOf(syscall.PACKET_MR_MULTICAST), + "PACKET_MR_PROMISC": ValueOf(syscall.PACKET_MR_PROMISC), + "PACKET_MR_UNICAST": ValueOf(syscall.PACKET_MR_UNICAST), + "PACKET_MULTICAST": ValueOf(syscall.PACKET_MULTICAST), + "PACKET_ORIGDEV": ValueOf(syscall.PACKET_ORIGDEV), + "PACKET_OTHERHOST": ValueOf(syscall.PACKET_OTHERHOST), + "PACKET_OUTGOING": ValueOf(syscall.PACKET_OUTGOING), + "PACKET_RECV_OUTPUT": ValueOf(syscall.PACKET_RECV_OUTPUT), + "PACKET_RESERVE": ValueOf(syscall.PACKET_RESERVE), + "PACKET_RX_RING": ValueOf(syscall.PACKET_RX_RING), + "PACKET_STATISTICS": ValueOf(syscall.PACKET_STATISTICS), + "PACKET_TIMESTAMP": ValueOf(syscall.PACKET_TIMESTAMP), + "PACKET_TX_HAS_OFF": ValueOf(syscall.PACKET_TX_HAS_OFF), + "PACKET_TX_RING": ValueOf(syscall.PACKET_TX_RING), + "PACKET_TX_TIMESTAMP": ValueOf(syscall.PACKET_TX_TIMESTAMP), + "PACKET_VERSION": ValueOf(syscall.PACKET_VERSION), + "PACKET_VNET_HDR": ValueOf(syscall.PACKET_VNET_HDR), + "PARENB": ValueOf(syscall.PARENB), + "PARITY_CRC16_PR0": ValueOf(syscall.PARITY_CRC16_PR0), + "PARITY_CRC16_PR0_CCITT": ValueOf(syscall.PARITY_CRC16_PR0_CCITT), + "PARITY_CRC16_PR1": ValueOf(syscall.PARITY_CRC16_PR1), + "PARITY_CRC16_PR1_CCITT": ValueOf(syscall.PARITY_CRC16_PR1_CCITT), + "PARITY_CRC32_PR0_CCITT": ValueOf(syscall.PARITY_CRC32_PR0_CCITT), + "PARITY_CRC32_PR1_CCITT": ValueOf(syscall.PARITY_CRC32_PR1_CCITT), + "PARITY_DEFAULT": ValueOf(syscall.PARITY_DEFAULT), + "PARITY_NONE": ValueOf(syscall.PARITY_NONE), + "PARMRK": ValueOf(syscall.PARMRK), + "PARODD": ValueOf(syscall.PARODD), + "PENDIN": ValueOf(syscall.PENDIN), + "PRIO_PGRP": ValueOf(syscall.PRIO_PGRP), + "PRIO_PROCESS": ValueOf(syscall.PRIO_PROCESS), + "PRIO_USER": ValueOf(syscall.PRIO_USER), + "PROT_EXEC": ValueOf(syscall.PROT_EXEC), + "PROT_GROWSDOWN": ValueOf(syscall.PROT_GROWSDOWN), + "PROT_GROWSUP": ValueOf(syscall.PROT_GROWSUP), + "PROT_NONE": ValueOf(syscall.PROT_NONE), + "PROT_READ": ValueOf(syscall.PROT_READ), + "PROT_WRITE": ValueOf(syscall.PROT_WRITE), + "PR_CAPBSET_DROP": ValueOf(syscall.PR_CAPBSET_DROP), + "PR_CAPBSET_READ": ValueOf(syscall.PR_CAPBSET_READ), + "PR_ENDIAN_BIG": ValueOf(syscall.PR_ENDIAN_BIG), + "PR_ENDIAN_LITTLE": ValueOf(syscall.PR_ENDIAN_LITTLE), + "PR_ENDIAN_PPC_LITTLE": ValueOf(syscall.PR_ENDIAN_PPC_LITTLE), + "PR_FPEMU_NOPRINT": ValueOf(syscall.PR_FPEMU_NOPRINT), + "PR_FPEMU_SIGFPE": ValueOf(syscall.PR_FPEMU_SIGFPE), + "PR_FP_EXC_ASYNC": ValueOf(syscall.PR_FP_EXC_ASYNC), + "PR_FP_EXC_DISABLED": ValueOf(syscall.PR_FP_EXC_DISABLED), + "PR_FP_EXC_DIV": ValueOf(syscall.PR_FP_EXC_DIV), + "PR_FP_EXC_INV": ValueOf(syscall.PR_FP_EXC_INV), + "PR_FP_EXC_NONRECOV": ValueOf(syscall.PR_FP_EXC_NONRECOV), + "PR_FP_EXC_OVF": ValueOf(syscall.PR_FP_EXC_OVF), + "PR_FP_EXC_PRECISE": ValueOf(syscall.PR_FP_EXC_PRECISE), + "PR_FP_EXC_RES": ValueOf(syscall.PR_FP_EXC_RES), + "PR_FP_EXC_SW_ENABLE": ValueOf(syscall.PR_FP_EXC_SW_ENABLE), + "PR_FP_EXC_UND": ValueOf(syscall.PR_FP_EXC_UND), + "PR_GET_CHILD_SUBREAPER": ValueOf(syscall.PR_GET_CHILD_SUBREAPER), + "PR_GET_DUMPABLE": ValueOf(syscall.PR_GET_DUMPABLE), + "PR_GET_ENDIAN": ValueOf(syscall.PR_GET_ENDIAN), + "PR_GET_FPEMU": ValueOf(syscall.PR_GET_FPEMU), + "PR_GET_FPEXC": ValueOf(syscall.PR_GET_FPEXC), + "PR_GET_KEEPCAPS": ValueOf(syscall.PR_GET_KEEPCAPS), + "PR_GET_NAME": ValueOf(syscall.PR_GET_NAME), + "PR_GET_NO_NEW_PRIVS": ValueOf(syscall.PR_GET_NO_NEW_PRIVS), + "PR_GET_PDEATHSIG": ValueOf(syscall.PR_GET_PDEATHSIG), + "PR_GET_SECCOMP": ValueOf(syscall.PR_GET_SECCOMP), + "PR_GET_SECUREBITS": ValueOf(syscall.PR_GET_SECUREBITS), + "PR_GET_TID_ADDRESS": ValueOf(syscall.PR_GET_TID_ADDRESS), + "PR_GET_TIMERSLACK": ValueOf(syscall.PR_GET_TIMERSLACK), + "PR_GET_TIMING": ValueOf(syscall.PR_GET_TIMING), + "PR_GET_TSC": ValueOf(syscall.PR_GET_TSC), + "PR_GET_UNALIGN": ValueOf(syscall.PR_GET_UNALIGN), + "PR_MCE_KILL": ValueOf(syscall.PR_MCE_KILL), + "PR_MCE_KILL_CLEAR": ValueOf(syscall.PR_MCE_KILL_CLEAR), + "PR_MCE_KILL_DEFAULT": ValueOf(syscall.PR_MCE_KILL_DEFAULT), + "PR_MCE_KILL_EARLY": ValueOf(syscall.PR_MCE_KILL_EARLY), + "PR_MCE_KILL_GET": ValueOf(syscall.PR_MCE_KILL_GET), + "PR_MCE_KILL_LATE": ValueOf(syscall.PR_MCE_KILL_LATE), + "PR_MCE_KILL_SET": ValueOf(syscall.PR_MCE_KILL_SET), + "PR_SET_CHILD_SUBREAPER": ValueOf(syscall.PR_SET_CHILD_SUBREAPER), + "PR_SET_DUMPABLE": ValueOf(syscall.PR_SET_DUMPABLE), + "PR_SET_ENDIAN": ValueOf(syscall.PR_SET_ENDIAN), + "PR_SET_FPEMU": ValueOf(syscall.PR_SET_FPEMU), + "PR_SET_FPEXC": ValueOf(syscall.PR_SET_FPEXC), + "PR_SET_KEEPCAPS": ValueOf(syscall.PR_SET_KEEPCAPS), + "PR_SET_MM": ValueOf(syscall.PR_SET_MM), + "PR_SET_MM_ARG_END": ValueOf(syscall.PR_SET_MM_ARG_END), + "PR_SET_MM_ARG_START": ValueOf(syscall.PR_SET_MM_ARG_START), + "PR_SET_MM_AUXV": ValueOf(syscall.PR_SET_MM_AUXV), + "PR_SET_MM_BRK": ValueOf(syscall.PR_SET_MM_BRK), + "PR_SET_MM_END_CODE": ValueOf(syscall.PR_SET_MM_END_CODE), + "PR_SET_MM_END_DATA": ValueOf(syscall.PR_SET_MM_END_DATA), + "PR_SET_MM_ENV_END": ValueOf(syscall.PR_SET_MM_ENV_END), + "PR_SET_MM_ENV_START": ValueOf(syscall.PR_SET_MM_ENV_START), + "PR_SET_MM_EXE_FILE": ValueOf(syscall.PR_SET_MM_EXE_FILE), + "PR_SET_MM_START_BRK": ValueOf(syscall.PR_SET_MM_START_BRK), + "PR_SET_MM_START_CODE": ValueOf(syscall.PR_SET_MM_START_CODE), + "PR_SET_MM_START_DATA": ValueOf(syscall.PR_SET_MM_START_DATA), + "PR_SET_MM_START_STACK": ValueOf(syscall.PR_SET_MM_START_STACK), + "PR_SET_NAME": ValueOf(syscall.PR_SET_NAME), + "PR_SET_NO_NEW_PRIVS": ValueOf(syscall.PR_SET_NO_NEW_PRIVS), + "PR_SET_PDEATHSIG": ValueOf(syscall.PR_SET_PDEATHSIG), + "PR_SET_PTRACER": ValueOf(syscall.PR_SET_PTRACER), + "PR_SET_PTRACER_ANY": ValueOf(syscall.PR_SET_PTRACER_ANY), + "PR_SET_SECCOMP": ValueOf(syscall.PR_SET_SECCOMP), + "PR_SET_SECUREBITS": ValueOf(syscall.PR_SET_SECUREBITS), + "PR_SET_TIMERSLACK": ValueOf(syscall.PR_SET_TIMERSLACK), + "PR_SET_TIMING": ValueOf(syscall.PR_SET_TIMING), + "PR_SET_TSC": ValueOf(syscall.PR_SET_TSC), + "PR_SET_UNALIGN": ValueOf(syscall.PR_SET_UNALIGN), + "PR_TASK_PERF_EVENTS_DISABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_DISABLE), + "PR_TASK_PERF_EVENTS_ENABLE": ValueOf(syscall.PR_TASK_PERF_EVENTS_ENABLE), + "PR_TIMING_STATISTICAL": ValueOf(syscall.PR_TIMING_STATISTICAL), + "PR_TIMING_TIMESTAMP": ValueOf(syscall.PR_TIMING_TIMESTAMP), + "PR_TSC_ENABLE": ValueOf(syscall.PR_TSC_ENABLE), + "PR_TSC_SIGSEGV": ValueOf(syscall.PR_TSC_SIGSEGV), + "PR_UNALIGN_NOPRINT": ValueOf(syscall.PR_UNALIGN_NOPRINT), + "PR_UNALIGN_SIGBUS": ValueOf(syscall.PR_UNALIGN_SIGBUS), + "PTRACE_ATTACH": ValueOf(syscall.PTRACE_ATTACH), + "PTRACE_CONT": ValueOf(syscall.PTRACE_CONT), + "PTRACE_DETACH": ValueOf(syscall.PTRACE_DETACH), + "PTRACE_EVENT_CLONE": ValueOf(syscall.PTRACE_EVENT_CLONE), + "PTRACE_EVENT_EXEC": ValueOf(syscall.PTRACE_EVENT_EXEC), + "PTRACE_EVENT_EXIT": ValueOf(syscall.PTRACE_EVENT_EXIT), + "PTRACE_EVENT_FORK": ValueOf(syscall.PTRACE_EVENT_FORK), + "PTRACE_EVENT_SECCOMP": ValueOf(syscall.PTRACE_EVENT_SECCOMP), + "PTRACE_EVENT_STOP": ValueOf(syscall.PTRACE_EVENT_STOP), + "PTRACE_EVENT_VFORK": ValueOf(syscall.PTRACE_EVENT_VFORK), + "PTRACE_EVENT_VFORK_DONE": ValueOf(syscall.PTRACE_EVENT_VFORK_DONE), + "PTRACE_GETEVENTMSG": ValueOf(syscall.PTRACE_GETEVENTMSG), + "PTRACE_GETREGS": ValueOf(syscall.PTRACE_GETREGS), + "PTRACE_GETREGSET": ValueOf(syscall.PTRACE_GETREGSET), + "PTRACE_GETSIGINFO": ValueOf(syscall.PTRACE_GETSIGINFO), + "PTRACE_GETSIGMASK": ValueOf(syscall.PTRACE_GETSIGMASK), + "PTRACE_INTERRUPT": ValueOf(syscall.PTRACE_INTERRUPT), + "PTRACE_KILL": ValueOf(syscall.PTRACE_KILL), + "PTRACE_LISTEN": ValueOf(syscall.PTRACE_LISTEN), + "PTRACE_O_EXITKILL": ValueOf(syscall.PTRACE_O_EXITKILL), + "PTRACE_O_MASK": ValueOf(syscall.PTRACE_O_MASK), + "PTRACE_O_TRACECLONE": ValueOf(syscall.PTRACE_O_TRACECLONE), + "PTRACE_O_TRACEEXEC": ValueOf(syscall.PTRACE_O_TRACEEXEC), + "PTRACE_O_TRACEEXIT": ValueOf(syscall.PTRACE_O_TRACEEXIT), + "PTRACE_O_TRACEFORK": ValueOf(syscall.PTRACE_O_TRACEFORK), + "PTRACE_O_TRACESECCOMP": ValueOf(syscall.PTRACE_O_TRACESECCOMP), + "PTRACE_O_TRACESYSGOOD": ValueOf(syscall.PTRACE_O_TRACESYSGOOD), + "PTRACE_O_TRACEVFORK": ValueOf(syscall.PTRACE_O_TRACEVFORK), + "PTRACE_O_TRACEVFORKDONE": ValueOf(syscall.PTRACE_O_TRACEVFORKDONE), + "PTRACE_PEEKDATA": ValueOf(syscall.PTRACE_PEEKDATA), + "PTRACE_PEEKSIGINFO": ValueOf(syscall.PTRACE_PEEKSIGINFO), + "PTRACE_PEEKSIGINFO_SHARED": ValueOf(syscall.PTRACE_PEEKSIGINFO_SHARED), + "PTRACE_PEEKTEXT": ValueOf(syscall.PTRACE_PEEKTEXT), + "PTRACE_PEEKUSR": ValueOf(syscall.PTRACE_PEEKUSR), + "PTRACE_POKEDATA": ValueOf(syscall.PTRACE_POKEDATA), + "PTRACE_POKETEXT": ValueOf(syscall.PTRACE_POKETEXT), + "PTRACE_POKEUSR": ValueOf(syscall.PTRACE_POKEUSR), + "PTRACE_SEIZE": ValueOf(syscall.PTRACE_SEIZE), + "PTRACE_SETOPTIONS": ValueOf(syscall.PTRACE_SETOPTIONS), + "PTRACE_SETREGS": ValueOf(syscall.PTRACE_SETREGS), + "PTRACE_SETREGSET": ValueOf(syscall.PTRACE_SETREGSET), + "PTRACE_SETSIGINFO": ValueOf(syscall.PTRACE_SETSIGINFO), + "PTRACE_SETSIGMASK": ValueOf(syscall.PTRACE_SETSIGMASK), + "PTRACE_SINGLESTEP": ValueOf(syscall.PTRACE_SINGLESTEP), + "PTRACE_SYSCALL": ValueOf(syscall.PTRACE_SYSCALL), + "PTRACE_TRACEME": ValueOf(syscall.PTRACE_TRACEME), + "ParseDirent": ValueOf(syscall.ParseDirent), + "ParseNetlinkMessage": ValueOf(syscall.ParseNetlinkMessage), + "ParseNetlinkRouteAttr": ValueOf(syscall.ParseNetlinkRouteAttr), + "ParseSocketControlMessage": ValueOf(syscall.ParseSocketControlMessage), + "ParseUnixCredentials": ValueOf(syscall.ParseUnixCredentials), + "ParseUnixRights": ValueOf(syscall.ParseUnixRights), + "PathMax": ValueOf(syscall.PathMax), + "Pause": ValueOf(syscall.Pause), + "Pipe": ValueOf(syscall.Pipe), + "Pipe2": ValueOf(syscall.Pipe2), + "PivotRoot": ValueOf(syscall.PivotRoot), + "Pread": ValueOf(syscall.Pread), + "PtraceAttach": ValueOf(syscall.PtraceAttach), + "PtraceCont": ValueOf(syscall.PtraceCont), + "PtraceDetach": ValueOf(syscall.PtraceDetach), + "PtraceGetEventMsg": ValueOf(syscall.PtraceGetEventMsg), + "PtraceGetRegs": ValueOf(syscall.PtraceGetRegs), + "PtracePeekData": ValueOf(syscall.PtracePeekData), + "PtracePeekText": ValueOf(syscall.PtracePeekText), + "PtracePokeData": ValueOf(syscall.PtracePokeData), + "PtracePokeText": ValueOf(syscall.PtracePokeText), + "PtraceSetOptions": ValueOf(syscall.PtraceSetOptions), + "PtraceSetRegs": ValueOf(syscall.PtraceSetRegs), + "PtraceSingleStep": ValueOf(syscall.PtraceSingleStep), + "PtraceSyscall": ValueOf(syscall.PtraceSyscall), + "Pwrite": ValueOf(syscall.Pwrite), + "RLIMIT_AS": ValueOf(syscall.RLIMIT_AS), + "RLIMIT_CORE": ValueOf(syscall.RLIMIT_CORE), + "RLIMIT_CPU": ValueOf(syscall.RLIMIT_CPU), + "RLIMIT_DATA": ValueOf(syscall.RLIMIT_DATA), + "RLIMIT_FSIZE": ValueOf(syscall.RLIMIT_FSIZE), + "RLIMIT_NOFILE": ValueOf(syscall.RLIMIT_NOFILE), + "RLIMIT_STACK": ValueOf(syscall.RLIMIT_STACK), + "RLIM_INFINITY": ValueOf(syscall.RLIM_INFINITY), + "RTAX_ADVMSS": ValueOf(syscall.RTAX_ADVMSS), + "RTAX_CWND": ValueOf(syscall.RTAX_CWND), + "RTAX_FEATURES": ValueOf(syscall.RTAX_FEATURES), + "RTAX_FEATURE_ALLFRAG": ValueOf(syscall.RTAX_FEATURE_ALLFRAG), + "RTAX_FEATURE_ECN": ValueOf(syscall.RTAX_FEATURE_ECN), + "RTAX_FEATURE_SACK": ValueOf(syscall.RTAX_FEATURE_SACK), + "RTAX_FEATURE_TIMESTAMP": ValueOf(syscall.RTAX_FEATURE_TIMESTAMP), + "RTAX_HOPLIMIT": ValueOf(syscall.RTAX_HOPLIMIT), + "RTAX_INITCWND": ValueOf(syscall.RTAX_INITCWND), + "RTAX_INITRWND": ValueOf(syscall.RTAX_INITRWND), + "RTAX_LOCK": ValueOf(syscall.RTAX_LOCK), + "RTAX_MAX": ValueOf(syscall.RTAX_MAX), + "RTAX_MTU": ValueOf(syscall.RTAX_MTU), + "RTAX_QUICKACK": ValueOf(syscall.RTAX_QUICKACK), + "RTAX_REORDERING": ValueOf(syscall.RTAX_REORDERING), + "RTAX_RTO_MIN": ValueOf(syscall.RTAX_RTO_MIN), + "RTAX_RTT": ValueOf(syscall.RTAX_RTT), + "RTAX_RTTVAR": ValueOf(syscall.RTAX_RTTVAR), + "RTAX_SSTHRESH": ValueOf(syscall.RTAX_SSTHRESH), + "RTAX_UNSPEC": ValueOf(syscall.RTAX_UNSPEC), + "RTAX_WINDOW": ValueOf(syscall.RTAX_WINDOW), + "RTA_ALIGNTO": ValueOf(syscall.RTA_ALIGNTO), + "RTA_CACHEINFO": ValueOf(syscall.RTA_CACHEINFO), + "RTA_DST": ValueOf(syscall.RTA_DST), + "RTA_FLOW": ValueOf(syscall.RTA_FLOW), + "RTA_GATEWAY": ValueOf(syscall.RTA_GATEWAY), + "RTA_IIF": ValueOf(syscall.RTA_IIF), + "RTA_MAX": ValueOf(syscall.RTA_MAX), + "RTA_METRICS": ValueOf(syscall.RTA_METRICS), + "RTA_MULTIPATH": ValueOf(syscall.RTA_MULTIPATH), + "RTA_OIF": ValueOf(syscall.RTA_OIF), + "RTA_PREFSRC": ValueOf(syscall.RTA_PREFSRC), + "RTA_PRIORITY": ValueOf(syscall.RTA_PRIORITY), + "RTA_SRC": ValueOf(syscall.RTA_SRC), + "RTA_TABLE": ValueOf(syscall.RTA_TABLE), + "RTA_UNSPEC": ValueOf(syscall.RTA_UNSPEC), + "RTCF_DIRECTSRC": ValueOf(syscall.RTCF_DIRECTSRC), + "RTCF_DOREDIRECT": ValueOf(syscall.RTCF_DOREDIRECT), + "RTCF_LOG": ValueOf(syscall.RTCF_LOG), + "RTCF_MASQ": ValueOf(syscall.RTCF_MASQ), + "RTCF_NAT": ValueOf(syscall.RTCF_NAT), + "RTCF_VALVE": ValueOf(syscall.RTCF_VALVE), + "RTF_ADDRCLASSMASK": ValueOf(uint32(syscall.RTF_ADDRCLASSMASK)), + "RTF_ADDRCONF": ValueOf(syscall.RTF_ADDRCONF), + "RTF_ALLONLINK": ValueOf(syscall.RTF_ALLONLINK), + "RTF_BROADCAST": ValueOf(syscall.RTF_BROADCAST), + "RTF_CACHE": ValueOf(syscall.RTF_CACHE), + "RTF_DEFAULT": ValueOf(syscall.RTF_DEFAULT), + "RTF_DYNAMIC": ValueOf(syscall.RTF_DYNAMIC), + "RTF_FLOW": ValueOf(syscall.RTF_FLOW), + "RTF_GATEWAY": ValueOf(syscall.RTF_GATEWAY), + "RTF_HOST": ValueOf(syscall.RTF_HOST), + "RTF_INTERFACE": ValueOf(syscall.RTF_INTERFACE), + "RTF_IRTT": ValueOf(syscall.RTF_IRTT), + "RTF_LINKRT": ValueOf(syscall.RTF_LINKRT), + "RTF_LOCAL": ValueOf(uint32(syscall.RTF_LOCAL)), + "RTF_MODIFIED": ValueOf(syscall.RTF_MODIFIED), + "RTF_MSS": ValueOf(syscall.RTF_MSS), + "RTF_MTU": ValueOf(syscall.RTF_MTU), + "RTF_MULTICAST": ValueOf(syscall.RTF_MULTICAST), + "RTF_NAT": ValueOf(syscall.RTF_NAT), + "RTF_NOFORWARD": ValueOf(syscall.RTF_NOFORWARD), + "RTF_NONEXTHOP": ValueOf(syscall.RTF_NONEXTHOP), + "RTF_NOPMTUDISC": ValueOf(syscall.RTF_NOPMTUDISC), + "RTF_POLICY": ValueOf(syscall.RTF_POLICY), + "RTF_REINSTATE": ValueOf(syscall.RTF_REINSTATE), + "RTF_REJECT": ValueOf(syscall.RTF_REJECT), + "RTF_STATIC": ValueOf(syscall.RTF_STATIC), + "RTF_THROW": ValueOf(syscall.RTF_THROW), + "RTF_UP": ValueOf(syscall.RTF_UP), + "RTF_WINDOW": ValueOf(syscall.RTF_WINDOW), + "RTF_XRESOLVE": ValueOf(syscall.RTF_XRESOLVE), + "RTM_BASE": ValueOf(syscall.RTM_BASE), + "RTM_DELACTION": ValueOf(syscall.RTM_DELACTION), + "RTM_DELADDR": ValueOf(syscall.RTM_DELADDR), + "RTM_DELADDRLABEL": ValueOf(syscall.RTM_DELADDRLABEL), + "RTM_DELLINK": ValueOf(syscall.RTM_DELLINK), + "RTM_DELMDB": ValueOf(syscall.RTM_DELMDB), + "RTM_DELNEIGH": ValueOf(syscall.RTM_DELNEIGH), + "RTM_DELQDISC": ValueOf(syscall.RTM_DELQDISC), + "RTM_DELROUTE": ValueOf(syscall.RTM_DELROUTE), + "RTM_DELRULE": ValueOf(syscall.RTM_DELRULE), + "RTM_DELTCLASS": ValueOf(syscall.RTM_DELTCLASS), + "RTM_DELTFILTER": ValueOf(syscall.RTM_DELTFILTER), + "RTM_F_CLONED": ValueOf(syscall.RTM_F_CLONED), + "RTM_F_EQUALIZE": ValueOf(syscall.RTM_F_EQUALIZE), + "RTM_F_NOTIFY": ValueOf(syscall.RTM_F_NOTIFY), + "RTM_F_PREFIX": ValueOf(syscall.RTM_F_PREFIX), + "RTM_GETACTION": ValueOf(syscall.RTM_GETACTION), + "RTM_GETADDR": ValueOf(syscall.RTM_GETADDR), + "RTM_GETADDRLABEL": ValueOf(syscall.RTM_GETADDRLABEL), + "RTM_GETANYCAST": ValueOf(syscall.RTM_GETANYCAST), + "RTM_GETDCB": ValueOf(syscall.RTM_GETDCB), + "RTM_GETLINK": ValueOf(syscall.RTM_GETLINK), + "RTM_GETMDB": ValueOf(syscall.RTM_GETMDB), + "RTM_GETMULTICAST": ValueOf(syscall.RTM_GETMULTICAST), + "RTM_GETNEIGH": ValueOf(syscall.RTM_GETNEIGH), + "RTM_GETNEIGHTBL": ValueOf(syscall.RTM_GETNEIGHTBL), + "RTM_GETNETCONF": ValueOf(syscall.RTM_GETNETCONF), + "RTM_GETQDISC": ValueOf(syscall.RTM_GETQDISC), + "RTM_GETROUTE": ValueOf(syscall.RTM_GETROUTE), + "RTM_GETRULE": ValueOf(syscall.RTM_GETRULE), + "RTM_GETTCLASS": ValueOf(syscall.RTM_GETTCLASS), + "RTM_GETTFILTER": ValueOf(syscall.RTM_GETTFILTER), + "RTM_MAX": ValueOf(syscall.RTM_MAX), + "RTM_NEWACTION": ValueOf(syscall.RTM_NEWACTION), + "RTM_NEWADDR": ValueOf(syscall.RTM_NEWADDR), + "RTM_NEWADDRLABEL": ValueOf(syscall.RTM_NEWADDRLABEL), + "RTM_NEWLINK": ValueOf(syscall.RTM_NEWLINK), + "RTM_NEWMDB": ValueOf(syscall.RTM_NEWMDB), + "RTM_NEWNDUSEROPT": ValueOf(syscall.RTM_NEWNDUSEROPT), + "RTM_NEWNEIGH": ValueOf(syscall.RTM_NEWNEIGH), + "RTM_NEWNEIGHTBL": ValueOf(syscall.RTM_NEWNEIGHTBL), + "RTM_NEWNETCONF": ValueOf(syscall.RTM_NEWNETCONF), + "RTM_NEWPREFIX": ValueOf(syscall.RTM_NEWPREFIX), + "RTM_NEWQDISC": ValueOf(syscall.RTM_NEWQDISC), + "RTM_NEWROUTE": ValueOf(syscall.RTM_NEWROUTE), + "RTM_NEWRULE": ValueOf(syscall.RTM_NEWRULE), + "RTM_NEWTCLASS": ValueOf(syscall.RTM_NEWTCLASS), + "RTM_NEWTFILTER": ValueOf(syscall.RTM_NEWTFILTER), + "RTM_NR_FAMILIES": ValueOf(syscall.RTM_NR_FAMILIES), + "RTM_NR_MSGTYPES": ValueOf(syscall.RTM_NR_MSGTYPES), + "RTM_SETDCB": ValueOf(syscall.RTM_SETDCB), + "RTM_SETLINK": ValueOf(syscall.RTM_SETLINK), + "RTM_SETNEIGHTBL": ValueOf(syscall.RTM_SETNEIGHTBL), + "RTNH_ALIGNTO": ValueOf(syscall.RTNH_ALIGNTO), + "RTNH_F_DEAD": ValueOf(syscall.RTNH_F_DEAD), + "RTNH_F_ONLINK": ValueOf(syscall.RTNH_F_ONLINK), + "RTNH_F_PERVASIVE": ValueOf(syscall.RTNH_F_PERVASIVE), + "RTNLGRP_IPV4_IFADDR": ValueOf(syscall.RTNLGRP_IPV4_IFADDR), + "RTNLGRP_IPV4_MROUTE": ValueOf(syscall.RTNLGRP_IPV4_MROUTE), + "RTNLGRP_IPV4_ROUTE": ValueOf(syscall.RTNLGRP_IPV4_ROUTE), + "RTNLGRP_IPV4_RULE": ValueOf(syscall.RTNLGRP_IPV4_RULE), + "RTNLGRP_IPV6_IFADDR": ValueOf(syscall.RTNLGRP_IPV6_IFADDR), + "RTNLGRP_IPV6_IFINFO": ValueOf(syscall.RTNLGRP_IPV6_IFINFO), + "RTNLGRP_IPV6_MROUTE": ValueOf(syscall.RTNLGRP_IPV6_MROUTE), + "RTNLGRP_IPV6_PREFIX": ValueOf(syscall.RTNLGRP_IPV6_PREFIX), + "RTNLGRP_IPV6_ROUTE": ValueOf(syscall.RTNLGRP_IPV6_ROUTE), + "RTNLGRP_IPV6_RULE": ValueOf(syscall.RTNLGRP_IPV6_RULE), + "RTNLGRP_LINK": ValueOf(syscall.RTNLGRP_LINK), + "RTNLGRP_ND_USEROPT": ValueOf(syscall.RTNLGRP_ND_USEROPT), + "RTNLGRP_NEIGH": ValueOf(syscall.RTNLGRP_NEIGH), + "RTNLGRP_NONE": ValueOf(syscall.RTNLGRP_NONE), + "RTNLGRP_NOTIFY": ValueOf(syscall.RTNLGRP_NOTIFY), + "RTNLGRP_TC": ValueOf(syscall.RTNLGRP_TC), + "RTN_ANYCAST": ValueOf(syscall.RTN_ANYCAST), + "RTN_BLACKHOLE": ValueOf(syscall.RTN_BLACKHOLE), + "RTN_BROADCAST": ValueOf(syscall.RTN_BROADCAST), + "RTN_LOCAL": ValueOf(syscall.RTN_LOCAL), + "RTN_MAX": ValueOf(syscall.RTN_MAX), + "RTN_MULTICAST": ValueOf(syscall.RTN_MULTICAST), + "RTN_NAT": ValueOf(syscall.RTN_NAT), + "RTN_PROHIBIT": ValueOf(syscall.RTN_PROHIBIT), + "RTN_THROW": ValueOf(syscall.RTN_THROW), + "RTN_UNICAST": ValueOf(syscall.RTN_UNICAST), + "RTN_UNREACHABLE": ValueOf(syscall.RTN_UNREACHABLE), + "RTN_UNSPEC": ValueOf(syscall.RTN_UNSPEC), + "RTN_XRESOLVE": ValueOf(syscall.RTN_XRESOLVE), + "RTPROT_BIRD": ValueOf(syscall.RTPROT_BIRD), + "RTPROT_BOOT": ValueOf(syscall.RTPROT_BOOT), + "RTPROT_DHCP": ValueOf(syscall.RTPROT_DHCP), + "RTPROT_DNROUTED": ValueOf(syscall.RTPROT_DNROUTED), + "RTPROT_GATED": ValueOf(syscall.RTPROT_GATED), + "RTPROT_KERNEL": ValueOf(syscall.RTPROT_KERNEL), + "RTPROT_MROUTED": ValueOf(syscall.RTPROT_MROUTED), + "RTPROT_MRT": ValueOf(syscall.RTPROT_MRT), + "RTPROT_NTK": ValueOf(syscall.RTPROT_NTK), + "RTPROT_RA": ValueOf(syscall.RTPROT_RA), + "RTPROT_REDIRECT": ValueOf(syscall.RTPROT_REDIRECT), + "RTPROT_STATIC": ValueOf(syscall.RTPROT_STATIC), + "RTPROT_UNSPEC": ValueOf(syscall.RTPROT_UNSPEC), + "RTPROT_XORP": ValueOf(syscall.RTPROT_XORP), + "RTPROT_ZEBRA": ValueOf(syscall.RTPROT_ZEBRA), + "RT_CLASS_DEFAULT": ValueOf(syscall.RT_CLASS_DEFAULT), + "RT_CLASS_LOCAL": ValueOf(syscall.RT_CLASS_LOCAL), + "RT_CLASS_MAIN": ValueOf(syscall.RT_CLASS_MAIN), + "RT_CLASS_MAX": ValueOf(syscall.RT_CLASS_MAX), + "RT_CLASS_UNSPEC": ValueOf(syscall.RT_CLASS_UNSPEC), + "RT_SCOPE_HOST": ValueOf(syscall.RT_SCOPE_HOST), + "RT_SCOPE_LINK": ValueOf(syscall.RT_SCOPE_LINK), + "RT_SCOPE_NOWHERE": ValueOf(syscall.RT_SCOPE_NOWHERE), + "RT_SCOPE_SITE": ValueOf(syscall.RT_SCOPE_SITE), + "RT_SCOPE_UNIVERSE": ValueOf(syscall.RT_SCOPE_UNIVERSE), + "RT_TABLE_COMPAT": ValueOf(syscall.RT_TABLE_COMPAT), + "RT_TABLE_DEFAULT": ValueOf(syscall.RT_TABLE_DEFAULT), + "RT_TABLE_LOCAL": ValueOf(syscall.RT_TABLE_LOCAL), + "RT_TABLE_MAIN": ValueOf(syscall.RT_TABLE_MAIN), + "RT_TABLE_MAX": ValueOf(uint32(syscall.RT_TABLE_MAX)), + "RT_TABLE_UNSPEC": ValueOf(syscall.RT_TABLE_UNSPEC), + "RUSAGE_CHILDREN": ValueOf(syscall.RUSAGE_CHILDREN), + "RUSAGE_SELF": ValueOf(syscall.RUSAGE_SELF), + "RUSAGE_THREAD": ValueOf(syscall.RUSAGE_THREAD), + "RawSyscall": ValueOf(syscall.RawSyscall), + "RawSyscall6": ValueOf(syscall.RawSyscall6), + "Read": ValueOf(syscall.Read), + "ReadDirent": ValueOf(syscall.ReadDirent), + "Readlink": ValueOf(syscall.Readlink), + "Reboot": ValueOf(syscall.Reboot), + "Recvfrom": ValueOf(syscall.Recvfrom), + "Recvmsg": ValueOf(syscall.Recvmsg), + "Removexattr": ValueOf(syscall.Removexattr), + "Rename": ValueOf(syscall.Rename), + "Renameat": ValueOf(syscall.Renameat), + "Rmdir": ValueOf(syscall.Rmdir), + "SCM_CREDENTIALS": ValueOf(syscall.SCM_CREDENTIALS), + "SCM_RIGHTS": ValueOf(syscall.SCM_RIGHTS), + "SCM_TIMESTAMP": ValueOf(syscall.SCM_TIMESTAMP), + "SCM_TIMESTAMPING": ValueOf(syscall.SCM_TIMESTAMPING), + "SCM_TIMESTAMPNS": ValueOf(syscall.SCM_TIMESTAMPNS), + "SCM_WIFI_STATUS": ValueOf(syscall.SCM_WIFI_STATUS), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGCHLD": ValueOf(syscall.SIGCHLD), + "SIGCLD": ValueOf(syscall.SIGCLD), + "SIGCONT": ValueOf(syscall.SIGCONT), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGIO": ValueOf(syscall.SIGIO), + "SIGIOT": ValueOf(syscall.SIGIOT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGPOLL": ValueOf(syscall.SIGPOLL), + "SIGPROF": ValueOf(syscall.SIGPROF), + "SIGPWR": ValueOf(syscall.SIGPWR), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGSTKFLT": ValueOf(syscall.SIGSTKFLT), + "SIGSTOP": ValueOf(syscall.SIGSTOP), + "SIGSYS": ValueOf(syscall.SIGSYS), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIGTSTP": ValueOf(syscall.SIGTSTP), + "SIGTTIN": ValueOf(syscall.SIGTTIN), + "SIGTTOU": ValueOf(syscall.SIGTTOU), + "SIGUNUSED": ValueOf(syscall.SIGUNUSED), + "SIGURG": ValueOf(syscall.SIGURG), + "SIGUSR1": ValueOf(syscall.SIGUSR1), + "SIGUSR2": ValueOf(syscall.SIGUSR2), + "SIGVTALRM": ValueOf(syscall.SIGVTALRM), + "SIGWINCH": ValueOf(syscall.SIGWINCH), + "SIGXCPU": ValueOf(syscall.SIGXCPU), + "SIGXFSZ": ValueOf(syscall.SIGXFSZ), + "SIOCADDDLCI": ValueOf(syscall.SIOCADDDLCI), + "SIOCADDMULTI": ValueOf(syscall.SIOCADDMULTI), + "SIOCADDRT": ValueOf(syscall.SIOCADDRT), + "SIOCATMARK": ValueOf(syscall.SIOCATMARK), + "SIOCDARP": ValueOf(syscall.SIOCDARP), + "SIOCDELDLCI": ValueOf(syscall.SIOCDELDLCI), + "SIOCDELMULTI": ValueOf(syscall.SIOCDELMULTI), + "SIOCDELRT": ValueOf(syscall.SIOCDELRT), + "SIOCDEVPRIVATE": ValueOf(syscall.SIOCDEVPRIVATE), + "SIOCDIFADDR": ValueOf(syscall.SIOCDIFADDR), + "SIOCDRARP": ValueOf(syscall.SIOCDRARP), + "SIOCGARP": ValueOf(syscall.SIOCGARP), + "SIOCGIFADDR": ValueOf(syscall.SIOCGIFADDR), + "SIOCGIFBR": ValueOf(syscall.SIOCGIFBR), + "SIOCGIFBRDADDR": ValueOf(syscall.SIOCGIFBRDADDR), + "SIOCGIFCONF": ValueOf(syscall.SIOCGIFCONF), + "SIOCGIFCOUNT": ValueOf(syscall.SIOCGIFCOUNT), + "SIOCGIFDSTADDR": ValueOf(syscall.SIOCGIFDSTADDR), + "SIOCGIFENCAP": ValueOf(syscall.SIOCGIFENCAP), + "SIOCGIFFLAGS": ValueOf(syscall.SIOCGIFFLAGS), + "SIOCGIFHWADDR": ValueOf(syscall.SIOCGIFHWADDR), + "SIOCGIFINDEX": ValueOf(syscall.SIOCGIFINDEX), + "SIOCGIFMAP": ValueOf(syscall.SIOCGIFMAP), + "SIOCGIFMEM": ValueOf(syscall.SIOCGIFMEM), + "SIOCGIFMETRIC": ValueOf(syscall.SIOCGIFMETRIC), + "SIOCGIFMTU": ValueOf(syscall.SIOCGIFMTU), + "SIOCGIFNAME": ValueOf(syscall.SIOCGIFNAME), + "SIOCGIFNETMASK": ValueOf(syscall.SIOCGIFNETMASK), + "SIOCGIFPFLAGS": ValueOf(syscall.SIOCGIFPFLAGS), + "SIOCGIFSLAVE": ValueOf(syscall.SIOCGIFSLAVE), + "SIOCGIFTXQLEN": ValueOf(syscall.SIOCGIFTXQLEN), + "SIOCGPGRP": ValueOf(syscall.SIOCGPGRP), + "SIOCGRARP": ValueOf(syscall.SIOCGRARP), + "SIOCGSTAMP": ValueOf(syscall.SIOCGSTAMP), + "SIOCGSTAMPNS": ValueOf(syscall.SIOCGSTAMPNS), + "SIOCPROTOPRIVATE": ValueOf(syscall.SIOCPROTOPRIVATE), + "SIOCRTMSG": ValueOf(syscall.SIOCRTMSG), + "SIOCSARP": ValueOf(syscall.SIOCSARP), + "SIOCSIFADDR": ValueOf(syscall.SIOCSIFADDR), + "SIOCSIFBR": ValueOf(syscall.SIOCSIFBR), + "SIOCSIFBRDADDR": ValueOf(syscall.SIOCSIFBRDADDR), + "SIOCSIFDSTADDR": ValueOf(syscall.SIOCSIFDSTADDR), + "SIOCSIFENCAP": ValueOf(syscall.SIOCSIFENCAP), + "SIOCSIFFLAGS": ValueOf(syscall.SIOCSIFFLAGS), + "SIOCSIFHWADDR": ValueOf(syscall.SIOCSIFHWADDR), + "SIOCSIFHWBROADCAST": ValueOf(syscall.SIOCSIFHWBROADCAST), + "SIOCSIFLINK": ValueOf(syscall.SIOCSIFLINK), + "SIOCSIFMAP": ValueOf(syscall.SIOCSIFMAP), + "SIOCSIFMEM": ValueOf(syscall.SIOCSIFMEM), + "SIOCSIFMETRIC": ValueOf(syscall.SIOCSIFMETRIC), + "SIOCSIFMTU": ValueOf(syscall.SIOCSIFMTU), + "SIOCSIFNAME": ValueOf(syscall.SIOCSIFNAME), + "SIOCSIFNETMASK": ValueOf(syscall.SIOCSIFNETMASK), + "SIOCSIFPFLAGS": ValueOf(syscall.SIOCSIFPFLAGS), + "SIOCSIFSLAVE": ValueOf(syscall.SIOCSIFSLAVE), + "SIOCSIFTXQLEN": ValueOf(syscall.SIOCSIFTXQLEN), + "SIOCSPGRP": ValueOf(syscall.SIOCSPGRP), + "SIOCSRARP": ValueOf(syscall.SIOCSRARP), + "SOCK_CLOEXEC": ValueOf(syscall.SOCK_CLOEXEC), + "SOCK_DCCP": ValueOf(syscall.SOCK_DCCP), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_NONBLOCK": ValueOf(syscall.SOCK_NONBLOCK), + "SOCK_PACKET": ValueOf(syscall.SOCK_PACKET), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_RDM": ValueOf(syscall.SOCK_RDM), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_AAL": ValueOf(syscall.SOL_AAL), + "SOL_ATM": ValueOf(syscall.SOL_ATM), + "SOL_DECNET": ValueOf(syscall.SOL_DECNET), + "SOL_ICMPV6": ValueOf(syscall.SOL_ICMPV6), + "SOL_IP": ValueOf(syscall.SOL_IP), + "SOL_IPV6": ValueOf(syscall.SOL_IPV6), + "SOL_IRDA": ValueOf(syscall.SOL_IRDA), + "SOL_PACKET": ValueOf(syscall.SOL_PACKET), + "SOL_RAW": ValueOf(syscall.SOL_RAW), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOL_TCP": ValueOf(syscall.SOL_TCP), + "SOL_X25": ValueOf(syscall.SOL_X25), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_ACCEPTCONN": ValueOf(syscall.SO_ACCEPTCONN), + "SO_ATTACH_FILTER": ValueOf(syscall.SO_ATTACH_FILTER), + "SO_BINDTODEVICE": ValueOf(syscall.SO_BINDTODEVICE), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_BSDCOMPAT": ValueOf(syscall.SO_BSDCOMPAT), + "SO_BUSY_POLL": ValueOf(syscall.SO_BUSY_POLL), + "SO_DEBUG": ValueOf(syscall.SO_DEBUG), + "SO_DETACH_FILTER": ValueOf(syscall.SO_DETACH_FILTER), + "SO_DOMAIN": ValueOf(syscall.SO_DOMAIN), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_ERROR": ValueOf(syscall.SO_ERROR), + "SO_GET_FILTER": ValueOf(syscall.SO_GET_FILTER), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_LOCK_FILTER": ValueOf(syscall.SO_LOCK_FILTER), + "SO_MARK": ValueOf(syscall.SO_MARK), + "SO_MAX_PACING_RATE": ValueOf(syscall.SO_MAX_PACING_RATE), + "SO_NOFCS": ValueOf(syscall.SO_NOFCS), + "SO_NO_CHECK": ValueOf(syscall.SO_NO_CHECK), + "SO_OOBINLINE": ValueOf(syscall.SO_OOBINLINE), + "SO_PASSCRED": ValueOf(syscall.SO_PASSCRED), + "SO_PASSSEC": ValueOf(syscall.SO_PASSSEC), + "SO_PEEK_OFF": ValueOf(syscall.SO_PEEK_OFF), + "SO_PEERCRED": ValueOf(syscall.SO_PEERCRED), + "SO_PEERNAME": ValueOf(syscall.SO_PEERNAME), + "SO_PEERSEC": ValueOf(syscall.SO_PEERSEC), + "SO_PRIORITY": ValueOf(syscall.SO_PRIORITY), + "SO_PROTOCOL": ValueOf(syscall.SO_PROTOCOL), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_RCVBUFFORCE": ValueOf(syscall.SO_RCVBUFFORCE), + "SO_RCVLOWAT": ValueOf(syscall.SO_RCVLOWAT), + "SO_RCVTIMEO": ValueOf(syscall.SO_RCVTIMEO), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_REUSEPORT": ValueOf(syscall.SO_REUSEPORT), + "SO_RXQ_OVFL": ValueOf(syscall.SO_RXQ_OVFL), + "SO_SECURITY_AUTHENTICATION": ValueOf(syscall.SO_SECURITY_AUTHENTICATION), + "SO_SECURITY_ENCRYPTION_NETWORK": ValueOf(syscall.SO_SECURITY_ENCRYPTION_NETWORK), + "SO_SECURITY_ENCRYPTION_TRANSPORT": ValueOf(syscall.SO_SECURITY_ENCRYPTION_TRANSPORT), + "SO_SELECT_ERR_QUEUE": ValueOf(syscall.SO_SELECT_ERR_QUEUE), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_SNDBUFFORCE": ValueOf(syscall.SO_SNDBUFFORCE), + "SO_SNDLOWAT": ValueOf(syscall.SO_SNDLOWAT), + "SO_SNDTIMEO": ValueOf(syscall.SO_SNDTIMEO), + "SO_TIMESTAMP": ValueOf(syscall.SO_TIMESTAMP), + "SO_TIMESTAMPING": ValueOf(syscall.SO_TIMESTAMPING), + "SO_TIMESTAMPNS": ValueOf(syscall.SO_TIMESTAMPNS), + "SO_TYPE": ValueOf(syscall.SO_TYPE), + "SO_WIFI_STATUS": ValueOf(syscall.SO_WIFI_STATUS), + "SYS_ACCEPT": ValueOf(syscall.SYS_ACCEPT), + "SYS_ACCEPT4": ValueOf(syscall.SYS_ACCEPT4), + "SYS_ACCT": ValueOf(syscall.SYS_ACCT), + "SYS_ADD_KEY": ValueOf(syscall.SYS_ADD_KEY), + "SYS_ADJTIMEX": ValueOf(syscall.SYS_ADJTIMEX), + "SYS_ARCH_SPECIFIC_SYSCALL": ValueOf(syscall.SYS_ARCH_SPECIFIC_SYSCALL), + "SYS_BIND": ValueOf(syscall.SYS_BIND), + "SYS_BPF": ValueOf(syscall.SYS_BPF), + "SYS_BRK": ValueOf(syscall.SYS_BRK), + "SYS_CAPGET": ValueOf(syscall.SYS_CAPGET), + "SYS_CAPSET": ValueOf(syscall.SYS_CAPSET), + "SYS_CHDIR": ValueOf(syscall.SYS_CHDIR), + "SYS_CHROOT": ValueOf(syscall.SYS_CHROOT), + "SYS_CLOCK_ADJTIME": ValueOf(syscall.SYS_CLOCK_ADJTIME), + "SYS_CLOCK_GETRES": ValueOf(syscall.SYS_CLOCK_GETRES), + "SYS_CLOCK_GETTIME": ValueOf(syscall.SYS_CLOCK_GETTIME), + "SYS_CLOCK_NANOSLEEP": ValueOf(syscall.SYS_CLOCK_NANOSLEEP), + "SYS_CLOCK_SETTIME": ValueOf(syscall.SYS_CLOCK_SETTIME), + "SYS_CLONE": ValueOf(syscall.SYS_CLONE), + "SYS_CLOSE": ValueOf(syscall.SYS_CLOSE), + "SYS_CONNECT": ValueOf(syscall.SYS_CONNECT), + "SYS_DELETE_MODULE": ValueOf(syscall.SYS_DELETE_MODULE), + "SYS_DUP": ValueOf(syscall.SYS_DUP), + "SYS_DUP3": ValueOf(syscall.SYS_DUP3), + "SYS_EPOLL_CREATE": ValueOf(syscall.SYS_EPOLL_CREATE), + "SYS_EPOLL_CREATE1": ValueOf(syscall.SYS_EPOLL_CREATE1), + "SYS_EPOLL_CTL": ValueOf(syscall.SYS_EPOLL_CTL), + "SYS_EPOLL_PWAIT": ValueOf(syscall.SYS_EPOLL_PWAIT), + "SYS_EPOLL_WAIT": ValueOf(syscall.SYS_EPOLL_WAIT), + "SYS_EVENTFD2": ValueOf(syscall.SYS_EVENTFD2), + "SYS_EXECVE": ValueOf(syscall.SYS_EXECVE), + "SYS_EXECVEAT": ValueOf(syscall.SYS_EXECVEAT), + "SYS_EXIT": ValueOf(syscall.SYS_EXIT), + "SYS_EXIT_GROUP": ValueOf(syscall.SYS_EXIT_GROUP), + "SYS_FACCESSAT": ValueOf(syscall.SYS_FACCESSAT), + "SYS_FADVISE64": ValueOf(syscall.SYS_FADVISE64), + "SYS_FALLOCATE": ValueOf(syscall.SYS_FALLOCATE), + "SYS_FANOTIFY_INIT": ValueOf(syscall.SYS_FANOTIFY_INIT), + "SYS_FANOTIFY_MARK": ValueOf(syscall.SYS_FANOTIFY_MARK), + "SYS_FCHDIR": ValueOf(syscall.SYS_FCHDIR), + "SYS_FCHMOD": ValueOf(syscall.SYS_FCHMOD), + "SYS_FCHMODAT": ValueOf(syscall.SYS_FCHMODAT), + "SYS_FCHOWN": ValueOf(syscall.SYS_FCHOWN), + "SYS_FCHOWNAT": ValueOf(syscall.SYS_FCHOWNAT), + "SYS_FCNTL": ValueOf(syscall.SYS_FCNTL), + "SYS_FDATASYNC": ValueOf(syscall.SYS_FDATASYNC), + "SYS_FGETXATTR": ValueOf(syscall.SYS_FGETXATTR), + "SYS_FINIT_MODULE": ValueOf(syscall.SYS_FINIT_MODULE), + "SYS_FLISTXATTR": ValueOf(syscall.SYS_FLISTXATTR), + "SYS_FLOCK": ValueOf(syscall.SYS_FLOCK), + "SYS_FREMOVEXATTR": ValueOf(syscall.SYS_FREMOVEXATTR), + "SYS_FSETXATTR": ValueOf(syscall.SYS_FSETXATTR), + "SYS_FSTAT": ValueOf(syscall.SYS_FSTAT), + "SYS_FSTATAT": ValueOf(syscall.SYS_FSTATAT), + "SYS_FSTATFS": ValueOf(syscall.SYS_FSTATFS), + "SYS_FSYNC": ValueOf(syscall.SYS_FSYNC), + "SYS_FTRUNCATE": ValueOf(syscall.SYS_FTRUNCATE), + "SYS_FUTEX": ValueOf(syscall.SYS_FUTEX), + "SYS_FUTIMESAT": ValueOf(syscall.SYS_FUTIMESAT), + "SYS_GETCPU": ValueOf(syscall.SYS_GETCPU), + "SYS_GETCWD": ValueOf(syscall.SYS_GETCWD), + "SYS_GETDENTS64": ValueOf(syscall.SYS_GETDENTS64), + "SYS_GETEGID": ValueOf(syscall.SYS_GETEGID), + "SYS_GETEUID": ValueOf(syscall.SYS_GETEUID), + "SYS_GETGID": ValueOf(syscall.SYS_GETGID), + "SYS_GETGROUPS": ValueOf(syscall.SYS_GETGROUPS), + "SYS_GETITIMER": ValueOf(syscall.SYS_GETITIMER), + "SYS_GETPEERNAME": ValueOf(syscall.SYS_GETPEERNAME), + "SYS_GETPGID": ValueOf(syscall.SYS_GETPGID), + "SYS_GETPGRP": ValueOf(syscall.SYS_GETPGRP), + "SYS_GETPID": ValueOf(syscall.SYS_GETPID), + "SYS_GETPPID": ValueOf(syscall.SYS_GETPPID), + "SYS_GETPRIORITY": ValueOf(syscall.SYS_GETPRIORITY), + "SYS_GETRANDOM": ValueOf(syscall.SYS_GETRANDOM), + "SYS_GETRESGID": ValueOf(syscall.SYS_GETRESGID), + "SYS_GETRESUID": ValueOf(syscall.SYS_GETRESUID), + "SYS_GETRLIMIT": ValueOf(syscall.SYS_GETRLIMIT), + "SYS_GETRUSAGE": ValueOf(syscall.SYS_GETRUSAGE), + "SYS_GETSID": ValueOf(syscall.SYS_GETSID), + "SYS_GETSOCKNAME": ValueOf(syscall.SYS_GETSOCKNAME), + "SYS_GETSOCKOPT": ValueOf(syscall.SYS_GETSOCKOPT), + "SYS_GETTID": ValueOf(syscall.SYS_GETTID), + "SYS_GETTIMEOFDAY": ValueOf(syscall.SYS_GETTIMEOFDAY), + "SYS_GETUID": ValueOf(syscall.SYS_GETUID), + "SYS_GETXATTR": ValueOf(syscall.SYS_GETXATTR), + "SYS_GET_MEMPOLICY": ValueOf(syscall.SYS_GET_MEMPOLICY), + "SYS_GET_ROBUST_LIST": ValueOf(syscall.SYS_GET_ROBUST_LIST), + "SYS_INIT_MODULE": ValueOf(syscall.SYS_INIT_MODULE), + "SYS_INOTIFY_ADD_WATCH": ValueOf(syscall.SYS_INOTIFY_ADD_WATCH), + "SYS_INOTIFY_INIT1": ValueOf(syscall.SYS_INOTIFY_INIT1), + "SYS_INOTIFY_RM_WATCH": ValueOf(syscall.SYS_INOTIFY_RM_WATCH), + "SYS_IOCTL": ValueOf(syscall.SYS_IOCTL), + "SYS_IOPRIO_GET": ValueOf(syscall.SYS_IOPRIO_GET), + "SYS_IOPRIO_SET": ValueOf(syscall.SYS_IOPRIO_SET), + "SYS_IO_CANCEL": ValueOf(syscall.SYS_IO_CANCEL), + "SYS_IO_DESTROY": ValueOf(syscall.SYS_IO_DESTROY), + "SYS_IO_GETEVENTS": ValueOf(syscall.SYS_IO_GETEVENTS), + "SYS_IO_SETUP": ValueOf(syscall.SYS_IO_SETUP), + "SYS_IO_SUBMIT": ValueOf(syscall.SYS_IO_SUBMIT), + "SYS_KCMP": ValueOf(syscall.SYS_KCMP), + "SYS_KEXEC_LOAD": ValueOf(syscall.SYS_KEXEC_LOAD), + "SYS_KEYCTL": ValueOf(syscall.SYS_KEYCTL), + "SYS_KILL": ValueOf(syscall.SYS_KILL), + "SYS_LCHOWN": ValueOf(syscall.SYS_LCHOWN), + "SYS_LGETXATTR": ValueOf(syscall.SYS_LGETXATTR), + "SYS_LINKAT": ValueOf(syscall.SYS_LINKAT), + "SYS_LISTEN": ValueOf(syscall.SYS_LISTEN), + "SYS_LISTXATTR": ValueOf(syscall.SYS_LISTXATTR), + "SYS_LLISTXATTR": ValueOf(syscall.SYS_LLISTXATTR), + "SYS_LOOKUP_DCOOKIE": ValueOf(syscall.SYS_LOOKUP_DCOOKIE), + "SYS_LREMOVEXATTR": ValueOf(syscall.SYS_LREMOVEXATTR), + "SYS_LSEEK": ValueOf(syscall.SYS_LSEEK), + "SYS_LSETXATTR": ValueOf(syscall.SYS_LSETXATTR), + "SYS_MADVISE": ValueOf(syscall.SYS_MADVISE), + "SYS_MBIND": ValueOf(syscall.SYS_MBIND), + "SYS_MEMFD_CREATE": ValueOf(syscall.SYS_MEMFD_CREATE), + "SYS_MIGRATE_PAGES": ValueOf(syscall.SYS_MIGRATE_PAGES), + "SYS_MINCORE": ValueOf(syscall.SYS_MINCORE), + "SYS_MKDIRAT": ValueOf(syscall.SYS_MKDIRAT), + "SYS_MKNODAT": ValueOf(syscall.SYS_MKNODAT), + "SYS_MLOCK": ValueOf(syscall.SYS_MLOCK), + "SYS_MLOCKALL": ValueOf(syscall.SYS_MLOCKALL), + "SYS_MMAP": ValueOf(syscall.SYS_MMAP), + "SYS_MOUNT": ValueOf(syscall.SYS_MOUNT), + "SYS_MOVE_PAGES": ValueOf(syscall.SYS_MOVE_PAGES), + "SYS_MPROTECT": ValueOf(syscall.SYS_MPROTECT), + "SYS_MQ_GETSETATTR": ValueOf(syscall.SYS_MQ_GETSETATTR), + "SYS_MQ_NOTIFY": ValueOf(syscall.SYS_MQ_NOTIFY), + "SYS_MQ_OPEN": ValueOf(syscall.SYS_MQ_OPEN), + "SYS_MQ_TIMEDRECEIVE": ValueOf(syscall.SYS_MQ_TIMEDRECEIVE), + "SYS_MQ_TIMEDSEND": ValueOf(syscall.SYS_MQ_TIMEDSEND), + "SYS_MQ_UNLINK": ValueOf(syscall.SYS_MQ_UNLINK), + "SYS_MREMAP": ValueOf(syscall.SYS_MREMAP), + "SYS_MSGCTL": ValueOf(syscall.SYS_MSGCTL), + "SYS_MSGGET": ValueOf(syscall.SYS_MSGGET), + "SYS_MSGRCV": ValueOf(syscall.SYS_MSGRCV), + "SYS_MSGSND": ValueOf(syscall.SYS_MSGSND), + "SYS_MSYNC": ValueOf(syscall.SYS_MSYNC), + "SYS_MUNLOCK": ValueOf(syscall.SYS_MUNLOCK), + "SYS_MUNLOCKALL": ValueOf(syscall.SYS_MUNLOCKALL), + "SYS_MUNMAP": ValueOf(syscall.SYS_MUNMAP), + "SYS_NAME_TO_HANDLE_AT": ValueOf(syscall.SYS_NAME_TO_HANDLE_AT), + "SYS_NANOSLEEP": ValueOf(syscall.SYS_NANOSLEEP), + "SYS_NFSSERVCTL": ValueOf(syscall.SYS_NFSSERVCTL), + "SYS_OPENAT": ValueOf(syscall.SYS_OPENAT), + "SYS_OPEN_BY_HANDLE_AT": ValueOf(syscall.SYS_OPEN_BY_HANDLE_AT), + "SYS_PAUSE": ValueOf(syscall.SYS_PAUSE), + "SYS_PERF_EVENT_OPEN": ValueOf(syscall.SYS_PERF_EVENT_OPEN), + "SYS_PERSONALITY": ValueOf(syscall.SYS_PERSONALITY), + "SYS_PIPE2": ValueOf(syscall.SYS_PIPE2), + "SYS_PIVOT_ROOT": ValueOf(syscall.SYS_PIVOT_ROOT), + "SYS_PPOLL": ValueOf(syscall.SYS_PPOLL), + "SYS_PRCTL": ValueOf(syscall.SYS_PRCTL), + "SYS_PREAD64": ValueOf(syscall.SYS_PREAD64), + "SYS_PREADV": ValueOf(syscall.SYS_PREADV), + "SYS_PRLIMIT64": ValueOf(syscall.SYS_PRLIMIT64), + "SYS_PROCESS_VM_READV": ValueOf(syscall.SYS_PROCESS_VM_READV), + "SYS_PROCESS_VM_WRITEV": ValueOf(syscall.SYS_PROCESS_VM_WRITEV), + "SYS_PSELECT6": ValueOf(syscall.SYS_PSELECT6), + "SYS_PTRACE": ValueOf(syscall.SYS_PTRACE), + "SYS_PWRITE64": ValueOf(syscall.SYS_PWRITE64), + "SYS_PWRITEV": ValueOf(syscall.SYS_PWRITEV), + "SYS_QUOTACTL": ValueOf(syscall.SYS_QUOTACTL), + "SYS_READ": ValueOf(syscall.SYS_READ), + "SYS_READAHEAD": ValueOf(syscall.SYS_READAHEAD), + "SYS_READLINKAT": ValueOf(syscall.SYS_READLINKAT), + "SYS_READV": ValueOf(syscall.SYS_READV), + "SYS_REBOOT": ValueOf(syscall.SYS_REBOOT), + "SYS_RECVFROM": ValueOf(syscall.SYS_RECVFROM), + "SYS_RECVMMSG": ValueOf(syscall.SYS_RECVMMSG), + "SYS_RECVMSG": ValueOf(syscall.SYS_RECVMSG), + "SYS_REMAP_FILE_PAGES": ValueOf(syscall.SYS_REMAP_FILE_PAGES), + "SYS_REMOVEXATTR": ValueOf(syscall.SYS_REMOVEXATTR), + "SYS_RENAMEAT": ValueOf(syscall.SYS_RENAMEAT), + "SYS_RENAMEAT2": ValueOf(syscall.SYS_RENAMEAT2), + "SYS_REQUEST_KEY": ValueOf(syscall.SYS_REQUEST_KEY), + "SYS_RESTART_SYSCALL": ValueOf(syscall.SYS_RESTART_SYSCALL), + "SYS_RT_SIGACTION": ValueOf(syscall.SYS_RT_SIGACTION), + "SYS_RT_SIGPENDING": ValueOf(syscall.SYS_RT_SIGPENDING), + "SYS_RT_SIGPROCMASK": ValueOf(syscall.SYS_RT_SIGPROCMASK), + "SYS_RT_SIGQUEUEINFO": ValueOf(syscall.SYS_RT_SIGQUEUEINFO), + "SYS_RT_SIGRETURN": ValueOf(syscall.SYS_RT_SIGRETURN), + "SYS_RT_SIGSUSPEND": ValueOf(syscall.SYS_RT_SIGSUSPEND), + "SYS_RT_SIGTIMEDWAIT": ValueOf(syscall.SYS_RT_SIGTIMEDWAIT), + "SYS_RT_TGSIGQUEUEINFO": ValueOf(syscall.SYS_RT_TGSIGQUEUEINFO), + "SYS_SCHED_GETAFFINITY": ValueOf(syscall.SYS_SCHED_GETAFFINITY), + "SYS_SCHED_GETATTR": ValueOf(syscall.SYS_SCHED_GETATTR), + "SYS_SCHED_GETPARAM": ValueOf(syscall.SYS_SCHED_GETPARAM), + "SYS_SCHED_GETSCHEDULER": ValueOf(syscall.SYS_SCHED_GETSCHEDULER), + "SYS_SCHED_GET_PRIORITY_MAX": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MAX), + "SYS_SCHED_GET_PRIORITY_MIN": ValueOf(syscall.SYS_SCHED_GET_PRIORITY_MIN), + "SYS_SCHED_RR_GET_INTERVAL": ValueOf(syscall.SYS_SCHED_RR_GET_INTERVAL), + "SYS_SCHED_SETAFFINITY": ValueOf(syscall.SYS_SCHED_SETAFFINITY), + "SYS_SCHED_SETATTR": ValueOf(syscall.SYS_SCHED_SETATTR), + "SYS_SCHED_SETPARAM": ValueOf(syscall.SYS_SCHED_SETPARAM), + "SYS_SCHED_SETSCHEDULER": ValueOf(syscall.SYS_SCHED_SETSCHEDULER), + "SYS_SCHED_YIELD": ValueOf(syscall.SYS_SCHED_YIELD), + "SYS_SECCOMP": ValueOf(syscall.SYS_SECCOMP), + "SYS_SEMCTL": ValueOf(syscall.SYS_SEMCTL), + "SYS_SEMGET": ValueOf(syscall.SYS_SEMGET), + "SYS_SEMOP": ValueOf(syscall.SYS_SEMOP), + "SYS_SEMTIMEDOP": ValueOf(syscall.SYS_SEMTIMEDOP), + "SYS_SENDFILE": ValueOf(syscall.SYS_SENDFILE), + "SYS_SENDMMSG": ValueOf(syscall.SYS_SENDMMSG), + "SYS_SENDMSG": ValueOf(syscall.SYS_SENDMSG), + "SYS_SENDTO": ValueOf(syscall.SYS_SENDTO), + "SYS_SETDOMAINNAME": ValueOf(syscall.SYS_SETDOMAINNAME), + "SYS_SETFSGID": ValueOf(syscall.SYS_SETFSGID), + "SYS_SETFSUID": ValueOf(syscall.SYS_SETFSUID), + "SYS_SETGID": ValueOf(syscall.SYS_SETGID), + "SYS_SETGROUPS": ValueOf(syscall.SYS_SETGROUPS), + "SYS_SETHOSTNAME": ValueOf(syscall.SYS_SETHOSTNAME), + "SYS_SETITIMER": ValueOf(syscall.SYS_SETITIMER), + "SYS_SETNS": ValueOf(syscall.SYS_SETNS), + "SYS_SETPGID": ValueOf(syscall.SYS_SETPGID), + "SYS_SETPRIORITY": ValueOf(syscall.SYS_SETPRIORITY), + "SYS_SETREGID": ValueOf(syscall.SYS_SETREGID), + "SYS_SETRESGID": ValueOf(syscall.SYS_SETRESGID), + "SYS_SETRESUID": ValueOf(syscall.SYS_SETRESUID), + "SYS_SETREUID": ValueOf(syscall.SYS_SETREUID), + "SYS_SETRLIMIT": ValueOf(syscall.SYS_SETRLIMIT), + "SYS_SETSID": ValueOf(syscall.SYS_SETSID), + "SYS_SETSOCKOPT": ValueOf(syscall.SYS_SETSOCKOPT), + "SYS_SETTIMEOFDAY": ValueOf(syscall.SYS_SETTIMEOFDAY), + "SYS_SETUID": ValueOf(syscall.SYS_SETUID), + "SYS_SETXATTR": ValueOf(syscall.SYS_SETXATTR), + "SYS_SET_MEMPOLICY": ValueOf(syscall.SYS_SET_MEMPOLICY), + "SYS_SET_ROBUST_LIST": ValueOf(syscall.SYS_SET_ROBUST_LIST), + "SYS_SET_TID_ADDRESS": ValueOf(syscall.SYS_SET_TID_ADDRESS), + "SYS_SHMAT": ValueOf(syscall.SYS_SHMAT), + "SYS_SHMCTL": ValueOf(syscall.SYS_SHMCTL), + "SYS_SHMDT": ValueOf(syscall.SYS_SHMDT), + "SYS_SHMGET": ValueOf(syscall.SYS_SHMGET), + "SYS_SHUTDOWN": ValueOf(syscall.SYS_SHUTDOWN), + "SYS_SIGALTSTACK": ValueOf(syscall.SYS_SIGALTSTACK), + "SYS_SIGNALFD4": ValueOf(syscall.SYS_SIGNALFD4), + "SYS_SOCKET": ValueOf(syscall.SYS_SOCKET), + "SYS_SOCKETPAIR": ValueOf(syscall.SYS_SOCKETPAIR), + "SYS_SPLICE": ValueOf(syscall.SYS_SPLICE), + "SYS_STATFS": ValueOf(syscall.SYS_STATFS), + "SYS_SWAPOFF": ValueOf(syscall.SYS_SWAPOFF), + "SYS_SWAPON": ValueOf(syscall.SYS_SWAPON), + "SYS_SYMLINKAT": ValueOf(syscall.SYS_SYMLINKAT), + "SYS_SYNC": ValueOf(syscall.SYS_SYNC), + "SYS_SYNCFS": ValueOf(syscall.SYS_SYNCFS), + "SYS_SYNC_FILE_RANGE": ValueOf(syscall.SYS_SYNC_FILE_RANGE), + "SYS_SYNC_FILE_RANGE2": ValueOf(syscall.SYS_SYNC_FILE_RANGE2), + "SYS_SYSINFO": ValueOf(syscall.SYS_SYSINFO), + "SYS_SYSLOG": ValueOf(syscall.SYS_SYSLOG), + "SYS_TEE": ValueOf(syscall.SYS_TEE), + "SYS_TGKILL": ValueOf(syscall.SYS_TGKILL), + "SYS_TIME": ValueOf(syscall.SYS_TIME), + "SYS_TIMERFD_CREATE": ValueOf(syscall.SYS_TIMERFD_CREATE), + "SYS_TIMERFD_GETTIME": ValueOf(syscall.SYS_TIMERFD_GETTIME), + "SYS_TIMERFD_SETTIME": ValueOf(syscall.SYS_TIMERFD_SETTIME), + "SYS_TIMER_CREATE": ValueOf(syscall.SYS_TIMER_CREATE), + "SYS_TIMER_DELETE": ValueOf(syscall.SYS_TIMER_DELETE), + "SYS_TIMER_GETOVERRUN": ValueOf(syscall.SYS_TIMER_GETOVERRUN), + "SYS_TIMER_GETTIME": ValueOf(syscall.SYS_TIMER_GETTIME), + "SYS_TIMER_SETTIME": ValueOf(syscall.SYS_TIMER_SETTIME), + "SYS_TIMES": ValueOf(syscall.SYS_TIMES), + "SYS_TKILL": ValueOf(syscall.SYS_TKILL), + "SYS_TRUNCATE": ValueOf(syscall.SYS_TRUNCATE), + "SYS_UMASK": ValueOf(syscall.SYS_UMASK), + "SYS_UMOUNT2": ValueOf(syscall.SYS_UMOUNT2), + "SYS_UNAME": ValueOf(syscall.SYS_UNAME), + "SYS_UNLINKAT": ValueOf(syscall.SYS_UNLINKAT), + "SYS_UNSHARE": ValueOf(syscall.SYS_UNSHARE), + "SYS_USTAT": ValueOf(syscall.SYS_USTAT), + "SYS_UTIME": ValueOf(syscall.SYS_UTIME), + "SYS_UTIMENSAT": ValueOf(syscall.SYS_UTIMENSAT), + "SYS_UTIMES": ValueOf(syscall.SYS_UTIMES), + "SYS_VHANGUP": ValueOf(syscall.SYS_VHANGUP), + "SYS_VMSPLICE": ValueOf(syscall.SYS_VMSPLICE), + "SYS_WAIT4": ValueOf(syscall.SYS_WAIT4), + "SYS_WAITID": ValueOf(syscall.SYS_WAITID), + "SYS_WRITE": ValueOf(syscall.SYS_WRITE), + "SYS_WRITEV": ValueOf(syscall.SYS_WRITEV), + "S_BLKSIZE": ValueOf(syscall.S_BLKSIZE), + "S_IEXEC": ValueOf(syscall.S_IEXEC), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IREAD": ValueOf(syscall.S_IREAD), + "S_IRGRP": ValueOf(syscall.S_IRGRP), + "S_IROTH": ValueOf(syscall.S_IROTH), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_IRWXG": ValueOf(syscall.S_IRWXG), + "S_IRWXO": ValueOf(syscall.S_IRWXO), + "S_IRWXU": ValueOf(syscall.S_IRWXU), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWGRP": ValueOf(syscall.S_IWGRP), + "S_IWOTH": ValueOf(syscall.S_IWOTH), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXGRP": ValueOf(syscall.S_IXGRP), + "S_IXOTH": ValueOf(syscall.S_IXOTH), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Select": ValueOf(syscall.Select), + "Sendfile": ValueOf(syscall.Sendfile), + "Sendmsg": ValueOf(syscall.Sendmsg), + "SendmsgN": ValueOf(syscall.SendmsgN), + "Sendto": ValueOf(syscall.Sendto), + "SetLsfPromisc": ValueOf(syscall.SetLsfPromisc), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setdomainname": ValueOf(syscall.Setdomainname), + "Setenv": ValueOf(syscall.Setenv), + "Setfsgid": ValueOf(syscall.Setfsgid), + "Setfsuid": ValueOf(syscall.Setfsuid), + "Setgid": ValueOf(syscall.Setgid), + "Setgroups": ValueOf(syscall.Setgroups), + "Sethostname": ValueOf(syscall.Sethostname), + "Setpgid": ValueOf(syscall.Setpgid), + "Setpriority": ValueOf(syscall.Setpriority), + "Setregid": ValueOf(syscall.Setregid), + "Setresgid": ValueOf(syscall.Setresgid), + "Setresuid": ValueOf(syscall.Setresuid), + "Setreuid": ValueOf(syscall.Setreuid), + "Setrlimit": ValueOf(syscall.Setrlimit), + "Setsid": ValueOf(syscall.Setsid), + "SetsockoptByte": ValueOf(syscall.SetsockoptByte), + "SetsockoptICMPv6Filter": ValueOf(syscall.SetsockoptICMPv6Filter), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPMreqn": ValueOf(syscall.SetsockoptIPMreqn), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptString": ValueOf(syscall.SetsockoptString), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Settimeofday": ValueOf(syscall.Settimeofday), + "Setuid": ValueOf(syscall.Setuid), + "Setxattr": ValueOf(syscall.Setxattr), + "Shutdown": ValueOf(syscall.Shutdown), + "SizeofCmsghdr": ValueOf(syscall.SizeofCmsghdr), + "SizeofICMPv6Filter": ValueOf(syscall.SizeofICMPv6Filter), + "SizeofIPMreq": ValueOf(syscall.SizeofIPMreq), + "SizeofIPMreqn": ValueOf(syscall.SizeofIPMreqn), + "SizeofIPv6MTUInfo": ValueOf(syscall.SizeofIPv6MTUInfo), + "SizeofIPv6Mreq": ValueOf(syscall.SizeofIPv6Mreq), + "SizeofIfAddrmsg": ValueOf(syscall.SizeofIfAddrmsg), + "SizeofIfInfomsg": ValueOf(syscall.SizeofIfInfomsg), + "SizeofInet4Pktinfo": ValueOf(syscall.SizeofInet4Pktinfo), + "SizeofInet6Pktinfo": ValueOf(syscall.SizeofInet6Pktinfo), + "SizeofInotifyEvent": ValueOf(syscall.SizeofInotifyEvent), + "SizeofLinger": ValueOf(syscall.SizeofLinger), + "SizeofMsghdr": ValueOf(syscall.SizeofMsghdr), + "SizeofNlAttr": ValueOf(syscall.SizeofNlAttr), + "SizeofNlMsgerr": ValueOf(syscall.SizeofNlMsgerr), + "SizeofNlMsghdr": ValueOf(syscall.SizeofNlMsghdr), + "SizeofRtAttr": ValueOf(syscall.SizeofRtAttr), + "SizeofRtGenmsg": ValueOf(syscall.SizeofRtGenmsg), + "SizeofRtMsg": ValueOf(syscall.SizeofRtMsg), + "SizeofRtNexthop": ValueOf(syscall.SizeofRtNexthop), + "SizeofSockFilter": ValueOf(syscall.SizeofSockFilter), + "SizeofSockFprog": ValueOf(syscall.SizeofSockFprog), + "SizeofSockaddrAny": ValueOf(syscall.SizeofSockaddrAny), + "SizeofSockaddrInet4": ValueOf(syscall.SizeofSockaddrInet4), + "SizeofSockaddrInet6": ValueOf(syscall.SizeofSockaddrInet6), + "SizeofSockaddrLinklayer": ValueOf(syscall.SizeofSockaddrLinklayer), + "SizeofSockaddrNetlink": ValueOf(syscall.SizeofSockaddrNetlink), + "SizeofSockaddrUnix": ValueOf(syscall.SizeofSockaddrUnix), + "SizeofTCPInfo": ValueOf(syscall.SizeofTCPInfo), + "SizeofUcred": ValueOf(syscall.SizeofUcred), + "SlicePtrFromStrings": ValueOf(syscall.SlicePtrFromStrings), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "Socketpair": ValueOf(syscall.Socketpair), + "Splice": ValueOf(syscall.Splice), + "StartProcess": ValueOf(syscall.StartProcess), + "Stat": ValueOf(syscall.Stat), + "Statfs": ValueOf(syscall.Statfs), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringSlicePtr": ValueOf(syscall.StringSlicePtr), + "Symlink": ValueOf(syscall.Symlink), + "Sync": ValueOf(syscall.Sync), + "SyncFileRange": ValueOf(syscall.SyncFileRange), + "Syscall": ValueOf(syscall.Syscall), + "Syscall6": ValueOf(syscall.Syscall6), + "Sysinfo": ValueOf(syscall.Sysinfo), + "TCFLSH": ValueOf(syscall.TCFLSH), + "TCGETS": ValueOf(syscall.TCGETS), + "TCIFLUSH": ValueOf(syscall.TCIFLUSH), + "TCIOFLUSH": ValueOf(syscall.TCIOFLUSH), + "TCOFLUSH": ValueOf(syscall.TCOFLUSH), + "TCP_CONGESTION": ValueOf(syscall.TCP_CONGESTION), + "TCP_COOKIE_IN_ALWAYS": ValueOf(syscall.TCP_COOKIE_IN_ALWAYS), + "TCP_COOKIE_MAX": ValueOf(syscall.TCP_COOKIE_MAX), + "TCP_COOKIE_MIN": ValueOf(syscall.TCP_COOKIE_MIN), + "TCP_COOKIE_OUT_NEVER": ValueOf(syscall.TCP_COOKIE_OUT_NEVER), + "TCP_COOKIE_PAIR_SIZE": ValueOf(syscall.TCP_COOKIE_PAIR_SIZE), + "TCP_COOKIE_TRANSACTIONS": ValueOf(syscall.TCP_COOKIE_TRANSACTIONS), + "TCP_CORK": ValueOf(syscall.TCP_CORK), + "TCP_DEFER_ACCEPT": ValueOf(syscall.TCP_DEFER_ACCEPT), + "TCP_FASTOPEN": ValueOf(syscall.TCP_FASTOPEN), + "TCP_INFO": ValueOf(syscall.TCP_INFO), + "TCP_KEEPCNT": ValueOf(syscall.TCP_KEEPCNT), + "TCP_KEEPIDLE": ValueOf(syscall.TCP_KEEPIDLE), + "TCP_KEEPINTVL": ValueOf(syscall.TCP_KEEPINTVL), + "TCP_LINGER2": ValueOf(syscall.TCP_LINGER2), + "TCP_MAXSEG": ValueOf(syscall.TCP_MAXSEG), + "TCP_MAXWIN": ValueOf(syscall.TCP_MAXWIN), + "TCP_MAX_WINSHIFT": ValueOf(syscall.TCP_MAX_WINSHIFT), + "TCP_MD5SIG": ValueOf(syscall.TCP_MD5SIG), + "TCP_MD5SIG_MAXKEYLEN": ValueOf(syscall.TCP_MD5SIG_MAXKEYLEN), + "TCP_MSS": ValueOf(syscall.TCP_MSS), + "TCP_MSS_DEFAULT": ValueOf(syscall.TCP_MSS_DEFAULT), + "TCP_MSS_DESIRED": ValueOf(syscall.TCP_MSS_DESIRED), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TCP_QUEUE_SEQ": ValueOf(syscall.TCP_QUEUE_SEQ), + "TCP_QUICKACK": ValueOf(syscall.TCP_QUICKACK), + "TCP_REPAIR": ValueOf(syscall.TCP_REPAIR), + "TCP_REPAIR_OPTIONS": ValueOf(syscall.TCP_REPAIR_OPTIONS), + "TCP_REPAIR_QUEUE": ValueOf(syscall.TCP_REPAIR_QUEUE), + "TCP_SYNCNT": ValueOf(syscall.TCP_SYNCNT), + "TCP_S_DATA_IN": ValueOf(syscall.TCP_S_DATA_IN), + "TCP_S_DATA_OUT": ValueOf(syscall.TCP_S_DATA_OUT), + "TCP_THIN_DUPACK": ValueOf(syscall.TCP_THIN_DUPACK), + "TCP_THIN_LINEAR_TIMEOUTS": ValueOf(syscall.TCP_THIN_LINEAR_TIMEOUTS), + "TCP_TIMESTAMP": ValueOf(syscall.TCP_TIMESTAMP), + "TCP_USER_TIMEOUT": ValueOf(syscall.TCP_USER_TIMEOUT), + "TCP_WINDOW_CLAMP": ValueOf(syscall.TCP_WINDOW_CLAMP), + "TCSAFLUSH": ValueOf(syscall.TCSAFLUSH), + "TCSETS": ValueOf(syscall.TCSETS), + "TIOCCBRK": ValueOf(syscall.TIOCCBRK), + "TIOCCONS": ValueOf(syscall.TIOCCONS), + "TIOCEXCL": ValueOf(syscall.TIOCEXCL), + "TIOCGDEV": ValueOf(uint32(syscall.TIOCGDEV)), + "TIOCGETD": ValueOf(syscall.TIOCGETD), + "TIOCGEXCL": ValueOf(uint32(syscall.TIOCGEXCL)), + "TIOCGICOUNT": ValueOf(syscall.TIOCGICOUNT), + "TIOCGLCKTRMIOS": ValueOf(syscall.TIOCGLCKTRMIOS), + "TIOCGPGRP": ValueOf(syscall.TIOCGPGRP), + "TIOCGPKT": ValueOf(uint32(syscall.TIOCGPKT)), + "TIOCGPTLCK": ValueOf(uint32(syscall.TIOCGPTLCK)), + "TIOCGPTN": ValueOf(uint32(syscall.TIOCGPTN)), + "TIOCGRS485": ValueOf(syscall.TIOCGRS485), + "TIOCGSERIAL": ValueOf(syscall.TIOCGSERIAL), + "TIOCGSID": ValueOf(syscall.TIOCGSID), + "TIOCGSOFTCAR": ValueOf(syscall.TIOCGSOFTCAR), + "TIOCGWINSZ": ValueOf(syscall.TIOCGWINSZ), + "TIOCINQ": ValueOf(syscall.TIOCINQ), + "TIOCLINUX": ValueOf(syscall.TIOCLINUX), + "TIOCMBIC": ValueOf(syscall.TIOCMBIC), + "TIOCMBIS": ValueOf(syscall.TIOCMBIS), + "TIOCMGET": ValueOf(syscall.TIOCMGET), + "TIOCMIWAIT": ValueOf(syscall.TIOCMIWAIT), + "TIOCMSET": ValueOf(syscall.TIOCMSET), + "TIOCM_CAR": ValueOf(syscall.TIOCM_CAR), + "TIOCM_CD": ValueOf(syscall.TIOCM_CD), + "TIOCM_CTS": ValueOf(syscall.TIOCM_CTS), + "TIOCM_DSR": ValueOf(syscall.TIOCM_DSR), + "TIOCM_DTR": ValueOf(syscall.TIOCM_DTR), + "TIOCM_LE": ValueOf(syscall.TIOCM_LE), + "TIOCM_RI": ValueOf(syscall.TIOCM_RI), + "TIOCM_RNG": ValueOf(syscall.TIOCM_RNG), + "TIOCM_RTS": ValueOf(syscall.TIOCM_RTS), + "TIOCM_SR": ValueOf(syscall.TIOCM_SR), + "TIOCM_ST": ValueOf(syscall.TIOCM_ST), + "TIOCNOTTY": ValueOf(syscall.TIOCNOTTY), + "TIOCNXCL": ValueOf(syscall.TIOCNXCL), + "TIOCOUTQ": ValueOf(syscall.TIOCOUTQ), + "TIOCPKT": ValueOf(syscall.TIOCPKT), + "TIOCPKT_DATA": ValueOf(syscall.TIOCPKT_DATA), + "TIOCPKT_DOSTOP": ValueOf(syscall.TIOCPKT_DOSTOP), + "TIOCPKT_FLUSHREAD": ValueOf(syscall.TIOCPKT_FLUSHREAD), + "TIOCPKT_FLUSHWRITE": ValueOf(syscall.TIOCPKT_FLUSHWRITE), + "TIOCPKT_IOCTL": ValueOf(syscall.TIOCPKT_IOCTL), + "TIOCPKT_NOSTOP": ValueOf(syscall.TIOCPKT_NOSTOP), + "TIOCPKT_START": ValueOf(syscall.TIOCPKT_START), + "TIOCPKT_STOP": ValueOf(syscall.TIOCPKT_STOP), + "TIOCSBRK": ValueOf(syscall.TIOCSBRK), + "TIOCSCTTY": ValueOf(syscall.TIOCSCTTY), + "TIOCSERCONFIG": ValueOf(syscall.TIOCSERCONFIG), + "TIOCSERGETLSR": ValueOf(syscall.TIOCSERGETLSR), + "TIOCSERGETMULTI": ValueOf(syscall.TIOCSERGETMULTI), + "TIOCSERGSTRUCT": ValueOf(syscall.TIOCSERGSTRUCT), + "TIOCSERGWILD": ValueOf(syscall.TIOCSERGWILD), + "TIOCSERSETMULTI": ValueOf(syscall.TIOCSERSETMULTI), + "TIOCSERSWILD": ValueOf(syscall.TIOCSERSWILD), + "TIOCSER_TEMT": ValueOf(syscall.TIOCSER_TEMT), + "TIOCSETD": ValueOf(syscall.TIOCSETD), + "TIOCSIG": ValueOf(syscall.TIOCSIG), + "TIOCSLCKTRMIOS": ValueOf(syscall.TIOCSLCKTRMIOS), + "TIOCSPGRP": ValueOf(syscall.TIOCSPGRP), + "TIOCSPTLCK": ValueOf(syscall.TIOCSPTLCK), + "TIOCSRS485": ValueOf(syscall.TIOCSRS485), + "TIOCSSERIAL": ValueOf(syscall.TIOCSSERIAL), + "TIOCSSOFTCAR": ValueOf(syscall.TIOCSSOFTCAR), + "TIOCSTI": ValueOf(syscall.TIOCSTI), + "TIOCSWINSZ": ValueOf(syscall.TIOCSWINSZ), + "TIOCVHANGUP": ValueOf(syscall.TIOCVHANGUP), + "TOSTOP": ValueOf(syscall.TOSTOP), + "TUNATTACHFILTER": ValueOf(syscall.TUNATTACHFILTER), + "TUNDETACHFILTER": ValueOf(syscall.TUNDETACHFILTER), + "TUNGETFEATURES": ValueOf(uint32(syscall.TUNGETFEATURES)), + "TUNGETFILTER": ValueOf(uint32(syscall.TUNGETFILTER)), + "TUNGETIFF": ValueOf(uint32(syscall.TUNGETIFF)), + "TUNGETSNDBUF": ValueOf(uint32(syscall.TUNGETSNDBUF)), + "TUNGETVNETHDRSZ": ValueOf(uint32(syscall.TUNGETVNETHDRSZ)), + "TUNSETDEBUG": ValueOf(syscall.TUNSETDEBUG), + "TUNSETGROUP": ValueOf(syscall.TUNSETGROUP), + "TUNSETIFF": ValueOf(syscall.TUNSETIFF), + "TUNSETIFINDEX": ValueOf(syscall.TUNSETIFINDEX), + "TUNSETLINK": ValueOf(syscall.TUNSETLINK), + "TUNSETNOCSUM": ValueOf(syscall.TUNSETNOCSUM), + "TUNSETOFFLOAD": ValueOf(syscall.TUNSETOFFLOAD), + "TUNSETOWNER": ValueOf(syscall.TUNSETOWNER), + "TUNSETPERSIST": ValueOf(syscall.TUNSETPERSIST), + "TUNSETQUEUE": ValueOf(syscall.TUNSETQUEUE), + "TUNSETSNDBUF": ValueOf(syscall.TUNSETSNDBUF), + "TUNSETTXFILTER": ValueOf(syscall.TUNSETTXFILTER), + "TUNSETVNETHDRSZ": ValueOf(syscall.TUNSETVNETHDRSZ), + "Tee": ValueOf(syscall.Tee), + "Tgkill": ValueOf(syscall.Tgkill), + "Time": ValueOf(syscall.Time), + "Times": ValueOf(syscall.Times), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TimevalToNsec": ValueOf(syscall.TimevalToNsec), + "Truncate": ValueOf(syscall.Truncate), + "Umask": ValueOf(syscall.Umask), + "Uname": ValueOf(syscall.Uname), + "UnixCredentials": ValueOf(syscall.UnixCredentials), + "UnixRights": ValueOf(syscall.UnixRights), + "Unlink": ValueOf(syscall.Unlink), + "Unlinkat": ValueOf(syscall.Unlinkat), + "Unmount": ValueOf(syscall.Unmount), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Unshare": ValueOf(syscall.Unshare), + "Ustat": ValueOf(syscall.Ustat), + "Utime": ValueOf(syscall.Utime), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VDISCARD": ValueOf(syscall.VDISCARD), + "VEOF": ValueOf(syscall.VEOF), + "VEOL": ValueOf(syscall.VEOL), + "VEOL2": ValueOf(syscall.VEOL2), + "VERASE": ValueOf(syscall.VERASE), + "VINTR": ValueOf(syscall.VINTR), + "VKILL": ValueOf(syscall.VKILL), + "VLNEXT": ValueOf(syscall.VLNEXT), + "VMIN": ValueOf(syscall.VMIN), + "VQUIT": ValueOf(syscall.VQUIT), + "VREPRINT": ValueOf(syscall.VREPRINT), + "VSTART": ValueOf(syscall.VSTART), + "VSTOP": ValueOf(syscall.VSTOP), + "VSUSP": ValueOf(syscall.VSUSP), + "VSWTC": ValueOf(syscall.VSWTC), + "VT0": ValueOf(syscall.VT0), + "VT1": ValueOf(syscall.VT1), + "VTDLY": ValueOf(syscall.VTDLY), + "VTIME": ValueOf(syscall.VTIME), + "VWERASE": ValueOf(syscall.VWERASE), + "WALL": ValueOf(syscall.WALL), + "WCLONE": ValueOf(uint32(syscall.WCLONE)), + "WCONTINUED": ValueOf(syscall.WCONTINUED), + "WEXITED": ValueOf(syscall.WEXITED), + "WNOHANG": ValueOf(syscall.WNOHANG), + "WNOTHREAD": ValueOf(syscall.WNOTHREAD), + "WNOWAIT": ValueOf(syscall.WNOWAIT), + "WORDSIZE": ValueOf(syscall.WORDSIZE), + "WSTOPPED": ValueOf(syscall.WSTOPPED), + "WUNTRACED": ValueOf(syscall.WUNTRACED), + "Wait4": ValueOf(syscall.Wait4), + "Write": ValueOf(syscall.Write), + "XCASE": ValueOf(syscall.XCASE), + },Types: map[string]Type{ + "Cmsghdr": TypeOf((*syscall.Cmsghdr)(nil)).Elem(), + "Credential": TypeOf((*syscall.Credential)(nil)).Elem(), + "Dirent": TypeOf((*syscall.Dirent)(nil)).Elem(), + "EpollEvent": TypeOf((*syscall.EpollEvent)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FdSet": TypeOf((*syscall.FdSet)(nil)).Elem(), + "Flock_t": TypeOf((*syscall.Flock_t)(nil)).Elem(), + "Fsid": TypeOf((*syscall.Fsid)(nil)).Elem(), + "ICMPv6Filter": TypeOf((*syscall.ICMPv6Filter)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPMreqn": TypeOf((*syscall.IPMreqn)(nil)).Elem(), + "IPv6MTUInfo": TypeOf((*syscall.IPv6MTUInfo)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "IfAddrmsg": TypeOf((*syscall.IfAddrmsg)(nil)).Elem(), + "IfInfomsg": TypeOf((*syscall.IfInfomsg)(nil)).Elem(), + "Inet4Pktinfo": TypeOf((*syscall.Inet4Pktinfo)(nil)).Elem(), + "Inet6Pktinfo": TypeOf((*syscall.Inet6Pktinfo)(nil)).Elem(), + "InotifyEvent": TypeOf((*syscall.InotifyEvent)(nil)).Elem(), + "Iovec": TypeOf((*syscall.Iovec)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "Msghdr": TypeOf((*syscall.Msghdr)(nil)).Elem(), + "NetlinkMessage": TypeOf((*syscall.NetlinkMessage)(nil)).Elem(), + "NetlinkRouteAttr": TypeOf((*syscall.NetlinkRouteAttr)(nil)).Elem(), + "NetlinkRouteRequest": TypeOf((*syscall.NetlinkRouteRequest)(nil)).Elem(), + "NlAttr": TypeOf((*syscall.NlAttr)(nil)).Elem(), + "NlMsgerr": TypeOf((*syscall.NlMsgerr)(nil)).Elem(), + "NlMsghdr": TypeOf((*syscall.NlMsghdr)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "PtraceRegs": TypeOf((*syscall.PtraceRegs)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "RawSockaddrLinklayer": TypeOf((*syscall.RawSockaddrLinklayer)(nil)).Elem(), + "RawSockaddrNetlink": TypeOf((*syscall.RawSockaddrNetlink)(nil)).Elem(), + "RawSockaddrUnix": TypeOf((*syscall.RawSockaddrUnix)(nil)).Elem(), + "Rlimit": TypeOf((*syscall.Rlimit)(nil)).Elem(), + "RtAttr": TypeOf((*syscall.RtAttr)(nil)).Elem(), + "RtGenmsg": TypeOf((*syscall.RtGenmsg)(nil)).Elem(), + "RtMsg": TypeOf((*syscall.RtMsg)(nil)).Elem(), + "RtNexthop": TypeOf((*syscall.RtNexthop)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "SockFilter": TypeOf((*syscall.SockFilter)(nil)).Elem(), + "SockFprog": TypeOf((*syscall.SockFprog)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrLinklayer": TypeOf((*syscall.SockaddrLinklayer)(nil)).Elem(), + "SockaddrNetlink": TypeOf((*syscall.SockaddrNetlink)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "SocketControlMessage": TypeOf((*syscall.SocketControlMessage)(nil)).Elem(), + "Stat_t": TypeOf((*syscall.Stat_t)(nil)).Elem(), + "Statfs_t": TypeOf((*syscall.Statfs_t)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "SysProcIDMap": TypeOf((*syscall.SysProcIDMap)(nil)).Elem(), + "Sysinfo_t": TypeOf((*syscall.Sysinfo_t)(nil)).Elem(), + "TCPInfo": TypeOf((*syscall.TCPInfo)(nil)).Elem(), + "Termios": TypeOf((*syscall.Termios)(nil)).Elem(), + "Time_t": TypeOf((*syscall.Time_t)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timex": TypeOf((*syscall.Timex)(nil)).Elem(), + "Tms": TypeOf((*syscall.Tms)(nil)).Elem(), + "Ucred": TypeOf((*syscall.Ucred)(nil)).Elem(), + "Ustat_t": TypeOf((*syscall.Ustat_t)(nil)).Elem(), + "Utimbuf": TypeOf((*syscall.Utimbuf)(nil)).Elem(), + "Utsname": TypeOf((*syscall.Utsname)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + },Untypeds: map[string]string{ + "AF_ALG": "int:38", + "AF_APPLETALK": "int:5", + "AF_ASH": "int:18", + "AF_ATMPVC": "int:8", + "AF_ATMSVC": "int:20", + "AF_AX25": "int:3", + "AF_BLUETOOTH": "int:31", + "AF_BRIDGE": "int:7", + "AF_CAIF": "int:37", + "AF_CAN": "int:29", + "AF_DECnet": "int:12", + "AF_ECONET": "int:19", + "AF_FILE": "int:1", + "AF_IEEE802154": "int:36", + "AF_INET": "int:2", + "AF_INET6": "int:10", + "AF_IPX": "int:4", + "AF_IRDA": "int:23", + "AF_ISDN": "int:34", + "AF_IUCV": "int:32", + "AF_KEY": "int:15", + "AF_LLC": "int:26", + "AF_LOCAL": "int:1", + "AF_MAX": "int:41", + "AF_NETBEUI": "int:13", + "AF_NETLINK": "int:16", + "AF_NETROM": "int:6", + "AF_NFC": "int:39", + "AF_PACKET": "int:17", + "AF_PHONET": "int:35", + "AF_PPPOX": "int:24", + "AF_RDS": "int:21", + "AF_ROSE": "int:11", + "AF_ROUTE": "int:16", + "AF_RXRPC": "int:33", + "AF_SECURITY": "int:14", + "AF_SNA": "int:22", + "AF_TIPC": "int:30", + "AF_UNIX": "int:1", + "AF_UNSPEC": "int:0", + "AF_VSOCK": "int:40", + "AF_WANPIPE": "int:25", + "AF_X25": "int:9", + "ARPHRD_ADAPT": "int:264", + "ARPHRD_APPLETLK": "int:8", + "ARPHRD_ARCNET": "int:7", + "ARPHRD_ASH": "int:781", + "ARPHRD_ATM": "int:19", + "ARPHRD_AX25": "int:3", + "ARPHRD_BIF": "int:775", + "ARPHRD_CAIF": "int:822", + "ARPHRD_CAN": "int:280", + "ARPHRD_CHAOS": "int:5", + "ARPHRD_CISCO": "int:513", + "ARPHRD_CSLIP": "int:257", + "ARPHRD_CSLIP6": "int:259", + "ARPHRD_DDCMP": "int:517", + "ARPHRD_DLCI": "int:15", + "ARPHRD_ECONET": "int:782", + "ARPHRD_EETHER": "int:2", + "ARPHRD_ETHER": "int:1", + "ARPHRD_EUI64": "int:27", + "ARPHRD_FCAL": "int:785", + "ARPHRD_FCFABRIC": "int:787", + "ARPHRD_FCPL": "int:786", + "ARPHRD_FCPP": "int:784", + "ARPHRD_FDDI": "int:774", + "ARPHRD_FRAD": "int:770", + "ARPHRD_HDLC": "int:513", + "ARPHRD_HIPPI": "int:780", + "ARPHRD_HWX25": "int:272", + "ARPHRD_IEEE1394": "int:24", + "ARPHRD_IEEE802": "int:6", + "ARPHRD_IEEE80211": "int:801", + "ARPHRD_IEEE80211_PRISM": "int:802", + "ARPHRD_IEEE80211_RADIOTAP": "int:803", + "ARPHRD_IEEE802154": "int:804", + "ARPHRD_IEEE802154_MONITOR": "int:805", + "ARPHRD_IEEE802_TR": "int:800", + "ARPHRD_INFINIBAND": "int:32", + "ARPHRD_IP6GRE": "int:823", + "ARPHRD_IPDDP": "int:777", + "ARPHRD_IPGRE": "int:778", + "ARPHRD_IRDA": "int:783", + "ARPHRD_LAPB": "int:516", + "ARPHRD_LOCALTLK": "int:773", + "ARPHRD_LOOPBACK": "int:772", + "ARPHRD_METRICOM": "int:23", + "ARPHRD_NETLINK": "int:824", + "ARPHRD_NETROM": "int:0", + "ARPHRD_NONE": "int:65534", + "ARPHRD_PHONET": "int:820", + "ARPHRD_PHONET_PIPE": "int:821", + "ARPHRD_PIMREG": "int:779", + "ARPHRD_PPP": "int:512", + "ARPHRD_PRONET": "int:4", + "ARPHRD_RAWHDLC": "int:518", + "ARPHRD_ROSE": "int:270", + "ARPHRD_RSRVD": "int:260", + "ARPHRD_SIT": "int:776", + "ARPHRD_SKIP": "int:771", + "ARPHRD_SLIP": "int:256", + "ARPHRD_SLIP6": "int:258", + "ARPHRD_TUNNEL": "int:768", + "ARPHRD_TUNNEL6": "int:769", + "ARPHRD_VOID": "int:65535", + "ARPHRD_X25": "int:271", + "B0": "int:0", + "B1000000": "int:4104", + "B110": "int:3", + "B115200": "int:4098", + "B1152000": "int:4105", + "B1200": "int:9", + "B134": "int:4", + "B150": "int:5", + "B1500000": "int:4106", + "B1800": "int:10", + "B19200": "int:14", + "B200": "int:6", + "B2000000": "int:4107", + "B230400": "int:4099", + "B2400": "int:11", + "B2500000": "int:4108", + "B300": "int:7", + "B3000000": "int:4109", + "B3500000": "int:4110", + "B38400": "int:15", + "B4000000": "int:4111", + "B460800": "int:4100", + "B4800": "int:12", + "B50": "int:1", + "B500000": "int:4101", + "B57600": "int:4097", + "B576000": "int:4102", + "B600": "int:8", + "B75": "int:2", + "B921600": "int:4103", + "B9600": "int:13", + "BPF_A": "int:16", + "BPF_ABS": "int:32", + "BPF_ADD": "int:0", + "BPF_ALU": "int:4", + "BPF_AND": "int:80", + "BPF_B": "int:16", + "BPF_DIV": "int:48", + "BPF_H": "int:8", + "BPF_IMM": "int:0", + "BPF_IND": "int:64", + "BPF_JA": "int:0", + "BPF_JEQ": "int:16", + "BPF_JGE": "int:48", + "BPF_JGT": "int:32", + "BPF_JMP": "int:5", + "BPF_JSET": "int:64", + "BPF_K": "int:0", + "BPF_LD": "int:0", + "BPF_LDX": "int:1", + "BPF_LEN": "int:128", + "BPF_LSH": "int:96", + "BPF_MAJOR_VERSION": "int:1", + "BPF_MAXINSNS": "int:4096", + "BPF_MEM": "int:96", + "BPF_MEMWORDS": "int:16", + "BPF_MINOR_VERSION": "int:1", + "BPF_MISC": "int:7", + "BPF_MOD": "int:144", + "BPF_MSH": "int:160", + "BPF_MUL": "int:32", + "BPF_NEG": "int:128", + "BPF_OR": "int:64", + "BPF_RET": "int:6", + "BPF_RSH": "int:112", + "BPF_ST": "int:2", + "BPF_STX": "int:3", + "BPF_SUB": "int:16", + "BPF_TAX": "int:0", + "BPF_TXA": "int:128", + "BPF_W": "int:0", + "BPF_X": "int:8", + "BPF_XOR": "int:160", + "BRKINT": "int:2", + "CFLUSH": "int:15", + "CLOCAL": "int:2048", + "CLONE_CHILD_CLEARTID": "int:2097152", + "CLONE_CHILD_SETTID": "int:16777216", + "CLONE_DETACHED": "int:4194304", + "CLONE_FILES": "int:1024", + "CLONE_FS": "int:512", + "CLONE_IO": "int:2147483648", + "CLONE_NEWIPC": "int:134217728", + "CLONE_NEWNET": "int:1073741824", + "CLONE_NEWNS": "int:131072", + "CLONE_NEWPID": "int:536870912", + "CLONE_NEWUSER": "int:268435456", + "CLONE_NEWUTS": "int:67108864", + "CLONE_PARENT": "int:32768", + "CLONE_PARENT_SETTID": "int:1048576", + "CLONE_PTRACE": "int:8192", + "CLONE_SETTLS": "int:524288", + "CLONE_SIGHAND": "int:2048", + "CLONE_SYSVSEM": "int:262144", + "CLONE_THREAD": "int:65536", + "CLONE_UNTRACED": "int:8388608", + "CLONE_VFORK": "int:16384", + "CLONE_VM": "int:256", + "CREAD": "int:128", + "CS5": "int:0", + "CS6": "int:16", + "CS7": "int:32", + "CS8": "int:48", + "CSIGNAL": "int:255", + "CSIZE": "int:48", + "CSTART": "int:17", + "CSTATUS": "int:0", + "CSTOP": "int:19", + "CSTOPB": "int:64", + "CSUSP": "int:26", + "DT_BLK": "int:6", + "DT_CHR": "int:2", + "DT_DIR": "int:4", + "DT_FIFO": "int:1", + "DT_LNK": "int:10", + "DT_REG": "int:8", + "DT_SOCK": "int:12", + "DT_UNKNOWN": "int:0", + "DT_WHT": "int:14", + "ECHO": "int:8", + "ECHOCTL": "int:512", + "ECHOE": "int:16", + "ECHOK": "int:32", + "ECHOKE": "int:2048", + "ECHONL": "int:64", + "ECHOPRT": "int:1024", + "ENCODING_DEFAULT": "int:0", + "ENCODING_FM_MARK": "int:3", + "ENCODING_FM_SPACE": "int:4", + "ENCODING_MANCHESTER": "int:5", + "ENCODING_NRZ": "int:1", + "ENCODING_NRZI": "int:2", + "EPOLLERR": "int:8", + "EPOLLET": "int:2147483648", + "EPOLLHUP": "int:16", + "EPOLLIN": "int:1", + "EPOLLMSG": "int:1024", + "EPOLLONESHOT": "int:1073741824", + "EPOLLOUT": "int:4", + "EPOLLPRI": "int:2", + "EPOLLRDBAND": "int:128", + "EPOLLRDHUP": "int:8192", + "EPOLLRDNORM": "int:64", + "EPOLLWAKEUP": "int:536870912", + "EPOLLWRBAND": "int:512", + "EPOLLWRNORM": "int:256", + "EPOLL_CLOEXEC": "int:524288", + "EPOLL_CTL_ADD": "int:1", + "EPOLL_CTL_DEL": "int:2", + "EPOLL_CTL_MOD": "int:3", + "ETH_P_1588": "int:35063", + "ETH_P_8021AD": "int:34984", + "ETH_P_8021AH": "int:35047", + "ETH_P_8021Q": "int:33024", + "ETH_P_802_2": "int:4", + "ETH_P_802_3": "int:1", + "ETH_P_802_3_MIN": "int:1536", + "ETH_P_802_EX1": "int:34997", + "ETH_P_AARP": "int:33011", + "ETH_P_AF_IUCV": "int:64507", + "ETH_P_ALL": "int:3", + "ETH_P_AOE": "int:34978", + "ETH_P_ARCNET": "int:26", + "ETH_P_ARP": "int:2054", + "ETH_P_ATALK": "int:32923", + "ETH_P_ATMFATE": "int:34948", + "ETH_P_ATMMPOA": "int:34892", + "ETH_P_AX25": "int:2", + "ETH_P_BATMAN": "int:17157", + "ETH_P_BPQ": "int:2303", + "ETH_P_CAIF": "int:247", + "ETH_P_CAN": "int:12", + "ETH_P_CANFD": "int:13", + "ETH_P_CONTROL": "int:22", + "ETH_P_CUST": "int:24582", + "ETH_P_DDCMP": "int:6", + "ETH_P_DEC": "int:24576", + "ETH_P_DIAG": "int:24581", + "ETH_P_DNA_DL": "int:24577", + "ETH_P_DNA_RC": "int:24578", + "ETH_P_DNA_RT": "int:24579", + "ETH_P_DSA": "int:27", + "ETH_P_ECONET": "int:24", + "ETH_P_EDSA": "int:56026", + "ETH_P_FCOE": "int:35078", + "ETH_P_FIP": "int:35092", + "ETH_P_HDLC": "int:25", + "ETH_P_IEEE802154": "int:246", + "ETH_P_IEEEPUP": "int:2560", + "ETH_P_IEEEPUPAT": "int:2561", + "ETH_P_IP": "int:2048", + "ETH_P_IPV6": "int:34525", + "ETH_P_IPX": "int:33079", + "ETH_P_IRDA": "int:23", + "ETH_P_LAT": "int:24580", + "ETH_P_LINK_CTL": "int:34924", + "ETH_P_LOCALTALK": "int:9", + "ETH_P_LOOP": "int:96", + "ETH_P_MOBITEX": "int:21", + "ETH_P_MPLS_MC": "int:34888", + "ETH_P_MPLS_UC": "int:34887", + "ETH_P_MVRP": "int:35061", + "ETH_P_PAE": "int:34958", + "ETH_P_PAUSE": "int:34824", + "ETH_P_PHONET": "int:245", + "ETH_P_PPPTALK": "int:16", + "ETH_P_PPP_DISC": "int:34915", + "ETH_P_PPP_MP": "int:8", + "ETH_P_PPP_SES": "int:34916", + "ETH_P_PRP": "int:35067", + "ETH_P_PUP": "int:512", + "ETH_P_PUPAT": "int:513", + "ETH_P_QINQ1": "int:37120", + "ETH_P_QINQ2": "int:37376", + "ETH_P_QINQ3": "int:37632", + "ETH_P_RARP": "int:32821", + "ETH_P_SCA": "int:24583", + "ETH_P_SLOW": "int:34825", + "ETH_P_SNAP": "int:5", + "ETH_P_TDLS": "int:35085", + "ETH_P_TEB": "int:25944", + "ETH_P_TIPC": "int:35018", + "ETH_P_TRAILER": "int:28", + "ETH_P_TR_802_2": "int:17", + "ETH_P_WAN_PPP": "int:7", + "ETH_P_WCCP": "int:34878", + "ETH_P_X25": "int:2053", + "EXTA": "int:14", + "EXTB": "int:15", + "EXTPROC": "int:65536", + "FD_CLOEXEC": "int:1", + "FD_SETSIZE": "int:1024", + "FLUSHO": "int:4096", + "F_DUPFD": "int:0", + "F_DUPFD_CLOEXEC": "int:1030", + "F_EXLCK": "int:4", + "F_GETFD": "int:1", + "F_GETFL": "int:3", + "F_GETLEASE": "int:1025", + "F_GETLK": "int:5", + "F_GETLK64": "int:5", + "F_GETOWN": "int:9", + "F_GETOWN_EX": "int:16", + "F_GETPIPE_SZ": "int:1032", + "F_GETSIG": "int:11", + "F_LOCK": "int:1", + "F_NOTIFY": "int:1026", + "F_OK": "int:0", + "F_RDLCK": "int:0", + "F_SETFD": "int:2", + "F_SETFL": "int:4", + "F_SETLEASE": "int:1024", + "F_SETLK": "int:6", + "F_SETLK64": "int:6", + "F_SETLKW": "int:7", + "F_SETLKW64": "int:7", + "F_SETOWN": "int:8", + "F_SETOWN_EX": "int:15", + "F_SETPIPE_SZ": "int:1031", + "F_SETSIG": "int:10", + "F_SHLCK": "int:8", + "F_TEST": "int:3", + "F_TLOCK": "int:2", + "F_ULOCK": "int:0", + "F_UNLCK": "int:2", + "F_WRLCK": "int:1", + "HUPCL": "int:1024", + "ICANON": "int:2", + "ICMPV6_FILTER": "int:1", + "ICRNL": "int:256", + "IEXTEN": "int:32768", + "IFA_ADDRESS": "int:1", + "IFA_ANYCAST": "int:5", + "IFA_BROADCAST": "int:4", + "IFA_CACHEINFO": "int:6", + "IFA_F_DADFAILED": "int:8", + "IFA_F_DEPRECATED": "int:32", + "IFA_F_HOMEADDRESS": "int:16", + "IFA_F_NODAD": "int:2", + "IFA_F_OPTIMISTIC": "int:4", + "IFA_F_PERMANENT": "int:128", + "IFA_F_SECONDARY": "int:1", + "IFA_F_TEMPORARY": "int:1", + "IFA_F_TENTATIVE": "int:64", + "IFA_LABEL": "int:3", + "IFA_LOCAL": "int:2", + "IFA_MAX": "int:7", + "IFA_MULTICAST": "int:7", + "IFA_UNSPEC": "int:0", + "IFF_802_1Q_VLAN": "int:1", + "IFF_ALLMULTI": "int:512", + "IFF_ATTACH_QUEUE": "int:512", + "IFF_AUTOMEDIA": "int:16384", + "IFF_BONDING": "int:32", + "IFF_BRIDGE_PORT": "int:16384", + "IFF_BROADCAST": "int:2", + "IFF_DEBUG": "int:4", + "IFF_DETACH_QUEUE": "int:1024", + "IFF_DISABLE_NETPOLL": "int:4096", + "IFF_DONT_BRIDGE": "int:2048", + "IFF_DORMANT": "int:131072", + "IFF_DYNAMIC": "int:32768", + "IFF_EBRIDGE": "int:2", + "IFF_ECHO": "int:262144", + "IFF_ISATAP": "int:128", + "IFF_LIVE_ADDR_CHANGE": "int:1048576", + "IFF_LOOPBACK": "int:8", + "IFF_LOWER_UP": "int:65536", + "IFF_MACVLAN": "int:2097152", + "IFF_MACVLAN_PORT": "int:8192", + "IFF_MASTER": "int:1024", + "IFF_MASTER_8023AD": "int:8", + "IFF_MASTER_ALB": "int:16", + "IFF_MASTER_ARPMON": "int:256", + "IFF_MULTICAST": "int:4096", + "IFF_MULTI_QUEUE": "int:256", + "IFF_NOARP": "int:128", + "IFF_NOFILTER": "int:4096", + "IFF_NOTRAILERS": "int:32", + "IFF_NO_PI": "int:4096", + "IFF_ONE_QUEUE": "int:8192", + "IFF_OVS_DATAPATH": "int:32768", + "IFF_PERSIST": "int:2048", + "IFF_POINTOPOINT": "int:16", + "IFF_PORTSEL": "int:8192", + "IFF_PROMISC": "int:256", + "IFF_RUNNING": "int:64", + "IFF_SLAVE": "int:2048", + "IFF_SLAVE_INACTIVE": "int:4", + "IFF_SLAVE_NEEDARP": "int:64", + "IFF_SUPP_NOFCS": "int:524288", + "IFF_TAP": "int:2", + "IFF_TEAM_PORT": "int:262144", + "IFF_TUN": "int:1", + "IFF_TUN_EXCL": "int:32768", + "IFF_TX_SKB_SHARING": "int:65536", + "IFF_UNICAST_FLT": "int:131072", + "IFF_UP": "int:1", + "IFF_VNET_HDR": "int:16384", + "IFF_VOLATILE": "int:461914", + "IFF_WAN_HDLC": "int:512", + "IFF_XMIT_DST_RELEASE": "int:1024", + "IFLA_ADDRESS": "int:1", + "IFLA_BROADCAST": "int:2", + "IFLA_COST": "int:8", + "IFLA_IFALIAS": "int:20", + "IFLA_IFNAME": "int:3", + "IFLA_LINK": "int:5", + "IFLA_LINKINFO": "int:18", + "IFLA_LINKMODE": "int:17", + "IFLA_MAP": "int:14", + "IFLA_MASTER": "int:10", + "IFLA_MAX": "int:36", + "IFLA_MTU": "int:4", + "IFLA_NET_NS_PID": "int:19", + "IFLA_OPERSTATE": "int:16", + "IFLA_PRIORITY": "int:9", + "IFLA_PROTINFO": "int:12", + "IFLA_QDISC": "int:6", + "IFLA_STATS": "int:7", + "IFLA_TXQLEN": "int:13", + "IFLA_UNSPEC": "int:0", + "IFLA_WEIGHT": "int:15", + "IFLA_WIRELESS": "int:11", + "IFNAMSIZ": "int:16", + "IGNBRK": "int:1", + "IGNCR": "int:128", + "IGNPAR": "int:4", + "IMAXBEL": "int:8192", + "INLCR": "int:64", + "INPCK": "int:16", + "IN_ACCESS": "int:1", + "IN_ALL_EVENTS": "int:4095", + "IN_ATTRIB": "int:4", + "IN_CLASSA_HOST": "int:16777215", + "IN_CLASSA_MAX": "int:128", + "IN_CLASSA_NET": "int:4278190080", + "IN_CLASSA_NSHIFT": "int:24", + "IN_CLASSB_HOST": "int:65535", + "IN_CLASSB_MAX": "int:65536", + "IN_CLASSB_NET": "int:4294901760", + "IN_CLASSB_NSHIFT": "int:16", + "IN_CLASSC_HOST": "int:255", + "IN_CLASSC_NET": "int:4294967040", + "IN_CLASSC_NSHIFT": "int:8", + "IN_CLOEXEC": "int:524288", + "IN_CLOSE": "int:24", + "IN_CLOSE_NOWRITE": "int:16", + "IN_CLOSE_WRITE": "int:8", + "IN_CREATE": "int:256", + "IN_DELETE": "int:512", + "IN_DELETE_SELF": "int:1024", + "IN_DONT_FOLLOW": "int:33554432", + "IN_EXCL_UNLINK": "int:67108864", + "IN_IGNORED": "int:32768", + "IN_ISDIR": "int:1073741824", + "IN_LOOPBACKNET": "int:127", + "IN_MASK_ADD": "int:536870912", + "IN_MODIFY": "int:2", + "IN_MOVE": "int:192", + "IN_MOVED_FROM": "int:64", + "IN_MOVED_TO": "int:128", + "IN_MOVE_SELF": "int:2048", + "IN_NONBLOCK": "int:2048", + "IN_ONESHOT": "int:2147483648", + "IN_ONLYDIR": "int:16777216", + "IN_OPEN": "int:32", + "IN_Q_OVERFLOW": "int:16384", + "IN_UNMOUNT": "int:8192", + "IPPROTO_AH": "int:51", + "IPPROTO_BEETPH": "int:94", + "IPPROTO_COMP": "int:108", + "IPPROTO_DCCP": "int:33", + "IPPROTO_DSTOPTS": "int:60", + "IPPROTO_EGP": "int:8", + "IPPROTO_ENCAP": "int:98", + "IPPROTO_ESP": "int:50", + "IPPROTO_FRAGMENT": "int:44", + "IPPROTO_GRE": "int:47", + "IPPROTO_HOPOPTS": "int:0", + "IPPROTO_ICMP": "int:1", + "IPPROTO_ICMPV6": "int:58", + "IPPROTO_IDP": "int:22", + "IPPROTO_IGMP": "int:2", + "IPPROTO_IP": "int:0", + "IPPROTO_IPIP": "int:4", + "IPPROTO_IPV6": "int:41", + "IPPROTO_MH": "int:135", + "IPPROTO_MTP": "int:92", + "IPPROTO_NONE": "int:59", + "IPPROTO_PIM": "int:103", + "IPPROTO_PUP": "int:12", + "IPPROTO_RAW": "int:255", + "IPPROTO_ROUTING": "int:43", + "IPPROTO_RSVP": "int:46", + "IPPROTO_SCTP": "int:132", + "IPPROTO_TCP": "int:6", + "IPPROTO_TP": "int:29", + "IPPROTO_UDP": "int:17", + "IPPROTO_UDPLITE": "int:136", + "IPV6_2292DSTOPTS": "int:4", + "IPV6_2292HOPLIMIT": "int:8", + "IPV6_2292HOPOPTS": "int:3", + "IPV6_2292PKTINFO": "int:2", + "IPV6_2292PKTOPTIONS": "int:6", + "IPV6_2292RTHDR": "int:5", + "IPV6_ADDRFORM": "int:1", + "IPV6_ADD_MEMBERSHIP": "int:20", + "IPV6_AUTHHDR": "int:10", + "IPV6_CHECKSUM": "int:7", + "IPV6_DROP_MEMBERSHIP": "int:21", + "IPV6_DSTOPTS": "int:59", + "IPV6_HOPLIMIT": "int:52", + "IPV6_HOPOPTS": "int:54", + "IPV6_IPSEC_POLICY": "int:34", + "IPV6_JOIN_ANYCAST": "int:27", + "IPV6_JOIN_GROUP": "int:20", + "IPV6_LEAVE_ANYCAST": "int:28", + "IPV6_LEAVE_GROUP": "int:21", + "IPV6_MTU": "int:24", + "IPV6_MTU_DISCOVER": "int:23", + "IPV6_MULTICAST_HOPS": "int:18", + "IPV6_MULTICAST_IF": "int:17", + "IPV6_MULTICAST_LOOP": "int:19", + "IPV6_NEXTHOP": "int:9", + "IPV6_PKTINFO": "int:50", + "IPV6_PMTUDISC_DO": "int:2", + "IPV6_PMTUDISC_DONT": "int:0", + "IPV6_PMTUDISC_PROBE": "int:3", + "IPV6_PMTUDISC_WANT": "int:1", + "IPV6_RECVDSTOPTS": "int:58", + "IPV6_RECVERR": "int:25", + "IPV6_RECVHOPLIMIT": "int:51", + "IPV6_RECVHOPOPTS": "int:53", + "IPV6_RECVPKTINFO": "int:49", + "IPV6_RECVRTHDR": "int:56", + "IPV6_RECVTCLASS": "int:66", + "IPV6_ROUTER_ALERT": "int:22", + "IPV6_RTHDR": "int:57", + "IPV6_RTHDRDSTOPTS": "int:55", + "IPV6_RTHDR_LOOSE": "int:0", + "IPV6_RTHDR_STRICT": "int:1", + "IPV6_RTHDR_TYPE_0": "int:0", + "IPV6_RXDSTOPTS": "int:59", + "IPV6_RXHOPOPTS": "int:54", + "IPV6_TCLASS": "int:67", + "IPV6_UNICAST_HOPS": "int:16", + "IPV6_V6ONLY": "int:26", + "IPV6_XFRM_POLICY": "int:35", + "IP_ADD_MEMBERSHIP": "int:35", + "IP_ADD_SOURCE_MEMBERSHIP": "int:39", + "IP_BLOCK_SOURCE": "int:38", + "IP_DEFAULT_MULTICAST_LOOP": "int:1", + "IP_DEFAULT_MULTICAST_TTL": "int:1", + "IP_DF": "int:16384", + "IP_DROP_MEMBERSHIP": "int:36", + "IP_DROP_SOURCE_MEMBERSHIP": "int:40", + "IP_FREEBIND": "int:15", + "IP_HDRINCL": "int:3", + "IP_IPSEC_POLICY": "int:16", + "IP_MAXPACKET": "int:65535", + "IP_MAX_MEMBERSHIPS": "int:20", + "IP_MF": "int:8192", + "IP_MINTTL": "int:21", + "IP_MSFILTER": "int:41", + "IP_MSS": "int:576", + "IP_MTU": "int:14", + "IP_MTU_DISCOVER": "int:10", + "IP_MULTICAST_ALL": "int:49", + "IP_MULTICAST_IF": "int:32", + "IP_MULTICAST_LOOP": "int:34", + "IP_MULTICAST_TTL": "int:33", + "IP_OFFMASK": "int:8191", + "IP_OPTIONS": "int:4", + "IP_ORIGDSTADDR": "int:20", + "IP_PASSSEC": "int:18", + "IP_PKTINFO": "int:8", + "IP_PKTOPTIONS": "int:9", + "IP_PMTUDISC": "int:10", + "IP_PMTUDISC_DO": "int:2", + "IP_PMTUDISC_DONT": "int:0", + "IP_PMTUDISC_PROBE": "int:3", + "IP_PMTUDISC_WANT": "int:1", + "IP_RECVERR": "int:11", + "IP_RECVOPTS": "int:6", + "IP_RECVORIGDSTADDR": "int:20", + "IP_RECVRETOPTS": "int:7", + "IP_RECVTOS": "int:13", + "IP_RECVTTL": "int:12", + "IP_RETOPTS": "int:7", + "IP_RF": "int:32768", + "IP_ROUTER_ALERT": "int:5", + "IP_TOS": "int:1", + "IP_TRANSPARENT": "int:19", + "IP_TTL": "int:2", + "IP_UNBLOCK_SOURCE": "int:37", + "IP_UNICAST_IF": "int:50", + "IP_XFRM_POLICY": "int:17", + "ISIG": "int:1", + "ISTRIP": "int:32", + "IUCLC": "int:512", + "IUTF8": "int:16384", + "IXANY": "int:2048", + "IXOFF": "int:4096", + "IXON": "int:1024", + "ImplementsGetwd": "bool:true", + "LINUX_REBOOT_CMD_CAD_OFF": "int:0", + "LINUX_REBOOT_CMD_CAD_ON": "int:2309737967", + "LINUX_REBOOT_CMD_HALT": "int:3454992675", + "LINUX_REBOOT_CMD_KEXEC": "int:1163412803", + "LINUX_REBOOT_CMD_POWER_OFF": "int:1126301404", + "LINUX_REBOOT_CMD_RESTART": "int:19088743", + "LINUX_REBOOT_CMD_RESTART2": "int:2712847316", + "LINUX_REBOOT_CMD_SW_SUSPEND": "int:3489725666", + "LINUX_REBOOT_MAGIC1": "int:4276215469", + "LINUX_REBOOT_MAGIC2": "int:672274793", + "LOCK_EX": "int:2", + "LOCK_NB": "int:4", + "LOCK_SH": "int:1", + "LOCK_UN": "int:8", + "MADV_DODUMP": "int:17", + "MADV_DOFORK": "int:11", + "MADV_DONTDUMP": "int:16", + "MADV_DONTFORK": "int:10", + "MADV_DONTNEED": "int:4", + "MADV_HUGEPAGE": "int:14", + "MADV_HWPOISON": "int:100", + "MADV_MERGEABLE": "int:12", + "MADV_NOHUGEPAGE": "int:15", + "MADV_NORMAL": "int:0", + "MADV_RANDOM": "int:1", + "MADV_REMOVE": "int:9", + "MADV_SEQUENTIAL": "int:2", + "MADV_UNMERGEABLE": "int:13", + "MADV_WILLNEED": "int:3", + "MAP_ANON": "int:32", + "MAP_ANONYMOUS": "int:32", + "MAP_DENYWRITE": "int:2048", + "MAP_EXECUTABLE": "int:4096", + "MAP_FILE": "int:0", + "MAP_FIXED": "int:16", + "MAP_GROWSDOWN": "int:256", + "MAP_HUGETLB": "int:262144", + "MAP_HUGE_MASK": "int:63", + "MAP_HUGE_SHIFT": "int:26", + "MAP_LOCKED": "int:8192", + "MAP_NONBLOCK": "int:65536", + "MAP_NORESERVE": "int:16384", + "MAP_POPULATE": "int:32768", + "MAP_PRIVATE": "int:2", + "MAP_SHARED": "int:1", + "MAP_STACK": "int:131072", + "MAP_TYPE": "int:15", + "MCL_CURRENT": "int:1", + "MCL_FUTURE": "int:2", + "MNT_DETACH": "int:2", + "MNT_EXPIRE": "int:4", + "MNT_FORCE": "int:1", + "MSG_CMSG_CLOEXEC": "int:1073741824", + "MSG_CONFIRM": "int:2048", + "MSG_CTRUNC": "int:8", + "MSG_DONTROUTE": "int:4", + "MSG_DONTWAIT": "int:64", + "MSG_EOR": "int:128", + "MSG_ERRQUEUE": "int:8192", + "MSG_FASTOPEN": "int:536870912", + "MSG_FIN": "int:512", + "MSG_MORE": "int:32768", + "MSG_NOSIGNAL": "int:16384", + "MSG_OOB": "int:1", + "MSG_PEEK": "int:2", + "MSG_PROXY": "int:16", + "MSG_RST": "int:4096", + "MSG_SYN": "int:1024", + "MSG_TRUNC": "int:32", + "MSG_TRYHARD": "int:4", + "MSG_WAITALL": "int:256", + "MSG_WAITFORONE": "int:65536", + "MS_ACTIVE": "int:1073741824", + "MS_ASYNC": "int:1", + "MS_BIND": "int:4096", + "MS_DIRSYNC": "int:128", + "MS_INVALIDATE": "int:2", + "MS_I_VERSION": "int:8388608", + "MS_KERNMOUNT": "int:4194304", + "MS_MANDLOCK": "int:64", + "MS_MGC_MSK": "int:4294901760", + "MS_MGC_VAL": "int:3236757504", + "MS_MOVE": "int:8192", + "MS_NOATIME": "int:1024", + "MS_NODEV": "int:4", + "MS_NODIRATIME": "int:2048", + "MS_NOEXEC": "int:8", + "MS_NOSUID": "int:2", + "MS_NOUSER": "int:-2147483648", + "MS_POSIXACL": "int:65536", + "MS_PRIVATE": "int:262144", + "MS_RDONLY": "int:1", + "MS_REC": "int:16384", + "MS_RELATIME": "int:2097152", + "MS_REMOUNT": "int:32", + "MS_RMT_MASK": "int:8388689", + "MS_SHARED": "int:1048576", + "MS_SILENT": "int:32768", + "MS_SLAVE": "int:524288", + "MS_STRICTATIME": "int:16777216", + "MS_SYNC": "int:4", + "MS_SYNCHRONOUS": "int:16", + "MS_UNBINDABLE": "int:131072", + "NAME_MAX": "int:255", + "NETLINK_ADD_MEMBERSHIP": "int:1", + "NETLINK_AUDIT": "int:9", + "NETLINK_BROADCAST_ERROR": "int:4", + "NETLINK_CONNECTOR": "int:11", + "NETLINK_CRYPTO": "int:21", + "NETLINK_DNRTMSG": "int:14", + "NETLINK_DROP_MEMBERSHIP": "int:2", + "NETLINK_ECRYPTFS": "int:19", + "NETLINK_FIB_LOOKUP": "int:10", + "NETLINK_FIREWALL": "int:3", + "NETLINK_GENERIC": "int:16", + "NETLINK_INET_DIAG": "int:4", + "NETLINK_IP6_FW": "int:13", + "NETLINK_ISCSI": "int:8", + "NETLINK_KOBJECT_UEVENT": "int:15", + "NETLINK_NETFILTER": "int:12", + "NETLINK_NFLOG": "int:5", + "NETLINK_NO_ENOBUFS": "int:5", + "NETLINK_PKTINFO": "int:3", + "NETLINK_RDMA": "int:20", + "NETLINK_ROUTE": "int:0", + "NETLINK_RX_RING": "int:6", + "NETLINK_SCSITRANSPORT": "int:18", + "NETLINK_SELINUX": "int:7", + "NETLINK_SOCK_DIAG": "int:4", + "NETLINK_TX_RING": "int:7", + "NETLINK_UNUSED": "int:1", + "NETLINK_USERSOCK": "int:2", + "NETLINK_XFRM": "int:6", + "NLA_ALIGNTO": "int:4", + "NLA_F_NESTED": "int:32768", + "NLA_F_NET_BYTEORDER": "int:16384", + "NLA_HDRLEN": "int:4", + "NLMSG_ALIGNTO": "int:4", + "NLMSG_DONE": "int:3", + "NLMSG_ERROR": "int:2", + "NLMSG_HDRLEN": "int:16", + "NLMSG_MIN_TYPE": "int:16", + "NLMSG_NOOP": "int:1", + "NLMSG_OVERRUN": "int:4", + "NLM_F_ACK": "int:4", + "NLM_F_APPEND": "int:2048", + "NLM_F_ATOMIC": "int:1024", + "NLM_F_CREATE": "int:1024", + "NLM_F_DUMP": "int:768", + "NLM_F_DUMP_INTR": "int:16", + "NLM_F_ECHO": "int:8", + "NLM_F_EXCL": "int:512", + "NLM_F_MATCH": "int:512", + "NLM_F_MULTI": "int:2", + "NLM_F_REPLACE": "int:256", + "NLM_F_REQUEST": "int:1", + "NLM_F_ROOT": "int:256", + "NOFLSH": "int:128", + "OCRNL": "int:8", + "OFDEL": "int:128", + "OFILL": "int:64", + "OLCUC": "int:2", + "ONLCR": "int:4", + "ONLRET": "int:32", + "ONOCR": "int:16", + "OPOST": "int:1", + "O_ACCMODE": "int:3", + "O_APPEND": "int:1024", + "O_ASYNC": "int:8192", + "O_CLOEXEC": "int:524288", + "O_CREAT": "int:64", + "O_DIRECT": "int:65536", + "O_DIRECTORY": "int:16384", + "O_DSYNC": "int:4096", + "O_EXCL": "int:128", + "O_FSYNC": "int:1052672", + "O_LARGEFILE": "int:0", + "O_NDELAY": "int:2048", + "O_NOATIME": "int:262144", + "O_NOCTTY": "int:256", + "O_NOFOLLOW": "int:32768", + "O_NONBLOCK": "int:2048", + "O_PATH": "int:2097152", + "O_RDONLY": "int:0", + "O_RDWR": "int:2", + "O_RSYNC": "int:1052672", + "O_SYNC": "int:1052672", + "O_TMPFILE": "int:4259840", + "O_TRUNC": "int:512", + "O_WRONLY": "int:1", + "PACKET_ADD_MEMBERSHIP": "int:1", + "PACKET_AUXDATA": "int:8", + "PACKET_BROADCAST": "int:1", + "PACKET_COPY_THRESH": "int:7", + "PACKET_DROP_MEMBERSHIP": "int:2", + "PACKET_FANOUT": "int:18", + "PACKET_FANOUT_CPU": "int:2", + "PACKET_FANOUT_FLAG_DEFRAG": "int:32768", + "PACKET_FANOUT_FLAG_ROLLOVER": "int:4096", + "PACKET_FANOUT_HASH": "int:0", + "PACKET_FANOUT_LB": "int:1", + "PACKET_FANOUT_RND": "int:4", + "PACKET_FANOUT_ROLLOVER": "int:3", + "PACKET_FASTROUTE": "int:6", + "PACKET_HDRLEN": "int:11", + "PACKET_HOST": "int:0", + "PACKET_LOOPBACK": "int:5", + "PACKET_LOSS": "int:14", + "PACKET_MR_ALLMULTI": "int:2", + "PACKET_MR_MULTICAST": "int:0", + "PACKET_MR_PROMISC": "int:1", + "PACKET_MR_UNICAST": "int:3", + "PACKET_MULTICAST": "int:2", + "PACKET_ORIGDEV": "int:9", + "PACKET_OTHERHOST": "int:3", + "PACKET_OUTGOING": "int:4", + "PACKET_RECV_OUTPUT": "int:3", + "PACKET_RESERVE": "int:12", + "PACKET_RX_RING": "int:5", + "PACKET_STATISTICS": "int:6", + "PACKET_TIMESTAMP": "int:17", + "PACKET_TX_HAS_OFF": "int:19", + "PACKET_TX_RING": "int:13", + "PACKET_TX_TIMESTAMP": "int:16", + "PACKET_VERSION": "int:10", + "PACKET_VNET_HDR": "int:15", + "PARENB": "int:256", + "PARITY_CRC16_PR0": "int:2", + "PARITY_CRC16_PR0_CCITT": "int:4", + "PARITY_CRC16_PR1": "int:3", + "PARITY_CRC16_PR1_CCITT": "int:5", + "PARITY_CRC32_PR0_CCITT": "int:6", + "PARITY_CRC32_PR1_CCITT": "int:7", + "PARITY_DEFAULT": "int:0", + "PARITY_NONE": "int:1", + "PARMRK": "int:8", + "PARODD": "int:512", + "PENDIN": "int:16384", + "PRIO_PGRP": "int:1", + "PRIO_PROCESS": "int:0", + "PRIO_USER": "int:2", + "PROT_EXEC": "int:4", + "PROT_GROWSDOWN": "int:16777216", + "PROT_GROWSUP": "int:33554432", + "PROT_NONE": "int:0", + "PROT_READ": "int:1", + "PROT_WRITE": "int:2", + "PR_CAPBSET_DROP": "int:24", + "PR_CAPBSET_READ": "int:23", + "PR_ENDIAN_BIG": "int:0", + "PR_ENDIAN_LITTLE": "int:1", + "PR_ENDIAN_PPC_LITTLE": "int:2", + "PR_FPEMU_NOPRINT": "int:1", + "PR_FPEMU_SIGFPE": "int:2", + "PR_FP_EXC_ASYNC": "int:2", + "PR_FP_EXC_DISABLED": "int:0", + "PR_FP_EXC_DIV": "int:65536", + "PR_FP_EXC_INV": "int:1048576", + "PR_FP_EXC_NONRECOV": "int:1", + "PR_FP_EXC_OVF": "int:131072", + "PR_FP_EXC_PRECISE": "int:3", + "PR_FP_EXC_RES": "int:524288", + "PR_FP_EXC_SW_ENABLE": "int:128", + "PR_FP_EXC_UND": "int:262144", + "PR_GET_CHILD_SUBREAPER": "int:37", + "PR_GET_DUMPABLE": "int:3", + "PR_GET_ENDIAN": "int:19", + "PR_GET_FPEMU": "int:9", + "PR_GET_FPEXC": "int:11", + "PR_GET_KEEPCAPS": "int:7", + "PR_GET_NAME": "int:16", + "PR_GET_NO_NEW_PRIVS": "int:39", + "PR_GET_PDEATHSIG": "int:2", + "PR_GET_SECCOMP": "int:21", + "PR_GET_SECUREBITS": "int:27", + "PR_GET_TID_ADDRESS": "int:40", + "PR_GET_TIMERSLACK": "int:30", + "PR_GET_TIMING": "int:13", + "PR_GET_TSC": "int:25", + "PR_GET_UNALIGN": "int:5", + "PR_MCE_KILL": "int:33", + "PR_MCE_KILL_CLEAR": "int:0", + "PR_MCE_KILL_DEFAULT": "int:2", + "PR_MCE_KILL_EARLY": "int:1", + "PR_MCE_KILL_GET": "int:34", + "PR_MCE_KILL_LATE": "int:0", + "PR_MCE_KILL_SET": "int:1", + "PR_SET_CHILD_SUBREAPER": "int:36", + "PR_SET_DUMPABLE": "int:4", + "PR_SET_ENDIAN": "int:20", + "PR_SET_FPEMU": "int:10", + "PR_SET_FPEXC": "int:12", + "PR_SET_KEEPCAPS": "int:8", + "PR_SET_MM": "int:35", + "PR_SET_MM_ARG_END": "int:9", + "PR_SET_MM_ARG_START": "int:8", + "PR_SET_MM_AUXV": "int:12", + "PR_SET_MM_BRK": "int:7", + "PR_SET_MM_END_CODE": "int:2", + "PR_SET_MM_END_DATA": "int:4", + "PR_SET_MM_ENV_END": "int:11", + "PR_SET_MM_ENV_START": "int:10", + "PR_SET_MM_EXE_FILE": "int:13", + "PR_SET_MM_START_BRK": "int:6", + "PR_SET_MM_START_CODE": "int:1", + "PR_SET_MM_START_DATA": "int:3", + "PR_SET_MM_START_STACK": "int:5", + "PR_SET_NAME": "int:15", + "PR_SET_NO_NEW_PRIVS": "int:38", + "PR_SET_PDEATHSIG": "int:1", + "PR_SET_PTRACER": "int:1499557217", + "PR_SET_PTRACER_ANY": "int:-1", + "PR_SET_SECCOMP": "int:22", + "PR_SET_SECUREBITS": "int:28", + "PR_SET_TIMERSLACK": "int:29", + "PR_SET_TIMING": "int:14", + "PR_SET_TSC": "int:26", + "PR_SET_UNALIGN": "int:6", + "PR_TASK_PERF_EVENTS_DISABLE": "int:31", + "PR_TASK_PERF_EVENTS_ENABLE": "int:32", + "PR_TIMING_STATISTICAL": "int:0", + "PR_TIMING_TIMESTAMP": "int:1", + "PR_TSC_ENABLE": "int:1", + "PR_TSC_SIGSEGV": "int:2", + "PR_UNALIGN_NOPRINT": "int:1", + "PR_UNALIGN_SIGBUS": "int:2", + "PTRACE_ATTACH": "int:16", + "PTRACE_CONT": "int:7", + "PTRACE_DETACH": "int:17", + "PTRACE_EVENT_CLONE": "int:3", + "PTRACE_EVENT_EXEC": "int:4", + "PTRACE_EVENT_EXIT": "int:6", + "PTRACE_EVENT_FORK": "int:1", + "PTRACE_EVENT_SECCOMP": "int:7", + "PTRACE_EVENT_STOP": "int:128", + "PTRACE_EVENT_VFORK": "int:2", + "PTRACE_EVENT_VFORK_DONE": "int:5", + "PTRACE_GETEVENTMSG": "int:16897", + "PTRACE_GETREGS": "int:12", + "PTRACE_GETREGSET": "int:16900", + "PTRACE_GETSIGINFO": "int:16898", + "PTRACE_GETSIGMASK": "int:16906", + "PTRACE_INTERRUPT": "int:16903", + "PTRACE_KILL": "int:8", + "PTRACE_LISTEN": "int:16904", + "PTRACE_O_EXITKILL": "int:1048576", + "PTRACE_O_MASK": "int:1048831", + "PTRACE_O_TRACECLONE": "int:8", + "PTRACE_O_TRACEEXEC": "int:16", + "PTRACE_O_TRACEEXIT": "int:64", + "PTRACE_O_TRACEFORK": "int:2", + "PTRACE_O_TRACESECCOMP": "int:128", + "PTRACE_O_TRACESYSGOOD": "int:1", + "PTRACE_O_TRACEVFORK": "int:4", + "PTRACE_O_TRACEVFORKDONE": "int:32", + "PTRACE_PEEKDATA": "int:2", + "PTRACE_PEEKSIGINFO": "int:16905", + "PTRACE_PEEKSIGINFO_SHARED": "int:1", + "PTRACE_PEEKTEXT": "int:1", + "PTRACE_PEEKUSR": "int:3", + "PTRACE_POKEDATA": "int:5", + "PTRACE_POKETEXT": "int:4", + "PTRACE_POKEUSR": "int:6", + "PTRACE_SEIZE": "int:16902", + "PTRACE_SETOPTIONS": "int:16896", + "PTRACE_SETREGS": "int:13", + "PTRACE_SETREGSET": "int:16901", + "PTRACE_SETSIGINFO": "int:16899", + "PTRACE_SETSIGMASK": "int:16907", + "PTRACE_SINGLESTEP": "int:9", + "PTRACE_SYSCALL": "int:24", + "PTRACE_TRACEME": "int:0", + "PathMax": "int:4096", + "RLIMIT_AS": "int:9", + "RLIMIT_CORE": "int:4", + "RLIMIT_CPU": "int:0", + "RLIMIT_DATA": "int:2", + "RLIMIT_FSIZE": "int:1", + "RLIMIT_NOFILE": "int:7", + "RLIMIT_STACK": "int:3", + "RLIM_INFINITY": "int:-1", + "RTAX_ADVMSS": "int:8", + "RTAX_CWND": "int:7", + "RTAX_FEATURES": "int:12", + "RTAX_FEATURE_ALLFRAG": "int:8", + "RTAX_FEATURE_ECN": "int:1", + "RTAX_FEATURE_SACK": "int:2", + "RTAX_FEATURE_TIMESTAMP": "int:4", + "RTAX_HOPLIMIT": "int:10", + "RTAX_INITCWND": "int:11", + "RTAX_INITRWND": "int:14", + "RTAX_LOCK": "int:1", + "RTAX_MAX": "int:15", + "RTAX_MTU": "int:2", + "RTAX_QUICKACK": "int:15", + "RTAX_REORDERING": "int:9", + "RTAX_RTO_MIN": "int:13", + "RTAX_RTT": "int:4", + "RTAX_RTTVAR": "int:5", + "RTAX_SSTHRESH": "int:6", + "RTAX_UNSPEC": "int:0", + "RTAX_WINDOW": "int:3", + "RTA_ALIGNTO": "int:4", + "RTA_CACHEINFO": "int:12", + "RTA_DST": "int:1", + "RTA_FLOW": "int:11", + "RTA_GATEWAY": "int:5", + "RTA_IIF": "int:3", + "RTA_MAX": "int:17", + "RTA_METRICS": "int:8", + "RTA_MULTIPATH": "int:9", + "RTA_OIF": "int:4", + "RTA_PREFSRC": "int:7", + "RTA_PRIORITY": "int:6", + "RTA_SRC": "int:2", + "RTA_TABLE": "int:15", + "RTA_UNSPEC": "int:0", + "RTCF_DIRECTSRC": "int:67108864", + "RTCF_DOREDIRECT": "int:16777216", + "RTCF_LOG": "int:33554432", + "RTCF_MASQ": "int:4194304", + "RTCF_NAT": "int:8388608", + "RTCF_VALVE": "int:2097152", + "RTF_ADDRCLASSMASK": "int:4160749568", + "RTF_ADDRCONF": "int:262144", + "RTF_ALLONLINK": "int:131072", + "RTF_BROADCAST": "int:268435456", + "RTF_CACHE": "int:16777216", + "RTF_DEFAULT": "int:65536", + "RTF_DYNAMIC": "int:16", + "RTF_FLOW": "int:33554432", + "RTF_GATEWAY": "int:2", + "RTF_HOST": "int:4", + "RTF_INTERFACE": "int:1073741824", + "RTF_IRTT": "int:256", + "RTF_LINKRT": "int:1048576", + "RTF_LOCAL": "int:2147483648", + "RTF_MODIFIED": "int:32", + "RTF_MSS": "int:64", + "RTF_MTU": "int:64", + "RTF_MULTICAST": "int:536870912", + "RTF_NAT": "int:134217728", + "RTF_NOFORWARD": "int:4096", + "RTF_NONEXTHOP": "int:2097152", + "RTF_NOPMTUDISC": "int:16384", + "RTF_POLICY": "int:67108864", + "RTF_REINSTATE": "int:8", + "RTF_REJECT": "int:512", + "RTF_STATIC": "int:1024", + "RTF_THROW": "int:8192", + "RTF_UP": "int:1", + "RTF_WINDOW": "int:128", + "RTF_XRESOLVE": "int:2048", + "RTM_BASE": "int:16", + "RTM_DELACTION": "int:49", + "RTM_DELADDR": "int:21", + "RTM_DELADDRLABEL": "int:73", + "RTM_DELLINK": "int:17", + "RTM_DELMDB": "int:85", + "RTM_DELNEIGH": "int:29", + "RTM_DELQDISC": "int:37", + "RTM_DELROUTE": "int:25", + "RTM_DELRULE": "int:33", + "RTM_DELTCLASS": "int:41", + "RTM_DELTFILTER": "int:45", + "RTM_F_CLONED": "int:512", + "RTM_F_EQUALIZE": "int:1024", + "RTM_F_NOTIFY": "int:256", + "RTM_F_PREFIX": "int:2048", + "RTM_GETACTION": "int:50", + "RTM_GETADDR": "int:22", + "RTM_GETADDRLABEL": "int:74", + "RTM_GETANYCAST": "int:62", + "RTM_GETDCB": "int:78", + "RTM_GETLINK": "int:18", + "RTM_GETMDB": "int:86", + "RTM_GETMULTICAST": "int:58", + "RTM_GETNEIGH": "int:30", + "RTM_GETNEIGHTBL": "int:66", + "RTM_GETNETCONF": "int:82", + "RTM_GETQDISC": "int:38", + "RTM_GETROUTE": "int:26", + "RTM_GETRULE": "int:34", + "RTM_GETTCLASS": "int:42", + "RTM_GETTFILTER": "int:46", + "RTM_MAX": "int:87", + "RTM_NEWACTION": "int:48", + "RTM_NEWADDR": "int:20", + "RTM_NEWADDRLABEL": "int:72", + "RTM_NEWLINK": "int:16", + "RTM_NEWMDB": "int:84", + "RTM_NEWNDUSEROPT": "int:68", + "RTM_NEWNEIGH": "int:28", + "RTM_NEWNEIGHTBL": "int:64", + "RTM_NEWNETCONF": "int:80", + "RTM_NEWPREFIX": "int:52", + "RTM_NEWQDISC": "int:36", + "RTM_NEWROUTE": "int:24", + "RTM_NEWRULE": "int:32", + "RTM_NEWTCLASS": "int:40", + "RTM_NEWTFILTER": "int:44", + "RTM_NR_FAMILIES": "int:18", + "RTM_NR_MSGTYPES": "int:72", + "RTM_SETDCB": "int:79", + "RTM_SETLINK": "int:19", + "RTM_SETNEIGHTBL": "int:67", + "RTNH_ALIGNTO": "int:4", + "RTNH_F_DEAD": "int:1", + "RTNH_F_ONLINK": "int:4", + "RTNH_F_PERVASIVE": "int:2", + "RTNLGRP_IPV4_IFADDR": "int:5", + "RTNLGRP_IPV4_MROUTE": "int:6", + "RTNLGRP_IPV4_ROUTE": "int:7", + "RTNLGRP_IPV4_RULE": "int:8", + "RTNLGRP_IPV6_IFADDR": "int:9", + "RTNLGRP_IPV6_IFINFO": "int:12", + "RTNLGRP_IPV6_MROUTE": "int:10", + "RTNLGRP_IPV6_PREFIX": "int:18", + "RTNLGRP_IPV6_ROUTE": "int:11", + "RTNLGRP_IPV6_RULE": "int:19", + "RTNLGRP_LINK": "int:1", + "RTNLGRP_ND_USEROPT": "int:20", + "RTNLGRP_NEIGH": "int:3", + "RTNLGRP_NONE": "int:0", + "RTNLGRP_NOTIFY": "int:2", + "RTNLGRP_TC": "int:4", + "RTN_ANYCAST": "int:4", + "RTN_BLACKHOLE": "int:6", + "RTN_BROADCAST": "int:3", + "RTN_LOCAL": "int:2", + "RTN_MAX": "int:11", + "RTN_MULTICAST": "int:5", + "RTN_NAT": "int:10", + "RTN_PROHIBIT": "int:8", + "RTN_THROW": "int:9", + "RTN_UNICAST": "int:1", + "RTN_UNREACHABLE": "int:7", + "RTN_UNSPEC": "int:0", + "RTN_XRESOLVE": "int:11", + "RTPROT_BIRD": "int:12", + "RTPROT_BOOT": "int:3", + "RTPROT_DHCP": "int:16", + "RTPROT_DNROUTED": "int:13", + "RTPROT_GATED": "int:8", + "RTPROT_KERNEL": "int:2", + "RTPROT_MROUTED": "int:17", + "RTPROT_MRT": "int:10", + "RTPROT_NTK": "int:15", + "RTPROT_RA": "int:9", + "RTPROT_REDIRECT": "int:1", + "RTPROT_STATIC": "int:4", + "RTPROT_UNSPEC": "int:0", + "RTPROT_XORP": "int:14", + "RTPROT_ZEBRA": "int:11", + "RT_CLASS_DEFAULT": "int:253", + "RT_CLASS_LOCAL": "int:255", + "RT_CLASS_MAIN": "int:254", + "RT_CLASS_MAX": "int:255", + "RT_CLASS_UNSPEC": "int:0", + "RT_SCOPE_HOST": "int:254", + "RT_SCOPE_LINK": "int:253", + "RT_SCOPE_NOWHERE": "int:255", + "RT_SCOPE_SITE": "int:200", + "RT_SCOPE_UNIVERSE": "int:0", + "RT_TABLE_COMPAT": "int:252", + "RT_TABLE_DEFAULT": "int:253", + "RT_TABLE_LOCAL": "int:255", + "RT_TABLE_MAIN": "int:254", + "RT_TABLE_MAX": "int:4294967295", + "RT_TABLE_UNSPEC": "int:0", + "RUSAGE_CHILDREN": "int:-1", + "RUSAGE_SELF": "int:0", + "RUSAGE_THREAD": "int:1", + "SCM_CREDENTIALS": "int:2", + "SCM_RIGHTS": "int:1", + "SCM_TIMESTAMP": "int:29", + "SCM_TIMESTAMPING": "int:37", + "SCM_TIMESTAMPNS": "int:35", + "SCM_WIFI_STATUS": "int:41", + "SHUT_RD": "int:0", + "SHUT_RDWR": "int:2", + "SHUT_WR": "int:1", + "SIOCADDDLCI": "int:35200", + "SIOCADDMULTI": "int:35121", + "SIOCADDRT": "int:35083", + "SIOCATMARK": "int:35077", + "SIOCDARP": "int:35155", + "SIOCDELDLCI": "int:35201", + "SIOCDELMULTI": "int:35122", + "SIOCDELRT": "int:35084", + "SIOCDEVPRIVATE": "int:35312", + "SIOCDIFADDR": "int:35126", + "SIOCDRARP": "int:35168", + "SIOCGARP": "int:35156", + "SIOCGIFADDR": "int:35093", + "SIOCGIFBR": "int:35136", + "SIOCGIFBRDADDR": "int:35097", + "SIOCGIFCONF": "int:35090", + "SIOCGIFCOUNT": "int:35128", + "SIOCGIFDSTADDR": "int:35095", + "SIOCGIFENCAP": "int:35109", + "SIOCGIFFLAGS": "int:35091", + "SIOCGIFHWADDR": "int:35111", + "SIOCGIFINDEX": "int:35123", + "SIOCGIFMAP": "int:35184", + "SIOCGIFMEM": "int:35103", + "SIOCGIFMETRIC": "int:35101", + "SIOCGIFMTU": "int:35105", + "SIOCGIFNAME": "int:35088", + "SIOCGIFNETMASK": "int:35099", + "SIOCGIFPFLAGS": "int:35125", + "SIOCGIFSLAVE": "int:35113", + "SIOCGIFTXQLEN": "int:35138", + "SIOCGPGRP": "int:35076", + "SIOCGRARP": "int:35169", + "SIOCGSTAMP": "int:35078", + "SIOCGSTAMPNS": "int:35079", + "SIOCPROTOPRIVATE": "int:35296", + "SIOCRTMSG": "int:35085", + "SIOCSARP": "int:35157", + "SIOCSIFADDR": "int:35094", + "SIOCSIFBR": "int:35137", + "SIOCSIFBRDADDR": "int:35098", + "SIOCSIFDSTADDR": "int:35096", + "SIOCSIFENCAP": "int:35110", + "SIOCSIFFLAGS": "int:35092", + "SIOCSIFHWADDR": "int:35108", + "SIOCSIFHWBROADCAST": "int:35127", + "SIOCSIFLINK": "int:35089", + "SIOCSIFMAP": "int:35185", + "SIOCSIFMEM": "int:35104", + "SIOCSIFMETRIC": "int:35102", + "SIOCSIFMTU": "int:35106", + "SIOCSIFNAME": "int:35107", + "SIOCSIFNETMASK": "int:35100", + "SIOCSIFPFLAGS": "int:35124", + "SIOCSIFSLAVE": "int:35120", + "SIOCSIFTXQLEN": "int:35139", + "SIOCSPGRP": "int:35074", + "SIOCSRARP": "int:35170", + "SOCK_CLOEXEC": "int:524288", + "SOCK_DCCP": "int:6", + "SOCK_DGRAM": "int:2", + "SOCK_NONBLOCK": "int:2048", + "SOCK_PACKET": "int:10", + "SOCK_RAW": "int:3", + "SOCK_RDM": "int:4", + "SOCK_SEQPACKET": "int:5", + "SOCK_STREAM": "int:1", + "SOL_AAL": "int:265", + "SOL_ATM": "int:264", + "SOL_DECNET": "int:261", + "SOL_ICMPV6": "int:58", + "SOL_IP": "int:0", + "SOL_IPV6": "int:41", + "SOL_IRDA": "int:266", + "SOL_PACKET": "int:263", + "SOL_RAW": "int:255", + "SOL_SOCKET": "int:1", + "SOL_TCP": "int:6", + "SOL_X25": "int:262", + "SOMAXCONN": "int:128", + "SO_ACCEPTCONN": "int:30", + "SO_ATTACH_FILTER": "int:26", + "SO_BINDTODEVICE": "int:25", + "SO_BROADCAST": "int:6", + "SO_BSDCOMPAT": "int:14", + "SO_BUSY_POLL": "int:46", + "SO_DEBUG": "int:1", + "SO_DETACH_FILTER": "int:27", + "SO_DOMAIN": "int:39", + "SO_DONTROUTE": "int:5", + "SO_ERROR": "int:4", + "SO_GET_FILTER": "int:26", + "SO_KEEPALIVE": "int:9", + "SO_LINGER": "int:13", + "SO_LOCK_FILTER": "int:44", + "SO_MARK": "int:36", + "SO_MAX_PACING_RATE": "int:47", + "SO_NOFCS": "int:43", + "SO_NO_CHECK": "int:11", + "SO_OOBINLINE": "int:10", + "SO_PASSCRED": "int:16", + "SO_PASSSEC": "int:34", + "SO_PEEK_OFF": "int:42", + "SO_PEERCRED": "int:17", + "SO_PEERNAME": "int:28", + "SO_PEERSEC": "int:31", + "SO_PRIORITY": "int:12", + "SO_PROTOCOL": "int:38", + "SO_RCVBUF": "int:8", + "SO_RCVBUFFORCE": "int:33", + "SO_RCVLOWAT": "int:18", + "SO_RCVTIMEO": "int:20", + "SO_REUSEADDR": "int:2", + "SO_REUSEPORT": "int:15", + "SO_RXQ_OVFL": "int:40", + "SO_SECURITY_AUTHENTICATION": "int:22", + "SO_SECURITY_ENCRYPTION_NETWORK": "int:24", + "SO_SECURITY_ENCRYPTION_TRANSPORT": "int:23", + "SO_SELECT_ERR_QUEUE": "int:45", + "SO_SNDBUF": "int:7", + "SO_SNDBUFFORCE": "int:32", + "SO_SNDLOWAT": "int:19", + "SO_SNDTIMEO": "int:21", + "SO_TIMESTAMP": "int:29", + "SO_TIMESTAMPING": "int:37", + "SO_TIMESTAMPNS": "int:35", + "SO_TYPE": "int:3", + "SO_WIFI_STATUS": "int:41", + "SYS_ACCEPT": "int:202", + "SYS_ACCEPT4": "int:242", + "SYS_ACCT": "int:89", + "SYS_ADD_KEY": "int:217", + "SYS_ADJTIMEX": "int:171", + "SYS_ARCH_SPECIFIC_SYSCALL": "int:244", + "SYS_BIND": "int:200", + "SYS_BPF": "int:280", + "SYS_BRK": "int:214", + "SYS_CAPGET": "int:90", + "SYS_CAPSET": "int:91", + "SYS_CHDIR": "int:49", + "SYS_CHROOT": "int:51", + "SYS_CLOCK_ADJTIME": "int:266", + "SYS_CLOCK_GETRES": "int:114", + "SYS_CLOCK_GETTIME": "int:113", + "SYS_CLOCK_NANOSLEEP": "int:115", + "SYS_CLOCK_SETTIME": "int:112", + "SYS_CLONE": "int:220", + "SYS_CLOSE": "int:57", + "SYS_CONNECT": "int:203", + "SYS_DELETE_MODULE": "int:106", + "SYS_DUP": "int:23", + "SYS_DUP3": "int:24", + "SYS_EPOLL_CREATE": "int:1042", + "SYS_EPOLL_CREATE1": "int:20", + "SYS_EPOLL_CTL": "int:21", + "SYS_EPOLL_PWAIT": "int:22", + "SYS_EPOLL_WAIT": "int:1069", + "SYS_EVENTFD2": "int:19", + "SYS_EXECVE": "int:221", + "SYS_EXECVEAT": "int:281", + "SYS_EXIT": "int:93", + "SYS_EXIT_GROUP": "int:94", + "SYS_FACCESSAT": "int:48", + "SYS_FADVISE64": "int:223", + "SYS_FALLOCATE": "int:47", + "SYS_FANOTIFY_INIT": "int:262", + "SYS_FANOTIFY_MARK": "int:263", + "SYS_FCHDIR": "int:50", + "SYS_FCHMOD": "int:52", + "SYS_FCHMODAT": "int:53", + "SYS_FCHOWN": "int:55", + "SYS_FCHOWNAT": "int:54", + "SYS_FCNTL": "int:25", + "SYS_FDATASYNC": "int:83", + "SYS_FGETXATTR": "int:10", + "SYS_FINIT_MODULE": "int:273", + "SYS_FLISTXATTR": "int:13", + "SYS_FLOCK": "int:32", + "SYS_FREMOVEXATTR": "int:16", + "SYS_FSETXATTR": "int:7", + "SYS_FSTAT": "int:80", + "SYS_FSTATAT": "int:79", + "SYS_FSTATFS": "int:44", + "SYS_FSYNC": "int:82", + "SYS_FTRUNCATE": "int:46", + "SYS_FUTEX": "int:98", + "SYS_FUTIMESAT": "int:1066", + "SYS_GETCPU": "int:168", + "SYS_GETCWD": "int:17", + "SYS_GETDENTS64": "int:61", + "SYS_GETEGID": "int:177", + "SYS_GETEUID": "int:175", + "SYS_GETGID": "int:176", + "SYS_GETGROUPS": "int:158", + "SYS_GETITIMER": "int:102", + "SYS_GETPEERNAME": "int:205", + "SYS_GETPGID": "int:155", + "SYS_GETPGRP": "int:1060", + "SYS_GETPID": "int:172", + "SYS_GETPPID": "int:173", + "SYS_GETPRIORITY": "int:141", + "SYS_GETRANDOM": "int:278", + "SYS_GETRESGID": "int:150", + "SYS_GETRESUID": "int:148", + "SYS_GETRLIMIT": "int:163", + "SYS_GETRUSAGE": "int:165", + "SYS_GETSID": "int:156", + "SYS_GETSOCKNAME": "int:204", + "SYS_GETSOCKOPT": "int:209", + "SYS_GETTID": "int:178", + "SYS_GETTIMEOFDAY": "int:169", + "SYS_GETUID": "int:174", + "SYS_GETXATTR": "int:8", + "SYS_GET_MEMPOLICY": "int:236", + "SYS_GET_ROBUST_LIST": "int:100", + "SYS_INIT_MODULE": "int:105", + "SYS_INOTIFY_ADD_WATCH": "int:27", + "SYS_INOTIFY_INIT1": "int:26", + "SYS_INOTIFY_RM_WATCH": "int:28", + "SYS_IOCTL": "int:29", + "SYS_IOPRIO_GET": "int:31", + "SYS_IOPRIO_SET": "int:30", + "SYS_IO_CANCEL": "int:3", + "SYS_IO_DESTROY": "int:1", + "SYS_IO_GETEVENTS": "int:4", + "SYS_IO_SETUP": "int:0", + "SYS_IO_SUBMIT": "int:2", + "SYS_KCMP": "int:272", + "SYS_KEXEC_LOAD": "int:104", + "SYS_KEYCTL": "int:219", + "SYS_KILL": "int:129", + "SYS_LCHOWN": "int:1032", + "SYS_LGETXATTR": "int:9", + "SYS_LINKAT": "int:37", + "SYS_LISTEN": "int:201", + "SYS_LISTXATTR": "int:11", + "SYS_LLISTXATTR": "int:12", + "SYS_LOOKUP_DCOOKIE": "int:18", + "SYS_LREMOVEXATTR": "int:15", + "SYS_LSEEK": "int:62", + "SYS_LSETXATTR": "int:6", + "SYS_MADVISE": "int:233", + "SYS_MBIND": "int:235", + "SYS_MEMFD_CREATE": "int:279", + "SYS_MIGRATE_PAGES": "int:238", + "SYS_MINCORE": "int:232", + "SYS_MKDIRAT": "int:34", + "SYS_MKNODAT": "int:33", + "SYS_MLOCK": "int:228", + "SYS_MLOCKALL": "int:230", + "SYS_MMAP": "int:222", + "SYS_MOUNT": "int:40", + "SYS_MOVE_PAGES": "int:239", + "SYS_MPROTECT": "int:226", + "SYS_MQ_GETSETATTR": "int:185", + "SYS_MQ_NOTIFY": "int:184", + "SYS_MQ_OPEN": "int:180", + "SYS_MQ_TIMEDRECEIVE": "int:183", + "SYS_MQ_TIMEDSEND": "int:182", + "SYS_MQ_UNLINK": "int:181", + "SYS_MREMAP": "int:216", + "SYS_MSGCTL": "int:187", + "SYS_MSGGET": "int:186", + "SYS_MSGRCV": "int:188", + "SYS_MSGSND": "int:189", + "SYS_MSYNC": "int:227", + "SYS_MUNLOCK": "int:229", + "SYS_MUNLOCKALL": "int:231", + "SYS_MUNMAP": "int:215", + "SYS_NAME_TO_HANDLE_AT": "int:264", + "SYS_NANOSLEEP": "int:101", + "SYS_NFSSERVCTL": "int:42", + "SYS_OPENAT": "int:56", + "SYS_OPEN_BY_HANDLE_AT": "int:265", + "SYS_PAUSE": "int:1061", + "SYS_PERF_EVENT_OPEN": "int:241", + "SYS_PERSONALITY": "int:92", + "SYS_PIPE2": "int:59", + "SYS_PIVOT_ROOT": "int:41", + "SYS_PPOLL": "int:73", + "SYS_PRCTL": "int:167", + "SYS_PREAD64": "int:67", + "SYS_PREADV": "int:69", + "SYS_PRLIMIT64": "int:261", + "SYS_PROCESS_VM_READV": "int:270", + "SYS_PROCESS_VM_WRITEV": "int:271", + "SYS_PSELECT6": "int:72", + "SYS_PTRACE": "int:117", + "SYS_PWRITE64": "int:68", + "SYS_PWRITEV": "int:70", + "SYS_QUOTACTL": "int:60", + "SYS_READ": "int:63", + "SYS_READAHEAD": "int:213", + "SYS_READLINKAT": "int:78", + "SYS_READV": "int:65", + "SYS_REBOOT": "int:142", + "SYS_RECVFROM": "int:207", + "SYS_RECVMMSG": "int:243", + "SYS_RECVMSG": "int:212", + "SYS_REMAP_FILE_PAGES": "int:234", + "SYS_REMOVEXATTR": "int:14", + "SYS_RENAMEAT": "int:38", + "SYS_RENAMEAT2": "int:276", + "SYS_REQUEST_KEY": "int:218", + "SYS_RESTART_SYSCALL": "int:128", + "SYS_RT_SIGACTION": "int:134", + "SYS_RT_SIGPENDING": "int:136", + "SYS_RT_SIGPROCMASK": "int:135", + "SYS_RT_SIGQUEUEINFO": "int:138", + "SYS_RT_SIGRETURN": "int:139", + "SYS_RT_SIGSUSPEND": "int:133", + "SYS_RT_SIGTIMEDWAIT": "int:137", + "SYS_RT_TGSIGQUEUEINFO": "int:240", + "SYS_SCHED_GETAFFINITY": "int:123", + "SYS_SCHED_GETATTR": "int:275", + "SYS_SCHED_GETPARAM": "int:121", + "SYS_SCHED_GETSCHEDULER": "int:120", + "SYS_SCHED_GET_PRIORITY_MAX": "int:125", + "SYS_SCHED_GET_PRIORITY_MIN": "int:126", + "SYS_SCHED_RR_GET_INTERVAL": "int:127", + "SYS_SCHED_SETAFFINITY": "int:122", + "SYS_SCHED_SETATTR": "int:274", + "SYS_SCHED_SETPARAM": "int:118", + "SYS_SCHED_SETSCHEDULER": "int:119", + "SYS_SCHED_YIELD": "int:124", + "SYS_SECCOMP": "int:277", + "SYS_SEMCTL": "int:191", + "SYS_SEMGET": "int:190", + "SYS_SEMOP": "int:193", + "SYS_SEMTIMEDOP": "int:192", + "SYS_SENDFILE": "int:71", + "SYS_SENDMMSG": "int:269", + "SYS_SENDMSG": "int:211", + "SYS_SENDTO": "int:206", + "SYS_SETDOMAINNAME": "int:162", + "SYS_SETFSGID": "int:152", + "SYS_SETFSUID": "int:151", + "SYS_SETGID": "int:144", + "SYS_SETGROUPS": "int:159", + "SYS_SETHOSTNAME": "int:161", + "SYS_SETITIMER": "int:103", + "SYS_SETNS": "int:268", + "SYS_SETPGID": "int:154", + "SYS_SETPRIORITY": "int:140", + "SYS_SETREGID": "int:143", + "SYS_SETRESGID": "int:149", + "SYS_SETRESUID": "int:147", + "SYS_SETREUID": "int:145", + "SYS_SETRLIMIT": "int:164", + "SYS_SETSID": "int:157", + "SYS_SETSOCKOPT": "int:208", + "SYS_SETTIMEOFDAY": "int:170", + "SYS_SETUID": "int:146", + "SYS_SETXATTR": "int:5", + "SYS_SET_MEMPOLICY": "int:237", + "SYS_SET_ROBUST_LIST": "int:99", + "SYS_SET_TID_ADDRESS": "int:96", + "SYS_SHMAT": "int:196", + "SYS_SHMCTL": "int:195", + "SYS_SHMDT": "int:197", + "SYS_SHMGET": "int:194", + "SYS_SHUTDOWN": "int:210", + "SYS_SIGALTSTACK": "int:132", + "SYS_SIGNALFD4": "int:74", + "SYS_SOCKET": "int:198", + "SYS_SOCKETPAIR": "int:199", + "SYS_SPLICE": "int:76", + "SYS_STATFS": "int:43", + "SYS_SWAPOFF": "int:225", + "SYS_SWAPON": "int:224", + "SYS_SYMLINKAT": "int:36", + "SYS_SYNC": "int:81", + "SYS_SYNCFS": "int:267", + "SYS_SYNC_FILE_RANGE": "int:84", + "SYS_SYNC_FILE_RANGE2": "int:84", + "SYS_SYSINFO": "int:179", + "SYS_SYSLOG": "int:116", + "SYS_TEE": "int:77", + "SYS_TGKILL": "int:131", + "SYS_TIME": "int:1062", + "SYS_TIMERFD_CREATE": "int:85", + "SYS_TIMERFD_GETTIME": "int:87", + "SYS_TIMERFD_SETTIME": "int:86", + "SYS_TIMER_CREATE": "int:107", + "SYS_TIMER_DELETE": "int:111", + "SYS_TIMER_GETOVERRUN": "int:109", + "SYS_TIMER_GETTIME": "int:108", + "SYS_TIMER_SETTIME": "int:110", + "SYS_TIMES": "int:153", + "SYS_TKILL": "int:130", + "SYS_TRUNCATE": "int:45", + "SYS_UMASK": "int:166", + "SYS_UMOUNT2": "int:39", + "SYS_UNAME": "int:160", + "SYS_UNLINKAT": "int:35", + "SYS_UNSHARE": "int:97", + "SYS_USTAT": "int:1070", + "SYS_UTIME": "int:1063", + "SYS_UTIMENSAT": "int:88", + "SYS_UTIMES": "int:1037", + "SYS_VHANGUP": "int:58", + "SYS_VMSPLICE": "int:75", + "SYS_WAIT4": "int:260", + "SYS_WAITID": "int:95", + "SYS_WRITE": "int:64", + "SYS_WRITEV": "int:66", + "S_BLKSIZE": "int:512", + "S_IEXEC": "int:64", + "S_IFBLK": "int:24576", + "S_IFCHR": "int:8192", + "S_IFDIR": "int:16384", + "S_IFIFO": "int:4096", + "S_IFLNK": "int:40960", + "S_IFMT": "int:61440", + "S_IFREG": "int:32768", + "S_IFSOCK": "int:49152", + "S_IREAD": "int:256", + "S_IRGRP": "int:32", + "S_IROTH": "int:4", + "S_IRUSR": "int:256", + "S_IRWXG": "int:56", + "S_IRWXO": "int:7", + "S_IRWXU": "int:448", + "S_ISGID": "int:1024", + "S_ISUID": "int:2048", + "S_ISVTX": "int:512", + "S_IWGRP": "int:16", + "S_IWOTH": "int:2", + "S_IWRITE": "int:128", + "S_IWUSR": "int:128", + "S_IXGRP": "int:8", + "S_IXOTH": "int:1", + "S_IXUSR": "int:64", + "SizeofCmsghdr": "int:16", + "SizeofICMPv6Filter": "int:32", + "SizeofIPMreq": "int:8", + "SizeofIPMreqn": "int:12", + "SizeofIPv6MTUInfo": "int:32", + "SizeofIPv6Mreq": "int:20", + "SizeofIfAddrmsg": "int:8", + "SizeofIfInfomsg": "int:16", + "SizeofInet4Pktinfo": "int:12", + "SizeofInet6Pktinfo": "int:20", + "SizeofInotifyEvent": "int:16", + "SizeofLinger": "int:8", + "SizeofMsghdr": "int:56", + "SizeofNlAttr": "int:4", + "SizeofNlMsgerr": "int:20", + "SizeofNlMsghdr": "int:16", + "SizeofRtAttr": "int:4", + "SizeofRtGenmsg": "int:1", + "SizeofRtMsg": "int:12", + "SizeofRtNexthop": "int:8", + "SizeofSockFilter": "int:8", + "SizeofSockFprog": "int:16", + "SizeofSockaddrAny": "int:112", + "SizeofSockaddrInet4": "int:16", + "SizeofSockaddrInet6": "int:28", + "SizeofSockaddrLinklayer": "int:20", + "SizeofSockaddrNetlink": "int:12", + "SizeofSockaddrUnix": "int:110", + "SizeofTCPInfo": "int:104", + "SizeofUcred": "int:12", + "TCFLSH": "int:21515", + "TCGETS": "int:21505", + "TCIFLUSH": "int:0", + "TCIOFLUSH": "int:2", + "TCOFLUSH": "int:1", + "TCP_CONGESTION": "int:13", + "TCP_COOKIE_IN_ALWAYS": "int:1", + "TCP_COOKIE_MAX": "int:16", + "TCP_COOKIE_MIN": "int:8", + "TCP_COOKIE_OUT_NEVER": "int:2", + "TCP_COOKIE_PAIR_SIZE": "int:32", + "TCP_COOKIE_TRANSACTIONS": "int:15", + "TCP_CORK": "int:3", + "TCP_DEFER_ACCEPT": "int:9", + "TCP_FASTOPEN": "int:23", + "TCP_INFO": "int:11", + "TCP_KEEPCNT": "int:6", + "TCP_KEEPIDLE": "int:4", + "TCP_KEEPINTVL": "int:5", + "TCP_LINGER2": "int:8", + "TCP_MAXSEG": "int:2", + "TCP_MAXWIN": "int:65535", + "TCP_MAX_WINSHIFT": "int:14", + "TCP_MD5SIG": "int:14", + "TCP_MD5SIG_MAXKEYLEN": "int:80", + "TCP_MSS": "int:512", + "TCP_MSS_DEFAULT": "int:536", + "TCP_MSS_DESIRED": "int:1220", + "TCP_NODELAY": "int:1", + "TCP_QUEUE_SEQ": "int:21", + "TCP_QUICKACK": "int:12", + "TCP_REPAIR": "int:19", + "TCP_REPAIR_OPTIONS": "int:22", + "TCP_REPAIR_QUEUE": "int:20", + "TCP_SYNCNT": "int:7", + "TCP_S_DATA_IN": "int:4", + "TCP_S_DATA_OUT": "int:8", + "TCP_THIN_DUPACK": "int:17", + "TCP_THIN_LINEAR_TIMEOUTS": "int:16", + "TCP_TIMESTAMP": "int:24", + "TCP_USER_TIMEOUT": "int:18", + "TCP_WINDOW_CLAMP": "int:10", + "TCSAFLUSH": "int:2", + "TCSETS": "int:21506", + "TIOCCBRK": "int:21544", + "TIOCCONS": "int:21533", + "TIOCEXCL": "int:21516", + "TIOCGDEV": "int:2147767346", + "TIOCGETD": "int:21540", + "TIOCGEXCL": "int:2147767360", + "TIOCGICOUNT": "int:21597", + "TIOCGLCKTRMIOS": "int:21590", + "TIOCGPGRP": "int:21519", + "TIOCGPKT": "int:2147767352", + "TIOCGPTLCK": "int:2147767353", + "TIOCGPTN": "int:2147767344", + "TIOCGRS485": "int:21550", + "TIOCGSERIAL": "int:21534", + "TIOCGSID": "int:21545", + "TIOCGSOFTCAR": "int:21529", + "TIOCGWINSZ": "int:21523", + "TIOCINQ": "int:21531", + "TIOCLINUX": "int:21532", + "TIOCMBIC": "int:21527", + "TIOCMBIS": "int:21526", + "TIOCMGET": "int:21525", + "TIOCMIWAIT": "int:21596", + "TIOCMSET": "int:21528", + "TIOCM_CAR": "int:64", + "TIOCM_CD": "int:64", + "TIOCM_CTS": "int:32", + "TIOCM_DSR": "int:256", + "TIOCM_DTR": "int:2", + "TIOCM_LE": "int:1", + "TIOCM_RI": "int:128", + "TIOCM_RNG": "int:128", + "TIOCM_RTS": "int:4", + "TIOCM_SR": "int:16", + "TIOCM_ST": "int:8", + "TIOCNOTTY": "int:21538", + "TIOCNXCL": "int:21517", + "TIOCOUTQ": "int:21521", + "TIOCPKT": "int:21536", + "TIOCPKT_DATA": "int:0", + "TIOCPKT_DOSTOP": "int:32", + "TIOCPKT_FLUSHREAD": "int:1", + "TIOCPKT_FLUSHWRITE": "int:2", + "TIOCPKT_IOCTL": "int:64", + "TIOCPKT_NOSTOP": "int:16", + "TIOCPKT_START": "int:8", + "TIOCPKT_STOP": "int:4", + "TIOCSBRK": "int:21543", + "TIOCSCTTY": "int:21518", + "TIOCSERCONFIG": "int:21587", + "TIOCSERGETLSR": "int:21593", + "TIOCSERGETMULTI": "int:21594", + "TIOCSERGSTRUCT": "int:21592", + "TIOCSERGWILD": "int:21588", + "TIOCSERSETMULTI": "int:21595", + "TIOCSERSWILD": "int:21589", + "TIOCSER_TEMT": "int:1", + "TIOCSETD": "int:21539", + "TIOCSIG": "int:1074025526", + "TIOCSLCKTRMIOS": "int:21591", + "TIOCSPGRP": "int:21520", + "TIOCSPTLCK": "int:1074025521", + "TIOCSRS485": "int:21551", + "TIOCSSERIAL": "int:21535", + "TIOCSSOFTCAR": "int:21530", + "TIOCSTI": "int:21522", + "TIOCSWINSZ": "int:21524", + "TIOCVHANGUP": "int:21559", + "TOSTOP": "int:256", + "TUNATTACHFILTER": "int:1074812117", + "TUNDETACHFILTER": "int:1074812118", + "TUNGETFEATURES": "int:2147767503", + "TUNGETFILTER": "int:2148553947", + "TUNGETIFF": "int:2147767506", + "TUNGETSNDBUF": "int:2147767507", + "TUNGETVNETHDRSZ": "int:2147767511", + "TUNSETDEBUG": "int:1074025673", + "TUNSETGROUP": "int:1074025678", + "TUNSETIFF": "int:1074025674", + "TUNSETIFINDEX": "int:1074025690", + "TUNSETLINK": "int:1074025677", + "TUNSETNOCSUM": "int:1074025672", + "TUNSETOFFLOAD": "int:1074025680", + "TUNSETOWNER": "int:1074025676", + "TUNSETPERSIST": "int:1074025675", + "TUNSETQUEUE": "int:1074025689", + "TUNSETSNDBUF": "int:1074025684", + "TUNSETTXFILTER": "int:1074025681", + "TUNSETVNETHDRSZ": "int:1074025688", + "VDISCARD": "int:13", + "VEOF": "int:4", + "VEOL": "int:11", + "VEOL2": "int:16", + "VERASE": "int:2", + "VINTR": "int:0", + "VKILL": "int:3", + "VLNEXT": "int:15", + "VMIN": "int:6", + "VQUIT": "int:1", + "VREPRINT": "int:12", + "VSTART": "int:8", + "VSTOP": "int:9", + "VSUSP": "int:10", + "VSWTC": "int:7", + "VT0": "int:0", + "VT1": "int:16384", + "VTDLY": "int:16384", + "VTIME": "int:5", + "VWERASE": "int:14", + "WALL": "int:1073741824", + "WCLONE": "int:2147483648", + "WCONTINUED": "int:8", + "WEXITED": "int:4", + "WNOHANG": "int:1", + "WNOTHREAD": "int:536870912", + "WNOWAIT": "int:16777216", + "WORDSIZE": "int:64", + "WSTOPPED": "int:2", + "WUNTRACED": "int:2", + "XCASE": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/syscall_windows_amd64.go b/vendor/github.com/cosmos72/gomacro/imports/syscall_windows_amd64.go new file mode 100644 index 0000000..1553245 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/syscall_windows_amd64.go @@ -0,0 +1,996 @@ +// +build !gccgo + +// this file was generated by gomacro command: import "syscall" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "syscall" +) + +func init() { + Packages["syscall"] = Package{ + Binds: map[string]Value{ + "AF_INET": ValueOf(syscall.AF_INET), + "AF_INET6": ValueOf(syscall.AF_INET6), + "AF_NETBIOS": ValueOf(syscall.AF_NETBIOS), + "AF_UNIX": ValueOf(syscall.AF_UNIX), + "AF_UNSPEC": ValueOf(syscall.AF_UNSPEC), + "AI_CANONNAME": ValueOf(syscall.AI_CANONNAME), + "AI_NUMERICHOST": ValueOf(syscall.AI_NUMERICHOST), + "AI_PASSIVE": ValueOf(syscall.AI_PASSIVE), + "APPLICATION_ERROR": ValueOf(syscall.APPLICATION_ERROR), + "AUTHTYPE_CLIENT": ValueOf(syscall.AUTHTYPE_CLIENT), + "AUTHTYPE_SERVER": ValueOf(syscall.AUTHTYPE_SERVER), + "Accept": ValueOf(syscall.Accept), + "AcceptEx": ValueOf(syscall.AcceptEx), + "BASE_PROTOCOL": ValueOf(syscall.BASE_PROTOCOL), + "Bind": ValueOf(syscall.Bind), + "BytePtrFromString": ValueOf(syscall.BytePtrFromString), + "ByteSliceFromString": ValueOf(syscall.ByteSliceFromString), + "CERT_CHAIN_POLICY_AUTHENTICODE": ValueOf(syscall.CERT_CHAIN_POLICY_AUTHENTICODE), + "CERT_CHAIN_POLICY_AUTHENTICODE_TS": ValueOf(syscall.CERT_CHAIN_POLICY_AUTHENTICODE_TS), + "CERT_CHAIN_POLICY_BASE": ValueOf(syscall.CERT_CHAIN_POLICY_BASE), + "CERT_CHAIN_POLICY_BASIC_CONSTRAINTS": ValueOf(syscall.CERT_CHAIN_POLICY_BASIC_CONSTRAINTS), + "CERT_CHAIN_POLICY_EV": ValueOf(syscall.CERT_CHAIN_POLICY_EV), + "CERT_CHAIN_POLICY_MICROSOFT_ROOT": ValueOf(syscall.CERT_CHAIN_POLICY_MICROSOFT_ROOT), + "CERT_CHAIN_POLICY_NT_AUTH": ValueOf(syscall.CERT_CHAIN_POLICY_NT_AUTH), + "CERT_CHAIN_POLICY_SSL": ValueOf(syscall.CERT_CHAIN_POLICY_SSL), + "CERT_E_CN_NO_MATCH": ValueOf(uint32(syscall.CERT_E_CN_NO_MATCH)), + "CERT_E_EXPIRED": ValueOf(uint32(syscall.CERT_E_EXPIRED)), + "CERT_E_PURPOSE": ValueOf(uint32(syscall.CERT_E_PURPOSE)), + "CERT_E_ROLE": ValueOf(uint32(syscall.CERT_E_ROLE)), + "CERT_E_UNTRUSTEDROOT": ValueOf(uint32(syscall.CERT_E_UNTRUSTEDROOT)), + "CERT_STORE_ADD_ALWAYS": ValueOf(syscall.CERT_STORE_ADD_ALWAYS), + "CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG": ValueOf(syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG), + "CERT_STORE_PROV_MEMORY": ValueOf(syscall.CERT_STORE_PROV_MEMORY), + "CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT": ValueOf(syscall.CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT), + "CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT": ValueOf(syscall.CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT), + "CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT": ValueOf(syscall.CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT), + "CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT": ValueOf(syscall.CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT), + "CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT": ValueOf(syscall.CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT), + "CERT_TRUST_INVALID_BASIC_CONSTRAINTS": ValueOf(syscall.CERT_TRUST_INVALID_BASIC_CONSTRAINTS), + "CERT_TRUST_INVALID_EXTENSION": ValueOf(syscall.CERT_TRUST_INVALID_EXTENSION), + "CERT_TRUST_INVALID_NAME_CONSTRAINTS": ValueOf(syscall.CERT_TRUST_INVALID_NAME_CONSTRAINTS), + "CERT_TRUST_INVALID_POLICY_CONSTRAINTS": ValueOf(syscall.CERT_TRUST_INVALID_POLICY_CONSTRAINTS), + "CERT_TRUST_IS_CYCLIC": ValueOf(syscall.CERT_TRUST_IS_CYCLIC), + "CERT_TRUST_IS_EXPLICIT_DISTRUST": ValueOf(syscall.CERT_TRUST_IS_EXPLICIT_DISTRUST), + "CERT_TRUST_IS_NOT_SIGNATURE_VALID": ValueOf(syscall.CERT_TRUST_IS_NOT_SIGNATURE_VALID), + "CERT_TRUST_IS_NOT_TIME_VALID": ValueOf(syscall.CERT_TRUST_IS_NOT_TIME_VALID), + "CERT_TRUST_IS_NOT_VALID_FOR_USAGE": ValueOf(syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE), + "CERT_TRUST_IS_OFFLINE_REVOCATION": ValueOf(syscall.CERT_TRUST_IS_OFFLINE_REVOCATION), + "CERT_TRUST_IS_REVOKED": ValueOf(syscall.CERT_TRUST_IS_REVOKED), + "CERT_TRUST_IS_UNTRUSTED_ROOT": ValueOf(syscall.CERT_TRUST_IS_UNTRUSTED_ROOT), + "CERT_TRUST_NO_ERROR": ValueOf(syscall.CERT_TRUST_NO_ERROR), + "CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY": ValueOf(syscall.CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY), + "CERT_TRUST_REVOCATION_STATUS_UNKNOWN": ValueOf(syscall.CERT_TRUST_REVOCATION_STATUS_UNKNOWN), + "CREATE_ALWAYS": ValueOf(syscall.CREATE_ALWAYS), + "CREATE_NEW": ValueOf(syscall.CREATE_NEW), + "CREATE_NEW_PROCESS_GROUP": ValueOf(syscall.CREATE_NEW_PROCESS_GROUP), + "CREATE_UNICODE_ENVIRONMENT": ValueOf(syscall.CREATE_UNICODE_ENVIRONMENT), + "CRYPT_DEFAULT_CONTAINER_OPTIONAL": ValueOf(syscall.CRYPT_DEFAULT_CONTAINER_OPTIONAL), + "CRYPT_DELETEKEYSET": ValueOf(syscall.CRYPT_DELETEKEYSET), + "CRYPT_MACHINE_KEYSET": ValueOf(syscall.CRYPT_MACHINE_KEYSET), + "CRYPT_NEWKEYSET": ValueOf(syscall.CRYPT_NEWKEYSET), + "CRYPT_SILENT": ValueOf(syscall.CRYPT_SILENT), + "CRYPT_VERIFYCONTEXT": ValueOf(uint32(syscall.CRYPT_VERIFYCONTEXT)), + "CTRL_BREAK_EVENT": ValueOf(syscall.CTRL_BREAK_EVENT), + "CTRL_C_EVENT": ValueOf(syscall.CTRL_C_EVENT), + "CancelIo": ValueOf(syscall.CancelIo), + "CancelIoEx": ValueOf(syscall.CancelIoEx), + "CertAddCertificateContextToStore": ValueOf(syscall.CertAddCertificateContextToStore), + "CertCloseStore": ValueOf(syscall.CertCloseStore), + "CertCreateCertificateContext": ValueOf(syscall.CertCreateCertificateContext), + "CertEnumCertificatesInStore": ValueOf(syscall.CertEnumCertificatesInStore), + "CertFreeCertificateChain": ValueOf(syscall.CertFreeCertificateChain), + "CertFreeCertificateContext": ValueOf(syscall.CertFreeCertificateContext), + "CertGetCertificateChain": ValueOf(syscall.CertGetCertificateChain), + "CertOpenStore": ValueOf(syscall.CertOpenStore), + "CertOpenSystemStore": ValueOf(syscall.CertOpenSystemStore), + "CertVerifyCertificateChainPolicy": ValueOf(syscall.CertVerifyCertificateChainPolicy), + "Chdir": ValueOf(syscall.Chdir), + "Chmod": ValueOf(syscall.Chmod), + "Chown": ValueOf(syscall.Chown), + "Clearenv": ValueOf(syscall.Clearenv), + "Close": ValueOf(syscall.Close), + "CloseHandle": ValueOf(syscall.CloseHandle), + "CloseOnExec": ValueOf(syscall.CloseOnExec), + "Closesocket": ValueOf(syscall.Closesocket), + "CommandLineToArgv": ValueOf(syscall.CommandLineToArgv), + "ComputerName": ValueOf(syscall.ComputerName), + "Connect": ValueOf(syscall.Connect), + "ConnectEx": ValueOf(syscall.ConnectEx), + "ConvertSidToStringSid": ValueOf(syscall.ConvertSidToStringSid), + "ConvertStringSidToSid": ValueOf(syscall.ConvertStringSidToSid), + "CopySid": ValueOf(syscall.CopySid), + "CreateDirectory": ValueOf(syscall.CreateDirectory), + "CreateFile": ValueOf(syscall.CreateFile), + "CreateFileMapping": ValueOf(syscall.CreateFileMapping), + "CreateHardLink": ValueOf(syscall.CreateHardLink), + "CreateIoCompletionPort": ValueOf(syscall.CreateIoCompletionPort), + "CreatePipe": ValueOf(syscall.CreatePipe), + "CreateProcess": ValueOf(syscall.CreateProcess), + "CreateSymbolicLink": ValueOf(syscall.CreateSymbolicLink), + "CreateToolhelp32Snapshot": ValueOf(syscall.CreateToolhelp32Snapshot), + "CryptAcquireContext": ValueOf(syscall.CryptAcquireContext), + "CryptGenRandom": ValueOf(syscall.CryptGenRandom), + "CryptReleaseContext": ValueOf(syscall.CryptReleaseContext), + "DNS_INFO_NO_RECORDS": ValueOf(syscall.DNS_INFO_NO_RECORDS), + "DNS_TYPE_A": ValueOf(syscall.DNS_TYPE_A), + "DNS_TYPE_A6": ValueOf(syscall.DNS_TYPE_A6), + "DNS_TYPE_AAAA": ValueOf(syscall.DNS_TYPE_AAAA), + "DNS_TYPE_ADDRS": ValueOf(syscall.DNS_TYPE_ADDRS), + "DNS_TYPE_AFSDB": ValueOf(syscall.DNS_TYPE_AFSDB), + "DNS_TYPE_ALL": ValueOf(syscall.DNS_TYPE_ALL), + "DNS_TYPE_ANY": ValueOf(syscall.DNS_TYPE_ANY), + "DNS_TYPE_ATMA": ValueOf(syscall.DNS_TYPE_ATMA), + "DNS_TYPE_AXFR": ValueOf(syscall.DNS_TYPE_AXFR), + "DNS_TYPE_CERT": ValueOf(syscall.DNS_TYPE_CERT), + "DNS_TYPE_CNAME": ValueOf(syscall.DNS_TYPE_CNAME), + "DNS_TYPE_DHCID": ValueOf(syscall.DNS_TYPE_DHCID), + "DNS_TYPE_DNAME": ValueOf(syscall.DNS_TYPE_DNAME), + "DNS_TYPE_DNSKEY": ValueOf(syscall.DNS_TYPE_DNSKEY), + "DNS_TYPE_DS": ValueOf(syscall.DNS_TYPE_DS), + "DNS_TYPE_EID": ValueOf(syscall.DNS_TYPE_EID), + "DNS_TYPE_GID": ValueOf(syscall.DNS_TYPE_GID), + "DNS_TYPE_GPOS": ValueOf(syscall.DNS_TYPE_GPOS), + "DNS_TYPE_HINFO": ValueOf(syscall.DNS_TYPE_HINFO), + "DNS_TYPE_ISDN": ValueOf(syscall.DNS_TYPE_ISDN), + "DNS_TYPE_IXFR": ValueOf(syscall.DNS_TYPE_IXFR), + "DNS_TYPE_KEY": ValueOf(syscall.DNS_TYPE_KEY), + "DNS_TYPE_KX": ValueOf(syscall.DNS_TYPE_KX), + "DNS_TYPE_LOC": ValueOf(syscall.DNS_TYPE_LOC), + "DNS_TYPE_MAILA": ValueOf(syscall.DNS_TYPE_MAILA), + "DNS_TYPE_MAILB": ValueOf(syscall.DNS_TYPE_MAILB), + "DNS_TYPE_MB": ValueOf(syscall.DNS_TYPE_MB), + "DNS_TYPE_MD": ValueOf(syscall.DNS_TYPE_MD), + "DNS_TYPE_MF": ValueOf(syscall.DNS_TYPE_MF), + "DNS_TYPE_MG": ValueOf(syscall.DNS_TYPE_MG), + "DNS_TYPE_MINFO": ValueOf(syscall.DNS_TYPE_MINFO), + "DNS_TYPE_MR": ValueOf(syscall.DNS_TYPE_MR), + "DNS_TYPE_MX": ValueOf(syscall.DNS_TYPE_MX), + "DNS_TYPE_NAPTR": ValueOf(syscall.DNS_TYPE_NAPTR), + "DNS_TYPE_NBSTAT": ValueOf(syscall.DNS_TYPE_NBSTAT), + "DNS_TYPE_NIMLOC": ValueOf(syscall.DNS_TYPE_NIMLOC), + "DNS_TYPE_NS": ValueOf(syscall.DNS_TYPE_NS), + "DNS_TYPE_NSAP": ValueOf(syscall.DNS_TYPE_NSAP), + "DNS_TYPE_NSAPPTR": ValueOf(syscall.DNS_TYPE_NSAPPTR), + "DNS_TYPE_NSEC": ValueOf(syscall.DNS_TYPE_NSEC), + "DNS_TYPE_NULL": ValueOf(syscall.DNS_TYPE_NULL), + "DNS_TYPE_NXT": ValueOf(syscall.DNS_TYPE_NXT), + "DNS_TYPE_OPT": ValueOf(syscall.DNS_TYPE_OPT), + "DNS_TYPE_PTR": ValueOf(syscall.DNS_TYPE_PTR), + "DNS_TYPE_PX": ValueOf(syscall.DNS_TYPE_PX), + "DNS_TYPE_RP": ValueOf(syscall.DNS_TYPE_RP), + "DNS_TYPE_RRSIG": ValueOf(syscall.DNS_TYPE_RRSIG), + "DNS_TYPE_RT": ValueOf(syscall.DNS_TYPE_RT), + "DNS_TYPE_SIG": ValueOf(syscall.DNS_TYPE_SIG), + "DNS_TYPE_SINK": ValueOf(syscall.DNS_TYPE_SINK), + "DNS_TYPE_SOA": ValueOf(syscall.DNS_TYPE_SOA), + "DNS_TYPE_SRV": ValueOf(syscall.DNS_TYPE_SRV), + "DNS_TYPE_TEXT": ValueOf(syscall.DNS_TYPE_TEXT), + "DNS_TYPE_TKEY": ValueOf(syscall.DNS_TYPE_TKEY), + "DNS_TYPE_TSIG": ValueOf(syscall.DNS_TYPE_TSIG), + "DNS_TYPE_UID": ValueOf(syscall.DNS_TYPE_UID), + "DNS_TYPE_UINFO": ValueOf(syscall.DNS_TYPE_UINFO), + "DNS_TYPE_UNSPEC": ValueOf(syscall.DNS_TYPE_UNSPEC), + "DNS_TYPE_WINS": ValueOf(syscall.DNS_TYPE_WINS), + "DNS_TYPE_WINSR": ValueOf(syscall.DNS_TYPE_WINSR), + "DNS_TYPE_WKS": ValueOf(syscall.DNS_TYPE_WKS), + "DNS_TYPE_X25": ValueOf(syscall.DNS_TYPE_X25), + "DUPLICATE_CLOSE_SOURCE": ValueOf(syscall.DUPLICATE_CLOSE_SOURCE), + "DUPLICATE_SAME_ACCESS": ValueOf(syscall.DUPLICATE_SAME_ACCESS), + "DeleteFile": ValueOf(syscall.DeleteFile), + "DeviceIoControl": ValueOf(syscall.DeviceIoControl), + "DnsNameCompare": ValueOf(syscall.DnsNameCompare), + "DnsQuery": ValueOf(syscall.DnsQuery), + "DnsRecordListFree": ValueOf(syscall.DnsRecordListFree), + "DnsSectionAdditional": ValueOf(syscall.DnsSectionAdditional), + "DnsSectionAnswer": ValueOf(syscall.DnsSectionAnswer), + "DnsSectionAuthority": ValueOf(syscall.DnsSectionAuthority), + "DnsSectionQuestion": ValueOf(syscall.DnsSectionQuestion), + "DuplicateHandle": ValueOf(syscall.DuplicateHandle), + "E2BIG": ValueOf(syscall.E2BIG), + "EACCES": ValueOf(syscall.EACCES), + "EADDRINUSE": ValueOf(syscall.EADDRINUSE), + "EADDRNOTAVAIL": ValueOf(syscall.EADDRNOTAVAIL), + "EADV": ValueOf(syscall.EADV), + "EAFNOSUPPORT": ValueOf(syscall.EAFNOSUPPORT), + "EAGAIN": ValueOf(syscall.EAGAIN), + "EALREADY": ValueOf(syscall.EALREADY), + "EBADE": ValueOf(syscall.EBADE), + "EBADF": ValueOf(syscall.EBADF), + "EBADFD": ValueOf(syscall.EBADFD), + "EBADMSG": ValueOf(syscall.EBADMSG), + "EBADR": ValueOf(syscall.EBADR), + "EBADRQC": ValueOf(syscall.EBADRQC), + "EBADSLT": ValueOf(syscall.EBADSLT), + "EBFONT": ValueOf(syscall.EBFONT), + "EBUSY": ValueOf(syscall.EBUSY), + "ECANCELED": ValueOf(syscall.ECANCELED), + "ECHILD": ValueOf(syscall.ECHILD), + "ECHRNG": ValueOf(syscall.ECHRNG), + "ECOMM": ValueOf(syscall.ECOMM), + "ECONNABORTED": ValueOf(syscall.ECONNABORTED), + "ECONNREFUSED": ValueOf(syscall.ECONNREFUSED), + "ECONNRESET": ValueOf(syscall.ECONNRESET), + "EDEADLK": ValueOf(syscall.EDEADLK), + "EDEADLOCK": ValueOf(syscall.EDEADLOCK), + "EDESTADDRREQ": ValueOf(syscall.EDESTADDRREQ), + "EDOM": ValueOf(syscall.EDOM), + "EDOTDOT": ValueOf(syscall.EDOTDOT), + "EDQUOT": ValueOf(syscall.EDQUOT), + "EEXIST": ValueOf(syscall.EEXIST), + "EFAULT": ValueOf(syscall.EFAULT), + "EFBIG": ValueOf(syscall.EFBIG), + "EHOSTDOWN": ValueOf(syscall.EHOSTDOWN), + "EHOSTUNREACH": ValueOf(syscall.EHOSTUNREACH), + "EIDRM": ValueOf(syscall.EIDRM), + "EILSEQ": ValueOf(syscall.EILSEQ), + "EINPROGRESS": ValueOf(syscall.EINPROGRESS), + "EINTR": ValueOf(syscall.EINTR), + "EINVAL": ValueOf(syscall.EINVAL), + "EIO": ValueOf(syscall.EIO), + "EISCONN": ValueOf(syscall.EISCONN), + "EISDIR": ValueOf(syscall.EISDIR), + "EISNAM": ValueOf(syscall.EISNAM), + "EKEYEXPIRED": ValueOf(syscall.EKEYEXPIRED), + "EKEYREJECTED": ValueOf(syscall.EKEYREJECTED), + "EKEYREVOKED": ValueOf(syscall.EKEYREVOKED), + "EL2HLT": ValueOf(syscall.EL2HLT), + "EL2NSYNC": ValueOf(syscall.EL2NSYNC), + "EL3HLT": ValueOf(syscall.EL3HLT), + "EL3RST": ValueOf(syscall.EL3RST), + "ELIBACC": ValueOf(syscall.ELIBACC), + "ELIBBAD": ValueOf(syscall.ELIBBAD), + "ELIBEXEC": ValueOf(syscall.ELIBEXEC), + "ELIBMAX": ValueOf(syscall.ELIBMAX), + "ELIBSCN": ValueOf(syscall.ELIBSCN), + "ELNRNG": ValueOf(syscall.ELNRNG), + "ELOOP": ValueOf(syscall.ELOOP), + "EMEDIUMTYPE": ValueOf(syscall.EMEDIUMTYPE), + "EMFILE": ValueOf(syscall.EMFILE), + "EMLINK": ValueOf(syscall.EMLINK), + "EMSGSIZE": ValueOf(syscall.EMSGSIZE), + "EMULTIHOP": ValueOf(syscall.EMULTIHOP), + "ENAMETOOLONG": ValueOf(syscall.ENAMETOOLONG), + "ENAVAIL": ValueOf(syscall.ENAVAIL), + "ENETDOWN": ValueOf(syscall.ENETDOWN), + "ENETRESET": ValueOf(syscall.ENETRESET), + "ENETUNREACH": ValueOf(syscall.ENETUNREACH), + "ENFILE": ValueOf(syscall.ENFILE), + "ENOANO": ValueOf(syscall.ENOANO), + "ENOBUFS": ValueOf(syscall.ENOBUFS), + "ENOCSI": ValueOf(syscall.ENOCSI), + "ENODATA": ValueOf(syscall.ENODATA), + "ENODEV": ValueOf(syscall.ENODEV), + "ENOENT": ValueOf(syscall.ENOENT), + "ENOEXEC": ValueOf(syscall.ENOEXEC), + "ENOKEY": ValueOf(syscall.ENOKEY), + "ENOLCK": ValueOf(syscall.ENOLCK), + "ENOLINK": ValueOf(syscall.ENOLINK), + "ENOMEDIUM": ValueOf(syscall.ENOMEDIUM), + "ENOMEM": ValueOf(syscall.ENOMEM), + "ENOMSG": ValueOf(syscall.ENOMSG), + "ENONET": ValueOf(syscall.ENONET), + "ENOPKG": ValueOf(syscall.ENOPKG), + "ENOPROTOOPT": ValueOf(syscall.ENOPROTOOPT), + "ENOSPC": ValueOf(syscall.ENOSPC), + "ENOSR": ValueOf(syscall.ENOSR), + "ENOSTR": ValueOf(syscall.ENOSTR), + "ENOSYS": ValueOf(syscall.ENOSYS), + "ENOTBLK": ValueOf(syscall.ENOTBLK), + "ENOTCONN": ValueOf(syscall.ENOTCONN), + "ENOTDIR": ValueOf(syscall.ENOTDIR), + "ENOTEMPTY": ValueOf(syscall.ENOTEMPTY), + "ENOTNAM": ValueOf(syscall.ENOTNAM), + "ENOTRECOVERABLE": ValueOf(syscall.ENOTRECOVERABLE), + "ENOTSOCK": ValueOf(syscall.ENOTSOCK), + "ENOTSUP": ValueOf(syscall.ENOTSUP), + "ENOTTY": ValueOf(syscall.ENOTTY), + "ENOTUNIQ": ValueOf(syscall.ENOTUNIQ), + "ENXIO": ValueOf(syscall.ENXIO), + "EOPNOTSUPP": ValueOf(syscall.EOPNOTSUPP), + "EOVERFLOW": ValueOf(syscall.EOVERFLOW), + "EOWNERDEAD": ValueOf(syscall.EOWNERDEAD), + "EPERM": ValueOf(syscall.EPERM), + "EPFNOSUPPORT": ValueOf(syscall.EPFNOSUPPORT), + "EPIPE": ValueOf(syscall.EPIPE), + "EPROTO": ValueOf(syscall.EPROTO), + "EPROTONOSUPPORT": ValueOf(syscall.EPROTONOSUPPORT), + "EPROTOTYPE": ValueOf(syscall.EPROTOTYPE), + "ERANGE": ValueOf(syscall.ERANGE), + "EREMCHG": ValueOf(syscall.EREMCHG), + "EREMOTE": ValueOf(syscall.EREMOTE), + "EREMOTEIO": ValueOf(syscall.EREMOTEIO), + "ERESTART": ValueOf(syscall.ERESTART), + "EROFS": ValueOf(syscall.EROFS), + "ERROR_ACCESS_DENIED": ValueOf(syscall.ERROR_ACCESS_DENIED), + "ERROR_ALREADY_EXISTS": ValueOf(syscall.ERROR_ALREADY_EXISTS), + "ERROR_BROKEN_PIPE": ValueOf(syscall.ERROR_BROKEN_PIPE), + "ERROR_BUFFER_OVERFLOW": ValueOf(syscall.ERROR_BUFFER_OVERFLOW), + "ERROR_DIR_NOT_EMPTY": ValueOf(syscall.ERROR_DIR_NOT_EMPTY), + "ERROR_ENVVAR_NOT_FOUND": ValueOf(syscall.ERROR_ENVVAR_NOT_FOUND), + "ERROR_FILE_EXISTS": ValueOf(syscall.ERROR_FILE_EXISTS), + "ERROR_FILE_NOT_FOUND": ValueOf(syscall.ERROR_FILE_NOT_FOUND), + "ERROR_HANDLE_EOF": ValueOf(syscall.ERROR_HANDLE_EOF), + "ERROR_INSUFFICIENT_BUFFER": ValueOf(syscall.ERROR_INSUFFICIENT_BUFFER), + "ERROR_IO_PENDING": ValueOf(syscall.ERROR_IO_PENDING), + "ERROR_MOD_NOT_FOUND": ValueOf(syscall.ERROR_MOD_NOT_FOUND), + "ERROR_MORE_DATA": ValueOf(syscall.ERROR_MORE_DATA), + "ERROR_NETNAME_DELETED": ValueOf(syscall.ERROR_NETNAME_DELETED), + "ERROR_NOT_FOUND": ValueOf(syscall.ERROR_NOT_FOUND), + "ERROR_NO_MORE_FILES": ValueOf(syscall.ERROR_NO_MORE_FILES), + "ERROR_OPERATION_ABORTED": ValueOf(syscall.ERROR_OPERATION_ABORTED), + "ERROR_PATH_NOT_FOUND": ValueOf(syscall.ERROR_PATH_NOT_FOUND), + "ERROR_PRIVILEGE_NOT_HELD": ValueOf(syscall.ERROR_PRIVILEGE_NOT_HELD), + "ERROR_PROC_NOT_FOUND": ValueOf(syscall.ERROR_PROC_NOT_FOUND), + "ESHUTDOWN": ValueOf(syscall.ESHUTDOWN), + "ESOCKTNOSUPPORT": ValueOf(syscall.ESOCKTNOSUPPORT), + "ESPIPE": ValueOf(syscall.ESPIPE), + "ESRCH": ValueOf(syscall.ESRCH), + "ESRMNT": ValueOf(syscall.ESRMNT), + "ESTALE": ValueOf(syscall.ESTALE), + "ESTRPIPE": ValueOf(syscall.ESTRPIPE), + "ETIME": ValueOf(syscall.ETIME), + "ETIMEDOUT": ValueOf(syscall.ETIMEDOUT), + "ETOOMANYREFS": ValueOf(syscall.ETOOMANYREFS), + "ETXTBSY": ValueOf(syscall.ETXTBSY), + "EUCLEAN": ValueOf(syscall.EUCLEAN), + "EUNATCH": ValueOf(syscall.EUNATCH), + "EUSERS": ValueOf(syscall.EUSERS), + "EWINDOWS": ValueOf(syscall.EWINDOWS), + "EWOULDBLOCK": ValueOf(syscall.EWOULDBLOCK), + "EXDEV": ValueOf(syscall.EXDEV), + "EXFULL": ValueOf(syscall.EXFULL), + "Environ": ValueOf(syscall.Environ), + "EscapeArg": ValueOf(syscall.EscapeArg), + "Exec": ValueOf(syscall.Exec), + "Exit": ValueOf(syscall.Exit), + "ExitProcess": ValueOf(syscall.ExitProcess), + "FILE_ACTION_ADDED": ValueOf(syscall.FILE_ACTION_ADDED), + "FILE_ACTION_MODIFIED": ValueOf(syscall.FILE_ACTION_MODIFIED), + "FILE_ACTION_REMOVED": ValueOf(syscall.FILE_ACTION_REMOVED), + "FILE_ACTION_RENAMED_NEW_NAME": ValueOf(syscall.FILE_ACTION_RENAMED_NEW_NAME), + "FILE_ACTION_RENAMED_OLD_NAME": ValueOf(syscall.FILE_ACTION_RENAMED_OLD_NAME), + "FILE_APPEND_DATA": ValueOf(syscall.FILE_APPEND_DATA), + "FILE_ATTRIBUTE_ARCHIVE": ValueOf(syscall.FILE_ATTRIBUTE_ARCHIVE), + "FILE_ATTRIBUTE_DIRECTORY": ValueOf(syscall.FILE_ATTRIBUTE_DIRECTORY), + "FILE_ATTRIBUTE_HIDDEN": ValueOf(syscall.FILE_ATTRIBUTE_HIDDEN), + "FILE_ATTRIBUTE_NORMAL": ValueOf(syscall.FILE_ATTRIBUTE_NORMAL), + "FILE_ATTRIBUTE_READONLY": ValueOf(syscall.FILE_ATTRIBUTE_READONLY), + "FILE_ATTRIBUTE_REPARSE_POINT": ValueOf(syscall.FILE_ATTRIBUTE_REPARSE_POINT), + "FILE_ATTRIBUTE_SYSTEM": ValueOf(syscall.FILE_ATTRIBUTE_SYSTEM), + "FILE_BEGIN": ValueOf(syscall.FILE_BEGIN), + "FILE_CURRENT": ValueOf(syscall.FILE_CURRENT), + "FILE_END": ValueOf(syscall.FILE_END), + "FILE_FLAG_BACKUP_SEMANTICS": ValueOf(syscall.FILE_FLAG_BACKUP_SEMANTICS), + "FILE_FLAG_OPEN_REPARSE_POINT": ValueOf(syscall.FILE_FLAG_OPEN_REPARSE_POINT), + "FILE_FLAG_OVERLAPPED": ValueOf(syscall.FILE_FLAG_OVERLAPPED), + "FILE_LIST_DIRECTORY": ValueOf(syscall.FILE_LIST_DIRECTORY), + "FILE_MAP_COPY": ValueOf(syscall.FILE_MAP_COPY), + "FILE_MAP_EXECUTE": ValueOf(syscall.FILE_MAP_EXECUTE), + "FILE_MAP_READ": ValueOf(syscall.FILE_MAP_READ), + "FILE_MAP_WRITE": ValueOf(syscall.FILE_MAP_WRITE), + "FILE_NOTIFY_CHANGE_ATTRIBUTES": ValueOf(syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES), + "FILE_NOTIFY_CHANGE_CREATION": ValueOf(syscall.FILE_NOTIFY_CHANGE_CREATION), + "FILE_NOTIFY_CHANGE_DIR_NAME": ValueOf(syscall.FILE_NOTIFY_CHANGE_DIR_NAME), + "FILE_NOTIFY_CHANGE_FILE_NAME": ValueOf(syscall.FILE_NOTIFY_CHANGE_FILE_NAME), + "FILE_NOTIFY_CHANGE_LAST_ACCESS": ValueOf(syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS), + "FILE_NOTIFY_CHANGE_LAST_WRITE": ValueOf(syscall.FILE_NOTIFY_CHANGE_LAST_WRITE), + "FILE_NOTIFY_CHANGE_SIZE": ValueOf(syscall.FILE_NOTIFY_CHANGE_SIZE), + "FILE_SHARE_DELETE": ValueOf(syscall.FILE_SHARE_DELETE), + "FILE_SHARE_READ": ValueOf(syscall.FILE_SHARE_READ), + "FILE_SHARE_WRITE": ValueOf(syscall.FILE_SHARE_WRITE), + "FILE_SKIP_COMPLETION_PORT_ON_SUCCESS": ValueOf(syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS), + "FILE_SKIP_SET_EVENT_ON_HANDLE": ValueOf(syscall.FILE_SKIP_SET_EVENT_ON_HANDLE), + "FILE_TYPE_CHAR": ValueOf(syscall.FILE_TYPE_CHAR), + "FILE_TYPE_DISK": ValueOf(syscall.FILE_TYPE_DISK), + "FILE_TYPE_PIPE": ValueOf(syscall.FILE_TYPE_PIPE), + "FILE_TYPE_REMOTE": ValueOf(syscall.FILE_TYPE_REMOTE), + "FILE_TYPE_UNKNOWN": ValueOf(syscall.FILE_TYPE_UNKNOWN), + "FILE_WRITE_ATTRIBUTES": ValueOf(syscall.FILE_WRITE_ATTRIBUTES), + "FORMAT_MESSAGE_ALLOCATE_BUFFER": ValueOf(syscall.FORMAT_MESSAGE_ALLOCATE_BUFFER), + "FORMAT_MESSAGE_ARGUMENT_ARRAY": ValueOf(syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY), + "FORMAT_MESSAGE_FROM_HMODULE": ValueOf(syscall.FORMAT_MESSAGE_FROM_HMODULE), + "FORMAT_MESSAGE_FROM_STRING": ValueOf(syscall.FORMAT_MESSAGE_FROM_STRING), + "FORMAT_MESSAGE_FROM_SYSTEM": ValueOf(syscall.FORMAT_MESSAGE_FROM_SYSTEM), + "FORMAT_MESSAGE_IGNORE_INSERTS": ValueOf(syscall.FORMAT_MESSAGE_IGNORE_INSERTS), + "FORMAT_MESSAGE_MAX_WIDTH_MASK": ValueOf(syscall.FORMAT_MESSAGE_MAX_WIDTH_MASK), + "FSCTL_GET_REPARSE_POINT": ValueOf(syscall.FSCTL_GET_REPARSE_POINT), + "Fchdir": ValueOf(syscall.Fchdir), + "Fchmod": ValueOf(syscall.Fchmod), + "Fchown": ValueOf(syscall.Fchown), + "FindClose": ValueOf(syscall.FindClose), + "FindFirstFile": ValueOf(syscall.FindFirstFile), + "FindNextFile": ValueOf(syscall.FindNextFile), + "FlushFileBuffers": ValueOf(syscall.FlushFileBuffers), + "FlushViewOfFile": ValueOf(syscall.FlushViewOfFile), + "ForkLock": ValueOf(&syscall.ForkLock).Elem(), + "FormatMessage": ValueOf(syscall.FormatMessage), + "FreeAddrInfoW": ValueOf(syscall.FreeAddrInfoW), + "FreeEnvironmentStrings": ValueOf(syscall.FreeEnvironmentStrings), + "FreeLibrary": ValueOf(syscall.FreeLibrary), + "Fsync": ValueOf(syscall.Fsync), + "Ftruncate": ValueOf(syscall.Ftruncate), + "FullPath": ValueOf(syscall.FullPath), + "GENERIC_ALL": ValueOf(syscall.GENERIC_ALL), + "GENERIC_EXECUTE": ValueOf(syscall.GENERIC_EXECUTE), + "GENERIC_READ": ValueOf(uint32(syscall.GENERIC_READ)), + "GENERIC_WRITE": ValueOf(syscall.GENERIC_WRITE), + "GetAcceptExSockaddrs": ValueOf(syscall.GetAcceptExSockaddrs), + "GetAdaptersInfo": ValueOf(syscall.GetAdaptersInfo), + "GetAddrInfoW": ValueOf(syscall.GetAddrInfoW), + "GetCommandLine": ValueOf(syscall.GetCommandLine), + "GetComputerName": ValueOf(syscall.GetComputerName), + "GetConsoleMode": ValueOf(syscall.GetConsoleMode), + "GetCurrentDirectory": ValueOf(syscall.GetCurrentDirectory), + "GetCurrentProcess": ValueOf(syscall.GetCurrentProcess), + "GetEnvironmentStrings": ValueOf(syscall.GetEnvironmentStrings), + "GetEnvironmentVariable": ValueOf(syscall.GetEnvironmentVariable), + "GetExitCodeProcess": ValueOf(syscall.GetExitCodeProcess), + "GetFileAttributes": ValueOf(syscall.GetFileAttributes), + "GetFileAttributesEx": ValueOf(syscall.GetFileAttributesEx), + "GetFileExInfoStandard": ValueOf(syscall.GetFileExInfoStandard), + "GetFileExMaxInfoLevel": ValueOf(syscall.GetFileExMaxInfoLevel), + "GetFileInformationByHandle": ValueOf(syscall.GetFileInformationByHandle), + "GetFileType": ValueOf(syscall.GetFileType), + "GetFullPathName": ValueOf(syscall.GetFullPathName), + "GetHostByName": ValueOf(syscall.GetHostByName), + "GetIfEntry": ValueOf(syscall.GetIfEntry), + "GetLastError": ValueOf(syscall.GetLastError), + "GetLengthSid": ValueOf(syscall.GetLengthSid), + "GetLongPathName": ValueOf(syscall.GetLongPathName), + "GetProcAddress": ValueOf(syscall.GetProcAddress), + "GetProcessTimes": ValueOf(syscall.GetProcessTimes), + "GetProtoByName": ValueOf(syscall.GetProtoByName), + "GetQueuedCompletionStatus": ValueOf(syscall.GetQueuedCompletionStatus), + "GetServByName": ValueOf(syscall.GetServByName), + "GetShortPathName": ValueOf(syscall.GetShortPathName), + "GetStartupInfo": ValueOf(syscall.GetStartupInfo), + "GetStdHandle": ValueOf(syscall.GetStdHandle), + "GetSystemTimeAsFileTime": ValueOf(syscall.GetSystemTimeAsFileTime), + "GetTempPath": ValueOf(syscall.GetTempPath), + "GetTimeZoneInformation": ValueOf(syscall.GetTimeZoneInformation), + "GetTokenInformation": ValueOf(syscall.GetTokenInformation), + "GetUserNameEx": ValueOf(syscall.GetUserNameEx), + "GetUserProfileDirectory": ValueOf(syscall.GetUserProfileDirectory), + "GetVersion": ValueOf(syscall.GetVersion), + "Getegid": ValueOf(syscall.Getegid), + "Getenv": ValueOf(syscall.Getenv), + "Geteuid": ValueOf(syscall.Geteuid), + "Getgid": ValueOf(syscall.Getgid), + "Getgroups": ValueOf(syscall.Getgroups), + "Getpagesize": ValueOf(syscall.Getpagesize), + "Getpeername": ValueOf(syscall.Getpeername), + "Getpid": ValueOf(syscall.Getpid), + "Getppid": ValueOf(syscall.Getppid), + "Getsockname": ValueOf(syscall.Getsockname), + "Getsockopt": ValueOf(syscall.Getsockopt), + "GetsockoptInt": ValueOf(syscall.GetsockoptInt), + "Gettimeofday": ValueOf(syscall.Gettimeofday), + "Getuid": ValueOf(syscall.Getuid), + "Getwd": ValueOf(syscall.Getwd), + "HANDLE_FLAG_INHERIT": ValueOf(syscall.HANDLE_FLAG_INHERIT), + "HKEY_CLASSES_ROOT": ValueOf(uint32(syscall.HKEY_CLASSES_ROOT)), + "HKEY_CURRENT_CONFIG": ValueOf(uint32(syscall.HKEY_CURRENT_CONFIG)), + "HKEY_CURRENT_USER": ValueOf(uint32(syscall.HKEY_CURRENT_USER)), + "HKEY_DYN_DATA": ValueOf(uint32(syscall.HKEY_DYN_DATA)), + "HKEY_LOCAL_MACHINE": ValueOf(uint32(syscall.HKEY_LOCAL_MACHINE)), + "HKEY_PERFORMANCE_DATA": ValueOf(uint32(syscall.HKEY_PERFORMANCE_DATA)), + "HKEY_USERS": ValueOf(uint32(syscall.HKEY_USERS)), + "IFF_BROADCAST": ValueOf(syscall.IFF_BROADCAST), + "IFF_LOOPBACK": ValueOf(syscall.IFF_LOOPBACK), + "IFF_MULTICAST": ValueOf(syscall.IFF_MULTICAST), + "IFF_POINTTOPOINT": ValueOf(syscall.IFF_POINTTOPOINT), + "IFF_UP": ValueOf(syscall.IFF_UP), + "IGNORE": ValueOf(syscall.IGNORE), + "INFINITE": ValueOf(uint32(syscall.INFINITE)), + "INVALID_FILE_ATTRIBUTES": ValueOf(uint32(syscall.INVALID_FILE_ATTRIBUTES)), + "IOC_IN": ValueOf(uint32(syscall.IOC_IN)), + "IOC_INOUT": ValueOf(uint32(syscall.IOC_INOUT)), + "IOC_OUT": ValueOf(syscall.IOC_OUT), + "IOC_VENDOR": ValueOf(syscall.IOC_VENDOR), + "IOC_WS2": ValueOf(syscall.IOC_WS2), + "IO_REPARSE_TAG_SYMLINK": ValueOf(uint32(syscall.IO_REPARSE_TAG_SYMLINK)), + "IPPROTO_IP": ValueOf(syscall.IPPROTO_IP), + "IPPROTO_IPV6": ValueOf(syscall.IPPROTO_IPV6), + "IPPROTO_TCP": ValueOf(syscall.IPPROTO_TCP), + "IPPROTO_UDP": ValueOf(syscall.IPPROTO_UDP), + "IPV6_JOIN_GROUP": ValueOf(syscall.IPV6_JOIN_GROUP), + "IPV6_LEAVE_GROUP": ValueOf(syscall.IPV6_LEAVE_GROUP), + "IPV6_MULTICAST_HOPS": ValueOf(syscall.IPV6_MULTICAST_HOPS), + "IPV6_MULTICAST_IF": ValueOf(syscall.IPV6_MULTICAST_IF), + "IPV6_MULTICAST_LOOP": ValueOf(syscall.IPV6_MULTICAST_LOOP), + "IPV6_UNICAST_HOPS": ValueOf(syscall.IPV6_UNICAST_HOPS), + "IPV6_V6ONLY": ValueOf(syscall.IPV6_V6ONLY), + "IP_ADD_MEMBERSHIP": ValueOf(syscall.IP_ADD_MEMBERSHIP), + "IP_DROP_MEMBERSHIP": ValueOf(syscall.IP_DROP_MEMBERSHIP), + "IP_MULTICAST_IF": ValueOf(syscall.IP_MULTICAST_IF), + "IP_MULTICAST_LOOP": ValueOf(syscall.IP_MULTICAST_LOOP), + "IP_MULTICAST_TTL": ValueOf(syscall.IP_MULTICAST_TTL), + "IP_TOS": ValueOf(syscall.IP_TOS), + "IP_TTL": ValueOf(syscall.IP_TTL), + "ImplementsGetwd": ValueOf(syscall.ImplementsGetwd), + "InvalidHandle": ValueOf(uint64(syscall.InvalidHandle)), + "KEY_ALL_ACCESS": ValueOf(syscall.KEY_ALL_ACCESS), + "KEY_CREATE_LINK": ValueOf(syscall.KEY_CREATE_LINK), + "KEY_CREATE_SUB_KEY": ValueOf(syscall.KEY_CREATE_SUB_KEY), + "KEY_ENUMERATE_SUB_KEYS": ValueOf(syscall.KEY_ENUMERATE_SUB_KEYS), + "KEY_EXECUTE": ValueOf(syscall.KEY_EXECUTE), + "KEY_NOTIFY": ValueOf(syscall.KEY_NOTIFY), + "KEY_QUERY_VALUE": ValueOf(syscall.KEY_QUERY_VALUE), + "KEY_READ": ValueOf(syscall.KEY_READ), + "KEY_SET_VALUE": ValueOf(syscall.KEY_SET_VALUE), + "KEY_WOW64_32KEY": ValueOf(syscall.KEY_WOW64_32KEY), + "KEY_WOW64_64KEY": ValueOf(syscall.KEY_WOW64_64KEY), + "KEY_WRITE": ValueOf(syscall.KEY_WRITE), + "LANG_ENGLISH": ValueOf(syscall.LANG_ENGLISH), + "LAYERED_PROTOCOL": ValueOf(syscall.LAYERED_PROTOCOL), + "Lchown": ValueOf(syscall.Lchown), + "Link": ValueOf(syscall.Link), + "Listen": ValueOf(syscall.Listen), + "LoadCancelIoEx": ValueOf(syscall.LoadCancelIoEx), + "LoadConnectEx": ValueOf(syscall.LoadConnectEx), + "LoadCreateSymbolicLink": ValueOf(syscall.LoadCreateSymbolicLink), + "LoadDLL": ValueOf(syscall.LoadDLL), + "LoadGetAddrInfo": ValueOf(syscall.LoadGetAddrInfo), + "LoadLibrary": ValueOf(syscall.LoadLibrary), + "LoadSetFileCompletionNotificationModes": ValueOf(syscall.LoadSetFileCompletionNotificationModes), + "LocalFree": ValueOf(syscall.LocalFree), + "LookupAccountName": ValueOf(syscall.LookupAccountName), + "LookupAccountSid": ValueOf(syscall.LookupAccountSid), + "LookupSID": ValueOf(syscall.LookupSID), + "MAXIMUM_REPARSE_DATA_BUFFER_SIZE": ValueOf(syscall.MAXIMUM_REPARSE_DATA_BUFFER_SIZE), + "MAXLEN_IFDESCR": ValueOf(syscall.MAXLEN_IFDESCR), + "MAXLEN_PHYSADDR": ValueOf(syscall.MAXLEN_PHYSADDR), + "MAX_ADAPTER_ADDRESS_LENGTH": ValueOf(syscall.MAX_ADAPTER_ADDRESS_LENGTH), + "MAX_ADAPTER_DESCRIPTION_LENGTH": ValueOf(syscall.MAX_ADAPTER_DESCRIPTION_LENGTH), + "MAX_ADAPTER_NAME_LENGTH": ValueOf(syscall.MAX_ADAPTER_NAME_LENGTH), + "MAX_COMPUTERNAME_LENGTH": ValueOf(syscall.MAX_COMPUTERNAME_LENGTH), + "MAX_INTERFACE_NAME_LEN": ValueOf(syscall.MAX_INTERFACE_NAME_LEN), + "MAX_LONG_PATH": ValueOf(syscall.MAX_LONG_PATH), + "MAX_PATH": ValueOf(syscall.MAX_PATH), + "MAX_PROTOCOL_CHAIN": ValueOf(syscall.MAX_PROTOCOL_CHAIN), + "MapViewOfFile": ValueOf(syscall.MapViewOfFile), + "MaxTokenInfoClass": ValueOf(syscall.MaxTokenInfoClass), + "Mkdir": ValueOf(syscall.Mkdir), + "MoveFile": ValueOf(syscall.MoveFile), + "MustLoadDLL": ValueOf(syscall.MustLoadDLL), + "NameCanonical": ValueOf(syscall.NameCanonical), + "NameCanonicalEx": ValueOf(syscall.NameCanonicalEx), + "NameDisplay": ValueOf(syscall.NameDisplay), + "NameDnsDomain": ValueOf(syscall.NameDnsDomain), + "NameFullyQualifiedDN": ValueOf(syscall.NameFullyQualifiedDN), + "NameSamCompatible": ValueOf(syscall.NameSamCompatible), + "NameServicePrincipal": ValueOf(syscall.NameServicePrincipal), + "NameUniqueId": ValueOf(syscall.NameUniqueId), + "NameUnknown": ValueOf(syscall.NameUnknown), + "NameUserPrincipal": ValueOf(syscall.NameUserPrincipal), + "NetApiBufferFree": ValueOf(syscall.NetApiBufferFree), + "NetGetJoinInformation": ValueOf(syscall.NetGetJoinInformation), + "NetSetupDomainName": ValueOf(syscall.NetSetupDomainName), + "NetSetupUnjoined": ValueOf(syscall.NetSetupUnjoined), + "NetSetupUnknownStatus": ValueOf(syscall.NetSetupUnknownStatus), + "NetSetupWorkgroupName": ValueOf(syscall.NetSetupWorkgroupName), + "NetUserGetInfo": ValueOf(syscall.NetUserGetInfo), + "NewCallback": ValueOf(syscall.NewCallback), + "NewCallbackCDecl": ValueOf(syscall.NewCallbackCDecl), + "NewLazyDLL": ValueOf(syscall.NewLazyDLL), + "NsecToFiletime": ValueOf(syscall.NsecToFiletime), + "NsecToTimespec": ValueOf(syscall.NsecToTimespec), + "NsecToTimeval": ValueOf(syscall.NsecToTimeval), + "Ntohs": ValueOf(syscall.Ntohs), + "OID_PKIX_KP_SERVER_AUTH": ValueOf(&syscall.OID_PKIX_KP_SERVER_AUTH).Elem(), + "OID_SERVER_GATED_CRYPTO": ValueOf(&syscall.OID_SERVER_GATED_CRYPTO).Elem(), + "OID_SGC_NETSCAPE": ValueOf(&syscall.OID_SGC_NETSCAPE).Elem(), + "OPEN_ALWAYS": ValueOf(syscall.OPEN_ALWAYS), + "OPEN_EXISTING": ValueOf(syscall.OPEN_EXISTING), + "O_APPEND": ValueOf(syscall.O_APPEND), + "O_ASYNC": ValueOf(syscall.O_ASYNC), + "O_CLOEXEC": ValueOf(syscall.O_CLOEXEC), + "O_CREAT": ValueOf(syscall.O_CREAT), + "O_EXCL": ValueOf(syscall.O_EXCL), + "O_NOCTTY": ValueOf(syscall.O_NOCTTY), + "O_NONBLOCK": ValueOf(syscall.O_NONBLOCK), + "O_RDONLY": ValueOf(syscall.O_RDONLY), + "O_RDWR": ValueOf(syscall.O_RDWR), + "O_SYNC": ValueOf(syscall.O_SYNC), + "O_TRUNC": ValueOf(syscall.O_TRUNC), + "O_WRONLY": ValueOf(syscall.O_WRONLY), + "Open": ValueOf(syscall.Open), + "OpenCurrentProcessToken": ValueOf(syscall.OpenCurrentProcessToken), + "OpenProcess": ValueOf(syscall.OpenProcess), + "OpenProcessToken": ValueOf(syscall.OpenProcessToken), + "PAGE_EXECUTE_READ": ValueOf(syscall.PAGE_EXECUTE_READ), + "PAGE_EXECUTE_READWRITE": ValueOf(syscall.PAGE_EXECUTE_READWRITE), + "PAGE_EXECUTE_WRITECOPY": ValueOf(syscall.PAGE_EXECUTE_WRITECOPY), + "PAGE_READONLY": ValueOf(syscall.PAGE_READONLY), + "PAGE_READWRITE": ValueOf(syscall.PAGE_READWRITE), + "PAGE_WRITECOPY": ValueOf(syscall.PAGE_WRITECOPY), + "PFL_HIDDEN": ValueOf(syscall.PFL_HIDDEN), + "PFL_MATCHES_PROTOCOL_ZERO": ValueOf(syscall.PFL_MATCHES_PROTOCOL_ZERO), + "PFL_MULTIPLE_PROTO_ENTRIES": ValueOf(syscall.PFL_MULTIPLE_PROTO_ENTRIES), + "PFL_NETWORKDIRECT_PROVIDER": ValueOf(syscall.PFL_NETWORKDIRECT_PROVIDER), + "PFL_RECOMMENDED_PROTO_ENTRY": ValueOf(syscall.PFL_RECOMMENDED_PROTO_ENTRY), + "PKCS_7_ASN_ENCODING": ValueOf(syscall.PKCS_7_ASN_ENCODING), + "PROCESS_QUERY_INFORMATION": ValueOf(syscall.PROCESS_QUERY_INFORMATION), + "PROCESS_TERMINATE": ValueOf(syscall.PROCESS_TERMINATE), + "PROV_DH_SCHANNEL": ValueOf(syscall.PROV_DH_SCHANNEL), + "PROV_DSS": ValueOf(syscall.PROV_DSS), + "PROV_DSS_DH": ValueOf(syscall.PROV_DSS_DH), + "PROV_EC_ECDSA_FULL": ValueOf(syscall.PROV_EC_ECDSA_FULL), + "PROV_EC_ECDSA_SIG": ValueOf(syscall.PROV_EC_ECDSA_SIG), + "PROV_EC_ECNRA_FULL": ValueOf(syscall.PROV_EC_ECNRA_FULL), + "PROV_EC_ECNRA_SIG": ValueOf(syscall.PROV_EC_ECNRA_SIG), + "PROV_FORTEZZA": ValueOf(syscall.PROV_FORTEZZA), + "PROV_INTEL_SEC": ValueOf(syscall.PROV_INTEL_SEC), + "PROV_MS_EXCHANGE": ValueOf(syscall.PROV_MS_EXCHANGE), + "PROV_REPLACE_OWF": ValueOf(syscall.PROV_REPLACE_OWF), + "PROV_RNG": ValueOf(syscall.PROV_RNG), + "PROV_RSA_AES": ValueOf(syscall.PROV_RSA_AES), + "PROV_RSA_FULL": ValueOf(syscall.PROV_RSA_FULL), + "PROV_RSA_SCHANNEL": ValueOf(syscall.PROV_RSA_SCHANNEL), + "PROV_RSA_SIG": ValueOf(syscall.PROV_RSA_SIG), + "PROV_SPYRUS_LYNKS": ValueOf(syscall.PROV_SPYRUS_LYNKS), + "PROV_SSL": ValueOf(syscall.PROV_SSL), + "Pipe": ValueOf(syscall.Pipe), + "PostQueuedCompletionStatus": ValueOf(syscall.PostQueuedCompletionStatus), + "Process32First": ValueOf(syscall.Process32First), + "Process32Next": ValueOf(syscall.Process32Next), + "REG_BINARY": ValueOf(syscall.REG_BINARY), + "REG_DWORD": ValueOf(syscall.REG_DWORD), + "REG_DWORD_BIG_ENDIAN": ValueOf(syscall.REG_DWORD_BIG_ENDIAN), + "REG_DWORD_LITTLE_ENDIAN": ValueOf(syscall.REG_DWORD_LITTLE_ENDIAN), + "REG_EXPAND_SZ": ValueOf(syscall.REG_EXPAND_SZ), + "REG_FULL_RESOURCE_DESCRIPTOR": ValueOf(syscall.REG_FULL_RESOURCE_DESCRIPTOR), + "REG_LINK": ValueOf(syscall.REG_LINK), + "REG_MULTI_SZ": ValueOf(syscall.REG_MULTI_SZ), + "REG_NONE": ValueOf(syscall.REG_NONE), + "REG_QWORD": ValueOf(syscall.REG_QWORD), + "REG_QWORD_LITTLE_ENDIAN": ValueOf(syscall.REG_QWORD_LITTLE_ENDIAN), + "REG_RESOURCE_LIST": ValueOf(syscall.REG_RESOURCE_LIST), + "REG_RESOURCE_REQUIREMENTS_LIST": ValueOf(syscall.REG_RESOURCE_REQUIREMENTS_LIST), + "REG_SZ": ValueOf(syscall.REG_SZ), + "Read": ValueOf(syscall.Read), + "ReadConsole": ValueOf(syscall.ReadConsole), + "ReadDirectoryChanges": ValueOf(syscall.ReadDirectoryChanges), + "ReadFile": ValueOf(syscall.ReadFile), + "Readlink": ValueOf(syscall.Readlink), + "Recvfrom": ValueOf(syscall.Recvfrom), + "RegCloseKey": ValueOf(syscall.RegCloseKey), + "RegEnumKeyEx": ValueOf(syscall.RegEnumKeyEx), + "RegOpenKeyEx": ValueOf(syscall.RegOpenKeyEx), + "RegQueryInfoKey": ValueOf(syscall.RegQueryInfoKey), + "RegQueryValueEx": ValueOf(syscall.RegQueryValueEx), + "RemoveDirectory": ValueOf(syscall.RemoveDirectory), + "Rename": ValueOf(syscall.Rename), + "Rmdir": ValueOf(syscall.Rmdir), + "SHUT_RD": ValueOf(syscall.SHUT_RD), + "SHUT_RDWR": ValueOf(syscall.SHUT_RDWR), + "SHUT_WR": ValueOf(syscall.SHUT_WR), + "SIGABRT": ValueOf(syscall.SIGABRT), + "SIGALRM": ValueOf(syscall.SIGALRM), + "SIGBUS": ValueOf(syscall.SIGBUS), + "SIGFPE": ValueOf(syscall.SIGFPE), + "SIGHUP": ValueOf(syscall.SIGHUP), + "SIGILL": ValueOf(syscall.SIGILL), + "SIGINT": ValueOf(syscall.SIGINT), + "SIGKILL": ValueOf(syscall.SIGKILL), + "SIGPIPE": ValueOf(syscall.SIGPIPE), + "SIGQUIT": ValueOf(syscall.SIGQUIT), + "SIGSEGV": ValueOf(syscall.SIGSEGV), + "SIGTERM": ValueOf(syscall.SIGTERM), + "SIGTRAP": ValueOf(syscall.SIGTRAP), + "SIO_GET_EXTENSION_FUNCTION_POINTER": ValueOf(uint32(syscall.SIO_GET_EXTENSION_FUNCTION_POINTER)), + "SIO_GET_INTERFACE_LIST": ValueOf(syscall.SIO_GET_INTERFACE_LIST), + "SIO_KEEPALIVE_VALS": ValueOf(uint32(syscall.SIO_KEEPALIVE_VALS)), + "SIO_UDP_CONNRESET": ValueOf(uint32(syscall.SIO_UDP_CONNRESET)), + "SOCK_DGRAM": ValueOf(syscall.SOCK_DGRAM), + "SOCK_RAW": ValueOf(syscall.SOCK_RAW), + "SOCK_SEQPACKET": ValueOf(syscall.SOCK_SEQPACKET), + "SOCK_STREAM": ValueOf(syscall.SOCK_STREAM), + "SOL_SOCKET": ValueOf(syscall.SOL_SOCKET), + "SOMAXCONN": ValueOf(syscall.SOMAXCONN), + "SO_BROADCAST": ValueOf(syscall.SO_BROADCAST), + "SO_DONTROUTE": ValueOf(syscall.SO_DONTROUTE), + "SO_KEEPALIVE": ValueOf(syscall.SO_KEEPALIVE), + "SO_LINGER": ValueOf(syscall.SO_LINGER), + "SO_RCVBUF": ValueOf(syscall.SO_RCVBUF), + "SO_REUSEADDR": ValueOf(syscall.SO_REUSEADDR), + "SO_SNDBUF": ValueOf(syscall.SO_SNDBUF), + "SO_UPDATE_ACCEPT_CONTEXT": ValueOf(syscall.SO_UPDATE_ACCEPT_CONTEXT), + "SO_UPDATE_CONNECT_CONTEXT": ValueOf(syscall.SO_UPDATE_CONNECT_CONTEXT), + "STANDARD_RIGHTS_ALL": ValueOf(syscall.STANDARD_RIGHTS_ALL), + "STANDARD_RIGHTS_EXECUTE": ValueOf(syscall.STANDARD_RIGHTS_EXECUTE), + "STANDARD_RIGHTS_READ": ValueOf(syscall.STANDARD_RIGHTS_READ), + "STANDARD_RIGHTS_REQUIRED": ValueOf(syscall.STANDARD_RIGHTS_REQUIRED), + "STANDARD_RIGHTS_WRITE": ValueOf(syscall.STANDARD_RIGHTS_WRITE), + "STARTF_USESHOWWINDOW": ValueOf(syscall.STARTF_USESHOWWINDOW), + "STARTF_USESTDHANDLES": ValueOf(syscall.STARTF_USESTDHANDLES), + "STD_ERROR_HANDLE": ValueOf(syscall.STD_ERROR_HANDLE), + "STD_INPUT_HANDLE": ValueOf(syscall.STD_INPUT_HANDLE), + "STD_OUTPUT_HANDLE": ValueOf(syscall.STD_OUTPUT_HANDLE), + "SUBLANG_ENGLISH_US": ValueOf(syscall.SUBLANG_ENGLISH_US), + "SW_FORCEMINIMIZE": ValueOf(syscall.SW_FORCEMINIMIZE), + "SW_HIDE": ValueOf(syscall.SW_HIDE), + "SW_MAXIMIZE": ValueOf(syscall.SW_MAXIMIZE), + "SW_MINIMIZE": ValueOf(syscall.SW_MINIMIZE), + "SW_NORMAL": ValueOf(syscall.SW_NORMAL), + "SW_RESTORE": ValueOf(syscall.SW_RESTORE), + "SW_SHOW": ValueOf(syscall.SW_SHOW), + "SW_SHOWDEFAULT": ValueOf(syscall.SW_SHOWDEFAULT), + "SW_SHOWMAXIMIZED": ValueOf(syscall.SW_SHOWMAXIMIZED), + "SW_SHOWMINIMIZED": ValueOf(syscall.SW_SHOWMINIMIZED), + "SW_SHOWMINNOACTIVE": ValueOf(syscall.SW_SHOWMINNOACTIVE), + "SW_SHOWNA": ValueOf(syscall.SW_SHOWNA), + "SW_SHOWNOACTIVATE": ValueOf(syscall.SW_SHOWNOACTIVATE), + "SW_SHOWNORMAL": ValueOf(syscall.SW_SHOWNORMAL), + "SYMBOLIC_LINK_FLAG_DIRECTORY": ValueOf(syscall.SYMBOLIC_LINK_FLAG_DIRECTORY), + "SYNCHRONIZE": ValueOf(syscall.SYNCHRONIZE), + "S_IFBLK": ValueOf(syscall.S_IFBLK), + "S_IFCHR": ValueOf(syscall.S_IFCHR), + "S_IFDIR": ValueOf(syscall.S_IFDIR), + "S_IFIFO": ValueOf(syscall.S_IFIFO), + "S_IFLNK": ValueOf(syscall.S_IFLNK), + "S_IFMT": ValueOf(syscall.S_IFMT), + "S_IFREG": ValueOf(syscall.S_IFREG), + "S_IFSOCK": ValueOf(syscall.S_IFSOCK), + "S_IRUSR": ValueOf(syscall.S_IRUSR), + "S_ISGID": ValueOf(syscall.S_ISGID), + "S_ISUID": ValueOf(syscall.S_ISUID), + "S_ISVTX": ValueOf(syscall.S_ISVTX), + "S_IWRITE": ValueOf(syscall.S_IWRITE), + "S_IWUSR": ValueOf(syscall.S_IWUSR), + "S_IXUSR": ValueOf(syscall.S_IXUSR), + "Seek": ValueOf(syscall.Seek), + "Sendto": ValueOf(syscall.Sendto), + "SetCurrentDirectory": ValueOf(syscall.SetCurrentDirectory), + "SetEndOfFile": ValueOf(syscall.SetEndOfFile), + "SetEnvironmentVariable": ValueOf(syscall.SetEnvironmentVariable), + "SetFileAttributes": ValueOf(syscall.SetFileAttributes), + "SetFileCompletionNotificationModes": ValueOf(syscall.SetFileCompletionNotificationModes), + "SetFilePointer": ValueOf(syscall.SetFilePointer), + "SetFileTime": ValueOf(syscall.SetFileTime), + "SetHandleInformation": ValueOf(syscall.SetHandleInformation), + "SetNonblock": ValueOf(syscall.SetNonblock), + "Setenv": ValueOf(syscall.Setenv), + "Setsockopt": ValueOf(syscall.Setsockopt), + "SetsockoptIPMreq": ValueOf(syscall.SetsockoptIPMreq), + "SetsockoptIPv6Mreq": ValueOf(syscall.SetsockoptIPv6Mreq), + "SetsockoptInet4Addr": ValueOf(syscall.SetsockoptInet4Addr), + "SetsockoptInt": ValueOf(syscall.SetsockoptInt), + "SetsockoptLinger": ValueOf(syscall.SetsockoptLinger), + "SetsockoptTimeval": ValueOf(syscall.SetsockoptTimeval), + "Shutdown": ValueOf(syscall.Shutdown), + "SidTypeAlias": ValueOf(syscall.SidTypeAlias), + "SidTypeComputer": ValueOf(syscall.SidTypeComputer), + "SidTypeDeletedAccount": ValueOf(syscall.SidTypeDeletedAccount), + "SidTypeDomain": ValueOf(syscall.SidTypeDomain), + "SidTypeGroup": ValueOf(syscall.SidTypeGroup), + "SidTypeInvalid": ValueOf(syscall.SidTypeInvalid), + "SidTypeLabel": ValueOf(syscall.SidTypeLabel), + "SidTypeUnknown": ValueOf(syscall.SidTypeUnknown), + "SidTypeUser": ValueOf(syscall.SidTypeUser), + "SidTypeWellKnownGroup": ValueOf(syscall.SidTypeWellKnownGroup), + "Socket": ValueOf(syscall.Socket), + "SocketDisableIPv6": ValueOf(&syscall.SocketDisableIPv6).Elem(), + "StartProcess": ValueOf(syscall.StartProcess), + "Stderr": ValueOf(&syscall.Stderr).Elem(), + "Stdin": ValueOf(&syscall.Stdin).Elem(), + "Stdout": ValueOf(&syscall.Stdout).Elem(), + "StringBytePtr": ValueOf(syscall.StringBytePtr), + "StringByteSlice": ValueOf(syscall.StringByteSlice), + "StringToSid": ValueOf(syscall.StringToSid), + "StringToUTF16": ValueOf(syscall.StringToUTF16), + "StringToUTF16Ptr": ValueOf(syscall.StringToUTF16Ptr), + "Symlink": ValueOf(syscall.Symlink), + "Syscall": ValueOf(syscall.Syscall), + "Syscall12": ValueOf(syscall.Syscall12), + "Syscall15": ValueOf(syscall.Syscall15), + "Syscall6": ValueOf(syscall.Syscall6), + "Syscall9": ValueOf(syscall.Syscall9), + "TCP_NODELAY": ValueOf(syscall.TCP_NODELAY), + "TF_DISCONNECT": ValueOf(syscall.TF_DISCONNECT), + "TF_REUSE_SOCKET": ValueOf(syscall.TF_REUSE_SOCKET), + "TF_USE_DEFAULT_WORKER": ValueOf(syscall.TF_USE_DEFAULT_WORKER), + "TF_USE_KERNEL_APC": ValueOf(syscall.TF_USE_KERNEL_APC), + "TF_USE_SYSTEM_THREAD": ValueOf(syscall.TF_USE_SYSTEM_THREAD), + "TF_WRITE_BEHIND": ValueOf(syscall.TF_WRITE_BEHIND), + "TH32CS_INHERIT": ValueOf(uint32(syscall.TH32CS_INHERIT)), + "TH32CS_SNAPALL": ValueOf(syscall.TH32CS_SNAPALL), + "TH32CS_SNAPHEAPLIST": ValueOf(syscall.TH32CS_SNAPHEAPLIST), + "TH32CS_SNAPMODULE": ValueOf(syscall.TH32CS_SNAPMODULE), + "TH32CS_SNAPMODULE32": ValueOf(syscall.TH32CS_SNAPMODULE32), + "TH32CS_SNAPPROCESS": ValueOf(syscall.TH32CS_SNAPPROCESS), + "TH32CS_SNAPTHREAD": ValueOf(syscall.TH32CS_SNAPTHREAD), + "TIME_ZONE_ID_DAYLIGHT": ValueOf(syscall.TIME_ZONE_ID_DAYLIGHT), + "TIME_ZONE_ID_STANDARD": ValueOf(syscall.TIME_ZONE_ID_STANDARD), + "TIME_ZONE_ID_UNKNOWN": ValueOf(syscall.TIME_ZONE_ID_UNKNOWN), + "TOKEN_ADJUST_DEFAULT": ValueOf(syscall.TOKEN_ADJUST_DEFAULT), + "TOKEN_ADJUST_GROUPS": ValueOf(syscall.TOKEN_ADJUST_GROUPS), + "TOKEN_ADJUST_PRIVILEGES": ValueOf(syscall.TOKEN_ADJUST_PRIVILEGES), + "TOKEN_ALL_ACCESS": ValueOf(syscall.TOKEN_ALL_ACCESS), + "TOKEN_ASSIGN_PRIMARY": ValueOf(syscall.TOKEN_ASSIGN_PRIMARY), + "TOKEN_DUPLICATE": ValueOf(syscall.TOKEN_DUPLICATE), + "TOKEN_EXECUTE": ValueOf(syscall.TOKEN_EXECUTE), + "TOKEN_IMPERSONATE": ValueOf(syscall.TOKEN_IMPERSONATE), + "TOKEN_QUERY": ValueOf(syscall.TOKEN_QUERY), + "TOKEN_QUERY_SOURCE": ValueOf(syscall.TOKEN_QUERY_SOURCE), + "TOKEN_READ": ValueOf(syscall.TOKEN_READ), + "TOKEN_WRITE": ValueOf(syscall.TOKEN_WRITE), + "TRUNCATE_EXISTING": ValueOf(syscall.TRUNCATE_EXISTING), + "TerminateProcess": ValueOf(syscall.TerminateProcess), + "TimespecToNsec": ValueOf(syscall.TimespecToNsec), + "TokenAccessInformation": ValueOf(syscall.TokenAccessInformation), + "TokenAuditPolicy": ValueOf(syscall.TokenAuditPolicy), + "TokenDefaultDacl": ValueOf(syscall.TokenDefaultDacl), + "TokenElevation": ValueOf(syscall.TokenElevation), + "TokenElevationType": ValueOf(syscall.TokenElevationType), + "TokenGroups": ValueOf(syscall.TokenGroups), + "TokenGroupsAndPrivileges": ValueOf(syscall.TokenGroupsAndPrivileges), + "TokenHasRestrictions": ValueOf(syscall.TokenHasRestrictions), + "TokenImpersonationLevel": ValueOf(syscall.TokenImpersonationLevel), + "TokenIntegrityLevel": ValueOf(syscall.TokenIntegrityLevel), + "TokenLinkedToken": ValueOf(syscall.TokenLinkedToken), + "TokenLogonSid": ValueOf(syscall.TokenLogonSid), + "TokenMandatoryPolicy": ValueOf(syscall.TokenMandatoryPolicy), + "TokenOrigin": ValueOf(syscall.TokenOrigin), + "TokenOwner": ValueOf(syscall.TokenOwner), + "TokenPrimaryGroup": ValueOf(syscall.TokenPrimaryGroup), + "TokenPrivileges": ValueOf(syscall.TokenPrivileges), + "TokenRestrictedSids": ValueOf(syscall.TokenRestrictedSids), + "TokenSandBoxInert": ValueOf(syscall.TokenSandBoxInert), + "TokenSessionId": ValueOf(syscall.TokenSessionId), + "TokenSessionReference": ValueOf(syscall.TokenSessionReference), + "TokenSource": ValueOf(syscall.TokenSource), + "TokenStatistics": ValueOf(syscall.TokenStatistics), + "TokenType": ValueOf(syscall.TokenType), + "TokenUIAccess": ValueOf(syscall.TokenUIAccess), + "TokenUser": ValueOf(syscall.TokenUser), + "TokenVirtualizationAllowed": ValueOf(syscall.TokenVirtualizationAllowed), + "TokenVirtualizationEnabled": ValueOf(syscall.TokenVirtualizationEnabled), + "TranslateAccountName": ValueOf(syscall.TranslateAccountName), + "TranslateName": ValueOf(syscall.TranslateName), + "TransmitFile": ValueOf(syscall.TransmitFile), + "USAGE_MATCH_TYPE_AND": ValueOf(syscall.USAGE_MATCH_TYPE_AND), + "USAGE_MATCH_TYPE_OR": ValueOf(syscall.USAGE_MATCH_TYPE_OR), + "UTF16FromString": ValueOf(syscall.UTF16FromString), + "UTF16PtrFromString": ValueOf(syscall.UTF16PtrFromString), + "UTF16ToString": ValueOf(syscall.UTF16ToString), + "Unlink": ValueOf(syscall.Unlink), + "UnmapViewOfFile": ValueOf(syscall.UnmapViewOfFile), + "Unsetenv": ValueOf(syscall.Unsetenv), + "Utimes": ValueOf(syscall.Utimes), + "UtimesNano": ValueOf(syscall.UtimesNano), + "VirtualLock": ValueOf(syscall.VirtualLock), + "VirtualUnlock": ValueOf(syscall.VirtualUnlock), + "WAIT_ABANDONED": ValueOf(syscall.WAIT_ABANDONED), + "WAIT_FAILED": ValueOf(uint32(syscall.WAIT_FAILED)), + "WAIT_OBJECT_0": ValueOf(syscall.WAIT_OBJECT_0), + "WAIT_TIMEOUT": ValueOf(syscall.WAIT_TIMEOUT), + "WSACleanup": ValueOf(syscall.WSACleanup), + "WSADESCRIPTION_LEN": ValueOf(syscall.WSADESCRIPTION_LEN), + "WSAEACCES": ValueOf(syscall.WSAEACCES), + "WSAECONNRESET": ValueOf(syscall.WSAECONNRESET), + "WSAEnumProtocols": ValueOf(syscall.WSAEnumProtocols), + "WSAID_CONNECTEX": ValueOf(&syscall.WSAID_CONNECTEX).Elem(), + "WSAIoctl": ValueOf(syscall.WSAIoctl), + "WSAPROTOCOL_LEN": ValueOf(syscall.WSAPROTOCOL_LEN), + "WSARecv": ValueOf(syscall.WSARecv), + "WSARecvFrom": ValueOf(syscall.WSARecvFrom), + "WSASYS_STATUS_LEN": ValueOf(syscall.WSASYS_STATUS_LEN), + "WSASend": ValueOf(syscall.WSASend), + "WSASendTo": ValueOf(syscall.WSASendTo), + "WSASendto": ValueOf(syscall.WSASendto), + "WSAStartup": ValueOf(syscall.WSAStartup), + "WaitForSingleObject": ValueOf(syscall.WaitForSingleObject), + "Write": ValueOf(syscall.Write), + "WriteConsole": ValueOf(syscall.WriteConsole), + "WriteFile": ValueOf(syscall.WriteFile), + "X509_ASN_ENCODING": ValueOf(syscall.X509_ASN_ENCODING), + "XP1_CONNECTIONLESS": ValueOf(syscall.XP1_CONNECTIONLESS), + "XP1_CONNECT_DATA": ValueOf(syscall.XP1_CONNECT_DATA), + "XP1_DISCONNECT_DATA": ValueOf(syscall.XP1_DISCONNECT_DATA), + "XP1_EXPEDITED_DATA": ValueOf(syscall.XP1_EXPEDITED_DATA), + "XP1_GRACEFUL_CLOSE": ValueOf(syscall.XP1_GRACEFUL_CLOSE), + "XP1_GUARANTEED_DELIVERY": ValueOf(syscall.XP1_GUARANTEED_DELIVERY), + "XP1_GUARANTEED_ORDER": ValueOf(syscall.XP1_GUARANTEED_ORDER), + "XP1_IFS_HANDLES": ValueOf(syscall.XP1_IFS_HANDLES), + "XP1_MESSAGE_ORIENTED": ValueOf(syscall.XP1_MESSAGE_ORIENTED), + "XP1_MULTIPOINT_CONTROL_PLANE": ValueOf(syscall.XP1_MULTIPOINT_CONTROL_PLANE), + "XP1_MULTIPOINT_DATA_PLANE": ValueOf(syscall.XP1_MULTIPOINT_DATA_PLANE), + "XP1_PARTIAL_MESSAGE": ValueOf(syscall.XP1_PARTIAL_MESSAGE), + "XP1_PSEUDO_STREAM": ValueOf(syscall.XP1_PSEUDO_STREAM), + "XP1_QOS_SUPPORTED": ValueOf(syscall.XP1_QOS_SUPPORTED), + "XP1_SAN_SUPPORT_SDP": ValueOf(syscall.XP1_SAN_SUPPORT_SDP), + "XP1_SUPPORT_BROADCAST": ValueOf(syscall.XP1_SUPPORT_BROADCAST), + "XP1_SUPPORT_MULTIPOINT": ValueOf(syscall.XP1_SUPPORT_MULTIPOINT), + "XP1_UNI_RECV": ValueOf(syscall.XP1_UNI_RECV), + "XP1_UNI_SEND": ValueOf(syscall.XP1_UNI_SEND), + }, + Types: map[string]Type{ + "AddrinfoW": TypeOf((*syscall.AddrinfoW)(nil)).Elem(), + "ByHandleFileInformation": TypeOf((*syscall.ByHandleFileInformation)(nil)).Elem(), + "CertChainContext": TypeOf((*syscall.CertChainContext)(nil)).Elem(), + "CertChainElement": TypeOf((*syscall.CertChainElement)(nil)).Elem(), + "CertChainPara": TypeOf((*syscall.CertChainPara)(nil)).Elem(), + "CertChainPolicyPara": TypeOf((*syscall.CertChainPolicyPara)(nil)).Elem(), + "CertChainPolicyStatus": TypeOf((*syscall.CertChainPolicyStatus)(nil)).Elem(), + "CertContext": TypeOf((*syscall.CertContext)(nil)).Elem(), + "CertEnhKeyUsage": TypeOf((*syscall.CertEnhKeyUsage)(nil)).Elem(), + "CertRevocationInfo": TypeOf((*syscall.CertRevocationInfo)(nil)).Elem(), + "CertSimpleChain": TypeOf((*syscall.CertSimpleChain)(nil)).Elem(), + "CertTrustStatus": TypeOf((*syscall.CertTrustStatus)(nil)).Elem(), + "CertUsageMatch": TypeOf((*syscall.CertUsageMatch)(nil)).Elem(), + "DLL": TypeOf((*syscall.DLL)(nil)).Elem(), + "DLLError": TypeOf((*syscall.DLLError)(nil)).Elem(), + "DNSMXData": TypeOf((*syscall.DNSMXData)(nil)).Elem(), + "DNSPTRData": TypeOf((*syscall.DNSPTRData)(nil)).Elem(), + "DNSRecord": TypeOf((*syscall.DNSRecord)(nil)).Elem(), + "DNSSRVData": TypeOf((*syscall.DNSSRVData)(nil)).Elem(), + "DNSTXTData": TypeOf((*syscall.DNSTXTData)(nil)).Elem(), + "Errno": TypeOf((*syscall.Errno)(nil)).Elem(), + "FileNotifyInformation": TypeOf((*syscall.FileNotifyInformation)(nil)).Elem(), + "Filetime": TypeOf((*syscall.Filetime)(nil)).Elem(), + "GUID": TypeOf((*syscall.GUID)(nil)).Elem(), + "Handle": TypeOf((*syscall.Handle)(nil)).Elem(), + "Hostent": TypeOf((*syscall.Hostent)(nil)).Elem(), + "IPMreq": TypeOf((*syscall.IPMreq)(nil)).Elem(), + "IPv6Mreq": TypeOf((*syscall.IPv6Mreq)(nil)).Elem(), + "InterfaceInfo": TypeOf((*syscall.InterfaceInfo)(nil)).Elem(), + "IpAdapterInfo": TypeOf((*syscall.IpAdapterInfo)(nil)).Elem(), + "IpAddrString": TypeOf((*syscall.IpAddrString)(nil)).Elem(), + "IpAddressString": TypeOf((*syscall.IpAddressString)(nil)).Elem(), + "IpMaskString": TypeOf((*syscall.IpMaskString)(nil)).Elem(), + "LazyDLL": TypeOf((*syscall.LazyDLL)(nil)).Elem(), + "LazyProc": TypeOf((*syscall.LazyProc)(nil)).Elem(), + "Linger": TypeOf((*syscall.Linger)(nil)).Elem(), + "MibIfRow": TypeOf((*syscall.MibIfRow)(nil)).Elem(), + "Overlapped": TypeOf((*syscall.Overlapped)(nil)).Elem(), + "Proc": TypeOf((*syscall.Proc)(nil)).Elem(), + "ProcAttr": TypeOf((*syscall.ProcAttr)(nil)).Elem(), + "ProcessEntry32": TypeOf((*syscall.ProcessEntry32)(nil)).Elem(), + "ProcessInformation": TypeOf((*syscall.ProcessInformation)(nil)).Elem(), + "Protoent": TypeOf((*syscall.Protoent)(nil)).Elem(), + "RawSockaddr": TypeOf((*syscall.RawSockaddr)(nil)).Elem(), + "RawSockaddrAny": TypeOf((*syscall.RawSockaddrAny)(nil)).Elem(), + "RawSockaddrInet4": TypeOf((*syscall.RawSockaddrInet4)(nil)).Elem(), + "RawSockaddrInet6": TypeOf((*syscall.RawSockaddrInet6)(nil)).Elem(), + "Rusage": TypeOf((*syscall.Rusage)(nil)).Elem(), + "SID": TypeOf((*syscall.SID)(nil)).Elem(), + "SIDAndAttributes": TypeOf((*syscall.SIDAndAttributes)(nil)).Elem(), + "SSLExtraCertChainPolicyPara": TypeOf((*syscall.SSLExtraCertChainPolicyPara)(nil)).Elem(), + "SecurityAttributes": TypeOf((*syscall.SecurityAttributes)(nil)).Elem(), + "Servent": TypeOf((*syscall.Servent)(nil)).Elem(), + "Signal": TypeOf((*syscall.Signal)(nil)).Elem(), + "Sockaddr": TypeOf((*syscall.Sockaddr)(nil)).Elem(), + "SockaddrGen": TypeOf((*syscall.SockaddrGen)(nil)).Elem(), + "SockaddrInet4": TypeOf((*syscall.SockaddrInet4)(nil)).Elem(), + "SockaddrInet6": TypeOf((*syscall.SockaddrInet6)(nil)).Elem(), + "SockaddrUnix": TypeOf((*syscall.SockaddrUnix)(nil)).Elem(), + "StartupInfo": TypeOf((*syscall.StartupInfo)(nil)).Elem(), + "SysProcAttr": TypeOf((*syscall.SysProcAttr)(nil)).Elem(), + "Systemtime": TypeOf((*syscall.Systemtime)(nil)).Elem(), + "TCPKeepalive": TypeOf((*syscall.TCPKeepalive)(nil)).Elem(), + "Timespec": TypeOf((*syscall.Timespec)(nil)).Elem(), + "Timeval": TypeOf((*syscall.Timeval)(nil)).Elem(), + "Timezoneinformation": TypeOf((*syscall.Timezoneinformation)(nil)).Elem(), + "Token": TypeOf((*syscall.Token)(nil)).Elem(), + "Tokenprimarygroup": TypeOf((*syscall.Tokenprimarygroup)(nil)).Elem(), + "Tokenuser": TypeOf((*syscall.Tokenuser)(nil)).Elem(), + "TransmitFileBuffers": TypeOf((*syscall.TransmitFileBuffers)(nil)).Elem(), + "UserInfo10": TypeOf((*syscall.UserInfo10)(nil)).Elem(), + "WSABuf": TypeOf((*syscall.WSABuf)(nil)).Elem(), + "WSAData": TypeOf((*syscall.WSAData)(nil)).Elem(), + "WSAProtocolChain": TypeOf((*syscall.WSAProtocolChain)(nil)).Elem(), + "WSAProtocolInfo": TypeOf((*syscall.WSAProtocolInfo)(nil)).Elem(), + "WaitStatus": TypeOf((*syscall.WaitStatus)(nil)).Elem(), + "Win32FileAttributeData": TypeOf((*syscall.Win32FileAttributeData)(nil)).Elem(), + "Win32finddata": TypeOf((*syscall.Win32finddata)(nil)).Elem(), + }, + Proxies: map[string]Type{ + } } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/testing.go b/vendor/github.com/cosmos72/gomacro/imports/testing.go new file mode 100644 index 0000000..2c37fb9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/testing.go @@ -0,0 +1,44 @@ +// this file was generated by gomacro command: import _b "testing" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "testing" +) + +// reflection: allow interpreted code to import "testing" +func init() { + Packages["testing"] = Package{ + Binds: map[string]Value{ + "AllocsPerRun": ValueOf(testing.AllocsPerRun), + "Benchmark": ValueOf(testing.Benchmark), + "CoverMode": ValueOf(testing.CoverMode), + "Coverage": ValueOf(testing.Coverage), + "Main": ValueOf(testing.Main), + "MainStart": ValueOf(testing.MainStart), + "RegisterCover": ValueOf(testing.RegisterCover), + "RunBenchmarks": ValueOf(testing.RunBenchmarks), + "RunExamples": ValueOf(testing.RunExamples), + "RunTests": ValueOf(testing.RunTests), + "Short": ValueOf(testing.Short), + "Verbose": ValueOf(testing.Verbose), + },Types: map[string]Type{ + "B": TypeOf((*testing.B)(nil)).Elem(), + "BenchmarkResult": TypeOf((*testing.BenchmarkResult)(nil)).Elem(), + "Cover": TypeOf((*testing.Cover)(nil)).Elem(), + "CoverBlock": TypeOf((*testing.CoverBlock)(nil)).Elem(), + "InternalBenchmark": TypeOf((*testing.InternalBenchmark)(nil)).Elem(), + "InternalExample": TypeOf((*testing.InternalExample)(nil)).Elem(), + "InternalTest": TypeOf((*testing.InternalTest)(nil)).Elem(), + "M": TypeOf((*testing.M)(nil)).Elem(), + "PB": TypeOf((*testing.PB)(nil)).Elem(), + "T": TypeOf((*testing.T)(nil)).Elem(), + "TB": TypeOf((*testing.TB)(nil)).Elem(), + },Wrappers: map[string][]string{ + "B": []string{"Error","Errorf","Fail","FailNow","Failed","Fatal","Fatalf","Log","Logf","Name","Skip","SkipNow","Skipf","Skipped",}, + "T": []string{"Error","Errorf","Fail","FailNow","Failed","Fatal","Fatalf","Log","Logf","Name","Skip","SkipNow","Skipf","Skipped",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/testing_iotest.go b/vendor/github.com/cosmos72/gomacro/imports/testing_iotest.go new file mode 100644 index 0000000..ac2a8aa --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/testing_iotest.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _b "testing/iotest" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "testing/iotest" +) + +// reflection: allow interpreted code to import "testing/iotest" +func init() { + Packages["testing/iotest"] = Package{ + Binds: map[string]Value{ + "DataErrReader": ValueOf(iotest.DataErrReader), + "ErrTimeout": ValueOf(&iotest.ErrTimeout).Elem(), + "HalfReader": ValueOf(iotest.HalfReader), + "NewReadLogger": ValueOf(iotest.NewReadLogger), + "NewWriteLogger": ValueOf(iotest.NewWriteLogger), + "OneByteReader": ValueOf(iotest.OneByteReader), + "TimeoutReader": ValueOf(iotest.TimeoutReader), + "TruncateWriter": ValueOf(iotest.TruncateWriter), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/testing_quick.go b/vendor/github.com/cosmos72/gomacro/imports/testing_quick.go new file mode 100644 index 0000000..a3c5fd2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/testing_quick.go @@ -0,0 +1,39 @@ +// this file was generated by gomacro command: import _b "testing/quick" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "math/rand" + "reflect" + "testing/quick" +) + +// reflection: allow interpreted code to import "testing/quick" +func init() { + Packages["testing/quick"] = Package{ + Binds: map[string]Value{ + "Check": ValueOf(quick.Check), + "CheckEqual": ValueOf(quick.CheckEqual), + "Value": ValueOf(quick.Value), + },Types: map[string]Type{ + "CheckEqualError": TypeOf((*quick.CheckEqualError)(nil)).Elem(), + "CheckError": TypeOf((*quick.CheckError)(nil)).Elem(), + "Config": TypeOf((*quick.Config)(nil)).Elem(), + "Generator": TypeOf((*quick.Generator)(nil)).Elem(), + "SetupError": TypeOf((*quick.SetupError)(nil)).Elem(), + },Proxies: map[string]Type{ + "Generator": TypeOf((*Generator_testing_quick)(nil)).Elem(), + }, + } +} + +// --------------- proxy for testing/quick.Generator --------------- +type Generator_testing_quick struct { + Object interface{} + Generate_ func(_proxy_obj_ interface{}, rand *rand.Rand, size int) reflect.Value +} +func (Proxy *Generator_testing_quick) Generate(rand *rand.Rand, size int) reflect.Value { + return Proxy.Generate_(Proxy.Object, rand, size) +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/text_scanner.go b/vendor/github.com/cosmos72/gomacro/imports/text_scanner.go new file mode 100644 index 0000000..7fe1419 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/text_scanner.go @@ -0,0 +1,60 @@ +// this file was generated by gomacro command: import _b "text/scanner" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "text/scanner" +) + +// reflection: allow interpreted code to import "text/scanner" +func init() { + Packages["text/scanner"] = Package{ + Binds: map[string]Value{ + "Char": ValueOf(scanner.Char), + "Comment": ValueOf(scanner.Comment), + "EOF": ValueOf(scanner.EOF), + "Float": ValueOf(scanner.Float), + "GoTokens": ValueOf(scanner.GoTokens), + "GoWhitespace": ValueOf(int64(scanner.GoWhitespace)), + "Ident": ValueOf(scanner.Ident), + "Int": ValueOf(scanner.Int), + "RawString": ValueOf(scanner.RawString), + "ScanChars": ValueOf(scanner.ScanChars), + "ScanComments": ValueOf(scanner.ScanComments), + "ScanFloats": ValueOf(scanner.ScanFloats), + "ScanIdents": ValueOf(scanner.ScanIdents), + "ScanInts": ValueOf(scanner.ScanInts), + "ScanRawStrings": ValueOf(scanner.ScanRawStrings), + "ScanStrings": ValueOf(scanner.ScanStrings), + "SkipComments": ValueOf(scanner.SkipComments), + "String": ValueOf(scanner.String), + "TokenString": ValueOf(scanner.TokenString), + },Types: map[string]Type{ + "Position": TypeOf((*scanner.Position)(nil)).Elem(), + "Scanner": TypeOf((*scanner.Scanner)(nil)).Elem(), + },Untypeds: map[string]string{ + "Char": "int:-5", + "Comment": "int:-8", + "EOF": "int:-1", + "Float": "int:-4", + "GoTokens": "int:1012", + "GoWhitespace": "int:4294977024", + "Ident": "int:-2", + "Int": "int:-3", + "RawString": "int:-7", + "ScanChars": "int:32", + "ScanComments": "int:256", + "ScanFloats": "int:16", + "ScanIdents": "int:4", + "ScanInts": "int:8", + "ScanRawStrings": "int:128", + "ScanStrings": "int:64", + "SkipComments": "int:512", + "String": "int:-6", + },Wrappers: map[string][]string{ + "Scanner": []string{"IsValid","String",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/text_tabwriter.go b/vendor/github.com/cosmos72/gomacro/imports/text_tabwriter.go new file mode 100644 index 0000000..623fa81 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/text_tabwriter.go @@ -0,0 +1,29 @@ +// this file was generated by gomacro command: import _b "text/tabwriter" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "text/tabwriter" +) + +// reflection: allow interpreted code to import "text/tabwriter" +func init() { + Packages["text/tabwriter"] = Package{ + Binds: map[string]Value{ + "AlignRight": ValueOf(tabwriter.AlignRight), + "Debug": ValueOf(tabwriter.Debug), + "DiscardEmptyColumns": ValueOf(tabwriter.DiscardEmptyColumns), + "Escape": ValueOf(tabwriter.Escape), + "FilterHTML": ValueOf(tabwriter.FilterHTML), + "NewWriter": ValueOf(tabwriter.NewWriter), + "StripEscape": ValueOf(tabwriter.StripEscape), + "TabIndent": ValueOf(tabwriter.TabIndent), + },Types: map[string]Type{ + "Writer": TypeOf((*tabwriter.Writer)(nil)).Elem(), + },Untypeds: map[string]string{ + "Escape": "rune:255", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/text_template.go b/vendor/github.com/cosmos72/gomacro/imports/text_template.go new file mode 100644 index 0000000..6d9324a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/text_template.go @@ -0,0 +1,35 @@ +// this file was generated by gomacro command: import _b "text/template" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "text/template" +) + +// reflection: allow interpreted code to import "text/template" +func init() { + Packages["text/template"] = Package{ + Binds: map[string]Value{ + "HTMLEscape": ValueOf(template.HTMLEscape), + "HTMLEscapeString": ValueOf(template.HTMLEscapeString), + "HTMLEscaper": ValueOf(template.HTMLEscaper), + "IsTrue": ValueOf(template.IsTrue), + "JSEscape": ValueOf(template.JSEscape), + "JSEscapeString": ValueOf(template.JSEscapeString), + "JSEscaper": ValueOf(template.JSEscaper), + "Must": ValueOf(template.Must), + "New": ValueOf(template.New), + "ParseFiles": ValueOf(template.ParseFiles), + "ParseGlob": ValueOf(template.ParseGlob), + "URLQueryEscaper": ValueOf(template.URLQueryEscaper), + },Types: map[string]Type{ + "ExecError": TypeOf((*template.ExecError)(nil)).Elem(), + "FuncMap": TypeOf((*template.FuncMap)(nil)).Elem(), + "Template": TypeOf((*template.Template)(nil)).Elem(), + },Wrappers: map[string][]string{ + "Template": []string{"Copy","ErrorContext",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/text_template_parse.go b/vendor/github.com/cosmos72/gomacro/imports/text_template_parse.go new file mode 100644 index 0000000..f604512 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/text_template_parse.go @@ -0,0 +1,83 @@ +// this file was generated by gomacro command: import _b "text/template/parse" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "text/template/parse" +) + +// reflection: allow interpreted code to import "text/template/parse" +func init() { + Packages["text/template/parse"] = Package{ + Binds: map[string]Value{ + "IsEmptyTree": ValueOf(parse.IsEmptyTree), + "New": ValueOf(parse.New), + "NewIdentifier": ValueOf(parse.NewIdentifier), + "NodeAction": ValueOf(parse.NodeAction), + "NodeBool": ValueOf(parse.NodeBool), + "NodeChain": ValueOf(parse.NodeChain), + "NodeCommand": ValueOf(parse.NodeCommand), + "NodeDot": ValueOf(parse.NodeDot), + "NodeField": ValueOf(parse.NodeField), + "NodeIdentifier": ValueOf(parse.NodeIdentifier), + "NodeIf": ValueOf(parse.NodeIf), + "NodeList": ValueOf(parse.NodeList), + "NodeNil": ValueOf(parse.NodeNil), + "NodeNumber": ValueOf(parse.NodeNumber), + "NodePipe": ValueOf(parse.NodePipe), + "NodeRange": ValueOf(parse.NodeRange), + "NodeString": ValueOf(parse.NodeString), + "NodeTemplate": ValueOf(parse.NodeTemplate), + "NodeText": ValueOf(parse.NodeText), + "NodeVariable": ValueOf(parse.NodeVariable), + "NodeWith": ValueOf(parse.NodeWith), + "Parse": ValueOf(parse.Parse), + },Types: map[string]Type{ + "ActionNode": TypeOf((*parse.ActionNode)(nil)).Elem(), + "BoolNode": TypeOf((*parse.BoolNode)(nil)).Elem(), + "BranchNode": TypeOf((*parse.BranchNode)(nil)).Elem(), + "ChainNode": TypeOf((*parse.ChainNode)(nil)).Elem(), + "CommandNode": TypeOf((*parse.CommandNode)(nil)).Elem(), + "DotNode": TypeOf((*parse.DotNode)(nil)).Elem(), + "FieldNode": TypeOf((*parse.FieldNode)(nil)).Elem(), + "IdentifierNode": TypeOf((*parse.IdentifierNode)(nil)).Elem(), + "IfNode": TypeOf((*parse.IfNode)(nil)).Elem(), + "ListNode": TypeOf((*parse.ListNode)(nil)).Elem(), + "NilNode": TypeOf((*parse.NilNode)(nil)).Elem(), + "Node": TypeOf((*parse.Node)(nil)).Elem(), + "NodeType": TypeOf((*parse.NodeType)(nil)).Elem(), + "NumberNode": TypeOf((*parse.NumberNode)(nil)).Elem(), + "PipeNode": TypeOf((*parse.PipeNode)(nil)).Elem(), + "Pos": TypeOf((*parse.Pos)(nil)).Elem(), + "RangeNode": TypeOf((*parse.RangeNode)(nil)).Elem(), + "StringNode": TypeOf((*parse.StringNode)(nil)).Elem(), + "TemplateNode": TypeOf((*parse.TemplateNode)(nil)).Elem(), + "TextNode": TypeOf((*parse.TextNode)(nil)).Elem(), + "Tree": TypeOf((*parse.Tree)(nil)).Elem(), + "VariableNode": TypeOf((*parse.VariableNode)(nil)).Elem(), + "WithNode": TypeOf((*parse.WithNode)(nil)).Elem(), + },Wrappers: map[string][]string{ + "ActionNode": []string{"Position","Type",}, + "BoolNode": []string{"Position","Type",}, + "BranchNode": []string{"Position","Type",}, + "ChainNode": []string{"Position","Type",}, + "CommandNode": []string{"Position","Type",}, + "DotNode": []string{"Position",}, + "FieldNode": []string{"Position","Type",}, + "IdentifierNode": []string{"Position","Type",}, + "IfNode": []string{"Position","String","Type",}, + "ListNode": []string{"Position","Type",}, + "NilNode": []string{"Position",}, + "NumberNode": []string{"Position","Type",}, + "PipeNode": []string{"Position","Type",}, + "RangeNode": []string{"Position","String","Type",}, + "StringNode": []string{"Position","Type",}, + "TemplateNode": []string{"Position","Type",}, + "TextNode": []string{"Position","Type",}, + "VariableNode": []string{"Position","Type",}, + "WithNode": []string{"Position","String","Type",}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/time.go b/vendor/github.com/cosmos72/gomacro/imports/time.go new file mode 100644 index 0000000..0c24cc2 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/time.go @@ -0,0 +1,100 @@ +// this file was generated by gomacro command: import _b "time" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "time" +) + +// reflection: allow interpreted code to import "time" +func init() { + Packages["time"] = Package{ + Binds: map[string]Value{ + "ANSIC": ValueOf(time.ANSIC), + "After": ValueOf(time.After), + "AfterFunc": ValueOf(time.AfterFunc), + "April": ValueOf(time.April), + "August": ValueOf(time.August), + "Date": ValueOf(time.Date), + "December": ValueOf(time.December), + "February": ValueOf(time.February), + "FixedZone": ValueOf(time.FixedZone), + "Friday": ValueOf(time.Friday), + "Hour": ValueOf(time.Hour), + "January": ValueOf(time.January), + "July": ValueOf(time.July), + "June": ValueOf(time.June), + "Kitchen": ValueOf(time.Kitchen), + "LoadLocation": ValueOf(time.LoadLocation), + "Local": ValueOf(&time.Local).Elem(), + "March": ValueOf(time.March), + "May": ValueOf(time.May), + "Microsecond": ValueOf(time.Microsecond), + "Millisecond": ValueOf(time.Millisecond), + "Minute": ValueOf(time.Minute), + "Monday": ValueOf(time.Monday), + "Nanosecond": ValueOf(time.Nanosecond), + "NewTicker": ValueOf(time.NewTicker), + "NewTimer": ValueOf(time.NewTimer), + "November": ValueOf(time.November), + "Now": ValueOf(time.Now), + "October": ValueOf(time.October), + "Parse": ValueOf(time.Parse), + "ParseDuration": ValueOf(time.ParseDuration), + "ParseInLocation": ValueOf(time.ParseInLocation), + "RFC1123": ValueOf(time.RFC1123), + "RFC1123Z": ValueOf(time.RFC1123Z), + "RFC3339": ValueOf(time.RFC3339), + "RFC3339Nano": ValueOf(time.RFC3339Nano), + "RFC822": ValueOf(time.RFC822), + "RFC822Z": ValueOf(time.RFC822Z), + "RFC850": ValueOf(time.RFC850), + "RubyDate": ValueOf(time.RubyDate), + "Saturday": ValueOf(time.Saturday), + "Second": ValueOf(time.Second), + "September": ValueOf(time.September), + "Since": ValueOf(time.Since), + "Sleep": ValueOf(time.Sleep), + "Stamp": ValueOf(time.Stamp), + "StampMicro": ValueOf(time.StampMicro), + "StampMilli": ValueOf(time.StampMilli), + "StampNano": ValueOf(time.StampNano), + "Sunday": ValueOf(time.Sunday), + "Thursday": ValueOf(time.Thursday), + "Tick": ValueOf(time.Tick), + "Tuesday": ValueOf(time.Tuesday), + "UTC": ValueOf(&time.UTC).Elem(), + "Unix": ValueOf(time.Unix), + "UnixDate": ValueOf(time.UnixDate), + "Until": ValueOf(time.Until), + "Wednesday": ValueOf(time.Wednesday), + },Types: map[string]Type{ + "Duration": TypeOf((*time.Duration)(nil)).Elem(), + "Location": TypeOf((*time.Location)(nil)).Elem(), + "Month": TypeOf((*time.Month)(nil)).Elem(), + "ParseError": TypeOf((*time.ParseError)(nil)).Elem(), + "Ticker": TypeOf((*time.Ticker)(nil)).Elem(), + "Time": TypeOf((*time.Time)(nil)).Elem(), + "Timer": TypeOf((*time.Timer)(nil)).Elem(), + "Weekday": TypeOf((*time.Weekday)(nil)).Elem(), + },Untypeds: map[string]string{ + "ANSIC": "string:Mon Jan _2 15:04:05 2006", + "Kitchen": "string:3:04PM", + "RFC1123": "string:Mon, 02 Jan 2006 15:04:05 MST", + "RFC1123Z": "string:Mon, 02 Jan 2006 15:04:05 -0700", + "RFC3339": "string:2006-01-02T15:04:05Z07:00", + "RFC3339Nano": "string:2006-01-02T15:04:05.999999999Z07:00", + "RFC822": "string:02 Jan 06 15:04 MST", + "RFC822Z": "string:02 Jan 06 15:04 -0700", + "RFC850": "string:Monday, 02-Jan-06 15:04:05 MST", + "RubyDate": "string:Mon Jan 02 15:04:05 -0700 2006", + "Stamp": "string:Jan _2 15:04:05", + "StampMicro": "string:Jan _2 15:04:05.000000", + "StampMilli": "string:Jan _2 15:04:05.000", + "StampNano": "string:Jan _2 15:04:05.000000000", + "UnixDate": "string:Mon Jan _2 15:04:05 MST 2006", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/unicode.go b/vendor/github.com/cosmos72/gomacro/imports/unicode.go new file mode 100644 index 0000000..c41b77f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/unicode.go @@ -0,0 +1,293 @@ +// this file was generated by gomacro command: import _b "unicode" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "unicode" +) + +// reflection: allow interpreted code to import "unicode" +func init() { + Packages["unicode"] = Package{ + Binds: map[string]Value{ + "ASCII_Hex_Digit": ValueOf(&unicode.ASCII_Hex_Digit).Elem(), + "Adlam": ValueOf(&unicode.Adlam).Elem(), + "Ahom": ValueOf(&unicode.Ahom).Elem(), + "Anatolian_Hieroglyphs": ValueOf(&unicode.Anatolian_Hieroglyphs).Elem(), + "Arabic": ValueOf(&unicode.Arabic).Elem(), + "Armenian": ValueOf(&unicode.Armenian).Elem(), + "Avestan": ValueOf(&unicode.Avestan).Elem(), + "AzeriCase": ValueOf(&unicode.AzeriCase).Elem(), + "Balinese": ValueOf(&unicode.Balinese).Elem(), + "Bamum": ValueOf(&unicode.Bamum).Elem(), + "Bassa_Vah": ValueOf(&unicode.Bassa_Vah).Elem(), + "Batak": ValueOf(&unicode.Batak).Elem(), + "Bengali": ValueOf(&unicode.Bengali).Elem(), + "Bhaiksuki": ValueOf(&unicode.Bhaiksuki).Elem(), + "Bidi_Control": ValueOf(&unicode.Bidi_Control).Elem(), + "Bopomofo": ValueOf(&unicode.Bopomofo).Elem(), + "Brahmi": ValueOf(&unicode.Brahmi).Elem(), + "Braille": ValueOf(&unicode.Braille).Elem(), + "Buginese": ValueOf(&unicode.Buginese).Elem(), + "Buhid": ValueOf(&unicode.Buhid).Elem(), + "C": ValueOf(&unicode.C).Elem(), + "Canadian_Aboriginal": ValueOf(&unicode.Canadian_Aboriginal).Elem(), + "Carian": ValueOf(&unicode.Carian).Elem(), + "CaseRanges": ValueOf(&unicode.CaseRanges).Elem(), + "Categories": ValueOf(&unicode.Categories).Elem(), + "Caucasian_Albanian": ValueOf(&unicode.Caucasian_Albanian).Elem(), + "Cc": ValueOf(&unicode.Cc).Elem(), + "Cf": ValueOf(&unicode.Cf).Elem(), + "Chakma": ValueOf(&unicode.Chakma).Elem(), + "Cham": ValueOf(&unicode.Cham).Elem(), + "Cherokee": ValueOf(&unicode.Cherokee).Elem(), + "Co": ValueOf(&unicode.Co).Elem(), + "Common": ValueOf(&unicode.Common).Elem(), + "Coptic": ValueOf(&unicode.Coptic).Elem(), + "Cs": ValueOf(&unicode.Cs).Elem(), + "Cuneiform": ValueOf(&unicode.Cuneiform).Elem(), + "Cypriot": ValueOf(&unicode.Cypriot).Elem(), + "Cyrillic": ValueOf(&unicode.Cyrillic).Elem(), + "Dash": ValueOf(&unicode.Dash).Elem(), + "Deprecated": ValueOf(&unicode.Deprecated).Elem(), + "Deseret": ValueOf(&unicode.Deseret).Elem(), + "Devanagari": ValueOf(&unicode.Devanagari).Elem(), + "Diacritic": ValueOf(&unicode.Diacritic).Elem(), + "Digit": ValueOf(&unicode.Digit).Elem(), + "Duployan": ValueOf(&unicode.Duployan).Elem(), + "Egyptian_Hieroglyphs": ValueOf(&unicode.Egyptian_Hieroglyphs).Elem(), + "Elbasan": ValueOf(&unicode.Elbasan).Elem(), + "Ethiopic": ValueOf(&unicode.Ethiopic).Elem(), + "Extender": ValueOf(&unicode.Extender).Elem(), + "FoldCategory": ValueOf(&unicode.FoldCategory).Elem(), + "FoldScript": ValueOf(&unicode.FoldScript).Elem(), + "Georgian": ValueOf(&unicode.Georgian).Elem(), + "Glagolitic": ValueOf(&unicode.Glagolitic).Elem(), + "Gothic": ValueOf(&unicode.Gothic).Elem(), + "Grantha": ValueOf(&unicode.Grantha).Elem(), + "GraphicRanges": ValueOf(&unicode.GraphicRanges).Elem(), + "Greek": ValueOf(&unicode.Greek).Elem(), + "Gujarati": ValueOf(&unicode.Gujarati).Elem(), + "Gurmukhi": ValueOf(&unicode.Gurmukhi).Elem(), + "Han": ValueOf(&unicode.Han).Elem(), + "Hangul": ValueOf(&unicode.Hangul).Elem(), + "Hanunoo": ValueOf(&unicode.Hanunoo).Elem(), + "Hatran": ValueOf(&unicode.Hatran).Elem(), + "Hebrew": ValueOf(&unicode.Hebrew).Elem(), + "Hex_Digit": ValueOf(&unicode.Hex_Digit).Elem(), + "Hiragana": ValueOf(&unicode.Hiragana).Elem(), + "Hyphen": ValueOf(&unicode.Hyphen).Elem(), + "IDS_Binary_Operator": ValueOf(&unicode.IDS_Binary_Operator).Elem(), + "IDS_Trinary_Operator": ValueOf(&unicode.IDS_Trinary_Operator).Elem(), + "Ideographic": ValueOf(&unicode.Ideographic).Elem(), + "Imperial_Aramaic": ValueOf(&unicode.Imperial_Aramaic).Elem(), + "In": ValueOf(unicode.In), + "Inherited": ValueOf(&unicode.Inherited).Elem(), + "Inscriptional_Pahlavi": ValueOf(&unicode.Inscriptional_Pahlavi).Elem(), + "Inscriptional_Parthian": ValueOf(&unicode.Inscriptional_Parthian).Elem(), + "Is": ValueOf(unicode.Is), + "IsControl": ValueOf(unicode.IsControl), + "IsDigit": ValueOf(unicode.IsDigit), + "IsGraphic": ValueOf(unicode.IsGraphic), + "IsLetter": ValueOf(unicode.IsLetter), + "IsLower": ValueOf(unicode.IsLower), + "IsMark": ValueOf(unicode.IsMark), + "IsNumber": ValueOf(unicode.IsNumber), + "IsOneOf": ValueOf(unicode.IsOneOf), + "IsPrint": ValueOf(unicode.IsPrint), + "IsPunct": ValueOf(unicode.IsPunct), + "IsSpace": ValueOf(unicode.IsSpace), + "IsSymbol": ValueOf(unicode.IsSymbol), + "IsTitle": ValueOf(unicode.IsTitle), + "IsUpper": ValueOf(unicode.IsUpper), + "Javanese": ValueOf(&unicode.Javanese).Elem(), + "Join_Control": ValueOf(&unicode.Join_Control).Elem(), + "Kaithi": ValueOf(&unicode.Kaithi).Elem(), + "Kannada": ValueOf(&unicode.Kannada).Elem(), + "Katakana": ValueOf(&unicode.Katakana).Elem(), + "Kayah_Li": ValueOf(&unicode.Kayah_Li).Elem(), + "Kharoshthi": ValueOf(&unicode.Kharoshthi).Elem(), + "Khmer": ValueOf(&unicode.Khmer).Elem(), + "Khojki": ValueOf(&unicode.Khojki).Elem(), + "Khudawadi": ValueOf(&unicode.Khudawadi).Elem(), + "L": ValueOf(&unicode.L).Elem(), + "Lao": ValueOf(&unicode.Lao).Elem(), + "Latin": ValueOf(&unicode.Latin).Elem(), + "Lepcha": ValueOf(&unicode.Lepcha).Elem(), + "Letter": ValueOf(&unicode.Letter).Elem(), + "Limbu": ValueOf(&unicode.Limbu).Elem(), + "Linear_A": ValueOf(&unicode.Linear_A).Elem(), + "Linear_B": ValueOf(&unicode.Linear_B).Elem(), + "Lisu": ValueOf(&unicode.Lisu).Elem(), + "Ll": ValueOf(&unicode.Ll).Elem(), + "Lm": ValueOf(&unicode.Lm).Elem(), + "Lo": ValueOf(&unicode.Lo).Elem(), + "Logical_Order_Exception": ValueOf(&unicode.Logical_Order_Exception).Elem(), + "Lower": ValueOf(&unicode.Lower).Elem(), + "LowerCase": ValueOf(unicode.LowerCase), + "Lt": ValueOf(&unicode.Lt).Elem(), + "Lu": ValueOf(&unicode.Lu).Elem(), + "Lycian": ValueOf(&unicode.Lycian).Elem(), + "Lydian": ValueOf(&unicode.Lydian).Elem(), + "M": ValueOf(&unicode.M).Elem(), + "Mahajani": ValueOf(&unicode.Mahajani).Elem(), + "Malayalam": ValueOf(&unicode.Malayalam).Elem(), + "Mandaic": ValueOf(&unicode.Mandaic).Elem(), + "Manichaean": ValueOf(&unicode.Manichaean).Elem(), + "Marchen": ValueOf(&unicode.Marchen).Elem(), + "Mark": ValueOf(&unicode.Mark).Elem(), + "MaxASCII": ValueOf(unicode.MaxASCII), + "MaxCase": ValueOf(unicode.MaxCase), + "MaxLatin1": ValueOf(unicode.MaxLatin1), + "MaxRune": ValueOf(unicode.MaxRune), + "Mc": ValueOf(&unicode.Mc).Elem(), + "Me": ValueOf(&unicode.Me).Elem(), + "Meetei_Mayek": ValueOf(&unicode.Meetei_Mayek).Elem(), + "Mende_Kikakui": ValueOf(&unicode.Mende_Kikakui).Elem(), + "Meroitic_Cursive": ValueOf(&unicode.Meroitic_Cursive).Elem(), + "Meroitic_Hieroglyphs": ValueOf(&unicode.Meroitic_Hieroglyphs).Elem(), + "Miao": ValueOf(&unicode.Miao).Elem(), + "Mn": ValueOf(&unicode.Mn).Elem(), + "Modi": ValueOf(&unicode.Modi).Elem(), + "Mongolian": ValueOf(&unicode.Mongolian).Elem(), + "Mro": ValueOf(&unicode.Mro).Elem(), + "Multani": ValueOf(&unicode.Multani).Elem(), + "Myanmar": ValueOf(&unicode.Myanmar).Elem(), + "N": ValueOf(&unicode.N).Elem(), + "Nabataean": ValueOf(&unicode.Nabataean).Elem(), + "Nd": ValueOf(&unicode.Nd).Elem(), + "New_Tai_Lue": ValueOf(&unicode.New_Tai_Lue).Elem(), + "Newa": ValueOf(&unicode.Newa).Elem(), + "Nko": ValueOf(&unicode.Nko).Elem(), + "Nl": ValueOf(&unicode.Nl).Elem(), + "No": ValueOf(&unicode.No).Elem(), + "Noncharacter_Code_Point": ValueOf(&unicode.Noncharacter_Code_Point).Elem(), + "Number": ValueOf(&unicode.Number).Elem(), + "Ogham": ValueOf(&unicode.Ogham).Elem(), + "Ol_Chiki": ValueOf(&unicode.Ol_Chiki).Elem(), + "Old_Hungarian": ValueOf(&unicode.Old_Hungarian).Elem(), + "Old_Italic": ValueOf(&unicode.Old_Italic).Elem(), + "Old_North_Arabian": ValueOf(&unicode.Old_North_Arabian).Elem(), + "Old_Permic": ValueOf(&unicode.Old_Permic).Elem(), + "Old_Persian": ValueOf(&unicode.Old_Persian).Elem(), + "Old_South_Arabian": ValueOf(&unicode.Old_South_Arabian).Elem(), + "Old_Turkic": ValueOf(&unicode.Old_Turkic).Elem(), + "Oriya": ValueOf(&unicode.Oriya).Elem(), + "Osage": ValueOf(&unicode.Osage).Elem(), + "Osmanya": ValueOf(&unicode.Osmanya).Elem(), + "Other": ValueOf(&unicode.Other).Elem(), + "Other_Alphabetic": ValueOf(&unicode.Other_Alphabetic).Elem(), + "Other_Default_Ignorable_Code_Point": ValueOf(&unicode.Other_Default_Ignorable_Code_Point).Elem(), + "Other_Grapheme_Extend": ValueOf(&unicode.Other_Grapheme_Extend).Elem(), + "Other_ID_Continue": ValueOf(&unicode.Other_ID_Continue).Elem(), + "Other_ID_Start": ValueOf(&unicode.Other_ID_Start).Elem(), + "Other_Lowercase": ValueOf(&unicode.Other_Lowercase).Elem(), + "Other_Math": ValueOf(&unicode.Other_Math).Elem(), + "Other_Uppercase": ValueOf(&unicode.Other_Uppercase).Elem(), + "P": ValueOf(&unicode.P).Elem(), + "Pahawh_Hmong": ValueOf(&unicode.Pahawh_Hmong).Elem(), + "Palmyrene": ValueOf(&unicode.Palmyrene).Elem(), + "Pattern_Syntax": ValueOf(&unicode.Pattern_Syntax).Elem(), + "Pattern_White_Space": ValueOf(&unicode.Pattern_White_Space).Elem(), + "Pau_Cin_Hau": ValueOf(&unicode.Pau_Cin_Hau).Elem(), + "Pc": ValueOf(&unicode.Pc).Elem(), + "Pd": ValueOf(&unicode.Pd).Elem(), + "Pe": ValueOf(&unicode.Pe).Elem(), + "Pf": ValueOf(&unicode.Pf).Elem(), + "Phags_Pa": ValueOf(&unicode.Phags_Pa).Elem(), + "Phoenician": ValueOf(&unicode.Phoenician).Elem(), + "Pi": ValueOf(&unicode.Pi).Elem(), + "Po": ValueOf(&unicode.Po).Elem(), + "Prepended_Concatenation_Mark": ValueOf(&unicode.Prepended_Concatenation_Mark).Elem(), + "PrintRanges": ValueOf(&unicode.PrintRanges).Elem(), + "Properties": ValueOf(&unicode.Properties).Elem(), + "Ps": ValueOf(&unicode.Ps).Elem(), + "Psalter_Pahlavi": ValueOf(&unicode.Psalter_Pahlavi).Elem(), + "Punct": ValueOf(&unicode.Punct).Elem(), + "Quotation_Mark": ValueOf(&unicode.Quotation_Mark).Elem(), + "Radical": ValueOf(&unicode.Radical).Elem(), + "Rejang": ValueOf(&unicode.Rejang).Elem(), + "ReplacementChar": ValueOf(unicode.ReplacementChar), + "Runic": ValueOf(&unicode.Runic).Elem(), + "S": ValueOf(&unicode.S).Elem(), + "STerm": ValueOf(&unicode.STerm).Elem(), + "Samaritan": ValueOf(&unicode.Samaritan).Elem(), + "Saurashtra": ValueOf(&unicode.Saurashtra).Elem(), + "Sc": ValueOf(&unicode.Sc).Elem(), + "Scripts": ValueOf(&unicode.Scripts).Elem(), + "Sentence_Terminal": ValueOf(&unicode.Sentence_Terminal).Elem(), + "Sharada": ValueOf(&unicode.Sharada).Elem(), + "Shavian": ValueOf(&unicode.Shavian).Elem(), + "Siddham": ValueOf(&unicode.Siddham).Elem(), + "SignWriting": ValueOf(&unicode.SignWriting).Elem(), + "SimpleFold": ValueOf(unicode.SimpleFold), + "Sinhala": ValueOf(&unicode.Sinhala).Elem(), + "Sk": ValueOf(&unicode.Sk).Elem(), + "Sm": ValueOf(&unicode.Sm).Elem(), + "So": ValueOf(&unicode.So).Elem(), + "Soft_Dotted": ValueOf(&unicode.Soft_Dotted).Elem(), + "Sora_Sompeng": ValueOf(&unicode.Sora_Sompeng).Elem(), + "Space": ValueOf(&unicode.Space).Elem(), + "Sundanese": ValueOf(&unicode.Sundanese).Elem(), + "Syloti_Nagri": ValueOf(&unicode.Syloti_Nagri).Elem(), + "Symbol": ValueOf(&unicode.Symbol).Elem(), + "Syriac": ValueOf(&unicode.Syriac).Elem(), + "Tagalog": ValueOf(&unicode.Tagalog).Elem(), + "Tagbanwa": ValueOf(&unicode.Tagbanwa).Elem(), + "Tai_Le": ValueOf(&unicode.Tai_Le).Elem(), + "Tai_Tham": ValueOf(&unicode.Tai_Tham).Elem(), + "Tai_Viet": ValueOf(&unicode.Tai_Viet).Elem(), + "Takri": ValueOf(&unicode.Takri).Elem(), + "Tamil": ValueOf(&unicode.Tamil).Elem(), + "Tangut": ValueOf(&unicode.Tangut).Elem(), + "Telugu": ValueOf(&unicode.Telugu).Elem(), + "Terminal_Punctuation": ValueOf(&unicode.Terminal_Punctuation).Elem(), + "Thaana": ValueOf(&unicode.Thaana).Elem(), + "Thai": ValueOf(&unicode.Thai).Elem(), + "Tibetan": ValueOf(&unicode.Tibetan).Elem(), + "Tifinagh": ValueOf(&unicode.Tifinagh).Elem(), + "Tirhuta": ValueOf(&unicode.Tirhuta).Elem(), + "Title": ValueOf(&unicode.Title).Elem(), + "TitleCase": ValueOf(unicode.TitleCase), + "To": ValueOf(unicode.To), + "ToLower": ValueOf(unicode.ToLower), + "ToTitle": ValueOf(unicode.ToTitle), + "ToUpper": ValueOf(unicode.ToUpper), + "TurkishCase": ValueOf(&unicode.TurkishCase).Elem(), + "Ugaritic": ValueOf(&unicode.Ugaritic).Elem(), + "Unified_Ideograph": ValueOf(&unicode.Unified_Ideograph).Elem(), + "Upper": ValueOf(&unicode.Upper).Elem(), + "UpperCase": ValueOf(unicode.UpperCase), + "UpperLower": ValueOf(unicode.UpperLower), + "Vai": ValueOf(&unicode.Vai).Elem(), + "Variation_Selector": ValueOf(&unicode.Variation_Selector).Elem(), + "Version": ValueOf(unicode.Version), + "Warang_Citi": ValueOf(&unicode.Warang_Citi).Elem(), + "White_Space": ValueOf(&unicode.White_Space).Elem(), + "Yi": ValueOf(&unicode.Yi).Elem(), + "Z": ValueOf(&unicode.Z).Elem(), + "Zl": ValueOf(&unicode.Zl).Elem(), + "Zp": ValueOf(&unicode.Zp).Elem(), + "Zs": ValueOf(&unicode.Zs).Elem(), + },Types: map[string]Type{ + "CaseRange": TypeOf((*unicode.CaseRange)(nil)).Elem(), + "Range16": TypeOf((*unicode.Range16)(nil)).Elem(), + "Range32": TypeOf((*unicode.Range32)(nil)).Elem(), + "RangeTable": TypeOf((*unicode.RangeTable)(nil)).Elem(), + "SpecialCase": TypeOf((*unicode.SpecialCase)(nil)).Elem(), + },Untypeds: map[string]string{ + "LowerCase": "int:1", + "MaxASCII": "rune:127", + "MaxCase": "int:3", + "MaxLatin1": "rune:255", + "MaxRune": "rune:1114111", + "ReplacementChar": "rune:65533", + "TitleCase": "int:2", + "UpperCase": "int:0", + "UpperLower": "rune:1114112", + "Version": "string:9.0.0", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/unicode_utf16.go b/vendor/github.com/cosmos72/gomacro/imports/unicode_utf16.go new file mode 100644 index 0000000..cb10290 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/unicode_utf16.go @@ -0,0 +1,22 @@ +// this file was generated by gomacro command: import _b "unicode/utf16" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "unicode/utf16" +) + +// reflection: allow interpreted code to import "unicode/utf16" +func init() { + Packages["unicode/utf16"] = Package{ + Binds: map[string]Value{ + "Decode": ValueOf(utf16.Decode), + "DecodeRune": ValueOf(utf16.DecodeRune), + "Encode": ValueOf(utf16.Encode), + "EncodeRune": ValueOf(utf16.EncodeRune), + "IsSurrogate": ValueOf(utf16.IsSurrogate), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/unicode_utf8.go b/vendor/github.com/cosmos72/gomacro/imports/unicode_utf8.go new file mode 100644 index 0000000..c4d0f1c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/unicode_utf8.go @@ -0,0 +1,40 @@ +// this file was generated by gomacro command: import _b "unicode/utf8" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "unicode/utf8" +) + +// reflection: allow interpreted code to import "unicode/utf8" +func init() { + Packages["unicode/utf8"] = Package{ + Binds: map[string]Value{ + "DecodeLastRune": ValueOf(utf8.DecodeLastRune), + "DecodeLastRuneInString": ValueOf(utf8.DecodeLastRuneInString), + "DecodeRune": ValueOf(utf8.DecodeRune), + "DecodeRuneInString": ValueOf(utf8.DecodeRuneInString), + "EncodeRune": ValueOf(utf8.EncodeRune), + "FullRune": ValueOf(utf8.FullRune), + "FullRuneInString": ValueOf(utf8.FullRuneInString), + "MaxRune": ValueOf(utf8.MaxRune), + "RuneCount": ValueOf(utf8.RuneCount), + "RuneCountInString": ValueOf(utf8.RuneCountInString), + "RuneError": ValueOf(utf8.RuneError), + "RuneLen": ValueOf(utf8.RuneLen), + "RuneSelf": ValueOf(utf8.RuneSelf), + "RuneStart": ValueOf(utf8.RuneStart), + "UTFMax": ValueOf(utf8.UTFMax), + "Valid": ValueOf(utf8.Valid), + "ValidRune": ValueOf(utf8.ValidRune), + "ValidString": ValueOf(utf8.ValidString), + },Untypeds: map[string]string{ + "MaxRune": "rune:1114111", + "RuneError": "rune:65533", + "RuneSelf": "int:128", + "UTFMax": "int:4", + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/imports/unsafe.go b/vendor/github.com/cosmos72/gomacro/imports/unsafe.go new file mode 100644 index 0000000..062d03f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/imports/unsafe.go @@ -0,0 +1,18 @@ +// this file was generated by gomacro command: import _b "unsafe" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package imports + +import ( + . "reflect" + "unsafe" +) + +// reflection: allow interpreted code to import "unsafe" +func init() { + Packages["unsafe"] = Package{ + Types: map[string]Type{ + "Pointer": TypeOf((*unsafe.Pointer)(nil)).Elem(), + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/main.go b/vendor/github.com/cosmos72/gomacro/main.go new file mode 100644 index 0000000..4e62746 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/main.go @@ -0,0 +1,114 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * main.go + * + * Created on: Feb 13, 2017 + * Author: Massimiliano Ghilardi + */ + +package main + +import ( + "fmt" + "os" + + "github.com/cosmos72/gomacro/base" + "github.com/cosmos72/gomacro/parser" +) + +func main() { + args := os.Args[1:] + + var cmd Cmd + cmd.Init() + + cmd.Options |= base.OptFastInterpreter // use fast interpreter by default + + // cmd.Options |= base.OptShowTime // | base.OptTrapPanic // | base.OptShowAfterMacroExpansion // | base.OptShowAfterParse // | base.OptDebugMacroExpand // | base.OptDebugQuasiquote + + cmd.ParserMode |= parser.Trace & 0 + + err := cmd.Main(args) + if err != nil { + fmt.Fprintln(cmd.Stderr, err) + } +} + +/* + miscellaneous annotations + + imports, generated with: find [a-u]* -type f -name \*.go | grep -v internal | grep -v testdata | grep -v cmd/ | grep -v builtin | xargs -d'\n' dirname | sort -u | while read i; do echo -n "_b \"$i\"; "; done + plus some hand-made tweaks + import ( _b "archive/tar"; _b "archive/zip"; _b "bufio"; _b "bytes"; _b "compress/bzip2"; _b "compress/flate"; _b "compress/gzip"; _b "compress/lzw"; _b "compress/zlib"; _b "container/heap"; _b "container/list"; _b "container/ring"; _b "context"; _b "crypto"; _b "crypto/aes"; _b "crypto/cipher"; _b "crypto/des"; _b "crypto/dsa"; _b "crypto/ecdsa"; _b "crypto/elliptic"; _b "crypto/hmac"; _b "crypto/md5"; _b "crypto/rand"; _b "crypto/rc4"; _b "crypto/rsa"; _b "crypto/sha1"; _b "crypto/sha256"; _b "crypto/sha512"; _b "crypto/subtle"; _b "crypto/tls"; _b "crypto/x509"; _b "crypto/x509/pkix"; _b "database/sql"; _b "database/sql/driver"; _b "debug/dwarf"; _b "debug/elf"; _b "debug/gosym"; _b "debug/macho"; _b "debug/pe"; _b "debug/plan9obj"; _b "encoding"; _b "encoding/ascii85"; _b "encoding/asn1"; _b "encoding/base32"; _b "encoding/base64"; _b "encoding/binary"; _b "encoding/csv"; _b "encoding/gob"; _b "encoding/hex"; _b "encoding/json"; _b "encoding/pem"; _b "encoding/xml"; _b "errors"; _b "expvar"; _b "flag"; _b "fmt"; _b "go/ast"; _b "go/build"; _b "go/constant"; _b "go/doc"; _b "go/format"; _b "go/importer"; _b "go/parser"; _b "go/printer"; _b "go/scanner"; _b "go/token"; _b "go/types"; _b "hash"; _b "hash/adler32"; _b "hash/crc32"; _b "hash/crc64"; _b "hash/fnv"; _b "html"; _b "html/template"; _b "image"; _b "image/color"; _b "image/color/palette"; _b "image/draw"; _b "image/gif"; _b "image/jpeg"; _b "image/png"; _b "index/suffixarray"; _b "io"; _b "io/ioutil"; _b "log"; _b "log/syslog"; _b "math"; _b "math/big"; _b "math/cmplx"; _b "math/rand"; _b "mime"; _b "mime/multipart"; _b "mime/quotedprintable"; _b "net"; _b "net/http"; _b "net/http/cgi"; _b "net/http/cookiejar"; _b "net/http/fcgi"; _b "net/http/httptest"; _b "net/http/httptrace"; _b "net/http/httputil"; _b "net/http/pprof"; _b "net/mail"; _b "net/rpc"; _b "net/rpc/jsonrpc"; _b "net/smtp"; _b "net/textproto"; _b "net/url"; _b "os"; _b "os/exec"; _b "os/signal"; _b "os/user"; _b "path"; _b "path/filepath"; _b "plugin"; _b "reflect"; _b "regexp"; _b "regexp/syntax"; _b "runtime"; _b "runtime/debug"; _b "runtime/pprof"; _b "runtime/trace"; _b "sort"; _b "strconv"; _b "strings"; _b "sync"; _b "sync/atomic"; _b "syscall"; _b "testing"; _b "testing/iotest"; _b "testing/quick"; _b "text/scanner"; _b "text/tabwriter"; _b "text/template"; _b "text/template/parse"; _b "time"; _b "unicode"; _b "unicode/utf16"; _b "unicode/utf8"; _b "unsafe" ) + + // test interfaces: + + import ( "time"; "fmt" ); var s fmt.Stringer = time.Second // ok + s.String // ok, s is the interface fmt.Stringer + + import ( "os"; "io" ); var in io.Reader = os.Stdin // ok + import "reflect"; var t = reflect.TypeOf(os.Stdin) // ok + t.Elem // ok, t is the interface reflect.Type + + // test methods-to-functions: + + time.Duration.Seconds // easy, time.Duration is a concrete type + io.Stringer.String // harder, io.Stringer is an interface + + // test methods: + + type Pair struct { A, B int }; var p Pair + func (p *Pair) Lhs() int { return p.A }; func (p *Pair) SetLhs(a int) { p.A = a } + p.SetLhs(2); p.Lhs() + + type Triple struct { Pair; C int }; var t Triple + t.Pair = p + t.SetLhs(3); t.Lhs() + + // test some valid methods: + + type Pair2 Pair; var p2 Pair2 + func (p Pair2) Foo() { } + + type SPair []Pair; var s SPair + func (p SPair) Foo() { }; s.Foo() + + type Int int; var I Int + func (x Int) Print() { println(x) }; I.Print; I.Print() + func (x *Int) Print() { println(*x) }; I.Print; I.Print() + + // test some bogus methods: + + func (p **Pair) Foo() { } + type PPair *Pair + func (p PPair) Foo() { } + func (p *PPair) Foo() { } + + // test type alias: + + type iint = int + type Int int + var i int = 1 + var ii iint = 2 + var I Int = 3 + func show(x int) { println(x) } + func Show(x Int) { println(x) } + +*/ diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/github.com/cosmos72/gomacro/parser/LICENSE similarity index 100% rename from vendor/golang.org/x/tools/LICENSE rename to vendor/github.com/cosmos72/gomacro/parser/LICENSE diff --git a/vendor/github.com/cosmos72/gomacro/parser/global.go b/vendor/github.com/cosmos72/gomacro/parser/global.go new file mode 100644 index 0000000..ac57b73 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/parser/global.go @@ -0,0 +1,153 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file contains the exported entry points for invoking the parser. + +package parser + +import ( + "fmt" + "go/ast" + "go/token" + + mt "github.com/cosmos72/gomacro/token" +) + +// A Mode value is a set of flags (or 0). +// They control the amount of source code parsed and other optional +// parser functionality. +// +type Mode uint + +const ( + PackageClauseOnly Mode = 1 << iota // stop parsing after package clause + ImportsOnly // stop parsing after import declarations + ParseComments // parse comments and add them to AST + Trace // print a trace of parsed productions + DeclarationErrors // report declaration errors + SpuriousErrors // same as AllErrors, for backward-compatibility + AllErrors = SpuriousErrors // report all errors (not just the first 10 on different lines) +) + +type Parser struct { + parser +} + +func (p *parser) Configure(mode Mode, specialChar rune) { + p.mode = mode + p.specialChar = specialChar +} + +func (p *parser) Init(fileset *mt.FileSet, filename string, lineOffset int, src []byte) { + p.init(fileset, filename, lineOffset, src, p.mode) +} + +func (p *parser) Parse() (list []ast.Node, err error) { + if p.file == nil || p.pkgScope == nil { + panic("Parser.Parse(): parser is not initialized, call Parser.Init() first") + } + + defer func() { + if e := recover(); e != nil { + // resume same panic if it's not a bailout + if _, ok := e.(bailout); !ok { + panic(e) + } + } + p.errors.Sort() + err = p.errors.Err() + p.file = nil + p.pkgScope = nil + }() + + topScope := p.topScope + + var lastpos1, lastpos2 token.Pos + list = make([]ast.Node, 0) + for p.tok != token.EOF && p.errors.Len() < 10 { + list = append(list, p.parseAny()) + // fmt.Printf("// parser position is now %d (%s). parsed %#v\n", p.pos, p.file.Position(p.pos), list[len(list)-1]) + if p.pos == lastpos1 { + p.error(p.pos, fmt.Sprintf("skipping '%s' to continue", mt.String(p.tok))) + p.next() + } else { + lastpos1 = lastpos2 + lastpos2 = p.pos + } + } + + assert(topScope == p.topScope, "unbalanced scopes") + + if p.errors.Len() > 0 { + p.errors.Sort() + return list, p.errors.Err() + } + return list, nil +} + +func (p *parser) parseAny() ast.Node { + if p.tok == token.COMMENT { + // advance to the next non-comment token + p.next() + } + var node ast.Node + switch p.tok { + case token.PACKAGE: + // not p.parseFile() because it does not support top-level statements and expressions + node = p.parsePackage() + case token.IMPORT: + node = p.parseGenDecl(token.IMPORT, p.parseImportSpec) + case token.CONST, token.TYPE, token.VAR, token.FUNC, mt.MACRO, mt.FUNCTION: + // a "func" at top level can be either a function declaration: func foo(args) /*...*/ + // or a method declaration: func (receiver) foo(args) /*...*/ + // or a function literal, i.e. a closure: func(args) /*...*/ + // since method declaration and function literal are so similar, + // there is no reasonable way to distinguish them here. + // + // decision: always parse as a declaration. + // function literals at top level must either be written ~lambda(args) /*...*/ + // or come after some other token: a variable declaration, an expression, + // or at least a '(' + node = p.parseDecl(syncDecl) + default: + node = p.parseStmt() + if expr, ok := node.(*ast.ExprStmt); ok { + // unwrap expressions + node = expr.X + } + } + return node +} + +func (p *parser) parsePackage() ast.Node { + if p.trace { + defer un(trace(p, "Package")) + } + doc := p.leadComment + pos := p.expect(token.PACKAGE) + + var names []*ast.Ident + + switch p.tok { + case token.ILLEGAL, token.EOF, token.SEMICOLON, token.RPAREN, token.RBRACE, token.RBRACK: + default: + ident := p.parseIdent() + if ident.Name == "_" && p.mode&DeclarationErrors != 0 { + p.error(p.pos, "invalid package name: _") + } + names = []*ast.Ident{ident} + } + p.expectSemi() + + return &ast.GenDecl{ + TokPos: pos, + Tok: token.PACKAGE, + Specs: []ast.Spec{ + &ast.ValueSpec{ + Doc: doc, + Names: names, + }, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/parser/parser.diffs b/vendor/github.com/cosmos72/gomacro/parser/parser.diffs new file mode 100644 index 0000000..2fc6ac5 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/parser/parser.diffs @@ -0,0 +1,440 @@ +--- /usr/local/go/src/go/parser/parser.go 2017-02-16 20:27:47.000000000 +0100 ++++ parser.go 2017-04-22 17:58:50.801987424 +0200 +@@ -19,11 +19,13 @@ + import ( + "fmt" + "go/ast" +- "go/scanner" + "go/token" + "strconv" + "strings" + "unicode" ++ ++ "github.com/cosmos72/gomacro/scanner" ++ mt "github.com/cosmos72/gomacro/token" + ) + + // The parser structure holds the parser's internal state. +@@ -37,11 +39,17 @@ + trace bool // == (mode & Trace != 0) + indent int // indentation used for tracing output + ++ specialChar rune // patch: prefix for quote operators ' ` , ,@ ++ fileset *token.FileSet ++ + // Comments + comments []*ast.CommentGroup + leadComment *ast.CommentGroup // last lead comment + lineComment *ast.CommentGroup // last line comment + ++ // Previous token ++ tok0 token.Token ++ + // Next token + pos token.Pos // token position + tok token.Token // one token look-ahead +@@ -71,16 +79,51 @@ + } + + func (p *parser) init(fset *token.FileSet, filename string, src []byte, mode Mode) { ++ // Explicitly initialize all private fields since a parser may be reused. ++ if fset == nil { ++ fset = token.NewFileSet() ++ } ++ p.fileset = fset + p.file = fset.AddFile(filename, -1, len(src)) ++ p.errors = nil ++ + var m scanner.Mode + if mode&ParseComments != 0 { + m = scanner.ScanComments + } ++ if p.specialChar == '\x00' { ++ p.specialChar = '~' ++ } + eh := func(pos token.Position, msg string) { p.errors.Add(pos, msg) } +- p.scanner.Init(p.file, src, eh, m) ++ p.scanner.Init(p.file, src, eh, m, p.specialChar) + + p.mode = mode + p.trace = mode&Trace != 0 // for convenience (p.trace is used frequently) ++ p.indent = 0 ++ ++ p.comments = nil ++ p.leadComment = nil ++ p.lineComment = nil ++ ++ p.pos = token.NoPos ++ p.tok = token.ILLEGAL ++ p.lit = "" ++ ++ p.syncPos = token.NoPos ++ p.syncCnt = 0 ++ ++ p.exprLev = 0 ++ p.inRhs = false ++ ++ p.topScope = nil ++ p.openScope() ++ p.pkgScope = p.topScope ++ ++ p.unresolved = nil ++ p.imports = nil ++ ++ p.labelScope = nil ++ p.targetStack = nil + + p.next() + } +@@ -243,11 +286,13 @@ + // very first token (!p.pos.IsValid()) is not initialized + // (it is token.ILLEGAL), so don't print it . + if p.trace && p.pos.IsValid() { +- s := p.tok.String() ++ s := mt.String(p.tok) // patch: support macro-related keywords + switch { + case p.tok.IsLiteral(): + p.printTrace(s, p.lit) +- case p.tok.IsOperator(), p.tok.IsKeyword(): ++ case p.tok.IsOperator(), p.tok.IsKeyword(), ++ mt.IsMacroKeyword(p.tok): // patch: support macro-related keywords ++ + p.printTrace("\"" + s + "\"") + default: + p.printTrace(s) +@@ -274,7 +319,7 @@ + comment = &ast.Comment{Slash: p.pos, Text: p.lit} + p.next0() + +- return ++ return comment, endline + } + + // Consume a group of adjacent comments, add it to the parser's +@@ -317,6 +362,7 @@ + p.leadComment = nil + p.lineComment = nil + prev := p.pos ++ p.tok0 = p.tok + p.next0() + + if p.tok == token.COMMENT { +@@ -378,7 +424,7 @@ + if p.tok == token.SEMICOLON && p.lit == "\n" { + msg += ", found newline" + } else { +- msg += ", found '" + p.tok.String() + "'" ++ msg += ", found '" + mt.String(p.tok) + "'" + if p.tok.IsLiteral() { + msg += " " + p.lit + } +@@ -390,7 +436,7 @@ + func (p *parser) expect(tok token.Token) token.Pos { + pos := p.pos + if p.tok != tok { +- p.errorExpected(pos, "'"+tok.String()+"'") ++ p.errorExpected(pos, "'"+mt.String(tok)+"'") + } + p.next() // make progress + return pos +@@ -409,7 +455,7 @@ + + func (p *parser) expectSemi() { + // semicolon is optional before a closing ')' or '}' +- if p.tok != token.RPAREN && p.tok != token.RBRACE { ++ if p.tok != token.RPAREN && p.tok != token.RBRACE && p.tok != token.RBRACK { // patch: semicolon is optional also before a closing ']' + switch p.tok { + case token.COMMA: + // permit a ',' instead of a ';' but complain +@@ -454,7 +500,7 @@ + case token.BREAK, token.CONST, token.CONTINUE, token.DEFER, + token.FALLTHROUGH, token.FOR, token.GO, token.GOTO, + token.IF, token.RETURN, token.SELECT, token.SWITCH, +- token.TYPE, token.VAR: ++ token.TYPE, token.VAR, mt.FUNCTION: + // Return only if parser made some progress since last + // sync or if it has not reached 10 sync calls without + // progress. Otherwise consume at least one token to +@@ -489,7 +535,7 @@ + func syncDecl(p *parser) { + for { + switch p.tok { +- case token.CONST, token.TYPE, token.VAR: ++ case token.CONST, token.TYPE, token.VAR, token.FUNC, mt.FUNCTION: + // see comments in syncStmt + if p.pos == p.syncPos && p.syncCnt < 10 { + p.syncCnt++ +@@ -912,12 +958,12 @@ + return + } + +-func (p *parser) parseFuncType() (*ast.FuncType, *ast.Scope) { ++func (p *parser) parseFuncType(tok token.Token) (*ast.FuncType, *ast.Scope) { + if p.trace { + defer un(trace(p, "FuncType")) + } + +- pos := p.expect(token.FUNC) ++ pos := p.expect(tok) + scope := ast.NewScope(p.topScope) // function scope + params, results := p.parseSignature(scope) + +@@ -1026,8 +1072,8 @@ + return p.parseStructType() + case token.MUL: + return p.parsePointerType() +- case token.FUNC: +- typ, _ := p.parseFuncType() ++ case token.FUNC, mt.LAMBDA: ++ typ, _ := p.parseFuncType(p.tok) + return typ + case token.INTERFACE: + return p.parseInterfaceType() +@@ -1041,6 +1087,8 @@ + typ := p.parseType() + rparen := p.expect(token.RPAREN) + return &ast.ParenExpr{Lparen: lparen, X: typ, Rparen: rparen} ++ case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE: // patch: support quote and friends inside types ++ return p.parseQuote() + } + + // no type found +@@ -1063,7 +1111,7 @@ + defer un(trace(p, "StatementList")) + } + +- for p.tok != token.CASE && p.tok != token.DEFAULT && p.tok != token.RBRACE && p.tok != token.EOF { ++ for p.tok != mt.TYPECASE && p.tok != token.CASE && p.tok != token.DEFAULT && p.tok != token.RBRACE && p.tok != token.EOF { + list = append(list, p.parseStmt()) + } + +@@ -1103,12 +1151,12 @@ + // ---------------------------------------------------------------------------- + // Expressions + +-func (p *parser) parseFuncTypeOrLit() ast.Expr { ++func (p *parser) parseFuncTypeOrLit(tok token.Token) ast.Expr { + if p.trace { + defer un(trace(p, "FuncTypeOrLit")) + } + +- typ, scope := p.parseFuncType() ++ typ, scope := p.parseFuncType(tok) + if p.tok != token.LBRACE { + // function type only + return typ +@@ -1152,8 +1200,20 @@ + rparen := p.expect(token.RPAREN) + return &ast.ParenExpr{Lparen: lparen, X: x, Rparen: rparen} + +- case token.FUNC: +- return p.parseFuncTypeOrLit() ++ case token.FUNC, mt.LAMBDA: ++ // patch: lambda. equivalent to func, useful to resolve ambiguities between closures ++ // and function/method declarations ++ return p.parseFuncTypeOrLit(p.tok) ++ ++ // patch: quote and friends ++ // TODO: accept ms.MACRO here and interpret as local macro definition? (i.e. Common Lisp macrolet) ++ case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE: ++ return p.parseQuote() ++ ++ // patch: accept block statements inside expressions. allows to nest macro calls, ++ // to write { if a { b } else { c } } inside an expression, and many other things ++ case token.LBRACE: ++ return p.parseExprBlock() + } + + if typ := p.tryIdentOrType(); typ != nil { +@@ -1432,10 +1492,13 @@ + + // If x is of the form (T), unparen returns unparen(T), otherwise it returns x. + func unparen(x ast.Expr) ast.Expr { +- if p, isParen := x.(*ast.ParenExpr); isParen { +- x = unparen(p.X) ++ for { ++ if p, ok := x.(*ast.ParenExpr); ok { ++ x = p.X ++ continue ++ } ++ return x + } +- return x + } + + // checkExprOrType checks that x is an expression or a type +@@ -1701,6 +1764,10 @@ + // Go spec: The scope of a label is the body of the function + // in which it is declared and excludes the body of any nested + // function. ++ if p.labelScope == nil { ++ p.error(label.Pos(), fmt.Sprintf("syntax error: label outside block: %s", label.Name)) ++ return p.parseStmt(), false ++ } + stmt := &ast.LabeledStmt{Label: label, Colon: colon, Stmt: p.parseStmt()} + p.declare(stmt, nil, p.labelScope, ast.Lbl, label) + return stmt, false +@@ -1884,25 +1951,32 @@ + return + } + +-func (p *parser) parseCaseClause(typeSwitch bool) *ast.CaseClause { ++func (p *parser) parseCaseClause(typeSwitch bool) ast.Stmt { + if p.trace { + defer un(trace(p, "CaseClause")) + } + + pos := p.pos + var list []ast.Expr +- if p.tok == token.CASE { ++ if p.tok == mt.TYPECASE { ++ p.next() ++ list = p.parseTypeList() ++ } else if p.tok == token.CASE { + p.next() + if typeSwitch { + list = p.parseTypeList() + } else { + list = p.parseRhsList() + } +- } else { ++ } else if p.tok == token.DEFAULT { + p.expect(token.DEFAULT) ++ } else { ++ // patch: support switch foo { ~,{bar} } ++ // where bar will expand to case x, y, z: w ++ return p.parseStmt() + } +- + colon := p.expect(token.COLON) ++ + p.openScope() + body := p.parseStmtList() + p.closeScope() +@@ -1980,7 +2054,8 @@ + typeSwitch := p.isTypeSwitchGuard(s2) + lbrace := p.expect(token.LBRACE) + var list []ast.Stmt +- for p.tok == token.CASE || p.tok == token.DEFAULT { ++ // patch: allow ~quote and friends in addition to case: and default: ++ for p.tok0 != token.EOF && p.tok != token.LPAREN && p.tok != token.RBRACK && p.tok != token.RBRACE { + list = append(list, p.parseCaseClause(typeSwitch)) + } + rbrace := p.expect(token.RBRACE) +@@ -2159,13 +2234,17 @@ + } + + switch p.tok { +- case token.CONST, token.TYPE, token.VAR: ++ case token.CONST, token.TYPE, token.VAR, ++ mt.FUNCTION: // patch: allow function/method declarations inside statements. extremely useful for ~quote and ~quasiquote + s = &ast.DeclStmt{Decl: p.parseDecl(syncStmt)} + case + // tokens that may start an expression + token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING, token.FUNC, token.LPAREN, // operands + token.LBRACK, token.STRUCT, token.MAP, token.CHAN, token.INTERFACE, // composite types +- token.ADD, token.SUB, token.MUL, token.AND, token.XOR, token.ARROW, token.NOT: // unary operators ++ token.ADD, token.SUB, token.MUL, token.AND, token.XOR, token.ARROW, token.NOT, // unary operators ++ mt.MACRO, mt.SPLICE, mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE, // patch: macro, quote and friends ++ mt.LAMBDA: ++ + s, _ = p.parseSimpleStmt(labelOk) + // because of the required look-ahead, labeled statements are + // parsed by parseSimpleStmt - don't expect a semicolon after +@@ -2173,6 +2252,8 @@ + if _, isLabeledStmt := s.(*ast.LabeledStmt); !isLabeledStmt { + p.expectSemi() + } ++ case token.IMPORT: // patch: allow imports inside statements. useful for ~quote and ~quasiquote ++ s = &ast.DeclStmt{Decl: p.parseGenDecl(token.IMPORT, p.parseImportSpec)} + case token.GO: + s = p.parseGoStmt() + case token.DEFER: +@@ -2366,17 +2447,41 @@ + } + } + +-func (p *parser) parseFuncDecl() *ast.FuncDecl { ++func (p *parser) parseFuncDecl(tok token.Token) *ast.FuncDecl { + if p.trace { + defer un(trace(p, "FunctionDecl")) + } ++ decl := p.parseFuncOrMacroDecl(tok) ++ ++ // paranoia: empty receiver list is omitted. this should not happen, ++ // but we use it to distinguish functions from macros, so better safe than sorry. ++ recv := decl.Recv ++ if recv != nil && len(recv.List) == 0 { ++ decl.Recv = nil ++ } ++ return decl ++} ++ ++// patch: parse a macro declaration ++func (p *parser) parseMacroDecl() *ast.FuncDecl { ++ if p.trace { ++ defer un(trace(p, "MacroDecl")) ++ } ++ decl := p.parseFuncOrMacroDecl(mt.MACRO) ++ // add zero-length receiver list, to mark decl as a macro ++ decl.Recv = &ast.FieldList{List: []*ast.Field{}} ++ return decl ++} ++ ++func (p *parser) parseFuncOrMacroDecl(tok token.Token) *ast.FuncDecl { + + doc := p.leadComment +- pos := p.expect(token.FUNC) ++ pos := p.expect(tok) + scope := ast.NewScope(p.topScope) // function scope + + var recv *ast.FieldList +- if p.tok == token.LPAREN { ++ // patch: macros cannot have a receiver ++ if tok != mt.MACRO && p.tok == token.LPAREN { + recv = p.parseParameters(scope, false) + } + +@@ -2429,8 +2534,11 @@ + case token.TYPE: + f = p.parseTypeSpec + +- case token.FUNC: +- return p.parseFuncDecl() ++ case token.FUNC, mt.FUNCTION: ++ return p.parseFuncDecl(p.tok) ++ ++ case mt.MACRO: // patch: parse a macro declaration ++ return p.parseMacroDecl() + + default: + pos := p.pos +@@ -2473,8 +2581,11 @@ + return nil + } + +- p.openScope() +- p.pkgScope = p.topScope ++ topScope := p.topScope ++ labelScope := p.labelScope ++ if topScope == nil { ++ p.openScope() ++ } + var decls []ast.Decl + if p.mode&PackageClauseOnly == 0 { + // import decls +@@ -2489,9 +2600,11 @@ + } + } + } +- p.closeScope() +- assert(p.topScope == nil, "unbalanced scopes") +- assert(p.labelScope == nil, "unbalanced label scopes") ++ if topScope == nil { ++ p.closeScope() ++ } ++ assert(p.topScope == topScope, "unbalanced scopes") ++ assert(p.labelScope == labelScope, "unbalanced label scopes") + + // resolve global identifiers within the same file + i := 0 diff --git a/vendor/github.com/cosmos72/gomacro/parser/parser.go b/vendor/github.com/cosmos72/gomacro/parser/parser.go new file mode 100644 index 0000000..34d67bc --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/parser/parser.go @@ -0,0 +1,2639 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package parser implements a parser for Go source files. Input may be +// provided in a variety of forms (see the various Parse* functions); the +// output is an abstract syntax tree (AST) representing the Go source. The +// parser is invoked through one of the Parse* functions. +// +// The parser accepts a larger language than is syntactically permitted by +// the Go spec, for simplicity, and for improved robustness in the presence +// of syntax errors. For instance, in method declarations, the receiver is +// treated like an ordinary parameter list and thus may contain multiple +// entries where the spec permits exactly one. Consequently, the corresponding +// field in the AST (ast.FuncDecl.Recv) field is not restricted to one entry. +// +package parser + +import ( + "fmt" + "go/ast" + "go/token" + "strconv" + "strings" + "unicode" + + "github.com/cosmos72/gomacro/scanner" + mt "github.com/cosmos72/gomacro/token" +) + +// The parser structure holds the parser's internal state. +type parser struct { + file *mt.File + errors scanner.ErrorList + scanner scanner.Scanner + + // Tracing/debugging + mode Mode // parsing mode + trace bool // == (mode & Trace != 0) + indent int // indentation used for tracing output + + // Comments + comments []*ast.CommentGroup + leadComment *ast.CommentGroup // last lead comment + lineComment *ast.CommentGroup // last line comment + + tok0 token.Token // patch: Previous token + specialChar rune // patch: prefix for quote operators ' ` , ,@ + + // Next token + pos token.Pos // token position + tok token.Token // one token look-ahead + lit string // token literal + + // Error recovery + // (used to limit the number of calls to syncXXX functions + // w/o making scanning progress - avoids potential endless + // loops across multiple parser functions during error recovery) + syncPos token.Pos // last synchronization position + syncCnt int // number of calls to syncXXX without progress + + // Non-syntactic parser control + exprLev int // < 0: in control clause, >= 0: in expression + inRhs bool // if set, the parser is parsing a rhs expression + + // Ordinary identifier scopes + pkgScope *ast.Scope // pkgScope.Outer == nil + topScope *ast.Scope // top-most scope; may be pkgScope + unresolved []*ast.Ident // unresolved identifiers + imports []*ast.ImportSpec // list of imports + + // Label scopes + // (maintained by open/close LabelScope) + labelScope *ast.Scope // label scope for current function + targetStack [][]*ast.Ident // stack of unresolved labels +} + +func (p *parser) init(fset *mt.FileSet, filename string, lineOffset int, src []byte, mode Mode) { + // Explicitly initialize all private fields since a parser may be reused. + if fset == nil { + fset = mt.NewFileSet() + } + p.file = fset.AddFile(filename, -1, len(src), lineOffset) + p.errors = nil + + var m scanner.Mode + if mode&ParseComments != 0 { + m = scanner.ScanComments + } + if p.specialChar == '\x00' { + p.specialChar = '~' + } + eh := func(pos token.Position, msg string) { p.errors.Add(pos, msg) } + p.scanner.Init(p.file, src, eh, m, p.specialChar) + + p.mode = mode + p.trace = mode&Trace != 0 // for convenience (p.trace is used frequently) + p.indent = 0 + + p.comments = nil + p.leadComment = nil + p.lineComment = nil + + p.pos = token.NoPos + p.tok = token.ILLEGAL + p.lit = "" + + p.syncPos = token.NoPos + p.syncCnt = 0 + + p.exprLev = 0 + p.inRhs = false + + p.topScope = nil + p.openScope() + p.pkgScope = p.topScope + + p.unresolved = nil + p.imports = nil + + p.labelScope = nil + p.targetStack = nil + + p.next() +} + +// ---------------------------------------------------------------------------- +// Scoping support + +func (p *parser) openScope() { + p.topScope = ast.NewScope(p.topScope) +} + +func (p *parser) closeScope() { + p.topScope = p.topScope.Outer +} + +func (p *parser) openLabelScope() { + p.labelScope = ast.NewScope(p.labelScope) + p.targetStack = append(p.targetStack, nil) +} + +func (p *parser) closeLabelScope() { + // resolve labels + n := len(p.targetStack) - 1 + scope := p.labelScope + for _, ident := range p.targetStack[n] { + ident.Obj = scope.Lookup(ident.Name) + if ident.Obj == nil && p.mode&DeclarationErrors != 0 { + p.error(ident.Pos(), fmt.Sprintf("label %s undefined", ident.Name)) + } + } + // pop label scope + p.targetStack = p.targetStack[0:n] + p.labelScope = p.labelScope.Outer +} + +func (p *parser) declare(decl, data interface{}, scope *ast.Scope, kind ast.ObjKind, idents ...*ast.Ident) { + for _, ident := range idents { + assert(ident.Obj == nil, "identifier already declared or resolved") + obj := ast.NewObj(kind, ident.Name) + // remember the corresponding declaration for redeclaration + // errors and global variable resolution/typechecking phase + obj.Decl = decl + obj.Data = data + ident.Obj = obj + if ident.Name != "_" { + if alt := scope.Insert(obj); alt != nil && p.mode&DeclarationErrors != 0 { + prevDecl := "" + if pos := alt.Pos(); pos.IsValid() { + prevDecl = fmt.Sprintf("\n\tprevious declaration at %s", p.file.Position(pos)) + } + p.error(ident.Pos(), fmt.Sprintf("%s redeclared in this block%s", ident.Name, prevDecl)) + } + } + } +} + +func (p *parser) shortVarDecl(decl *ast.AssignStmt, list []ast.Expr) { + // Go spec: A short variable declaration may redeclare variables + // provided they were originally declared in the same block with + // the same type, and at least one of the non-blank variables is new. + n := 0 // number of new variables + for _, x := range list { + if ident, isIdent := x.(*ast.Ident); isIdent { + assert(ident.Obj == nil, "identifier already declared or resolved") + obj := ast.NewObj(ast.Var, ident.Name) + // remember corresponding assignment for other tools + obj.Decl = decl + ident.Obj = obj + if ident.Name != "_" { + if alt := p.topScope.Insert(obj); alt != nil { + ident.Obj = alt // redeclaration + } else { + n++ // new declaration + } + } + } else { + p.errorExpected(x.Pos(), "identifier on left side of :=") + } + } + if n == 0 && p.mode&DeclarationErrors != 0 { + p.error(list[0].Pos(), "no new variables on left side of :=") + } +} + +// The unresolved object is a sentinel to mark identifiers that have been added +// to the list of unresolved identifiers. The sentinel is only used for verifying +// internal consistency. +var unresolved = new(ast.Object) + +// If x is an identifier, tryResolve attempts to resolve x by looking up +// the object it denotes. If no object is found and collectUnresolved is +// set, x is marked as unresolved and collected in the list of unresolved +// identifiers. +// +func (p *parser) tryResolve(x ast.Expr, collectUnresolved bool) { + // nothing to do if x is not an identifier or the blank identifier + ident, _ := x.(*ast.Ident) + if ident == nil { + return + } + assert(ident.Obj == nil, "identifier already declared or resolved") + if ident.Name == "_" { + return + } + // try to resolve the identifier + for s := p.topScope; s != nil; s = s.Outer { + if obj := s.Lookup(ident.Name); obj != nil { + ident.Obj = obj + return + } + } + // all local scopes are known, so any unresolved identifier + // must be found either in the file scope, package scope + // (perhaps in another file), or universe scope --- collect + // them so that they can be resolved later + if collectUnresolved { + ident.Obj = unresolved + p.unresolved = append(p.unresolved, ident) + } +} + +func (p *parser) resolve(x ast.Expr) { + p.tryResolve(x, true) +} + +// ---------------------------------------------------------------------------- +// Parsing support + +func (p *parser) printTrace(a ...interface{}) { + const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + const n = len(dots) + pos := p.file.Position(p.pos) + fmt.Printf("%5d:%3d: ", pos.Line, pos.Column) + i := 2 * p.indent + for i > n { + fmt.Print(dots) + i -= n + } + // i <= n + fmt.Print(dots[0:i]) + fmt.Println(a...) +} + +func trace(p *parser, msg string) *parser { + p.printTrace(msg, "(") + p.indent++ + return p +} + +// Usage pattern: defer un(trace(p, "...")) +func un(p *parser) { + p.indent-- + p.printTrace(")") +} + +// Advance to the next token. +func (p *parser) next0() { + // Because of one-token look-ahead, print the previous token + // when tracing as it provides a more readable output. The + // very first token (!p.pos.IsValid()) is not initialized + // (it is token.ILLEGAL), so don't print it . + if p.trace && p.pos.IsValid() { + s := mt.String(p.tok) // patch: support macro-related keywords + switch { + case p.tok.IsLiteral(): + p.printTrace(s, p.lit) + case p.tok.IsOperator(), p.tok.IsKeyword(), + mt.IsMacroKeyword(p.tok): // patch: support macro-related keywords + + p.printTrace("\"" + s + "\"") + default: + p.printTrace(s) + } + } + + p.pos, p.tok, p.lit = p.scanner.Scan() +} + +// Consume a comment and return it and the line on which it ends. +func (p *parser) consumeComment() (comment *ast.Comment, endline int) { + // /*-style comments may end on a different line than where they start. + // Scan the comment for '\n' chars and adjust endline accordingly. + endline = p.file.Line(p.pos) + if p.lit[1] == '*' { + // don't use range here - no need to decode Unicode code points + for i := 0; i < len(p.lit); i++ { + if p.lit[i] == '\n' { + endline++ + } + } + } + + comment = &ast.Comment{Slash: p.pos, Text: p.lit} + p.next0() + + return +} + +// Consume a group of adjacent comments, add it to the parser's +// comments list, and return it together with the line at which +// the last comment in the group ends. A non-comment token or n +// empty lines terminate a comment group. +// +func (p *parser) consumeCommentGroup(n int) (comments *ast.CommentGroup, endline int) { + var list []*ast.Comment + endline = p.file.Line(p.pos) + for p.tok == token.COMMENT && p.file.Line(p.pos) <= endline+n { + var comment *ast.Comment + comment, endline = p.consumeComment() + list = append(list, comment) + } + + // add comment group to the comments list + comments = &ast.CommentGroup{List: list} + p.comments = append(p.comments, comments) + + return +} + +// Advance to the next non-comment token. In the process, collect +// any comment groups encountered, and remember the last lead and +// and line comments. +// +// A lead comment is a comment group that starts and ends in a +// line without any other tokens and that is followed by a non-comment +// token on the line immediately after the comment group. +// +// A line comment is a comment group that follows a non-comment +// token on the same line, and that has no tokens after it on the line +// where it ends. +// +// Lead and line comments may be considered documentation that is +// stored in the AST. +// +func (p *parser) next() { + p.leadComment = nil + p.lineComment = nil + prev := p.pos + p.tok0 = p.tok + p.next0() + + if p.tok == token.COMMENT { + var comment *ast.CommentGroup + var endline int + + if p.file.Line(p.pos) == p.file.Line(prev) { + // The comment is on same line as the previous token; it + // cannot be a lead comment but may be a line comment. + comment, endline = p.consumeCommentGroup(0) + if p.file.Line(p.pos) != endline { + // The next token is on a different line, thus + // the last comment group is a line comment. + p.lineComment = comment + } + } + + // consume successor comments, if any + endline = -1 + for p.tok == token.COMMENT { + comment, endline = p.consumeCommentGroup(1) + } + + if endline+1 == p.file.Line(p.pos) { + // The next token is following on the line immediately after the + // comment group, thus the last comment group is a lead comment. + p.leadComment = comment + } + } +} + +// A bailout panic is raised to indicate early termination. +type bailout struct{} + +func (p *parser) error(pos token.Pos, msg string) { + epos := p.file.Position(pos) + + // If AllErrors is not set, discard errors reported on the same line + // as the last recorded error and stop parsing if there are more than + // 10 errors. + if p.mode&AllErrors == 0 { + n := len(p.errors) + if n > 0 && p.errors[n-1].Pos.Line == epos.Line { + return // discard - likely a spurious error + } + if n > 10 { + panic(bailout{}) + } + } + + p.errors.Add(epos, msg) +} + +func (p *parser) errorExpected(pos token.Pos, msg string) { + msg = "expected " + msg + if pos == p.pos { + // the error happened at the current position; + // make the error message more specific + if p.tok == token.SEMICOLON && p.lit == "\n" { + msg += ", found newline" + } else { + msg += ", found '" + mt.String(p.tok) + "'" + if p.tok.IsLiteral() { + msg += " " + p.lit + } + } + } + p.error(pos, msg) +} + +func (p *parser) expect(tok token.Token) token.Pos { + pos := p.pos + if p.tok != tok { + p.errorExpected(pos, "'"+mt.String(tok)+"'") + } + p.next() // make progress + return pos +} + +// expectClosing is like expect but provides a better error message +// for the common case of a missing comma before a newline. +// +func (p *parser) expectClosing(tok token.Token, context string) token.Pos { + if p.tok != tok && p.tok == token.SEMICOLON && p.lit == "\n" { + p.error(p.pos, "missing ',' before newline in "+context) + p.next() + } + return p.expect(tok) +} + +func (p *parser) expectSemi() { + // semicolon is optional before a closing ')' or '}' + if p.tok != token.RPAREN && p.tok != token.RBRACE && p.tok != token.RBRACK { // patch: semicolon is optional also before a closing ']' + switch p.tok { + case token.COMMA: + // permit a ',' instead of a ';' but complain + p.errorExpected(p.pos, "';'") + fallthrough + case token.SEMICOLON: + p.next() + default: + p.errorExpected(p.pos, "';'") + syncStmt(p) + } + } +} + +func (p *parser) atComma(context string, follow token.Token) bool { + if p.tok == token.COMMA { + return true + } + if p.tok != follow { + msg := "missing ','" + if p.tok == token.SEMICOLON && p.lit == "\n" { + msg += " before newline" + } + p.error(p.pos, msg+" in "+context) + return true // "insert" comma and continue + } + return false +} + +func assert(cond bool, msg string) { + if !cond { + panic("go/parser internal error: " + msg) + } +} + +// syncStmt advances to the next statement. +// Used for synchronization after an error. +// +func syncStmt(p *parser) { + for { + switch p.tok { + case token.BREAK, token.CONST, token.CONTINUE, token.DEFER, + token.FALLTHROUGH, token.FOR, token.GO, token.GOTO, + token.IF, token.RETURN, token.SELECT, token.SWITCH, + token.TYPE, token.VAR, mt.FUNCTION: + // Return only if parser made some progress since last + // sync or if it has not reached 10 sync calls without + // progress. Otherwise consume at least one token to + // avoid an endless parser loop (it is possible that + // both parseOperand and parseStmt call syncStmt and + // correctly do not advance, thus the need for the + // invocation limit p.syncCnt). + if p.pos == p.syncPos && p.syncCnt < 10 { + p.syncCnt++ + return + } + if p.pos > p.syncPos { + p.syncPos = p.pos + p.syncCnt = 0 + return + } + // Reaching here indicates a parser bug, likely an + // incorrect token list in this function, but it only + // leads to skipping of possibly correct code if a + // previous error is present, and thus is preferred + // over a non-terminating parse. + case token.EOF: + return + } + p.next() + } +} + +// syncDecl advances to the next declaration. +// Used for synchronization after an error. +// +func syncDecl(p *parser) { + for { + switch p.tok { + case token.CONST, token.TYPE, token.VAR, token.FUNC, mt.FUNCTION: + // see comments in syncStmt + if p.pos == p.syncPos && p.syncCnt < 10 { + p.syncCnt++ + return + } + if p.pos > p.syncPos { + p.syncPos = p.pos + p.syncCnt = 0 + return + } + case token.EOF: + return + } + p.next() + } +} + +// safePos returns a valid file position for a given position: If pos +// is valid to begin with, safePos returns pos. If pos is out-of-range, +// safePos returns the EOF position. +// +// This is hack to work around "artificial" end positions in the AST which +// are computed by adding 1 to (presumably valid) token positions. If the +// token positions are invalid due to parse errors, the resulting end position +// may be past the file's EOF position, which would lead to panics if used +// later on. +// +func (p *parser) safePos(pos token.Pos) (res token.Pos) { + defer func() { + if recover() != nil { + res = token.Pos(p.file.Base() + p.file.Size()) // EOF position + } + }() + _ = p.file.Offset(pos) // trigger a panic if position is out-of-range + return pos +} + +// ---------------------------------------------------------------------------- +// Identifiers + +func (p *parser) parseIdent() *ast.Ident { + pos := p.pos + name := "_" + if p.tok == token.IDENT { + name = p.lit + p.next() + } else { + p.expect(token.IDENT) // use expect() error handling + } + return &ast.Ident{NamePos: pos, Name: name} +} + +func (p *parser) parseIdentList() (list []*ast.Ident) { + if p.trace { + defer un(trace(p, "IdentList")) + } + + list = append(list, p.parseIdent()) + for p.tok == token.COMMA { + p.next() + list = append(list, p.parseIdent()) + } + + return +} + +// ---------------------------------------------------------------------------- +// Common productions + +// If lhs is set, result list elements which are identifiers are not resolved. +func (p *parser) parseExprList(lhs bool) (list []ast.Expr) { + if p.trace { + defer un(trace(p, "ExpressionList")) + } + + list = append(list, p.checkExpr(p.parseExpr(lhs))) + for p.tok == token.COMMA { + p.next() + list = append(list, p.checkExpr(p.parseExpr(lhs))) + } + + return +} + +func (p *parser) parseLhsList() []ast.Expr { + old := p.inRhs + p.inRhs = false + list := p.parseExprList(true) + switch p.tok { + case token.DEFINE: + // lhs of a short variable declaration + // but doesn't enter scope until later: + // caller must call p.shortVarDecl(p.makeIdentList(list)) + // at appropriate time. + case token.COLON: + // lhs of a label declaration or a communication clause of a select + // statement (parseLhsList is not called when parsing the case clause + // of a switch statement): + // - labels are declared by the caller of parseLhsList + // - for communication clauses, if there is a stand-alone identifier + // followed by a colon, we have a syntax error; there is no need + // to resolve the identifier in that case + default: + // identifiers must be declared elsewhere + for _, x := range list { + p.resolve(x) + } + } + p.inRhs = old + return list +} + +func (p *parser) parseRhsList() []ast.Expr { + old := p.inRhs + p.inRhs = true + list := p.parseExprList(false) + p.inRhs = old + return list +} + +// ---------------------------------------------------------------------------- +// Types + +func (p *parser) parseType() ast.Expr { + if p.trace { + defer un(trace(p, "Type")) + } + + typ := p.tryType() + + if typ == nil { + pos := p.pos + p.errorExpected(pos, "type") + p.next() // make progress + return &ast.BadExpr{From: pos, To: p.pos} + } + + return typ +} + +// If the result is an identifier, it is not resolved. +func (p *parser) parseTypeName() ast.Expr { + if p.trace { + defer un(trace(p, "TypeName")) + } + + ident := p.parseIdent() + // don't resolve ident yet - it may be a parameter or field name + + if p.tok == token.PERIOD { + // ident is a package name + p.next() + p.resolve(ident) + sel := p.parseIdent() + return &ast.SelectorExpr{X: ident, Sel: sel} + } + + return ident +} + +func (p *parser) parseArrayType() ast.Expr { + if p.trace { + defer un(trace(p, "ArrayType")) + } + + lbrack := p.expect(token.LBRACK) + p.exprLev++ + var len ast.Expr + // always permit ellipsis for more fault-tolerant parsing + if p.tok == token.ELLIPSIS { + len = &ast.Ellipsis{Ellipsis: p.pos} + p.next() + } else if p.tok != token.RBRACK { + len = p.parseRhs() + } + p.exprLev-- + p.expect(token.RBRACK) + elt := p.parseType() + + return &ast.ArrayType{Lbrack: lbrack, Len: len, Elt: elt} +} + +func (p *parser) makeIdentList(list []ast.Expr) []*ast.Ident { + idents := make([]*ast.Ident, len(list)) + for i, x := range list { + ident, isIdent := x.(*ast.Ident) + if !isIdent { + if _, isBad := x.(*ast.BadExpr); !isBad { + // only report error if it's a new one + p.errorExpected(x.Pos(), "identifier") + } + ident = &ast.Ident{NamePos: x.Pos(), Name: "_"} + } + idents[i] = ident + } + return idents +} + +func (p *parser) parseFieldDecl(scope *ast.Scope) *ast.Field { + if p.trace { + defer un(trace(p, "FieldDecl")) + } + + doc := p.leadComment + + // 1st FieldDecl + // A type name used as an anonymous field looks like a field identifier. + var list []ast.Expr + for { + list = append(list, p.parseVarType(false)) + if p.tok != token.COMMA { + break + } + p.next() + } + + typ := p.tryVarType(false) + + // analyze case + var idents []*ast.Ident + if typ != nil { + // IdentifierList Type + idents = p.makeIdentList(list) + } else { + // ["*"] TypeName (AnonymousField) + typ = list[0] // we always have at least one element + if n := len(list); n > 1 { + p.errorExpected(p.pos, "type") + typ = &ast.BadExpr{From: p.pos, To: p.pos} + } else if !isTypeName(deref(typ)) { + p.errorExpected(typ.Pos(), "anonymous field") + typ = &ast.BadExpr{From: typ.Pos(), To: p.safePos(typ.End())} + } + } + + // Tag + var tag *ast.BasicLit + if p.tok == token.STRING { + tag = &ast.BasicLit{ValuePos: p.pos, Kind: p.tok, Value: p.lit} + p.next() + } + + p.expectSemi() // call before accessing p.linecomment + + field := &ast.Field{Doc: doc, Names: idents, Type: typ, Tag: tag, Comment: p.lineComment} + p.declare(field, nil, scope, ast.Var, idents...) + p.resolve(typ) + + return field +} + +func (p *parser) parseStructType() *ast.StructType { + if p.trace { + defer un(trace(p, "StructType")) + } + + pos := p.expect(token.STRUCT) + lbrace := p.expect(token.LBRACE) + scope := ast.NewScope(nil) // struct scope + var list []*ast.Field + for p.tok == token.IDENT || p.tok == token.MUL || p.tok == token.LPAREN { + // a field declaration cannot start with a '(' but we accept + // it here for more robust parsing and better error messages + // (parseFieldDecl will check and complain if necessary) + list = append(list, p.parseFieldDecl(scope)) + } + rbrace := p.expect(token.RBRACE) + + return &ast.StructType{ + Struct: pos, + Fields: &ast.FieldList{ + Opening: lbrace, + List: list, + Closing: rbrace, + }, + } +} + +func (p *parser) parsePointerType() *ast.StarExpr { + if p.trace { + defer un(trace(p, "PointerType")) + } + + star := p.expect(token.MUL) + base := p.parseType() + + return &ast.StarExpr{Star: star, X: base} +} + +// If the result is an identifier, it is not resolved. +func (p *parser) tryVarType(isParam bool) ast.Expr { + if isParam && p.tok == token.ELLIPSIS { + pos := p.pos + p.next() + typ := p.tryIdentOrType() // don't use parseType so we can provide better error message + if typ != nil { + p.resolve(typ) + } else { + p.error(pos, "'...' parameter is missing type") + typ = &ast.BadExpr{From: pos, To: p.pos} + } + return &ast.Ellipsis{Ellipsis: pos, Elt: typ} + } + return p.tryIdentOrType() +} + +// If the result is an identifier, it is not resolved. +func (p *parser) parseVarType(isParam bool) ast.Expr { + typ := p.tryVarType(isParam) + if typ == nil { + pos := p.pos + p.errorExpected(pos, "type") + p.next() // make progress + typ = &ast.BadExpr{From: pos, To: p.pos} + } + return typ +} + +func (p *parser) parseParameterList(scope *ast.Scope, ellipsisOk bool) (params []*ast.Field) { + if p.trace { + defer un(trace(p, "ParameterList")) + } + + // 1st ParameterDecl + // A list of identifiers looks like a list of type names. + var list []ast.Expr + for { + list = append(list, p.parseVarType(ellipsisOk)) + if p.tok != token.COMMA { + break + } + p.next() + if p.tok == token.RPAREN { + break + } + } + + // analyze case + if typ := p.tryVarType(ellipsisOk); typ != nil { + // IdentifierList Type + idents := p.makeIdentList(list) + field := &ast.Field{Names: idents, Type: typ} + params = append(params, field) + // Go spec: The scope of an identifier denoting a function + // parameter or result variable is the function body. + p.declare(field, nil, scope, ast.Var, idents...) + p.resolve(typ) + if !p.atComma("parameter list", token.RPAREN) { + return + } + p.next() + for p.tok != token.RPAREN && p.tok != token.EOF { + idents := p.parseIdentList() + typ := p.parseVarType(ellipsisOk) + field := &ast.Field{Names: idents, Type: typ} + params = append(params, field) + // Go spec: The scope of an identifier denoting a function + // parameter or result variable is the function body. + p.declare(field, nil, scope, ast.Var, idents...) + p.resolve(typ) + if !p.atComma("parameter list", token.RPAREN) { + break + } + p.next() + } + return + } + + // Type { "," Type } (anonymous parameters) + params = make([]*ast.Field, len(list)) + for i, typ := range list { + p.resolve(typ) + params[i] = &ast.Field{Type: typ} + } + return +} + +func (p *parser) parseParameters(scope *ast.Scope, ellipsisOk bool) *ast.FieldList { + if p.trace { + defer un(trace(p, "Parameters")) + } + + var params []*ast.Field + lparen := p.expect(token.LPAREN) + if p.tok != token.RPAREN { + params = p.parseParameterList(scope, ellipsisOk) + } + rparen := p.expect(token.RPAREN) + + return &ast.FieldList{Opening: lparen, List: params, Closing: rparen} +} + +func (p *parser) parseResult(scope *ast.Scope) *ast.FieldList { + if p.trace { + defer un(trace(p, "Result")) + } + + if p.tok == token.LPAREN { + return p.parseParameters(scope, false) + } + + typ := p.tryType() + if typ != nil { + list := make([]*ast.Field, 1) + list[0] = &ast.Field{Type: typ} + return &ast.FieldList{List: list} + } + + return nil +} + +func (p *parser) parseSignature(scope *ast.Scope) (params, results *ast.FieldList) { + if p.trace { + defer un(trace(p, "Signature")) + } + + params = p.parseParameters(scope, true) + results = p.parseResult(scope) + + return +} + +func (p *parser) parseFuncType(tok token.Token) (*ast.FuncType, *ast.Scope) { + if p.trace { + defer un(trace(p, "FuncType")) + } + + pos := p.expect(tok) + scope := ast.NewScope(p.topScope) // function scope + params, results := p.parseSignature(scope) + + return &ast.FuncType{Func: pos, Params: params, Results: results}, scope +} + +func (p *parser) parseMethodSpec(scope *ast.Scope) *ast.Field { + if p.trace { + defer un(trace(p, "MethodSpec")) + } + + doc := p.leadComment + var idents []*ast.Ident + var typ ast.Expr + x := p.parseTypeName() + if ident, isIdent := x.(*ast.Ident); isIdent && p.tok == token.LPAREN { + // method + idents = []*ast.Ident{ident} + scope := ast.NewScope(nil) // method scope + params, results := p.parseSignature(scope) + typ = &ast.FuncType{Func: token.NoPos, Params: params, Results: results} + } else { + // embedded interface + typ = x + p.resolve(typ) + } + p.expectSemi() // call before accessing p.linecomment + + spec := &ast.Field{Doc: doc, Names: idents, Type: typ, Comment: p.lineComment} + p.declare(spec, nil, scope, ast.Fun, idents...) + + return spec +} + +func (p *parser) parseInterfaceType() *ast.InterfaceType { + if p.trace { + defer un(trace(p, "InterfaceType")) + } + + pos := p.expect(token.INTERFACE) + lbrace := p.expect(token.LBRACE) + scope := ast.NewScope(nil) // interface scope + var list []*ast.Field + for p.tok == token.IDENT { + list = append(list, p.parseMethodSpec(scope)) + } + rbrace := p.expect(token.RBRACE) + + return &ast.InterfaceType{ + Interface: pos, + Methods: &ast.FieldList{ + Opening: lbrace, + List: list, + Closing: rbrace, + }, + } +} + +func (p *parser) parseMapType() *ast.MapType { + if p.trace { + defer un(trace(p, "MapType")) + } + + pos := p.expect(token.MAP) + p.expect(token.LBRACK) + key := p.parseType() + p.expect(token.RBRACK) + value := p.parseType() + + return &ast.MapType{Map: pos, Key: key, Value: value} +} + +func (p *parser) parseChanType() *ast.ChanType { + if p.trace { + defer un(trace(p, "ChanType")) + } + + pos := p.pos + dir := ast.SEND | ast.RECV + var arrow token.Pos + if p.tok == token.CHAN { + p.next() + if p.tok == token.ARROW { + arrow = p.pos + p.next() + dir = ast.SEND + } + } else { + arrow = p.expect(token.ARROW) + p.expect(token.CHAN) + dir = ast.RECV + } + value := p.parseType() + + return &ast.ChanType{Begin: pos, Arrow: arrow, Dir: dir, Value: value} +} + +// If the result is an identifier, it is not resolved. +func (p *parser) tryIdentOrType() ast.Expr { + switch p.tok { + case token.IDENT: + return p.parseTypeName() + case token.LBRACK: + return p.parseArrayType() + case token.STRUCT: + return p.parseStructType() + case token.MUL: + return p.parsePointerType() + case token.FUNC, mt.LAMBDA: + typ, _ := p.parseFuncType(p.tok) + return typ + case token.INTERFACE: + return p.parseInterfaceType() + case token.MAP: + return p.parseMapType() + case token.CHAN, token.ARROW: + return p.parseChanType() + case token.LPAREN: + lparen := p.pos + p.next() + typ := p.parseType() + rparen := p.expect(token.RPAREN) + return &ast.ParenExpr{Lparen: lparen, X: typ, Rparen: rparen} + case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE: // patch: support quote and friends inside types + return p.parseQuote() + } + + // no type found + return nil +} + +func (p *parser) tryType() ast.Expr { + typ := p.tryIdentOrType() + if typ != nil { + p.resolve(typ) + } + return typ +} + +// ---------------------------------------------------------------------------- +// Blocks + +func (p *parser) parseStmtList() (list []ast.Stmt) { + if p.trace { + defer un(trace(p, "StatementList")) + } + + for p.tok != mt.TYPECASE && p.tok != token.CASE && p.tok != token.DEFAULT && p.tok != token.RBRACE && p.tok != token.EOF { + list = append(list, p.parseStmt()) + } + + return +} + +func (p *parser) parseBody(scope *ast.Scope) *ast.BlockStmt { + if p.trace { + defer un(trace(p, "Body")) + } + + lbrace := p.expect(token.LBRACE) + p.topScope = scope // open function scope + p.openLabelScope() + list := p.parseStmtList() + p.closeLabelScope() + p.closeScope() + rbrace := p.expect(token.RBRACE) + + return &ast.BlockStmt{Lbrace: lbrace, List: list, Rbrace: rbrace} +} + +func (p *parser) parseBlockStmt() *ast.BlockStmt { + if p.trace { + defer un(trace(p, "BlockStmt")) + } + + lbrace := p.expect(token.LBRACE) + p.openScope() + list := p.parseStmtList() + p.closeScope() + rbrace := p.expect(token.RBRACE) + + return &ast.BlockStmt{Lbrace: lbrace, List: list, Rbrace: rbrace} +} + +// ---------------------------------------------------------------------------- +// Expressions + +func (p *parser) parseFuncTypeOrLit(tok token.Token) ast.Expr { + if p.trace { + defer un(trace(p, "FuncTypeOrLit")) + } + + typ, scope := p.parseFuncType(tok) + if p.tok != token.LBRACE { + // function type only + return typ + } + + p.exprLev++ + body := p.parseBody(scope) + p.exprLev-- + + return &ast.FuncLit{Type: typ, Body: body} +} + +// parseOperand may return an expression or a raw type (incl. array +// types of the form [...]T. Callers must verify the result. +// If lhs is set and the result is an identifier, it is not resolved. +// +func (p *parser) parseOperand(lhs bool) ast.Expr { + if p.trace { + defer un(trace(p, "Operand")) + } + + switch p.tok { + case token.IDENT: + x := p.parseIdent() + if !lhs { + p.resolve(x) + } + return x + + case token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING: + x := &ast.BasicLit{ValuePos: p.pos, Kind: p.tok, Value: p.lit} + p.next() + return x + + case token.LPAREN: + lparen := p.pos + p.next() + p.exprLev++ + x := p.parseRhsOrType() // types may be parenthesized: (some type) + p.exprLev-- + rparen := p.expect(token.RPAREN) + return &ast.ParenExpr{Lparen: lparen, X: x, Rparen: rparen} + + case token.FUNC, mt.LAMBDA: + // patch: lambda. equivalent to func, useful to resolve ambiguities between closures + // and function/method declarations + return p.parseFuncTypeOrLit(p.tok) + + // patch: quote and friends + // TODO: accept ms.MACRO here and interpret as local macro definition? (i.e. Common Lisp macrolet) + case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE: + return p.parseQuote() + + // patch: accept block statements inside expressions. allows to nest macro calls, + // to write { if a { b } else { c } } inside an expression, and many other things + case token.LBRACE: + return p.parseExprBlock() + } + + if typ := p.tryIdentOrType(); typ != nil { + // could be type for composite literal or conversion + _, isIdent := typ.(*ast.Ident) + assert(!isIdent, "type cannot be identifier") + return typ + } + + // we have an error + pos := p.pos + p.errorExpected(pos, "operand") + syncStmt(p) + return &ast.BadExpr{From: pos, To: p.pos} +} + +func (p *parser) parseSelector(x ast.Expr) ast.Expr { + if p.trace { + defer un(trace(p, "Selector")) + } + + sel := p.parseIdent() + + return &ast.SelectorExpr{X: x, Sel: sel} +} + +func (p *parser) parseTypeAssertion(x ast.Expr) ast.Expr { + if p.trace { + defer un(trace(p, "TypeAssertion")) + } + + lparen := p.expect(token.LPAREN) + var typ ast.Expr + if p.tok == token.TYPE { + // type switch: typ == nil + p.next() + } else { + typ = p.parseType() + } + rparen := p.expect(token.RPAREN) + + return &ast.TypeAssertExpr{X: x, Type: typ, Lparen: lparen, Rparen: rparen} +} + +func (p *parser) parseIndexOrSlice(x ast.Expr) ast.Expr { + if p.trace { + defer un(trace(p, "IndexOrSlice")) + } + + const N = 3 // change the 3 to 2 to disable 3-index slices + lbrack := p.expect(token.LBRACK) + p.exprLev++ + var index [N]ast.Expr + var colons [N - 1]token.Pos + if p.tok != token.COLON { + index[0] = p.parseRhs() + } + ncolons := 0 + for p.tok == token.COLON && ncolons < len(colons) { + colons[ncolons] = p.pos + ncolons++ + p.next() + if p.tok != token.COLON && p.tok != token.RBRACK && p.tok != token.EOF { + index[ncolons] = p.parseRhs() + } + } + p.exprLev-- + rbrack := p.expect(token.RBRACK) + + if ncolons > 0 { + // slice expression + slice3 := false + if ncolons == 2 { + slice3 = true + // Check presence of 2nd and 3rd index here rather than during type-checking + // to prevent erroneous programs from passing through gofmt (was issue 7305). + if index[1] == nil { + p.error(colons[0], "2nd index required in 3-index slice") + index[1] = &ast.BadExpr{From: colons[0] + 1, To: colons[1]} + } + if index[2] == nil { + p.error(colons[1], "3rd index required in 3-index slice") + index[2] = &ast.BadExpr{From: colons[1] + 1, To: rbrack} + } + } + return &ast.SliceExpr{X: x, Lbrack: lbrack, Low: index[0], High: index[1], Max: index[2], Slice3: slice3, Rbrack: rbrack} + } + + return &ast.IndexExpr{X: x, Lbrack: lbrack, Index: index[0], Rbrack: rbrack} +} + +func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr { + if p.trace { + defer un(trace(p, "CallOrConversion")) + } + + lparen := p.expect(token.LPAREN) + p.exprLev++ + var list []ast.Expr + var ellipsis token.Pos + for p.tok != token.RPAREN && p.tok != token.EOF && !ellipsis.IsValid() { + list = append(list, p.parseRhsOrType()) // builtins may expect a type: make(some type, ...) + if p.tok == token.ELLIPSIS { + ellipsis = p.pos + p.next() + } + if !p.atComma("argument list", token.RPAREN) { + break + } + p.next() + } + p.exprLev-- + rparen := p.expectClosing(token.RPAREN, "argument list") + + return &ast.CallExpr{Fun: fun, Lparen: lparen, Args: list, Ellipsis: ellipsis, Rparen: rparen} +} + +func (p *parser) parseValue(keyOk bool) ast.Expr { + if p.trace { + defer un(trace(p, "Element")) + } + + if p.tok == token.LBRACE { + return p.parseLiteralValue(nil) + } + + // Because the parser doesn't know the composite literal type, it cannot + // know if a key that's an identifier is a struct field name or a name + // denoting a value. The former is not resolved by the parser or the + // resolver. + // + // Instead, _try_ to resolve such a key if possible. If it resolves, + // it a) has correctly resolved, or b) incorrectly resolved because + // the key is a struct field with a name matching another identifier. + // In the former case we are done, and in the latter case we don't + // care because the type checker will do a separate field lookup. + // + // If the key does not resolve, it a) must be defined at the top + // level in another file of the same package, the universe scope, or be + // undeclared; or b) it is a struct field. In the former case, the type + // checker can do a top-level lookup, and in the latter case it will do + // a separate field lookup. + x := p.checkExpr(p.parseExpr(keyOk)) + if keyOk { + if p.tok == token.COLON { + // Try to resolve the key but don't collect it + // as unresolved identifier if it fails so that + // we don't get (possibly false) errors about + // undeclared names. + p.tryResolve(x, false) + } else { + // not a key + p.resolve(x) + } + } + + return x +} + +func (p *parser) parseElement() ast.Expr { + if p.trace { + defer un(trace(p, "Element")) + } + + x := p.parseValue(true) + if p.tok == token.COLON { + colon := p.pos + p.next() + x = &ast.KeyValueExpr{Key: x, Colon: colon, Value: p.parseValue(false)} + } + + return x +} + +func (p *parser) parseElementList() (list []ast.Expr) { + if p.trace { + defer un(trace(p, "ElementList")) + } + + for p.tok != token.RBRACE && p.tok != token.EOF { + list = append(list, p.parseElement()) + if !p.atComma("composite literal", token.RBRACE) { + break + } + p.next() + } + + return +} + +func (p *parser) parseLiteralValue(typ ast.Expr) ast.Expr { + if p.trace { + defer un(trace(p, "LiteralValue")) + } + + lbrace := p.expect(token.LBRACE) + var elts []ast.Expr + p.exprLev++ + if p.tok != token.RBRACE { + elts = p.parseElementList() + } + p.exprLev-- + rbrace := p.expectClosing(token.RBRACE, "composite literal") + return &ast.CompositeLit{Type: typ, Lbrace: lbrace, Elts: elts, Rbrace: rbrace} +} + +// checkExpr checks that x is an expression (and not a type). +func (p *parser) checkExpr(x ast.Expr) ast.Expr { + switch unparen(x).(type) { + case *ast.BadExpr: + case *ast.Ident: + case *ast.BasicLit: + case *ast.FuncLit: + case *ast.CompositeLit: + case *ast.ParenExpr: + panic("unreachable") + case *ast.SelectorExpr: + case *ast.IndexExpr: + case *ast.SliceExpr: + case *ast.TypeAssertExpr: + // If t.Type == nil we have a type assertion of the form + // y.(type), which is only allowed in type switch expressions. + // It's hard to exclude those but for the case where we are in + // a type switch. Instead be lenient and test this in the type + // checker. + case *ast.CallExpr: + case *ast.StarExpr: + case *ast.UnaryExpr: + case *ast.BinaryExpr: + default: + // all other nodes are not proper expressions + p.errorExpected(x.Pos(), "expression") + x = &ast.BadExpr{From: x.Pos(), To: p.safePos(x.End())} + } + return x +} + +// isTypeName reports whether x is a (qualified) TypeName. +func isTypeName(x ast.Expr) bool { + switch t := x.(type) { + case *ast.BadExpr: + case *ast.Ident: + case *ast.SelectorExpr: + _, isIdent := t.X.(*ast.Ident) + return isIdent + default: + return false // all other nodes are not type names + } + return true +} + +// isLiteralType reports whether x is a legal composite literal type. +func isLiteralType(x ast.Expr) bool { + switch t := x.(type) { + case *ast.BadExpr: + case *ast.Ident: + case *ast.SelectorExpr: + _, isIdent := t.X.(*ast.Ident) + return isIdent + case *ast.ArrayType: + case *ast.StructType: + case *ast.MapType: + default: + return false // all other nodes are not legal composite literal types + } + return true +} + +// If x is of the form *T, deref returns T, otherwise it returns x. +func deref(x ast.Expr) ast.Expr { + if p, isPtr := x.(*ast.StarExpr); isPtr { + x = p.X + } + return x +} + +// If x is of the form (T), unparen returns unparen(T), otherwise it returns x. +func unparen(x ast.Expr) ast.Expr { + for { + if p, ok := x.(*ast.ParenExpr); ok { + x = p.X + continue + } + return x + } +} + +// checkExprOrType checks that x is an expression or a type +// (and not a raw type such as [...]T). +// +func (p *parser) checkExprOrType(x ast.Expr) ast.Expr { + switch t := unparen(x).(type) { + case *ast.ParenExpr: + panic("unreachable") + case *ast.UnaryExpr: + case *ast.ArrayType: + if len, isEllipsis := t.Len.(*ast.Ellipsis); isEllipsis { + p.error(len.Pos(), "expected array length, found '...'") + x = &ast.BadExpr{From: x.Pos(), To: p.safePos(x.End())} + } + } + + // all other nodes are expressions or types + return x +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parsePrimaryExpr(lhs bool) ast.Expr { + if p.trace { + defer un(trace(p, "PrimaryExpr")) + } + + x := p.parseOperand(lhs) +L: + for { + switch p.tok { + case token.PERIOD: + p.next() + if lhs { + p.resolve(x) + } + switch p.tok { + case token.IDENT: + x = p.parseSelector(p.checkExprOrType(x)) + case token.LPAREN: + x = p.parseTypeAssertion(p.checkExpr(x)) + default: + pos := p.pos + p.errorExpected(pos, "selector or type assertion") + p.next() // make progress + sel := &ast.Ident{NamePos: pos, Name: "_"} + x = &ast.SelectorExpr{X: x, Sel: sel} + } + case token.LBRACK: + if lhs { + p.resolve(x) + } + x = p.parseIndexOrSlice(p.checkExpr(x)) + case token.LPAREN: + if lhs { + p.resolve(x) + } + x = p.parseCallOrConversion(p.checkExprOrType(x)) + case token.LBRACE: + if isLiteralType(x) && (p.exprLev >= 0 || !isTypeName(x)) { + if lhs { + p.resolve(x) + } + x = p.parseLiteralValue(x) + } else { + break L + } + default: + break L + } + lhs = false // no need to try to resolve again + } + + return x +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parseUnaryExpr(lhs bool) ast.Expr { + if p.trace { + defer un(trace(p, "UnaryExpr")) + } + + switch p.tok { + case token.ADD, token.SUB, token.NOT, token.XOR, token.AND: + pos, op := p.pos, p.tok + p.next() + x := p.parseUnaryExpr(false) + return &ast.UnaryExpr{OpPos: pos, Op: op, X: p.checkExpr(x)} + + case token.ARROW: + // channel type or receive expression + arrow := p.pos + p.next() + + // If the next token is token.CHAN we still don't know if it + // is a channel type or a receive operation - we only know + // once we have found the end of the unary expression. There + // are two cases: + // + // <- type => (<-type) must be channel type + // <- expr => <-(expr) is a receive from an expression + // + // In the first case, the arrow must be re-associated with + // the channel type parsed already: + // + // <- (chan type) => (<-chan type) + // <- (chan<- type) => (<-chan (<-type)) + + x := p.parseUnaryExpr(false) + + // determine which case we have + if typ, ok := x.(*ast.ChanType); ok { + // (<-type) + + // re-associate position info and <- + dir := ast.SEND + for ok && dir == ast.SEND { + if typ.Dir == ast.RECV { + // error: (<-type) is (<-(<-chan T)) + p.errorExpected(typ.Arrow, "'chan'") + } + arrow, typ.Begin, typ.Arrow = typ.Arrow, arrow, arrow + dir, typ.Dir = typ.Dir, ast.RECV + typ, ok = typ.Value.(*ast.ChanType) + } + if dir == ast.SEND { + p.errorExpected(arrow, "channel type") + } + + return x + } + + // <-(expr) + return &ast.UnaryExpr{OpPos: arrow, Op: token.ARROW, X: p.checkExpr(x)} + + case token.MUL: + // pointer type or unary "*" expression + pos := p.pos + p.next() + x := p.parseUnaryExpr(false) + return &ast.StarExpr{Star: pos, X: p.checkExprOrType(x)} + } + + return p.parsePrimaryExpr(lhs) +} + +func (p *parser) tokPrec() (token.Token, int) { + tok := p.tok + if p.inRhs && tok == token.ASSIGN { + tok = token.EQL + } + return tok, tok.Precedence() +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parseBinaryExpr(lhs bool, prec1 int) ast.Expr { + if p.trace { + defer un(trace(p, "BinaryExpr")) + } + + x := p.parseUnaryExpr(lhs) + for { + op, oprec := p.tokPrec() + if oprec < prec1 { + return x + } + pos := p.expect(op) + if lhs { + p.resolve(x) + lhs = false + } + y := p.parseBinaryExpr(false, oprec+1) + x = &ast.BinaryExpr{X: p.checkExpr(x), OpPos: pos, Op: op, Y: p.checkExpr(y)} + } +} + +// If lhs is set and the result is an identifier, it is not resolved. +// The result may be a type or even a raw type ([...]int). Callers must +// check the result (using checkExpr or checkExprOrType), depending on +// context. +func (p *parser) parseExpr(lhs bool) ast.Expr { + if p.trace { + defer un(trace(p, "Expression")) + } + + return p.parseBinaryExpr(lhs, token.LowestPrec+1) +} + +func (p *parser) parseRhs() ast.Expr { + old := p.inRhs + p.inRhs = true + x := p.checkExpr(p.parseExpr(false)) + p.inRhs = old + return x +} + +func (p *parser) parseRhsOrType() ast.Expr { + old := p.inRhs + p.inRhs = true + x := p.checkExprOrType(p.parseExpr(false)) + p.inRhs = old + return x +} + +// ---------------------------------------------------------------------------- +// Statements + +// Parsing modes for parseSimpleStmt. +const ( + basic = iota + labelOk + rangeOk +) + +// parseSimpleStmt returns true as 2nd result if it parsed the assignment +// of a range clause (with mode == rangeOk). The returned statement is an +// assignment with a right-hand side that is a single unary expression of +// the form "range x". No guarantees are given for the left-hand side. +func (p *parser) parseSimpleStmt(mode int) (ast.Stmt, bool) { + if p.trace { + defer un(trace(p, "SimpleStmt")) + } + + x := p.parseLhsList() + + switch p.tok { + case + token.DEFINE, token.ASSIGN, token.ADD_ASSIGN, + token.SUB_ASSIGN, token.MUL_ASSIGN, token.QUO_ASSIGN, + token.REM_ASSIGN, token.AND_ASSIGN, token.OR_ASSIGN, + token.XOR_ASSIGN, token.SHL_ASSIGN, token.SHR_ASSIGN, token.AND_NOT_ASSIGN: + // assignment statement, possibly part of a range clause + pos, tok := p.pos, p.tok + p.next() + var y []ast.Expr + isRange := false + if mode == rangeOk && p.tok == token.RANGE && (tok == token.DEFINE || tok == token.ASSIGN) { + pos := p.pos + p.next() + y = []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}} + isRange = true + } else { + y = p.parseRhsList() + } + as := &ast.AssignStmt{Lhs: x, TokPos: pos, Tok: tok, Rhs: y} + if tok == token.DEFINE { + p.shortVarDecl(as, x) + } + return as, isRange + } + + if len(x) > 1 { + p.errorExpected(x[0].Pos(), "1 expression") + // continue with first expression + } + + switch p.tok { + case token.COLON: + // labeled statement + colon := p.pos + p.next() + if label, isIdent := x[0].(*ast.Ident); mode == labelOk && isIdent { + // Go spec: The scope of a label is the body of the function + // in which it is declared and excludes the body of any nested + // function. + if p.labelScope == nil { + p.error(label.Pos(), fmt.Sprintf("syntax error: label outside block: %s", label.Name)) + return p.parseStmt(), false + } + stmt := &ast.LabeledStmt{Label: label, Colon: colon, Stmt: p.parseStmt()} + p.declare(stmt, nil, p.labelScope, ast.Lbl, label) + return stmt, false + } + // The label declaration typically starts at x[0].Pos(), but the label + // declaration may be erroneous due to a token after that position (and + // before the ':'). If SpuriousErrors is not set, the (only) error re- + // ported for the line is the illegal label error instead of the token + // before the ':' that caused the problem. Thus, use the (latest) colon + // position for error reporting. + p.error(colon, "illegal label declaration") + return &ast.BadStmt{From: x[0].Pos(), To: colon + 1}, false + + case token.ARROW: + // send statement + arrow := p.pos + p.next() + y := p.parseRhs() + return &ast.SendStmt{Chan: x[0], Arrow: arrow, Value: y}, false + + case token.INC, token.DEC: + // increment or decrement + s := &ast.IncDecStmt{X: x[0], TokPos: p.pos, Tok: p.tok} + p.next() + return s, false + } + + // expression + return &ast.ExprStmt{X: x[0]}, false +} + +func (p *parser) parseCallExpr(callType string) *ast.CallExpr { + x := p.parseRhsOrType() // could be a conversion: (some type)(x) + if call, isCall := x.(*ast.CallExpr); isCall { + return call + } + if _, isBad := x.(*ast.BadExpr); !isBad { + // only report error if it's a new one + p.error(p.safePos(x.End()), fmt.Sprintf("function must be invoked in %s statement", callType)) + } + return nil +} + +func (p *parser) parseGoStmt() ast.Stmt { + if p.trace { + defer un(trace(p, "GoStmt")) + } + + pos := p.expect(token.GO) + call := p.parseCallExpr("go") + p.expectSemi() + if call == nil { + return &ast.BadStmt{From: pos, To: pos + 2} // len("go") + } + + return &ast.GoStmt{Go: pos, Call: call} +} + +func (p *parser) parseDeferStmt() ast.Stmt { + if p.trace { + defer un(trace(p, "DeferStmt")) + } + + pos := p.expect(token.DEFER) + call := p.parseCallExpr("defer") + p.expectSemi() + if call == nil { + return &ast.BadStmt{From: pos, To: pos + 5} // len("defer") + } + + return &ast.DeferStmt{Defer: pos, Call: call} +} + +func (p *parser) parseReturnStmt() *ast.ReturnStmt { + if p.trace { + defer un(trace(p, "ReturnStmt")) + } + + pos := p.pos + p.expect(token.RETURN) + var x []ast.Expr + if p.tok != token.SEMICOLON && p.tok != token.RBRACE { + x = p.parseRhsList() + } + p.expectSemi() + + return &ast.ReturnStmt{Return: pos, Results: x} +} + +func (p *parser) parseBranchStmt(tok token.Token) *ast.BranchStmt { + if p.trace { + defer un(trace(p, "BranchStmt")) + } + + pos := p.expect(tok) + var label *ast.Ident + if tok != token.FALLTHROUGH && p.tok == token.IDENT { + label = p.parseIdent() + // add to list of unresolved targets + n := len(p.targetStack) - 1 + p.targetStack[n] = append(p.targetStack[n], label) + } + p.expectSemi() + + return &ast.BranchStmt{TokPos: pos, Tok: tok, Label: label} +} + +func (p *parser) makeExpr(s ast.Stmt, kind string) ast.Expr { + if s == nil { + return nil + } + if es, isExpr := s.(*ast.ExprStmt); isExpr { + return p.checkExpr(es.X) + } + p.error(s.Pos(), fmt.Sprintf("expected %s, found simple statement (missing parentheses around composite literal?)", kind)) + return &ast.BadExpr{From: s.Pos(), To: p.safePos(s.End())} +} + +func (p *parser) parseIfStmt() *ast.IfStmt { + if p.trace { + defer un(trace(p, "IfStmt")) + } + + pos := p.expect(token.IF) + p.openScope() + defer p.closeScope() + + var s ast.Stmt + var x ast.Expr + { + prevLev := p.exprLev + p.exprLev = -1 + if p.tok == token.SEMICOLON { + p.next() + x = p.parseRhs() + } else { + s, _ = p.parseSimpleStmt(basic) + if p.tok == token.SEMICOLON { + p.next() + x = p.parseRhs() + } else { + x = p.makeExpr(s, "boolean expression") + s = nil + } + } + p.exprLev = prevLev + } + + body := p.parseBlockStmt() + var else_ ast.Stmt + if p.tok == token.ELSE { + p.next() + switch p.tok { + case token.IF: + else_ = p.parseIfStmt() + case token.LBRACE: + else_ = p.parseBlockStmt() + p.expectSemi() + default: + p.errorExpected(p.pos, "if statement or block") + else_ = &ast.BadStmt{From: p.pos, To: p.pos} + } + } else { + p.expectSemi() + } + + return &ast.IfStmt{If: pos, Init: s, Cond: x, Body: body, Else: else_} +} + +func (p *parser) parseTypeList() (list []ast.Expr) { + if p.trace { + defer un(trace(p, "TypeList")) + } + + list = append(list, p.parseType()) + for p.tok == token.COMMA { + p.next() + list = append(list, p.parseType()) + } + + return +} + +func (p *parser) parseCaseClause(typeSwitch bool) ast.Stmt { + if p.trace { + defer un(trace(p, "CaseClause")) + } + + pos := p.pos + var list []ast.Expr + if p.tok == mt.TYPECASE { + p.next() + list = p.parseTypeList() + } else if p.tok == token.CASE { + p.next() + if typeSwitch { + list = p.parseTypeList() + } else { + list = p.parseRhsList() + } + } else if p.tok == token.DEFAULT { + p.expect(token.DEFAULT) + } else { + switch p.tok { + case token.ILLEGAL, token.EOF, token.COLON, token.SEMICOLON, token.RBRACE, token.RBRACK, token.LPAREN: + p.errorExpected(p.pos, "'case' or 'default'") + default: + // patch: support switch foo { ~,{bar} } + // where bar will expand to case x, y, z: w + return p.parseStmt() + } + } + colon := p.expect(token.COLON) + + p.openScope() + body := p.parseStmtList() + p.closeScope() + + return &ast.CaseClause{Case: pos, List: list, Colon: colon, Body: body} +} + +func isTypeSwitchAssert(x ast.Expr) bool { + a, ok := x.(*ast.TypeAssertExpr) + return ok && a.Type == nil +} + +func (p *parser) isTypeSwitchGuard(s ast.Stmt) bool { + switch t := s.(type) { + case *ast.ExprStmt: + // x.(type) + return isTypeSwitchAssert(t.X) + case *ast.AssignStmt: + // v := x.(type) + if len(t.Lhs) == 1 && len(t.Rhs) == 1 && isTypeSwitchAssert(t.Rhs[0]) { + switch t.Tok { + case token.ASSIGN: + // permit v = x.(type) but complain + p.error(t.TokPos, "expected ':=', found '='") + fallthrough + case token.DEFINE: + return true + } + } + } + return false +} + +func (p *parser) parseSwitchStmt() ast.Stmt { + if p.trace { + defer un(trace(p, "SwitchStmt")) + } + + pos := p.expect(token.SWITCH) + p.openScope() + defer p.closeScope() + + var s1, s2 ast.Stmt + if p.tok != token.LBRACE { + prevLev := p.exprLev + p.exprLev = -1 + if p.tok != token.SEMICOLON { + s2, _ = p.parseSimpleStmt(basic) + } + if p.tok == token.SEMICOLON { + p.next() + s1 = s2 + s2 = nil + if p.tok != token.LBRACE { + // A TypeSwitchGuard may declare a variable in addition + // to the variable declared in the initial SimpleStmt. + // Introduce extra scope to avoid redeclaration errors: + // + // switch t := 0; t := x.(T) { ... } + // + // (this code is not valid Go because the first t + // cannot be accessed and thus is never used, the extra + // scope is needed for the correct error message). + // + // If we don't have a type switch, s2 must be an expression. + // Having the extra nested but empty scope won't affect it. + p.openScope() + defer p.closeScope() + s2, _ = p.parseSimpleStmt(basic) + } + } + p.exprLev = prevLev + } + + typeSwitch := p.isTypeSwitchGuard(s2) + lbrace := p.expect(token.LBRACE) + var list []ast.Stmt + // patch: allow ~quote and friends in addition to case: and default: + for p.tok0 != token.EOF && p.tok != token.LPAREN && p.tok != token.RBRACK && p.tok != token.RBRACE { + list = append(list, p.parseCaseClause(typeSwitch)) + } + rbrace := p.expect(token.RBRACE) + p.expectSemi() + body := &ast.BlockStmt{Lbrace: lbrace, List: list, Rbrace: rbrace} + + if typeSwitch { + return &ast.TypeSwitchStmt{Switch: pos, Init: s1, Assign: s2, Body: body} + } + + return &ast.SwitchStmt{Switch: pos, Init: s1, Tag: p.makeExpr(s2, "switch expression"), Body: body} +} + +func (p *parser) parseCommClause() *ast.CommClause { + if p.trace { + defer un(trace(p, "CommClause")) + } + + p.openScope() + pos := p.pos + var comm ast.Stmt + if p.tok == token.CASE { + p.next() + lhs := p.parseLhsList() + if p.tok == token.ARROW { + // SendStmt + if len(lhs) > 1 { + p.errorExpected(lhs[0].Pos(), "1 expression") + // continue with first expression + } + arrow := p.pos + p.next() + rhs := p.parseRhs() + comm = &ast.SendStmt{Chan: lhs[0], Arrow: arrow, Value: rhs} + } else { + // RecvStmt + if tok := p.tok; tok == token.ASSIGN || tok == token.DEFINE { + // RecvStmt with assignment + if len(lhs) > 2 { + p.errorExpected(lhs[0].Pos(), "1 or 2 expressions") + // continue with first two expressions + lhs = lhs[0:2] + } + pos := p.pos + p.next() + rhs := p.parseRhs() + as := &ast.AssignStmt{Lhs: lhs, TokPos: pos, Tok: tok, Rhs: []ast.Expr{rhs}} + if tok == token.DEFINE { + p.shortVarDecl(as, lhs) + } + comm = as + } else { + // lhs must be single receive operation + if len(lhs) > 1 { + p.errorExpected(lhs[0].Pos(), "1 expression") + // continue with first expression + } + comm = &ast.ExprStmt{X: lhs[0]} + } + } + } else { + p.expect(token.DEFAULT) + } + + colon := p.expect(token.COLON) + body := p.parseStmtList() + p.closeScope() + + return &ast.CommClause{Case: pos, Comm: comm, Colon: colon, Body: body} +} + +func (p *parser) parseSelectStmt() *ast.SelectStmt { + if p.trace { + defer un(trace(p, "SelectStmt")) + } + + pos := p.expect(token.SELECT) + lbrace := p.expect(token.LBRACE) + var list []ast.Stmt + for p.tok == token.CASE || p.tok == token.DEFAULT { + list = append(list, p.parseCommClause()) + } + rbrace := p.expect(token.RBRACE) + p.expectSemi() + body := &ast.BlockStmt{Lbrace: lbrace, List: list, Rbrace: rbrace} + + return &ast.SelectStmt{Select: pos, Body: body} +} + +func (p *parser) parseForStmt() ast.Stmt { + if p.trace { + defer un(trace(p, "ForStmt")) + } + + pos := p.expect(token.FOR) + p.openScope() + defer p.closeScope() + + var s1, s2, s3 ast.Stmt + var isRange bool + if p.tok != token.LBRACE { + prevLev := p.exprLev + p.exprLev = -1 + if p.tok != token.SEMICOLON { + if p.tok == token.RANGE { + // "for range x" (nil lhs in assignment) + pos := p.pos + p.next() + y := []ast.Expr{&ast.UnaryExpr{OpPos: pos, Op: token.RANGE, X: p.parseRhs()}} + s2 = &ast.AssignStmt{Rhs: y} + isRange = true + } else { + s2, isRange = p.parseSimpleStmt(rangeOk) + } + } + if !isRange && p.tok == token.SEMICOLON { + p.next() + s1 = s2 + s2 = nil + if p.tok != token.SEMICOLON { + s2, _ = p.parseSimpleStmt(basic) + } + p.expectSemi() + if p.tok != token.LBRACE { + s3, _ = p.parseSimpleStmt(basic) + } + } + p.exprLev = prevLev + } + + body := p.parseBlockStmt() + p.expectSemi() + + if isRange { + as := s2.(*ast.AssignStmt) + // check lhs + var key, value ast.Expr + switch len(as.Lhs) { + case 0: + // nothing to do + case 1: + key = as.Lhs[0] + case 2: + key, value = as.Lhs[0], as.Lhs[1] + default: + p.errorExpected(as.Lhs[len(as.Lhs)-1].Pos(), "at most 2 expressions") + return &ast.BadStmt{From: pos, To: p.safePos(body.End())} + } + // parseSimpleStmt returned a right-hand side that + // is a single unary expression of the form "range x" + x := as.Rhs[0].(*ast.UnaryExpr).X + return &ast.RangeStmt{ + For: pos, + Key: key, + Value: value, + TokPos: as.TokPos, + Tok: as.Tok, + X: x, + Body: body, + } + } + + // regular for statement + return &ast.ForStmt{ + For: pos, + Init: s1, + Cond: p.makeExpr(s2, "boolean or range expression"), + Post: s3, + Body: body, + } +} + +func (p *parser) parseStmt() (s ast.Stmt) { + if p.trace { + defer un(trace(p, "Statement")) + } + + switch p.tok { + case token.CONST, token.TYPE, token.VAR, + mt.FUNCTION: // patch: allow function/method declarations inside statements. extremely useful for ~quote and ~quasiquote + s = &ast.DeclStmt{Decl: p.parseDecl(syncStmt)} + case + // tokens that may start an expression + token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING, token.FUNC, token.LPAREN, // operands + token.LBRACK, token.STRUCT, token.MAP, token.CHAN, token.INTERFACE, // composite types + token.ADD, token.SUB, token.MUL, token.AND, token.XOR, token.ARROW, token.NOT, // unary operators + mt.MACRO, mt.SPLICE, mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE, // patch: macro, quote and friends + mt.LAMBDA: + + s, _ = p.parseSimpleStmt(labelOk) + // because of the required look-ahead, labeled statements are + // parsed by parseSimpleStmt - don't expect a semicolon after + // them + if _, isLabeledStmt := s.(*ast.LabeledStmt); !isLabeledStmt { + p.expectSemi() + } + case token.IMPORT: // patch: allow imports inside statements. useful for ~quote and ~quasiquote + s = &ast.DeclStmt{Decl: p.parseGenDecl(token.IMPORT, p.parseImportSpec)} + case token.GO: + s = p.parseGoStmt() + case token.DEFER: + s = p.parseDeferStmt() + case token.RETURN: + s = p.parseReturnStmt() + case token.BREAK, token.CONTINUE, token.GOTO, token.FALLTHROUGH: + s = p.parseBranchStmt(p.tok) + case token.LBRACE: + s = p.parseBlockStmt() + p.expectSemi() + case token.IF: + s = p.parseIfStmt() + case token.SWITCH: + s = p.parseSwitchStmt() + case token.SELECT: + s = p.parseSelectStmt() + case token.FOR: + s = p.parseForStmt() + case token.SEMICOLON: + // Is it ever possible to have an implicit semicolon + // producing an empty statement in a valid program? + // (handle correctly anyway) + s = &ast.EmptyStmt{Semicolon: p.pos, Implicit: p.lit == "\n"} + p.next() + case token.RBRACE: + // a semicolon may be omitted before a closing "}" + s = &ast.EmptyStmt{Semicolon: p.pos, Implicit: true} + default: + // no statement found + pos := p.pos + p.errorExpected(pos, "statement") + syncStmt(p) + s = &ast.BadStmt{From: pos, To: p.pos} + } + + return +} + +// ---------------------------------------------------------------------------- +// Declarations + +type parseSpecFunction func(doc *ast.CommentGroup, keyword token.Token, iota int) ast.Spec + +func isValidImport(lit string) bool { + const illegalChars = `!"#$%&'()*,:;<=>?[\]^{|}` + "`\uFFFD" + s, _ := strconv.Unquote(lit) // go/scanner returns a legal string literal + for _, r := range s { + if !unicode.IsGraphic(r) || unicode.IsSpace(r) || strings.ContainsRune(illegalChars, r) { + return false + } + } + return s != "" +} + +func (p *parser) parseImportSpec(doc *ast.CommentGroup, _ token.Token, _ int) ast.Spec { + if p.trace { + defer un(trace(p, "ImportSpec")) + } + + var ident *ast.Ident + switch p.tok { + case token.PERIOD: + ident = &ast.Ident{NamePos: p.pos, Name: "."} + p.next() + case token.IDENT: + ident = p.parseIdent() + } + + pos := p.pos + var path string + if p.tok == token.STRING { + path = p.lit + if !isValidImport(path) { + p.error(pos, "invalid import path: "+path) + } + p.next() + } else { + p.expect(token.STRING) // use expect() error handling + } + p.expectSemi() // call before accessing p.linecomment + + // collect imports + spec := &ast.ImportSpec{ + Doc: doc, + Name: ident, + Path: &ast.BasicLit{ValuePos: pos, Kind: token.STRING, Value: path}, + Comment: p.lineComment, + } + p.imports = append(p.imports, spec) + + return spec +} + +func (p *parser) parseValueSpec(doc *ast.CommentGroup, keyword token.Token, iota int) ast.Spec { + if p.trace { + defer un(trace(p, keyword.String()+"Spec")) + } + + pos := p.pos + idents := p.parseIdentList() + typ := p.tryType() + var values []ast.Expr + // always permit optional initialization for more tolerant parsing + if p.tok == token.ASSIGN { + p.next() + values = p.parseRhsList() + } + p.expectSemi() // call before accessing p.linecomment + + switch keyword { + case token.VAR: + if typ == nil && values == nil { + p.error(pos, "missing variable type or initialization") + } + case token.CONST: + if values == nil && (iota == 0 || typ != nil) { + p.error(pos, "missing constant value") + } + } + + // Go spec: The scope of a constant or variable identifier declared inside + // a function begins at the end of the ConstSpec or VarSpec and ends at + // the end of the innermost containing block. + // (Global identifiers are resolved in a separate phase after parsing.) + spec := &ast.ValueSpec{ + Doc: doc, + Names: idents, + Type: typ, + Values: values, + Comment: p.lineComment, + } + kind := ast.Con + if keyword == token.VAR { + kind = ast.Var + } + p.declare(spec, iota, p.topScope, kind, idents...) + + return spec +} + +func (p *parser) parseTypeSpec(doc *ast.CommentGroup, _ token.Token, _ int) ast.Spec { + if p.trace { + defer un(trace(p, "TypeSpec")) + } + + ident := p.parseIdent() + + // Go spec: The scope of a type identifier declared inside a function begins + // at the identifier in the TypeSpec and ends at the end of the innermost + // containing block. + // (Global identifiers are resolved in a separate phase after parsing.) + spec := &ast.TypeSpec{Doc: doc, Name: ident} + p.declare(spec, nil, p.topScope, ast.Typ, ident) + + // PATCH: support type aliases + if p.tok == token.ASSIGN { + pos := p.pos + p.next() + spec.Type = &ast.UnaryExpr{OpPos: pos, Op: token.ASSIGN, X: p.parseType()} + } else { + spec.Type = p.parseType() + } + p.expectSemi() // call before accessing p.linecomment + spec.Comment = p.lineComment + + return spec +} + +func (p *parser) parseGenDecl(keyword token.Token, f parseSpecFunction) *ast.GenDecl { + if p.trace { + defer un(trace(p, "GenDecl("+keyword.String()+")")) + } + + doc := p.leadComment + pos := p.expect(keyword) + var lparen, rparen token.Pos + var list []ast.Spec + if p.tok == token.LPAREN { + lparen = p.pos + p.next() + for iota := 0; p.tok != token.RPAREN && p.tok != token.EOF; iota++ { + list = append(list, f(p.leadComment, keyword, iota)) + } + rparen = p.expect(token.RPAREN) + p.expectSemi() + } else { + list = append(list, f(nil, keyword, 0)) + } + + return &ast.GenDecl{ + Doc: doc, + TokPos: pos, + Tok: keyword, + Lparen: lparen, + Specs: list, + Rparen: rparen, + } +} + +func (p *parser) parseFuncDecl(tok token.Token) *ast.FuncDecl { + if p.trace { + defer un(trace(p, "FunctionDecl")) + } + decl := p.parseFuncOrMacroDecl(tok) + + // paranoia: empty receiver list is omitted. this should not happen, + // but we use it to distinguish functions from macros, so better safe than sorry. + recv := decl.Recv + if recv != nil && len(recv.List) == 0 { + decl.Recv = nil + } + return decl +} + +// patch: parse a macro declaration +func (p *parser) parseMacroDecl() *ast.FuncDecl { + if p.trace { + defer un(trace(p, "MacroDecl")) + } + decl := p.parseFuncOrMacroDecl(mt.MACRO) + // add zero-length receiver list, to mark decl as a macro + decl.Recv = &ast.FieldList{List: []*ast.Field{}} + return decl +} + +func (p *parser) parseFuncOrMacroDecl(tok token.Token) *ast.FuncDecl { + + doc := p.leadComment + pos := p.expect(tok) + scope := ast.NewScope(p.topScope) // function scope + + var recv *ast.FieldList + // patch: macros cannot have a receiver + if tok != mt.MACRO && p.tok == token.LPAREN { + recv = p.parseParameters(scope, false) + } + + ident := p.parseIdent() + + params, results := p.parseSignature(scope) + + var body *ast.BlockStmt + if p.tok == token.LBRACE { + body = p.parseBody(scope) + } + p.expectSemi() + + decl := &ast.FuncDecl{ + Doc: doc, + Recv: recv, + Name: ident, + Type: &ast.FuncType{ + Func: pos, + Params: params, + Results: results, + }, + Body: body, + } + if recv == nil { + // Go spec: The scope of an identifier denoting a constant, type, + // variable, or function (but not method) declared at top level + // (outside any function) is the package block. + // + // init() functions cannot be referred to and there may + // be more than one - don't put them in the pkgScope + if ident.Name != "init" { + p.declare(decl, nil, p.pkgScope, ast.Fun, ident) + } + } + + return decl +} + +func (p *parser) parseDecl(sync func(*parser)) ast.Decl { + if p.trace { + defer un(trace(p, "Declaration")) + } + + var f parseSpecFunction + switch p.tok { + case token.CONST, token.VAR: + f = p.parseValueSpec + + case token.TYPE: + f = p.parseTypeSpec + + case token.FUNC, mt.FUNCTION: + return p.parseFuncDecl(p.tok) + + case mt.MACRO: // patch: parse a macro declaration + return p.parseMacroDecl() + + default: + pos := p.pos + p.errorExpected(pos, "declaration") + sync(p) + return &ast.BadDecl{From: pos, To: p.pos} + } + + return p.parseGenDecl(p.tok, f) +} + +// ---------------------------------------------------------------------------- +// Source files + +func (p *parser) parseFile() *ast.File { + if p.trace { + defer un(trace(p, "File")) + } + + // Don't bother parsing the rest if we had errors scanning the first token. + // Likely not a Go source file at all. + if p.errors.Len() != 0 { + return nil + } + + // package clause + doc := p.leadComment + pos := p.expect(token.PACKAGE) + // Go spec: The package clause is not a declaration; + // the package name does not appear in any scope. + ident := p.parseIdent() + if ident.Name == "_" && p.mode&DeclarationErrors != 0 { + p.error(p.pos, "invalid package name _") + } + p.expectSemi() + + // Don't bother parsing the rest if we had errors parsing the package clause. + // Likely not a Go source file at all. + if p.errors.Len() != 0 { + return nil + } + + topScope := p.topScope + labelScope := p.labelScope + if topScope == nil { + p.openScope() + } + var decls []ast.Decl + if p.mode&PackageClauseOnly == 0 { + // import decls + for p.tok == token.IMPORT { + decls = append(decls, p.parseGenDecl(token.IMPORT, p.parseImportSpec)) + } + + if p.mode&ImportsOnly == 0 { + // rest of package body + for p.tok != token.EOF { + decls = append(decls, p.parseDecl(syncDecl)) + } + } + } + if topScope == nil { + p.closeScope() + } + assert(p.topScope == topScope, "unbalanced scopes") + assert(p.labelScope == labelScope, "unbalanced label scopes") + + // resolve global identifiers within the same file + i := 0 + for _, ident := range p.unresolved { + // i <= index for current ident + assert(ident.Obj == unresolved, "object already resolved") + ident.Obj = p.pkgScope.Lookup(ident.Name) // also removes unresolved sentinel + if ident.Obj == nil { + p.unresolved[i] = ident + i++ + } + } + + return &ast.File{ + Doc: doc, + Package: pos, + Name: ident, + Decls: decls, + Scope: p.pkgScope, + Imports: p.imports, + Unresolved: p.unresolved[0:i], + Comments: p.comments, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/parser/quote.go b/vendor/github.com/cosmos72/gomacro/parser/quote.go new file mode 100644 index 0000000..a5b1450 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/parser/quote.go @@ -0,0 +1,192 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package parser implements a parser for Go source files. Input may be +// provided in a variety of forms (see the various Parse* functions); the +// output is an abstract syntax tree (AST) representing the Go source. The +// parser is invoked through one of the Parse* functions. +// +// The parser accepts a larger language than is syntactically permitted by +// the Go spec, for simplicity, and for improved robustness in the presence +// of syntax errors. For instance, in method declarations, the receiver is +// treated like an ordinary parameter list and thus may contain multiple +// entries where the spec permits exactly one. Consequently, the corresponding +// field in the AST (ast.FuncDecl.Recv) field is not restricted to one entry. +// +package parser + +import ( + "fmt" + "go/ast" + "go/token" + + mt "github.com/cosmos72/gomacro/token" +) + +// patch: quote and friends +func (p *parser) parseQuote() ast.Expr { + if p.trace { + defer un(trace(p, "Quote")) + } + + op := p.tok + opPos := p.pos + opName := mt.String(op) // use the actual name QUOTE/QUASIQUOTE/UNQUOTE/UNQUOTE_SPLICE even if we found ~' ~` ~, ~,@ + p.next() + + var node ast.Node + + // QUOTE, QUASIQUOTE, UNQUOTE and UNQUOTE_SLICE must be followed by one of: + // * a basic literal + // * an identifier + // * a block statement + // * another QUOTE, QUASIQUOTE or UNQUOTE (not UNQUOTE_SPLICE, it must be wrapped in {}) + switch p.tok { + case token.EOF, token.RPAREN, token.RBRACK, token.RBRACE, + token.COMMA, token.PERIOD, token.SEMICOLON, token.COLON: + + // no applicable expression after QUOTE/QUASIQUOTE/...: just return the keyword itself + return &ast.Ident{NamePos: opPos, Name: opName} + + case token.IDENT: + node = &ast.Ident{NamePos: p.pos, Name: p.lit} + p.next() + + case token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING: + node = &ast.BasicLit{ValuePos: p.pos, Kind: p.tok, Value: p.lit} + p.next() + + case mt.QUOTE, mt.QUASIQUOTE, mt.UNQUOTE, mt.UNQUOTE_SPLICE: + node = p.parseQuote() + + case token.LBRACE: + node = p.parseBlockStmtQuoted() + + default: + p.errorExpected(p.pos, "one of: '{', 'IDENT', 'INT', 'STRING', 'QUOTE', 'QUASIQUOTE', 'UNQUOTE' or 'UNQUOTE_SPLICE'") + } + + expr, _ := MakeQuote(p, op, opPos, node) + return expr +} + +func (p *parser) parseBlockStmtQuoted() *ast.BlockStmt { + if p.trace { + defer un(trace(p, "BlockStmtQuoted")) + } + + lbrace := p.expect(token.LBRACE) + p.openScope() + list := p.parseStmtListQuoted() + p.closeScope() + rbrace := p.expect(token.RBRACE) + + return &ast.BlockStmt{Lbrace: lbrace, List: list, Rbrace: rbrace} +} + +func (p *parser) parseStmtListQuoted() (list []ast.Stmt) { + if p.trace { + defer un(trace(p, "StatementListQuoted")) + } + + var stmt ast.Stmt + for p.tok != token.RBRACE && p.tok != token.EOF { + if p.tok == mt.TYPECASE { + stmt = p.parseCaseClause(true) + } else if p.tok == token.CASE || p.tok == token.DEFAULT { + stmt = p.parseCaseClause(false) + } else { + stmt = p.parseStmt() + } + list = append(list, stmt) + } + return +} + +// MakeQuote creates an ast.UnaryExpr representing quote{node}. +// Returns both the unaryexpr and the blockstmt containing its body +func MakeQuote(p_or_nil *parser, op token.Token, pos token.Pos, node ast.Node) (*ast.UnaryExpr, *ast.BlockStmt) { + var body *ast.BlockStmt + var stmt ast.Stmt + switch node := node.(type) { + case nil: + break + case *ast.BlockStmt: + body = node + case ast.Stmt: + stmt = node + case ast.Expr: + stmt = &ast.ExprStmt{X: node} + default: + msg := fmt.Sprintf("%v: expecting statement or expression, found %T %#v", op, node) + if p_or_nil != nil { + p_or_nil.error(node.Pos(), msg) + } else { + panic(msg) + } + } + if body == nil { + var pos, end token.Pos + list := make([]ast.Stmt, 0) + if stmt != nil { + list = append(list, stmt) + pos = stmt.Pos() + end = stmt.End() + } + body = &ast.BlockStmt{Lbrace: pos, List: list, Rbrace: end} + } + + // due to go/ast strictly typed model, there is only one mechanism + // to insert a statement inside an expression: use a closure. + // so we return a unary expression: QUOTE (func() { /*block*/ }) + typ := &ast.FuncType{Func: token.NoPos, Params: &ast.FieldList{}} + fun := &ast.FuncLit{Type: typ, Body: body} + return &ast.UnaryExpr{OpPos: pos, Op: op, X: fun}, body +} + +/* +// macro calls syntax is "foo ; bar ; baz"... recognize it +func (p *parser) expectSemiOrSpace() { + // semicolon is optional before a closing ')' or '}' + // make it optional also between identifiers and literals. + // allows to write {macro arg1 arg2} instead of the heavy {macro; arg1; arg2} + switch p.tok { + case token.RPAREN, token.RBRACK, token.RBRACE: + break + case token.COMMA: + // permit a ',' instead of a ';' but complain + p.errorExpected(p.pos, "';'") + fallthrough + case token.SEMICOLON: + p.next() + case token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING: + switch p.tok0 { + case token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING: + return + } + fallthrough + default: + p.errorExpected(p.pos, "';'") + syncStmt(p) + } +} +*/ + +// parseExprBlock parses a block statement inside an expression. +func (p *parser) parseExprBlock() ast.Expr { + if p.trace { + defer un(trace(p, "ExprBlock")) + } + + pos := p.pos + block := p.parseBlockStmt() + + // due to go/ast strictly typed model, there is only one mechanism + // to insert a block statement (or any statement) inside an expression: + // use a closure. so we return the unary expression: + // MACRO func() { /*block*/ } + typ := &ast.FuncType{Params: &ast.FieldList{}} + fun := &ast.FuncLit{Type: typ, Body: block} + return &ast.UnaryExpr{OpPos: pos, Op: mt.MACRO, X: fun} +} diff --git a/vendor/github.com/cosmos72/gomacro/parser/x_package.go b/vendor/github.com/cosmos72/gomacro/parser/x_package.go new file mode 100644 index 0000000..f7e8dd8 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/parser/x_package.go @@ -0,0 +1,31 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/parser" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package parser + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/parser" +func init() { + imports.Packages["github.com/cosmos72/gomacro/parser"] = imports.Package{ + Binds: map[string]r.Value{ + "AllErrors": r.ValueOf(AllErrors), + "DeclarationErrors": r.ValueOf(DeclarationErrors), + "ImportsOnly": r.ValueOf(ImportsOnly), + "MakeQuote": r.ValueOf(MakeQuote), + "PackageClauseOnly": r.ValueOf(PackageClauseOnly), + "ParseComments": r.ValueOf(ParseComments), + "SpuriousErrors": r.ValueOf(SpuriousErrors), + "Trace": r.ValueOf(Trace), + }, Types: map[string]r.Type{ + "Mode": r.TypeOf((*Mode)(nil)).Elem(), + "Parser": r.TypeOf((*Parser)(nil)).Elem(), + }, Wrappers: map[string][]string{ + "Parser": []string{"Configure", "Init", "Parse"}, + }, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/scanner/LICENSE b/vendor/github.com/cosmos72/gomacro/scanner/LICENSE new file mode 100644 index 0000000..6a66aea --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/scanner/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/cosmos72/gomacro/scanner/errors.go b/vendor/github.com/cosmos72/gomacro/scanner/errors.go new file mode 100644 index 0000000..bf7bfa3 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/scanner/errors.go @@ -0,0 +1,124 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package scanner + +import ( + "fmt" + "go/token" + "io" + "sort" +) + +// In an ErrorList, an error is represented by an *Error. +// The position Pos, if valid, points to the beginning of +// the offending token, and the error condition is described +// by Msg. +// +type Error struct { + Pos token.Position + Msg string +} + +// Error implements the error interface. +func (e Error) Error() string { + if e.Pos.Filename != "" || e.Pos.IsValid() { + // don't print "" + // TODO(gri) reconsider the semantics of Position.IsValid + return e.Pos.String() + ": " + e.Msg + } + return e.Msg +} + +// ErrorList is a list of *Errors. +// The zero value for an ErrorList is an empty ErrorList ready to use. +// +type ErrorList []*Error + +// Add adds an Error with given position and error message to an ErrorList. +func (p *ErrorList) Add(pos token.Position, msg string) { + *p = append(*p, &Error{pos, msg}) +} + +// Reset resets an ErrorList to no errors. +func (p *ErrorList) Reset() { *p = (*p)[0:0] } + +// ErrorList implements the sort Interface. +func (p ErrorList) Len() int { return len(p) } +func (p ErrorList) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +func (p ErrorList) Less(i, j int) bool { + e := &p[i].Pos + f := &p[j].Pos + // Note that it is not sufficient to simply compare file offsets because + // the offsets do not reflect modified line information (through //line + // comments). + if e.Filename != f.Filename { + return e.Filename < f.Filename + } + if e.Line != f.Line { + return e.Line < f.Line + } + if e.Column != f.Column { + return e.Column < f.Column + } + return p[i].Msg < p[j].Msg +} + +// Sort sorts an ErrorList. *Error entries are sorted by position, +// other errors are sorted by error message, and before any *Error +// entry. +// +func (p ErrorList) Sort() { + sort.Sort(p) +} + +// RemoveMultiples sorts an ErrorList and removes all but the first error per line. +func (p *ErrorList) RemoveMultiples() { + sort.Sort(p) + var last token.Position // initial last.Line is != any legal error line + i := 0 + for _, e := range *p { + if e.Pos.Filename != last.Filename || e.Pos.Line != last.Line { + last = e.Pos + (*p)[i] = e + i++ + } + } + (*p) = (*p)[0:i] +} + +// An ErrorList implements the error interface. +func (p ErrorList) Error() string { + switch len(p) { + case 0: + return "no errors" + case 1: + return p[0].Error() + } + return fmt.Sprintf("%s (and %d more errors)", p[0], len(p)-1) +} + +// Err returns an error equivalent to this error list. +// If the list is empty, Err returns nil. +func (p ErrorList) Err() error { + if len(p) == 0 { + return nil + } + return p +} + +// PrintError is a utility function that prints a list of errors to w, +// one error per line, if the err parameter is an ErrorList. Otherwise +// it prints the err string. +// +func PrintError(w io.Writer, err error) { + if list, ok := err.(ErrorList); ok { + for _, e := range list { + fmt.Fprintf(w, "%s\n", e) + } + } else if err != nil { + fmt.Fprintf(w, "%s\n", err) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/scanner/scanner.diffs b/vendor/github.com/cosmos72/gomacro/scanner/scanner.diffs new file mode 100644 index 0000000..94e6620 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/scanner/scanner.diffs @@ -0,0 +1,125 @@ +--- /usr/local/go/src/go/scanner/scanner.go 2017-02-16 19:27:47.000000000 +0000 ++++ scanner.go 2017-04-02 13:54:30.000000000 +0000 +@@ -16,6 +16,8 @@ + "strconv" + "unicode" + "unicode/utf8" ++ ++ mt "github.com/cosmos72/gomacro/token" + ) + + // An ErrorHandler may be provided to Scanner.Init. If a syntax error is +@@ -31,11 +33,12 @@ + // + type Scanner struct { + // immutable state +- file *token.File // source file handle +- dir string // directory portion of file.Name() +- src []byte // source +- err ErrorHandler // error reporting; or nil +- mode Mode // scanning mode ++ file *token.File // source file handle ++ dir string // directory portion of file.Name() ++ src []byte // source ++ err ErrorHandler // error reporting; or nil ++ mode Mode // scanning mode ++ specialChar rune // prefix of interpreter quoting symbols ' ` , ,@ + + // scanning state + ch rune // current character +@@ -110,7 +113,7 @@ + // Note that Init may call err if there is an error in the first character + // of the file. + // +-func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode) { ++func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode, specialChar rune) { + // Explicitly initialize all fields since a scanner may be reused. + if file.Size() != len(src) { + panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src))) +@@ -120,6 +123,7 @@ + s.src = src + s.err = err + s.mode = mode ++ s.specialChar = specialChar + + s.ch = ' ' + s.offset = 0 +@@ -613,7 +617,7 @@ + lit = s.scanIdentifier() + if len(lit) > 1 { + // keywords are longer than one letter - avoid lookup otherwise +- tok = token.Lookup(lit) ++ tok = mt.Lookup(lit) // patch: support macro, quote and friends + switch tok { + case token.IDENT, token.BREAK, token.CONTINUE, token.FALLTHROUGH, token.RETURN: + insertSemi = true +@@ -699,8 +703,14 @@ + } + case '*': + tok = s.switch2(token.MUL, token.MUL_ASSIGN) +- case '/': +- if s.ch == '/' || s.ch == '*' { ++ case '/', '#': ++ if ch == '/' && (s.ch == '/' || s.ch == '*') || ch == '#' && s.ch == '!' { ++ // accept both #! and // as line comments ++ // in this way, *.gomacro files can start with "#!/usr/bin/env gomacro" ++ // Unix-like systems will happily execute them directly ++ if s.ch == '!' { ++ s.ch = '/' ++ } + // comment + if s.insertSemi && s.findLineEnd() { + // reset position to the beginning of the comment +@@ -718,8 +728,13 @@ + } + tok = token.COMMENT + lit = comment +- } else { ++ } else if ch == '/' { + tok = s.switch2(token.QUO, token.QUO_ASSIGN) ++ } else { ++ s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch)) ++ insertSemi = s.insertSemi // preserve insertSemi info ++ tok = token.ILLEGAL ++ lit = string(ch) + } + case '%': + tok = s.switch2(token.REM, token.REM_ASSIGN) +@@ -747,6 +762,37 @@ + } + case '|': + tok = s.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR) ++ case '@': ++ // patch: support macro, quote and friends ++ tok = mt.SPLICE ++ case s.specialChar: ++ // patch: support macro, quote and friends. s.specialChar is configurable, default is '~' ++ // quote specialChar ' ++ // quasiquote specialChar ` ++ // unquote specialChar , ++ // unquote_splice specialChar ,@ ++ switch s.ch { ++ case '\'': ++ s.next() ++ tok = mt.QUOTE ++ case '`': ++ s.next() ++ tok = mt.QUASIQUOTE ++ case ',': ++ s.next() ++ if s.ch == '@' { ++ s.next() ++ tok = mt.UNQUOTE_SPLICE ++ } else { ++ tok = mt.UNQUOTE ++ } ++ default: ++ tok = token.ILLEGAL ++ } ++ if tok != token.ILLEGAL { ++ break ++ } ++ fallthrough + default: + // next reports unexpected BOMs - don't repeat + if ch != bom { diff --git a/vendor/github.com/cosmos72/gomacro/scanner/scanner.go b/vendor/github.com/cosmos72/gomacro/scanner/scanner.go new file mode 100644 index 0000000..0799953 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/scanner/scanner.go @@ -0,0 +1,813 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package scanner implements a scanner for Go source text. +// It takes a []byte as source which can then be tokenized +// through repeated calls to the Scan method. +// +package scanner + +import ( + "bytes" + "fmt" + "go/token" + "path/filepath" + "strconv" + "unicode" + "unicode/utf8" + + mt "github.com/cosmos72/gomacro/token" +) + +// An ErrorHandler may be provided to Scanner.Init. If a syntax error is +// encountered and a handler was installed, the handler is called with a +// position and an error message. The position points to the beginning of +// the offending token. +// +type ErrorHandler func(pos token.Position, msg string) + +// A Scanner holds the scanner's internal state while processing +// a given text. It can be allocated as part of another data +// structure but must be initialized via Init before use. +// +type Scanner struct { + // immutable state + file *mt.File // source file handle + dir string // directory portion of file.Name() + src []byte // source + err ErrorHandler // error reporting; or nil + mode Mode // scanning mode + + specialChar rune // prefix of macro-related keywords and symbols ' ` , ,@ + + // scanning state + ch rune // current character + offset int // character offset + rdOffset int // reading offset (position after current character) + lineOffset int // current line offset + insertSemi bool // insert a semicolon before next newline + + // public state - ok to modify + ErrorCount int // number of errors encountered +} + +const bom = 0xFEFF // byte order mark, only permitted as very first character + +// Read the next Unicode char into s.ch. +// s.ch < 0 means end-of-file. +// +func (s *Scanner) next() { + if s.rdOffset < len(s.src) { + s.offset = s.rdOffset + if s.ch == '\n' { + s.lineOffset = s.offset + s.file.AddLine(s.offset) + } + r, w := rune(s.src[s.rdOffset]), 1 + switch { + case r == 0: + s.error(s.offset, "illegal character NUL") + case r >= utf8.RuneSelf: + // not ASCII + r, w = utf8.DecodeRune(s.src[s.rdOffset:]) + if r == utf8.RuneError && w == 1 { + s.error(s.offset, "illegal UTF-8 encoding") + } else if r == bom && s.offset > 0 { + s.error(s.offset, "illegal byte order mark") + } + } + s.rdOffset += w + s.ch = r + } else { + s.offset = len(s.src) + if s.ch == '\n' { + s.lineOffset = s.offset + s.file.AddLine(s.offset) + } + s.ch = -1 // eof + } +} + +// A mode value is a set of flags (or 0). +// They control scanner behavior. +// +type Mode uint + +const ( + ScanComments Mode = 1 << iota // return comments as COMMENT tokens + dontInsertSemis // do not automatically insert semicolons - for testing only +) + +// Init prepares the scanner s to tokenize the text src by setting the +// scanner at the beginning of src. The scanner uses the file set file +// for position information and it adds line information for each line. +// It is ok to re-use the same file when re-scanning the same file as +// line information which is already present is ignored. Init causes a +// panic if the file size does not match the src size. +// +// Calls to Scan will invoke the error handler err if they encounter a +// syntax error and err is not nil. Also, for each error encountered, +// the Scanner field ErrorCount is incremented by one. The mode parameter +// determines how comments are handled. +// +// Note that Init may call err if there is an error in the first character +// of the file. +// +func (s *Scanner) Init(file *mt.File, src []byte, err ErrorHandler, mode Mode, specialChar rune) { + // Explicitly initialize all fields since a scanner may be reused. + if file.Size() != len(src) { + panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src))) + } + s.file = file + s.dir, _ = filepath.Split(file.Name()) + s.src = src + s.err = err + s.mode = mode + s.specialChar = specialChar + + s.ch = ' ' + s.offset = 0 + s.rdOffset = 0 + s.lineOffset = 0 + s.insertSemi = false + s.ErrorCount = 0 + + s.next() + if s.ch == bom { + s.next() // ignore BOM at file beginning + } +} + +func (s *Scanner) error(offs int, msg string) { + if s.err != nil { + s.err(s.file.Position(s.file.Pos(offs)), msg) + } + s.ErrorCount++ +} + +var prefix = []byte("//line ") + +func (s *Scanner) interpretLineComment(text []byte) { + if bytes.HasPrefix(text, prefix) { + // get filename and line number, if any + if i := bytes.LastIndex(text, []byte{':'}); i > 0 { + if line, err := strconv.Atoi(string(text[i+1:])); err == nil && line > 0 { + // valid //line filename:line comment + filename := string(bytes.TrimSpace(text[len(prefix):i])) + if filename != "" { + filename = filepath.Clean(filename) + if !filepath.IsAbs(filename) { + // make filename relative to current directory + filename = filepath.Join(s.dir, filename) + } + } + // update scanner position + s.file.AddLineInfo(s.lineOffset+len(text)+1, filename, line) // +len(text)+1 since comment applies to next line + } + } + } +} + +func (s *Scanner) scanComment() string { + // initial '/' already consumed; s.ch == '/' || s.ch == '*' + offs := s.offset - 1 // position of initial '/' + hasCR := false + + if s.ch == '/' { + //-style comment + s.next() + for s.ch != '\n' && s.ch >= 0 { + if s.ch == '\r' { + hasCR = true + } + s.next() + } + if offs == s.lineOffset { + // comment starts at the beginning of the current line + s.interpretLineComment(s.src[offs:s.offset]) + } + goto exit + } + + /*-style comment */ + s.next() + for s.ch >= 0 { + ch := s.ch + if ch == '\r' { + hasCR = true + } + s.next() + if ch == '*' && s.ch == '/' { + s.next() + goto exit + } + } + + s.error(offs, "comment not terminated") + +exit: + lit := s.src[offs:s.offset] + if hasCR { + lit = stripCR(lit) + } + + return string(lit) +} + +func (s *Scanner) findLineEnd() bool { + // initial '/' already consumed + + defer func(offs int) { + // reset scanner state to where it was upon calling findLineEnd + s.ch = '/' + s.offset = offs + s.rdOffset = offs + 1 + s.next() // consume initial '/' again + }(s.offset - 1) + + // read ahead until a newline, EOF, or non-comment token is found + for s.ch == '/' || s.ch == '*' { + if s.ch == '/' { + //-style comment always contains a newline + return true + } + /*-style comment: look for newline */ + s.next() + for s.ch >= 0 { + ch := s.ch + if ch == '\n' { + return true + } + s.next() + if ch == '*' && s.ch == '/' { + s.next() + break + } + } + s.skipWhitespace() // s.insertSemi is set + if s.ch < 0 || s.ch == '\n' { + return true + } + if s.ch != '/' { + // non-comment token + return false + } + s.next() // consume '/' + } + + return false +} + +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) +} + +func isDigit(ch rune) bool { + return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) +} + +func (s *Scanner) scanIdentifier() string { + offs := s.offset + for isLetter(s.ch) || isDigit(s.ch) { + s.next() + } + return string(s.src[offs:s.offset]) +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch - '0') + case 'a' <= ch && ch <= 'f': + return int(ch - 'a' + 10) + case 'A' <= ch && ch <= 'F': + return int(ch - 'A' + 10) + } + return 16 // larger than any legal digit val +} + +func (s *Scanner) scanMantissa(base int) { + for digitVal(s.ch) < base { + s.next() + } +} + +func (s *Scanner) scanNumber(seenDecimalPoint bool) (token.Token, string) { + // digitVal(s.ch) < 10 + offs := s.offset + tok := token.INT + + if seenDecimalPoint { + offs-- + tok = token.FLOAT + s.scanMantissa(10) + goto exponent + } + + if s.ch == '0' { + // int or float + offs := s.offset + s.next() + if s.ch == 'x' || s.ch == 'X' { + // hexadecimal int + s.next() + s.scanMantissa(16) + if s.offset-offs <= 2 { + // only scanned "0x" or "0X" + s.error(offs, "illegal hexadecimal number") + } + } else { + // octal int or float + seenDecimalDigit := false + s.scanMantissa(8) + if s.ch == '8' || s.ch == '9' { + // illegal octal int or float + seenDecimalDigit = true + s.scanMantissa(10) + } + if s.ch == '.' || s.ch == 'e' || s.ch == 'E' || s.ch == 'i' { + goto fraction + } + // octal int + if seenDecimalDigit { + s.error(offs, "illegal octal number") + } + } + goto exit + } + + // decimal int or float + s.scanMantissa(10) + +fraction: + if s.ch == '.' { + tok = token.FLOAT + s.next() + s.scanMantissa(10) + } + +exponent: + if s.ch == 'e' || s.ch == 'E' { + tok = token.FLOAT + s.next() + if s.ch == '-' || s.ch == '+' { + s.next() + } + if digitVal(s.ch) < 10 { + s.scanMantissa(10) + } else { + s.error(offs, "illegal floating-point exponent") + } + } + + if s.ch == 'i' { + tok = token.IMAG + s.next() + } + +exit: + return tok, string(s.src[offs:s.offset]) +} + +// scanEscape parses an escape sequence where rune is the accepted +// escaped quote. In case of a syntax error, it stops at the offending +// character (without consuming it) and returns false. Otherwise +// it returns true. +func (s *Scanner) scanEscape(quote rune) bool { + offs := s.offset + + var n int + var base, max uint32 + switch s.ch { + case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', quote: + s.next() + return true + case '0', '1', '2', '3', '4', '5', '6', '7': + n, base, max = 3, 8, 255 + case 'x': + s.next() + n, base, max = 2, 16, 255 + case 'u': + s.next() + n, base, max = 4, 16, unicode.MaxRune + case 'U': + s.next() + n, base, max = 8, 16, unicode.MaxRune + default: + msg := "unknown escape sequence" + if s.ch < 0 { + msg = "escape sequence not terminated" + } + s.error(offs, msg) + return false + } + + var x uint32 + for n > 0 { + d := uint32(digitVal(s.ch)) + if d >= base { + msg := fmt.Sprintf("illegal character %#U in escape sequence", s.ch) + if s.ch < 0 { + msg = "escape sequence not terminated" + } + s.error(s.offset, msg) + return false + } + x = x*base + d + s.next() + n-- + } + + if x > max || 0xD800 <= x && x < 0xE000 { + s.error(offs, "escape sequence is invalid Unicode code point") + return false + } + + return true +} + +func (s *Scanner) scanRune() string { + // '\'' opening already consumed + offs := s.offset - 1 + + valid := true + n := 0 + for { + ch := s.ch + if ch == '\n' || ch < 0 { + // only report error if we don't have one already + if valid { + s.error(offs, "rune literal not terminated") + valid = false + } + break + } + s.next() + if ch == '\'' { + break + } + n++ + if ch == '\\' { + if !s.scanEscape('\'') { + valid = false + } + // continue to read to closing quote + } + } + + if valid && n != 1 { + s.error(offs, "illegal rune literal") + } + + return string(s.src[offs:s.offset]) +} + +func (s *Scanner) scanString() string { + // '"' opening already consumed + offs := s.offset - 1 + + for { + ch := s.ch + if ch == '\n' || ch < 0 { + s.error(offs, "string literal not terminated") + break + } + s.next() + if ch == '"' { + break + } + if ch == '\\' { + s.scanEscape('"') + } + } + + return string(s.src[offs:s.offset]) +} + +func stripCR(b []byte) []byte { + c := make([]byte, len(b)) + i := 0 + for _, ch := range b { + if ch != '\r' { + c[i] = ch + i++ + } + } + return c[:i] +} + +func (s *Scanner) scanRawString() string { + // '`' opening already consumed + offs := s.offset - 1 + + hasCR := false + for { + ch := s.ch + if ch < 0 { + s.error(offs, "raw string literal not terminated") + break + } + s.next() + if ch == '`' { + break + } + if ch == '\r' { + hasCR = true + } + } + + lit := s.src[offs:s.offset] + if hasCR { + lit = stripCR(lit) + } + + return string(lit) +} + +func (s *Scanner) skipWhitespace() { + for s.ch == ' ' || s.ch == '\t' || s.ch == '\n' && !s.insertSemi || s.ch == '\r' { + s.next() + } +} + +// Helper functions for scanning multi-byte tokens such as >> += >>= . +// Different routines recognize different length tok_i based on matches +// of ch_i. If a token ends in '=', the result is tok1 or tok3 +// respectively. Otherwise, the result is tok0 if there was no other +// matching character, or tok2 if the matching character was ch2. + +func (s *Scanner) switch2(tok0, tok1 token.Token) token.Token { + if s.ch == '=' { + s.next() + return tok1 + } + return tok0 +} + +func (s *Scanner) switch3(tok0, tok1 token.Token, ch2 rune, tok2 token.Token) token.Token { + if s.ch == '=' { + s.next() + return tok1 + } + if s.ch == ch2 { + s.next() + return tok2 + } + return tok0 +} + +func (s *Scanner) switch4(tok0, tok1 token.Token, ch2 rune, tok2, tok3 token.Token) token.Token { + if s.ch == '=' { + s.next() + return tok1 + } + if s.ch == ch2 { + s.next() + if s.ch == '=' { + s.next() + return tok3 + } + return tok2 + } + return tok0 +} + +// Scan scans the next token and returns the token position, the token, +// and its literal string if applicable. The source end is indicated by +// token.EOF. +// +// If the returned token is a literal (token.IDENT, token.INT, token.FLOAT, +// token.IMAG, token.CHAR, token.STRING) or token.COMMENT, the literal string +// has the corresponding value. +// +// If the returned token is a keyword, the literal string is the keyword. +// +// If the returned token is token.SEMICOLON, the corresponding +// literal string is ";" if the semicolon was present in the source, +// and "\n" if the semicolon was inserted because of a newline or +// at EOF. +// +// If the returned token is token.ILLEGAL, the literal string is the +// offending character. +// +// In all other cases, Scan returns an empty literal string. +// +// For more tolerant parsing, Scan will return a valid token if +// possible even if a syntax error was encountered. Thus, even +// if the resulting token sequence contains no illegal tokens, +// a client may not assume that no error occurred. Instead it +// must check the scanner's ErrorCount or the number of calls +// of the error handler, if there was one installed. +// +// Scan adds line information to the file added to the file +// set with Init. Token positions are relative to that file +// and thus relative to the file set. +// +func (s *Scanner) Scan() (pos token.Pos, tok token.Token, lit string) { +scanAgain: + s.skipWhitespace() + + // current token start + pos = s.file.Pos(s.offset) + + // determine token value + insertSemi := false + switch ch := s.ch; { + case isLetter(ch): + lit = s.scanIdentifier() + if len(lit) > 1 { + // keywords are longer than one letter - avoid lookup otherwise + tok = mt.Lookup(lit) + switch tok { + case token.IDENT, token.BREAK, token.CONTINUE, token.FALLTHROUGH, token.RETURN: + insertSemi = true + } + } else { + insertSemi = true + tok = token.IDENT + } + case '0' <= ch && ch <= '9': + insertSemi = true + tok, lit = s.scanNumber(false) + default: + s.next() // always make progress + switch ch { + case -1: + if s.insertSemi { + s.insertSemi = false // EOF consumed + return pos, token.SEMICOLON, "\n" + } + tok = token.EOF + case '\n': + // we only reach here if s.insertSemi was + // set in the first place and exited early + // from s.skipWhitespace() + s.insertSemi = false // newline consumed + return pos, token.SEMICOLON, "\n" + case '"': + insertSemi = true + tok = token.STRING + lit = s.scanString() + case '\'': + insertSemi = true + tok = token.CHAR + lit = s.scanRune() + case '`': + insertSemi = true + tok = token.STRING + lit = s.scanRawString() + case ':': + tok = s.switch2(token.COLON, token.DEFINE) + case '.': + if '0' <= s.ch && s.ch <= '9' { + insertSemi = true + tok, lit = s.scanNumber(true) + } else if s.ch == '.' { + s.next() + if s.ch == '.' { + s.next() + tok = token.ELLIPSIS + } + } else { + tok = token.PERIOD + } + case ',': + tok = token.COMMA + case ';': + tok = token.SEMICOLON + lit = ";" + case '(': + tok = token.LPAREN + case ')': + insertSemi = true + tok = token.RPAREN + case '[': + tok = token.LBRACK + case ']': + insertSemi = true + tok = token.RBRACK + case '{': + tok = token.LBRACE + case '}': + insertSemi = true + tok = token.RBRACE + case '+': + tok = s.switch3(token.ADD, token.ADD_ASSIGN, '+', token.INC) + if tok == token.INC { + insertSemi = true + } + case '-': + tok = s.switch3(token.SUB, token.SUB_ASSIGN, '-', token.DEC) + if tok == token.DEC { + insertSemi = true + } + case '*': + tok = s.switch2(token.MUL, token.MUL_ASSIGN) + case '/', '#': + if ch == '/' && (s.ch == '/' || s.ch == '*') || ch == '#' && s.ch == '!' { + // accept both #! and // as line comments + // in this way, *.gomacro files can start with "#!/usr/bin/env gomacro" + // Unix-like systems will happily execute them directly + if s.ch == '!' { + s.ch = '/' + } + // comment + if s.insertSemi && s.findLineEnd() { + // reset position to the beginning of the comment + s.ch = '/' + s.offset = s.file.Offset(pos) + s.rdOffset = s.offset + 1 + s.insertSemi = false // newline consumed + return pos, token.SEMICOLON, "\n" + } + comment := s.scanComment() + if s.mode&ScanComments == 0 { + // skip comment + s.insertSemi = false // newline consumed + goto scanAgain + } + tok = token.COMMENT + lit = comment + } else if ch == '/' { + tok = s.switch2(token.QUO, token.QUO_ASSIGN) + } else { + s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch)) + insertSemi = s.insertSemi // preserve insertSemi info + tok = token.ILLEGAL + lit = string(ch) + } + case '%': + tok = s.switch2(token.REM, token.REM_ASSIGN) + case '^': + tok = s.switch2(token.XOR, token.XOR_ASSIGN) + case '<': + if s.ch == '-' { + s.next() + tok = token.ARROW + } else { + tok = s.switch4(token.LSS, token.LEQ, '<', token.SHL, token.SHL_ASSIGN) + } + case '>': + tok = s.switch4(token.GTR, token.GEQ, '>', token.SHR, token.SHR_ASSIGN) + case '=': + tok = s.switch2(token.ASSIGN, token.EQL) + case '!': + tok = s.switch2(token.NOT, token.NEQ) + case '&': + if s.ch == '^' { + s.next() + tok = s.switch2(token.AND_NOT, token.AND_NOT_ASSIGN) + } else { + tok = s.switch3(token.AND, token.AND_ASSIGN, '&', token.LAND) + } + case '|': + tok = s.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR) + case '@': + // patch: support macro, quote and friends + tok = mt.SPLICE + case s.specialChar: + // patch: support macro, quote and friends. s.specialChar is configurable, default is '~' + // quote specialChar ' + // quasiquote specialChar ` + // unquote specialChar , + // unquote_splice specialChar ,@ + switch s.ch { + case '\'': + s.next() + tok = mt.QUOTE + case '`', '"': // accept both ~` and ~" as ~quasiquote, because ~` confuses syntax hilighting in IDEs + s.next() + tok = mt.QUASIQUOTE + case ',': + s.next() + if s.ch == '@' { + s.next() + tok = mt.UNQUOTE_SPLICE + } else { + tok = mt.UNQUOTE + } + default: + lit = s.scanIdentifier() + tok = mt.LookupSpecial(lit) + if tok == token.ILLEGAL { + s.error(s.file.Offset(pos), fmt.Sprintf("expecting macro-related keyword after '%c', found '%c%s'", s.specialChar, s.specialChar, lit)) + insertSemi = s.insertSemi // preserve insertSemi info + } + } + default: + // next reports unexpected BOMs - don't repeat + if ch != bom { + s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch)) + } + insertSemi = s.insertSemi // preserve insertSemi info + tok = token.ILLEGAL + lit = string(ch) + } + } + if s.mode&dontInsertSemis == 0 { + s.insertSemi = insertSemi + } + + return +} diff --git a/vendor/github.com/cosmos72/gomacro/scanner/x_package.go b/vendor/github.com/cosmos72/gomacro/scanner/x_package.go new file mode 100644 index 0000000..9038cae --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/scanner/x_package.go @@ -0,0 +1,27 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/scanner" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package scanner + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/scanner" +func init() { + imports.Packages["github.com/cosmos72/gomacro/scanner"] = imports.Package{ + Binds: map[string]r.Value{ + "PrintError": r.ValueOf(PrintError), + "ScanComments": r.ValueOf(ScanComments), + }, + Types: map[string]r.Type{ + "Error": r.TypeOf((*Error)(nil)).Elem(), + "ErrorHandler": r.TypeOf((*ErrorHandler)(nil)).Elem(), + "ErrorList": r.TypeOf((*ErrorList)(nil)).Elem(), + "Mode": r.TypeOf((*Mode)(nil)).Elem(), + "Scanner": r.TypeOf((*Scanner)(nil)).Elem(), + }, + Proxies: map[string]r.Type{}} +} diff --git a/vendor/github.com/cosmos72/gomacro/token/LICENSE b/vendor/github.com/cosmos72/gomacro/token/LICENSE new file mode 100644 index 0000000..6a66aea --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/token/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/cosmos72/gomacro/token/fileset.go b/vendor/github.com/cosmos72/gomacro/token/fileset.go new file mode 100644 index 0000000..be15815 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/token/fileset.go @@ -0,0 +1,98 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package token + +import ( + "go/token" +) + +// ----------------------------------------------------------------------------- +// File + +// A File is a handle for a file belonging to a FileSet. +// A File has a name, size, and line offset table. +// +type File struct { + *token.File + line int // starting line of this file +} + +// PositionFor returns the Position value for the given file position p. +// If adjusted is set, the position may be adjusted by position-altering +// //line comments; otherwise those comments are ignored. +// p must be a Pos value in f or NoPos. +// +func (f *File) PositionFor(p token.Pos, adjusted bool) (pos token.Position) { + pos = f.File.PositionFor(p, adjusted) + if pos.IsValid() { + pos.Line += f.line + } + return pos +} + +// Position returns the Position value for the given file position p. +// Calling f.Position(p) is equivalent to calling f.PositionFor(p, true). +// +func (f *File) Position(p token.Pos) (pos token.Position) { + return f.PositionFor(p, true) +} + +// ----------------------------------------------------------------------------- +// FileSet + +// A FileSet represents a set of source files. +// This is a wrapper for go/token.FileSet that adds a starting line offset to each file in the set +// +type FileSet struct { + token.FileSet + filemap map[*token.File]*File +} + +// NewFileSet creates a new file set. +func NewFileSet() *FileSet { + return &FileSet{ + FileSet: *token.NewFileSet(), + filemap: make(map[*token.File]*File), + } +} + +// AddFile adds a new file with a given filename, base offset, and file size +func (s *FileSet) AddFile(filename string, base, size, line int) *File { + innerf := s.FileSet.AddFile(filename, base, size) + f := &File{File: innerf, line: line} + s.filemap[innerf] = f + return f +} + +// File returns the file that contains the position p. +// If no such file is found (for instance for p == NoPos), +// the result is nil. +// +func (s *FileSet) File(p token.Pos) (f *File) { + if p != token.NoPos { + innerf := s.FileSet.File(p) + f = s.filemap[innerf] + } + return +} + +// PositionFor converts a Pos p in the fileset into a Position value. +// If adjusted is set, the position may be adjusted by position-altering +// //line comments; otherwise those comments are ignored. +// p must be a Pos value in s or NoPos. +// +func (s *FileSet) PositionFor(p token.Pos, adjusted bool) (pos token.Position) { + if f := s.File(p); f != nil { + pos = f.PositionFor(p, adjusted) + } + return +} + +// Position converts a Pos p in the fileset into a Position value. +// Calling s.Position(p) is equivalent to calling s.PositionFor(p, true). +// +func (s *FileSet) Position(p token.Pos) (pos token.Position) { + return s.PositionFor(p, true) +} diff --git a/vendor/github.com/cosmos72/gomacro/token/token.go b/vendor/github.com/cosmos72/gomacro/token/token.go new file mode 100644 index 0000000..2c37cd1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/token/token.go @@ -0,0 +1,102 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package token defines constants representing the lexical tokens of the Go +// programming language and basic operations on tokens (printing, predicates). +// +package token + +import ( + "go/token" + base "go/token" +) + +const ( + QUOTE base.Token = (base.VAR+127)&^127 + iota + QUASIQUOTE + UNQUOTE + UNQUOTE_SPLICE + SPLICE + MACRO + FUNCTION + LAMBDA + TYPECASE +) + +var tokens map[base.Token]string + +var keywords map[string]base.Token + +func init() { + tokens = map[base.Token]string{ + SPLICE: "~splice", + QUOTE: "~quote", + QUASIQUOTE: "~quasiquote", + UNQUOTE: "~unquote", + UNQUOTE_SPLICE: "~unquote_splice", + MACRO: "~macro", + FUNCTION: "~func", + LAMBDA: "~lambda", + TYPECASE: "~typecase", + } + + keywords = make(map[string]base.Token) + for k, v := range tokens { + keywords[v[1:]] = k // skip ~ in lookup table + } +} + +// Lookup maps a identifier to its keyword token. +func Lookup(lit string) base.Token { + if lit == "macro" { + // allow the spelling "macro" because "~macro" is really ugly in source code... + // especially when writing :~macro + return MACRO + } + return token.Lookup(lit) +} + +// LookupSpecial maps a identifier starting with '~' to its keyword token. +func LookupSpecial(lit string) base.Token { + tok, _ := keywords[lit] + return tok +} + +func String(tok base.Token) string { + if str, ok := tokens[tok]; ok { + return str + } + return tok.String() +} + +// Predicates + +// IsLiteral returns true for tokens corresponding to identifiers +// and basic type literals; it returns false otherwise. +// +func IsLiteral(tok base.Token) bool { + return tok.IsLiteral() +} + +// IsOperator returns true for tokens corresponding to operators and +// delimiters; it returns false otherwise. +// +func IsOperator(tok base.Token) bool { + return tok.IsOperator() +} + +// IsKeyword returns true for tokens corresponding to keywords; +// it returns false otherwise. +// +func IsKeyword(tok base.Token) bool { + return tok.IsKeyword() +} + +// IsMacroKeyword returns true for tokens corresponding to macro-related keywords; +// it returns false otherwise. +// +func IsMacroKeyword(tok base.Token) bool { + _, ok := tokens[tok] + return ok +} diff --git a/vendor/github.com/cosmos72/gomacro/token/x_package.go b/vendor/github.com/cosmos72/gomacro/token/x_package.go new file mode 100644 index 0000000..0941a8a --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/token/x_package.go @@ -0,0 +1,39 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/token" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package token + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/token" +func init() { + imports.Packages["github.com/cosmos72/gomacro/token"] = imports.Package{ + Binds: map[string]r.Value{ + "FUNCTION": r.ValueOf(FUNCTION), + "IsKeyword": r.ValueOf(IsKeyword), + "IsLiteral": r.ValueOf(IsLiteral), + "IsMacroKeyword": r.ValueOf(IsMacroKeyword), + "IsOperator": r.ValueOf(IsOperator), + "LAMBDA": r.ValueOf(LAMBDA), + "Lookup": r.ValueOf(Lookup), + "LookupSpecial": r.ValueOf(LookupSpecial), + "MACRO": r.ValueOf(MACRO), + "NewFileSet": r.ValueOf(NewFileSet), + "QUASIQUOTE": r.ValueOf(QUASIQUOTE), + "QUOTE": r.ValueOf(QUOTE), + "SPLICE": r.ValueOf(SPLICE), + "String": r.ValueOf(String), + "TYPECASE": r.ValueOf(TYPECASE), + "UNQUOTE": r.ValueOf(UNQUOTE), + "UNQUOTE_SPLICE": r.ValueOf(UNQUOTE_SPLICE), + }, + Types: map[string]r.Type{ + "File": r.TypeOf((*File)(nil)).Elem(), + "FileSet": r.TypeOf((*FileSet)(nil)).Elem(), + }, + Proxies: map[string]r.Type{}} +} diff --git a/vendor/github.com/cosmos72/gomacro/typeutil/LICENSE b/vendor/github.com/cosmos72/gomacro/typeutil/LICENSE new file mode 100644 index 0000000..6a66aea --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/typeutil/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/cosmos72/gomacro/typeutil/README.md b/vendor/github.com/cosmos72/gomacro/typeutil/README.md new file mode 100644 index 0000000..5f8cb4e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/typeutil/README.md @@ -0,0 +1,34 @@ +## typeutil - patched versions of `go/types.Identical` and `golang.org/x/tools/go/type/typeutil.Map` + +typeutil contains patched version of some Go utilities to handle `go/types.Type` + +1. an Identical() function with a stricter definition of type identity: + + * interfaces are considered identical only if they **print** equally, + so embedding an interface is **different** from copying its methods + (standard `go/types.Identical` intentionally does not distinguish + these two cases). Also, the order of methods and embedded interfaces + is relevant. + + * methods are considered identical only if their receiver, parameters + and results types are identical (standard `go/types.Identical` + intentionally ignores the receiver type) + +2. Map: a mapping from `go/types.Type` to `interface{}` values, + using the stricter definition of type identity defined above. + + Since `go/types.Type` are not canonical, i.e. not unique, comparing + them with == does not give the expected results, as explained in + https://github.com/golang/example/tree/master/gotypes#types + + So a specialized map is needed to use them as keys - either + `golang.org/x/tools/go/type/typeutil.Map`, or this patched version + `github.com/cosmos72/gomacro/typeutil/Map`, or something analogous + +They are useful as type canonicalizing tools for the Go interpreter gomacro, +and not necessarily suitable for other purpouses. + +## License + +BSD-3-Clause as the original, unpatched utilities. + diff --git a/vendor/github.com/cosmos72/gomacro/typeutil/map.go b/vendor/github.com/cosmos72/gomacro/typeutil/map.go new file mode 100644 index 0000000..66de1bb --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/typeutil/map.go @@ -0,0 +1,350 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package typeutil defines various utilities for types, such as Map, +// a mapping from types.Type to interface{} values. +package typeutil + +import ( + "bytes" + "fmt" + "go/types" + "reflect" +) + +// Map is a hash-table-based mapping from types (types.Type) to +// arbitrary interface{} values. The concrete types that implement +// the Type interface are pointers. Since they are not canonicalized, +// == cannot be used to check for equivalence, and thus we cannot +// simply use a Go map. +// +// Just as with map[K]V, a nil *Map is a valid empty map. +// +// Not thread-safe. +// +type Map struct { + hasher Hasher // shared by many Maps + table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused + length int // number of map entries +} + +// entry is an entry (key/value association) in a hash bucket. +type entry struct { + key types.Type + value interface{} +} + +// SetHasher sets the hasher used by Map. +// +// All Hashers are functionally equivalent but contain internal state +// used to cache the results of hashing previously seen types. +// +// A single Hasher created by MakeHasher() may be shared among many +// Maps. This is recommended if the instances have many keys in +// common, as it will amortize the cost of hash computation. +// +// A Hasher may grow without bound as new types are seen. Even when a +// type is deleted from the map, the Hasher never shrinks, since other +// types in the map may reference the deleted type indirectly. +// +// Hashers are not thread-safe, and read-only operations such as +// Map.Lookup require updates to the hasher, so a full Mutex lock (not a +// read-lock) is require around all Map operations if a shared +// hasher is accessed from multiple threads. +// +// If SetHasher is not called, the Map will create a private hasher at +// the first call to Insert. +// +func (m *Map) SetHasher(hasher Hasher) { + m.hasher = hasher +} + +// Delete removes the entry with the given key, if any. +// It returns true if the entry was found. +// +func (m *Map) Delete(key types.Type) bool { + if m != nil && m.table != nil { + hash := m.hasher.Hash(key) + bucket := m.table[hash] + for i, e := range bucket { + if e.key != nil && types.Identical(key, e.key) { + // We can't compact the bucket as it + // would disturb iterators. + bucket[i] = entry{} + m.length-- + return true + } + } + } + return false +} + +// At returns the map entry for the given key. +// The result is nil if the entry is not present. +// +func (m *Map) At(key types.Type) interface{} { + if m != nil && m.table != nil { + for _, e := range m.table[m.hasher.Hash(key)] { + if e.key != nil && Identical(key, e.key) { + return e.value + } + } + } + return nil +} + +// Set sets the map entry for key to val, +// and returns the previous entry, if any. +func (m *Map) Set(key types.Type, value interface{}) (prev interface{}) { + if m.table != nil { + hash := m.hasher.Hash(key) + bucket := m.table[hash] + var hole *entry + for i, e := range bucket { + if e.key == nil { + hole = &bucket[i] + } else if Identical(key, e.key) { + prev = e.value + bucket[i].value = value + return + } + } + + if hole != nil { + *hole = entry{key, value} // overwrite deleted entry + } else { + m.table[hash] = append(bucket, entry{key, value}) + } + } else { + if m.hasher.memo == nil { + m.hasher = MakeHasher() + } + hash := m.hasher.Hash(key) + m.table = map[uint32][]entry{hash: {entry{key, value}}} + } + + m.length++ + return +} + +// Len returns the number of map entries. +func (m *Map) Len() int { + if m != nil { + return m.length + } + return 0 +} + +// Iterate calls function f on each entry in the map in unspecified order. +// +// If f should mutate the map, Iterate provides the same guarantees as +// Go maps: if f deletes a map entry that Iterate has not yet reached, +// f will not be invoked for it, but if f inserts a map entry that +// Iterate has not yet reached, whether or not f will be invoked for +// it is unspecified. +// +func (m *Map) Iterate(f func(key types.Type, value interface{})) { + if m != nil { + for _, bucket := range m.table { + for _, e := range bucket { + if e.key != nil { + f(e.key, e.value) + } + } + } + } +} + +// Keys returns a new slice containing the set of map keys. +// The order is unspecified. +func (m *Map) Keys() []types.Type { + keys := make([]types.Type, 0, m.Len()) + m.Iterate(func(key types.Type, _ interface{}) { + keys = append(keys, key) + }) + return keys +} + +func (m *Map) toString(values bool) string { + if m == nil { + return "{}" + } + var buf bytes.Buffer + fmt.Fprint(&buf, "{") + sep := "" + m.Iterate(func(key types.Type, value interface{}) { + fmt.Fprint(&buf, sep) + sep = ", " + fmt.Fprint(&buf, key) + if values { + fmt.Fprintf(&buf, ": %q", value) + } + }) + fmt.Fprint(&buf, "}") + return buf.String() +} + +// String returns a string representation of the map's entries. +// Values are printed using fmt.Sprintf("%v", v). +// Order is unspecified. +// +func (m *Map) String() string { + return m.toString(true) +} + +// KeysString returns a string representation of the map's key set. +// Order is unspecified. +// +func (m *Map) KeysString() string { + return m.toString(false) +} + +//////////////////////////////////////////////////////////////////////// +// Hasher + +// A Hasher maps each type to its hash value. +// For efficiency, a hasher uses memoization; thus its memory +// footprint grows monotonically over time. +// Hashers are not thread-safe. +// Hashers have reference semantics. +// Call MakeHasher to create a Hasher. +type Hasher struct { + memo map[types.Type]uint32 +} + +// MakeHasher returns a new Hasher instance. +func MakeHasher() Hasher { + return Hasher{make(map[types.Type]uint32)} +} + +// Hash computes a hash value for the given type t such that +// Identical(t, t') => Hash(t) == Hash(t'). +func (h Hasher) Hash(t types.Type) uint32 { + hash, ok := h.memo[t] + if !ok { + hash = h.hashFor(t) + h.memo[t] = hash + } + return hash +} + +// hashString computes the Fowler–Noll–Vo hash of s. +func hashString(s string) uint32 { + var h uint32 = 2166136261 + for i := 0; i < len(s); i++ { + h ^= uint32(s[i]) + h *= 16777619 + } + return h +} + +func hashNamed(t *types.Named) uint32 { + // Not safe with a copying GC; objects may move. + n := reflect.ValueOf(t.Obj()).Pointer() + return uint32(n ^ n>>32) +} + +func (h Hasher) hashTuple(tuple *types.Tuple) uint32 { + // See go/types.identicalTypes for rationale. + n := tuple.Len() + var hash uint32 = 9137 + 2*uint32(n) + for i := 0; i < n; i++ { + // order is significant + hash = (hash<<5 | hash>>27) + 3*h.hashFor(tuple.At(i).Type()) + } + return hash +} + +func (h Hasher) hashVar(va *types.Var) uint32 { + var hash uint32 = 0 + if va != nil { + hash = h.Hash(va.Type()) + } + return hash +} + +// hashFor computes the hash of t. +func (h Hasher) hashFor(t types.Type) uint32 { + // See Identical for rationale. + switch t := t.(type) { + case *types.Basic: + return uint32(t.Kind()) + + case *types.Array: + return 9043 + 2*uint32(t.Len()) + 3*h.Hash(t.Elem()) + + case *types.Slice: + return 9049 + 2*h.Hash(t.Elem()) + + case *types.Struct: + var hash uint32 = 9059 + for i, n := 0, t.NumFields(); i < n; i++ { + f := t.Field(i) + if f.Anonymous() { + hash += 8861 + } + // field order is significant + hash = hash<<5 | hash>>27 + hash += hashString(t.Tag(i)) + hash += hashString(f.Name()) // (ignore f.Pkg) + hash += h.Hash(f.Type()) + } + return hash + + case *types.Pointer: + return 9067 + 2*h.Hash(t.Elem()) + + case *types.Signature: + var hash uint32 = 9091 + if t.Variadic() { + hash *= 8863 + } + // PATCH: also consider the receiver type + return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results()) + 7*h.hashVar(t.Recv()) + + case *types.Interface: + // PATCH: consider the explicit methods and embedded interfaces, in order. + // See Identical for rationale. + var hash uint32 = 9103 + for i, n := 0, t.NumEmbeddeds(); i < n; i++ { + // Embedded interfaces order is significant. + e := t.Embedded(i) + // Not safe with a copying GC; objects may move. + hash = (hash<<5 | hash>>27) + 2*hashNamed(e) + } + for i, n := 0, t.NumExplicitMethods(); i < n; i++ { + // Method order is significant. + // Ignore m.Pkg(). + m := t.ExplicitMethod(i) + // fmt.Printf("Hash for interface <%v> method %q <%v>\n", t, m.Name(), m.Type()) + + hash = (hash<<5 | hash>>27) + 7*hashString(m.Name()) + if mt, ok := m.Type().Underlying().(*types.Signature); ok { + if mt.Variadic() { + hash *= 8863 + } + // do NOT hash the receiver of an interface... it may be the interface itself + hash += 3*h.hashTuple(mt.Params()) + 5*h.hashTuple(mt.Results()) + } + } + return hash + + case *types.Map: + return 9109 + 2*h.Hash(t.Key()) + 3*h.Hash(t.Elem()) + + case *types.Chan: + return 9127 + 2*uint32(t.Dir()) + 3*h.Hash(t.Elem()) + + case *types.Named: + // Not safe with a copying GC; objects may move. + return hashNamed(t) + + case *types.Tuple: + return h.hashTuple(t) + + case nil: + return 9133 + } + panic(t) +} diff --git a/vendor/github.com/cosmos72/gomacro/typeutil/predicates.go b/vendor/github.com/cosmos72/gomacro/typeutil/predicates.go new file mode 100644 index 0000000..46d0f7b --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/typeutil/predicates.go @@ -0,0 +1,237 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// This file implements commonly used type predicates. + +package typeutil + +import ( + "go/ast" + "go/types" +) + +// Identical reports whether x and y are identical. +func Identical(x, y types.Type) bool { + return identical(x, y, true, nil) +} + +// IdenticalIgnoreTags reports whether x and y are identical if tags are ignored. +func IdenticalIgnoreTags(x, y types.Type) bool { + return identical(x, y, false, nil) +} + +func sameName(xname string, xpkg *types.Package, yname string, ypkg *types.Package) bool { + // spec: + // "Two identifiers are different if they are spelled differently, + // or if they appear in different packages and are not exported. + // Otherwise, they are the same." + if xname != yname { + return false + } + // xname == yname + if ast.IsExported(xname) { + return true + } + // not exported, so packages must be the same (pkg == nil for + // fields in Universe scope; this can only happen for types + // introduced via Eval) + if xpkg == nil || ypkg == nil { + return xpkg == ypkg + } + // xpkg != nil && ypkg != nil + return xpkg.Path() == ypkg.Path() +} + +func sameVarName(x, y *types.Var) bool { + if x == nil || y == nil { + return x == y + } + return x == y || sameName(x.Name(), x.Pkg(), y.Name(), y.Pkg()) +} + +func sameFuncName(x, y *types.Func) bool { + if x == nil || y == nil { + return x == y + } + return x == y || sameName(x.Name(), x.Pkg(), y.Name(), y.Pkg()) +} + +// An ifacePair is a node in a stack of interface type pairs compared for identity. +type ifacePair struct { + x, y *types.Interface + prev *ifacePair +} + +func identicalVar(v, w *types.Var, cmpTags bool, p *ifacePair) bool { + if v == nil || w == nil { + return v == w + } + return v == w || identical(v.Type(), w.Type(), cmpTags, p) +} + +func (p *ifacePair) identical(q *ifacePair) bool { + return p.x == q.x && p.y == q.y || p.x == q.y && p.y == q.x +} + +func identical(x, y types.Type, cmpTags bool, p *ifacePair) bool { + if x == y { + return true + } + + switch x := x.(type) { + case *types.Basic: + // types.Basic types are singletons except for the rune and byte + // aliases, thus we cannot solely rely on the x == y check + // above. + if y, ok := y.(*types.Basic); ok { + return x.Kind() == y.Kind() + } + + case *types.Array: + // Two array types are identical if they have identical element types + // and the same array length. + if y, ok := y.(*types.Array); ok { + return x.Len() == y.Len() && identical(x.Elem(), y.Elem(), cmpTags, p) + } + + case *types.Slice: + // Two slice types are identical if they have identical element types. + if y, ok := y.(*types.Slice); ok { + return identical(x.Elem(), y.Elem(), cmpTags, p) + } + + case *types.Struct: + // Two struct types are identical if they have the same sequence of fields, + // and if corresponding fields have the same names, and identical types, + // and identical tags. Two anonymous fields are considered to have the same + // name. Lower-case field names from different packages are always different. + if y, ok := y.(*types.Struct); ok { + if x.NumFields() == y.NumFields() { + for i, n := 0, x.NumFields(); i < n; i++ { + f := x.Field(i) + g := y.Field(i) + if f.Anonymous() != g.Anonymous() || + cmpTags && x.Tag(i) != y.Tag(i) || + !sameVarName(f, g) || + !identical(f.Type(), g.Type(), cmpTags, p) { + return false + } + } + return true + } + } + + case *types.Pointer: + // Two pointer types are identical if they have identical base types. + if y, ok := y.(*types.Pointer); ok { + return identical(x.Elem(), y.Elem(), cmpTags, p) + } + + case *types.Tuple: + // Two tuples types are identical if they have the same number of elements + // and corresponding elements have identical types. + if y, ok := y.(*types.Tuple); ok { + if x.Len() == y.Len() { + for i, n := 0, x.Len(); i < n; i++ { + v := x.At(i) + w := y.At(i) + if !identical(v.Type(), w.Type(), cmpTags, p) { + return false + } + } + return true + } + } + + case *types.Signature: + // Two function types are identical if they have the same number of parameters + // and result values, corresponding parameter and result types are identical, + // and either both functions are variadic or neither is. Parameter and result + // names are not required to match. + // + // PATCH: also compare the receiver type + if y, ok := y.(*types.Signature); ok { + return x.Variadic() == y.Variadic() && + identicalVar(x.Recv(), y.Recv(), cmpTags, p) && + identical(x.Params(), y.Params(), cmpTags, p) && + identical(x.Results(), y.Results(), cmpTags, p) + } + + case *types.Interface: + // PATCH: two interface types are identical if they have the same explicit methods + // and the same embedded interfaces. The order of methods and embeddeds is *relevant*. + if y, ok := y.(*types.Interface); ok { + na := x.NumMethods() + nb := y.NumMethods() + ne := x.NumEmbeddeds() + nf := x.NumEmbeddeds() + if na == nb && ne == nf { + // this PATCHED definition of type identity sidesteps the type cycles + // created via method parameter types that are anonymous interfaces + // (directly or indirectly) embedding the current interface, as for example + // + // type T interface { + // m() interface{T} + // } + // + // simply by *not* embedding the interfaces, and checking for identical + // embedded interfaces - which are always named and thus compare trivially + // without recursion, preventing any infinite cycle or recursion. + q := &ifacePair{x, y, p} + for p != nil { + if p.identical(q) { + return true // same pair was compared before + } + p = p.prev + } + for i := 0; i < na; i++ { + a := x.Method(i) + b := y.Method(i) + if !sameFuncName(a, b) || !identical(a.Type(), b.Type(), cmpTags, q) { + return false + } + } + for i := 0; i < ne; i++ { + e := x.Embedded(i) + f := y.Embedded(i) + if e.Obj() != f.Obj() { + return false + } + } + return true + } + } + + case *types.Map: + // Two map types are identical if they have identical key and value types. + if y, ok := y.(*types.Map); ok { + return identical(x.Key(), y.Key(), cmpTags, p) && identical(x.Elem(), y.Elem(), cmpTags, p) + } + + case *types.Chan: + // Two channel types are identical if they have identical value types + // and the same direction. + if y, ok := y.(*types.Chan); ok { + return x.Dir() == y.Dir() && identical(x.Elem(), y.Elem(), cmpTags, p) + } + + case *types.Named: + // Two named types are identical if their type names originate + // in the same type declaration. + if y, ok := y.(*types.Named); ok { + return x.Obj() == y.Obj() + } + + case nil: + + default: + unreachable() + } + + return false +} + +func unreachable() { + panic("unreachable") +} diff --git a/vendor/github.com/cosmos72/gomacro/typeutil/x_package.go b/vendor/github.com/cosmos72/gomacro/typeutil/x_package.go new file mode 100644 index 0000000..1b3d431 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/typeutil/x_package.go @@ -0,0 +1,25 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/typeutil" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package typeutil + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/typeutil" +func init() { + imports.Packages["github.com/cosmos72/gomacro/typeutil"] = imports.Package{ + Binds: map[string]r.Value{ + "Identical": r.ValueOf(Identical), + "IdenticalIgnoreTags": r.ValueOf(IdenticalIgnoreTags), + "MakeHasher": r.ValueOf(MakeHasher), + }, + Types: map[string]r.Type{ + "Hasher": r.TypeOf((*Hasher)(nil)).Elem(), + "Map": r.TypeOf((*Map)(nil)).Elem(), + }, + Proxies: map[string]r.Type{}} +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/README.md b/vendor/github.com/cosmos72/gomacro/xreflect/README.md new file mode 100644 index 0000000..50f45d9 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/README.md @@ -0,0 +1,12 @@ +### xreflect + +The package `xreflect` is a wrapper aroung Go standard packages `reflect` and `go/types` +that **emulates** the missing features of `reflect` package: + +* NamedOf: declare new named types at runtime +* AddMethod: add method to a named type at runtime +* InterfaceOf: declare new interfaces at runtime + +## License + +GPL v3+ diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/build_easy.go b/vendor/github.com/cosmos72/gomacro/xreflect/build_easy.go new file mode 100644 index 0000000..ba44557 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/build_easy.go @@ -0,0 +1,304 @@ +// +build gomacro_xreflect_easy + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * build_easy.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +type Type interface { + + // Align returns the alignment in bytes of a value of + // this type when allocated in memory. + Align() int + + // FieldAlign returns the alignment in bytes of a value of + // this type when used as a field in a struct. + FieldAlign() int + + // AssignableTo reports whether a value of the type is assignable to type u. + AssignableTo(u Type) bool + + // ConvertibleTo reports whether a value of the type is convertible to type u. + ConvertibleTo(u Type) bool + + // Comparable reports whether values of this type are comparable. + Comparable() bool + + // GoType returns the go/types.Type corresponding to the given type. + GoType() types.Type + + // Implements reports whether the type implements the interface type u. + // It panics if u's Kind is not Interface + Implements(u Type) bool + + // Name returns the type's name within its package. + // It returns an empty string for unnamed types. + Name() string + + // Named returns whether the type is named. + // It returns false for unnamed types. + Named() bool + + // Pkg returns a named type's package, that is, the package where it was defined. + // If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), + // Pkg will return nil. + Pkg() *Package + + // PkgName returns a named type's package name, that is, + // the default name that the package provides when imported. + // If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), + // the package name will be the empty string. + PkgName() string + + // PkgPath returns a named type's package path, that is, the import path + // that uniquely identifies the package, such as "encoding/base64". + // If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), + // the package path will be the empty string. + PkgPath() string + + // ReflectType returns a best-effort reflect.Type that approximates the type. + // It may be inexact for the following reasons: + // 1) missing reflect.NamedOf(): no way to programmatically create named types, or to access the underlying type of a named type + // 2) missing reflect.InterfaceOf(): interface types created at runtime will be approximated by structs + // 3) missing reflect.MethodOf(): method types created at runtime will be approximated by functions + // whose first parameter is the receiver + // 4) reflect.StructOf() does not support embedded or unexported fields + // 5) go/reflect lacks the ability to create self-referencing types: + // references to the type itself will be replaced by interface{}. + // + // Examples: + // after invoking at runtime type2.NewStruct() and type2.NewNamed() + // to create the following type: + // type List struct { Elem int; Rest *List } + // ReflectType will return a reflect.Type equivalent to: + // struct { Elem int; Rest interface{} } + // i.e. the type name will be missing due to limitation 1 above, + // and the field 'Rest' will have type interface{} instead of *List due to limitation 5. + ReflectType() reflect.Type + + UnsafeForceReflectType(rtype reflect.Type) + + // Size returns the number of bytes needed to store + // a value of the given type; it is analogous to unsafe.Sizeof. + Size() uintptr + + // String returns a string representation of a type. + String() string + + // AddMethod adds method with given name and signature to type, unless it is already in the method list. + // It panics if the type is unnamed, or if the signature is not a function-with-receiver type. + // Returns the method index, or < 0 in case of errors + AddMethod(name string, signature Type) int + + // Bits returns the size of the type in bits. + // It panics if the type's Kind is not one of the + // sized or unsized Int, Uint, Float, or Complex kinds. + Bits() int + + // ChanDir returns a channel type's direction. + // It panics if the type's Kind is not Chan. + ChanDir() reflect.ChanDir + + // Complete marks an interface type as complete and computes wrapper methods for embedded fields. + // It must be called by users of InterfaceOf after the interface's embedded types are fully defined + // and before using the interface type in any way other than to form other types. + // Complete returns a canonicalized (unique) version of the receiver. + Complete() Type + // Elem returns a type's element type. + // It panics if the type's Kind is not Array, Chan, Map, Ptr, or Slice. + Elem() Type + + // Field returns a struct type's i-th field. + // It panics if the type's Kind is not Struct. + // It panics if i is not in the range [0, NumField()). + Field(i int) StructField + // FieldByName returns the (possibly embedded) struct field with the given name + // and the number of fields found at the same (shallowest) depth: 0 if not found. + // Private fields are returned only if they were declared in pkgpath. + FieldByName(name, pkgpath string) (field StructField, count int) + + // IsMethod reports whether a function type's contains a receiver, i.e. is a method. + // If IsMethod returns true, the actual receiver type is available as the first parameter, i.e. Type.In(0) + // It panics if the type's Kind is not Func. + IsMethod() bool + + // IsVariadic reports whether a function type's final input parameter is a "..." parameter. + // If so, t.In(t.NumIn() - 1) returns the parameter's implicit actual type []T. + // IsVariadic panics if the type's Kind is not Func. + IsVariadic() bool + + // Key returns a map type's key type. + // It panics if the type's Kind is not Map. + Key() Type + // Kind returns the specific kind of the type. + Kind() reflect.Kind + + // Len returns an array type's length. + // It panics if the type's Kind is not Array. + Len() int + + // In returns the type of a function type's i'th input parameter. + // It panics if the type's Kind is not Func. + // It panics if i is not in the range [0, NumIn()). + In(i int) Type + // Method return the i-th explicitly declared method of named type or interface t. + // Wrapper methods for embedded fields or embedded interfaces are not returned. + // It panics if the type is unnamed, or if the type's Kind is not Interface + Method(i int) Method + // MethodByName returns the method with given name (including wrapper methods for embedded fields) + // and the number of methods found at the same (shallowest) depth: 0 if not found. + // Private methods are returned only if they were declared in pkgpath. + MethodByName(name, pkgpath string) (method Method, count int) + + // NumMethod returns the number of explicitly declared methods of named type or interface t. + // Wrapper methods for embedded fields or embedded interfaces are not counted. + NumMethod() int + // NumField returns a struct type's field count. + // It panics if the type's Kind is not Struct. + NumField() int + + // NumIn returns a function type's input parameter count. + // It panics if the type's Kind is not Func. + NumIn() int + + // NumOut returns a function type's output parameter count. + // It panics if the type's Kind is not Func. + NumOut() int + + // Out returns the type of a function type's i'th output parameter. + // It panics if the type's Kind is not Func. + // It panics if i is not in the range [0, NumOut()). + Out(i int) Type + + // RemoveMethods removes given methods from type. + // It panics if the type is unnamed, or if the signature is not a function type, + RemoveMethods(names []string, pkgpath string) + + // SetUnderlying sets the underlying type of a named type and marks it as complete. + // It panics if the type is unnamed, or if the underlying type is named, + // or if SetUnderlying() was already invoked on the named type. + SetUnderlying(underlying Type) + + // underlying returns the underlying types.Type of a type. + // TODO implement Underlying() Type ? + // Synthetizing the underlying reflect.Type is not possible for interface types, + // or for struct types with embedded or unexported fields. + underlying() types.Type + + elem() Type + + Universe() *Universe + + // GetMethods returns the pointer to the method values. + // It panics if the type is unnamed + GetMethods() *[]reflect.Value +} + +func unwrap(t Type) *xtype { + if t == nil { + return nil + } + return t.(*xtype) +} + +func wrap(t *xtype) Type { + return t +} + +// Complete marks an interface type as complete and computes wrapper methods for embedded fields. +// It must be called by users of InterfaceOf after the interface's embedded types are fully defined +// and before using the interface type in any way other than to form other types. +func (t *xtype) Complete() Type { + if t.kind != reflect.Interface { + xerrorf(t, "Complete of non-interface %v", t) + } + gtype := t.gtype.Underlying().(*types.Interface) + gtype.Complete() + return wrap(t) +} + +var ( + BasicTypes = universe.BasicTypes + + TypeOfBool = BasicTypes[reflect.Bool] + TypeOfInt = BasicTypes[reflect.Int] + TypeOfInt8 = BasicTypes[reflect.Int8] + TypeOfInt16 = BasicTypes[reflect.Int16] + TypeOfInt32 = BasicTypes[reflect.Int32] + TypeOfInt64 = BasicTypes[reflect.Int64] + TypeOfUint = BasicTypes[reflect.Uint] + TypeOfUint8 = BasicTypes[reflect.Uint8] + TypeOfUint16 = BasicTypes[reflect.Uint16] + TypeOfUint32 = BasicTypes[reflect.Uint32] + TypeOfUint64 = BasicTypes[reflect.Uint64] + TypeOfUintptr = BasicTypes[reflect.Uintptr] + TypeOfFloat32 = BasicTypes[reflect.Float32] + TypeOfFloat64 = BasicTypes[reflect.Float64] + TypeOfComplex64 = BasicTypes[reflect.Complex64] + TypeOfComplex128 = BasicTypes[reflect.Complex128] + TypeOfString = BasicTypes[reflect.String] + TypeOfUnsafePointer = BasicTypes[reflect.UnsafePointer] + TypeOfError = universe.TypeOfError + TypeOfInterface = universe.TypeOfInterface +) + +// TypeOf creates a Type corresponding to reflect.TypeOf() of given value. +// Note: conversions from Type to reflect.Type and back are not exact, +// because of the reasons listed in Type.ReflectType() +// Conversions from reflect.Type to Type and back are not exact for the same reasons. +func TypeOf(rvalue interface{}) Type { + return universe.FromReflectType(reflect.TypeOf(rvalue)) +} + +// FromReflectType creates a Type corresponding to given reflect.Type +// Note: conversions from Type to reflect.Type and back are not exact, +// because of the reasons listed in Type.ReflectType() +// Conversions from reflect.Type to Type and back are not exact for the same reasons. +func FromReflectType(rtype reflect.Type) Type { + return universe.FromReflectType(rtype) +} + +// NamedOf returns a new named type for the given type name and package. +// Initially, the underlying type is set to interface{} - use SetUnderlying to change it. +// These two steps are separate to allow creating self-referencing types, +// as for example type List struct { Elem int; Rest *List } +func NamedOf(name, pkgpath string) Type { + return universe.NamedOf(name, pkgpath) +} + +func NewPackage(path, name string) *Package { + return universe.NewPackage(path, name) +} + +func MakeType(gtype types.Type, rtype reflect.Type) Type { + return universe.MakeType(gtype, rtype) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/build_strict.go b/vendor/github.com/cosmos72/gomacro/xreflect/build_strict.go new file mode 100644 index 0000000..a689538 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/build_strict.go @@ -0,0 +1,345 @@ +// +build !gomacro_xreflect_easy + +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * build_strict.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +type Type []xtype + +// Align returns the alignment in bytes of a value of +// this type when allocated in memory. +func (t Type) Align() int { + return t[0].Align() +} + +// FieldAlign returns the alignment in bytes of a value of +// this type when used as a field in a struct. +func (t Type) FieldAlign() int { + return t[0].FieldAlign() +} + +// AssignableTo reports whether a value of the type is assignable to type u. +func (t Type) AssignableTo(u Type) bool { + return t[0].AssignableTo(u) +} + +// ConvertibleTo reports whether a value of the type is convertible to type u. +func (t Type) ConvertibleTo(u Type) bool { + return t[0].ConvertibleTo(u) +} + +// Comparable reports whether values of this type are comparable. +func (t Type) Comparable() bool { + return t[0].Comparable() +} + +// GoType returns the go/types.Type corresponding to the given type. +func (t Type) GoType() types.Type { + return t[0].GoType() +} + +// Implements reports whether the type implements the interface type u. +// It panics if u's Kind is not Interface +func (t Type) Implements(u Type) bool { + return t[0].Implements(u) +} + +// Name returns the type's name within its package. +// It returns an empty string for unnamed types. +func (t Type) Name() string { + if len(t) == 0 { + return "" + } + return t[0].Name() +} + +// Named returns whether the type is named. +// It returns false for unnamed types. +func (t Type) Named() bool { + if len(t) == 0 { + return false + } + return t[0].Named() +} + +// Pkg returns a named type's package, that is, the package where it was defined. +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// Pkg will return nil. +func (t Type) Pkg() *Package { + return t[0].Pkg() +} + +// PkgName returns a named type's package name, that is, +// the default name that the package provides when imported. +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// the package name will be the empty string. +func (t Type) PkgName() string { + return t[0].PkgName() +} + +// PkgPath returns a named type's package path, that is, the import path +// that uniquely identifies the package, such as "encoding/base64". +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// the package path will be the empty string. +func (t Type) PkgPath() string { + return t[0].PkgPath() +} + +// ReflectType returns a best-effort reflect.Type that approximates the type. +// It may be inexact for the following reasons: +// 1) missing reflect.NamedOf(): no way to programmatically create named types, or to access the underlying type of a named type +// 2) missing reflect.InterfaceOf(): interface types created at runtime will be approximated by structs +// 3) missing reflect.MethodOf(): method types created at runtime will be approximated by functions +// whose first parameter is the receiver +// 4) reflect.StructOf() does not support embedded or unexported fields +// 5) go/reflect lacks the ability to create self-referencing types: +// references to the type itself will be replaced by interface{}. +// +// Examples: +// after invoking at runtime type2.NewStruct() and type2.NewNamed() +// to create the following type: +// type List struct { Elem int; Rest *List } +// ReflectType will return a reflect.Type equivalent to: +// struct { Elem int; Rest interface{} } +// i.e. the type name will be missing due to limitation 1 above, +// and the field 'Rest' will have type interface{} instead of *List due to limitation 5. +func (t Type) ReflectType() reflect.Type { + return t[0].ReflectType() +} + +func (t Type) UnsafeForceReflectType(rtype reflect.Type) { + t[0].UnsafeForceReflectType(rtype) +} + +// Size returns the number of bytes needed to store +// a value of the given type; it is analogous to unsafe.Sizeof. +func (t Type) Size() uintptr { + return t[0].Size() +} + +// String returns a string representation of a type. +func (t Type) String() string { + if t == nil { + return "" + } + return t[0].String() +} + +// AddMethod adds method with given name and signature to type, unless it is already in the method list. +// It panics if the type is unnamed, or if the signature is not a function-with-receiver type. +// Returns the method index, or < 0 in case of errors +func (t Type) AddMethod(name string, signature Type) int { + return t[0].AddMethod(name, signature) +} + +// Bits returns the size of the type in bits. +// It panics if the type's Kind is not one of the +// sized or unsized Int, Uint, Float, or Complex kinds. +func (t Type) Bits() int { + return t[0].Bits() +} + +// ChanDir returns a channel type's direction. +// It panics if the type's Kind is not Chan. +func (t Type) ChanDir() reflect.ChanDir { + return t[0].ChanDir() +} + +// Complete marks an interface type as complete and computes wrapper methods for embedded fields. +// It must be called by users of InterfaceOf after the interface's embedded types are fully defined +// and before using the interface type in any way other than to form other types. +// Complete returns the receiver. +func (t Type) Complete() Type { + t[0].Complete() + return t +} + +// Elem returns a type's element type. +// It panics if the type's Kind is not Array, Chan, Map, Ptr, or Slice. +func (t Type) Elem() Type { + return t[0].Elem() +} + +func (t Type) elem() Type { + return t[0].elem() +} + +// Field returns a struct type's i-th field. +// It panics if the type's Kind is not Struct. +// It panics if i is not in the range [0, NumField()). +func (t Type) Field(i int) StructField { + return t[0].Field(i) +} + +// FieldByName returns the (possibly embedded) struct field with the given name +// and the number of fields found at the same (shallowest) depth: 0 if not found. +// Private fields are returned only if they were declared in pkgpath. +func (t Type) FieldByName(name, pkgpath string) (field StructField, count int) { + return t[0].FieldByName(name, pkgpath) +} + +// IsMethod reports whether a function type's contains a receiver, i.e. is a method. +// If IsMethod returns true, the actual receiver type is available as the first parameter, i.e. Type.In(0) +// It panics if the type's Kind is not Func. +func (t Type) IsMethod() bool { + return t[0].IsMethod() +} + +// IsVariadic reports whether a function type's final input parameter is a "..." parameter. +// If so, t.In(t.NumIn() - 1) returns the parameter's implicit actual type []T. +// IsVariadic panics if the type's Kind is not Func. +func (t Type) IsVariadic() bool { + return t[0].IsVariadic() +} + +// Key returns a map type's key type. +// It panics if the type's Kind is not Map. +func (t Type) Key() Type { + return t[0].Key() +} + +// Kind returns the specific kind of the type. +func (t Type) Kind() reflect.Kind { + if len(t) == 0 { + return reflect.Invalid + } + return t[0].Kind() +} + +// Len returns an array type's length. +// It panics if the type's Kind is not Array. +func (t Type) Len() int { + return t[0].Len() +} + +// In returns the type of a function type's i'th input parameter. +// It panics if the type's Kind is not Func. +// It panics if i is not in the range [0, NumIn()). +func (t Type) In(i int) Type { + return t[0].In(i) +} + +// Method return the i-th explicitly declared method of named type or interface t. +// Wrapper methods for embedded fields or embedded interfaces are not returned. +// It panics if the type is unnamed, or if the type's Kind is not Interface +func (t Type) Method(i int) Method { + return t[0].Method(i) +} + +// MethodByName returns the method with given name (including wrapper methods for embedded fields) +// and the number of methods found at the same (shallowest) depth: 0 if not found. +// Private methods are returned only if they were declared in pkgpath. +func (t Type) MethodByName(name, pkgpath string) (method Method, count int) { + return t[0].MethodByName(name, pkgpath) +} + +// NumMethod returns the number of explicitly declared methods of named type or interface t. +// Wrapper methods for embedded fields or embedded interfaces are not counted. +func (t Type) NumMethod() int { + return t[0].NumMethod() +} + +// NumField returns a struct type's field count. +// It panics if the type's Kind is not Struct. +func (t Type) NumField() int { + return t[0].NumField() +} + +// NumIn returns a function type's input parameter count. +// It panics if the type's Kind is not Func. +func (t Type) NumIn() int { + return t[0].NumIn() +} + +// NumOut returns a function type's output parameter count. +// It panics if the type's Kind is not Func. +func (t Type) NumOut() int { + return t[0].NumOut() +} + +// Out returns the type of a function type's i'th output parameter. +// It panics if the type's Kind is not Func. +// It panics if i is not in the range [0, NumOut()). +func (t Type) Out(i int) Type { + return t[0].Out(i) +} + +// RemoveMethods removes given methods from type. +// It panics if the type is unnamed. +func (t Type) RemoveMethods(names []string, pkgpath string) { + t[0].RemoveMethods(names, pkgpath) +} + +// SetUnderlying sets the underlying type of a named type and marks it as complete. +// It panics if the type is unnamed, or if the underlying type is named, +// or if SetUnderlying() was already invoked on the named type. +func (t Type) SetUnderlying(underlying Type) { + t[0].SetUnderlying(underlying) +} + +// underlying returns the underlying types.Type of a type. +// TODO implement Underlying() Type ? +// Synthetizing the underlying reflect.Type is not possible for interface types, +// or for struct types with embedded or unexported fields. +func (t Type) underlying() types.Type { + return t[0].underlying() +} + +func (t Type) Universe() *Universe { + return t[0].Universe() +} + +// GetMethods returns the pointer to the method values. +// It panics if the type is unnamed +func (t Type) GetMethods() *[]reflect.Value { + return t[0].GetMethods() +} + +// Complete marks an interface type as complete and computes wrapper methods for embedded fields. +// It must be called by users of InterfaceOf after the interface's embedded types are fully defined +// and before using the interface type in any way other than to form other types. +func (t *xtype) Complete() { + if t.kind != reflect.Interface { + xerrorf(t, "Complete of non-interface %v", t) + } + gtype := t.gtype.Underlying().(*types.Interface) + gtype.Complete() +} + +func wrap(t *xtype) Type { + return Type{*t} +} + +func unwrap(t Type) *xtype { + return &t[0] +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/composite.go b/vendor/github.com/cosmos72/gomacro/xreflect/composite.go new file mode 100644 index 0000000..6b54b9f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/composite.go @@ -0,0 +1,140 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * composite.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +// ChanDir returns a channel type's direction. +// It panics if the type's Kind is not Chan. +func (t *xtype) ChanDir() reflect.ChanDir { + if t.Kind() != reflect.Chan { + xerrorf(t, "ChanDir of non-chan type %v", t) + } + return t.rtype.ChanDir() +} + +// Elem returns a type's element type. +// It panics if the type's Kind is not Array, Chan, Map, Ptr, or Slice. +func (t *xtype) Elem() Type { + v := t.universe + if v.ThreadSafe { + defer un(lock(v)) + } + return t.elem() +} + +func (t *xtype) elem() Type { + gtype := t.underlying() + rtype := t.rtype + switch gtype := gtype.(type) { + case *types.Array: + return t.universe.maketype(gtype.Elem(), rtype.Elem()) + case *types.Chan: + return t.universe.maketype(gtype.Elem(), rtype.Elem()) + case *types.Map: + return t.universe.maketype(gtype.Elem(), rtype.Elem()) + case *types.Pointer: + return t.universe.maketype(gtype.Elem(), rtype.Elem()) + case *types.Slice: + return t.universe.maketype(gtype.Elem(), rtype.Elem()) + default: + xerrorf(t, "Elem of invalid type %v", t) + return nil + } +} + +// Key returns a map type's key type. +// It panics if the type's Kind is not Map. +func (t *xtype) Key() Type { + if t.Kind() != reflect.Map { + xerrorf(t, "Key of non-map type %v", t) + } + gtype := t.underlying().(*types.Map) + return t.universe.MakeType(gtype.Key(), t.rtype.Key()) +} + +// Len returns an array type's length. +// It panics if the type's Kind is not Array. +func (t *xtype) Len() int { + if t.Kind() != reflect.Array { + xerrorf(t, "Len of non-array type %v", t) + } + return t.rtype.Len() +} + +func (v *Universe) ArrayOf(count int, elem Type) Type { + return v.MakeType( + types.NewArray(elem.GoType(), int64(count)), + reflect.ArrayOf(count, elem.ReflectType())) +} + +func (v *Universe) ChanOf(dir reflect.ChanDir, elem Type) Type { + gdir := dirToGdir(dir) + return v.MakeType( + types.NewChan(gdir, elem.GoType()), + reflect.ChanOf(dir, elem.ReflectType())) +} + +func (v *Universe) MapOf(key, elem Type) Type { + return v.MakeType( + types.NewMap(key.GoType(), elem.GoType()), + reflect.MapOf(key.ReflectType(), elem.ReflectType())) +} + +func (v *Universe) PtrTo(elem Type) Type { + return v.MakeType( + types.NewPointer(elem.GoType()), + reflect.PtrTo(elem.ReflectType())) +} + +func (v *Universe) SliceOf(elem Type) Type { + return v.MakeType( + types.NewSlice(elem.GoType()), + reflect.SliceOf(elem.ReflectType())) +} + +func ArrayOf(count int, elem Type) Type { + return elem.Universe().ArrayOf(count, elem) +} + +func ChanOf(dir reflect.ChanDir, elem Type) Type { + return elem.Universe().ChanOf(dir, elem) +} + +func MapOf(key, elem Type) Type { + return key.Universe().MapOf(key, elem) +} + +func PtrTo(elem Type) Type { + return elem.Universe().PtrTo(elem) +} + +func SliceOf(elem Type) Type { + return elem.Universe().SliceOf(elem) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/fromreflect.go b/vendor/github.com/cosmos72/gomacro/xreflect/fromreflect.go new file mode 100644 index 0000000..4893237 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/fromreflect.go @@ -0,0 +1,487 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * fromreflect.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/token" + "go/types" + "reflect" + "strings" +) + +func (v *Universe) TypeOf(rvalue interface{}) Type { + return v.FromReflectType(reflect.TypeOf(rvalue)) +} + +func (v *Universe) FromReflectType(rtype reflect.Type) Type { + if rtype == nil { + return nil + } + if v.ThreadSafe { + defer un(lock(v)) + } + return v.fromReflectType(rtype) +} + +func (v *Universe) fromReflectType(rtype reflect.Type) Type { + if rtype == nil { + return nil + } + if v.BasicTypes == nil { + v.init() + } + t := v.BasicTypes[rtype.Kind()] + if t != nil && t.ReflectType() == rtype { + return t + } + if t = v.ReflectTypes[rtype]; t != nil { + // debugf("found rtype in cache: %v -> %v (%v)", rtype, t, t.ReflectType()) + // time.Sleep(100 * time.Millisecond) + return t + } + name := rtype.Name() + tryresolve := v.TryResolve + if tryresolve != nil && len(name) != 0 { + t = tryresolve(name, rtype.PkgPath()) + if t != nil { + return t + } + } + if v.RebuildDepth >= 0 { + // decrement ONLY here and in fromReflectPtr() when calling fromReflectInterfacePtrStruct() + v.RebuildDepth-- + defer func() { + v.RebuildDepth++ + }() + } + // when converting a named type and v.Importer cannot locate it, + // immediately register it in the cache because it may reference itself, + // as for example type List struct { Elem int; Rest *List } + // otherwise we may get an infinite recursion + if len(name) != 0 { + if !v.rebuild() { + if t = v.namedTypeFromImport(rtype); t != nil { + // debugf("found type in import: %v -> %v", t, t.ReflectType()) + return t + } + } + t = v.namedOf(name, rtype.PkgPath()) + v.cache(rtype, t) // support self-refencing types + // debugf("prepared named type %v", t) + } + + var u Type + switch k := rtype.Kind(); k { + case reflect.Invalid: + return nil + case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.String, + reflect.UnsafePointer: + u = v.BasicTypes[k] + case reflect.Array: + u = v.fromReflectArray(rtype) + case reflect.Chan: + u = v.fromReflectChan(rtype) + case reflect.Func: + u = v.fromReflectFunc(rtype) + case reflect.Interface: + u = v.fromReflectInterface(rtype) + case reflect.Map: + u = v.fromReflectMap(rtype) + case reflect.Ptr: + u = v.fromReflectPtr(rtype) + case reflect.Slice: + u = v.fromReflectSlice(rtype) + case reflect.Struct: + u = v.fromReflectStruct(rtype) + default: + errorf(t, "unsupported reflect.Type %v", rtype) + } + if t == nil { + t = u + // cache before adding methods - otherwise we get an infinite recursion + // if u is a pointer to named type with methods that reference the named type + v.cache(rtype, t) + } else { + t.SetUnderlying(u) + // t.ReflectType() is now u.ReflectType(). but we can do better... we know the exact rtype to set + if !v.rebuild() { + t.UnsafeForceReflectType(rtype) + } + } + return v.addmethods(t, rtype) +} + +func (v *Universe) addmethods(t Type, rtype reflect.Type) Type { + n := rtype.NumMethod() + if n == 0 { + return t + } + tm := t + if !t.Named() && t.Kind() == reflect.Ptr { + // methods on pointer-to-type. add them to the type itself + tm = t.elem() + } + xt := unwrap(tm) + if !xt.Named() { + errorf(t, "cannot add methods to unnamed type %v", t) + } + if xt.kind == reflect.Interface { + // debugf("NOT adding methods to interface %v", tm) + return t + } + if xt.methodvalues != nil { + // prevent another infinite recursion: Type.AddMethod() may reference the type itself in its methods + // debugf("NOT adding again %d methods to %v", n, tm) + } else { + // debugf("adding %d methods to %v", n, tm) + xt.methodvalues = make([]reflect.Value, 0, n) + nilv := reflect.Value{} + if v.rebuild() { + v.RebuildDepth-- + + } + for i := 0; i < n; i++ { + rmethod := rtype.Method(i) + signature := v.fromReflectMethod(rmethod.Type) + n1 := tm.NumMethod() + tm.AddMethod(rmethod.Name, signature) + n2 := tm.NumMethod() + if n1 == n2 { + // method was already present + continue + } + for len(xt.methodvalues) < n2 { + xt.methodvalues = append(xt.methodvalues, nilv) + } + xt.methodvalues[n1] = rmethod.Func + } + } + return t +} + +func (v *Universe) fromReflectField(rfield *reflect.StructField) StructField { + t := v.fromReflectType(rfield.Type) + name := rfield.Name + anonymous := rfield.Anonymous + + if strings.HasPrefix(name, StrGensymEmbedded) { + // this reflect.StructField emulates embedded field using our own convention. + // eat our own dogfood and convert it back to an embedded field. + rtype := rfield.Type + typename := rtype.Name() + if len(typename) == 0 { + typename = name[len(StrGensymEmbedded):] + } + // rebuild the type's name and package + t = v.named(t, typename, rtype.PkgPath()) + name = typename + anonymous = true + } else if strings.HasPrefix(name, StrGensymPrivate) { + // this reflect.StructField emulates private (unexported) field using our own convention. + // eat our own dogfood and convert it back to a private field. + name = name[len(StrGensymPrivate):] + } + + return StructField{ + Name: name, + Pkg: v.loadPackage(rfield.PkgPath), + Type: t, + Tag: rfield.Tag, + Offset: rfield.Offset, + Index: rfield.Index, + Anonymous: anonymous, + } +} + +func (v *Universe) fromReflectFields(rfields []reflect.StructField) []StructField { + fields := make([]StructField, len(rfields)) + for i := range rfields { + fields[i] = v.fromReflectField(&rfields[i]) + } + return fields +} + +// named creates a new named Type based on t, having the given name and pkgpath +func (v *Universe) named(t Type, name string, pkgpath string) Type { + if t.Name() != name || t.PkgPath() != pkgpath { + t2 := v.namedOf(name, pkgpath) + t2.SetUnderlying(v.maketype(t.underlying(), t.ReflectType())) + t = t2 + } + return t +} + +// fromReflectArray converts a reflect.Type with Kind reflect.Array into a Type +func (v *Universe) fromReflectArray(rtype reflect.Type) Type { + count := rtype.Len() + elem := v.fromReflectType(rtype.Elem()) + if v.rebuild() { + rtype = reflect.ArrayOf(count, elem.ReflectType()) + } + return v.maketype(types.NewArray(elem.GoType(), int64(count)), rtype) +} + +// fromReflectChan converts a reflect.Type with Kind reflect.Chan into a Type +func (v *Universe) fromReflectChan(rtype reflect.Type) Type { + dir := rtype.ChanDir() + elem := v.fromReflectType(rtype.Elem()) + if v.rebuild() { + rtype = reflect.ChanOf(dir, elem.ReflectType()) + } + gdir := dirToGdir(dir) + return v.maketype(types.NewChan(gdir, elem.GoType()), rtype) +} + +// fromReflectFunc converts a reflect.Type with Kind reflect.Func into a function Type +func (v *Universe) fromReflectFunc(rtype reflect.Type) Type { + nin, nout := rtype.NumIn(), rtype.NumOut() + in := make([]Type, nin) + out := make([]Type, nout) + for i := 0; i < nin; i++ { + in[i] = v.fromReflectType(rtype.In(i)) + } + for i := 0; i < nout; i++ { + out[i] = v.fromReflectType(rtype.Out(i)) + } + gin := toGoTuple(in) + gout := toGoTuple(out) + variadic := rtype.IsVariadic() + + if v.rebuild() { + rin := toReflectTypes(in) + rout := toReflectTypes(out) + rtype = reflect.FuncOf(rin, rout, variadic) + } + return v.maketype( + types.NewSignature(nil, gin, gout, variadic), + rtype, + ) +} + +// fromReflectMethod converts a reflect.Type with Kind reflect.Func into a method Type, +// i.e. into a function with receiver +func (v *Universe) fromReflectMethod(rtype reflect.Type) Type { + nin, nout := rtype.NumIn(), rtype.NumOut() + if nin == 0 { + errorf(nil, "fromReflectMethod: function type has zero arguments, cannot use first one as receiver: <%v>", rtype) + } + in := make([]Type, nin) + out := make([]Type, nout) + for i := 0; i < nin; i++ { + in[i] = v.fromReflectType(rtype.In(i)) + } + for i := 0; i < nout; i++ { + out[i] = v.fromReflectType(rtype.Out(i)) + } + grecv := toGoParam(in[0]) + gin := toGoTuple(in[1:]) + gout := toGoTuple(out) + variadic := rtype.IsVariadic() + + if v.RebuildDepth >= 1 { + rin := toReflectTypes(in) + rout := toReflectTypes(out) + rtype = reflect.FuncOf(rin, rout, variadic) + } + return v.maketype( + types.NewSignature(grecv, gin, gout, variadic), + rtype, + ) +} + +// fromReflectMethod converts a reflect.Type with Kind reflect.Func into a method Type, +// manually adding the given type as receiver +func (v *Universe) fromReflectInterfaceMethod(rtype, rmethod reflect.Type) Type { + return v.fromReflectMethod(addreceiver(rtype, rmethod)) +} + +// fromReflectInterface converts a reflect.Type with Kind reflect.Interface into a Type +func (v *Universe) fromReflectInterface(rtype reflect.Type) Type { + if rtype == v.TypeOfInterface.ReflectType() { + return v.TypeOfInterface + } + n := rtype.NumMethod() + gmethods := make([]*types.Func, n) + for i := 0; i < n; i++ { + rmethod := rtype.Method(i) + method := v.fromReflectInterfaceMethod(rtype, rmethod.Type) + pkg := v.loadPackage(rmethod.PkgPath) + gmethods[i] = types.NewFunc(token.NoPos, (*types.Package)(pkg), rmethod.Name, method.GoType().(*types.Signature)) + } + // no way to extract embedded interfaces from reflect.Type + if v.rebuild() { + rfields := make([]reflect.StructField, 1+n) + rfields[0] = approxInterfaceHeader() + for i := 0; i < n; i++ { + rmethod := rtype.Method(i) + rmethodtype := rmethod.Type + if v.RebuildDepth >= 1 { + // needed? method := v.FromReflectType(rmethod.Type) above + // should already rebuild rmethod.Type.ReflectType() + rmethodtype = v.fromReflectInterfaceMethod(rtype, rmethod.Type).ReflectType() + } + rfields[i+1] = approxInterfaceMethod(rmethod.Name, rmethodtype) + } + // interfaces may have lots of methods, thus a lot of fields in the proxy struct. + // Then use a pointer to the proxy struct: InterfaceOf() does that, and we must behave identically + rtype = reflect.PtrTo(reflect.StructOf(rfields)) + } + return v.maketype(types.NewInterface(gmethods, nil).Complete(), rtype) +} + +// isReflectInterfaceStruct returns true if rtype is a reflect.Type with Kind reflect.Struct, +// that contains our own conventions to emulate an interface +func isReflectInterfaceStruct(rtype reflect.Type) bool { + if rtype.Kind() == reflect.Struct { + if n := rtype.NumField(); n != 0 { + rfield := rtype.Field(0) + return rfield.Name == StrGensymInterface && rfield.Type == reflectTypeOfInterfaceHeader + } + } + return false +} + +// fromReflectInterfacePtrStruct converts a reflect.Type with Kind reflect.Ptr, +// that contains our own conventions to emulate an interface, into a Type +func (v *Universe) fromReflectInterfacePtrStruct(rtype reflect.Type) Type { + if rtype.Kind() != reflect.Ptr || rtype.Elem().Kind() != reflect.Struct { + errorf(nil, "internal error: fromReflectInterfacePtrStruct expects pointer-to-struct reflect.Type, found: %v", rtype) + } + rebuild := v.rebuild() + rtype = rtype.Elem() + n := rtype.NumField() + // skip rtype.Field(0), it is just approxInterfaceSelf() + var gmethods []*types.Func + var gembeddeds []*types.Named + var rebuildfields []reflect.StructField + if rebuild { + rebuildfields = make([]reflect.StructField, n) + rebuildfields[0] = approxInterfaceHeader() + } + for i := 1; i < n; i++ { + rfield := rtype.Field(i) + name := rfield.Name + if strings.HasPrefix(name, StrGensymEmbedded) { + typename := name[len(StrGensymEmbedded):] + t := v.fromReflectType(rfield.Type) + if t.Kind() != reflect.Interface { + errorf(t, "FromReflectType: reflect.Type <%v> is an emulated interface containing the embedded interface <%v>.\n\tExtracting the latter returned a non-interface: %v", t) + } + t = v.named(t, typename, rfield.Type.PkgPath()) + gembeddeds = append(gembeddeds, t.GoType().(*types.Named)) + if rebuild { + rebuildfields[i] = approxInterfaceEmbedded(t) + } + } else { + if strings.HasPrefix(name, StrGensymPrivate) { + name = name[len(StrGensymPrivate):] + } + t := v.fromReflectFunc(rfield.Type) + if t.Kind() != reflect.Func { + errorf(t, "FromReflectType: reflect.Type <%v> is an emulated interface containing the method <%v>.\n\tExtracting the latter returned a non-function: %v", t) + } + gtype := t.GoType().Underlying() + pkg := v.loadPackage(rfield.PkgPath) + gmethods = append(gmethods, types.NewFunc(token.NoPos, (*types.Package)(pkg), name, gtype.(*types.Signature))) + if rebuild { + rebuildfields[i] = approxInterfaceMethod(name, t.ReflectType()) + } + } + } + if rebuild { + rtype = reflect.PtrTo(reflect.StructOf(rebuildfields)) + } + return v.maketype(types.NewInterface(gmethods, gembeddeds).Complete(), rtype) +} + +// fromReflectMap converts a reflect.Type with Kind reflect.map into a Type +func (v *Universe) fromReflectMap(rtype reflect.Type) Type { + key := v.fromReflectType(rtype.Key()) + elem := v.fromReflectType(rtype.Elem()) + if v.rebuild() { + rtype = reflect.MapOf(key.ReflectType(), elem.ReflectType()) + } + return v.maketype(types.NewMap(key.GoType(), elem.GoType()), rtype) +} + +// fromReflectPtr converts a reflect.Type with Kind reflect.Ptr into a Type +func (v *Universe) fromReflectPtr(rtype reflect.Type) Type { + relem := rtype.Elem() + var gtype types.Type + rebuild := v.rebuild() + if isReflectInterfaceStruct(relem) { + if rebuild { + v.RebuildDepth-- + defer func() { + v.RebuildDepth++ + }() + } + t := v.fromReflectInterfacePtrStruct(rtype) + if rebuild { + relem = t.ReflectType().Elem() + } + gtype = t.GoType() + } else { + elem := v.fromReflectType(relem) + gtype = types.NewPointer(elem.GoType()) + } + if rebuild { + rtype = reflect.PtrTo(relem) + } + return v.maketype(gtype, rtype) +} + +// fromReflectPtr converts a reflect.Type with Kind reflect.Slice into a Type +func (v *Universe) fromReflectSlice(rtype reflect.Type) Type { + elem := v.fromReflectType(rtype.Elem()) + if v.rebuild() { + rtype = reflect.SliceOf(elem.ReflectType()) + } + return v.maketype(types.NewSlice(elem.GoType()), rtype) +} + +// fromReflectStruct converts a reflect.Type with Kind reflect.Struct into a Type +func (v *Universe) fromReflectStruct(rtype reflect.Type) Type { + n := rtype.NumField() + fields := make([]StructField, n) + for i := 0; i < n; i++ { + rfield := rtype.Field(i) + fields[i] = v.fromReflectField(&rfield) + } + vars := toGoFields(fields) + tags := toTags(fields) + + // use reflect.StructOf to recreate reflect.Type only if requested, because it's not 100% accurate: + // reflect.StructOf does not support unexported or anonymous fields, + // and go/reflect cannot create named types, interfaces and self-referencing types + if v.rebuild() { + rfields := toReflectFields(fields, true) + rtype = reflect.StructOf(rfields) + } + return v.maketype(types.NewStruct(vars, tags), rtype) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/function.go b/vendor/github.com/cosmos72/gomacro/xreflect/function.go new file mode 100644 index 0000000..512bf6c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/function.go @@ -0,0 +1,149 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * type.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +// IsMethod reports whether a function type's contains a receiver, i.e. is a method. +// If IsMethod returns true, the actual receiver type is available as the first parameter, i.e. Type.In(0) +// It panics if the type's Kind is not Func. +func (t *xtype) IsMethod() bool { + if t.Kind() != reflect.Func { + xerrorf(t, "IsMethod of non-func type %v", t) + } + gtype := t.underlying().(*types.Signature) + return gtype.Recv() != nil +} + +// IsVariadic reports whether a function type's final input parameter is a "..." parameter. +// If so, t.In(t.NumIn() - 1) returns the parameter's implicit actual type []T. +// IsVariadic panics if the type's Kind is not Func. +func (t *xtype) IsVariadic() bool { + if t.Kind() != reflect.Func { + xerrorf(t, "In of non-func type %v", t) + } + return t.rtype.IsVariadic() +} + +// In returns the type of a function type's i'th input parameter. +// It panics if the type's Kind is not Func. +// It panics if i is not in the range [0, NumIn()). +func (t *xtype) In(i int) Type { + if t.Kind() != reflect.Func { + xerrorf(t, "In of non-func type %v", t) + } + gtype := t.underlying().(*types.Signature) + var va *types.Var + if recv := gtype.Recv(); recv != nil { + // include the receiver as first parameter + if i == 0 { + va = recv + } else { + va = gtype.Params().At(i - 1) + } + } else { + va = gtype.Params().At(i) + } + return t.universe.MakeType(va.Type(), t.rtype.In(i)) +} + +// NumIn returns a function type's input parameter count. +// It panics if the type's Kind is not Func. +func (t *xtype) NumIn() int { + if t.Kind() != reflect.Func { + xerrorf(t, "NumIn of non-func type %v", t) + } + var nparams, nrecv int + gtype := t.underlying().(*types.Signature) + if gtype.Recv() != nil { + nrecv = 1 + } + if params := gtype.Params(); params != nil { + nparams = params.Len() + } + return nparams + nrecv +} + +// NumOut returns a function type's output parameter count. +// It panics if the type's Kind is not Func. +func (t *xtype) NumOut() int { + if t.Kind() != reflect.Func { + xerrorf(t, "NumOut of non-func type %v", t) + } + gtype := t.underlying().(*types.Signature) + return gtype.Results().Len() +} + +// Out returns the type of a function type's i'th output parameter. +// It panics if the type's Kind is not Func. +// It panics if i is not in the range [0, NumOut()). +func (t *xtype) Out(i int) Type { + if t.Kind() != reflect.Func { + xerrorf(t, "Out of non-func type %v", t) + } + gtype := t.underlying().(*types.Signature) + va := gtype.Results().At(i) + return t.universe.MakeType(va.Type(), t.rtype.Out(i)) +} + +func FuncOf(in []Type, out []Type, variadic bool) Type { + return MethodOf(nil, in, out, variadic) +} + +func (v *Universe) FuncOf(in []Type, out []Type, variadic bool) Type { + return v.MethodOf(nil, in, out, variadic) +} + +func MethodOf(recv Type, in []Type, out []Type, variadic bool) Type { + v := universe + if recv != nil { + v = recv.Universe() + } else if len(in) != 0 && in[0] != nil { + v = in[0].Universe() + } else if len(out) != 0 && out[0] != nil { + v = out[0].Universe() + } + return v.MethodOf(recv, in, out, variadic) +} + +func (v *Universe) MethodOf(recv Type, in []Type, out []Type, variadic bool) Type { + gin := toGoTuple(in) + gout := toGoTuple(out) + rin := toReflectTypes(in) + rout := toReflectTypes(out) + var grecv *types.Var + if recv != nil { + rin = append([]reflect.Type{recv.ReflectType()}, rin...) + grecv = toGoParam(recv) + } + return v.MakeType( + types.NewSignature(grecv, gin, gout, variadic), + reflect.FuncOf(rin, rout, variadic), + ) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/gensym.go b/vendor/github.com/cosmos72/gomacro/xreflect/gensym.go new file mode 100644 index 0000000..3472b33 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/gensym.go @@ -0,0 +1,57 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * gensym.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "fmt" +) + +// the following constants must match with github.com/cosmos72/gomacro/base/constants.go +const ( + StrGensymInterface = "\u0080" // name of extra struct field needed by the interpreter when creating interpreted interfaces + StrGensymPrivate = "\u00AD" // prefix to generate names for unexported struct fields. + StrGensymEmbedded = "\u00BB" // prefix to generate names for embedded struct fields. +) + +var gensymn = 0 + +func GensymEmbedded(name string) string { + if len(name) == 0 { + n := gensymn + gensymn++ + name = fmt.Sprintf("%d", n) + } + return StrGensymEmbedded + name +} + +func GensymPrivate(name string) string { + if len(name) == 0 { + n := gensymn + gensymn++ + name = fmt.Sprintf("%d", n) + } + return StrGensymPrivate + name +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/global.go b/vendor/github.com/cosmos72/gomacro/xreflect/global.go new file mode 100644 index 0000000..9b8a961 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/global.go @@ -0,0 +1,136 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * global.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/ast" + "go/types" + "reflect" +) + +type Package types.Package + +// InterfaceHeader is the internal header of interpreted interfaces +type InterfaceHeader struct { + // val and typ must be private! otherwise interpreted code may mess with them and break type safety + val reflect.Value + typ Type +} + +func MakeInterfaceHeader(val reflect.Value, typ Type) InterfaceHeader { + if val.IsValid() && val.CanSet() { + val = val.Convert(val.Type()) // make a copy + } + return InterfaceHeader{val, typ} +} + +func (h InterfaceHeader) Value() reflect.Value { + return h.val +} + +func (h InterfaceHeader) Type() Type { + return h.typ +} + +type Method struct { + Name string + Pkg *Package + Type Type // method type + Funs *[]reflect.Value // (*Funs)[Index] is the method, with receiver as first argument + Index int // index for Type.Method + FieldIndex []int // embedded fields index sequence for reflect.Type.FieldByIndex or reflect.Value.FieldByIndex + GoFun *types.Func // for completeness +} + +type StructField struct { + // Name is the field name. + Name string + // Pkg is the package that qualifies a lower case (unexported) + // field name. It may be nil for upper case (exported) field names. + // See https://golang.org/ref/spec#Uniqueness_of_identifiers + Pkg *Package + Type Type // field type + Tag reflect.StructTag // field tag string + Offset uintptr // offset within struct, in bytes + Index []int // index sequence for reflect.Type.FieldByIndex or reflect.Value.FieldByIndex + Anonymous bool // is an embedded field. Note: embedded field's name should be set to the type's name +} + +type xtype struct { + kind reflect.Kind + gtype types.Type + rtype reflect.Type + universe *Universe + methodvalues []reflect.Value + fieldcache map[QName]StructField + methodcache map[QName]Method +} + +// QName is a replacement for go/types.Id and implements accurate comparison +// of type names, field names and method names. +// It recognizes unexported names, and names declared in different packages. +// +// To compare two names, build two QNames with the functions QName* +// then compare the two QName structs with == +type QName struct { + name, pkgpath string +} + +func (q QName) Name() string { + return q.name +} + +func (q QName) PkgPath() string { + return q.pkgpath +} + +type QNameI interface { + Name() string + PkgPath() string +} + +func QName2(name, pkgpath string) QName { + if ast.IsExported(name) { + pkgpath = "" + } + return QName{name, pkgpath} +} + +func QName1(q QNameI) QName { + return QName2(q.Name(), q.PkgPath()) +} + +func QNameGo2(name string, pkg *types.Package) QName { + var pkgpath string + if pkg != nil && !ast.IsExported(name) { + pkgpath = pkg.Path() + } + return QName{name, pkgpath} +} + +func QNameGo(obj types.Object) QName { + return QNameGo2(obj.Name(), obj.Pkg()) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/importer.go b/vendor/github.com/cosmos72/gomacro/xreflect/importer.go new file mode 100644 index 0000000..2682a4f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/importer.go @@ -0,0 +1,65 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * importer.go + * + * Created on May 14, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "errors" + "fmt" + "go/importer" + "go/types" +) + +type Importer struct { + from types.ImporterFrom + compat types.Importer + srcDir string + mode types.ImportMode +} + +func DefaultImporter() *Importer { + imp := Importer{} + compat := importer.Default() + if from, ok := compat.(types.ImporterFrom); ok { + imp.from = from + } else { + imp.compat = compat + } + return &imp +} + +func (imp *Importer) Import(path string) (*types.Package, error) { + return imp.ImportFrom(path, imp.srcDir, imp.mode) +} + +func (imp *Importer) ImportFrom(path string, srcDir string, mode types.ImportMode) (*types.Package, error) { + if imp.from != nil { + return imp.from.ImportFrom(path, srcDir, mode) + } else if imp.compat != nil { + return imp.compat.Import(path) + } else { + return nil, errors.New(fmt.Sprintf("importer.Default() returned nil, cannot import %q", path)) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/init.go b/vendor/github.com/cosmos72/gomacro/xreflect/init.go new file mode 100644 index 0000000..46a5e4f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/init.go @@ -0,0 +1,145 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * init.go + * + * Created on May 19, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "reflect" + "unsafe" + + "go/types" +) + +var rbasictypes = []reflect.Type{ + reflect.Bool: reflect.TypeOf(bool(false)), + reflect.Int: reflect.TypeOf(int(0)), + reflect.Int8: reflect.TypeOf(int8(0)), + reflect.Int16: reflect.TypeOf(int16(0)), + reflect.Int32: reflect.TypeOf(int32(0)), + reflect.Int64: reflect.TypeOf(int64(0)), + reflect.Uint: reflect.TypeOf(uint(0)), + reflect.Uint8: reflect.TypeOf(uint8(0)), + reflect.Uint16: reflect.TypeOf(uint16(0)), + reflect.Uint32: reflect.TypeOf(uint32(0)), + reflect.Uint64: reflect.TypeOf(uint64(0)), + reflect.Uintptr: reflect.TypeOf(uintptr(0)), + reflect.Float32: reflect.TypeOf(float32(0)), + reflect.Float64: reflect.TypeOf(float64(0)), + reflect.Complex64: reflect.TypeOf(complex64(0)), + reflect.Complex128: reflect.TypeOf(complex128(0)), + reflect.String: reflect.TypeOf(string("")), + reflect.UnsafePointer: reflect.TypeOf(unsafe.Pointer(nil)), +} + +func (v *Universe) makebasictypes() []Type { + m := make([]Type, len(rbasictypes)) + for gkind := types.Bool; gkind <= types.UnsafePointer; gkind++ { + kind := ToReflectKind(gkind) + gtype := types.Typ[gkind] + rtype := rbasictypes[kind] + if gtype == nil || rtype == nil { + continue + } + t := wrap(&xtype{kind: kind, gtype: gtype, rtype: rtype, universe: v}) + v.add(t) + m[kind] = t + } + return m +} + +func (v *Universe) makeerror() Type { + t := wrap(&xtype{ + kind: reflect.Interface, + gtype: types.Universe.Lookup("error").Type(), + rtype: reflect.TypeOf((*error)(nil)).Elem(), + universe: v, + }) + v.add(t) + return t +} + +func (v *Universe) makeinterface() Type { + t := wrap(&xtype{ + kind: reflect.Interface, + gtype: types.NewInterface(nil, nil).Complete(), + rtype: reflect.TypeOf((*interface{})(nil)).Elem(), + universe: v, + }) + v.add(t) + return t +} + +func (v *Universe) Init() *Universe { + if v.ThreadSafe { + defer un(lock(v)) + } + return v.init() +} + +func (v *Universe) init() *Universe { + v.BasicTypes = v.makebasictypes() + v.TypeOfError = v.makeerror() + v.TypeOfInterface = v.makeinterface() + // critical! trying to rebuild "error" type creates a non-indentical copy... lots of conversions would fail + v.cache(v.TypeOfError.ReflectType(), v.TypeOfError) + v.cache(v.TypeOfInterface.ReflectType(), v.TypeOfInterface) + return v +} + +func NewUniverse() *Universe { + v := &Universe{} + return v.init() +} + +const MaxDepth = int(^uint(0) >> 1) + +var ( + universe = (&Universe{ThreadSafe: true}).Init() + + reflectTypeOfInterfaceHeader = reflect.TypeOf(InterfaceHeader{}) +) + +func DefaultUniverse() *Universe { + return universe +} + +// Bits returns the size of the type in bits. +// It panics if the type's Kind is not one of the +// sized or unsized Int, Uint, Float, or Complex kinds. +func (t *xtype) Bits() int { + return t.rtype.Bits() +} + +// Align returns the alignment in bytes of a value of +// this type when allocated in memory. +func (t *xtype) Align() int { + return t.rtype.Align() +} + +// FieldAlign returns the alignment in bytes of a value of +// this type when used as a field in a struct. +func (t *xtype) FieldAlign() int { + return t.rtype.FieldAlign() +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/interface.go b/vendor/github.com/cosmos72/gomacro/xreflect/interface.go new file mode 100644 index 0000000..e4d5eaf --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/interface.go @@ -0,0 +1,129 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * struct.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/token" + "go/types" + "reflect" +) + +func toGoFuncs(names []string, methods []Type) []*types.Func { + gfuns := make([]*types.Func, len(methods)) + for i, t := range methods { + switch gsig := t.underlying().(type) { + case *types.Signature: + gfuns[i] = types.NewFunc(token.NoPos, nil, names[i], gsig) + default: + errorf(t, "InterfaceOf: %d-th 'method' argument is not a function type: %v", i, t) + } + } + return gfuns +} + +func toGoNamedTypes(ts []Type) []*types.Named { + gnameds := make([]*types.Named, len(ts)) + for i, t := range ts { + if gt, ok := t.GoType().(*types.Named); ok { + gnameds[i] = gt + } else { + errorf(t, "InterfaceOf: %d-th 'embedded' argument is not a named type: %v", i, t) + } + } + return gnameds +} + +func (v *Universe) InterfaceOf(methodnames []string, methods []Type, embeddeds []Type) Type { + gmethods := toGoFuncs(methodnames, methods) + gembeddeds := toGoNamedTypes(embeddeds) + + // for reflect.Type, approximate an interface as a struct: + // one field for the wrapped object: type is interface{}, + // one field for each embedded interface: type is the embedded interface type + // one field for each method: type is the method type i.e. a function + nemb := len(embeddeds) + rfields := make([]reflect.StructField, 1+nemb+len(methods)) + rfields[0] = approxInterfaceHeader() + for i, emb := range embeddeds { + rfields[i+1] = approxInterfaceEmbedded(emb) + } + for i, method := range methods { + rfields[i+nemb+1] = approxInterfaceMethod(methodnames[i], method.ReflectType()) + } + return v.maketype3( + reflect.Interface, + types.NewInterface(gmethods, gembeddeds), + // interfaces may have lots of methods, thus a lot of fields in the proxy struct. + // Use a pointer to the proxy struct + reflect.PtrTo(reflect.StructOf(rfields)), + ) +} + +// InterfaceOf returns a new interface for the given methods and embedded types. +// After the methods and embeddeds are fully defined, call Complete() to mark +// the interface as complete and compute wrapper methods for embedded fields. +// +// WARNING: the Type returned by InterfaceOf is not complete, +// i.e. its method set is not computed yet. +// Once you know that methods and embedded interfaces are complete, +// call Complete() to compute the method set and mark this Type as complete. +func InterfaceOf(methodnames []string, methods []Type, embeddeds []Type) Type { + v := universe + if len(embeddeds) != 0 && embeddeds[0] != nil { + v = embeddeds[0].Universe() + } else if len(methods) != 0 && methods[0] != nil { + v = methods[0].Universe() + } + return v.InterfaceOf(methodnames, methods, embeddeds) +} + +// utilities for InterfaceOf() + +func approxInterfaceHeader() reflect.StructField { + return reflect.StructField{ + Name: StrGensymInterface, + Type: reflectTypeOfInterfaceHeader, + } +} + +func approxInterfaceEmbedded(t Type) reflect.StructField { + // embedded interfaces are always anonymous + return reflect.StructField{ + Name: toExportedFieldName("", t, true), + Type: t.ReflectType(), + } +} + +func approxInterfaceMethod(name string, rtype reflect.Type) reflect.StructField { + // interface methods cannot be anonymous + if len(name) == 0 { + name = "_" + } + return reflect.StructField{ + Name: toExportedFieldName(name, nil, false), + Type: rtype, + } +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/lookup.go b/vendor/github.com/cosmos72/gomacro/xreflect/lookup.go new file mode 100644 index 0000000..e6721f0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/lookup.go @@ -0,0 +1,304 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * lookup.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +// FieldByName returns the (possibly embedded) struct field with given name, +// and the number of fields found at the same (shallowest) depth: 0 if not found. +// Private fields are returned only if they were declared in pkgpath. +func (t *xtype) FieldByName(name, pkgpath string) (field StructField, count int) { + if name == "_" || t.kind != reflect.Struct { + return + } + // debugf("field cache for %v <%v> = %v", unsafe.Pointer(t), t, t.fieldcache) + qname := QName2(name, pkgpath) + + v := t.universe + if v.ThreadSafe { + defer un(lock(v)) + } + field, found := t.fieldcache[qname] + if found { + if field.Index == nil { // marker for ambiguous field names + count = int(field.Offset) // reuse Offset as "number of ambiguous fields" + } else { + count = 1 + } + return field, count + } + var tovisit []StructField + + field, count, tovisit = fieldByName(t, qname, 0, nil) + + // breadth-first recursion + for count == 0 && len(tovisit) != 0 { + var next []StructField + for _, f := range tovisit { + efield, ecount, etovisit := fieldByName(unwrap(f.Type), qname, f.Offset, f.Index) + if count == 0 { + if ecount > 0 { + field = efield + } else { + // no recursion if we found something + next = append(next, etovisit...) + } + } + count += ecount + } + tovisit = next + } + if count > 0 { + cacheFieldByName(t, qname, &field, count) + } + return field, count +} + +func fieldByName(t *xtype, qname QName, offset uintptr, index []int) (field StructField, count int, tovisit []StructField) { + // also support embedded fields: they can be named types or pointers to named types + if t.kind == reflect.Ptr { + t = unwrap(t.elem()) + } + gtype, ok := t.gtype.Underlying().(*types.Struct) + if !ok { + debugf("fieldByName: type is %s, not struct. bailing out", t.kind) + return + } + n := t.NumField() + for i := 0; i < n; i++ { + + gfield := gtype.Field(i) + if matchFieldByName(qname, gfield) { + if count == 0 { + field = t.field(i) // lock already held + field.Offset += offset + field.Index = concat(index, field.Index) // make a copy of index + // debugf("fieldByName: %d-th field of <%v> matches: %#v", i, t.rtype, field) + } + count++ + } else if count == 0 && gfield.Anonymous() { + efield := t.field(i) // lock already held + efield.Offset += offset + efield.Index = concat(index, efield.Index) // make a copy of index + // debugf("fieldByName: %d-th field of <%v> is anonymous: %#v", i, t.rtype, efield) + tovisit = append(tovisit, efield) + } + } + return +} + +// return true if gfield name matches given name, or if it's anonymous and its *type* name matches given name +func matchFieldByName(qname QName, gfield *types.Var) bool { + // always check the field's package, not the type's package + if qname == QNameGo(gfield) { + return true + } + if gfield.Anonymous() { + gtype := gfield.Type() + if gptr, ok := gtype.(*types.Pointer); ok { + // unnamed field has unnamed pointer type, as for example *Foo + // check the element type + gtype = gptr.Elem() + } + switch gtype := gtype.(type) { + case *types.Basic: + // is it possible to embed basic types? + // yes, and they work as unexported embedded fields, + // i.e. in the same package as the struct that includes them + return qname == QNameGo2(gtype.Name(), gfield.Pkg()) + case *types.Named: + // gtype.Obj().Pkg() and gfield.Pkg() should be identical for *unexported* fields + // (they are ignored for exported fields) + return qname == QNameGo2(gtype.Obj().Name(), gfield.Pkg()) + } + } + return false +} + +// add field to type's fieldcache. used by Type.FieldByName after a successful lookup +func cacheFieldByName(t *xtype, qname QName, field *StructField, count int) { + if t.fieldcache == nil { + t.fieldcache = make(map[QName]StructField) + } + if count > 1 { + field.Index = nil // marker for ambiguous field names + field.Offset = uintptr(count) // reuse Offset as "number of ambiguous fields" + } + t.fieldcache[qname] = *field + t.universe.fieldcache = true +} + +// anonymousFields returns the anonymous fields of a (named or unnamed) struct type +func anonymousFields(t *xtype, offset uintptr, index []int) []StructField { + var tovisit []StructField + gt := t.gtype.Underlying() + if gptr, ok := gt.(*types.Pointer); ok { + gt = gptr.Elem().Underlying() + } + gtype, ok := gt.(*types.Struct) + if !ok { + return tovisit + } + n := gtype.NumFields() + for i := 0; i < n; i++ { + gfield := gtype.Field(i) + if gfield.Anonymous() { + field := t.Field(i) + field.Offset += offset + field.Index = concat(index, field.Index) // make a copy of index + tovisit = append(tovisit, field) + } + } + return tovisit +} + +// MethodByName returns the method with given name (including wrapper methods for embedded fields) +// and the number of methods found at the same (shallowest) depth: 0 if not found. +// Private methods are returned only if they were declared in pkgpath. +func (t *xtype) MethodByName(name, pkgpath string) (method Method, count int) { + // debugf("method cache for %v <%v> = %v", unsafe.Pointer(t), t, t.methodcache) + + // only named types and interfaces can have methods + if name == "_" || (!t.Named() && t.kind != reflect.Interface) { + return + } + qname := QName2(name, pkgpath) + v := t.universe + if v.ThreadSafe { + defer un(lock(v)) + } + method, found := t.methodcache[qname] + if found { + index := method.Index + if index < 0 { // marker for ambiguous method names + count = -index + } else { + count = 1 + } + return method, count + } + method, count = methodByName(t, qname, nil) + if count == 0 { + tovisit := anonymousFields(t, 0, nil) + // breadth-first recursion + for count == 0 && len(tovisit) != 0 { + var next []StructField + for _, f := range tovisit { + et := unwrap(f.Type) + emethod, ecount := methodByName(et, qname, f.Index) + if count == 0 { + if ecount > 0 { + method = emethod + } else { + // no recursion if we found something + next = append(next, anonymousFields(et, f.Offset, f.Index)...) + } + } + count += ecount + } + tovisit = next + } + } + if count > 0 { + cacheMethodByName(t, qname, &method, count) + } + return method, count +} + +func methodByName(t *xtype, qname QName, index []int) (method Method, count int) { + // also support embedded fields: they can be named types or pointers to named types + if t.kind == reflect.Ptr { + t = unwrap(t.elem()) + } + n := t.NumMethod() + for i := 0; i < n; i++ { + gmethod := t.gmethod(i) + if matchMethodByName(qname, gmethod) { + if count == 0 { + method = t.method(i) // lock already held + method.FieldIndex = concat(index, method.FieldIndex) // make a copy of index + // debugf("methodByName: %d-th method of <%v> matches: %#v", i, t.rtype, method) + } + count++ + } + } + return +} + +// return true if gmethod name matches given name +func matchMethodByName(qname QName, gmethod *types.Func) bool { + // always check the methods's package, not the type's package + return qname == QNameGo(gmethod) +} + +// add method to type's methodcache. used by Type.MethodByName after a successful lookup +func cacheMethodByName(t *xtype, qname QName, method *Method, count int) { + if t.methodcache == nil { + t.methodcache = make(map[QName]Method) + } + if count > 1 { + method.Index = -count // marker for ambiguous method names + } + t.methodcache[qname] = *method + t.universe.methodcache = true +} + +func invalidateCache(gtype types.Type, t interface{}) { + if t, ok := t.(Type); ok { + t := unwrap(t) + t.fieldcache = nil + t.methodcache = nil + } +} + +func invalidateMethodCache(gtype types.Type, t interface{}) { + if t, ok := t.(Type); ok { + t := unwrap(t) + t.methodcache = nil + } +} + +// clears all xtype.fieldcache and xtype.methodcache. +// invoked by NamedOf() when a type is redefined. +func (v *Universe) InvalidateCache() { + if v.fieldcache || v.methodcache { + v.gmap.Iterate(invalidateCache) + v.fieldcache = false + v.methodcache = false + } +} + +// clears all xtype.methodcache. +// invoked by AddMethod() when a method is redefined. +func (v *Universe) InvalidateMethodCache() { + if v.methodcache { + v.gmap.Iterate(invalidateMethodCache) + v.methodcache = false + } +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/named.go b/vendor/github.com/cosmos72/gomacro/xreflect/named.go new file mode 100644 index 0000000..631e602 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/named.go @@ -0,0 +1,365 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * named.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/ast" + "go/token" + "go/types" + "reflect" + "sort" + "unsafe" +) + +// NumMethod returns the number of explicitly declared methods of named type or interface t. +// Wrapper methods for embedded fields or embedded interfaces are not counted. +func (t *xtype) NumMethod() int { + num := 0 + if gtype, ok := t.gtype.Underlying().(*types.Interface); ok { + num = gtype.NumExplicitMethods() + } else if gtype, ok := t.gtype.(*types.Named); ok { + num = gtype.NumMethods() + } + return num +} + +// Method return the i-th explicitly declared method of named type or interface t. +// Wrapper methods for embedded fields are not counted +func (t *xtype) Method(i int) Method { + v := t.universe + if v.ThreadSafe { + defer un(lock(v)) + } + return t.method(i) +} + +func (t *xtype) method(i int) Method { + gfunc := t.gmethod(i) + name := gfunc.Name() + resizemethodvalues(t) + + rtype := t.rtype + var rfunctype reflect.Type + rfuncs := &t.methodvalues + rfunc := t.methodvalues[i] + if rfunc.Kind() == reflect.Func { + // easy, method is cached already + rfunctype = rfunc.Type() + } else if gtype, ok := t.gtype.Underlying().(*types.Interface); ok { + if rtype.Kind() == reflect.Ptr && isReflectInterfaceStruct(rtype.Elem()) { + // rtype is our emulated interface type. + // it's a pointer to a struct containing: InterfaceHeader, embeddeds, methods (without receiver) + skip := gtype.NumEmbeddeds() + 1 + rfield := rtype.Elem().Field(i + skip) + rfunctype = addreceiver(rtype, rfield.Type) + } else if rtype.Kind() != reflect.Interface { + xerrorf(t, "inconsistent interface type <%v>: expecting interface reflect.Type, found <%v>", t, rtype) + } else if ast.IsExported(name) { + // rtype is an interface type, and reflect only returns exported methods + // rtype.MethodByName returns a Method with the following caveats + // 1) Type == method signature, without a receiver + // 2) Func == nil. + rmethod, _ := rtype.MethodByName(name) + if rmethod.Type == nil { + xerrorf(t, "interface type <%v>: reflect method %q not found", t, name) + } else if rmethod.Index != i { + xerrorf(t, "inconsistent interface type <%v>: method %q has go/types.Func index=%d but reflect.Method index=%d", + t, name, i, rmethod.Index) + } + rfunctype = addreceiver(rtype, rmethod.Type) + } + } else { + rmethod, _ := rtype.MethodByName(gfunc.Name()) + rfunc = rmethod.Func + if rfunc.Kind() != reflect.Func { + if rtype.Kind() != reflect.Ptr { + // also search in the method set of pointer-to-t + rmethod, _ = reflect.PtrTo(rtype).MethodByName(gfunc.Name()) + rfunc = rmethod.Func + } + } + if rfunc.Kind() != reflect.Func { + if ast.IsExported(name) { + xerrorf(t, "type <%v>: reflect method %q not found", t, gfunc.Name()) + } + } else { + t.methodvalues[i] = rfunc + rfunctype = rmethod.Type + } + } + return t.makemethod(i, gfunc, rfuncs, rfunctype) // lock already held +} + +func addreceiver(recv reflect.Type, rtype reflect.Type) reflect.Type { + nin := rtype.NumIn() + rin := make([]reflect.Type, nin+1) + rin[0] = recv + for i := 0; i < nin; i++ { + rin[i+1] = rtype.In(i) + } + nout := rtype.NumOut() + rout := make([]reflect.Type, nout) + for i := 0; i < nout; i++ { + rout[i] = rtype.Out(i) + } + return reflect.FuncOf(rin, rout, rtype.IsVariadic()) +} + +func (t *xtype) gmethod(i int) *types.Func { + var gfun *types.Func + if gtype, ok := t.gtype.Underlying().(*types.Interface); ok { + gfun = gtype.ExplicitMethod(i) + } else if gtype, ok := t.gtype.(*types.Named); ok { + gfun = gtype.Method(i) + } else { + xerrorf(t, "Method on invalid type %v", t) + } + return gfun +} + +func (t *xtype) makemethod(index int, gfun *types.Func, rfuns *[]reflect.Value, rfunctype reflect.Type) Method { + // sanity checks + name := gfun.Name() + gsig := gfun.Type().Underlying().(*types.Signature) + if rfunctype != nil { + nparams := 0 + if gsig.Params() != nil { + nparams = gsig.Params().Len() + } + if gsig.Recv() != nil { + if nparams+1 != rfunctype.NumIn() { + xerrorf(t, `type <%v>: inconsistent %d-th method signature: + go/types.Type has receiver <%v> and %d parameters: %v + reflect.Type has %d parameters: %v`, t, index, gsig.Recv(), nparams, gsig, rfunctype.NumIn(), rfunctype) + } + } else if nparams != rfunctype.NumIn() { + xerrorf(t, `type <%v>: inconsistent %d-th method signature: + go/types.Type has no receiver and %d parameters: %v + reflect.Type has %d parameters: %v`, t, index, nparams, gsig, rfunctype.NumIn(), rfunctype) + } + } + var tmethod Type + if rfunctype != nil { + tmethod = t.universe.maketype(gsig, rfunctype) // lock already held + } + return Method{ + Name: name, + Pkg: (*Package)(gfun.Pkg()), + Type: tmethod, + Funs: rfuns, + Index: index, + GoFun: gfun, + } +} + +func resizemethodvalues(t *xtype) { + n := t.NumMethod() + if cap(t.methodvalues) < n { + slice := make([]reflect.Value, n, n+n/2+4) + copy(slice, t.methodvalues) + t.methodvalues = slice + } else if len(t.methodvalues) < n { + t.methodvalues = t.methodvalues[0:n] + } +} + +func (v *Universe) NamedOf(name, pkgpath string) Type { + if v.ThreadSafe { + defer un(lock(v)) + } + return v.namedOf(name, pkgpath) +} + +func (v *Universe) namedOf(name, pkgpath string) Type { + underlying := v.TypeOfInterface + pkg := v.loadPackage(pkgpath) + // typename := types.NewTypeName(token.NoPos, (*types.Package)(pkg), name, underlying.GoType()) + typename := types.NewTypeName(token.NoPos, (*types.Package)(pkg), name, nil) + return v.maketype3( + reflect.Invalid, // incomplete type! will be fixed by SetUnderlying + types.NewNamed(typename, underlying.GoType(), nil), + underlying.ReflectType(), + ) +} + +// SetUnderlying sets the underlying type of a named type and marks t as complete. +// It panics if the type is unnamed, or if the underlying type is named, +// or if SetUnderlying() was already invoked on the named type. +func (t *xtype) SetUnderlying(underlying Type) { + switch gtype := t.gtype.(type) { + case *types.Named: + v := t.universe + if t.kind != reflect.Invalid || gtype.Underlying() != v.TypeOfInterface.GoType() || t.rtype != v.TypeOfInterface.ReflectType() { + // redefined type. try really hard to support it. + v.InvalidateCache() + // xerrorf(t, "SetUnderlying invoked multiple times on named type %v", t) + } + gunderlying := underlying.GoType().Underlying() // in case underlying is named + t.kind = gtypeToKind(t, gunderlying) + gtype.SetUnderlying(gunderlying) + t.rtype = underlying.ReflectType() + default: + xerrorf(t, "SetUnderlying of unnamed type %v", t) + } +} + +// AddMethod adds method 'name' to type. +// It panics if the type is unnamed, or if the signature is not a function type, +// Returns the method index, or < 0 in case of errors +func (t *xtype) AddMethod(name string, signature Type) int { + gtype, ok := t.gtype.(*types.Named) + if !ok { + xerrorf(t, "AddMethod on unnamed type %v", t) + } + kind := gtypeToKind(t, gtype.Underlying()) + if kind == reflect.Ptr || kind == reflect.Interface { + xerrorf(t, "AddMethod: cannot add methods to named %s type: <%v>", kind, t) + } + if signature.Kind() != reflect.Func { + xerrorf(t, "AddMethod on <%v> of non-function: %v", t, signature) + } + gsig := signature.underlying().(*types.Signature) + // accept both signatures "non-nil receiver" and "nil receiver, use the first parameter as receiver" + grecv := gsig.Recv() + if grecv == nil && gsig.Params().Len() != 0 { + grecv = gsig.Params().At(0) + } + if grecv == nil { + xerrorf(t, "AddMethod on <%v> of function with no receiver and no parameters: %v", t, gsig) + } + if !types.IdenticalIgnoreTags(grecv.Type(), gtype) && + // !types.IdenticalIgnoreTags(grecv.Type(), gtype.Underlying()) && + !types.IdenticalIgnoreTags(grecv.Type(), types.NewPointer(gtype)) { + + label := "receiver" + if gsig.Recv() == nil { + label = "first parameter" + } + xerrorf(t, "AddMethod on <%v> of function <%v> with mismatched %s type: %v", t, gsig, label, grecv.Type()) + } + + gpkg := gtype.Obj().Pkg() + gfun := types.NewFunc(token.NoPos, gpkg, name, gsig) + + n1 := gtype.NumMethods() + index := unsafeAddMethod(gtype, gfun) + n2 := gtype.NumMethods() + + // update the caches... be careful if the method was just redefined + nilv := reflect.Value{} + for len(t.methodvalues) < n2 { + t.methodvalues = append(t.methodvalues, nilv) + } + t.methodvalues[index] = nilv + if n1 == n2 { + // an existing method was overwritten. + // it may be cached in some other type's method cache. + t.universe.InvalidateMethodCache() + } + return index +} + +// RemoveMethods removes given methods from type. +// It panics if the type is unnamed, or if the signature is not a function type, +func (t *xtype) RemoveMethods(names []string, pkgpath string) { + gtype, ok := t.gtype.(*types.Named) + if !ok { + xerrorf(t, "RemoveMethods on unnamed type %v", t) + } + if len(names) == 0 { + return + } + n1 := gtype.NumMethods() + unsafeRemoveMethods(gtype, names, pkgpath) + n2 := gtype.NumMethods() + if n1 != n2 { + // some existing methods were removed. + // they may be cached in some other type's method cache. + t.universe.InvalidateMethodCache() + } +} + +// internal representation of go/types.Named +type unsafeNamed struct { + obj *types.TypeName + underlying types.Type + methods []*types.Func +} + +// patched version of go/types.Named.AddMethod() that *overwrites* matching methods +// (the original does not) +func unsafeAddMethod(gtype *types.Named, gfun *types.Func) int { + if gfun.Name() == "_" { + return -1 + } + gt := (*unsafeNamed)(unsafe.Pointer(gtype)) + qname := QNameGo(gfun) + for i, m := range gt.methods { + if qname == QNameGo(m) { + gt.methods[i] = gfun + return i + } + } + gt.methods = append(gt.methods, gfun) + return len(gt.methods) - 1 +} + +func unsafeRemoveMethods(gtype *types.Named, names []string, pkgpath string) { + names = append([]string{}, names...) // make a copy + sort.Strings(names) // and sort it + + gt := (*unsafeNamed)(unsafe.Pointer(gtype)) + + n1 := len(gt.methods) + n2 := n1 + for i, j := 0, 0; i < n1; i++ { + m := gt.methods[i] + name := m.Name() + pos := sort.SearchStrings(names, name) + if pos < len(names) && names[pos] == name && (m.Exported() || m.Pkg().Path() == pkgpath) { + // delete this method + n2-- + continue + } + if i != j { + gt.methods[j] = gt.methods[i] + } + j++ + } + if n1 != n2 { + gt.methods = gt.methods[:n2] + } +} + +// GetMethods returns the pointer to the method values. +// It panics if the type is unnamed +func (t *xtype) GetMethods() *[]reflect.Value { + if !t.Named() { + xerrorf(t, "GetMethods on unnamed type %v", t) + } + resizemethodvalues(t) + return &t.methodvalues +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/package.go b/vendor/github.com/cosmos72/gomacro/xreflect/package.go new file mode 100644 index 0000000..08f10c1 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/package.go @@ -0,0 +1,82 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * package.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "strings" +) + +func (v *Universe) loadPackage(path string) *Package { + if len(path) == 0 { + // do not create unnamed packages + return nil + } + if pkg := v.Packages[path]; pkg != nil { + return pkg + } + // try to import the package first... + // slower, but creates the correct Typename objects for named types + if pkg := v.importPackage(path); pkg != nil { + return pkg + } + if v.Packages == nil { + v.Packages = make(map[string]*Package) + } + name := path[1+strings.LastIndexByte(path, '/'):] + pkg := (*Package)(types.NewPackage(path, name)) + v.Packages[path] = pkg + return pkg +} + +func (v *Universe) LoadPackage(path string) *Package { + if len(path) == 0 { + // do not create unnamed packages + return nil + } + if v.ThreadSafe { + defer un(lock(v)) + } + return v.loadPackage(path) +} + +func (pkg *Package) GoPackage() *types.Package { + return (*types.Package)(pkg) +} + +func (pkg *Package) Name() string { + if pkg == nil { + return "" + } + return (*types.Package)(pkg).Name() +} + +func (pkg *Package) Path() string { + if pkg == nil { + return "" + } + return (*types.Package)(pkg).Path() +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/struct.go b/vendor/github.com/cosmos72/gomacro/xreflect/struct.go new file mode 100644 index 0000000..7437f7e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/struct.go @@ -0,0 +1,181 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * struct.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "fmt" + "go/ast" + "go/token" + "go/types" + "reflect" +) + +// Field returns a struct type's i'th field. +// It panics if the type's Kind is not Struct. +// It panics if i is not in the range [0, NumField()). +func (t *xtype) Field(i int) StructField { + if t.kind != reflect.Struct { + xerrorf(t, "Field of non-struct type %v", t) + } + v := t.universe + if v.ThreadSafe { + defer un(lock(v)) + } + return t.field(i) +} + +func (t *xtype) field(i int) StructField { + if t.kind != reflect.Struct { + xerrorf(t, "Field of non-struct type %v", t) + } + gtype := t.gtype.Underlying().(*types.Struct) + + va := gtype.Field(i) + rf := t.rtype.Field(i) + + return StructField{ + Name: va.Name(), + Pkg: (*Package)(va.Pkg()), + Type: t.universe.maketype(va.Type(), rf.Type), // lock already held + Tag: rf.Tag, + Offset: rf.Offset, + Index: rf.Index, + Anonymous: va.Anonymous(), + } +} + +// NumField returns a struct type's field count. +// It panics if the type's Kind is not Struct. +func (t *xtype) NumField() int { + if t.kind != reflect.Struct { + xerrorf(t, "NumField of non-struct type %v", t) + } + gtype := t.underlying().(*types.Struct) + return gtype.NumFields() +} + +func (field *StructField) toReflectField(forceExported bool) reflect.StructField { + var pkgpath string + if pkg := field.Pkg; pkg != nil && !forceExported { + pkgpath = pkg.Path() + } + name := field.Name + if forceExported { + name = toExportedFieldName(name, field.Type, field.Anonymous) + } + return reflect.StructField{ + Name: name, + PkgPath: pkgpath, + Type: field.Type.ReflectType(), + Tag: field.Tag, + Offset: field.Offset, + Index: field.Index, + Anonymous: field.Anonymous, + } +} + +func toReflectFields(fields []StructField, forceExported bool) []reflect.StructField { + rfields := make([]reflect.StructField, len(fields)) + for i := range fields { + rfields[i] = fields[i].toReflectField(forceExported) + } + return rfields +} + +func (field *StructField) sanitize(i int) { + if len(field.Name) != 0 { + return + } + t := field.Type + name := t.Name() + if len(name) == 0 && t.Kind() == reflect.Ptr { + name = t.elem().Name() + } + if len(name) == 0 { + name = StrGensymEmbedded + fmt.Sprintf("%d", i) + } + field.Name = name + field.Anonymous = true +} + +func (field *StructField) toGoField(i int) *types.Var { + field.sanitize(i) + return types.NewField(token.NoPos, (*types.Package)(field.Pkg), field.Name, field.Type.GoType(), field.Anonymous) +} + +func toGoFields(fields []StructField) []*types.Var { + vars := make([]*types.Var, len(fields)) + for i := range fields { + vars[i] = fields[i].toGoField(i) + } + return vars +} + +func (field *StructField) toTag() string { + return string(field.Tag) +} + +func toTags(fields []StructField) []string { + tags := make([]string, len(fields)) + for i := range fields { + tags[i] = fields[i].toTag() + } + return tags +} + +func toExportedFieldName(name string, t Type, anonymous bool) string { + if len(name) == 0 && t != nil { + if name = t.Name(); len(name) == 0 && t.Kind() == reflect.Ptr { + name = t.elem().Name() + } + } + if !ast.IsExported(name) { + if anonymous { + return GensymEmbedded(name) + } else { + return GensymPrivate(name) + } + } + return name +} + +func (v *Universe) StructOf(fields []StructField) Type { + vars := toGoFields(fields) + tags := toTags(fields) + rfields := toReflectFields(fields, true) + return v.MakeType( + types.NewStruct(vars, tags), + reflect.StructOf(rfields), + ) +} + +func StructOf(fields []StructField) Type { + v := universe + if len(fields) != 0 && fields[0].Type != nil { + v = fields[0].Type.Universe() + } + return v.StructOf(fields) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/type.go b/vendor/github.com/cosmos72/gomacro/xreflect/type.go new file mode 100644 index 0000000..499e352 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/type.go @@ -0,0 +1,263 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * type.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" +) + +func SameType(t, u Type) bool { + xnil := t == nil + ynil := u == nil + if xnil || ynil { + return xnil == ynil + } + xt := unwrap(t) + yt := unwrap(u) + return xt == yt || xt.same(yt) +} + +func (t *xtype) same(u *xtype) bool { + return types.IdenticalIgnoreTags(t.GoType(), u.GoType()) +} + +func (m *Types) add(t Type) { + if t.Kind() == reflect.Interface { + rtype := t.ReflectType() + rkind := rtype.Kind() + if rkind != reflect.Interface && (rkind != reflect.Ptr || rtype.Elem().Kind() != reflect.Struct) { + errorf(t, "bug! inconsistent type <%v>: has kind = %s but its Type.Reflect() is %s\n\tinstead of interface or pointer-to-struct: <%v>", t, t.Kind(), rtype.Kind(), t.ReflectType()) + } + } + m.gmap.Set(t.GoType(), t) + // debugf("added type to cache: %v <%v> <%v>", t.Kind(), t.GoType(), t.ReflectType()) +} + +func (v *Universe) unique(t Type) Type { + gtype := t.GoType() + ret := v.Types.gmap.At(gtype) + if ret != nil { + // debugf("unique: found type in cache: %v for %v <%v> <%v>", ret, t.Kind(), gtype, t.ReflectType()) + return ret.(Type) + } + v.add(t) + return t +} + +// all unexported methods assume lock is already held +func (v *Universe) maketype3(kind reflect.Kind, gtype types.Type, rtype reflect.Type) Type { + if gtype == nil { + errorf(nil, "MakeType of nil types.Type") + } else if rtype == nil { + errorf(nil, "MakeType of nil reflect.Type") + } + ret := v.Types.gmap.At(gtype) + if ret != nil { + t := ret.(Type) + // debugf("found type in cache:\n\t %v <%v> <%v>\n\tfor %v <%v> <%v>", t.Kind(), t.GoType(), t.ReflectType(), kind, gtype, rtype) + return t + } + if v.BasicTypes == nil { + // lazy creation of basic types + v.init() + } + t := wrap(&xtype{kind: kind, gtype: gtype, rtype: rtype, universe: v}) + v.add(t) + return t +} + +func (v *Universe) maketype(gtype types.Type, rtype reflect.Type) Type { + return v.maketype3(gtypeToKind(nil, gtype), gtype, rtype) +} + +func (v *Universe) MakeType(gtype types.Type, rtype reflect.Type) Type { + kind := gtypeToKind(nil, gtype) + if v.ThreadSafe { + defer un(lock(v)) + } + return v.maketype3(kind, gtype, rtype) +} + +// GoType returns the go/types.Type corresponding to the type. +func (t *xtype) GoType() types.Type { + return t.gtype +} + +// ReflectType returns a best-effort reflect.Type that approximates the type. +// It may be inexact for the following reasons: +// 1) missing reflect.NamedOf(): no way to programmatically create named types, or to access the underlying type of a named type +// 2) missing reflect.InterfaceOf(): interface types created at runtime will be approximated by structs +// 3) missing reflect.MethodOf(): method types created at runtime will be approximated by functions +// whose first parameter is the receiver +// 4) reflect.StructOf() does not support embedded or unexported fields +// 5) go/reflect lacks the ability to create self-referencing types: +// references to the type itself will be replaced by interface{}. +// +// Examples: +// after invoking at runtime type2.NewStruct() and type2.NewNamed() +// to create the following type: +// type List struct { Elem int; Rest *List } +// ReflectType will return a reflect.Type equivalent to: +// struct { Elem int; Rest interface{} } +// i.e. the type name will be missing due to limitation 1 above, +// and the field 'Rest' will have type interface{} instead of *List due to limitation 5. +func (t *xtype) ReflectType() reflect.Type { + return t.rtype +} + +func (t *xtype) UnsafeForceReflectType(rtype reflect.Type) { + t.rtype = rtype +} + +func (t *xtype) Universe() *Universe { + return t.universe +} + +// Named returns whether the type is named. +// It returns false for unnamed types. +func (t *xtype) Named() bool { + switch t.gtype.(type) { + case *types.Basic, *types.Named: + return true + default: + return false + } +} + +// Name returns the type's name within its package. +// It returns an empty string for unnamed types. +func (t *xtype) Name() string { + switch gtype := t.gtype.(type) { + case *types.Basic: + return gtype.Name() + case *types.Named: + return gtype.Obj().Name() + default: + return "" + } +} + +// Pkg returns a named type's package, that is, the package where it was defined. +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// Pkg will return nil. +func (t *xtype) Pkg() *Package { + switch gtype := t.gtype.(type) { + case *types.Named: + return (*Package)(gtype.Obj().Pkg()) + default: + return nil + } +} + +// PkgName returns a named type's package name, that is, +// the default name that the package provides when imported. +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// the package name will be the empty string. +func (t *xtype) PkgName() string { + switch gtype := t.gtype.(type) { + case *types.Named: + return gtype.Obj().Pkg().Name() + default: + return "" + } +} + +// PkgPath returns a named type's package path, that is, the import path +// that uniquely identifies the package, such as "encoding/base64". +// If the type was predeclared (string, error) or unnamed (*T, struct{}, []int), +// the package path will be the empty string. +func (t *xtype) PkgPath() string { + switch gtype := t.gtype.(type) { + case *types.Named: + return gtype.Obj().Pkg().Path() + default: + return "" + } +} + +// Size returns the number of bytes needed to store +// a value of the given type; it is analogous to unsafe.Sizeof. +func (t *xtype) Size() uintptr { + return t.rtype.Size() +} + +// String returns a string representation of a type. +func (t *xtype) String() string { + if t == nil { + return "invalid type" + } + return t.gtype.String() +} + +/* +// Underlying returns the underlying type of a type. +func (t *xtype) Underlying() Type { + return Type{t.underlying} +} +*/ + +func (t *xtype) underlying() types.Type { + return t.gtype.Underlying() +} + +// Kind returns the specific kind of the type. +func (t *xtype) Kind() reflect.Kind { + if t == nil { + return reflect.Invalid + } + return t.kind +} + +// Implements reports whether the type implements the interface type u. +// It panics if u's Kind is not Interface +func (t *xtype) Implements(u Type) bool { + if u.Kind() != reflect.Interface { + xerrorf(t, "Type.Implements of non-interface type: %v", u) + } + return types.Implements(t.gtype, u.GoType().Underlying().(*types.Interface)) +} + +// AssignableTo reports whether a value of the type is assignable to type u. +func (t *xtype) AssignableTo(u Type) bool { + // debugf("AssignableTo: <%v> <%v>", t, u) + return types.AssignableTo(t.gtype, u.GoType()) +} + +// ConvertibleTo reports whether a value of the type is convertible to type u. +func (t *xtype) ConvertibleTo(u Type) bool { + return types.ConvertibleTo(t.gtype, u.GoType()) +} + +// Comparable reports whether values of this type are comparable. +func (t *xtype) Comparable() bool { + return types.Comparable(t.gtype) +} + +// Zero returns a Value representing the zero value for the specified type. +func Zero(t Type) reflect.Value { + return reflect.Zero(t.ReflectType()) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/type_test.go b/vendor/github.com/cosmos72/gomacro/xreflect/type_test.go new file mode 100644 index 0000000..b7ad78e --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/type_test.go @@ -0,0 +1,457 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * type_test.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "io" + "os" + "reflect" + "testing" + "time" +) + +var v = universe + +func fail(t *testing.T, actual interface{}, expected interface{}) { + t.Errorf("expecting %v <%T>, found %v <%T>\n", expected, expected, actual, actual) +} + +func fail2(t *testing.T, actual interface{}, expected interface{}) { + t.Errorf("expecting %#v <%T>,\n\tfound %#v <%T>\n", expected, expected, actual, actual) +} + +func is(t *testing.T, actual interface{}, expected interface{}) { + if actual != expected { + fail(t, actual, expected) + } +} + +func istrue(t *testing.T, actual bool) { + if !actual { + fail(t, actual, true) + } +} + +func isdeepequal(t *testing.T, actual interface{}, expected interface{}) { + if !reflect.DeepEqual(actual, expected) { + fail2(t, actual, expected) + } +} + +func istype(t *testing.T, actual interface{}, expected interface{}) { + is(t, reflect.TypeOf(actual), reflect.TypeOf(expected)) +} + +func TestBasic(t *testing.T) { + for i, rtype := range rbasictypes { + if rtype == nil { + continue + } + kind := reflect.Kind(i) + typ := v.BasicTypes[kind] + is(t, typ.Kind(), rtype.Kind()) + is(t, typ.Name(), rtype.Name()) + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Basic)(nil)) + + basic := typ.GoType().(*types.Basic) + k := ToReflectKind(basic.Kind()) + is(t, k, rtype.Kind()) + } +} + +func TestArray(t *testing.T) { + typ := ArrayOf(7, v.BasicTypes[reflect.Uint8]) + rtype := reflect.TypeOf([7]uint8{}) + is(t, typ.Kind(), reflect.Array) + is(t, typ.Name(), "") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Array)(nil)) + is(t, typ.String(), "[7]uint8") +} + +func TestFunction(t *testing.T) { + typ := FuncOf([]Type{v.BasicTypes[reflect.Bool], v.BasicTypes[reflect.Int16]}, []Type{v.BasicTypes[reflect.String]}, false) + rtype := reflect.TypeOf(func(bool, int16) string { return "" }) + is(t, typ.Kind(), reflect.Func) + is(t, typ.Name(), "") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Signature)(nil)) + is(t, typ.String(), "func(bool, int16) string") +} + +func TestInterface1(t *testing.T) { + methodtyp := FuncOf(nil, []Type{v.BasicTypes[reflect.Int]}, false) + typ := InterfaceOf([]string{"Cap", "Len"}, []Type{methodtyp, methodtyp}, nil).Complete() + + is(t, typ.Kind(), reflect.Interface) + is(t, typ.Name(), "") + is(t, typ.NumMethod(), 2) + actual := typ.Method(0) + is(t, actual.Name, "Cap") + is(t, true, types.Identical(methodtyp.GoType(), actual.Type.GoType())) + actual = typ.Method(1) + is(t, actual.Name, "Len") + is(t, true, types.Identical(methodtyp.GoType(), actual.Type.GoType())) + istype(t, typ.GoType(), (*types.Interface)(nil)) + + rtype := reflect.PtrTo( + reflect.StructOf([]reflect.StructField{ + approxInterfaceHeader(), + reflect.StructField{Name: "Cap", Type: methodtyp.ReflectType()}, + reflect.StructField{Name: "Len", Type: methodtyp.ReflectType()}, + })) + is(t, typ.ReflectType(), rtype) + is(t, typ.String(), "interface{Cap() int; Len() int}") +} + +// test implementing 'error' interface +func TestInterfaceError(t *testing.T) { + methodtyp := FuncOf(nil, []Type{v.BasicTypes[reflect.String]}, false) + typ := InterfaceOf([]string{"Error"}, []Type{methodtyp}, nil).Complete() + + is(t, typ.Kind(), reflect.Interface) + is(t, typ.Name(), "") + is(t, typ.NumMethod(), 1) + + is(t, typ.Implements(v.TypeOfError), true) +} + +func TestMap(t *testing.T) { + typ := MapOf(v.TypeOfInterface, v.BasicTypes[reflect.Bool]) + rtype := reflect.TypeOf(map[interface{}]bool{}) + is(t, typ.Kind(), reflect.Map) + is(t, typ.Name(), "") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Map)(nil)) +} + +func TestMethod(t *testing.T) { + typ := v.NamedOf("MyInt", "main") + typ.SetUnderlying(v.BasicTypes[reflect.Int]) + rtype := reflect.TypeOf(int(0)) + is(t, typ.Kind(), reflect.Int) + is(t, typ.Name(), "MyInt") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Named)(nil)) +} + +func TestNamed(t *testing.T) { + typ := v.NamedOf("MyMap", "main") + underlying := MapOf(v.TypeOfInterface, v.BasicTypes[reflect.Bool]) + typ.SetUnderlying(underlying) + rtype := reflect.TypeOf(map[interface{}]bool{}) + is(t, typ.Kind(), reflect.Map) + is(t, typ.Name(), "MyMap") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Named)(nil)) +} + +func TestSelfReference(t *testing.T) { + typ := v.NamedOf("List", "main") + underlying := StructOf([]StructField{ + StructField{Name: "First", Type: v.BasicTypes[reflect.Int]}, + StructField{Name: "Rest", Type: typ}, + }) + typ.SetUnderlying(underlying) + rtype := reflect.TypeOf(struct { + First int + Rest interface{} + }{}) + is(t, typ.Kind(), reflect.Struct) + is(t, typ.Name(), "List") + is(t, typ.ReflectType(), rtype) + is(t, true, types.Identical(typ.Field(1).Type.GoType(), typ.GoType())) + istype(t, typ.GoType(), (*types.Named)(nil)) + + is(t, typ.String(), "main.List") + is(t, typ.underlying().String(), "struct{First int; Rest main.List}") +} + +func TestStruct(t *testing.T) { + typ := StructOf([]StructField{ + StructField{Name: "First", Type: v.BasicTypes[reflect.Int]}, + StructField{Name: "Rest", Type: v.TypeOfInterface}, + }) + rtype := reflect.TypeOf(struct { + First int + Rest interface{} + }{}) + is(t, typ.Kind(), reflect.Struct) + is(t, typ.Name(), "") + is(t, typ.ReflectType(), rtype) + istype(t, typ.GoType(), (*types.Struct)(nil)) + is(t, typ.NumField(), rtype.NumField()) + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + rfield1 := field.toReflectField(false) + rfield2 := rtype.Field(i) + isdeepequal(t, rfield1, rfield2) + } + is(t, typ.String(), "struct{First int; Rest interface{}}") +} + +func TestEmbedded(t *testing.T) { + etyp := v.NamedOf("Box", "") + etyp.SetUnderlying(StructOf([]StructField{ + StructField{Name: "Value", Type: v.BasicTypes[reflect.Int]}, + })) + ertype := reflect.TypeOf(struct { + Value int + }{}) + is(t, etyp.Kind(), reflect.Struct) + is(t, etyp.Name(), "Box") + is(t, etyp.ReflectType(), ertype) + istype(t, etyp.GoType(), (*types.Named)(nil)) + istype(t, etyp.GoType().Underlying(), (*types.Struct)(nil)) + + typ := StructOf([]StructField{ + StructField{Name: "Label", Type: v.BasicTypes[reflect.String]}, + StructField{Type: v.PtrTo(etyp)}, // empty name => anonymous, and autodetect name from type + }) + is(t, typ.String(), "struct{Label string; *Box}") + field1 := typ.Field(1) + is(t, field1.Name, "Box") // autodetected + is(t, field1.Anonymous, true) + + // access field Struct.Value - shorthand for Struct.Box.Value + field, count := typ.FieldByName("Value", "") + is(t, count, 1) + isdeepequal(t, field.Index, []int{1, 0}) + + efield := etyp.Field(0) + field.Index = efield.Index + field.Offset = efield.Offset + isdeepequal(t, field, efield) + + // access anonymous field Struct.Box + field, count = typ.FieldByName("Box", "") + is(t, count, 1) + isdeepequal(t, field, typ.Field(1)) +} + +func TestFromReflect0(t *testing.T) { + rtype := reflect.TypeOf((*func(bool, int8, <-chan uint16, []float32, [2]float64, []complex64) map[interface{}]*string)(nil)).Elem() + v := &Universe{RebuildDepth: MaxDepth} + typ := v.FromReflectType(rtype) + is(t, typ.ReflectType(), rtype) // recreated 100% accurately? +} + +func TestFromReflect1(t *testing.T) { + rtype := reflect.TypeOf(time.Duration(0)) + typ := v.FromReflectType(rtype) + is(t, typ.ReflectType(), rtype) + is(t, typ.String(), "time.Duration") + is(t, typ.underlying().String(), "int64") +} + +func TestFromReflect2(t *testing.T) { + type Bag struct { + C <-chan bool + I int32 + U uintptr + F [3]float32 + G []float64 + M map[string]*complex64 + } + in := reflect.TypeOf(Bag{}) + expected := reflect.TypeOf(struct { + C <-chan bool + I int32 + U uintptr + F [3]float32 + G []float64 + M map[string]*complex64 + }{}) + v := &Universe{RebuildDepth: MaxDepth} + typ := v.FromReflectType(in) + actual := typ.ReflectType() + is(t, typ.Kind(), reflect.Struct) + is(t, typ.Name(), "Bag") + is(t, actual, expected) + is(t, actual.ConvertibleTo(in), true) + is(t, in.ConvertibleTo(actual), true) + is(t, actual.AssignableTo(in), true) + is(t, in.AssignableTo(actual), true) +} + +func TestFromReflect3(t *testing.T) { + rtype := reflect.TypeOf((*io.Reader)(nil)).Elem() + v := &Universe{RebuildDepth: 1} + typ := v.FromReflectType(rtype) + + actual := typ.ReflectType() + expected := reflect.PtrTo( + reflect.StructOf([]reflect.StructField{ + approxInterfaceHeader(), + reflect.StructField{Name: "Read", Type: reflect.TypeOf((*func([]uint8) (int, error))(nil)).Elem()}, + })) + is(t, typ.Kind(), reflect.Interface) + is(t, actual, expected) + is(t, typ.String(), "io.Reader") + is(t, typ.underlying().String(), "interface{Read([]uint8) (int, error)}") + + for depth := 0; depth <= 3; depth++ { + v := &Universe{RebuildDepth: depth} + typ = v.FromReflectType(rtype) + // debugf("%v\t-> %v", typ, typ.ReflectType()) + } +} + +func TestFromReflect4(t *testing.T) { + type ToString func() string + rtype := reflect.PtrTo( + reflect.StructOf([]reflect.StructField{ + approxInterfaceHeader(), + reflect.StructField{Name: "String", Type: reflect.TypeOf((*ToString)(nil)).Elem()}, + })) + typ := v.NamedOf("Stringer", "io") + v := &Universe{RebuildDepth: MaxDepth} + underlying := v.FromReflectType(rtype) + typ.SetUnderlying(underlying) + + actual := typ.ReflectType() + expected := reflect.PtrTo( + reflect.StructOf([]reflect.StructField{ + approxInterfaceHeader(), + reflect.StructField{Name: "String", Type: reflect.TypeOf((*func() string)(nil)).Elem()}, + })) + is(t, typ.Kind(), reflect.Interface) + is(t, actual, expected) + /* + is(t, typ.String(), "io.Stringer") + is(t, typ.underlying().String(), "interface{String() string}") + + for depth := 0; depth <= 3; depth++ { + v := &Universe{RebuildDepth: depth} + typ = v.FromReflectType(rtype) + // debugf("%v\t-> %v", typ, typ.ReflectType()) + } + */ +} + +func TestFromReflect5(t *testing.T) { + rtype := reflect.TypeOf((*reflect.Type)(nil)).Elem() + typ := v.FromReflectType(rtype) + + is(t, typ.String(), "reflect.Type") + + // importer is more accurate and gives even function param names... + s1 := "interface{Align() int; AssignableTo(reflect.Type) bool; Bits() int; ChanDir() reflect.ChanDir; Comparable() bool; ConvertibleTo(reflect.Type) bool; Elem() reflect.Type; Field(int) reflect.StructField; FieldAlign() int; FieldByIndex([]int) reflect.StructField; FieldByName(string) (reflect.StructField, bool); FieldByNameFunc(func(string) bool) (reflect.StructField, bool); Implements(reflect.Type) bool; In(int) reflect.Type; IsVariadic() bool; Key() reflect.Type; Kind() reflect.Kind; Len() int; Method(int) reflect.Method; MethodByName(string) (reflect.Method, bool); Name() string; NumField() int; NumIn() int; NumMethod() int; NumOut() int; Out(int) reflect.Type; PkgPath() string; Size() uintptr; String() string; common() *reflect.rtype; uncommon() *reflect.uncommonType}" + s2 := "interface{Align() int; AssignableTo(u reflect.Type) bool; Bits() int; ChanDir() reflect.ChanDir; Comparable() bool; ConvertibleTo(u reflect.Type) bool; Elem() reflect.Type; Field(i int) reflect.StructField; FieldAlign() int; FieldByIndex(index []int) reflect.StructField; FieldByName(name string) (reflect.StructField, bool); FieldByNameFunc(match func(string) bool) (reflect.StructField, bool); Implements(u reflect.Type) bool; In(i int) reflect.Type; IsVariadic() bool; Key() reflect.Type; Kind() reflect.Kind; Len() int; Method(int) reflect.Method; MethodByName(string) (reflect.Method, bool); Name() string; NumField() int; NumIn() int; NumMethod() int; NumOut() int; Out(i int) reflect.Type; PkgPath() string; Size() uintptr; String() string; common() *reflect.rtype; uncommon() *reflect.uncommonType}" + su := typ.underlying().String() + + if su != s1 && su != s2 { + is(t, su, s1) + } +} + +// test implementing 'io.Reader' interface +func TestInterfaceIoReader(t *testing.T) { + v.RebuildDepth = 0 + + in := []Type{v.SliceOf(v.BasicTypes[reflect.Uint8])} + out := []Type{v.BasicTypes[reflect.Int], v.TypeOfError} + methodtyp := v.FuncOf(in, out, false) + typ := InterfaceOf([]string{"Read"}, []Type{methodtyp}, nil).Complete() + gtyp := typ.GoType() + + is(t, typ.Kind(), reflect.Interface) + is(t, typ.Name(), "") + is(t, typ.NumMethod(), 1) + + // --------------------------- + treader := v.TypeOf((*io.Reader)(nil)).Elem() + + is(t, treader.Kind(), reflect.Interface) + is(t, treader.Name(), "Reader") + is(t, treader.NumMethod(), 1) + + istrue(t, typ.Implements(treader)) + istrue(t, typ.AssignableTo(treader)) + istrue(t, treader.AssignableTo(typ)) + istrue(t, types.Identical(gtyp, treader.GoType().Underlying())) + + // --------------------------- + io, err := v.Importer.Import("io") + istrue(t, err == nil) + istrue(t, io != nil) + + reader := io.Scope().Lookup("Reader").Type().(*types.Named) + ireader := reader.Underlying().(*types.Interface) + + is(t, reader.Obj().Name(), "Reader") + is(t, reader.NumMethods(), 0) // method Read() is declared in the interface, not in the named type + is(t, ireader.NumMethods(), 1) + + istrue(t, types.Implements(gtyp, ireader)) + istrue(t, types.Identical(gtyp, ireader)) + istrue(t, types.AssignableTo(gtyp, reader)) + istrue(t, types.AssignableTo(reader, gtyp)) + + // --------------------------- + t_file := v.TypeOf((*os.File)(nil)) + tfile := t_file.Elem() + + os, err := v.Importer.Import("os") + istrue(t, err == nil) + istrue(t, os != nil) + + file := os.Scope().Lookup("File").Type().(*types.Named) + + tfileRead := tfile.Method(6).Type.GoType().(*types.Signature) + fileRead := file.Method(6).Type().(*types.Signature) + ireaderRead := ireader.ExplicitMethod(0).Type().(*types.Signature) + + if false { + inspect("error", types.Universe.Lookup("error").Type()) + inspect("Universe.TypeOfError.GoType()", v.TypeOfError.GoType()) + inspect("tfile.Read.Results.1.Type", tfileRead.Results().At(1).Type()) + inspect("file.Read.Results.1.Type", fileRead.Results().At(1).Type()) + inspect("ireader.Read.Results.1.Type", ireaderRead.Results().At(1).Type()) + } + + istrue(t, types.Identical(tfileRead, ireaderRead)) + istrue(t, types.Identical(fileRead, ireaderRead)) + istrue(t, types.Identical(tfileRead, fileRead)) + + istrue(t, types.Implements(t_file.GoType(), ireader)) + istrue(t, types.AssignableTo(t_file.GoType(), reader)) + +} + +func inspect(label string, t types.Type) { + debugf("%s:\t%v", label, t) + switch t := t.(type) { + case *types.Named: + debugf(" typename:\t%p\t%#v", t.Obj(), t.Obj()) + for i, n := 0, t.NumMethods(); i < n; i++ { + debugf(" method %d:\t%s", i, t.Method(i)) + } + debugf(" underlying:\t%v", t.Underlying()) + } +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/universe.go b/vendor/github.com/cosmos72/gomacro/xreflect/universe.go new file mode 100644 index 0000000..6a1f9e0 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/universe.go @@ -0,0 +1,174 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * universe.go + * + * Created on May 14, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "go/types" + "reflect" + // "runtime/debug" + "sync" + + "github.com/cosmos72/gomacro/typeutil" +) + +type Types struct { + gmap typeutil.Map +} + +type Universe struct { + Types + ReflectTypes map[reflect.Type]Type + BasicTypes []Type + TypeOfInterface Type + TypeOfError Type + TryResolve func(name, pkgpath string) Type + Packages map[string]*Package + Importer types.ImporterFrom + RebuildDepth int + mutex sync.Mutex + debugmutex int + ThreadSafe bool + methodcache bool + fieldcache bool +} + +func lock(v *Universe) *Universe { + if v.debugmutex != 0 { + errorf(nil, "deadlocking universe %p", v) + } + v.mutex.Lock() + v.debugmutex++ + return v +} + +func un(v *Universe) { + // debugf("unlocking universe %p", v) + v.mutex.Unlock() + v.debugmutex-- +} + +func (v *Universe) rebuild() bool { + return v.RebuildDepth >= 0 +} + +func (v *Universe) cache(rt reflect.Type, t Type) Type { + if v.ReflectTypes == nil { + v.ReflectTypes = make(map[reflect.Type]Type) + } + v.ReflectTypes[rt] = t + // debugf("added rtype to cache: %v -> %v (%v)", rt, t, t.ReflectType()) + return t +} + +// cachePackage0 recursively adds pkg and its imports to Universe.Packages if not cached already +func (v *Universe) cachePackage0(pkg *types.Package) { + path := pkg.Path() + if _, ok := v.Packages[path]; ok { + return + } + v.Packages[path] = (*Package)(pkg) + for _, imp := range pkg.Imports() { + v.cachePackage0(imp) + } +} + +// cachePackage unconditionally adds pkg to Universe.Packages, +// then also adds its imports if not cached already +func (v *Universe) cachePackage(pkg *types.Package) { + if pkg == nil { + return + } + if v.Packages == nil { + v.Packages = make(map[string]*Package) + } + v.Packages[pkg.Path()] = (*Package)(pkg) + for _, imp := range pkg.Imports() { + v.cachePackage0(imp) + } +} + +// CachePackage unconditionally adds pkg to Universe.Packages, +// then also adds its imports if not cached already +func (v *Universe) CachePackage(pkg *types.Package) { + if pkg == nil { + return + } + if v.ThreadSafe { + defer un(lock(v)) + } + v.cachePackage(pkg) +} + +func (v *Universe) importPackage(path string) *Package { + if v.Importer == nil { + v.Importer = DefaultImporter() + } + pkg, err := v.Importer.Import(path) + if err != nil || pkg == nil { + // debugf("cannot find metadata to import package %q: %v\n\t%s", path, err, debug.Stack()) + debugf("importer: cannot find package %q metadata, approximating it with reflection", path) + return nil + } + // debugf("imported package %q", path) + v.cachePackage(pkg) + return (*Package)(pkg) +} + +func (v *Universe) namedTypeFromImport(rtype reflect.Type) Type { + t := v.namedTypeFromPackageCache(rtype) + if t != nil { + return t + } + pkg := v.importPackage(rtype.PkgPath()) + if pkg == nil { + return nil + } + + return v.namedTypeFromPackage(rtype, (*types.Package)(pkg)) +} + +func (v *Universe) namedTypeFromPackageCache(rtype reflect.Type) Type { + pkgpath := rtype.PkgPath() + pkg := (*types.Package)(v.Packages[pkgpath]) + if pkg != nil { + return v.namedTypeFromPackage(rtype, pkg) + } + return nil +} + +func (v *Universe) namedTypeFromPackage(rtype reflect.Type, pkg *types.Package) Type { + name := rtype.Name() + if scope := pkg.Scope(); scope != nil && len(name) != 0 { + if obj := scope.Lookup(name); obj != nil { + if gtype := obj.Type(); gtype != nil { + // debugf("imported named type %v for %v", gtype, rtype) + // not v.MakeType, because we already hold the lock + return v.maketype3(gtypeToKind(nil, gtype), gtype, rtype) + } + } + } + return nil +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/util.go b/vendor/github.com/cosmos72/gomacro/xreflect/util.go new file mode 100644 index 0000000..864372c --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/util.go @@ -0,0 +1,267 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * util.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "fmt" + "go/token" + "go/types" + "reflect" +) + +func concat(a, b []int) []int { + na := len(a) + c := make([]int, na+len(b)) + copy(c, a) + copy(c[na:], b) + return c +} + +func debugf(format string, args ...interface{}) { + str := fmt.Sprintf(format, args...) + fmt.Printf("// debug: %s\n", str) +} + +type Error struct { + Type Type + format string + args []interface{} +} + +func (e *Error) Error() string { + return fmt.Sprintf(e.format, e.args...) +} + +func errorf(t Type, format string, args ...interface{}) { + panic(&Error{t, format, args}) +} + +func xerrorf(t *xtype, format string, args ...interface{}) { + panic(&Error{wrap(t), format, args}) +} + +func dirToGdir(dir reflect.ChanDir) types.ChanDir { + var gdir types.ChanDir + switch dir { + case reflect.RecvDir: + gdir = types.RecvOnly + case reflect.SendDir: + gdir = types.SendOnly + case reflect.BothDir: + gdir = types.SendRecv + } + return gdir +} + +func gtypeToKind(t *xtype, gtype types.Type) reflect.Kind { + gtype = gtype.Underlying() + var kind reflect.Kind + switch gtype := gtype.(type) { + case *types.Array: + kind = reflect.Array + case *types.Basic: + kind = ToReflectKind(gtype.Kind()) + case *types.Chan: + kind = reflect.Chan + case *types.Signature: + kind = reflect.Func + case *types.Interface: + kind = reflect.Interface + case *types.Map: + kind = reflect.Map + case *types.Pointer: + kind = reflect.Ptr + case *types.Slice: + kind = reflect.Slice + case *types.Struct: + kind = reflect.Struct + // case *types.Named: // impossible, handled above + default: + xerrorf(t, "unsupported types.Type: %v", gtype) + } + // debugf("gtypeToKind(%T) -> %v", gtype, kind) + return kind +} + +func IsGoUntypedKind(gkind types.BasicKind) bool { + switch gkind { + case types.UntypedBool, types.UntypedInt, types.UntypedRune, + types.UntypedFloat, types.UntypedComplex, types.UntypedString, types.UntypedNil: + return true + default: + return false + } +} + +func ToReflectKind(gkind types.BasicKind) reflect.Kind { + var kind reflect.Kind + switch gkind { + case types.Bool, types.UntypedBool: + kind = reflect.Bool + case types.Int, types.UntypedInt: + kind = reflect.Int + case types.Int8: + kind = reflect.Int8 + case types.Int16: + kind = reflect.Int16 + case types.Int32, types.UntypedRune: + kind = reflect.Int32 + case types.Int64: + kind = reflect.Int64 + case types.Uint: + kind = reflect.Uint + case types.Uint8: + kind = reflect.Uint8 + case types.Uint16: + kind = reflect.Uint16 + case types.Uint32: + kind = reflect.Uint32 + case types.Uint64: + kind = reflect.Uint64 + case types.Uintptr: + kind = reflect.Uintptr + case types.Float32: + kind = reflect.Float32 + case types.Float64, types.UntypedFloat: + kind = reflect.Float64 + case types.Complex64: + kind = reflect.Complex64 + case types.Complex128, types.UntypedComplex: + kind = reflect.Complex128 + case types.String, types.UntypedString: + kind = reflect.String + case types.UnsafePointer: + kind = reflect.UnsafePointer + case types.UntypedNil: + kind = reflect.Invalid + default: + errorf(nil, "unsupported types.BasicKind: %v", gkind) + } + return kind +} + +func ToBasicKind(kind reflect.Kind, untyped bool) types.BasicKind { + var gkind types.BasicKind + switch kind { + case reflect.Bool: + if untyped { + gkind = types.UntypedBool + } else { + gkind = types.Bool + } + case reflect.Int: + if untyped { + gkind = types.Int + } else { + gkind = types.UntypedInt + } + case reflect.Int8: + gkind = types.Int8 + case reflect.Int16: + gkind = types.Int16 + case reflect.Int32: + if untyped { + gkind = types.UntypedRune + } else { + gkind = types.Int32 + } + case reflect.Int64: + gkind = types.Int64 + case reflect.Uint: + gkind = types.Uint + case reflect.Uint8: + gkind = types.Uint8 + case reflect.Uint16: + gkind = types.Uint16 + case reflect.Uint32: + gkind = types.Uint32 + case reflect.Uint64: + gkind = types.Uint64 + case reflect.Uintptr: + gkind = types.Uintptr + case reflect.Float32: + gkind = types.Float32 + case reflect.Float64: + if untyped { + gkind = types.UntypedFloat + } else { + gkind = types.Float64 + } + case reflect.Complex64: + gkind = types.Complex64 + case reflect.Complex128: + if untyped { + gkind = types.UntypedComplex + } else { + gkind = types.Complex128 + } + case reflect.String: + if untyped { + gkind = types.UntypedString + } else { + gkind = types.String + } + case reflect.UnsafePointer: + gkind = types.UnsafePointer + case reflect.Invalid: + gkind = types.UntypedNil + default: + errorf(nil, "unsupported refletc.Kind: %v", kind) + } + return gkind +} + +func path(gpkg *types.Package) string { + if gpkg == nil { + return "" + } + return gpkg.Path() +} + +func toReflectTypes(ts []Type) []reflect.Type { + rts := make([]reflect.Type, len(ts)) + for i, t := range ts { + rts[i] = t.ReflectType() + } + return rts +} + +func toGoParam(t Type) *types.Var { + return types.NewParam(token.NoPos, nil, "", t.GoType()) +} + +func toGoParams(ts []Type) []*types.Var { + vars := make([]*types.Var, len(ts)) + for i, t := range ts { + vars[i] = toGoParam(t) + } + return vars +} + +func toGoTuple(ts []Type) *types.Tuple { + vars := toGoParams(ts) + return types.NewTuple(vars...) +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/value.go b/vendor/github.com/cosmos72/gomacro/xreflect/value.go new file mode 100644 index 0000000..294ae27 --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/value.go @@ -0,0 +1,63 @@ +/* + * gomacro - A Go interpreter with Lisp-like macros + * + * Copyright (C) 2017 Massimiliano Ghilardi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * + * value.go + * + * Created on May 07, 2017 + * Author Massimiliano Ghilardi + */ + +package xreflect + +import ( + "reflect" +) + +type Value struct { + reflect.Value + XType Type +} + +func (v Value) Kind() reflect.Kind { + if v.XType == nil { + return reflect.Invalid + } + return v.XType.Kind() +} + +func (v Value) Type() Type { + return v.XType +} + +func (v Value) Convert(t Type) Value { + return Value{ + v.Value.Convert(t.ReflectType()), + t, + } +} + +func (v Value) FieldByName(name, pkgpath string) Value { + field, count := v.XType.FieldByName(name, pkgpath) + var w Value + if count == 1 { + w.Value = v.Value.FieldByIndex(field.Index) + w.XType = field.Type + } + return w +} diff --git a/vendor/github.com/cosmos72/gomacro/xreflect/x_package.go b/vendor/github.com/cosmos72/gomacro/xreflect/x_package.go new file mode 100644 index 0000000..00e326f --- /dev/null +++ b/vendor/github.com/cosmos72/gomacro/xreflect/x_package.go @@ -0,0 +1,72 @@ +// this file was generated by gomacro command: import _i "github.com/cosmos72/gomacro/xreflect" +// DO NOT EDIT! Any change will be lost when the file is re-generated + +package xreflect + +import ( + r "reflect" + + "github.com/cosmos72/gomacro/imports" +) + +// reflection: allow interpreted code to import "github.com/cosmos72/gomacro/xreflect" +func init() { + imports.Packages["github.com/cosmos72/gomacro/xreflect"] = imports.Package{ + Binds: map[string]r.Value{ + "ArrayOf": r.ValueOf(ArrayOf), + "ChanOf": r.ValueOf(ChanOf), + "DefaultImporter": r.ValueOf(DefaultImporter), + "DefaultUniverse": r.ValueOf(DefaultUniverse), + "FuncOf": r.ValueOf(FuncOf), + "GensymEmbedded": r.ValueOf(GensymEmbedded), + "GensymPrivate": r.ValueOf(GensymPrivate), + "InterfaceOf": r.ValueOf(InterfaceOf), + "MapOf": r.ValueOf(MapOf), + "MaxDepth": r.ValueOf(int64(MaxDepth)), + "MethodOf": r.ValueOf(MethodOf), + "NewUniverse": r.ValueOf(NewUniverse), + "PtrTo": r.ValueOf(PtrTo), + "QName1": r.ValueOf(QName1), + "QName2": r.ValueOf(QName2), + "QNameGo": r.ValueOf(QNameGo), + "QNameGo2": r.ValueOf(QNameGo2), + "SameType": r.ValueOf(SameType), + "SliceOf": r.ValueOf(SliceOf), + "StrGensymEmbedded": r.ValueOf(StrGensymEmbedded), + "StrGensymInterface": r.ValueOf(StrGensymInterface), + "StrGensymPrivate": r.ValueOf(StrGensymPrivate), + "StructOf": r.ValueOf(StructOf), + "Zero": r.ValueOf(Zero), + }, + Types: map[string]r.Type{ + "Error": r.TypeOf((*Error)(nil)).Elem(), + "Importer": r.TypeOf((*Importer)(nil)).Elem(), + "InterfaceHeader": r.TypeOf((*InterfaceHeader)(nil)).Elem(), + "Method": r.TypeOf((*Method)(nil)).Elem(), + "Package": r.TypeOf((*Package)(nil)).Elem(), + "QName": r.TypeOf((*QName)(nil)).Elem(), + "QNameI": r.TypeOf((*QNameI)(nil)).Elem(), + "StructField": r.TypeOf((*StructField)(nil)).Elem(), + "Type": r.TypeOf((*Type)(nil)).Elem(), + "Types": r.TypeOf((*Types)(nil)).Elem(), + "Universe": r.TypeOf((*Universe)(nil)).Elem(), + "Value": r.TypeOf((*Value)(nil)).Elem(), + }, + Proxies: map[string]r.Type{ + "QNameI": r.TypeOf((*QNameI_github_com_cosmos72_gomacro_xreflect)(nil)).Elem(), + }} +} + +// --------------- proxy for github.com/cosmos72/gomacro/xreflect.QNameI --------------- +type QNameI_github_com_cosmos72_gomacro_xreflect struct { + Object interface{} + Name_ func() string + PkgPath_ func() string +} + +func (Proxy *QNameI_github_com_cosmos72_gomacro_xreflect) Name() string { + return Proxy.Name_() +} +func (Proxy *QNameI_github_com_cosmos72_gomacro_xreflect) PkgPath() string { + return Proxy.PkgPath_() +} diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index 2a7cfd2..0000000 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2012-2013 Dave Collins - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 565bf58..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2015 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine and "-tags disableunsafe" -// is not added to the go build command line. -// +build !appengine,!disableunsafe - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -var ( - // offsetPtr, offsetScalar, and offsetFlag are the offsets for the - // internal reflect.Value fields. These values are valid before golang - // commit ecccf07e7f9d which changed the format. The are also valid - // after commit 82f48826c6c7 which changed the format again to mirror - // the original format. Code in the init function updates these offsets - // as necessary. - offsetPtr = uintptr(ptrSize) - offsetScalar = uintptr(0) - offsetFlag = uintptr(ptrSize * 2) - - // flagKindWidth and flagKindShift indicate various bits that the - // reflect package uses internally to track kind information. - // - // flagRO indicates whether or not the value field of a reflect.Value is - // read-only. - // - // flagIndir indicates whether the value field of a reflect.Value is - // the actual data or a pointer to the data. - // - // These values are valid before golang commit 90a7c3c86944 which - // changed their positions. Code in the init function updates these - // flags as necessary. - flagKindWidth = uintptr(5) - flagKindShift = uintptr(flagKindWidth - 1) - flagRO = uintptr(1 << 0) - flagIndir = uintptr(1 << 1) -) - -func init() { - // Older versions of reflect.Value stored small integers directly in the - // ptr field (which is named val in the older versions). Versions - // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named - // scalar for this purpose which unfortunately came before the flag - // field, so the offset of the flag field is different for those - // versions. - // - // This code constructs a new reflect.Value from a known small integer - // and checks if the size of the reflect.Value struct indicates it has - // the scalar field. When it does, the offsets are updated accordingly. - vv := reflect.ValueOf(0xf00) - if unsafe.Sizeof(vv) == (ptrSize * 4) { - offsetScalar = ptrSize * 2 - offsetFlag = ptrSize * 3 - } - - // Commit 90a7c3c86944 changed the flag positions such that the low - // order bits are the kind. This code extracts the kind from the flags - // field and ensures it's the correct type. When it's not, the flag - // order has been changed to the newer format, so the flags are updated - // accordingly. - upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag) - upfv := *(*uintptr)(upf) - flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) { - flagKindShift = 0 - flagRO = 1 << 5 - flagIndir = 1 << 6 - - // Commit adf9b30e5594 modified the flags to separate the - // flagRO flag into two bits which specifies whether or not the - // field is embedded. This causes flagIndir to move over a bit - // and means that flagRO is the combination of either of the - // original flagRO bit and the new bit. - // - // This code detects the change by extracting what used to be - // the indirect bit to ensure it's set. When it's not, the flag - // order has been changed to the newer format, so the flags are - // updated accordingly. - if upfv&flagIndir == 0 { - flagRO = 3 << 5 - flagIndir = 1 << 7 - } - } -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) (rv reflect.Value) { - indirects := 1 - vt := v.Type() - upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr) - rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag)) - if rvf&flagIndir != 0 { - vt = reflect.PtrTo(v.Type()) - indirects++ - } else if offsetScalar != 0 { - // The value is in the scalar field when it's not one of the - // reference types. - switch vt.Kind() { - case reflect.Uintptr: - case reflect.Chan: - case reflect.Func: - case reflect.Map: - case reflect.Ptr: - case reflect.UnsafePointer: - default: - upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + - offsetScalar) - } - } - - pv := reflect.NewAt(vt, upv) - rv = pv - for i := 0; i < indirects; i++ { - rv = rv.Elem() - } - return rv -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 457e412..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2015 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when either the code is running on Google App Engine or "-tags disableunsafe" -// is added to the go build command line. -// +build appengine disableunsafe - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 14f02dc..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go deleted file mode 100644 index ee1ab07..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "os" -) - -// ConfigState houses the configuration options used by spew to format and -// display values. There is a global instance, Config, that is used to control -// all top-level Formatter and Dump functionality. Each ConfigState instance -// provides methods equivalent to the top-level functions. -// -// The zero value for ConfigState provides no indentation. You would typically -// want to set it to a space or a tab. -// -// Alternatively, you can use NewDefaultConfig to get a ConfigState instance -// with default settings. See the documentation of NewDefaultConfig for default -// values. -type ConfigState struct { - // Indent specifies the string to use for each indentation level. The - // global config instance that all top-level functions use set this to a - // single space by default. If you would like more indentation, you might - // set this to a tab with "\t" or perhaps two spaces with " ". - Indent string - - // MaxDepth controls the maximum number of levels to descend into nested - // data structures. The default, 0, means there is no limit. - // - // NOTE: Circular data structures are properly detected, so it is not - // necessary to set this value unless you specifically want to limit deeply - // nested data structures. - MaxDepth int - - // DisableMethods specifies whether or not error and Stringer interfaces are - // invoked for types that implement them. - DisableMethods bool - - // DisablePointerMethods specifies whether or not to check for and invoke - // error and Stringer interfaces on types which only accept a pointer - // receiver when the current type is not a pointer. - // - // NOTE: This might be an unsafe action since calling one of these methods - // with a pointer receiver could technically mutate the value, however, - // in practice, types which choose to satisify an error or Stringer - // interface with a pointer receiver should not be mutating their state - // inside these interface methods. As a result, this option relies on - // access to the unsafe package, so it will not have any effect when - // running in environments without access to the unsafe package such as - // Google App Engine or with the "disableunsafe" build tag specified. - DisablePointerMethods bool - - // ContinueOnMethod specifies whether or not recursion should continue once - // a custom error or Stringer interface is invoked. The default, false, - // means it will print the results of invoking the custom error or Stringer - // interface and return immediately instead of continuing to recurse into - // the internals of the data type. - // - // NOTE: This flag does not have any effect if method invocation is disabled - // via the DisableMethods or DisablePointerMethods options. - ContinueOnMethod bool - - // SortKeys specifies map keys should be sorted before being printed. Use - // this to have a more deterministic, diffable output. Note that only - // native types (bool, int, uint, floats, uintptr and string) and types - // that support the error or Stringer interfaces (if methods are - // enabled) are supported, with other types sorted according to the - // reflect.Value.String() output which guarantees display stability. - SortKeys bool - - // SpewKeys specifies that, as a last resort attempt, map keys should - // be spewed to strings and sorted by those strings. This is only - // considered if SortKeys is true. - SpewKeys bool -} - -// Config is the active configuration of the top-level functions. -// The configuration can be changed by modifying the contents of spew.Config. -var Config = ConfigState{Indent: " "} - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the formatted string as a value that satisfies error. See NewFormatter -// for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, c.convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, c.convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, c.convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a Formatter interface returned by c.NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Print(a ...interface{}) (n int, err error) { - return fmt.Print(c.convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, c.convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Println(a ...interface{}) (n int, err error) { - return fmt.Println(c.convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprint(a ...interface{}) string { - return fmt.Sprint(c.convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, c.convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a Formatter interface returned by c.NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.convertArgs(a)...) -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -c.Printf, c.Println, or c.Printf. -*/ -func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(c, v) -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { - fdump(c, w, a...) -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by modifying the public members -of c. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func (c *ConfigState) Dump(a ...interface{}) { - fdump(c, os.Stdout, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func (c *ConfigState) Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(c, &buf, a...) - return buf.String() -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a spew Formatter interface using -// the ConfigState associated with s. -func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = newFormatter(c, arg) - } - return formatters -} - -// NewDefaultConfig returns a ConfigState with the following default settings. -// -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false -func NewDefaultConfig() *ConfigState { - return &ConfigState{Indent: " "} -} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go deleted file mode 100644 index 5be0c40..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/doc.go +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* -Package spew implements a deep pretty printer for Go data structures to aid in -debugging. - -A quick overview of the additional features spew provides over the built-in -printing facilities for Go data types are as follows: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) - -There are two different approaches spew allows for dumping Go data structures: - - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt - -Quick Start - -This section demonstrates how to quickly get started with spew. See the -sections below for further details on formatting and configuration options. - -To dump a variable with full newlines, indentation, type, and pointer -information use Dump, Fdump, or Sdump: - spew.Dump(myVar1, myVar2, ...) - spew.Fdump(someWriter, myVar1, myVar2, ...) - str := spew.Sdump(myVar1, myVar2, ...) - -Alternatively, if you would prefer to use format strings with a compacted inline -printing style, use the convenience wrappers Printf, Fprintf, etc with -%v (most compact), %+v (adds pointer addresses), %#v (adds types), or -%#+v (adds types and pointer addresses): - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -Configuration Options - -Configuration of spew is handled by fields in the ConfigState type. For -convenience, all of the top-level functions use a global state available -via the spew.Config global. - -It is also possible to create a ConfigState instance that provides methods -equivalent to the top-level functions. This allows concurrent configuration -options. See the ConfigState documentation for more details. - -The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage - -Simply call spew.Dump with a list of variables you want to dump: - - spew.Dump(myVar1, myVar2, ...) - -You may also call spew.Fdump if you would prefer to output to an arbitrary -io.Writer. For example, to dump to standard error: - - spew.Fdump(os.Stderr, myVar1, myVar2, ...) - -A third option is to call spew.Sdump to get the formatted output as a string: - - str := spew.Sdump(myVar1, myVar2, ...) - -Sample Dump Output - -See the Dump example for details on the setup of the types and variables being -shown here. - - (main.Foo) { - unexportedField: (*main.Bar)(0xf84002e210)({ - flag: (main.Flag) flagTwo, - data: (uintptr) - }), - ExportedField: (map[interface {}]interface {}) (len=1) { - (string) (len=3) "one": (bool) true - } - } - -Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C -command as shown. - ([]uint8) (len=32 cap=32) { - 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | - 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| - 00000020 31 32 |12| - } - -Custom Formatter - -Spew provides a custom formatter that implements the fmt.Formatter interface -so that it integrates cleanly with standard fmt package printing functions. The -formatter is useful for inline printing of smaller data types similar to the -standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Custom Formatter Usage - -The simplest way to make use of the spew custom formatter is to call one of the -convenience functions such as spew.Printf, spew.Println, or spew.Printf. The -functions have syntax you are most likely already familiar with: - - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Println(myVar, myVar2) - spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -See the Index for the full list convenience functions. - -Sample Formatter Output - -Double pointer to a uint8: - %v: <**>5 - %+v: <**>(0xf8400420d0->0xf8400420c8)5 - %#v: (**uint8)5 - %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 - -Pointer to circular struct with a uint8 field and a pointer to itself: - %v: <*>{1 <*>} - %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} - %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} - %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} - -See the Printf example for details on the setup of variables being shown -here. - -Errors - -Since it is possible for custom Stringer/error interfaces to panic, spew -detects them and handles them internally by printing the panic information -inline with the output. Since spew is intended to provide deep pretty printing -capabilities on structures, it intentionally does not return any errors. -*/ -package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go deleted file mode 100644 index a0ff95e..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "encoding/hex" - "fmt" - "io" - "os" - "reflect" - "regexp" - "strconv" - "strings" -) - -var ( - // uint8Type is a reflect.Type representing a uint8. It is used to - // convert cgo types to uint8 slices for hexdumping. - uint8Type = reflect.TypeOf(uint8(0)) - - // cCharRE is a regular expression that matches a cgo char. - // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile("^.*\\._Ctype_char$") - - // cUnsignedCharRE is a regular expression that matches a cgo unsigned - // char. It is used to detect unsigned character arrays to hexdump - // them. - cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") - - // cUint8tCharRE is a regular expression that matches a cgo uint8_t. - // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$") -) - -// dumpState contains information about the state of a dump operation. -type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextIndent bool - cs *ConfigState -} - -// indent performs indentation according to the depth level and cs.Indent -// option. -func (d *dumpState) indent() { - if d.ignoreNextIndent { - d.ignoreNextIndent = false - return - } - d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) -} - -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - -// dumpPtr handles formatting of pointers by indirecting them as necessary. -func (d *dumpState) dumpPtr(v reflect.Value) { - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range d.pointers { - if depth >= d.depth { - delete(d.pointers, k) - } - } - - // Keep list of all dereferenced pointers to show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by dereferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := d.pointers[addr]; ok && pd < d.depth { - cycleFound = true - indirects-- - break - } - d.pointers[addr] = d.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type information. - d.w.Write(openParenBytes) - d.w.Write(bytes.Repeat(asteriskBytes, indirects)) - d.w.Write([]byte(ve.Type().String())) - d.w.Write(closeParenBytes) - - // Display pointer information. - if len(pointerChain) > 0 { - d.w.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - d.w.Write(pointerChainBytes) - } - printHexPtr(d.w, addr) - } - d.w.Write(closeParenBytes) - } - - // Display dereferenced value. - d.w.Write(openParenBytes) - switch { - case nilFound == true: - d.w.Write(nilAngleBytes) - - case cycleFound == true: - d.w.Write(circularBytes) - - default: - d.ignoreNextType = true - d.dump(ve) - } - d.w.Write(closeParenBytes) -} - -// dumpSlice handles formatting of arrays and slices. Byte (uint8 under -// reflection) arrays and slices are dumped in hexdump -C fashion. -func (d *dumpState) dumpSlice(v reflect.Value) { - // Determine whether this type should be hex dumped or not. Also, - // for types which should be hexdumped, try to use the underlying data - // first, then fall back to trying to convert them to a uint8 slice. - var buf []uint8 - doConvert := false - doHexDump := false - numEntries := v.Len() - if numEntries > 0 { - vt := v.Index(0).Type() - vts := vt.String() - switch { - // C types that need to be converted. - case cCharRE.MatchString(vts): - fallthrough - case cUnsignedCharRE.MatchString(vts): - fallthrough - case cUint8tCharRE.MatchString(vts): - doConvert = true - - // Try to use existing uint8 slices and fall back to converting - // and copying if that fails. - case vt.Kind() == reflect.Uint8: - // We need an addressable interface to convert the type - // to a byte slice. However, the reflect package won't - // give us an interface on certain things like - // unexported struct fields in order to enforce - // visibility rules. We use unsafe, when available, to - // bypass these restrictions since this package does not - // mutate the values. - vs := v - if !vs.CanInterface() || !vs.CanAddr() { - vs = unsafeReflectValue(vs) - } - if !UnsafeDisabled { - vs = vs.Slice(0, numEntries) - - // Use the existing uint8 slice if it can be - // type asserted. - iface := vs.Interface() - if slice, ok := iface.([]uint8); ok { - buf = slice - doHexDump = true - break - } - } - - // The underlying data needs to be converted if it can't - // be type asserted to a uint8 slice. - doConvert = true - } - - // Copy and convert the underlying type if needed. - if doConvert && vt.ConvertibleTo(uint8Type) { - // Convert and copy each element into a uint8 byte - // slice. - buf = make([]uint8, numEntries) - for i := 0; i < numEntries; i++ { - vv := v.Index(i) - buf[i] = uint8(vv.Convert(uint8Type).Uint()) - } - doHexDump = true - } - } - - // Hexdump the entire slice as needed. - if doHexDump { - indent := strings.Repeat(d.cs.Indent, d.depth) - str := indent + hex.Dump(buf) - str = strings.Replace(str, "\n", "\n"+indent, -1) - str = strings.TrimRight(str, d.cs.Indent) - d.w.Write([]byte(str)) - return - } - - // Recursively call dump for each item. - for i := 0; i < numEntries; i++ { - d.dump(d.unpackValue(v.Index(i))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } -} - -// dump is the main workhorse for dumping a value. It uses the passed reflect -// value to figure out what kind of object we are dealing with and formats it -// appropriately. It is a recursive function, however circular data structures -// are detected and handled properly. -func (d *dumpState) dump(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - d.w.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - d.indent() - d.dumpPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !d.ignoreNextType { - d.indent() - d.w.Write(openParenBytes) - d.w.Write([]byte(v.Type().String())) - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - d.ignoreNextType = false - - // Display length and capacity if the built-in len and cap functions - // work with the value's kind and the len/cap itself is non-zero. - valueLen, valueCap := 0, 0 - switch v.Kind() { - case reflect.Array, reflect.Slice, reflect.Chan: - valueLen, valueCap = v.Len(), v.Cap() - case reflect.Map, reflect.String: - valueLen = v.Len() - } - if valueLen != 0 || valueCap != 0 { - d.w.Write(openParenBytes) - if valueLen != 0 { - d.w.Write(lenEqualsBytes) - printInt(d.w, int64(valueLen), 10) - } - if valueCap != 0 { - if valueLen != 0 { - d.w.Write(spaceBytes) - } - d.w.Write(capEqualsBytes) - printInt(d.w, int64(valueCap), 10) - } - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - - // Call Stringer/error interfaces if they exist and the handle methods flag - // is enabled - if !d.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(d.cs, d.w, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(d.w, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(d.w, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(d.w, v.Uint(), 10) - - case reflect.Float32: - printFloat(d.w, v.Float(), 32) - - case reflect.Float64: - printFloat(d.w, v.Float(), 64) - - case reflect.Complex64: - printComplex(d.w, v.Complex(), 32) - - case reflect.Complex128: - printComplex(d.w, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - d.dumpSlice(v) - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.String: - d.w.Write([]byte(strconv.Quote(v.String()))) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - d.w.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - numEntries := v.Len() - keys := v.MapKeys() - if d.cs.SortKeys { - sortValues(keys, d.cs) - } - for i, key := range keys { - d.dump(d.unpackValue(key)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.MapIndex(key))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Struct: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - vt := v.Type() - numFields := v.NumField() - for i := 0; i < numFields; i++ { - d.indent() - vtf := vt.Field(i) - d.w.Write([]byte(vtf.Name)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.Field(i))) - if i < (numFields - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(d.w, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(d.w, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it in case any new - // types are added. - default: - if v.CanInterface() { - fmt.Fprintf(d.w, "%v", v.Interface()) - } else { - fmt.Fprintf(d.w, "%v", v.String()) - } - } -} - -// fdump is a helper function to consolidate the logic from the various public -// methods which take varying writers and config states. -func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { - for _, arg := range a { - if arg == nil { - w.Write(interfaceBytes) - w.Write(spaceBytes) - w.Write(nilAngleBytes) - w.Write(newlineBytes) - continue - } - - d := dumpState{w: w, cs: cs} - d.pointers = make(map[uintptr]int) - d.dump(reflect.ValueOf(arg)) - d.w.Write(newlineBytes) - } -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func Fdump(w io.Writer, a ...interface{}) { - fdump(&Config, w, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(&Config, &buf, a...) - return buf.String() -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by an exported package global, -spew.Config. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func Dump(a ...interface{}) { - fdump(&Config, os.Stdout, a...) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go deleted file mode 100644 index ecf3b80..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// supportedFlags is a list of all the character flags supported by fmt package. -const supportedFlags = "0-+# " - -// formatState implements the fmt.Formatter interface and contains information -// about the state of a formatting operation. The NewFormatter function can -// be used to get a new Formatter which can be used directly as arguments -// in standard fmt package printing calls. -type formatState struct { - value interface{} - fs fmt.State - depth int - pointers map[uintptr]int - ignoreNextType bool - cs *ConfigState -} - -// buildDefaultFormat recreates the original format string without precision -// and width information to pass in to fmt.Sprintf in the case of an -// unrecognized type. Unless new types are added to the language, this -// function won't ever be called. -func (f *formatState) buildDefaultFormat() (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - buf.WriteRune('v') - - format = buf.String() - return format -} - -// constructOrigFormat recreates the original format string including precision -// and width information to pass along to the standard fmt package. This allows -// automatic deferral of all format strings this package doesn't support. -func (f *formatState) constructOrigFormat(verb rune) (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - if width, ok := f.fs.Width(); ok { - buf.WriteString(strconv.Itoa(width)) - } - - if precision, ok := f.fs.Precision(); ok { - buf.Write(precisionBytes) - buf.WriteString(strconv.Itoa(precision)) - } - - buf.WriteRune(verb) - - format = buf.String() - return format -} - -// unpackValue returns values inside of non-nil interfaces when possible and -// ensures that types for values which have been unpacked from an interface -// are displayed when the show types flag is also set. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (f *formatState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface { - f.ignoreNextType = false - if !v.IsNil() { - v = v.Elem() - } - } - return v -} - -// formatPtr handles formatting of pointers by indirecting them as necessary. -func (f *formatState) formatPtr(v reflect.Value) { - // Display nil if top level pointer is nil. - showTypes := f.fs.Flag('#') - if v.IsNil() && (!showTypes || f.ignoreNextType) { - f.fs.Write(nilAngleBytes) - return - } - - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range f.pointers { - if depth >= f.depth { - delete(f.pointers, k) - } - } - - // Keep list of all dereferenced pointers to possibly show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by derferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := f.pointers[addr]; ok && pd < f.depth { - cycleFound = true - indirects-- - break - } - f.pointers[addr] = f.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type or indirection level depending on flags. - if showTypes && !f.ignoreNextType { - f.fs.Write(openParenBytes) - f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) - f.fs.Write([]byte(ve.Type().String())) - f.fs.Write(closeParenBytes) - } else { - if nilFound || cycleFound { - indirects += strings.Count(ve.Type().String(), "*") - } - f.fs.Write(openAngleBytes) - f.fs.Write([]byte(strings.Repeat("*", indirects))) - f.fs.Write(closeAngleBytes) - } - - // Display pointer information depending on flags. - if f.fs.Flag('+') && (len(pointerChain) > 0) { - f.fs.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - f.fs.Write(pointerChainBytes) - } - printHexPtr(f.fs, addr) - } - f.fs.Write(closeParenBytes) - } - - // Display dereferenced value. - switch { - case nilFound == true: - f.fs.Write(nilAngleBytes) - - case cycleFound == true: - f.fs.Write(circularShortBytes) - - default: - f.ignoreNextType = true - f.format(ve) - } -} - -// format is the main workhorse for providing the Formatter interface. It -// uses the passed reflect value to figure out what kind of object we are -// dealing with and formats it appropriately. It is a recursive function, -// however circular data structures are detected and handled properly. -func (f *formatState) format(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - f.fs.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - f.formatPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !f.ignoreNextType && f.fs.Flag('#') { - f.fs.Write(openParenBytes) - f.fs.Write([]byte(v.Type().String())) - f.fs.Write(closeParenBytes) - } - f.ignoreNextType = false - - // Call Stringer/error interfaces if they exist and the handle methods - // flag is enabled. - if !f.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(f.cs, f.fs, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(f.fs, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(f.fs, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(f.fs, v.Uint(), 10) - - case reflect.Float32: - printFloat(f.fs, v.Float(), 32) - - case reflect.Float64: - printFloat(f.fs, v.Float(), 64) - - case reflect.Complex64: - printComplex(f.fs, v.Complex(), 32) - - case reflect.Complex128: - printComplex(f.fs, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - f.fs.Write(openBracketBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - numEntries := v.Len() - for i := 0; i < numEntries; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(v.Index(i))) - } - } - f.depth-- - f.fs.Write(closeBracketBytes) - - case reflect.String: - f.fs.Write([]byte(v.String())) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - f.fs.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - - f.fs.Write(openMapBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - keys := v.MapKeys() - if f.cs.SortKeys { - sortValues(keys, f.cs) - } - for i, key := range keys { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(key)) - f.fs.Write(colonBytes) - f.ignoreNextType = true - f.format(f.unpackValue(v.MapIndex(key))) - } - } - f.depth-- - f.fs.Write(closeMapBytes) - - case reflect.Struct: - numFields := v.NumField() - f.fs.Write(openBraceBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - vt := v.Type() - for i := 0; i < numFields; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - vtf := vt.Field(i) - if f.fs.Flag('+') || f.fs.Flag('#') { - f.fs.Write([]byte(vtf.Name)) - f.fs.Write(colonBytes) - } - f.format(f.unpackValue(v.Field(i))) - } - } - f.depth-- - f.fs.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(f.fs, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(f.fs, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it if any get added. - default: - format := f.buildDefaultFormat() - if v.CanInterface() { - fmt.Fprintf(f.fs, format, v.Interface()) - } else { - fmt.Fprintf(f.fs, format, v.String()) - } - } -} - -// Format satisfies the fmt.Formatter interface. See NewFormatter for usage -// details. -func (f *formatState) Format(fs fmt.State, verb rune) { - f.fs = fs - - // Use standard formatting for verbs that are not v. - if verb != 'v' { - format := f.constructOrigFormat(verb) - fmt.Fprintf(fs, format, f.value) - return - } - - if f.value == nil { - if fs.Flag('#') { - fs.Write(interfaceBytes) - } - fs.Write(nilAngleBytes) - return - } - - f.format(reflect.ValueOf(f.value)) -} - -// newFormatter is a helper function to consolidate the logic from the various -// public methods which take varying config states. -func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { - fs := &formatState{value: v, cs: cs} - fs.pointers = make(map[uintptr]int) - return fs -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -Printf, Println, or Fprintf. -*/ -func NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(&Config, v) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go deleted file mode 100644 index d8233f5..0000000 --- a/vendor/github.com/davecgh/go-spew/spew/spew.go +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "fmt" - "io" -) - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the formatted string as a value that satisfies error. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a default Formatter interface returned by NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) -func Print(a ...interface{}) (n int, err error) { - return fmt.Print(convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) -func Println(a ...interface{}) (n int, err error) { - return fmt.Println(convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprint(a ...interface{}) string { - return fmt.Sprint(convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintln(a ...interface{}) string { - return fmt.Sprintln(convertArgs(a)...) -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a default spew Formatter interface. -func convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = NewFormatter(arg) - } - return formatters -} diff --git a/vendor/github.com/mitchellh/go-homedir/LICENSE b/vendor/github.com/mitchellh/go-homedir/LICENSE deleted file mode 100644 index f9c841a..0000000 --- a/vendor/github.com/mitchellh/go-homedir/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-homedir/README.md b/vendor/github.com/mitchellh/go-homedir/README.md deleted file mode 100644 index d70706d..0000000 --- a/vendor/github.com/mitchellh/go-homedir/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# go-homedir - -This is a Go library for detecting the user's home directory without -the use of cgo, so the library can be used in cross-compilation environments. - -Usage is incredibly simple, just call `homedir.Dir()` to get the home directory -for a user, and `homedir.Expand()` to expand the `~` in a path to the home -directory. - -**Why not just use `os/user`?** The built-in `os/user` package requires -cgo on Darwin systems. This means that any Go code that uses that package -cannot cross compile. But 99% of the time the use for `os/user` is just to -retrieve the home directory, which we can do for the current user without -cgo. This library does that, enabling cross-compilation. diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go deleted file mode 100644 index 6944957..0000000 --- a/vendor/github.com/mitchellh/go-homedir/homedir.go +++ /dev/null @@ -1,132 +0,0 @@ -package homedir - -import ( - "bytes" - "errors" - "os" - "os/exec" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" -) - -// DisableCache will disable caching of the home directory. Caching is enabled -// by default. -var DisableCache bool - -var homedirCache string -var cacheLock sync.RWMutex - -// Dir returns the home directory for the executing user. -// -// This uses an OS-specific method for discovering the home directory. -// An error is returned if a home directory cannot be detected. -func Dir() (string, error) { - if !DisableCache { - cacheLock.RLock() - cached := homedirCache - cacheLock.RUnlock() - if cached != "" { - return cached, nil - } - } - - cacheLock.Lock() - defer cacheLock.Unlock() - - var result string - var err error - if runtime.GOOS == "windows" { - result, err = dirWindows() - } else { - // Unix-like system, so just assume Unix - result, err = dirUnix() - } - - if err != nil { - return "", err - } - homedirCache = result - return result, nil -} - -// Expand expands the path to include the home directory if the path -// is prefixed with `~`. If it isn't prefixed with `~`, the path is -// returned as-is. -func Expand(path string) (string, error) { - if len(path) == 0 { - return path, nil - } - - if path[0] != '~' { - return path, nil - } - - if len(path) > 1 && path[1] != '/' && path[1] != '\\' { - return "", errors.New("cannot expand user-specific home dir") - } - - dir, err := Dir() - if err != nil { - return "", err - } - - return filepath.Join(dir, path[1:]), nil -} - -func dirUnix() (string, error) { - // First prefer the HOME environmental variable - if home := os.Getenv("HOME"); home != "" { - return home, nil - } - - // If that fails, try getent - var stdout bytes.Buffer - cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid())) - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - // If "getent" is missing, ignore it - if err != exec.ErrNotFound { - return "", err - } - } else { - if passwd := strings.TrimSpace(stdout.String()); passwd != "" { - // username:password:uid:gid:gecos:home:shell - passwdParts := strings.SplitN(passwd, ":", 7) - if len(passwdParts) > 5 { - return passwdParts[5], nil - } - } - } - - // If all else fails, try the shell - stdout.Reset() - cmd = exec.Command("sh", "-c", "cd && pwd") - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - return "", err - } - - result := strings.TrimSpace(stdout.String()) - if result == "" { - return "", errors.New("blank output when reading home directory") - } - - return result, nil -} - -func dirWindows() (string, error) { - drive := os.Getenv("HOMEDRIVE") - path := os.Getenv("HOMEPATH") - home := drive + path - if drive == "" || path == "" { - home = os.Getenv("USERPROFILE") - } - if home == "" { - return "", errors.New("HOMEDRIVE, HOMEPATH, and USERPROFILE are blank") - } - - return home, nil -} diff --git a/vendor/github.com/motemen/go-quickfix/.travis.yml b/vendor/github.com/motemen/go-quickfix/.travis.yml deleted file mode 100644 index c1e5814..0000000 --- a/vendor/github.com/motemen/go-quickfix/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go -go: - - 1.5 - - 1.6 - - tip -install: - - go get ./... - - go get -t ./... diff --git a/vendor/github.com/motemen/go-quickfix/LICENSE b/vendor/github.com/motemen/go-quickfix/LICENSE deleted file mode 100644 index 756f32f..0000000 --- a/vendor/github.com/motemen/go-quickfix/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Hiroshi SHIBAMURA - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/motemen/go-quickfix/README.adoc b/vendor/github.com/motemen/go-quickfix/README.adoc deleted file mode 100644 index ee10b21..0000000 --- a/vendor/github.com/motemen/go-quickfix/README.adoc +++ /dev/null @@ -1,82 +0,0 @@ -= goquickfix image:https://travis-ci.org/motemen/go-quickfix.svg?branch=master["Build Status", link="https://travis-ci.org/motemen/go-quickfix"] image:http://godoc.org/github.com/motemen/go-quickfix?status.svg["GoDoc", link="http://godoc.org/github.com/motemen/go-quickfix"] image:http://gocover.io/_badge/github.com/motemen/go-quickfix["Test Coverage", link="http://gocover.io/github.com/motemen/go-quickfix"] - -The goquickfix command quick fixes Go source that is well typed but -Go refuses to compile e.g. "x declared and not used". - -== Installation - - go get github.com/motemen/go-quickfix/cmd/goquickfix - -== Usage - - goquickfix [-w] [-revert] ... - - Flags: - -revert=false: try to revert possible quickfixes introduced by goquickfix - -w=false: write result to (source) file instead of stdout - -== Description - -While coding, sometimes you may write a Go program that is completely well typed -but `go build` (or `run` or `test`) refuses to build, like this: - -[source,go] ----- -package main - -import ( - "fmt" - "log" -) - -func main() { - nums := []int{3, 1, 4, 1, 5} - for i, n := range nums { - fmt.Println(n) - } -} ----- - -The Go compiler will complain: - - eg.go:5: imported and not used: "log" - -Or - - eg.go:9: i declared and not used - -Do we have to bother to comment out the import line or remove -the unused identifier one by one for the Go compiler? Of course no, -`goquickfix` does the work instead of you. - -Run - - goquickfix -w eg.go - -and you will get the source rewritten so that Go compiles it well without -changing the semantics: - -[source,go] ----- -package main - -import ( - "fmt" - _ "log" -) - -func main() { - nums := []int{3, 1, 4, 1, 5} - for i, n := range nums { - fmt.Println(n) - _ = i - } -} ----- - -Now you can `go run` or `go test` your code safely. - -== TODO - -* `-d` option to show diffs -* `-hard=true` option to remove erroneous code rather than adding new code diff --git a/vendor/github.com/motemen/go-quickfix/quickfix.go b/vendor/github.com/motemen/go-quickfix/quickfix.go deleted file mode 100644 index bf76c83..0000000 --- a/vendor/github.com/motemen/go-quickfix/quickfix.go +++ /dev/null @@ -1,428 +0,0 @@ -// Package quickfix provides functions for fixing Go ASTs -// that are well typed but "go build" refuses to build. -package quickfix - -import ( - "fmt" - "regexp" - "strings" - - "go/ast" - "go/importer" - "go/token" - "go/types" - - "golang.org/x/tools/go/ast/astutil" -) - -var ( - declaredNotUsed = regexp.MustCompile(`^([a-zA-Z0-9_]+) declared but not used$`) - importedNotUsed = regexp.MustCompile(`^(".+") imported but not used`) - noNewVariablesOnDefine = "no new variables on left side of :=" -) - -type Config struct { - Fset *token.FileSet - Files []*ast.File - TypeInfo *types.Info - MaxTries int -} - -func QuickFix(fset *token.FileSet, files []*ast.File) (err error) { - config := Config{ - Fset: fset, - Files: files, - MaxTries: 10, - } - return config.QuickFix() -} - -// QuickFix rewrites AST files of same package so that they pass go build. -// For example: -// v declared but not used -> append `_ = v` -// "p" imported but not used -> rewrite to `import _ "p"` -// no new variables on left side of := -> rewrite `:=` to `=` -// -// TODO implement hardMode, which removes errorneous code rather than adding -func (c Config) QuickFix() (err error) { - maxTries := 10 - if c.MaxTries > 0 { - maxTries = c.MaxTries - } - for i := 0; i < maxTries; i++ { - var foundError bool - foundError, err = c.QuickFixOnce() - if !foundError { - return nil - } - } - - return -} - -type tracedVisitor struct { - path []ast.Node - visit func(ast.Node, []ast.Node) bool -} - -func (v tracedVisitor) Visit(node ast.Node) ast.Visitor { - if v.visit(node, v.path) { - return tracedVisitor{ - path: append([]ast.Node{node}, v.path...), - visit: v.visit, - } - } - - return nil -} - -func traverseAST(node ast.Node, visit func(ast.Node, []ast.Node) bool) { - v := tracedVisitor{ - visit: visit, - } - ast.Walk(v, node) -} - -// pkgsWithSideEffect are set of packages which are known to provide APIs by -// blank identifier import (import _ "p"). -var pkgsWithSideEffect = map[string]bool{} - -func init() { - for _, path := range []string{ - "expvar", - "image/gif", - "image/jpeg", - "image/png", - "net/http/pprof", - "unsafe", - "golang.org/x/image/bmp", - "golang.org/x/image/tiff", - "golang.org/x/image/vp8", - "golang.org/x/image/vp81", - "golang.org/x/image/webp", - "golang.org/x/tools/go/gcimporter", - } { - pkgsWithSideEffect[`"`+path+`"`] = true - } -} - -func RevertQuickFix(fset *token.FileSet, files []*ast.File) error { - config := Config{ - Fset: fset, - Files: files, - MaxTries: 10, - } - return config.RevertQuickFix() -} - -// RevertQuickFix reverts possible quickfixes introduced by QuickFix. -// This may result to non-buildable source, and cannot reproduce the original -// code before prior QuickFix. -// For example: -// `_ = v` -> removed -// `import _ "p"` -> rewritten to `import "p"` -func (c Config) RevertQuickFix() (err error) { - fset := c.Fset - files := c.Files - - nodeToRemove := map[ast.Node]bool{} - - for _, f := range files { - ast.Inspect(f, func(node ast.Node) bool { - if assign, ok := node.(*ast.AssignStmt); ok { - if len(assign.Lhs) == 1 && isBlankIdent(assign.Lhs[0]) && - len(assign.Rhs) == 1 && isIdent(assign.Rhs[0]) { - // The statement is `_ = v` - nodeToRemove[node] = true - } - - return false - } else if imp, ok := node.(*ast.ImportSpec); ok { - if isBlankIdent(imp.Name) && !pkgsWithSideEffect[imp.Path.Value] { - // The spec is `import _ "p"` and p is not a package that - // provides "side effects" - imp.Name = nil - } - - return false - } - - return true - }) - - for len(nodeToRemove) > 0 { - traverseAST(f, func(node ast.Node, nodepath []ast.Node) bool { - if nodeToRemove[node] { - parent := nodepath[0] - if removeChildNode(node, parent) == false { - err = fmt.Errorf( - "BUG: could not remove node: %s (in: %s)", - fset.Position(node.Pos()), - fset.Position(parent.Pos()), - ) - } - delete(nodeToRemove, node) - return false - } - - return true - }) - } - } - - return -} - -func (c Config) QuickFixOnce() (bool, error) { - fset := c.Fset - files := c.Files - - errs := []error{} - config := &types.Config{ - Error: func(err error) { - errs = append(errs, err) - }, - Importer: importer.Default(), - } - - _, err := config.Check("_quickfix", fset, files, c.TypeInfo) - if err == nil { - return false, nil - } - - // apply fixes on AST later so that we won't break funcs that inspect AST by positions - fixes := map[error]func() bool{} - unhandled := ErrorList{} - - foundError := len(errs) > 0 - - for _, err := range errs { - err, ok := err.(types.Error) - if !ok { - unhandled = append(unhandled, err) - continue - } - - f := findFile(c.Files, err.Pos) - if f == nil { - e := ErrCouldNotLocate{ - Err: err, - Fset: fset, - } - unhandled = append(unhandled, e) - continue - } - - nodepath, _ := astutil.PathEnclosingInterval(f, err.Pos, err.Pos) - - var fix func() bool - - // - "%s declared but not used" - // - "%q imported but not used" (+ " as %s") - // - "label %s declared but not used" TODO - // - "no new variables on left side of :=" - if m := declaredNotUsed.FindStringSubmatch(err.Msg); m != nil { - identName := m[1] - fix = func() bool { - return fixDeclaredNotUsed(nodepath, identName) - } - } else if m := importedNotUsed.FindStringSubmatch(err.Msg); m != nil { - pkgPath := m[1] // quoted string, but it's okay because this will be compared to ast.BasicLit.Value. - fix = func() bool { - return fixImportedNotUsed(nodepath, pkgPath) - } - } else if err.Msg == noNewVariablesOnDefine { - fix = func() bool { - return fixNoNewVariables(nodepath) - } - } else { - unhandled = append(unhandled, err) - } - - if fix != nil { - fixes[err] = fix - } - } - - for err, fix := range fixes { - if fix() == false { - unhandled = append(unhandled, err) - } - } - - return foundError, unhandled.any() -} - -func fixDeclaredNotUsed(nodepath []ast.Node, identName string) bool { - // insert "_ = x" to supress "declared but not used" error - stmt := &ast.AssignStmt{ - Lhs: []ast.Expr{ast.NewIdent("_")}, - Tok: token.ASSIGN, - Rhs: []ast.Expr{ast.NewIdent(identName)}, - } - return appendStmt(nodepath, stmt) -} - -func fixImportedNotUsed(nodepath []ast.Node, pkgPath string) bool { - for _, node := range nodepath { - if f, ok := node.(*ast.File); ok { - for _, imp := range f.Imports { - if imp.Path.Value == pkgPath { - // make this import spec anonymous one - imp.Name = ast.NewIdent("_") - return true - } - } - } - } - return false -} - -func fixNoNewVariables(nodepath []ast.Node) bool { - for _, node := range nodepath { - switch node := node.(type) { - case *ast.AssignStmt: - if node.Tok == token.DEFINE { - node.Tok = token.ASSIGN - return true - } - - case *ast.RangeStmt: - if node.Tok == token.DEFINE { - node.Tok = token.ASSIGN - return true - } - } - } - return false -} - -type ErrorList []error - -func (errs ErrorList) any() error { - if len(errs) == 0 { - return nil - } - - return errs -} - -func (errs ErrorList) Error() string { - s := []string{fmt.Sprintf("%d error(s):", len(errs))} - for _, e := range errs { - s = append(s, fmt.Sprintf("- %s", e)) - } - return strings.Join(s, "\n") -} - -func appendStmt(nodepath []ast.Node, stmt ast.Stmt) bool { - for _, node := range nodepath { - switch node := node.(type) { - case *ast.BlockStmt: - if node.List == nil { - node.List = []ast.Stmt{} - } - node.List = append(node.List, stmt) - - case *ast.CaseClause: - if node.Body == nil { - node.Body = []ast.Stmt{} - } - node.Body = append(node.Body, stmt) - - case *ast.CommClause: - if node.Body == nil { - node.Body = []ast.Stmt{} - } - node.Body = append(node.Body, stmt) - - case *ast.RangeStmt: - if node.Body == nil { - node.Body = &ast.BlockStmt{} - } - if node.Body.List == nil { - node.Body.List = []ast.Stmt{} - } - node.Body.List = append(node.Body.List, stmt) - - default: - continue - } - - return true - } - - return false -} - -func removeChildNode(child, parent ast.Node) bool { - switch parent := parent.(type) { - case *ast.BlockStmt: - removeFromStmtList(child, parent.List) - return true - case *ast.CaseClause: - removeFromStmtList(child, parent.Body) - return true - case *ast.CommClause: - removeFromStmtList(child, parent.Body) - return true - case *ast.RangeStmt: - removeFromStmtList(child, parent.Body.List) - return true - } - - return false -} - -// removeFromStmtList remove node from slice of statements list. This function -// modifies list in-place and pads rest of the slice with ast.EmptyStmt. -func removeFromStmtList(node ast.Node, list []ast.Stmt) bool { - for i, s := range list { - if s == node { - for ; i < len(list)-1; i++ { - list[i] = list[i+1] - } - list[len(list)-1] = &ast.EmptyStmt{} - return true - } - } - - return false -} - -func findFile(files []*ast.File, pos token.Pos) *ast.File { - for _, f := range files { - if f.Pos() <= pos && pos < f.End() { - return f - } - } - - return nil -} - -func isIdent(node ast.Node) bool { - if node == nil { - return false - } - - _, ok := node.(*ast.Ident) - return ok -} - -func isBlankIdent(node ast.Node) bool { - if node == nil { - return false - } - - ident, ok := node.(*ast.Ident) - return ok && ident != nil && ident.Name == "_" -} - -type ErrCouldNotLocate struct { - Err types.Error - Fset *token.FileSet -} - -func (e ErrCouldNotLocate) Error() string { - return fmt.Sprintf("cannot find file for error %q: %s (%d)", e.Err.Error(), e.Fset.Position(e.Err.Pos), e.Err.Pos) -} diff --git a/vendor/github.com/nu7hatch/gouuid/example_test.go b/vendor/github.com/nu7hatch/gouuid/example_test.go new file mode 100644 index 0000000..9e86fdc --- /dev/null +++ b/vendor/github.com/nu7hatch/gouuid/example_test.go @@ -0,0 +1,33 @@ +package uuid_test + +import ( + "fmt" + "github.com/nu7hatch/gouuid" +) + +func ExampleNewV4() { + u4, err := uuid.NewV4() + if err != nil { + fmt.Println("error:", err) + return + } + fmt.Println(u4) +} + +func ExampleNewV5() { + u5, err := uuid.NewV5(uuid.NamespaceURL, []byte("nu7hat.ch")) + if err != nil { + fmt.Println("error:", err) + return + } + fmt.Println(u5) +} + +func ExampleParseHex() { + u, err := uuid.ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + if err != nil { + fmt.Println("error:", err) + return + } + fmt.Println(u) +} diff --git a/vendor/github.com/nu7hatch/gouuid/uuid_test.go b/vendor/github.com/nu7hatch/gouuid/uuid_test.go new file mode 100644 index 0000000..70ed346 --- /dev/null +++ b/vendor/github.com/nu7hatch/gouuid/uuid_test.go @@ -0,0 +1,135 @@ +// This package provides immutable UUID structs and the functions +// NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 +// and 5 UUIDs as specified in RFC 4122. +// +// Copyright (C) 2011 by Krzysztof Kowalik +package uuid + +import ( + "regexp" + "testing" +) + +const format = "^[a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$" + +func TestParse(t *testing.T) { + _, err := Parse([]byte{1, 2, 3, 4, 5}) + if err == nil { + t.Errorf("Expected error due to invalid UUID sequence") + } + base, _ := NewV4() + u, err := Parse(base[:]) + if err != nil { + t.Errorf("Expected to parse UUID sequence without problems") + return + } + if u.String() != base.String() { + t.Errorf("Expected parsed UUID to be the same as base, %s != %s", u.String(), base.String()) + } +} + +func TestParseString(t *testing.T) { + _, err := ParseHex("foo") + if err == nil { + t.Errorf("Expected error due to invalid UUID string") + } + base, _ := NewV4() + u, err := ParseHex(base.String()) + if err != nil { + t.Errorf("Expected to parse UUID sequence without problems") + return + } + if u.String() != base.String() { + t.Errorf("Expected parsed UUID to be the same as base, %s != %s", u.String(), base.String()) + } +} + +func TestNewV3(t *testing.T) { + u, err := NewV3(NamespaceURL, []byte("golang.org")) + if err != nil { + t.Errorf("Expected to generate UUID without problems, error thrown: %d", err.Error()) + return + } + if u.Version() != 3 { + t.Errorf("Expected to generate UUIDv3, given %d", u.Version()) + } + if u.Variant() != ReservedRFC4122 { + t.Errorf("Expected to generate UUIDv3 RFC4122 variant, given %x", u.Variant()) + } + re := regexp.MustCompile(format) + if !re.MatchString(u.String()) { + t.Errorf("Expected string representation to be valid, given %s", u.String()) + } + u2, _ := NewV3(NamespaceURL, []byte("golang.org")) + if u2.String() != u.String() { + t.Errorf("Expected UUIDs generated of the same namespace and name to be the same") + } + u3, _ := NewV3(NamespaceDNS, []byte("golang.org")) + if u3.String() == u.String() { + t.Errorf("Expected UUIDs generated of different namespace and the same name to be different") + } + u4, _ := NewV3(NamespaceURL, []byte("code.google.com")) + if u4.String() == u.String() { + t.Errorf("Expected UUIDs generated of the same namespace and different names to be different") + } +} + +func TestNewV4(t *testing.T) { + u, err := NewV4() + if err != nil { + t.Errorf("Expected to generate UUID without problems, error thrown: %s", err.Error()) + return + } + if u.Version() != 4 { + t.Errorf("Expected to generate UUIDv4, given %d", u.Version()) + } + if u.Variant() != ReservedRFC4122 { + t.Errorf("Expected to generate UUIDv4 RFC4122 variant, given %x", u.Variant()) + } + re := regexp.MustCompile(format) + if !re.MatchString(u.String()) { + t.Errorf("Expected string representation to be valid, given %s", u.String()) + } +} + +func TestNewV5(t *testing.T) { + u, err := NewV5(NamespaceURL, []byte("golang.org")) + if err != nil { + t.Errorf("Expected to generate UUID without problems, error thrown: %d", err.Error()) + return + } + if u.Version() != 5 { + t.Errorf("Expected to generate UUIDv5, given %d", u.Version()) + } + if u.Variant() != ReservedRFC4122 { + t.Errorf("Expected to generate UUIDv5 RFC4122 variant, given %x", u.Variant()) + } + re := regexp.MustCompile(format) + if !re.MatchString(u.String()) { + t.Errorf("Expected string representation to be valid, given %s", u.String()) + } + u2, _ := NewV5(NamespaceURL, []byte("golang.org")) + if u2.String() != u.String() { + t.Errorf("Expected UUIDs generated of the same namespace and name to be the same") + } + u3, _ := NewV5(NamespaceDNS, []byte("golang.org")) + if u3.String() == u.String() { + t.Errorf("Expected UUIDs generated of different namespace and the same name to be different") + } + u4, _ := NewV5(NamespaceURL, []byte("code.google.com")) + if u4.String() == u.String() { + t.Errorf("Expected UUIDs generated of the same namespace and different names to be different") + } +} + +func BenchmarkParseHex(b *testing.B) { + s := "f3593cff-ee92-40df-4086-87825b523f13" + for i := 0; i < b.N; i++ { + _, err := ParseHex(s) + if err != nil { + b.Fatal(err) + } + } + b.StopTimer() + b.ReportAllocs() +} diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pebbe/zmq4/LICENSE.txt similarity index 63% rename from vendor/github.com/pmezard/go-difflib/LICENSE rename to vendor/github.com/pebbe/zmq4/LICENSE.txt index c67dad6..5b2a4b2 100644 --- a/vendor/github.com/pmezard/go-difflib/LICENSE +++ b/vendor/github.com/pebbe/zmq4/LICENSE.txt @@ -1,18 +1,16 @@ -Copyright (c) 2013, Patrick Mezard +Copyright (c) 2013-2014, Peter Kleiweg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - The names of its contributors may not be used to endorse or promote -products derived from this software without specific prior written -permission. +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED diff --git a/vendor/github.com/pebbe/zmq4/README.md b/vendor/github.com/pebbe/zmq4/README.md new file mode 100644 index 0000000..74c16e2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/README.md @@ -0,0 +1,77 @@ +A Go interface to [ZeroMQ](http://www.zeromq.org/) version 4. + +[![Go Report Card](https://goreportcard.com/badge/github.com/pebbe/zmq4)](https://goreportcard.com/report/github.com/pebbe/zmq4) +[![GoDoc](https://godoc.org/github.com/pebbe/zmq4?status.svg)](https://godoc.org/github.com/pebbe/zmq4) + +This requires ZeroMQ version 4.0.1 or above. To use CURVE security in +versions prior to 4.2, ZeroMQ must be installed with +[libsodium](https://github.com/jedisct1/libsodium) enabled. + +Partial support for ZeroMQ 4.2 DRAFT is available in the alternate +version of zmq4 `draft`. The API pertaining to this is subject to +change. To use this: + + import ( + zmq "github.com/pebbe/zmq4/draft" + ) + +For ZeroMQ version 3, see: http://github.com/pebbe/zmq3 + +For ZeroMQ version 2, see: http://github.com/pebbe/zmq2 + +Including all examples of [ØMQ - The Guide](http://zguide.zeromq.org/page:all). + +Keywords: zmq, zeromq, 0mq, networks, distributed computing, message passing, fanout, pubsub, pipeline, request-reply + +### See also + + * [Mangos](https://github.com/go-mangos/mangos) — An implementation in pure Go of the SP ("Scalable Protocols") protocols + * [go-nanomsg](https://github.com/op/go-nanomsg) — Language bindings for nanomsg in Go + * [goczmq](https://github.com/zeromq/goczmq) — A Go interface to CZMQ + +## Install + + go get github.com/pebbe/zmq4 + +If you need support for ZeroMQ 4.2 DRAFT, checkout the branch `draft4.2`. + +## Docs + + * [package help](http://godoc.org/github.com/pebbe/zmq4) + * [wiki](https://github.com/pebbe/zmq4/wiki) + +## API change + +There has been an API change in commit +0bc5ab465849847b0556295d9a2023295c4d169e of 2014-06-27, 10:17:55 UTC +in the functions `AuthAllow` and `AuthDeny`. + +Old: + + func AuthAllow(addresses ...string) + func AuthDeny(addresses ...string) + +New: + + func AuthAllow(domain string, addresses ...string) + func AuthDeny(domain string, addresses ...string) + +If `domain` can be parsed as an IP address, it will be interpreted as +such, and it and all remaining addresses are added to all domains. + +So this should still work as before: + + zmq.AuthAllow("127.0.0.1", "123.123.123.123") + +But this won't compile: + + a := []string{"127.0.0.1", "123.123.123.123"} + zmq.AuthAllow(a...) + +And needs to be rewritten as: + + a := []string{"127.0.0.1", "123.123.123.123"} + zmq.AuthAllow("*", a...) + +Furthermore, an address can now be a single IP address, as well as an IP +address and mask in CIDR notation, e.g. "123.123.123.0/24". diff --git a/vendor/github.com/pebbe/zmq4/auth.go b/vendor/github.com/pebbe/zmq4/auth.go new file mode 100644 index 0000000..70fb1d4 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/auth.go @@ -0,0 +1,645 @@ +/* + +This file implements functionality very similar to that of the xauth module in czmq. + +Notable differences in here: + + - domains are supported + - domains are used in AuthAllow and AuthDeny too + - usernames/passwords are read from memory, not from file + - public keys are read from memory, not from file + - an address can be a single IP address, or an IP address and mask in CIDR notation + - additional functions for configuring server or client socket with a single command + +*/ + +package zmq4 + +/* +#include +#include + +#if ZMQ_VERSION_MINOR < 2 +// Version < 4.2.x + +int zmq_curve_public (char *z85_public_key, const char *z85_secret_key) { return 0; } + +#endif // Version < 4.2.x +*/ +import "C" + +import ( + "errors" + "log" + "net" + "strings" + "unsafe" +) + +const CURVE_ALLOW_ANY = "*" + +var ( + auth_handler *Socket + auth_quit *Socket + + auth_init = false + auth_verbose = false + + auth_allow = make(map[string]map[string]bool) + auth_deny = make(map[string]map[string]bool) + auth_allow_net = make(map[string][]*net.IPNet) + auth_deny_net = make(map[string][]*net.IPNet) + + auth_users = make(map[string]map[string]string) + + auth_pubkeys = make(map[string]map[string]bool) + + auth_meta_handler = auth_meta_handler_default +) + +func auth_meta_handler_default(version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string) { + return map[string]string{} +} + +func auth_isIP(addr string) bool { + if net.ParseIP(addr) != nil { + return true + } + if _, _, err := net.ParseCIDR(addr); err == nil { + return true + } + return false +} + +func auth_is_allowed(domain, address string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow[d]; ok { + if a[address] { + return true + } + } + } + addr := net.ParseIP(address) + if addr != nil { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow_net[d]; ok { + for _, m := range a { + if m.Contains(addr) { + return true + } + } + } + } + } + return false +} + +func auth_is_denied(domain, address string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny[d]; ok { + if a[address] { + return true + } + } + } + addr := net.ParseIP(address) + if addr != nil { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny_net[d]; ok { + for _, m := range a { + if m.Contains(addr) { + return true + } + } + } + } + } + return false +} + +func auth_has_allow(domain string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow[d]; ok { + if len(a) > 0 || len(auth_allow_net[d]) > 0 { + return true + } + } + } + return false +} + +func auth_has_deny(domain string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny[d]; ok { + if len(a) > 0 || len(auth_deny_net[d]) > 0 { + return true + } + } + } + return false +} + +func auth_do_handler() { + for { + + msg, err := auth_handler.RecvMessage(0) + if err != nil { + if auth_verbose { + log.Println("AUTH: Quitting:", err) + } + break + } + + if msg[0] == "QUIT" { + if auth_verbose { + log.Println("AUTH: Quitting: received QUIT message") + } + _, err := auth_handler.SendMessage("QUIT") + if err != nil && auth_verbose { + log.Println("AUTH: Quitting: bouncing QUIT message:", err) + } + break + } + + version := msg[0] + if version != "1.0" { + panic("AUTH: version != 1.0") + } + + request_id := msg[1] + domain := msg[2] + address := msg[3] + identity := msg[4] + mechanism := msg[5] + credentials := msg[6:] + + username := "" + password := "" + client_key := "" + if mechanism == "PLAIN" { + username = msg[6] + password = msg[7] + } else if mechanism == "CURVE" { + s := msg[6] + if len(s) != 32 { + panic("AUTH: len(client_key) != 32") + } + client_key = Z85encode(s) + } + + allowed := false + denied := false + + if auth_has_allow(domain) { + if auth_is_allowed(domain, address) { + allowed = true + if auth_verbose { + log.Printf("AUTH: PASSED (whitelist) domain=%q address=%q\n", domain, address) + } + } else { + denied = true + if auth_verbose { + log.Printf("AUTH: DENIED (not in whitelist) domain=%q address=%q\n", domain, address) + } + } + } else if auth_has_deny(domain) { + if auth_is_denied(domain, address) { + denied = true + if auth_verbose { + log.Printf("AUTH: DENIED (blacklist) domain=%q address=%q\n", domain, address) + } + } else { + allowed = true + if auth_verbose { + log.Printf("AUTH: PASSED (not in blacklist) domain=%q address=%q\n", domain, address) + } + } + } + + // Mechanism-specific checks + if !denied { + if mechanism == "NULL" && !allowed { + // For NULL, we allow if the address wasn't blacklisted + if auth_verbose { + log.Printf("AUTH: ALLOWED (NULL)\n") + } + allowed = true + } else if mechanism == "PLAIN" { + // For PLAIN, even a whitelisted address must authenticate + allowed = authenticate_plain(domain, username, password) + } else if mechanism == "CURVE" { + // For CURVE, even a whitelisted address must authenticate + allowed = authenticate_curve(domain, client_key) + } + } + if allowed { + m := auth_meta_handler(version, request_id, domain, address, identity, mechanism, credentials...) + user_id := "" + if uid, ok := m["User-Id"]; ok { + user_id = uid + delete(m, "User-Id") + } + metadata := make([]byte, 0) + for key, value := range m { + if len(key) < 256 { + metadata = append(metadata, auth_meta_blob(key, value)...) + } + } + auth_handler.SendMessage(version, request_id, "200", "OK", user_id, metadata) + } else { + auth_handler.SendMessage(version, request_id, "400", "NO ACCESS", "", "") + } + } + + err := auth_handler.Close() + if err != nil && auth_verbose { + log.Println("AUTH: Quitting: Close:", err) + } + if auth_verbose { + log.Println("AUTH: Quit") + } +} + +func authenticate_plain(domain, username, password string) bool { + for _, dom := range []string{domain, "*"} { + if m, ok := auth_users[dom]; ok { + if m[username] == password { + if auth_verbose { + log.Printf("AUTH: ALLOWED (PLAIN) domain=%q username=%q password=%q\n", dom, username, password) + } + return true + } + } + } + if auth_verbose { + log.Printf("AUTH: DENIED (PLAIN) domain=%q username=%q password=%q\n", domain, username, password) + } + return false +} + +func authenticate_curve(domain, client_key string) bool { + for _, dom := range []string{domain, "*"} { + if m, ok := auth_pubkeys[dom]; ok { + if m[CURVE_ALLOW_ANY] { + if auth_verbose { + log.Printf("AUTH: ALLOWED (CURVE any client) domain=%q\n", dom) + } + return true + } + if m[client_key] { + if auth_verbose { + log.Printf("AUTH: ALLOWED (CURVE) domain=%q client_key=%q\n", dom, client_key) + } + return true + } + } + } + if auth_verbose { + log.Printf("AUTH: DENIED (CURVE) domain=%q client_key=%q\n", domain, client_key) + } + return false +} + +// Start authentication. +// +// Note that until you add policies, all incoming NULL connections are allowed +// (classic ZeroMQ behaviour), and all PLAIN and CURVE connections are denied. +func AuthStart() (err error) { + if auth_init { + if auth_verbose { + log.Println("AUTH: Already running") + } + return errors.New("Auth is already running") + } + + auth_handler, err = NewSocket(REP) + if err != nil { + return + } + auth_handler.SetLinger(0) + err = auth_handler.Bind("inproc://zeromq.zap.01") + if err != nil { + auth_handler.Close() + return + } + + auth_quit, err = NewSocket(REQ) + if err != nil { + auth_handler.Close() + return + } + auth_quit.SetLinger(0) + err = auth_quit.Connect("inproc://zeromq.zap.01") + if err != nil { + auth_handler.Close() + auth_quit.Close() + return + } + + go auth_do_handler() + + if auth_verbose { + log.Println("AUTH: Starting") + } + + auth_init = true + + return +} + +// Stop authentication. +func AuthStop() { + if !auth_init { + if auth_verbose { + log.Println("AUTH: Not running, can't stop") + } + return + } + if auth_verbose { + log.Println("AUTH: Stopping") + } + _, err := auth_quit.SendMessageDontwait("QUIT") + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: SendMessageDontwait(\"QUIT\"):", err) + } + _, err = auth_quit.RecvMessage(0) + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: RecvMessage:", err) + } + err = auth_quit.Close() + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: Close:", err) + } + if auth_verbose { + log.Println("AUTH: Stopped") + } + + auth_init = false + +} + +// Allow (whitelist) some addresses for a domain. +// +// An address can be a single IP address, or an IP address and mask in CIDR notation. +// +// For NULL, all clients from these addresses will be accepted. +// +// For PLAIN and CURVE, they will be allowed to continue with authentication. +// +// You can call this method multiple times to whitelist multiple IP addresses. +// +// If you whitelist a single address for a domain, any non-whitelisted addresses +// for that domain are treated as blacklisted. +// +// Use domain "*" for all domains. +// +// For backward compatibility: if domain can be parsed as an IP address, it will be +// interpreted as another address, and it and all remaining addresses will be added +// to all domains. +func AuthAllow(domain string, addresses ...string) { + if auth_isIP(domain) { + auth_allow_for_domain("*", domain) + auth_allow_for_domain("*", addresses...) + } else { + auth_allow_for_domain(domain, addresses...) + } +} + +func auth_allow_for_domain(domain string, addresses ...string) { + if _, ok := auth_allow[domain]; !ok { + auth_allow[domain] = make(map[string]bool) + auth_allow_net[domain] = make([]*net.IPNet, 0) + } + for _, address := range addresses { + if _, ipnet, err := net.ParseCIDR(address); err == nil { + auth_allow_net[domain] = append(auth_allow_net[domain], ipnet) + } else if net.ParseIP(address) != nil { + auth_allow[domain][address] = true + } else { + if auth_verbose { + log.Printf("AUTH: Allow for domain %q: %q is not a valid address or network\n", domain, address) + } + } + } +} + +// Deny (blacklist) some addresses for a domain. +// +// An address can be a single IP address, or an IP address and mask in CIDR notation. +// +// For all security mechanisms, this rejects the connection without any further authentication. +// +// Use either a whitelist for a domain, or a blacklist for a domain, not both. +// If you define both a whitelist and a blacklist for a domain, only the whitelist takes effect. +// +// Use domain "*" for all domains. +// +// For backward compatibility: if domain can be parsed as an IP address, it will be +// interpreted as another address, and it and all remaining addresses will be added +// to all domains. +func AuthDeny(domain string, addresses ...string) { + if auth_isIP(domain) { + auth_deny_for_domain("*", domain) + auth_deny_for_domain("*", addresses...) + } else { + auth_deny_for_domain(domain, addresses...) + } +} + +func auth_deny_for_domain(domain string, addresses ...string) { + if _, ok := auth_deny[domain]; !ok { + auth_deny[domain] = make(map[string]bool) + auth_deny_net[domain] = make([]*net.IPNet, 0) + } + for _, address := range addresses { + if _, ipnet, err := net.ParseCIDR(address); err == nil { + auth_deny_net[domain] = append(auth_deny_net[domain], ipnet) + } else if net.ParseIP(address) != nil { + auth_deny[domain][address] = true + } else { + if auth_verbose { + log.Printf("AUTH: Deny for domain %q: %q is not a valid address or network\n", domain, address) + } + } + } +} + +// Add a user for PLAIN authentication for a given domain. +// +// Set `domain` to "*" to apply to all domains. +func AuthPlainAdd(domain, username, password string) { + if _, ok := auth_users[domain]; !ok { + auth_users[domain] = make(map[string]string) + } + auth_users[domain][username] = password +} + +// Remove users from PLAIN authentication for a given domain. +func AuthPlainRemove(domain string, usernames ...string) { + if u, ok := auth_users[domain]; ok { + for _, username := range usernames { + delete(u, username) + } + } +} + +// Remove all users from PLAIN authentication for a given domain. +func AuthPlainRemoveAll(domain string) { + delete(auth_users, domain) +} + +// Add public user keys for CURVE authentication for a given domain. +// +// To cover all domains, use "*". +// +// Public keys are in Z85 printable text format. +// +// To allow all client keys without checking, specify CURVE_ALLOW_ANY for the key. +func AuthCurveAdd(domain string, pubkeys ...string) { + if _, ok := auth_pubkeys[domain]; !ok { + auth_pubkeys[domain] = make(map[string]bool) + } + for _, key := range pubkeys { + auth_pubkeys[domain][key] = true + } +} + +// Remove user keys from CURVE authentication for a given domain. +func AuthCurveRemove(domain string, pubkeys ...string) { + if p, ok := auth_pubkeys[domain]; ok { + for _, pubkey := range pubkeys { + delete(p, pubkey) + } + } +} + +// Remove all user keys from CURVE authentication for a given domain. +func AuthCurveRemoveAll(domain string) { + delete(auth_pubkeys, domain) +} + +// Enable verbose tracing of commands and activity. +func AuthSetVerbose(verbose bool) { + auth_verbose = verbose +} + +/* +This function sets the metadata handler that is called by the ZAP +handler to retrieve key/value properties that should be set on reply +messages in case of a status code "200" (succes). + +Default properties are `Socket-Type`, which is already set, and +`Identity` and `User-Id` that are empty by default. The last two can be +set, and more properties can be added. + +The `User-Id` property is used for the `user id` frame of the reply +message. All other properties are stored in the `metadata` frame of the +reply message. + +The default handler returns an empty map. + +For the meaning of the handler arguments, and other details, see: +http://rfc.zeromq.org/spec:27#toc10 +*/ +func AuthSetMetadataHandler( + handler func( + version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string)) { + auth_meta_handler = handler +} + +/* +This encodes a key/value pair into the format used by a ZAP handler. + +Returns an error if key is more then 255 characters long. +*/ +func AuthMetaBlob(key, value string) (blob []byte, err error) { + if len(key) > 255 { + return []byte{}, errors.New("Key too long") + } + return auth_meta_blob(key, value), nil +} + +func auth_meta_blob(name, value string) []byte { + l1 := len(name) + l2 := len(value) + b := make([]byte, l1+l2+5) + b[0] = byte(l1) + b[l1+1] = byte(l2 >> 24 & 255) + b[l1+2] = byte(l2 >> 16 & 255) + b[l1+3] = byte(l2 >> 8 & 255) + b[l1+4] = byte(l2 & 255) + copy(b[1:], []byte(name)) + copy(b[5+l1:], []byte(value)) + return b +} + +//. Additional functions for configuring server or client socket with a single command + +// Set NULL server role. +func (server *Socket) ServerAuthNull(domain string) error { + err := server.SetPlainServer(0) + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set PLAIN server role. +func (server *Socket) ServerAuthPlain(domain string) error { + err := server.SetPlainServer(1) + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set CURVE server role. +func (server *Socket) ServerAuthCurve(domain, secret_key string) error { + err := server.SetCurveServer(1) + if err == nil { + err = server.SetCurveSecretkey(secret_key) + } + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set PLAIN client role. +func (client *Socket) ClientAuthPlain(username, password string) error { + err := client.SetPlainUsername(username) + if err == nil { + err = client.SetPlainPassword(password) + } + return err +} + +// Set CURVE client role. +func (client *Socket) ClientAuthCurve(server_public_key, client_public_key, client_secret_key string) error { + err := client.SetCurveServerkey(server_public_key) + if err == nil { + err = client.SetCurvePublickey(client_public_key) + } + if err == nil { + client.SetCurveSecretkey(client_secret_key) + } + return err +} + +// Helper function to derive z85 public key from secret key +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +func AuthCurvePublic(z85SecretKey string) (z85PublicKey string, err error) { + if minor < 2 { + return "", ErrorNotImplemented42 + } + secret := C.CString(z85SecretKey) + defer C.free(unsafe.Pointer(secret)) + public := C.CString(strings.Repeat(" ", 41)) + defer C.free(unsafe.Pointer(public)) + if i, err := C.zmq_curve_public(public, secret); int(i) != 0 { + return "", errget(err) + } + z85PublicKey = C.GoString(public) + return z85PublicKey, nil +} diff --git a/vendor/github.com/pebbe/zmq4/auth_test.go b/vendor/github.com/pebbe/zmq4/auth_test.go new file mode 100644 index 0000000..2ef5290 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/auth_test.go @@ -0,0 +1,144 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4" + + "testing" +) + +func TestAuthCurvePublic(t *testing.T) { + if _, minor, _ := zmq.Version(); minor < 2 { + t.Skip("CurvePublic not available in ZeroMQ versions prior to 4.2.0") + } + expected := "Yne@$w-vo= 1 && !zmq.HasCurve() { + t.Skip("Curve not available") + } + + type Meta struct { + key string + value string + ok bool + } + + zmq.AuthSetVerbose(false) + + // Start authentication engine + err := zmq.AuthStart() + if err != nil { + t.Fatal("AuthStart:", err) + } + defer zmq.AuthStop() + + zmq.AuthSetMetadataHandler( + func(version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string) { + return map[string]string{ + "Identity": identity, + "User-Id": "anonymous", + "Hello": "World!", + "Foo": "Bar", + } + }) + + zmq.AuthAllow("domain1", "127.0.0.1") + + // We need two certificates, one for the client and one for + // the server. The client must know the server's public key + // to make a CURVE connection. + client_public, client_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + server_public, server_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + + // Tell authenticator to use this public client key + zmq.AuthCurveAdd("domain1", client_public) + + // Create and bind server socket + server, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + server.SetLinger(0) + server.Close() + }() + server.SetIdentity("Server1") + server.ServerAuthCurve("domain1", server_secret) + err = server.Bind("tcp://*:9000") + if err != nil { + t.Fatal("server.Bind:", err) + } + + // Create and connect client socket + client, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + client.SetLinger(0) + client.Close() + }() + server.SetIdentity("Client1") + client.ClientAuthCurve(server_public, client_public, client_secret) + err = client.Connect("tcp://127.0.0.1:9000") + if err != nil { + t.Fatal("client.Connect:", err) + } + + // Send a message from client to server + msg := []string{"Greetings", "Earthlings!"} + _, err = client.SendMessage(msg[0], msg[1]) + if err != nil { + t.Fatal("client.SendMessage:", err) + } + + // Receive message and metadata on the server + tests := []Meta{ + {"Identity", "Server1", true}, + {"User-Id", "anonymous", true}, + {"Socket-Type", "DEALER", true}, + {"Hello", "World!", true}, + {"Foo", "Bar", true}, + {"Fuz", "", false}, + } + keys := make([]string, len(tests)) + for i, test := range tests { + keys[i] = test.key + } + message, metadata, err := server.RecvMessageWithMetadata(0, keys...) + if err != nil { + t.Fatal("server.RecvMessageWithMetadata:", err) + } + if !arrayEqual(message, msg) { + t.Errorf("Received message was %q, expected %q", message, msg) + } + if _, minor, _ := zmq.Version(); minor < 1 { + t.Log("Metadata not avalable in ZeroMQ versions prior to 4.1.0") + } else { + for _, test := range tests { + value, ok := metadata[test.key] + if value != test.value || ok != test.ok { + t.Errorf("Metadata %s, expected %q %v, got %q %v", test.key, test.value, test.ok, value, ok) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/ctxoptions_unix.go b/vendor/github.com/pebbe/zmq4/ctxoptions_unix.go new file mode 100644 index 0000000..c980cd1 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/ctxoptions_unix.go @@ -0,0 +1,56 @@ +// +build !windows + +package zmq4 + +/* +#include +#include "zmq4.h" +*/ +import "C" + +/* +Sets the scheduling policy for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadSchedPolicy(n int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return setOption(ctx, C.ZMQ_THREAD_SCHED_POLICY, n) +} + +/* +Sets scheduling priority for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadPriority(n int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return setOption(ctx, C.ZMQ_THREAD_PRIORITY, n) +} diff --git a/vendor/github.com/pebbe/zmq4/ctxoptions_windows.go b/vendor/github.com/pebbe/zmq4/ctxoptions_windows.go new file mode 100644 index 0000000..b976013 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/ctxoptions_windows.go @@ -0,0 +1,44 @@ +// +build windows + +package zmq4 + +/* +Sets the scheduling policy for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadSchedPolicy(n int) error { + return ErrorNotImplementedWindows +} + +/* +Sets scheduling priority for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadPriority(n int) error { + return ErrorNotImplementedWindows +} diff --git a/vendor/github.com/pebbe/zmq4/doc.go b/vendor/github.com/pebbe/zmq4/doc.go new file mode 100644 index 0000000..eee1186 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/doc.go @@ -0,0 +1,20 @@ +/* +A Go interface to ZeroMQ (zmq, 0mq) version 4. + +For ZeroMQ version 3, see: http://github.com/pebbe/zmq3 + +For ZeroMQ version 2, see: http://github.com/pebbe/zmq2 + +http://www.zeromq.org/ + +See also the wiki: https://github.com/pebbe/zmq4/wiki + +A note on the use of a context: + +This package provides a default context. This is what will be used by +the functions without a context receiver, that create a socket or +manipulate the context. Package developers that import this package +should probably not use the default context with its associated +functions, but create their own context(s). See: type Context. +*/ +package zmq4 diff --git a/vendor/github.com/pebbe/zmq4/draft/TODO.md b/vendor/github.com/pebbe/zmq4/draft/TODO.md new file mode 100644 index 0000000..56bc7e1 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/TODO.md @@ -0,0 +1,46 @@ +## TODO for ZMQ 4.2 DRAFT + +see: https://github.com/zeromq/libzmq/releases/tag/v4.2.0 + +### New poller mechanism and APIs have been introduced in DRAFT state: + + zmq_poller_new + zmq_poller_destroy + zmq_poller_add + zmq_poller_modify + zmq_poller_remove + zmq_poller_wait + zmq_poller_wait_all + zmq_poller_add_fd + zmq_poller_modify_fd + zmq_poller_remove_fd + +and a new supporting struct typedef + + zmq_poller_event_t + +They support existing socket type, new thread-safe socket types and file +descriptors (cross-platform). + +Documentation will be made available in the future before these APIs are +declared stable. + +**Status in Go**: Not implemented because there is no documentation. + +### New cross-platform timers helper functions have been introduced in DRAFT state: + + zmq_timers_new + zmq_timers_destroy + zmq_timers_add + zmq_timers_cancel + zmq_timers_set_interval + zmq_timers_reset + zmq_timers_timeout + zmq_timers_execute + +and a new supporting callback typedef: + + zmq_timer_fn + +**Status in Go:** Not implemented because there is no documentation. +Do we need this in Go? diff --git a/vendor/github.com/pebbe/zmq4/draft/auth.go b/vendor/github.com/pebbe/zmq4/draft/auth.go new file mode 100644 index 0000000..70fb1d4 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/auth.go @@ -0,0 +1,645 @@ +/* + +This file implements functionality very similar to that of the xauth module in czmq. + +Notable differences in here: + + - domains are supported + - domains are used in AuthAllow and AuthDeny too + - usernames/passwords are read from memory, not from file + - public keys are read from memory, not from file + - an address can be a single IP address, or an IP address and mask in CIDR notation + - additional functions for configuring server or client socket with a single command + +*/ + +package zmq4 + +/* +#include +#include + +#if ZMQ_VERSION_MINOR < 2 +// Version < 4.2.x + +int zmq_curve_public (char *z85_public_key, const char *z85_secret_key) { return 0; } + +#endif // Version < 4.2.x +*/ +import "C" + +import ( + "errors" + "log" + "net" + "strings" + "unsafe" +) + +const CURVE_ALLOW_ANY = "*" + +var ( + auth_handler *Socket + auth_quit *Socket + + auth_init = false + auth_verbose = false + + auth_allow = make(map[string]map[string]bool) + auth_deny = make(map[string]map[string]bool) + auth_allow_net = make(map[string][]*net.IPNet) + auth_deny_net = make(map[string][]*net.IPNet) + + auth_users = make(map[string]map[string]string) + + auth_pubkeys = make(map[string]map[string]bool) + + auth_meta_handler = auth_meta_handler_default +) + +func auth_meta_handler_default(version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string) { + return map[string]string{} +} + +func auth_isIP(addr string) bool { + if net.ParseIP(addr) != nil { + return true + } + if _, _, err := net.ParseCIDR(addr); err == nil { + return true + } + return false +} + +func auth_is_allowed(domain, address string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow[d]; ok { + if a[address] { + return true + } + } + } + addr := net.ParseIP(address) + if addr != nil { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow_net[d]; ok { + for _, m := range a { + if m.Contains(addr) { + return true + } + } + } + } + } + return false +} + +func auth_is_denied(domain, address string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny[d]; ok { + if a[address] { + return true + } + } + } + addr := net.ParseIP(address) + if addr != nil { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny_net[d]; ok { + for _, m := range a { + if m.Contains(addr) { + return true + } + } + } + } + } + return false +} + +func auth_has_allow(domain string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_allow[d]; ok { + if len(a) > 0 || len(auth_allow_net[d]) > 0 { + return true + } + } + } + return false +} + +func auth_has_deny(domain string) bool { + for _, d := range []string{domain, "*"} { + if a, ok := auth_deny[d]; ok { + if len(a) > 0 || len(auth_deny_net[d]) > 0 { + return true + } + } + } + return false +} + +func auth_do_handler() { + for { + + msg, err := auth_handler.RecvMessage(0) + if err != nil { + if auth_verbose { + log.Println("AUTH: Quitting:", err) + } + break + } + + if msg[0] == "QUIT" { + if auth_verbose { + log.Println("AUTH: Quitting: received QUIT message") + } + _, err := auth_handler.SendMessage("QUIT") + if err != nil && auth_verbose { + log.Println("AUTH: Quitting: bouncing QUIT message:", err) + } + break + } + + version := msg[0] + if version != "1.0" { + panic("AUTH: version != 1.0") + } + + request_id := msg[1] + domain := msg[2] + address := msg[3] + identity := msg[4] + mechanism := msg[5] + credentials := msg[6:] + + username := "" + password := "" + client_key := "" + if mechanism == "PLAIN" { + username = msg[6] + password = msg[7] + } else if mechanism == "CURVE" { + s := msg[6] + if len(s) != 32 { + panic("AUTH: len(client_key) != 32") + } + client_key = Z85encode(s) + } + + allowed := false + denied := false + + if auth_has_allow(domain) { + if auth_is_allowed(domain, address) { + allowed = true + if auth_verbose { + log.Printf("AUTH: PASSED (whitelist) domain=%q address=%q\n", domain, address) + } + } else { + denied = true + if auth_verbose { + log.Printf("AUTH: DENIED (not in whitelist) domain=%q address=%q\n", domain, address) + } + } + } else if auth_has_deny(domain) { + if auth_is_denied(domain, address) { + denied = true + if auth_verbose { + log.Printf("AUTH: DENIED (blacklist) domain=%q address=%q\n", domain, address) + } + } else { + allowed = true + if auth_verbose { + log.Printf("AUTH: PASSED (not in blacklist) domain=%q address=%q\n", domain, address) + } + } + } + + // Mechanism-specific checks + if !denied { + if mechanism == "NULL" && !allowed { + // For NULL, we allow if the address wasn't blacklisted + if auth_verbose { + log.Printf("AUTH: ALLOWED (NULL)\n") + } + allowed = true + } else if mechanism == "PLAIN" { + // For PLAIN, even a whitelisted address must authenticate + allowed = authenticate_plain(domain, username, password) + } else if mechanism == "CURVE" { + // For CURVE, even a whitelisted address must authenticate + allowed = authenticate_curve(domain, client_key) + } + } + if allowed { + m := auth_meta_handler(version, request_id, domain, address, identity, mechanism, credentials...) + user_id := "" + if uid, ok := m["User-Id"]; ok { + user_id = uid + delete(m, "User-Id") + } + metadata := make([]byte, 0) + for key, value := range m { + if len(key) < 256 { + metadata = append(metadata, auth_meta_blob(key, value)...) + } + } + auth_handler.SendMessage(version, request_id, "200", "OK", user_id, metadata) + } else { + auth_handler.SendMessage(version, request_id, "400", "NO ACCESS", "", "") + } + } + + err := auth_handler.Close() + if err != nil && auth_verbose { + log.Println("AUTH: Quitting: Close:", err) + } + if auth_verbose { + log.Println("AUTH: Quit") + } +} + +func authenticate_plain(domain, username, password string) bool { + for _, dom := range []string{domain, "*"} { + if m, ok := auth_users[dom]; ok { + if m[username] == password { + if auth_verbose { + log.Printf("AUTH: ALLOWED (PLAIN) domain=%q username=%q password=%q\n", dom, username, password) + } + return true + } + } + } + if auth_verbose { + log.Printf("AUTH: DENIED (PLAIN) domain=%q username=%q password=%q\n", domain, username, password) + } + return false +} + +func authenticate_curve(domain, client_key string) bool { + for _, dom := range []string{domain, "*"} { + if m, ok := auth_pubkeys[dom]; ok { + if m[CURVE_ALLOW_ANY] { + if auth_verbose { + log.Printf("AUTH: ALLOWED (CURVE any client) domain=%q\n", dom) + } + return true + } + if m[client_key] { + if auth_verbose { + log.Printf("AUTH: ALLOWED (CURVE) domain=%q client_key=%q\n", dom, client_key) + } + return true + } + } + } + if auth_verbose { + log.Printf("AUTH: DENIED (CURVE) domain=%q client_key=%q\n", domain, client_key) + } + return false +} + +// Start authentication. +// +// Note that until you add policies, all incoming NULL connections are allowed +// (classic ZeroMQ behaviour), and all PLAIN and CURVE connections are denied. +func AuthStart() (err error) { + if auth_init { + if auth_verbose { + log.Println("AUTH: Already running") + } + return errors.New("Auth is already running") + } + + auth_handler, err = NewSocket(REP) + if err != nil { + return + } + auth_handler.SetLinger(0) + err = auth_handler.Bind("inproc://zeromq.zap.01") + if err != nil { + auth_handler.Close() + return + } + + auth_quit, err = NewSocket(REQ) + if err != nil { + auth_handler.Close() + return + } + auth_quit.SetLinger(0) + err = auth_quit.Connect("inproc://zeromq.zap.01") + if err != nil { + auth_handler.Close() + auth_quit.Close() + return + } + + go auth_do_handler() + + if auth_verbose { + log.Println("AUTH: Starting") + } + + auth_init = true + + return +} + +// Stop authentication. +func AuthStop() { + if !auth_init { + if auth_verbose { + log.Println("AUTH: Not running, can't stop") + } + return + } + if auth_verbose { + log.Println("AUTH: Stopping") + } + _, err := auth_quit.SendMessageDontwait("QUIT") + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: SendMessageDontwait(\"QUIT\"):", err) + } + _, err = auth_quit.RecvMessage(0) + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: RecvMessage:", err) + } + err = auth_quit.Close() + if err != nil && auth_verbose { + log.Println("AUTH: Stopping: Close:", err) + } + if auth_verbose { + log.Println("AUTH: Stopped") + } + + auth_init = false + +} + +// Allow (whitelist) some addresses for a domain. +// +// An address can be a single IP address, or an IP address and mask in CIDR notation. +// +// For NULL, all clients from these addresses will be accepted. +// +// For PLAIN and CURVE, they will be allowed to continue with authentication. +// +// You can call this method multiple times to whitelist multiple IP addresses. +// +// If you whitelist a single address for a domain, any non-whitelisted addresses +// for that domain are treated as blacklisted. +// +// Use domain "*" for all domains. +// +// For backward compatibility: if domain can be parsed as an IP address, it will be +// interpreted as another address, and it and all remaining addresses will be added +// to all domains. +func AuthAllow(domain string, addresses ...string) { + if auth_isIP(domain) { + auth_allow_for_domain("*", domain) + auth_allow_for_domain("*", addresses...) + } else { + auth_allow_for_domain(domain, addresses...) + } +} + +func auth_allow_for_domain(domain string, addresses ...string) { + if _, ok := auth_allow[domain]; !ok { + auth_allow[domain] = make(map[string]bool) + auth_allow_net[domain] = make([]*net.IPNet, 0) + } + for _, address := range addresses { + if _, ipnet, err := net.ParseCIDR(address); err == nil { + auth_allow_net[domain] = append(auth_allow_net[domain], ipnet) + } else if net.ParseIP(address) != nil { + auth_allow[domain][address] = true + } else { + if auth_verbose { + log.Printf("AUTH: Allow for domain %q: %q is not a valid address or network\n", domain, address) + } + } + } +} + +// Deny (blacklist) some addresses for a domain. +// +// An address can be a single IP address, or an IP address and mask in CIDR notation. +// +// For all security mechanisms, this rejects the connection without any further authentication. +// +// Use either a whitelist for a domain, or a blacklist for a domain, not both. +// If you define both a whitelist and a blacklist for a domain, only the whitelist takes effect. +// +// Use domain "*" for all domains. +// +// For backward compatibility: if domain can be parsed as an IP address, it will be +// interpreted as another address, and it and all remaining addresses will be added +// to all domains. +func AuthDeny(domain string, addresses ...string) { + if auth_isIP(domain) { + auth_deny_for_domain("*", domain) + auth_deny_for_domain("*", addresses...) + } else { + auth_deny_for_domain(domain, addresses...) + } +} + +func auth_deny_for_domain(domain string, addresses ...string) { + if _, ok := auth_deny[domain]; !ok { + auth_deny[domain] = make(map[string]bool) + auth_deny_net[domain] = make([]*net.IPNet, 0) + } + for _, address := range addresses { + if _, ipnet, err := net.ParseCIDR(address); err == nil { + auth_deny_net[domain] = append(auth_deny_net[domain], ipnet) + } else if net.ParseIP(address) != nil { + auth_deny[domain][address] = true + } else { + if auth_verbose { + log.Printf("AUTH: Deny for domain %q: %q is not a valid address or network\n", domain, address) + } + } + } +} + +// Add a user for PLAIN authentication for a given domain. +// +// Set `domain` to "*" to apply to all domains. +func AuthPlainAdd(domain, username, password string) { + if _, ok := auth_users[domain]; !ok { + auth_users[domain] = make(map[string]string) + } + auth_users[domain][username] = password +} + +// Remove users from PLAIN authentication for a given domain. +func AuthPlainRemove(domain string, usernames ...string) { + if u, ok := auth_users[domain]; ok { + for _, username := range usernames { + delete(u, username) + } + } +} + +// Remove all users from PLAIN authentication for a given domain. +func AuthPlainRemoveAll(domain string) { + delete(auth_users, domain) +} + +// Add public user keys for CURVE authentication for a given domain. +// +// To cover all domains, use "*". +// +// Public keys are in Z85 printable text format. +// +// To allow all client keys without checking, specify CURVE_ALLOW_ANY for the key. +func AuthCurveAdd(domain string, pubkeys ...string) { + if _, ok := auth_pubkeys[domain]; !ok { + auth_pubkeys[domain] = make(map[string]bool) + } + for _, key := range pubkeys { + auth_pubkeys[domain][key] = true + } +} + +// Remove user keys from CURVE authentication for a given domain. +func AuthCurveRemove(domain string, pubkeys ...string) { + if p, ok := auth_pubkeys[domain]; ok { + for _, pubkey := range pubkeys { + delete(p, pubkey) + } + } +} + +// Remove all user keys from CURVE authentication for a given domain. +func AuthCurveRemoveAll(domain string) { + delete(auth_pubkeys, domain) +} + +// Enable verbose tracing of commands and activity. +func AuthSetVerbose(verbose bool) { + auth_verbose = verbose +} + +/* +This function sets the metadata handler that is called by the ZAP +handler to retrieve key/value properties that should be set on reply +messages in case of a status code "200" (succes). + +Default properties are `Socket-Type`, which is already set, and +`Identity` and `User-Id` that are empty by default. The last two can be +set, and more properties can be added. + +The `User-Id` property is used for the `user id` frame of the reply +message. All other properties are stored in the `metadata` frame of the +reply message. + +The default handler returns an empty map. + +For the meaning of the handler arguments, and other details, see: +http://rfc.zeromq.org/spec:27#toc10 +*/ +func AuthSetMetadataHandler( + handler func( + version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string)) { + auth_meta_handler = handler +} + +/* +This encodes a key/value pair into the format used by a ZAP handler. + +Returns an error if key is more then 255 characters long. +*/ +func AuthMetaBlob(key, value string) (blob []byte, err error) { + if len(key) > 255 { + return []byte{}, errors.New("Key too long") + } + return auth_meta_blob(key, value), nil +} + +func auth_meta_blob(name, value string) []byte { + l1 := len(name) + l2 := len(value) + b := make([]byte, l1+l2+5) + b[0] = byte(l1) + b[l1+1] = byte(l2 >> 24 & 255) + b[l1+2] = byte(l2 >> 16 & 255) + b[l1+3] = byte(l2 >> 8 & 255) + b[l1+4] = byte(l2 & 255) + copy(b[1:], []byte(name)) + copy(b[5+l1:], []byte(value)) + return b +} + +//. Additional functions for configuring server or client socket with a single command + +// Set NULL server role. +func (server *Socket) ServerAuthNull(domain string) error { + err := server.SetPlainServer(0) + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set PLAIN server role. +func (server *Socket) ServerAuthPlain(domain string) error { + err := server.SetPlainServer(1) + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set CURVE server role. +func (server *Socket) ServerAuthCurve(domain, secret_key string) error { + err := server.SetCurveServer(1) + if err == nil { + err = server.SetCurveSecretkey(secret_key) + } + if err == nil { + err = server.SetZapDomain(domain) + } + return err +} + +// Set PLAIN client role. +func (client *Socket) ClientAuthPlain(username, password string) error { + err := client.SetPlainUsername(username) + if err == nil { + err = client.SetPlainPassword(password) + } + return err +} + +// Set CURVE client role. +func (client *Socket) ClientAuthCurve(server_public_key, client_public_key, client_secret_key string) error { + err := client.SetCurveServerkey(server_public_key) + if err == nil { + err = client.SetCurvePublickey(client_public_key) + } + if err == nil { + client.SetCurveSecretkey(client_secret_key) + } + return err +} + +// Helper function to derive z85 public key from secret key +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +func AuthCurvePublic(z85SecretKey string) (z85PublicKey string, err error) { + if minor < 2 { + return "", ErrorNotImplemented42 + } + secret := C.CString(z85SecretKey) + defer C.free(unsafe.Pointer(secret)) + public := C.CString(strings.Repeat(" ", 41)) + defer C.free(unsafe.Pointer(public)) + if i, err := C.zmq_curve_public(public, secret); int(i) != 0 { + return "", errget(err) + } + z85PublicKey = C.GoString(public) + return z85PublicKey, nil +} diff --git a/vendor/github.com/pebbe/zmq4/draft/auth_test.go b/vendor/github.com/pebbe/zmq4/draft/auth_test.go new file mode 100644 index 0000000..bf94180 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/auth_test.go @@ -0,0 +1,144 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4/draft" + + "testing" +) + +func TestAuthCurvePublic(t *testing.T) { + if _, minor, _ := zmq.Version(); minor < 2 { + t.Skip("CurvePublic not available in ZeroMQ versions prior to 4.2.0") + } + expected := "Yne@$w-vo= 1 && !zmq.HasCurve() { + t.Skip("Curve not available") + } + + type Meta struct { + key string + value string + ok bool + } + + zmq.AuthSetVerbose(false) + + // Start authentication engine + err := zmq.AuthStart() + if err != nil { + t.Fatal("AuthStart:", err) + } + defer zmq.AuthStop() + + zmq.AuthSetMetadataHandler( + func(version, request_id, domain, address, identity, mechanism string, credentials ...string) (metadata map[string]string) { + return map[string]string{ + "Identity": identity, + "User-Id": "anonymous", + "Hello": "World!", + "Foo": "Bar", + } + }) + + zmq.AuthAllow("domain1", "127.0.0.1") + + // We need two certificates, one for the client and one for + // the server. The client must know the server's public key + // to make a CURVE connection. + client_public, client_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + server_public, server_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + + // Tell authenticator to use this public client key + zmq.AuthCurveAdd("domain1", client_public) + + // Create and bind server socket + server, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + server.SetLinger(0) + server.Close() + }() + server.SetIdentity("Server1") + server.ServerAuthCurve("domain1", server_secret) + err = server.Bind("tcp://*:9000") + if err != nil { + t.Fatal("server.Bind:", err) + } + + // Create and connect client socket + client, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + client.SetLinger(0) + client.Close() + }() + server.SetIdentity("Client1") + client.ClientAuthCurve(server_public, client_public, client_secret) + err = client.Connect("tcp://127.0.0.1:9000") + if err != nil { + t.Fatal("client.Connect:", err) + } + + // Send a message from client to server + msg := []string{"Greetings", "Earthlings!"} + _, err = client.SendMessage(msg[0], msg[1]) + if err != nil { + t.Fatal("client.SendMessage:", err) + } + + // Receive message and metadata on the server + tests := []Meta{ + {"Identity", "Server1", true}, + {"User-Id", "anonymous", true}, + {"Socket-Type", "DEALER", true}, + {"Hello", "World!", true}, + {"Foo", "Bar", true}, + {"Fuz", "", false}, + } + keys := make([]string, len(tests)) + for i, test := range tests { + keys[i] = test.key + } + message, metadata, err := server.RecvMessageWithMetadata(0, keys...) + if err != nil { + t.Fatal("server.RecvMessageWithMetadata:", err) + } + if !arrayEqual(message, msg) { + t.Errorf("Received message was %q, expected %q", message, msg) + } + if _, minor, _ := zmq.Version(); minor < 1 { + t.Log("Metadata not avalable in ZeroMQ versions prior to 4.1.0") + } else { + for _, test := range tests { + value, ok := metadata[test.key] + if value != test.value || ok != test.ok { + t.Errorf("Metadata %s, expected %q %v, got %q %v", test.key, test.value, test.ok, value, ok) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/draft/ctxoptions_unix.go b/vendor/github.com/pebbe/zmq4/draft/ctxoptions_unix.go new file mode 100644 index 0000000..c980cd1 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/ctxoptions_unix.go @@ -0,0 +1,56 @@ +// +build !windows + +package zmq4 + +/* +#include +#include "zmq4.h" +*/ +import "C" + +/* +Sets the scheduling policy for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadSchedPolicy(n int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return setOption(ctx, C.ZMQ_THREAD_SCHED_POLICY, n) +} + +/* +Sets scheduling priority for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadPriority(n int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return setOption(ctx, C.ZMQ_THREAD_PRIORITY, n) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/ctxoptions_windows.go b/vendor/github.com/pebbe/zmq4/draft/ctxoptions_windows.go new file mode 100644 index 0000000..b976013 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/ctxoptions_windows.go @@ -0,0 +1,44 @@ +// +build windows + +package zmq4 + +/* +Sets the scheduling policy for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadSchedPolicy(n int) error { + return ErrorNotImplementedWindows +} + +/* +Sets scheduling priority for internal context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func (ctx *Context) SetThreadPriority(n int) error { + return ErrorNotImplementedWindows +} diff --git a/vendor/github.com/pebbe/zmq4/draft/doc.go b/vendor/github.com/pebbe/zmq4/draft/doc.go new file mode 100644 index 0000000..0732a74 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/doc.go @@ -0,0 +1,23 @@ +/* +A Go interface to ZeroMQ (zmq, 0mq) version 4. + +This includes partial support for ZeroMQ 4.2 DRAFT. The API pertaining +to this support is subject to change. + +For ZeroMQ version 3, see: http://github.com/pebbe/zmq3 + +For ZeroMQ version 2, see: http://github.com/pebbe/zmq2 + +http://www.zeromq.org/ + +See also the wiki: https://github.com/pebbe/zmq4/wiki + +A note on the use of a context: + +This package provides a default context. This is what will be used by +the functions without a context receiver, that create a socket or +manipulate the context. Package developers that import this package +should probably not use the default context with its associated +functions, but create their own context(s). See: type Context. +*/ +package zmq4 diff --git a/vendor/github.com/pebbe/zmq4/draft/dummy.c b/vendor/github.com/pebbe/zmq4/draft/dummy.c new file mode 100644 index 0000000..0fca94d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/dummy.c @@ -0,0 +1,5 @@ +/* + +You need CGO_ENABLED=1 to build this package + +*/ diff --git a/vendor/github.com/pebbe/zmq4/draft/errors.go b/vendor/github.com/pebbe/zmq4/draft/errors.go new file mode 100644 index 0000000..48dcdc3 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/errors.go @@ -0,0 +1,92 @@ +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "syscall" +) + +// An Errno is an unsigned number describing an error condition as returned by a call to ZeroMQ. +// It implements the error interface. +// The number is either a standard system error, or an error defined by the C library of ZeroMQ. +type Errno uintptr + +const ( + // Error conditions defined by the C library of ZeroMQ. + + // On Windows platform some of the standard POSIX errnos are not defined. + EADDRINUSE = Errno(C.EADDRINUSE) + EADDRNOTAVAIL = Errno(C.EADDRNOTAVAIL) + EAFNOSUPPORT = Errno(C.EAFNOSUPPORT) + ECONNABORTED = Errno(C.ECONNABORTED) + ECONNREFUSED = Errno(C.ECONNREFUSED) + ECONNRESET = Errno(C.ECONNRESET) + EHOSTUNREACH = Errno(C.EHOSTUNREACH) + EINPROGRESS = Errno(C.EINPROGRESS) + EMSGSIZE = Errno(C.EMSGSIZE) + ENETDOWN = Errno(C.ENETDOWN) + ENETRESET = Errno(C.ENETRESET) + ENETUNREACH = Errno(C.ENETUNREACH) + ENOBUFS = Errno(C.ENOBUFS) + ENOTCONN = Errno(C.ENOTCONN) + ENOTSOCK = Errno(C.ENOTSOCK) + ENOTSUP = Errno(C.ENOTSUP) + EPROTONOSUPPORT = Errno(C.EPROTONOSUPPORT) + ETIMEDOUT = Errno(C.ETIMEDOUT) + + // Native 0MQ error codes. + EFSM = Errno(C.EFSM) + EMTHREAD = Errno(C.EMTHREAD) + ENOCOMPATPROTO = Errno(C.ENOCOMPATPROTO) + ETERM = Errno(C.ETERM) +) + +func errget(err error) error { + eno, ok := err.(syscall.Errno) + if ok { + return Errno(eno) + } + return err +} + +// Return Errno as string. +func (errno Errno) Error() string { + if errno >= C.ZMQ_HAUSNUMERO { + return C.GoString(C.zmq_strerror(C.int(errno))) + } + return syscall.Errno(errno).Error() +} + +/* +Convert error to Errno. + +Example usage: + + switch AsErrno(err) { + + case zmq.Errno(syscall.EINTR): + // standard system error + + // call was interrupted + + case zmq.ETERM: + // error defined by ZeroMQ + + // context was terminated + + } + +See also: examples/interrupt.go +*/ +func AsErrno(err error) Errno { + if eno, ok := err.(Errno); ok { + return eno + } + if eno, ok := err.(syscall.Errno); ok { + return Errno(eno) + } + return Errno(0) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/polling.go b/vendor/github.com/pebbe/zmq4/draft/polling.go new file mode 100644 index 0000000..6e20a55 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/polling.go @@ -0,0 +1,187 @@ +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "fmt" + "time" +) + +// Return type for (*Poller)Poll +type Polled struct { + Socket *Socket // socket with matched event(s) + Events State // actual matched event(s) +} + +type Poller struct { + items []C.zmq_pollitem_t + socks []*Socket +} + +// Create a new Poller +func NewPoller() *Poller { + return &Poller{ + items: make([]C.zmq_pollitem_t, 0), + socks: make([]*Socket, 0), + } +} + +// Add items to the poller +// +// Events is a bitwise OR of zmq.POLLIN and zmq.POLLOUT +// +// Returns the id of the item, which can be used as a handle to +// (*Poller)Update and as an index into the result of (*Poller)PollAll +func (p *Poller) Add(soc *Socket, events State) int { + var item C.zmq_pollitem_t + item.socket = soc.soc + item.fd = 0 + item.events = C.short(events) + p.items = append(p.items, item) + p.socks = append(p.socks, soc) + return len(p.items) - 1 +} + +// Update the events mask of a socket in the poller +// +// Replaces the Poller's bitmask for the specified id with the events parameter passed +// +// Returns the previous value, or ErrorNoSocket if the id was out of range +func (p *Poller) Update(id int, events State) (previous State, err error) { + if id >= 0 && id < len(p.items) { + previous = State(p.items[id].events) + p.items[id].events = C.short(events) + return previous, nil + } + return 0, ErrorNoSocket +} + +// Update the events mask of a socket in the poller +// +// Replaces the Poller's bitmask for the specified socket with the events parameter passed +// +// Returns the previous value, or ErrorNoSocket if the socket didn't match +func (p *Poller) UpdateBySocket(soc *Socket, events State) (previous State, err error) { + for id, s := range p.socks { + if s == soc { + previous = State(p.items[id].events) + p.items[id].events = C.short(events) + return previous, nil + } + } + return 0, ErrorNoSocket +} + +// Remove a socket from the poller +// +// Returns ErrorNoSocket if the id was out of range +func (p *Poller) Remove(id int) error { + if id >= 0 && id < len(p.items) { + if id == len(p.items)-1 { + p.items = p.items[:id] + p.socks = p.socks[:id] + } else { + p.items = append(p.items[:id], p.items[id+1:]...) + p.socks = append(p.socks[:id], p.socks[id+1:]...) + } + return nil + } + return ErrorNoSocket +} + +// Remove a socket from the poller +// +// Returns ErrorNoSocket if the socket didn't match +func (p *Poller) RemoveBySocket(soc *Socket) error { + for id, s := range p.socks { + if s == soc { + return p.Remove(id) + } + } + return ErrorNoSocket +} + +/* +Input/output multiplexing + +If timeout < 0, wait forever until a matching event is detected + +Only sockets with matching socket events are returned in the list. + +Example: + + poller := zmq.NewPoller() + poller.Add(socket0, zmq.POLLIN) + poller.Add(socket1, zmq.POLLIN) + // Process messages from both sockets + for { + sockets, _ := poller.Poll(-1) + for _, socket := range sockets { + switch s := socket.Socket; s { + case socket0: + msg, _ := s.Recv(0) + // Process msg + case socket1: + msg, _ := s.Recv(0) + // Process msg + } + } + } +*/ +func (p *Poller) Poll(timeout time.Duration) ([]Polled, error) { + return p.poll(timeout, false) +} + +/* +This is like (*Poller)Poll, but it returns a list of all sockets, +in the same order as they were added to the poller, +not just those sockets that had an event. + +For each socket in the list, you have to check the Events field +to see if there was actually an event. + +When error is not nil, the return list contains no sockets. +*/ +func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) { + return p.poll(timeout, true) +} + +func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) { + lst := make([]Polled, 0, len(p.items)) + + for _, soc := range p.socks { + if !soc.opened { + return lst, ErrorSocketClosed + } + } + + t := timeout + if t > 0 { + t = t / time.Millisecond + } + if t < 0 { + t = -1 + } + rv, err := C.zmq_poll(&p.items[0], C.int(len(p.items)), C.long(t)) + if rv < 0 { + return lst, errget(err) + } + for i, it := range p.items { + if all || it.events&it.revents != 0 { + lst = append(lst, Polled{p.socks[i], State(it.revents)}) + } + } + return lst, nil +} + +// Poller as string. +func (p *Poller) String() string { + str := make([]string, 0) + for i, poll := range p.items { + str = append(str, fmt.Sprintf("%v%v", p.socks[i], State(poll.events))) + } + return fmt.Sprint("Poller", str) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/reactor.go b/vendor/github.com/pebbe/zmq4/draft/reactor.go new file mode 100644 index 0000000..701dc91 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/reactor.go @@ -0,0 +1,194 @@ +package zmq4 + +import ( + "errors" + "fmt" + "time" +) + +type reactor_socket struct { + e State + f func(State) error +} + +type reactor_channel struct { + ch <-chan interface{} + f func(interface{}) error + limit int +} + +type Reactor struct { + sockets map[*Socket]*reactor_socket + channels map[uint64]*reactor_channel + p *Poller + idx uint64 + remove []uint64 + verbose bool +} + +/* +Create a reactor to mix the handling of sockets and channels (timers or other channels). + +Example: + + reactor := zmq.NewReactor() + reactor.AddSocket(socket1, zmq.POLLIN, socket1_handler) + reactor.AddSocket(socket2, zmq.POLLIN, socket2_handler) + reactor.AddChannelTime(time.Tick(time.Second), 1, ticker_handler) + reactor.Run(time.Second) +*/ +func NewReactor() *Reactor { + r := &Reactor{ + sockets: make(map[*Socket]*reactor_socket), + channels: make(map[uint64]*reactor_channel), + p: NewPoller(), + remove: make([]uint64, 0), + } + return r +} + +// Add socket handler to the reactor. +// +// You can have only one handler per socket. Adding a second one will remove the first. +// +// The handler receives the socket state as an argument: POLLIN, POLLOUT, or both. +func (r *Reactor) AddSocket(soc *Socket, events State, handler func(State) error) { + r.RemoveSocket(soc) + r.sockets[soc] = &reactor_socket{e: events, f: handler} + r.p.Add(soc, events) +} + +// Remove a socket handler from the reactor. +func (r *Reactor) RemoveSocket(soc *Socket) { + if _, ok := r.sockets[soc]; ok { + delete(r.sockets, soc) + // rebuild poller + r.p = NewPoller() + for s, props := range r.sockets { + r.p.Add(s, props.e) + } + } +} + +// Add channel handler to the reactor. +// +// Returns id of added handler, that can be used later to remove it. +// +// If limit is positive, at most this many items will be handled in each run through the main loop, +// otherwise it will process as many items as possible. +// +// The handler function receives the value received from the channel. +func (r *Reactor) AddChannel(ch <-chan interface{}, limit int, handler func(interface{}) error) (id uint64) { + r.idx++ + id = r.idx + r.channels[id] = &reactor_channel{ch: ch, f: handler, limit: limit} + return +} + +// This function wraps AddChannel, using a channel of type time.Time instead of type interface{}. +func (r *Reactor) AddChannelTime(ch <-chan time.Time, limit int, handler func(interface{}) error) (id uint64) { + ch2 := make(chan interface{}) + go func() { + for { + a, ok := <-ch + if !ok { + close(ch2) + break + } + ch2 <- a + } + }() + return r.AddChannel(ch2, limit, handler) +} + +// Remove a channel from the reactor. +// +// Closed channels are removed automatically. +func (r *Reactor) RemoveChannel(id uint64) { + r.remove = append(r.remove, id) +} + +func (r *Reactor) SetVerbose(verbose bool) { + r.verbose = verbose +} + +// Run the reactor. +// +// The interval determines the time-out on the polling of sockets. +// Interval must be positive if there are channels. +// If there are no channels, you can set interval to -1. +// +// The run alternates between polling/handling sockets (using the interval as timeout), +// and reading/handling channels. The reading of channels is without time-out: if there +// is no activity on any channel, the run continues to poll sockets immediately. +// +// The run exits when any handler returns an error, returning that same error. +func (r *Reactor) Run(interval time.Duration) (err error) { + for { + + // process requests to remove channels + for _, id := range r.remove { + delete(r.channels, id) + } + r.remove = r.remove[0:0] + + CHANNELS: + for id, ch := range r.channels { + limit := ch.limit + for { + select { + case val, ok := <-ch.ch: + if !ok { + if r.verbose { + fmt.Printf("Reactor(%p) removing closed channel %d\n", r, id) + } + r.RemoveChannel(id) + continue CHANNELS + } + if r.verbose { + fmt.Printf("Reactor(%p) channel %d: %q\n", r, id, val) + } + err = ch.f(val) + if err != nil { + return + } + if ch.limit > 0 { + limit-- + if limit == 0 { + continue CHANNELS + } + } + default: + continue CHANNELS + } + } + } + + if len(r.channels) > 0 && interval < 0 { + return errors.New("There are channels, but polling time-out is infinite") + } + + if len(r.sockets) == 0 { + if len(r.channels) == 0 { + return errors.New("No sockets to poll, no channels to read") + } + time.Sleep(interval) + continue + } + + polled, e := r.p.Poll(interval) + if e != nil { + return e + } + for _, item := range polled { + if r.verbose { + fmt.Printf("Reactor(%p) %v\n", r, item) + } + err = r.sockets[item.Socket].f(item.Events) + if err != nil { + return + } + } + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/draft/socketevent_test.go b/vendor/github.com/pebbe/zmq4/draft/socketevent_test.go new file mode 100644 index 0000000..7af51ec --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/socketevent_test.go @@ -0,0 +1,98 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4/draft" + + "fmt" + "testing" + "time" +) + +func rep_socket_monitor(addr string, chMsg chan<- string) { + + defer close(chMsg) + + s, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + chMsg <- fmt.Sprint("NewSocket:", err) + return + } + defer func() { + s.SetLinger(0) + s.Close() + }() + + err = s.Connect(addr) + if err != nil { + chMsg <- fmt.Sprint("s.Connect:", err) + return + } + + for { + a, b, _, err := s.RecvEvent(0) + if err != nil { + chMsg <- fmt.Sprint("s.RecvEvent:", err) + return + } + chMsg <- fmt.Sprint(a, " ", b) + if a == zmq.EVENT_CLOSED { + break + } + } + chMsg <- "Done" +} + +func TestSocketEvent(t *testing.T) { + + var rep *zmq.Socket + defer func() { + if rep != nil { + rep.SetLinger(0) + rep.Close() + } + }() + + // REP socket + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + + // REP socket monitor, all events + err = rep.Monitor("inproc://monitor.rep", zmq.EVENT_ALL) + if err != nil { + t.Fatal("rep.Monitor:", err) + } + chMsg := make(chan string, 10) + go rep_socket_monitor("inproc://monitor.rep", chMsg) + time.Sleep(time.Second) + + // Generate an event + err = rep.Bind("tcp://*:9689") + if err != nil { + t.Fatal("rep.Bind:", err) + } + + rep.Close() + rep = nil + + expect := []string{ + "EVENT_LISTENING tcp://0.0.0.0:9689", + "EVENT_CLOSED tcp://0.0.0.0:9689", + "Done", + } + i := 0 + for msg := range chMsg { + if i < len(expect) { + if msg != expect[i] { + t.Errorf("Expected message %q, got %q", expect[i], msg) + } + i++ + } else { + t.Error("Unexpected message: %q", msg) + } + } + for ; i < len(expect); i++ { + t.Errorf("Expected message %q, got nothing", expect[i]) + } +} diff --git a/vendor/github.com/pebbe/zmq4/draft/socketget.go b/vendor/github.com/pebbe/zmq4/draft/socketget.go new file mode 100644 index 0000000..cf28751 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/socketget.go @@ -0,0 +1,648 @@ +package zmq4 + +/* +#include +#include +#include "zmq4.h" +*/ +import "C" + +import ( + "strings" + "time" + "unsafe" +) + +func (soc *Socket) getString(opt C.int, bufsize int) (string, error) { + if !soc.opened { + return "", ErrorSocketClosed + } + value := make([]byte, bufsize) + size := C.size_t(bufsize) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value[0]), &size); i != 0 { + return "", errget(err) + } + return strings.TrimRight(string(value[:int(size)]), "\x00"), nil +} + +func (soc *Socket) getStringRaw(opt C.int, bufsize int) (string, error) { + if !soc.opened { + return "", ErrorSocketClosed + } + value := make([]byte, bufsize) + size := C.size_t(bufsize) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value[0]), &size); i != 0 { + return "", errget(err) + } + return string(value[:int(size)]), nil +} + +func (soc *Socket) getInt(opt C.int) (int, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.int(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return int(value), nil +} + +func (soc *Socket) getInt64(opt C.int) (int64, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.int64_t(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return int64(value), nil +} + +func (soc *Socket) getUInt64(opt C.int) (uint64, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.uint64_t(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return uint64(value), nil +} + +// ZMQ_TYPE: Retrieve socket type +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc43 +func (soc *Socket) GetType() (Type, error) { + v, err := soc.getInt(C.ZMQ_TYPE) + return Type(v), err +} + +// ZMQ_RCVMORE: More message data parts to follow +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc30 +func (soc *Socket) GetRcvmore() (bool, error) { + v, err := soc.getInt(C.ZMQ_RCVMORE) + return v != 0, err +} + +// ZMQ_SNDHWM: Retrieves high water mark for outbound messages +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc36 +func (soc *Socket) GetSndhwm() (int, error) { + return soc.getInt(C.ZMQ_SNDHWM) +} + +// ZMQ_RCVHWM: Retrieve high water mark for inbound messages +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc29 +func (soc *Socket) GetRcvhwm() (int, error) { + return soc.getInt(C.ZMQ_RCVHWM) +} + +// ZMQ_AFFINITY: Retrieve I/O thread affinity +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc3 +func (soc *Socket) GetAffinity() (uint64, error) { + return soc.getUInt64(C.ZMQ_AFFINITY) +} + +// ZMQ_IDENTITY: Retrieve socket identity +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc15 +func (soc *Socket) GetIdentity() (string, error) { + return soc.getString(C.ZMQ_IDENTITY, 256) +} + +// ZMQ_RATE: Retrieve multicast data rate +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc27 +func (soc *Socket) GetRate() (int, error) { + return soc.getInt(C.ZMQ_RATE) +} + +// ZMQ_RECOVERY_IVL: Get multicast recovery interval +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc34 +func (soc *Socket) GetRecoveryIvl() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECOVERY_IVL) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SNDBUF: Retrieve kernel transmit buffer size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc35 +func (soc *Socket) GetSndbuf() (int, error) { + return soc.getInt(C.ZMQ_SNDBUF) +} + +// ZMQ_RCVBUF: Retrieve kernel receive buffer size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc28 +func (soc *Socket) GetRcvbuf() (int, error) { + return soc.getInt(C.ZMQ_RCVBUF) +} + +// ZMQ_LINGER: Retrieve linger period for socket shutdown +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc20 +func (soc *Socket) GetLinger() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_LINGER) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_RECONNECT_IVL: Retrieve reconnection interval +// +// Returns time.Duration(-1) for no reconnection +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc32 +func (soc *Socket) GetReconnectIvl() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECONNECT_IVL) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc33 +func (soc *Socket) GetReconnectIvlMax() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECONNECT_IVL_MAX) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc4 +func (soc *Socket) GetBacklog() (int, error) { + return soc.getInt(C.ZMQ_BACKLOG) +} + +// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc21 +func (soc *Socket) GetMaxmsgsize() (int64, error) { + return soc.getInt64(C.ZMQ_MAXMSGSIZE) +} + +// ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc23 +func (soc *Socket) GetMulticastHops() (int, error) { + return soc.getInt(C.ZMQ_MULTICAST_HOPS) +} + +// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc31 +func (soc *Socket) GetRcvtimeo() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RCVTIMEO) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc37 +func (soc *Socket) GetSndtimeo() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_SNDTIMEO) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_IPV6: Retrieve IPv6 socket status +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc18 +func (soc *Socket) GetIpv6() (bool, error) { + v, err := soc.getInt(C.ZMQ_IPV6) + return v != 0, err +} + +// ZMQ_IMMEDIATE: Retrieve attach-on-connect value +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc16 +func (soc *Socket) GetImmediate() (bool, error) { + v, err := soc.getInt(C.ZMQ_IMMEDIATE) + return v != 0, err +} + +// ZMQ_FD: Retrieve file descriptor associated with the socket +// see socketget_unix.go and socketget_windows.go + +// ZMQ_EVENTS: Retrieve socket event state +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc8 +func (soc *Socket) GetEvents() (State, error) { + v, err := soc.getInt(C.ZMQ_EVENTS) + return State(v), err +} + +// ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc19 +func (soc *Socket) GetLastEndpoint() (string, error) { + return soc.getString(C.ZMQ_LAST_ENDPOINT, 1024) +} + +// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc38 +func (soc *Socket) GetTcpKeepalive() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE) +} + +// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS) +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc40 +func (soc *Socket) GetTcpKeepaliveIdle() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_IDLE) +} + +// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc39 +func (soc *Socket) GetTcpKeepaliveCnt() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_CNT) +} + +// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc41 +func (soc *Socket) GetTcpKeepaliveIntvl() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_INTVL) +} + +// ZMQ_MECHANISM: Retrieve current security mechanism +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc22 +func (soc *Socket) GetMechanism() (Mechanism, error) { + v, err := soc.getInt(C.ZMQ_MECHANISM) + return Mechanism(v), err +} + +// ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc25 +func (soc *Socket) GetPlainServer() (int, error) { + return soc.getInt(C.ZMQ_PLAIN_SERVER) +} + +// ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc26 +func (soc *Socket) GetPlainUsername() (string, error) { + s, err := soc.getString(C.ZMQ_PLAIN_USERNAME, 1024) + if n := len(s); n > 0 && s[n-1] == 0 { + s = s[:n-1] + } + return s, err +} + +// ZMQ_PLAIN_PASSWORD: Retrieve current password +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc24 +func (soc *Socket) GetPlainPassword() (string, error) { + s, err := soc.getString(C.ZMQ_PLAIN_PASSWORD, 1024) + if n := len(s); n > 0 && s[n-1] == 0 { + s = s[:n-1] + } + return s, err +} + +// ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc5 +func (soc *Socket) GetCurvePublickeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_PUBLICKEY, 32) +} + +// ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc5 +func (soc *Socket) GetCurvePublickeykeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_PUBLICKEY, 41) +} + +// ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc6 +func (soc *Socket) GetCurveSecretkeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_SECRETKEY, 32) +} + +// ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc6 +func (soc *Socket) GetCurveSecretkeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_SECRETKEY, 41) +} + +// ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc7 +func (soc *Socket) GetCurveServerkeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_SERVERKEY, 32) +} + +// ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc7 +func (soc *Socket) GetCurveServerkeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_SERVERKEY, 41) +} + +// ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc44 +func (soc *Socket) GetZapDomain() (string, error) { + return soc.getString(C.ZMQ_ZAP_DOMAIN, 1024) +} + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.1.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// D : deprecated +// o : setsockopt only +// implemented documented test +// ZMQ_ROUTER_HANDOVER o +// ZMQ_TOS + + +// ZMQ_IPC_FILTER_PID D +// ZMQ_IPC_FILTER_UID D +// ZMQ_IPC_FILTER_GID D +// ZMQ_CONNECT_RID o +// ZMQ_GSSAPI_SERVER + + +// ZMQ_GSSAPI_PRINCIPAL + + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL + + +// ZMQ_GSSAPI_PLAINTEXT + + +// ZMQ_HANDSHAKE_IVL + + +// ZMQ_SOCKS_PROXY + +// ZMQ_XPUB_NODROP o? +// +//////////////////////////////////////////////////////////////// + +// ZMQ_TOS: Retrieve the Type-of-Service socket override status +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc42 +func (soc *Socket) GetTos() (int, error) { + if minor < 1 { + return 0, ErrorNotImplemented41 + } + return soc.getInt(C.ZMQ_TOS) +} + +// ZMQ_CONNECT_RID: SET ONLY + +// ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc12 +func (soc *Socket) GetGssapiServer() (bool, error) { + if minor < 1 { + return false, ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_GSSAPI_SERVER) + return v != 0, err +} + +// ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc11 +func (soc *Socket) GetGssapiPrincipal() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_GSSAPI_PRINCIPAL, 1024) +} + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc13 +func (soc *Socket) GetGssapiServicePrincipal() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_GSSAPI_SERVICE_PRINCIPAL, 1024) +} + +// ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc10 +func (soc *Socket) GetGssapiPlaintext() (bool, error) { + if minor < 1 { + return false, ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_GSSAPI_PLAINTEXT) + return v != 0, err +} + +// ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc14 +func (soc *Socket) GetHandshakeIvl() (time.Duration, error) { + if minor < 1 { + return time.Duration(0), ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_HANDSHAKE_IVL) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SOCKS_PROXY: NOT DOCUMENTED +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +func (soc *Socket) GetSocksProxy() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_SOCKS_PROXY, 1024) +} + +// ZMQ_XPUB_NODROP: SET ONLY? (not documented) + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.2.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// o : setsockopt only +// implemented documented test +// ZMQ_BLOCKY +// ZMQ_XPUB_MANUAL o +// ZMQ_XPUB_WELCOME_MSG o +// ZMQ_STREAM_NOTIFY o +// ZMQ_INVERT_MATCHING + + +// ZMQ_HEARTBEAT_IVL o +// ZMQ_HEARTBEAT_TTL o +// ZMQ_HEARTBEAT_TIMEOUT o +// ZMQ_XPUB_VERBOSER o +// ZMQ_CONNECT_TIMEOUT + + +// ZMQ_TCP_MAXRT + + +// ZMQ_THREAD_SAFE + + +// ZMQ_MULTICAST_MAXTPDU + + +// ZMQ_VMCI_BUFFER_SIZE + + +// ZMQ_VMCI_BUFFER_MIN_SIZE + + +// ZMQ_VMCI_BUFFER_MAX_SIZE + + +// ZMQ_VMCI_CONNECT_TIMEOUT + + +// ZMQ_USE_FD + + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_BLOCKY doesn't look like a socket option + +// ZMQ_INVERT_MATCHING: Retrieve inverted filtering status +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc18 +func (soc *Socket) GetInvertMatching() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_INVERT_MATCHING) +} + +// ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc5 +func (soc *Socket) GetConnectTimeout() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_CONNECT_TIMEOUT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc44 +func (soc *Socket) GetTcpMaxrt() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_TCP_MAXRT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_THREAD_SAFE: Retrieve socket thread safety +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc45 +func (soc *Socket) GetThreadSafe() (bool, error) { + if minor < 2 { + return false, ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_THREAD_SAFE) + return v != 0, err +} + +// ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc26 +func (soc *Socket) GetMulticastMaxtpdu() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_MULTICAST_MAXTPDU) +} + +// ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc49 +func (soc *Socket) GetVmciBufferSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_SIZE) +} + +// ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc50 +func (soc *Socket) GetVmciBufferMinSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_MIN_SIZE) +} + +// ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc51 +func (soc *Socket) GetVmciBufferMaxSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_MAX_SIZE) +} + +// ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc52 +func (soc *Socket) GetVmciConnectTimeout() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_VMCI_CONNECT_TIMEOUT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_USE_FD: Retrieve the pre-allocated socket file descriptor +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc29 +func (soc *Socket) Getusefd() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_USE_FD) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/socketget_unix.go b/vendor/github.com/pebbe/zmq4/draft/socketget_unix.go new file mode 100644 index 0000000..2671b33 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/socketget_unix.go @@ -0,0 +1,15 @@ +// +build !windows + +package zmq4 + +/* +#include +*/ +import "C" + +// ZMQ_FD: Retrieve file descriptor associated with the socket +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc9 +func (soc *Socket) GetFd() (int, error) { + return soc.getInt(C.ZMQ_FD) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/socketget_windows.go b/vendor/github.com/pebbe/zmq4/draft/socketget_windows.go new file mode 100644 index 0000000..6d2a89c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/socketget_windows.go @@ -0,0 +1,26 @@ +// +build windows + +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "unsafe" +) + +/* +ZMQ_FD: Retrieve file descriptor associated with the socket + +See: http://api.zeromq.org/4-1:zmq-getsockopt#toc9 +*/ +func (soc *Socket) GetFd() (uintptr, error) { + value := C.SOCKET(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, C.ZMQ_FD, unsafe.Pointer(&value), &size); i != 0 { + return uintptr(0), errget(err) + } + return uintptr(value), nil +} diff --git a/vendor/github.com/pebbe/zmq4/draft/socketset.go b/vendor/github.com/pebbe/zmq4/draft/socketset.go new file mode 100644 index 0000000..d5dd6f0 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/socketset.go @@ -0,0 +1,800 @@ +package zmq4 + +/* +#include +#include +#include +#include "zmq4.h" +*/ +import "C" + +import ( + "time" + "unsafe" +) + +func (soc *Socket) setString(opt C.int, s string) error { + if !soc.opened { + return ErrorSocketClosed + } + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(cs), C.size_t(len(s))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setNullString(opt C.int) error { + if !soc.opened { + return ErrorSocketClosed + } + if i, err := C.zmq_setsockopt(soc.soc, opt, nil, 0); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setInt(opt C.int, value int) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.int(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setInt64(opt C.int, value int64) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.int64_t(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setUInt64(opt C.int, value uint64) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.uint64_t(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +// ZMQ_SNDHWM: Set high water mark for outbound messages +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc39 +func (soc *Socket) SetSndhwm(value int) error { + return soc.setInt(C.ZMQ_SNDHWM, value) +} + +// ZMQ_RCVHWM: Set high water mark for inbound messages +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc28 +func (soc *Socket) SetRcvhwm(value int) error { + return soc.setInt(C.ZMQ_RCVHWM, value) +} + +// ZMQ_AFFINITY: Set I/O thread affinity +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc3 +func (soc *Socket) SetAffinity(value uint64) error { + return soc.setUInt64(C.ZMQ_AFFINITY, value) +} + +// ZMQ_SUBSCRIBE: Establish message filter +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc41 +func (soc *Socket) SetSubscribe(filter string) error { + return soc.setString(C.ZMQ_SUBSCRIBE, filter) +} + +// ZMQ_UNSUBSCRIBE: Remove message filter +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc47 +func (soc *Socket) SetUnsubscribe(filter string) error { + return soc.setString(C.ZMQ_UNSUBSCRIBE, filter) +} + +// ZMQ_IDENTITY: Set socket identity +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc16 +func (soc *Socket) SetIdentity(value string) error { + return soc.setString(C.ZMQ_IDENTITY, value) +} + +// ZMQ_RATE: Set multicast data rate +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc26 +func (soc *Socket) SetRate(value int) error { + return soc.setInt(C.ZMQ_RATE, value) +} + +// ZMQ_RECOVERY_IVL: Set multicast recovery interval +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc32 +func (soc *Socket) SetRecoveryIvl(value time.Duration) error { + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_RECOVERY_IVL, val) +} + +// ZMQ_SNDBUF: Set kernel transmit buffer size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc38 +func (soc *Socket) SetSndbuf(value int) error { + return soc.setInt(C.ZMQ_SNDBUF, value) +} + +// ZMQ_RCVBUF: Set kernel receive buffer size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc27 +func (soc *Socket) SetRcvbuf(value int) error { + return soc.setInt(C.ZMQ_RCVBUF, value) +} + +// ZMQ_LINGER: Set linger period for socket shutdown +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc19 +func (soc *Socket) SetLinger(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_LINGER, val) +} + +// ZMQ_RECONNECT_IVL: Set reconnection interval +// +// For no reconnection, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc30 +func (soc *Socket) SetReconnectIvl(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_RECONNECT_IVL, val) +} + +// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc31 +func (soc *Socket) SetReconnectIvlMax(value time.Duration) error { + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_RECONNECT_IVL_MAX, val) +} + +// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc4 +func (soc *Socket) SetBacklog(value int) error { + return soc.setInt(C.ZMQ_BACKLOG, value) +} + +// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc20 +func (soc *Socket) SetMaxmsgsize(value int64) error { + return soc.setInt64(C.ZMQ_MAXMSGSIZE, value) +} + +// ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc21 +func (soc *Socket) SetMulticastHops(value int) error { + return soc.setInt(C.ZMQ_MULTICAST_HOPS, value) +} + +// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc29 +func (soc *Socket) SetRcvtimeo(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_RCVTIMEO, val) +} + +// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc40 +func (soc *Socket) SetSndtimeo(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_SNDTIMEO, val) +} + +// ZMQ_IPV6: Enable IPv6 on socket +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc18 +func (soc *Socket) SetIpv6(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_IPV6, val) +} + +// ZMQ_IMMEDIATE: Queue messages only to completed connections +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc17 +func (soc *Socket) SetImmediate(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_IMMEDIATE, val) +} + +// ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc36 +func (soc *Socket) SetRouterMandatory(value int) error { + return soc.setInt(C.ZMQ_ROUTER_MANDATORY, value) +} + +// ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode +// +// This option is deprecated since ZeroMQ version 4.1, please use ZMQ_STREAM sockets instead. +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc37 +func (soc *Socket) SetRouterRaw(value int) error { + return soc.setInt(C.ZMQ_ROUTER_RAW, value) +} + +// ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc25 +func (soc *Socket) SetProbeRouter(value int) error { + return soc.setInt(C.ZMQ_PROBE_ROUTER, value) +} + +// ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc48 +func (soc *Socket) SetXpubVerbose(value int) error { + return soc.setInt(C.ZMQ_XPUB_VERBOSE, value) +} + +// ZMQ_REQ_CORRELATE: match replies with requests +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc33 +func (soc *Socket) SetReqCorrelate(value int) error { + return soc.setInt(C.ZMQ_REQ_CORRELATE, value) +} + +// ZMQ_REQ_RELAXED: relax strict alternation between request and reply +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc34 +func (soc *Socket) SetReqRelaxed(value int) error { + return soc.setInt(C.ZMQ_REQ_RELAXED, value) +} + +// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc42 +func (soc *Socket) SetTcpKeepalive(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE, value) +} + +// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS) +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc44 +func (soc *Socket) SetTcpKeepaliveIdle(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_IDLE, value) +} + +// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc43 +func (soc *Socket) SetTcpKeepaliveCnt(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_CNT, value) +} + +// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc45 +func (soc *Socket) SetTcpKeepaliveIntvl(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_INTVL, value) +} + +// ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections +// +// This option is deprecated since ZeroMQ version 4.1, please use authentication via +// the ZAP API and IP address whitelisting / blacklisting. +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc50 +func (soc *Socket) SetTcpAcceptFilter(filter string) error { + if len(filter) == 0 { + return soc.setNullString(C.ZMQ_TCP_ACCEPT_FILTER) + } + return soc.setString(C.ZMQ_TCP_ACCEPT_FILTER, filter) +} + +// ZMQ_PLAIN_SERVER: Set PLAIN server role +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc23 +func (soc *Socket) SetPlainServer(value int) error { + return soc.setInt(C.ZMQ_PLAIN_SERVER, value) +} + +// ZMQ_PLAIN_USERNAME: Set PLAIN security username +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc24 +func (soc *Socket) SetPlainUsername(username string) error { + if len(username) == 0 { + return soc.setNullString(C.ZMQ_PLAIN_USERNAME) + } + return soc.setString(C.ZMQ_PLAIN_USERNAME, username) +} + +// ZMQ_PLAIN_PASSWORD: Set PLAIN security password +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc22 +func (soc *Socket) SetPlainPassword(password string) error { + if len(password) == 0 { + return soc.setNullString(C.ZMQ_PLAIN_PASSWORD) + } + return soc.setString(C.ZMQ_PLAIN_PASSWORD, password) +} + +// ZMQ_CURVE_SERVER: Set CURVE server role +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc9 +func (soc *Socket) SetCurveServer(value int) error { + return soc.setInt(C.ZMQ_CURVE_SERVER, value) +} + +// ZMQ_CURVE_PUBLICKEY: Set CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc7 +func (soc *Socket) SetCurvePublickey(key string) error { + return soc.setString(C.ZMQ_CURVE_PUBLICKEY, key) +} + +// ZMQ_CURVE_SECRETKEY: Set CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc8 +func (soc *Socket) SetCurveSecretkey(key string) error { + return soc.setString(C.ZMQ_CURVE_SECRETKEY, key) +} + +// ZMQ_CURVE_SERVERKEY: Set CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc10 +func (soc *Socket) SetCurveServerkey(key string) error { + return soc.setString(C.ZMQ_CURVE_SERVERKEY, key) +} + +// ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc49 +func (soc *Socket) SetZapDomain(domain string) error { + return soc.setString(C.ZMQ_ZAP_DOMAIN, domain) +} + +// ZMQ_CONFLATE: Keep only last message +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc6 +func (soc *Socket) SetConflate(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_CONFLATE, val) +} + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.1.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// D : deprecated +// implemented documented test +// ZMQ_ROUTER_HANDOVER + + +// ZMQ_TOS + + +// ZMQ_IPC_FILTER_PID D +// ZMQ_IPC_FILTER_UID D +// ZMQ_IPC_FILTER_GID D +// ZMQ_CONNECT_RID + + +// ZMQ_GSSAPI_SERVER + + +// ZMQ_GSSAPI_PRINCIPAL + + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL + + +// ZMQ_GSSAPI_PLAINTEXT + + +// ZMQ_HANDSHAKE_IVL + + +// ZMQ_SOCKS_PROXY + +// ZMQ_XPUB_NODROP + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc35 +func (soc *Socket) SetRouterHandover(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_ROUTER_HANDOVER, val) +} + +// ZMQ_TOS: Set the Type-of-Service on socket +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc46 +func (soc *Socket) SetTos(value int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setInt(C.ZMQ_TOS, value) +} + +// ZMQ_CONNECT_RID: Assign the next outbound connection id +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc5 +func (soc *Socket) SetConnectRid(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + if value == "" { + return soc.setNullString(C.ZMQ_CONNECT_RID) + } + return soc.setString(C.ZMQ_CONNECT_RID, value) +} + +// ZMQ_GSSAPI_SERVER: Set GSSAPI server role +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc13 +func (soc *Socket) SetGssapiServer(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_GSSAPI_SERVER, val) +} + +// ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc12 +func (soc *Socket) SetGssapiPrincipal(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setString(C.ZMQ_GSSAPI_PRINCIPAL, value) +} + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc14 +func (soc *Socket) SetGssapiServicePrincipal(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setString(C.ZMQ_GSSAPI_SERVICE_PRINCIPAL, value) +} + +// ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc11 +func (soc *Socket) SetGssapiPlaintext(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_GSSAPI_PLAINTEXT, val) +} + +// ZMQ_HANDSHAKE_IVL: Set maximum handshake interval +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc15 +func (soc *Socket) SetHandshakeIvl(value time.Duration) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HANDSHAKE_IVL, val) +} + +// ZMQ_SOCKS_PROXY: NOT DOCUMENTED +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +func (soc *Socket) SetSocksProxy(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + if value == "" { + return soc.setNullString(C.ZMQ_SOCKS_PROXY) + } + return soc.setString(C.ZMQ_SOCKS_PROXY, value) +} + +// Available since ZeroMQ 4.1, documented since ZeroMQ 4.2 + +// ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc60 +func (soc *Socket) SetXpubNodrop(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_XPUB_NODROP, val) +} + +//////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.2.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// o : getsockopt only +// implemented documented test +// ZMQ_BLOCKY +// ZMQ_XPUB_MANUAL + + +// ZMQ_XPUB_WELCOME_MSG + + +// ZMQ_STREAM_NOTIFY + + +// ZMQ_INVERT_MATCHING + + +// ZMQ_HEARTBEAT_IVL + + +// ZMQ_HEARTBEAT_TTL + + +// ZMQ_HEARTBEAT_TIMEOUT + + +// ZMQ_XPUB_VERBOSER + + +// ZMQ_CONNECT_TIMEOUT + + +// ZMQ_TCP_MAXRT + + +// ZMQ_THREAD_SAFE o +// ZMQ_MULTICAST_MAXTPDU + + +// ZMQ_VMCI_BUFFER_SIZE + + +// ZMQ_VMCI_BUFFER_MIN_SIZE + + +// ZMQ_VMCI_BUFFER_MAX_SIZE + + +// ZMQ_VMCI_CONNECT_TIMEOUT + + +// ZMQ_USE_FD + + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_XPUB_MANUAL: change the subscription handling to manual +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc59 +func (soc *Socket) SetXpubManual(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_XPUB_MANUAL, value) +} + +// ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by subscriber when connecting +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc61 +func (soc *Socket) SetXpubWelcomeMsg(value string) error { + if minor < 2 { + return ErrorNotImplemented42 + } + if value == "" { + return soc.setNullString(C.ZMQ_XPUB_WELCOME_MSG) + } + return soc.setString(C.ZMQ_XPUB_WELCOME_MSG, value) +} + +// ZMQ_STREAM_NOTIFY: send connect and disconnect notifications +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc48 +func (soc *Socket) SetStreamNotify(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_STREAM_NOTIFY, value) +} + +// ZMQ_INVERT_MATCHING: Invert message filtering +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc22 +func (soc *Socket) SetInvertMatching(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_INVERT_MATCHING, value) +} + +// ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc17 +func (soc *Socket) SetHeartbeatIvl(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_IVL, val) +} + +// ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc19 +func (soc *Socket) SetHeartbeatTtl(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_TTL, val) +} + +// ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc18 +func (soc *Socket) SetHeartbeatTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_TIMEOUT, val) +} + +// ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc58 +func (soc *Socket) SetXpubVerboser(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_XPUB_VERBOSER, value) +} + +// ZMQ_CONNECT_TIMEOUT: Set connect() timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc7 +func (soc *Socket) SetConnectTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_CONNECT_TIMEOUT, val) +} + +// ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc54 +func (soc *Socket) SetTcpMaxrt(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_TCP_MAXRT, val) +} + +// ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc27 +func (soc *Socket) SetMulticastMaxtpdu(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_MULTICAST_MAXTPDU, value) +} + +// ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc68 +func (soc *Socket) SetVmciBufferSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_SIZE, value) +} + +// ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc69 +func (soc *Socket) SetVmciBufferMinSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_MIN_SIZE, value) +} + +// ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc70 +func (soc *Socket) SetVmciBufferMaxSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_MAX_SIZE, value) +} + +// ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc71 +func (soc *Socket) SetVmciConnectTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_VMCI_CONNECT_TIMEOUT, val) +} + +// ZMQ_USE_FD: Set the pre-allocated socket file descriptor +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc31 +func (soc *Socket) SetUseFd(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_USE_FD, value) +} diff --git a/vendor/github.com/pebbe/zmq4/draft/utils.go b/vendor/github.com/pebbe/zmq4/draft/utils.go new file mode 100644 index 0000000..3a0fa45 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/utils.go @@ -0,0 +1,206 @@ +package zmq4 + +import ( + "fmt" +) + +/* +Send multi-part message on socket. + +Any `[]string' or `[][]byte' is split into separate `string's or `[]byte's + +Any other part that isn't a `string' or `[]byte' is converted +to `string' with `fmt.Sprintf("%v", part)'. + +Returns total bytes sent. +*/ +func (soc *Socket) SendMessage(parts ...interface{}) (total int, err error) { + return soc.sendMessage(0, parts...) +} + +/* +Like SendMessage(), but adding the DONTWAIT flag. +*/ +func (soc *Socket) SendMessageDontwait(parts ...interface{}) (total int, err error) { + return soc.sendMessage(DONTWAIT, parts...) +} + +func (soc *Socket) sendMessage(dontwait Flag, parts ...interface{}) (total int, err error) { + + var last int +PARTS: + for last = len(parts) - 1; last >= 0; last-- { + switch t := parts[last].(type) { + case []string: + if len(t) > 0 { + break PARTS + } + case [][]byte: + if len(t) > 0 { + break PARTS + } + default: + break PARTS + } + } + + opt := SNDMORE | dontwait + for i := 0; i <= last; i++ { + if i == last { + opt = dontwait + } + switch t := parts[i].(type) { + case []string: + opt = SNDMORE | dontwait + n := len(t) - 1 + for j, s := range t { + if j == n && i == last { + opt = dontwait + } + c, e := soc.Send(s, opt) + if e == nil { + total += c + } else { + return -1, e + } + } + case [][]byte: + opt = SNDMORE | dontwait + n := len(t) - 1 + for j, b := range t { + if j == n && i == last { + opt = dontwait + } + c, e := soc.SendBytes(b, opt) + if e == nil { + total += c + } else { + return -1, e + } + } + case string: + c, e := soc.Send(t, opt) + if e == nil { + total += c + } else { + return -1, e + } + case []byte: + c, e := soc.SendBytes(t, opt) + if e == nil { + total += c + } else { + return -1, e + } + default: + c, e := soc.Send(fmt.Sprintf("%v", t), opt) + if e == nil { + total += c + } else { + return -1, e + } + } + } + return +} + +/* +Receive parts as message from socket. + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessage(flags Flag) (msg []string, err error) { + msg = make([]string, 0) + for { + s, e := soc.Recv(flags) + if e == nil { + msg = append(msg, s) + } else { + return msg[0:0], e + } + more, e := soc.GetRcvmore() + if e == nil { + if !more { + break + } + } else { + return msg[0:0], e + } + } + return +} + +/* +Receive parts as message from socket. + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageBytes(flags Flag) (msg [][]byte, err error) { + msg = make([][]byte, 0) + for { + b, e := soc.RecvBytes(flags) + if e == nil { + msg = append(msg, b) + } else { + return msg[0:0], e + } + more, e := soc.GetRcvmore() + if e == nil { + if !more { + break + } + } else { + return msg[0:0], e + } + } + return +} + +/* +Receive parts as message from socket, including metadata. + +Metadata is picked from the first message part. + +For details about metadata, see RecvWithMetadata(). + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageWithMetadata(flags Flag, properties ...string) (msg []string, metadata map[string]string, err error) { + b, p, err := soc.RecvMessageBytesWithMetadata(flags, properties...) + m := make([]string, len(b)) + for i, bt := range b { + m[i] = string(bt) + } + return m, p, err +} + +/* +Receive parts as message from socket, including metadata. + +Metadata is picked from the first message part. + +For details about metadata, see RecvBytesWithMetadata(). + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageBytesWithMetadata(flags Flag, properties ...string) (msg [][]byte, metadata map[string]string, err error) { + bb := make([][]byte, 0) + b, p, err := soc.RecvBytesWithMetadata(flags, properties...) + if err != nil { + return bb, p, err + } + for { + bb = append(bb, b) + + var more bool + more, err = soc.GetRcvmore() + if err != nil || !more { + break + } + b, err = soc.RecvBytes(flags) + if err != nil { + break + } + } + return bb, p, err +} diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq4.go b/vendor/github.com/pebbe/zmq4/draft/zmq4.go new file mode 100644 index 0000000..bf8f53f --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq4.go @@ -0,0 +1,1455 @@ +package zmq4 + +/* +#cgo !windows pkg-config: libzmq +#cgo windows CFLAGS: -I/usr/local/include +#cgo windows LDFLAGS: -L/usr/local/lib -lzmq +#include +#if ZMQ_VERSION_MINOR < 2 +#include +#endif +#include +#include +#include "zmq4.h" +#include "zmq42draft.h" + +int + zmq4_major = ZMQ_VERSION_MAJOR, + zmq4_minor = ZMQ_VERSION_MINOR, + zmq4_patch = ZMQ_VERSION_PATCH; + +#if ZMQ_VERSION_MINOR > 0 +// Version >= 4.1.x + +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value; // value is either error code, fd or reconnect interval +} zmq_event_t; + +#else +// Version == 4.0.x + +const char *zmq_msg_gets (zmq_msg_t *msg, const char *property) { + return NULL; +} + +int zmq_has (const char *capability) { + return 0; +} + +#if ZMQ_VERSION_PATCH < 5 +// Version < 4.0.5 + +int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control) { + return -1; +} + +#endif // Version < 4.0.5 + +#endif // Version == 4.0.x + +void zmq4_get_event40(zmq_msg_t *msg, int *ev, int *val) { + zmq_event_t event; + const char* data = (char*)zmq_msg_data(msg); + memcpy(&(event.event), data, sizeof(event.event)); + memcpy(&(event.value), data+sizeof(event.event), sizeof(event.value)); + *ev = (int)(event.event); + *val = (int)(event.value); +} +void zmq4_get_event41(zmq_msg_t *msg, int *ev, int *val) { + uint8_t *data = (uint8_t *) zmq_msg_data (msg); + uint16_t event = *(uint16_t *) (data); + *ev = (int)event; + *val = (int)(*(uint32_t *) (data + 2)); +} +void *zmq4_memcpy(void *dest, const void *src, size_t n) { + return memcpy(dest, src, n); +} +*/ +import "C" + +import ( + "errors" + "fmt" + "runtime" + "strings" + "unsafe" +) + +var ( + defaultCtx *Context + + major, minor, patch int + + ErrorContextClosed = errors.New("Context is closed") + ErrorSocketClosed = errors.New("Socket is closed") + ErrorMoreExpected = errors.New("More expected") + ErrorNotImplemented405 = errors.New("Not implemented, requires 0MQ version 4.0.5") + ErrorNotImplemented41 = errors.New("Not implemented, requires 0MQ version 4.1") + ErrorNotImplemented42 = errors.New("Not implemented, requires 0MQ version 4.2") + ErrorNotImplemented42draft = errors.New("Not implemented, requires 0MQ version 4.2 with drafts enabled") + ErrorNotImplementedWindows = errors.New("Not implemented on Windows") + ErrorNoSocket = errors.New("No such socket") + + initVersionError error + initContextError error +) + +func init() { + major, minor, patch = Version() + if major != 4 { + initVersionError = fmt.Errorf("Using zmq4 with ZeroMQ major version %d", major) + return + } + if major != int(C.zmq4_major) || minor != int(C.zmq4_minor) || patch != int(C.zmq4_patch) { + initVersionError = + fmt.Errorf( + "zmq4 was installed with ZeroMQ version %d.%d.%d, but the application links with version %d.%d.%d", + int(C.zmq4_major), int(C.zmq4_minor), int(C.zmq4_patch), + major, minor, patch) + return + } + + var err error + defaultCtx = &Context{} + defaultCtx.ctx, err = C.zmq_ctx_new() + if defaultCtx.ctx == nil || err != nil { + initContextError = fmt.Errorf("Init of ZeroMQ context failed: %v", errget(err)) + return + } + defaultCtx.opened = true +} + +//. Util + +// Report 0MQ library version. +func Version() (major, minor, patch int) { + if initVersionError != nil { + return 0, 0, 0 + } + var maj, min, pat C.int + C.zmq_version(&maj, &min, &pat) + return int(maj), int(min), int(pat) +} + +// Get 0MQ error message string. +func Error(e int) string { + return C.GoString(C.zmq_strerror(C.int(e))) +} + +//. Context + +const ( + MaxSocketsDflt = int(C.ZMQ_MAX_SOCKETS_DFLT) + IoThreadsDflt = int(C.ZMQ_IO_THREADS_DFLT) +) + +/* +A context that is not the default context. +*/ +type Context struct { + ctx unsafe.Pointer + opened bool + err error +} + +// Create a new context. +func NewContext() (ctx *Context, err error) { + if initVersionError != nil { + return nil, initVersionError + } + ctx = &Context{} + c, e := C.zmq_ctx_new() + if c == nil { + err = errget(e) + ctx.err = err + } else { + ctx.ctx = c + ctx.opened = true + runtime.SetFinalizer(ctx, (*Context).Term) + } + return +} + +/* +Terminates the default context. + +For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term +*/ +func Term() error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.Term() +} + +/* +Terminates the context. + +For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term +*/ +func (ctx *Context) Term() error { + if ctx.opened { + ctx.opened = false + n, err := C.zmq_ctx_term(ctx.ctx) + if n != 0 { + ctx.err = errget(err) + } + } + return ctx.err +} + +func getOption(ctx *Context, o C.int) (int, error) { + if !ctx.opened { + return 0, ErrorContextClosed + } + nc, err := C.zmq_ctx_get(ctx.ctx, o) + n := int(nc) + if n < 0 { + return n, errget(err) + } + return n, nil +} + +// Returns the size of the 0MQ thread pool in the default context. +func GetIoThreads() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetIoThreads() +} + +// Returns the size of the 0MQ thread pool. +func (ctx *Context) GetIoThreads() (int, error) { + return getOption(ctx, C.ZMQ_IO_THREADS) +} + +// Returns the maximum number of sockets allowed in the default context. +func GetMaxSockets() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetMaxSockets() +} + +// Returns the maximum number of sockets allowed. +func (ctx *Context) GetMaxSockets() (int, error) { + return getOption(ctx, C.ZMQ_MAX_SOCKETS) +} + +/* +Returns the maximum message size in the default context. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func GetMaxMsgsz() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetMaxMsgsz() +} + +/* +Returns the maximum message size. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) GetMaxMsgsz() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return getOption(ctx, C.ZMQ_MAX_MSGSZ) +} + +// Returns the IPv6 option in the default context. +func GetIpv6() (bool, error) { + if initVersionError != nil { + return false, initVersionError + } + if initContextError != nil { + return false, initContextError + } + return defaultCtx.GetIpv6() +} + +// Returns the IPv6 option. +func (ctx *Context) GetIpv6() (bool, error) { + i, e := getOption(ctx, C.ZMQ_IPV6) + if i == 0 { + return false, e + } + return true, e +} + +/* +Returns the blocky setting in the default context. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func GetBlocky() (bool, error) { + if initVersionError != nil { + return false, initVersionError + } + if initContextError != nil { + return false, initContextError + } + return defaultCtx.GetBlocky() +} + +/* +Returns the blocky setting. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) GetBlocky() (bool, error) { + if minor < 2 { + return false, ErrorNotImplemented42 + } + i, e := getOption(ctx, C.ZMQ_BLOCKY) + if i == 0 { + return false, e + } + return true, e +} + +func setOption(ctx *Context, o C.int, n int) error { + if !ctx.opened { + return ErrorContextClosed + } + i, err := C.zmq_ctx_set(ctx.ctx, o, C.int(n)) + if int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Specifies the size of the 0MQ thread pool to handle I/O operations in +the default context. If your application is using only the inproc +transport for messaging you may set this to zero, otherwise set it to at +least one. This option only applies before creating any sockets. + +Default value: 1 +*/ +func SetIoThreads(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetIoThreads(n) +} + +/* +Specifies the size of the 0MQ thread pool to handle I/O operations. If +your application is using only the inproc transport for messaging you +may set this to zero, otherwise set it to at least one. This option only +applies before creating any sockets. + +Default value: 1 +*/ +func (ctx *Context) SetIoThreads(n int) error { + return setOption(ctx, C.ZMQ_IO_THREADS, n) +} + +/* +Sets the scheduling policy for default context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func SetThreadSchedPolicy(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetThreadSchedPolicy(n) +} + +/* +Sets scheduling priority for default context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func SetThreadPriority(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetThreadPriority(n) +} + +/* +Set maximum message size in the default context. + +Default value: INT_MAX + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func SetMaxMsgsz(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetMaxMsgsz(n) +} + +/* +Set maximum message size. + +Default value: INT_MAX + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) SetMaxMsgsz(n int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return setOption(ctx, C.ZMQ_MAX_MSGSZ, n) +} + +/* +Sets the maximum number of sockets allowed in the default context. + +Default value: 1024 +*/ +func SetMaxSockets(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetMaxSockets(n) +} + +/* +Sets the maximum number of sockets allowed. + +Default value: 1024 +*/ +func (ctx *Context) SetMaxSockets(n int) error { + return setOption(ctx, C.ZMQ_MAX_SOCKETS, n) +} + +/* +Sets the IPv6 value for all sockets created in the default context from this point onwards. +A value of true means IPv6 is enabled, while false means the socket will use only IPv4. +When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts. + +Default value: false +*/ +func SetIpv6(i bool) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetIpv6(i) +} + +/* +Sets the IPv6 value for all sockets created in the context from this point onwards. +A value of true means IPv6 is enabled, while false means the socket will use only IPv4. +When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts. + +Default value: false +*/ +func (ctx *Context) SetIpv6(i bool) error { + n := 0 + if i { + n = 1 + } + return setOption(ctx, C.ZMQ_IPV6, n) +} + +/* +Sets the blocky behavior in the default context. + +See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3 + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func SetBlocky(i bool) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetBlocky(i) +} + +/* +Sets the blocky behavior. + +See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3 + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) SetBlocky(i bool) error { + if minor < 2 { + return ErrorNotImplemented42 + } + n := 0 + if i { + n = 1 + } + return setOption(ctx, C.ZMQ_BLOCKY, n) +} + +//. Sockets + +// Specifies the type of a socket, used by NewSocket() +type Type int + +const ( + // Constants for NewSocket() + // See: http://api.zeromq.org/4-1:zmq-socket#toc3 + REQ = Type(C.ZMQ_REQ) + REP = Type(C.ZMQ_REP) + DEALER = Type(C.ZMQ_DEALER) + ROUTER = Type(C.ZMQ_ROUTER) + PUB = Type(C.ZMQ_PUB) + SUB = Type(C.ZMQ_SUB) + XPUB = Type(C.ZMQ_XPUB) + XSUB = Type(C.ZMQ_XSUB) + PUSH = Type(C.ZMQ_PUSH) + PULL = Type(C.ZMQ_PULL) + PAIR = Type(C.ZMQ_PAIR) + STREAM = Type(C.ZMQ_STREAM) + // DRAFT + SERVER = Type(C.ZMQ_SERVER) + CLIENT = Type(C.ZMQ_CLIENT) + RADIO = Type(C.ZMQ_RADIO) + DISH = Type(C.ZMQ_DISH) + GATHER = Type(C.ZMQ_GATHER) + SCATTER = Type(C.ZMQ_SCATTER) + DGRAM = Type(C.ZMQ_DGRAM) +) + +/* +Socket type as string. +*/ +func (t Type) String() string { + switch t { + case REQ: + return "REQ" + case REP: + return "REP" + case DEALER: + return "DEALER" + case ROUTER: + return "ROUTER" + case PUB: + return "PUB" + case SUB: + return "SUB" + case XPUB: + return "XPUB" + case XSUB: + return "XSUB" + case PUSH: + return "PUSH" + case PULL: + return "PULL" + case PAIR: + return "PAIR" + case STREAM: + return "STREAM" + // DRAFT + case SERVER: + return "SERVER" + case CLIENT: + return "CLIENT" + case RADIO: + return "RADIO" + case DISH: + return "DISH" + case GATHER: + return "GATHER" + case SCATTER: + return "SCATTER" + case DGRAM: + return "DGRAM" + } + return "" +} + +// Used by (*Socket)Send() and (*Socket)Recv() +type Flag int + +const ( + // Flags for (*Socket)Send(), (*Socket)Recv() + // For Send, see: http://api.zeromq.org/4-1:zmq-send#toc2 + // For Recv, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + DONTWAIT = Flag(C.ZMQ_DONTWAIT) + SNDMORE = Flag(C.ZMQ_SNDMORE) +) + +/* +Socket flag as string. +*/ +func (f Flag) String() string { + ff := make([]string, 0) + if f&DONTWAIT != 0 { + ff = append(ff, "DONTWAIT") + } + if f&SNDMORE != 0 { + ff = append(ff, "SNDMORE") + } + if len(ff) == 0 { + return "" + } + return strings.Join(ff, "|") +} + +// Used by (*Socket)Monitor() and (*Socket)RecvEvent() +type Event int + +const ( + // Flags for (*Socket)Monitor() and (*Socket)RecvEvent() + // See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3 + EVENT_ALL = Event(C.ZMQ_EVENT_ALL) + EVENT_CONNECTED = Event(C.ZMQ_EVENT_CONNECTED) + EVENT_CONNECT_DELAYED = Event(C.ZMQ_EVENT_CONNECT_DELAYED) + EVENT_CONNECT_RETRIED = Event(C.ZMQ_EVENT_CONNECT_RETRIED) + EVENT_LISTENING = Event(C.ZMQ_EVENT_LISTENING) + EVENT_BIND_FAILED = Event(C.ZMQ_EVENT_BIND_FAILED) + EVENT_ACCEPTED = Event(C.ZMQ_EVENT_ACCEPTED) + EVENT_ACCEPT_FAILED = Event(C.ZMQ_EVENT_ACCEPT_FAILED) + EVENT_CLOSED = Event(C.ZMQ_EVENT_CLOSED) + EVENT_CLOSE_FAILED = Event(C.ZMQ_EVENT_CLOSE_FAILED) + EVENT_DISCONNECTED = Event(C.ZMQ_EVENT_DISCONNECTED) + EVENT_MONITOR_STOPPED = Event(C.ZMQ_EVENT_MONITOR_STOPPED) +) + +/* +Socket event as string. +*/ +func (e Event) String() string { + if e == EVENT_ALL { + return "EVENT_ALL" + } + ee := make([]string, 0) + if e&EVENT_CONNECTED != 0 { + ee = append(ee, "EVENT_CONNECTED") + } + if e&EVENT_CONNECT_DELAYED != 0 { + ee = append(ee, "EVENT_CONNECT_DELAYED") + } + if e&EVENT_CONNECT_RETRIED != 0 { + ee = append(ee, "EVENT_CONNECT_RETRIED") + } + if e&EVENT_LISTENING != 0 { + ee = append(ee, "EVENT_LISTENING") + } + if e&EVENT_BIND_FAILED != 0 { + ee = append(ee, "EVENT_BIND_FAILED") + } + if e&EVENT_ACCEPTED != 0 { + ee = append(ee, "EVENT_ACCEPTED") + } + if e&EVENT_ACCEPT_FAILED != 0 { + ee = append(ee, "EVENT_ACCEPT_FAILED") + } + if e&EVENT_CLOSED != 0 { + ee = append(ee, "EVENT_CLOSED") + } + if e&EVENT_CLOSE_FAILED != 0 { + ee = append(ee, "EVENT_CLOSE_FAILED") + } + if e&EVENT_DISCONNECTED != 0 { + ee = append(ee, "EVENT_DISCONNECTED") + } + if len(ee) == 0 { + return "" + } + return strings.Join(ee, "|") +} + +// Used by (soc *Socket)GetEvents() +type State int + +const ( + // Flags for (*Socket)GetEvents() + // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc8 + POLLIN = State(C.ZMQ_POLLIN) + POLLOUT = State(C.ZMQ_POLLOUT) +) + +/* +Socket state as string. +*/ +func (s State) String() string { + ss := make([]string, 0) + if s&POLLIN != 0 { + ss = append(ss, "POLLIN") + } + if s&POLLOUT != 0 { + ss = append(ss, "POLLOUT") + } + if len(ss) == 0 { + return "" + } + return strings.Join(ss, "|") +} + +// Specifies the security mechanism, used by (*Socket)GetMechanism() +type Mechanism int + +const ( + // Constants for (*Socket)GetMechanism() + // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc22 + NULL = Mechanism(C.ZMQ_NULL) + PLAIN = Mechanism(C.ZMQ_PLAIN) + CURVE = Mechanism(C.ZMQ_CURVE) + GSSAPI = Mechanism(C.ZMQ_GSSAPI) +) + +/* +Security mechanism as string. +*/ +func (m Mechanism) String() string { + switch m { + case NULL: + return "NULL" + case PLAIN: + return "PLAIN" + case CURVE: + return "CURVE" + case GSSAPI: + return "GSSAPI" + } + return "" +} + +/* +Socket functions starting with `Set` or `Get` are used for setting and +getting socket options. +*/ +type Socket struct { + soc unsafe.Pointer + ctx *Context + opened bool + err error +} + +/* +Socket as string. +*/ +func (soc Socket) String() string { + if !soc.opened { + return "Socket(CLOSED)" + } + t, err := soc.GetType() + if err != nil { + return fmt.Sprintf("Socket(%v)", err) + } + i, err := soc.GetIdentity() + if err == nil && i != "" { + return fmt.Sprintf("Socket(%v,%q)", t, i) + } + return fmt.Sprintf("Socket(%v,%p)", t, soc.soc) +} + +/* +Create 0MQ socket in the default context. + +WARNING: +The Socket is not thread safe. This means that you cannot access the same Socket +from different goroutines without using something like a mutex. + +For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3 +*/ +func NewSocket(t Type) (soc *Socket, err error) { + if initVersionError != nil { + return nil, initVersionError + } + if initContextError != nil { + return nil, initContextError + } + return defaultCtx.NewSocket(t) +} + +/* +Create 0MQ socket in the given context. + +WARNING: +The Socket is not thread safe. This means that you cannot access the same Socket +from different goroutines without using something like a mutex. + +For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3 +*/ +func (ctx *Context) NewSocket(t Type) (soc *Socket, err error) { + soc = &Socket{} + if !ctx.opened { + return soc, ErrorContextClosed + } + if t < 0 { + return soc, ErrorNotImplemented42draft + } + s, e := C.zmq_socket(ctx.ctx, C.int(t)) + if s == nil { + err = errget(e) + soc.err = err + } else { + soc.soc = s + soc.ctx = ctx + soc.opened = true + runtime.SetFinalizer(soc, (*Socket).Close) + } + return +} + +// If not called explicitly, the socket will be closed on garbage collection +func (soc *Socket) Close() error { + if soc.opened { + soc.opened = false + if i, err := C.zmq_close(soc.soc); int(i) != 0 { + soc.err = errget(err) + } + soc.soc = unsafe.Pointer(nil) + soc.ctx = nil + } + return soc.err +} + +// Return the context associated with a socket +func (soc *Socket) Context() (*Context, error) { + if !soc.opened { + return nil, ErrorSocketClosed + } + return soc.ctx, nil +} + +/* +Accept incoming connections on a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-bind#toc2 +*/ +func (soc *Socket) Bind(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_bind(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Stop accepting connections on a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-bind#toc2 +*/ +func (soc *Socket) Unbind(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_unbind(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Create outgoing connection from socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-connect#toc2 +*/ +func (soc *Socket) Connect(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_connect(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Disconnect a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-disconnect#toc2 +*/ +func (soc *Socket) Disconnect(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_disconnect(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Receive a message part from a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 +*/ +func (soc *Socket) Recv(flags Flag) (string, error) { + b, _, err := soc.RecvBytesWithOpts(flags) + return string(b), err +} + +/* +Receive a message part from a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 +*/ +func (soc *Socket) RecvBytes(flags Flag) ([]byte, error) { + b, _, err := soc.RecvBytesWithOpts(flags) + return b, err +} + +/* +Receive a message part from a socket, including message options. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +Valid options are + + - OptRoutingId(0) + - OptGroup("") + +*/ +func (soc *Socket) RecvWithOpts(flags Flag, options ...interface{}) (string, []interface{}, error) { + b, o, err := soc.RecvBytesWithOpts(flags, options...) + return string(b), o, err +} + +/* +Receive a message part from a socket, including message options. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +Valid options are + + - OptRoutingId(0) + - OptGroup("") + +*/ +func (soc *Socket) RecvBytesWithOpts(flags Flag, options ...interface{}) ([]byte, []interface{}, error) { + opts := make([]interface{}, len(options)) + + if !soc.opened { + return []byte{}, opts, ErrorSocketClosed + } + var msg C.zmq_msg_t + if i, err := C.zmq_msg_init(&msg); i != 0 { + return []byte{}, opts, errget(err) + } + defer C.zmq_msg_close(&msg) + + size, err := C.zmq_msg_recv(&msg, soc.soc, C.int(flags)) + if size < 0 { + return []byte{}, opts, errget(err) + } + if size == 0 { + return []byte{}, opts, nil + } + data := make([]byte, int(size)) + C.zmq4_memcpy(unsafe.Pointer(&data[0]), C.zmq_msg_data(&msg), C.size_t(size)) + + for i, option := range options { + switch option.(type) { + case OptRoutingId: + if !has42draft { + return []byte{}, opts, ErrorNotImplemented42draft + } + opts[i] = OptRoutingId(uint32(C.zmq_msg_routing_id(&msg))) + case OptGroup: + if !has42draft { + return []byte{}, opts, ErrorNotImplemented42draft + } + opts[i] = OptGroup(C.GoString(C.zmq_msg_group(&msg))) + default: + return []byte{}, opts, ErrorNotImplemented42 + } + } + + return data, opts, nil +} + +/* +Send a message part on a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2 +*/ +func (soc *Socket) Send(data string, flags Flag, options ...interface{}) (int, error) { + return soc.SendBytes([]byte(data), flags, options...) +} + +/* +Send a message part on a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2 +*/ +func (soc *Socket) SendBytes(data []byte, flags Flag, options ...interface{}) (int, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + if len(options) == 0 { + d := data + if len(data) == 0 { + d = []byte{0} + } + size, err := C.zmq_send(soc.soc, unsafe.Pointer(&d[0]), C.size_t(len(data)), C.int(flags)) + if size < 0 { + return int(size), errget(err) + } + return int(size), nil + } + if !has42draft { + return 0, ErrorNotImplemented42draft + } + + var msg C.zmq_msg_t + rc, err := C.zmq_msg_init_size(&msg, C.size_t(len(data))) + if rc != 0 { + return int(rc), errget(err) + } + defer C.zmq_msg_close(&msg) + + C.zmq4_memcpy(C.zmq_msg_data(&msg), unsafe.Pointer(&data[0]), C.size_t(len(data))) + + for _, option := range options { + switch t := option.(type) { + case OptRoutingId: + id := C.uint32_t(uint32(t)) + rc, err := C.zmq_msg_set_routing_id(&msg, id) + if rc != 0 { + return int(rc), errget(err) + } + case OptGroup: + s := C.CString(string(t)) + rc, err := C.zmq_msg_set_group(&msg, s) + C.free(unsafe.Pointer(s)) + if rc != 0 { + return int(rc), errget(err) + } + default: + return 0, fmt.Errorf("Invalid message option: %#v", option) + } + } + + size, err := C.zmq_msg_send(&msg, soc.soc, C.int(flags)) + if size < 0 { + return int(size), errget(err) + } + return int(size), nil +} + +/* +Register a monitoring callback. + +See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc2 + +WARNING: Closing a context with a monitoring callback will lead to random crashes. +This is a bug in the ZeroMQ library. +The monitoring callback has the same context as the socket it was created for. + +Example: + + package main + + import ( + zmq "github.com/pebbe/zmq4" + "log" + "time" + ) + + func rep_socket_monitor(addr string) { + s, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + log.Fatalln(err) + } + err = s.Connect(addr) + if err != nil { + log.Fatalln(err) + } + for { + a, b, c, err := s.RecvEvent(0) + if err != nil { + log.Println(err) + break + } + log.Println(a, b, c) + } + s.Close() + } + + func main() { + + // REP socket + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + log.Fatalln(err) + } + + // REP socket monitor, all events + err = rep.Monitor("inproc://monitor.rep", zmq.EVENT_ALL) + if err != nil { + log.Fatalln(err) + } + go rep_socket_monitor("inproc://monitor.rep") + + // Generate an event + rep.Bind("tcp://*:5555") + if err != nil { + log.Fatalln(err) + } + + // Allow some time for event detection + time.Sleep(time.Second) + + rep.Close() + zmq.Term() + } +*/ +func (soc *Socket) Monitor(addr string, events Event) error { + if !soc.opened { + return ErrorSocketClosed + } + if addr == "" { + if i, err := C.zmq_socket_monitor(soc.soc, nil, C.int(events)); i != 0 { + return errget(err) + } + return nil + } + + s := C.CString(addr) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_socket_monitor(soc.soc, s, C.int(events)); i != 0 { + return errget(err) + } + return nil +} + +/* +Receive a message part from a socket interpreted as an event. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of event_type, see: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3 + +For an example, see: func (*Socket) Monitor +*/ +func (soc *Socket) RecvEvent(flags Flag) (event_type Event, addr string, value int, err error) { + if !soc.opened { + return EVENT_ALL, "", 0, ErrorSocketClosed + } + var msg C.zmq_msg_t + if i, e := C.zmq_msg_init(&msg); i != 0 { + err = errget(e) + return + } + defer C.zmq_msg_close(&msg) + size, e := C.zmq_msg_recv(&msg, soc.soc, C.int(flags)) + if size < 0 { + err = errget(e) + return + } + et := C.int(0) + val := C.int(0) + + if minor == 0 { + C.zmq4_get_event40(&msg, &et, &val) + } else { + C.zmq4_get_event41(&msg, &et, &val) + } + more, e := soc.GetRcvmore() + if e != nil { + err = errget(e) + return + } + if !more { + err = ErrorMoreExpected + return + } + addr, e = soc.Recv(flags) + if e != nil { + err = errget(e) + return + } + + event_type = Event(et) + value = int(val) + + return +} + +/* +Start built-in ØMQ proxy + +See: http://api.zeromq.org/4-1:zmq-proxy#toc2 +*/ +func Proxy(frontend, backend, capture *Socket) error { + if !(frontend.opened && backend.opened && (capture == nil || capture.opened)) { + return ErrorSocketClosed + } + var capt unsafe.Pointer + if capture != nil { + capt = capture.soc + } + _, err := C.zmq_proxy(frontend.soc, backend.soc, capt) + return errget(err) +} + +/* +Start built-in ØMQ proxy with PAUSE/RESUME/TERMINATE control flow + +Returns ErrorNotImplemented405 with ZeroMQ version < 4.0.5 + +See: http://api.zeromq.org/4-1:zmq-proxy-steerable#toc2 +*/ +func ProxySteerable(frontend, backend, capture, control *Socket) error { + if minor == 0 && patch < 5 { + return ErrorNotImplemented405 + } + if !(frontend.opened && backend.opened && (capture == nil || capture.opened) && (control == nil || control.opened)) { + return ErrorSocketClosed + } + var capt, ctrl unsafe.Pointer + if capture != nil { + capt = capture.soc + } + if control != nil { + ctrl = control.soc + } + i, err := C.zmq_proxy_steerable(frontend.soc, backend.soc, capt, ctrl) + if i < 0 { + return errget(err) + } + return nil +} + +//. CURVE + +/* +Encode a binary key as Z85 printable text + +See: http://api.zeromq.org/4-1:zmq-z85-encode +*/ +func Z85encode(data string) string { + if initVersionError != nil { + return initVersionError.Error() + } + l1 := len(data) + if l1%4 != 0 { + panic("Z85encode: Length of data not a multiple of 4") + } + d := []byte(data) + + l2 := 5 * l1 / 4 + dest := make([]byte, l2+1) + + C.zmq_z85_encode((*C.char)(unsafe.Pointer(&dest[0])), (*C.uint8_t)(&d[0]), C.size_t(l1)) + + return string(dest[:l2]) +} + +/* +Decode a binary key from Z85 printable text + +See: http://api.zeromq.org/4-1:zmq-z85-decode +*/ +func Z85decode(s string) string { + if initVersionError != nil { + return initVersionError.Error() + } + l1 := len(s) + if l1%5 != 0 { + panic("Z85decode: Length of Z85 string not a multiple of 5") + } + l2 := 4 * l1 / 5 + dest := make([]byte, l2) + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + C.zmq_z85_decode((*C.uint8_t)(&dest[0]), cs) + return string(dest) +} + +/* +Generate a new CURVE keypair + +See: http://api.zeromq.org/4-1:zmq-curve-keypair#toc2 +*/ +func NewCurveKeypair() (z85_public_key, z85_secret_key string, err error) { + if initVersionError != nil { + return "", "", initVersionError + } + var pubkey, seckey [41]byte + if i, err := C.zmq_curve_keypair((*C.char)(unsafe.Pointer(&pubkey[0])), (*C.char)(unsafe.Pointer(&seckey[0]))); i != 0 { + return "", "", errget(err) + } + return string(pubkey[:40]), string(seckey[:40]), nil +} + +/* +Receive a message part with metadata. + +This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata. + +The returned metadata map contains only those properties that exist on the message. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3 +*/ +func (soc *Socket) RecvWithMetadata(flags Flag, properties ...string) (msg string, metadata map[string]string, err error) { + b, p, err := soc.RecvBytesWithMetadata(flags, properties...) + return string(b), p, err +} + +/* +Receive a message part with metadata. + +This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata. + +The returned metadata map contains only those properties that exist on the message. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3 +*/ +func (soc *Socket) RecvBytesWithMetadata(flags Flag, properties ...string) (msg []byte, metadata map[string]string, err error) { + if !soc.opened { + return []byte{}, map[string]string{}, ErrorSocketClosed + } + + metadata = make(map[string]string) + + var m C.zmq_msg_t + if i, err := C.zmq_msg_init(&m); i != 0 { + return []byte{}, metadata, errget(err) + } + defer C.zmq_msg_close(&m) + + size, err := C.zmq_msg_recv(&m, soc.soc, C.int(flags)) + if size < 0 { + return []byte{}, metadata, errget(err) + } + + data := make([]byte, int(size)) + if size > 0 { + C.zmq4_memcpy(unsafe.Pointer(&data[0]), C.zmq_msg_data(&m), C.size_t(size)) + } + + if minor > 0 { + for _, p := range properties { + ps := C.CString(p) + s, err := C.zmq_msg_gets(&m, ps) + if err == nil { + metadata[p] = C.GoString(s) + } + C.free(unsafe.Pointer(ps)) + } + } + return data, metadata, nil +} + +func hasCap(s string) (value bool) { + if initVersionError != nil { + return false + } + if minor < 1 { + return false + } + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + return C.zmq_has(cs) != 0 +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the ipc:// protocol +func HasIpc() bool { + return hasCap("ipc") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the pgm:// protocol +func HasPgm() bool { + return hasCap("pgm") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the tipc:// protocol +func HasTipc() bool { + return hasCap("tipc") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the norm:// protocol +func HasNorm() bool { + return hasCap("norm") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the CURVE security mechanism +func HasCurve() bool { + return hasCap("curve") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the GSSAPI security mechanism +func HasGssapi() bool { + return hasCap("gssapi") +} diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq4.h b/vendor/github.com/pebbe/zmq4/draft/zmq4.h new file mode 100644 index 0000000..ef4b523 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq4.h @@ -0,0 +1,55 @@ +#if ZMQ_VERSION_MAJOR != 4 + +#error "You need ZeroMQ version 4 to build this" + +#endif + +#if ZMQ_VERSION_MINOR < 1 + +#define ZMQ_CONNECT_RID -1 +#define ZMQ_GSSAPI -1 +#define ZMQ_GSSAPI_PLAINTEXT -1 +#define ZMQ_GSSAPI_PRINCIPAL -1 +#define ZMQ_GSSAPI_SERVER -1 +#define ZMQ_GSSAPI_SERVICE_PRINCIPAL -1 +#define ZMQ_HANDSHAKE_IVL -1 +#define ZMQ_IPC_FILTER_GID -1 +#define ZMQ_IPC_FILTER_PID -1 +#define ZMQ_IPC_FILTER_UID -1 +#define ZMQ_ROUTER_HANDOVER -1 +#define ZMQ_SOCKS_PROXY -1 +#define ZMQ_THREAD_PRIORITY -1 +#define ZMQ_THREAD_SCHED_POLICY -1 +#define ZMQ_TOS -1 +#define ZMQ_XPUB_NODROP -1 + +#endif + +#if ZMQ_VERSION_MINOR < 2 + +#define ZMQ_MAX_MSGSZ -1 + +#define ZMQ_BLOCKY -1 +#define ZMQ_XPUB_MANUAL -1 +#define ZMQ_XPUB_WELCOME_MSG -1 +#define ZMQ_STREAM_NOTIFY -1 +#define ZMQ_INVERT_MATCHING -1 +#define ZMQ_HEARTBEAT_IVL -1 +#define ZMQ_HEARTBEAT_TTL -1 +#define ZMQ_HEARTBEAT_TIMEOUT -1 +#define ZMQ_XPUB_VERBOSER -1 +#define ZMQ_CONNECT_TIMEOUT -1 +#define ZMQ_TCP_MAXRT -1 +#define ZMQ_THREAD_SAFE -1 +#define ZMQ_MULTICAST_MAXTPDU -1 +#define ZMQ_VMCI_BUFFER_SIZE -1 +#define ZMQ_VMCI_BUFFER_MIN_SIZE -1 +#define ZMQ_VMCI_BUFFER_MAX_SIZE -1 +#define ZMQ_VMCI_CONNECT_TIMEOUT -1 +#define ZMQ_USE_FD -1 + +#define ZMQ_GROUP_MAX_LENGTH -1 + +#define ZMQ_POLLPRI -1 + +#endif diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq41_test.go b/vendor/github.com/pebbe/zmq4/draft/zmq41_test.go new file mode 100644 index 0000000..a1d6f8b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq41_test.go @@ -0,0 +1,74 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4/draft" + + "testing" +) + +func TestRemoteEndpoint(t *testing.T) { + + if _, minor, _ := zmq.Version(); minor < 1 { + t.Skip("RemoteEndpoint not avalable in ZeroMQ versions prior to 4.1.0") + } + + addr := "tcp://127.0.0.1:9560" + peer := "127.0.0.1" + + var rep, req *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{rep, req} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + req, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + + if err = rep.Bind(addr); err != nil { + t.Fatal("rep.Bind:", err) + } + if err = req.Connect(addr); err != nil { + t.Fatal("req.Connect:", err) + } + + tmp := "test" + if _, err = req.Send(tmp, 0); err != nil { + t.Fatal("req.Send:", err) + } + + // get message with peer address (remote endpoint) + msg, props, err := rep.RecvWithMetadata(0, "Peer-Address") + if err != nil { + t.Fatal("rep.RecvWithMetadata:", err) + return + } + if msg != tmp { + t.Errorf("rep.RecvWithMetadata: expected %q, got %q", tmp, msg) + } + + if p := props["Peer-Address"]; p != peer { + t.Errorf("rep.RecvWithMetadata: expected Peer-Address == %q, got %q", peer, p) + } + + err = rep.Close() + rep = nil + if err != nil { + t.Fatal("rep.Close:", err) + } + + err = req.Close() + req = nil + if err != nil { + t.Fatal("req.Close:", err) + } +} diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq42draft.go b/vendor/github.com/pebbe/zmq4/draft/zmq42draft.go new file mode 100644 index 0000000..53e867c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq42draft.go @@ -0,0 +1,67 @@ +package zmq4 + +/* +#include +#include +#include +#include "zmq4.h" +#include "zmq42draft.h" + +#ifdef ZMQ42HASDRAFT +int zmq4has42draft = 1; +#else +int zmq4has42draft = 0; +// Version >= 4.2.0 with draft + +int zmq_join (void *s, const char *group) { return 0; } +int zmq_leave (void *s, const char *group) { return 0; } +int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id) { return 0; } +uint32_t zmq_msg_routing_id(zmq_msg_t *msg) { return 0; } +int zmq_msg_set_group(zmq_msg_t *msg, const char *group) { return 0; } +const char *zmq_msg_group(zmq_msg_t *msg) { return NULL; } + +#endif // ZMQ42HASDRAFT + +*/ +import "C" + +import ( + "unsafe" +) + +type OptRoutingId uint32 +type OptGroup string + +var ( + has42draft bool +) + +func init() { + has42draft = (C.zmq4has42draft != 0) +} + +func (soc *Socket) Join(group string) error { + if !has42draft { + return ErrorNotImplemented42draft + } + cs := C.CString(group) + defer C.free(unsafe.Pointer(cs)) + n, err := C.zmq_join(soc.soc, cs) + if n != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) Leave(group string) error { + if !has42draft { + return ErrorNotImplemented42draft + } + cs := C.CString(group) + defer C.free(unsafe.Pointer(cs)) + n, err := C.zmq_leave(soc.soc, cs) + if n != 0 { + return errget(err) + } + return nil +} diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq42draft.h b/vendor/github.com/pebbe/zmq4/draft/zmq42draft.h new file mode 100644 index 0000000..ad35fd2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq42draft.h @@ -0,0 +1,15 @@ +#if ZMQ_VERSION_MINOR == 2 +#ifdef ZMQ_BUILD_DRAFT_API +#define ZMQ42HASDRAFT +#endif +#endif + +#ifndef ZMQ42HASDRAFT +#define ZMQ_SERVER -12 +#define ZMQ_CLIENT -13 +#define ZMQ_RADIO -14 +#define ZMQ_DISH -15 +#define ZMQ_GATHER -16 +#define ZMQ_SCATTER -17 +#define ZMQ_DGRAM -18 +#endif diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq42draft_test.go b/vendor/github.com/pebbe/zmq4/draft/zmq42draft_test.go new file mode 100644 index 0000000..138efc4 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq42draft_test.go @@ -0,0 +1,152 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4/draft" + + "testing" + "time" +) + +func TestUdp(t *testing.T) { + + if _, minor, _ := zmq.Version(); minor < 2 { + t.Skip("Sockets RADIO and DISH need ZeroMQ 4.2 with draft enabled") + } + + ctx, err := zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + defer ctx.Term() + + radio, err := ctx.NewSocket(zmq.RADIO) + if err != nil { + t.Fatal("NewSocket RADIO:", err) + } + defer radio.Close() + dish, err := ctx.NewSocket(zmq.DISH) + if err != nil { + t.Fatal("NewSocket DISH:", err) + } + defer dish.Close() + + // Connecting dish should fail + err = dish.Connect("udp://127.0.0.1:5556") + if err == nil { + t.Fatal("Expected fail on dish.Connect") + } + + err = dish.Bind("udp://*:5556") + if err != nil { + t.Fatal("dish.Bind:", err) + } + + // Bind radio should fail + err = radio.Bind("udp://*:5556") + if err == nil { + t.Fatal("Expected fail on radio.Bind") + } + + err = radio.Connect("udp://127.0.0.1:5556") + if err != nil { + t.Fatal("radio.Connect:", err) + } + + time.Sleep(300 * time.Millisecond) + + err = dish.Join("TV") + if err != nil { + t.Fatal("dish.Join:", err) + } + + _, err = radio.Send("Friends", 0, zmq.OptGroup("TV")) + if err != nil { + t.Fatal("radio.SendMessage:", err) + } + + msg, opt, err := dish.RecvWithOpts(0, zmq.OptGroup("")) + if err != nil { + t.Fatal("dish.RecvWithOpt:", err) + } + if len(opt) != 1 { + t.Fatal("dish.RecvWithOpt: wrong number off options") + } + if string(opt[0].(zmq.OptGroup)) != "TV" { + t.Fatal("dish.RecvWithOpt: wrong group: %v", string(opt[0].(zmq.OptGroup))) + } + if msg != "Friends" { + t.Fatal("dish.RecvWithOpt: wrong message: %q", msg) + } +} + +func TestClientServer(t *testing.T) { + + if _, minor, _ := zmq.Version(); minor < 2 { + t.Skip("Sockets CLIENT and SERVER need ZeroMQ 4.2 with draft enabled") + } + + ctx, err := zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + defer ctx.Term() + + server, err := ctx.NewSocket(zmq.SERVER) + if err != nil { + t.Fatal("NewSocket SERVER:", err) + } + defer server.Close() + client, err := ctx.NewSocket(zmq.CLIENT) + if err != nil { + t.Fatal("NewSocket CLIENT:", err) + } + defer client.Close() + + addr := "tcp://127.0.0.1:9797" + err = server.Bind(addr) + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect(addr) + if err != nil { + t.Fatal("client.Connect:", err) + } + + content := "12345678ABCDEFGH12345678abcdefgh" + rc, err := client.Send(content, zmq.DONTWAIT) + if err != nil { + t.Fatal("client.Send DONTWAIT: ", err) + } + if rc != 32 { + t.Fatal("client.Send DONTWAIT: ", err32) + } + + msg, opts, err := server.RecvWithOpts(0, zmq.OptRoutingId(0)) + if err != nil { + t.Fatal("server.Recv: ", err) + } + // Check that message is still the same + if msg != content { + t.Fatal("server.Recv: %q != %q", msg, content) + } + + rc, err = server.Send(content, 0, opts[0]) + if err != nil { + t.Fatal("server.Send:", err) + } + if rc != 32 { + t.Fatal("server.Send: ", err32) + } + + // Receive message at client side + msg, err = client.Recv(0) + if err != nil { + t.Fatal("client.Recv: ", err) + } + + // Check that message is still the same + if msg != content { + t.Fatalf("client.Recv: %q != %q", msg, content) + } + +} diff --git a/vendor/github.com/pebbe/zmq4/draft/zmq4_test.go b/vendor/github.com/pebbe/zmq4/draft/zmq4_test.go new file mode 100644 index 0000000..b1e706e --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/draft/zmq4_test.go @@ -0,0 +1,2044 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4/draft" + + "errors" + "fmt" + "runtime" + "strconv" + "testing" + "time" +) + +var ( + err32 = errors.New("rc != 32") +) + +func TestVersion(t *testing.T) { + major, _, _ := zmq.Version() + if major != 4 { + t.Errorf("Expected major version 4, got %d", major) + } +} + +func TestMultipleContexts(t *testing.T) { + + chQuit := make(chan interface{}) + chErr := make(chan error, 2) + needQuit := false + var sock1, sock2, serv1, serv2 *zmq.Socket + var serv_ctx1, serv_ctx2, ctx1, ctx2 *zmq.Context + var err error + + defer func() { + if needQuit { + chQuit <- true + chQuit <- true + <-chErr + <-chErr + } + for _, s := range []*zmq.Socket{sock1, sock2, serv1, serv2} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + for _, c := range []*zmq.Context{serv_ctx1, serv_ctx2, ctx1, ctx2} { + if c != nil { + c.Term() + } + } + }() + + addr1 := "tcp://127.0.0.1:9997" + addr2 := "tcp://127.0.0.1:9998" + + serv_ctx1, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + serv1, err = serv_ctx1.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = serv1.Bind(addr1) + if err != nil { + t.Fatal("Bind:", err) + } + + serv_ctx2, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + serv2, err = serv_ctx2.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = serv2.Bind(addr2) + if err != nil { + t.Fatal("Bind:", err) + } + + new_service := func(sock *zmq.Socket, addr string) { + socket_handler := func(state zmq.State) error { + msg, err := sock.RecvMessage(0) + if err != nil { + return err + } + _, err = sock.SendMessage(addr, msg) + return err + } + quit_handler := func(interface{}) error { + return errors.New("quit") + } + + reactor := zmq.NewReactor() + reactor.AddSocket(sock, zmq.POLLIN, socket_handler) + reactor.AddChannel(chQuit, 1, quit_handler) + err = reactor.Run(100 * time.Millisecond) + chErr <- err + } + + go new_service(serv1, addr1) + go new_service(serv2, addr2) + needQuit = true + + time.Sleep(time.Second) + + // default context + + sock1, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + sock2, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = sock1.Connect(addr1) + if err != nil { + t.Fatal("sock1.Connect:", err) + } + err = sock2.Connect(addr2) + if err != nil { + t.Fatal("sock2.Connect:", err) + } + _, err = sock1.SendMessage(addr1) + if err != nil { + t.Fatal("sock1.SendMessage:", err) + } + _, err = sock2.SendMessage(addr2) + if err != nil { + t.Fatal("sock2.SendMessage:", err) + } + msg, err := sock1.RecvMessage(0) + expected := []string{addr1, addr1} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock1.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + msg, err = sock2.RecvMessage(0) + expected = []string{addr2, addr2} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock2.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + err = sock1.Close() + sock1 = nil + if err != nil { + t.Fatal("sock1.Close:", err) + } + err = sock2.Close() + sock2 = nil + if err != nil { + t.Fatal("sock2.Close:", err) + } + + // non-default contexts + + ctx1, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + ctx2, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + sock1, err = ctx1.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("ctx1.NewSocket:", err) + } + sock2, err = ctx2.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("ctx2.NewSocket:", err) + } + err = sock1.Connect(addr1) + if err != nil { + t.Fatal("sock1.Connect:", err) + } + err = sock2.Connect(addr2) + if err != nil { + t.Fatal("sock2.Connect:", err) + } + _, err = sock1.SendMessage(addr1) + if err != nil { + t.Fatal("sock1.SendMessage:", err) + } + _, err = sock2.SendMessage(addr2) + if err != nil { + t.Fatal("sock2.SendMessage:", err) + } + msg, err = sock1.RecvMessage(0) + expected = []string{addr1, addr1} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock1.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + msg, err = sock2.RecvMessage(0) + expected = []string{addr2, addr2} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock2.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + err = sock1.Close() + sock1 = nil + if err != nil { + t.Fatal("sock1.Close:", err) + } + err = sock2.Close() + sock2 = nil + if err != nil { + t.Fatal("sock2.Close:", err) + } + + err = ctx1.Term() + ctx1 = nil + if err != nil { + t.Fatal("ctx1.Term", nil) + } + err = ctx2.Term() + ctx1 = nil + if err != nil { + t.Fatal("ctx2.Term", nil) + } + + needQuit = false + for i := 0; i < 2; i++ { + // close(chQuit) doesn't work because the reactor removes closed channels, instead of acting on them + chQuit <- true + err = <-chErr + if err.Error() != "quit" { + t.Errorf("Expected error value quit, got %v", err) + } + } +} + +func TestAbstractIpc(t *testing.T) { + + var sb, sc *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + addr := "ipc://@/tmp/tester" + + // This is Linux only + if runtime.GOOS != "linux" { + t.Skip("Only on Linux") + } + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind(addr) + if err != nil { + t.Fatal("sb.Bind:", err) + } + + endpoint, err := sb.GetLastEndpoint() + expected := "ipc://@/tmp/tester" + if endpoint != expected || err != nil { + t.Fatalf("sb.GetLastEndpoint: expected 'nil' %q, got '%v' %q", expected, err, endpoint) + return + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = sc.Connect(addr) + if err != nil { + t.Fatal("sc.Bind:", err) + } + + resp, err := bounce(sb, sc) + if err != nil { + t.Error(resp, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Fatal("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Fatal("sb.Close:", err) + } +} + +func TestConflate(t *testing.T) { + + var s_in, s_out *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{s_in, s_out} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + bind_to := "tcp://127.0.0.1:5555" + + err := zmq.SetIoThreads(1) + if err != nil { + t.Fatal("SetIoThreads(1):", err) + } + + s_in, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Fatal("NewSocket 1:", err) + } + + err = s_in.SetConflate(true) + if err != nil { + t.Fatal("SetConflate(true):", err) + } + + err = s_in.Bind(bind_to) + if err != nil { + t.Fatal("s_in.Bind:", err) + } + + s_out, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Fatal("NewSocket 2:", err) + } + + err = s_out.Connect(bind_to) + if err != nil { + t.Fatal("s_out.Connect:", err) + } + + message_count := 20 + + for j := 0; j < message_count; j++ { + _, err = s_out.Send(fmt.Sprint(j), 0) + if err != nil { + t.Fatalf("s_out.Send %d: %v", j, err) + } + } + + time.Sleep(time.Second) + + payload_recved, err := s_in.Recv(0) + if err != nil { + t.Error("s_in.Recv:", err) + } else { + i, err := strconv.Atoi(payload_recved) + if err != nil { + t.Error("strconv.Atoi:", err) + } + if i != message_count-1 { + t.Error("payload_recved != message_count - 1") + } + } + + err = s_in.Close() + s_in = nil + if err != nil { + t.Error("s_in.Close:", err) + } + + err = s_out.Close() + s_out = nil + if err != nil { + t.Error("s_out.Close:", err) + } +} + +func TestConnectResolve(t *testing.T) { + + sock, err := zmq.NewSocket(zmq.PUB) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + if sock != nil { + sock.SetLinger(0) + sock.Close() + } + }() + + err = sock.Connect("tcp://localhost:1234") + if err != nil { + t.Error("sock.Connect:", err) + } + + fails := []string{ + "tcp://localhost:invalid", + "tcp://in val id:1234", + "invalid://localhost:1234", + } + for _, fail := range fails { + if err = sock.Connect(fail); err == nil { + t.Errorf("Connect %s, expected fail, got success", fail) + } + } + + err = sock.Close() + sock = nil + if err != nil { + t.Error("sock.Close:", err) + } +} + +func TestCtxOptions(t *testing.T) { + + type Result struct { + value interface{} + err error + } + + i, err := zmq.GetMaxSockets() + if err != nil { + t.Error("GetMaxSockets:", err) + } + if i != zmq.MaxSocketsDflt { + t.Errorf("MaxSockets != MaxSocketsDflt: %d != %d", i, zmq.MaxSocketsDflt) + } + + i, err = zmq.GetIoThreads() + if err != nil { + t.Error("GetIoThreads:", err) + } + if i != zmq.IoThreadsDflt { + t.Errorf("IoThreads != IoThreadsDflt: %d != %d", i, zmq.IoThreadsDflt) + } + + b, err := zmq.GetIpv6() + if b != false || err != nil { + t.Errorf("GetIpv6 1: expected false , got %v %v", b, err) + } + + zmq.SetIpv6(true) + defer zmq.SetIpv6(false) + b, err = zmq.GetIpv6() + if b != true || err != nil { + t.Errorf("GetIpv6 2: expected true , got %v %v", b, err) + } + + router, _ := zmq.NewSocket(zmq.ROUTER) + b, err = router.GetIpv6() + if b != true || err != nil { + t.Errorf("GetIpv6 3: expected true , got %v %v", b, err) + } + router.Close() +} + +func TestDisconnectInproc(t *testing.T) { + + var pubSocket, subSocket *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{pubSocket, subSocket} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + publicationsReceived := 0 + isSubscribed := false + + pubSocket, err := zmq.NewSocket(zmq.XPUB) + if err != nil { + t.Fatal("NewSocket XPUB:", err) + } + subSocket, err = zmq.NewSocket(zmq.SUB) + if err != nil { + t.Fatal("NewSocket SUB:", err) + } + err = subSocket.SetSubscribe("foo") + if err != nil { + t.Fatal("subSocket.SetSubscribe:", err) + } + + err = pubSocket.Bind("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("pubSocket.Bind:", err) + } + + iteration := 0 + + poller := zmq.NewPoller() + poller.Add(subSocket, zmq.POLLIN) // read publications + poller.Add(pubSocket, zmq.POLLIN) // read subscriptions + for { + sockets, err := poller.Poll(100 * time.Millisecond) + if err != nil { + t.Error("Poll:", err) + break // Interrupted + } + + for _, socket := range sockets { + if socket.Socket == pubSocket { + for { + buffer, err := pubSocket.Recv(0) + if err != nil { + t.Fatal("pubSocket.Recv", err) + } + exp := "\x01foo" + if isSubscribed { + exp = "\x00foo" + } + if buffer != exp { + t.Errorf("pubSocket.Recv: expected %q, got %q", exp, buffer) + } + + if buffer[0] == 0 { + if isSubscribed != true { + t.Errorf("Poller: expected subscribed") + } + isSubscribed = false + } else { + if isSubscribed != false { + t.Errorf("Poller: expected not subscribed") + } + isSubscribed = true + } + + more, err := pubSocket.GetRcvmore() + if err != nil { + t.Fatal("pubSocket.GetRcvmore:", err) + } + if !more { + break // Last message part + } + } + break + } + } + + for _, socket := range sockets { + if socket.Socket == subSocket { + for _, exp := range []string{"foo", "this is foo!", "", ""} { + msg, err := subSocket.Recv(0) + if err != nil { + t.Fatal("subSocket.Recv:", err) + } + if msg != exp { + t.Errorf("subSocket.Recv: expected %q, got %q", exp, msg) + } + more, err := subSocket.GetRcvmore() + if err != nil { + t.Fatal("subSocket.GetRcvmore:", err) + } + if !more { + publicationsReceived++ + break // Last message part + } + + } + break + } + } + + if iteration == 1 { + err := subSocket.Connect("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("subSocket.Connect", err) + } + } + if iteration == 4 { + err := subSocket.Disconnect("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("subSocket.Disconnect", err) + } + } + if iteration > 4 && len(sockets) == 0 { + break + } + + _, err = pubSocket.Send("foo", zmq.SNDMORE) + if err != nil { + t.Fatal("pubSocket.Send 1", err) + } + _, err = pubSocket.Send("this is foo!", 0) + if err != nil { + t.Fatal("pubSocket.Send 2", err) + } + + iteration++ + + } + + if publicationsReceived != 3 { + t.Error("publicationsReceived != 3 ") + } + if isSubscribed { + t.Error("isSubscribed") + } + + err = pubSocket.Close() + pubSocket = nil + if err != nil { + t.Error("pubSocket.Close:", err) + } + err = subSocket.Close() + subSocket = nil + if err != nil { + t.Error("subSocket.Close:", err) + } +} + +func TestFork(t *testing.T) { + + address := "tcp://127.0.0.1:6571" + NUM_MESSAGES := 5 + + // Create and bind pull socket to receive messages + pull, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + if pull != nil { + pull.SetLinger(0) + pull.Close() + } + }() + err = pull.Bind(address) + if err != nil { + t.Fatal("pull.Bind:", err) + } + + ready := make(chan bool) + + go func() { + defer func() { + close(ready) + }() + + // Create new socket, connect and send some messages + + push, err := zmq.NewSocket(zmq.PUSH) + //err = fmt.Errorf("DUMMY ERROR") + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := push.Close() + if err != nil { + t.Error("push.Close:", err) + } + }() + + err = push.Connect(address) + if err != nil { + t.Error("push.Connect:", err) + return + } + + for count := 0; count < NUM_MESSAGES; count++ { + ready <- true + _, err = push.Send("Hello", 0) + if err != nil { + t.Error("push.Send:", err) + return + } + } + + }() + + for { + if r := <-ready; !r { + break + } + msg, err := pull.Recv(0) + if err != nil { + t.Error("pull.Recv:", err) + } + if msg != "Hello" { + t.Errorf("pull.Recv: expected \"Hello\", got %q", msg) + } + } + + err = pull.Close() + pull = nil + if err != nil { + t.Error("pull.Close", err) + } + + <-ready // false +} + +func TestHwm(t *testing.T) { + + MAX_SENDS := 10000 + BIND_FIRST := 1 + CONNECT_FIRST := 2 + + test_defaults := func() (result int) { + + result = -1 + + // Set up bind socket + bind_socket, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Set up connect socket + connect_socket, err := zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error("connect_socket.Close:", err) + } + }() + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("test_defaults: send_count == recv_count") + } + + return send_count + } + + count_msg := func(send_hwm, recv_hwm, testType int) (result int) { + + result = -1 + + var bind_socket, connect_socket *zmq.Socket + var err error + + if testType == BIND_FIRST { + // Set up bind socket + bind_socket, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Set up connect socket + connect_socket, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error(err) + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + } else { + // Set up connect socket + connect_socket, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error("connect_socket.Close:", err) + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Set up bind socket + bind_socket, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("count_msg: send_count != recv_count") + } + + // Now it should be possible to send one more. + _, err = connect_socket.Send("", 0) + if err != nil { + t.Error("connect_socket.Send:", err) + return + } + + // Consume the remaining message. + _, err = bind_socket.Recv(0) + if err != nil { + t.Error("bind_socket.Recv:", err) + } + + return send_count + } + + test_inproc_bind_first := func(send_hwm, recv_hwm int) int { + return count_msg(send_hwm, recv_hwm, BIND_FIRST) + } + + test_inproc_connect_first := func(send_hwm, recv_hwm int) int { + return count_msg(send_hwm, recv_hwm, CONNECT_FIRST) + } + + test_inproc_connect_and_close_first := func(send_hwm, recv_hwm int) (result int) { + + result = -1 + + // Set up connect socket + connect_socket, err := zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + if connect_socket != nil { + connect_socket.Close() + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Close connect + err = connect_socket.Close() + connect_socket = nil + if err != nil { + t.Error("connect_socket.Close:", err) + return + } + + // Set up bind socket + bind_socket, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("test_inproc_connect_and_close_first: send_count != recv_count") + } + return send_count + } + + // Default values are 1000 on send and 1000 one receive, so 2000 total + if count := test_defaults(); count != 2000 { + t.Errorf("test_defaults: expected 2000, got %d", count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite send and receive buffer + if count := test_inproc_bind_first(0, 0); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(0, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(0, 0); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(0, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite send buffer + if count := test_inproc_bind_first(1, 0); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(1, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(1, 0); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(1, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite receive buffer + if count := test_inproc_bind_first(0, 1); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(0, 1): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(0, 1); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(0, 1): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Send and recv buffers hwm 1, so total that can be queued is 2 + if count := test_inproc_bind_first(1, 1); count != 2 { + t.Errorf("test_inproc_bind_first(1, 1): expected 2, got %d", count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(1, 1); count != 2 { + t.Errorf("test_inproc_connect_first(1, 1): expected 2, got %d", count) + } + time.Sleep(100 * time.Millisecond) + + // Send hwm of 1, send before bind so total that can be queued is 1 + if count := test_inproc_connect_and_close_first(1, 0); count != 1 { + t.Errorf("test_inproc_connect_and_close_first(1, 0): expected 1, got %d", count) + } + time.Sleep(100 * time.Millisecond) +} + +func TestPairIpc(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("ipc:///tmp/tester") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("ipc:///tmp/tester") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + msg, err := bounce(sb, sc) + if err != nil { + t.Error(msg, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestPairTcp(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("tcp://127.0.0.1:9736") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("tcp://127.0.0.1:9736") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + msg, err := bounce(sb, sc) + + if err != nil { + t.Error(msg, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestPoller(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("tcp://127.0.0.1:9737") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("tcp://127.0.0.1:9737") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + poller := zmq.NewPoller() + idxb := poller.Add(sb, 0) + idxc := poller.Add(sc, 0) + if idxb != 0 || idxc != 1 { + t.Errorf("idxb=%d idxc=%d", idxb, idxc) + } + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 1:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 1 len = %d", len(pa)) + } else if pa[0].Events != 0 || pa[1].Events != 0 { + t.Errorf("PollAll 1 events = %v, %v", pa[0], pa[1]) + } + + poller.Update(idxb, zmq.POLLOUT) + poller.UpdateBySocket(sc, zmq.POLLIN) + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 2:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 2 len = %d", len(pa)) + } else if pa[0].Events != zmq.POLLOUT || pa[1].Events != 0 { + t.Errorf("PollAll 2 events = %v, %v", pa[0], pa[1]) + } + + poller.UpdateBySocket(sb, 0) + + content := "12345678ABCDEFGH12345678ABCDEFGH" + + // Send message from client to server + if rc, err := sb.Send(content, zmq.DONTWAIT); err != nil { + t.Error("sb.Send DONTWAIT:", err) + } else if rc != 32 { + t.Error("sb.Send DONTWAIT:", err32) + } + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 3:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 3 len = %d", len(pa)) + } else if pa[0].Events != 0 || pa[1].Events != zmq.POLLIN { + t.Errorf("PollAll 3 events = %v, %v", pa[0], pa[1]) + } + + // Receive message + if msg, err := sc.Recv(zmq.DONTWAIT); err != nil { + t.Error("sb.Recv DONTWAIT:", err) + } else if msg != content { + t.Error("sb.Recv msg != content") + } + + poller.UpdateBySocket(sb, zmq.POLLOUT) + poller.Update(idxc, zmq.POLLIN) + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 4:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 4 len = %d", len(pa)) + } else if pa[0].Events != zmq.POLLOUT || pa[1].Events != 0 { + t.Errorf("PollAll 4 events = %v, %v", pa[0], pa[1]) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestSecurityCurve(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + if _, minor, _ := zmq.Version(); minor >= 1 && !zmq.HasCurve() { + t.Skip("Curve not available") + } + + // Generate new keypairs for this test + client_public, client_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + server_public, server_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + + handler, err = zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + // domain := msg[2] + // address := msg[3] + identity := msg[4] + mechanism := msg[5] + client_key := msg[6] + client_key_text := zmq.Z85encode(client_key) + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "CURVE" { + return errors.New("mechanism != CURVE") + } + if identity != "IDENT" { + return errors.New("identity != IDENT") + } + + if client_key_text == client_public { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "Invalid client public key", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + handler = nil + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // Server socket will accept connections + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = server.SetCurveServer(1) + if err != nil { + t.Fatal("server.SetCurveServer(1):", err) + } + err = server.SetCurveSecretkey(server_secret) + if err != nil { + t.Fatal("server.SetCurveSecretkey:", err) + } + err = server.SetIdentity("IDENT") + if err != nil { + t.Fatal("server.SetIdentity:", err) + } + server.Bind("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("server.Bind:", err) + } + + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + + // Check CURVE security with valid credentials + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage server key + // This will be caught by the curve_server class, not passed to ZAP + garbage_key := "0000111122223333444455556666777788889999" + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(garbage_key) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage client secret key + // This will be caught by the curve_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(garbage_key) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage client secret key + // This will be caught by the curve_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(garbage_key) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with bogus client credentials + // This must be caught by the ZAP handler + + bogus_public, bogus_secret, _ := zmq.NewCurveKeypair() + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(bogus_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(bogus_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + // Shutdown + err = server.Close() + server = nil + if err != nil { + t.Error("server.Close:", err) + } +} + +func TestSecurityNull(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + handler, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + domain := msg[2] + // address := msg[3] + // identity := msg[4] + mechanism := msg[5] + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "NULL" { + return errors.New("mechanism != NULL") + } + + if domain == "TEST" { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "BAD DOMAIN", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + handler = nil + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // We bounce between a binding server and a connecting client + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + + // We first test client/server with no ZAP domain + // Libzmq does not call our ZAP handler, the connect must succeed + err = server.Bind("tcp://127.0.0.1:9683") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9683") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + server.Unbind("tcp://127.0.0.1:9683") + client.Disconnect("tcp://127.0.0.1:9683") + + // Now define a ZAP domain for the server; this enables + // authentication. We're using the wrong domain so this test + // must fail. + err = server.SetZapDomain("WRONG") + if err != nil { + t.Fatal("server.SetZapDomain:", err) + } + err = server.Bind("tcp://127.0.0.1:9687") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9687") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + server.Unbind("tcp://127.0.0.1:9687") + client.Disconnect("tcp://127.0.0.1:9687") + + // Now use the right domain, the test must pass + err = server.SetZapDomain("TEST") + if err != nil { + t.Fatal("server.SetZapDomain:", err) + } + err = server.Bind("tcp://127.0.0.1:9688") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9688") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err = bounce(server, client) + if err != nil { + t.Error(msg, err) + } + server.Unbind("tcp://127.0.0.1:9688") + client.Disconnect("tcp://127.0.0.1:9688") + + err = client.Close() + client = nil + if err != nil { + t.Error("client.Close:", err) + } + err = server.Close() + server = nil + if err != nil { + t.Error("server.Close:", err) + } +} + +func TestSecurityPlain(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + handler, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + // domain := msg[2] + // address := msg[3] + identity := msg[4] + mechanism := msg[5] + username := msg[6] + password := msg[7] + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "PLAIN" { + return errors.New("mechanism != PLAIN") + } + if identity != "IDENT" { + return errors.New("identity != IDENT") + } + + if username == "admin" && password == "password" { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "Invalid username or password", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // Server socket will accept connections + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket", err) + } + err = server.SetIdentity("IDENT") + if err != nil { + t.Fatal("server.SetIdentity:", err) + } + err = server.SetPlainServer(1) + if err != nil { + t.Fatal("server.SetPlainServer(1):", err) + } + err = server.Bind("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("server.Bind") + } + + // Check PLAIN security with correct username/password + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetPlainUsername("admin") + if err != nil { + t.Fatal("client.SetPlainUsername:", err) + } + err = client.SetPlainPassword("password") + if err != nil { + t.Fatal("client.SetPlainPassword:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + // Check PLAIN security with badly configured client (as_server) + // This will be caught by the plain_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + client.SetPlainServer(1) + if err != nil { + t.Fatal("client.SetPlainServer(1):", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + err = server.Close() + server = nil + if err != nil { + t.Fatal("server.Close:", err) + } +} + +func bounce(server, client *zmq.Socket) (msg string, err error) { + + content := "12345678ABCDEFGH12345678abcdefgh" + + // Send message from client to server + rc, err := client.Send(content, zmq.SNDMORE|zmq.DONTWAIT) + if err != nil { + return "client.Send SNDMORE|DONTWAIT:", err + } + if rc != 32 { + return "client.Send SNDMORE|DONTWAIT:", err32 + } + + rc, err = client.Send(content, zmq.DONTWAIT) + if err != nil { + return "client.Send DONTWAIT:", err + } + if rc != 32 { + return "client.Send DONTWAIT:", err32 + } + + // Receive message at server side + msg, err = server.Recv(0) + if err != nil { + return "server.Recv 1:", err + } + + // Check that message is still the same + if msg != content { + return "server.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err := server.GetRcvmore() + if err != nil { + return "server.GetRcvmore 1:", err + } + if !rcvmore { + return "server.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore)) + } + + // Receive message at server side + msg, err = server.Recv(0) + if err != nil { + return "server.Recv 2:", err + } + + // Check that message is still the same + if msg != content { + return "server.Recv 2:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = server.GetRcvmore() + if err != nil { + return "server.GetRcvmore 2:", err + } + if rcvmore { + return "server.GetRcvmore 2:", errors.New(fmt.Sprint("rcvmore == ", rcvmore)) + } + + // The same, from server back to client + + // Send message from server to client + rc, err = server.Send(content, zmq.SNDMORE) + if err != nil { + return "server.Send SNDMORE:", err + } + if rc != 32 { + return "server.Send SNDMORE:", err32 + } + + rc, err = server.Send(content, 0) + if err != nil { + return "server.Send 0:", err + } + if rc != 32 { + return "server.Send 0:", err32 + } + + // Receive message at client side + msg, err = client.Recv(0) + if err != nil { + return "client.Recv 1:", err + } + + // Check that message is still the same + if msg != content { + return "client.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = client.GetRcvmore() + if err != nil { + return "client.GetRcvmore 1:", err + } + if !rcvmore { + return "client.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore)) + } + + // Receive message at client side + msg, err = client.Recv(0) + if err != nil { + return "client.Recv 2:", err + } + + // Check that message is still the same + if msg != content { + return "client.Recv 2:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = client.GetRcvmore() + if err != nil { + return "client.GetRcvmore 2:", err + } + if rcvmore { + return "client.GetRcvmore 2:", errors.New(fmt.Sprint("rcvmore == ", rcvmore)) + } + return "OK", nil +} + +func arrayEqual(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} diff --git a/vendor/github.com/pebbe/zmq4/dummy.c b/vendor/github.com/pebbe/zmq4/dummy.c new file mode 100644 index 0000000..0fca94d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/dummy.c @@ -0,0 +1,5 @@ +/* + +You need CGO_ENABLED=1 to build this package + +*/ diff --git a/vendor/github.com/pebbe/zmq4/errors.go b/vendor/github.com/pebbe/zmq4/errors.go new file mode 100644 index 0000000..48dcdc3 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/errors.go @@ -0,0 +1,92 @@ +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "syscall" +) + +// An Errno is an unsigned number describing an error condition as returned by a call to ZeroMQ. +// It implements the error interface. +// The number is either a standard system error, or an error defined by the C library of ZeroMQ. +type Errno uintptr + +const ( + // Error conditions defined by the C library of ZeroMQ. + + // On Windows platform some of the standard POSIX errnos are not defined. + EADDRINUSE = Errno(C.EADDRINUSE) + EADDRNOTAVAIL = Errno(C.EADDRNOTAVAIL) + EAFNOSUPPORT = Errno(C.EAFNOSUPPORT) + ECONNABORTED = Errno(C.ECONNABORTED) + ECONNREFUSED = Errno(C.ECONNREFUSED) + ECONNRESET = Errno(C.ECONNRESET) + EHOSTUNREACH = Errno(C.EHOSTUNREACH) + EINPROGRESS = Errno(C.EINPROGRESS) + EMSGSIZE = Errno(C.EMSGSIZE) + ENETDOWN = Errno(C.ENETDOWN) + ENETRESET = Errno(C.ENETRESET) + ENETUNREACH = Errno(C.ENETUNREACH) + ENOBUFS = Errno(C.ENOBUFS) + ENOTCONN = Errno(C.ENOTCONN) + ENOTSOCK = Errno(C.ENOTSOCK) + ENOTSUP = Errno(C.ENOTSUP) + EPROTONOSUPPORT = Errno(C.EPROTONOSUPPORT) + ETIMEDOUT = Errno(C.ETIMEDOUT) + + // Native 0MQ error codes. + EFSM = Errno(C.EFSM) + EMTHREAD = Errno(C.EMTHREAD) + ENOCOMPATPROTO = Errno(C.ENOCOMPATPROTO) + ETERM = Errno(C.ETERM) +) + +func errget(err error) error { + eno, ok := err.(syscall.Errno) + if ok { + return Errno(eno) + } + return err +} + +// Return Errno as string. +func (errno Errno) Error() string { + if errno >= C.ZMQ_HAUSNUMERO { + return C.GoString(C.zmq_strerror(C.int(errno))) + } + return syscall.Errno(errno).Error() +} + +/* +Convert error to Errno. + +Example usage: + + switch AsErrno(err) { + + case zmq.Errno(syscall.EINTR): + // standard system error + + // call was interrupted + + case zmq.ETERM: + // error defined by ZeroMQ + + // context was terminated + + } + +See also: examples/interrupt.go +*/ +func AsErrno(err error) Errno { + if eno, ok := err.(Errno); ok { + return eno + } + if eno, ok := err.(syscall.Errno); ok { + return Errno(eno) + } + return Errno(0) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/Build.sh b/vendor/github.com/pebbe/zmq4/examples/Build.sh new file mode 100755 index 0000000..58b7dc0 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/Build.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +go get github.com/pborman/uuid + +for i in bstar mdapi flcliapi kvsimple kvmsg clone intface +do + go install github.com/pebbe/zmq4/examples/$i +done + +cd `dirname $0` + +goos=`go env GOOS` +gobin=`go env GOBIN` +if [ "$gobin" = "" ] +then + gobin=`go env GOPATH` + if [ "$gobin" = "" ] + then + gobin=`go env GOROOT` + fi + gobin=`echo $gobin | sed -e 's/:.*//'` + gobin=$gobin/bin +fi + +dir=$gobin/zmq4-examples + +echo Installing examples in $dir + +mkdir -p $dir + +for i in *.sh +do + if [ $i != Build.sh ] + then + cp -u $i $dir + fi +done + +src='' +for i in *.go +do + if [ $i = interrupt.go ] + then + if [ $goos = windows -o $goos = plan9 ] + then + continue + fi + fi + bin=$dir/`basename $i .go` + if [ ! -f $bin -o $i -nt $bin ] + then + src="$src $i" + fi +done + +libs=`pkg-config --libs-only-L libzmq` +if [ "$libs" = "" ] +then + for i in $src + do + go build -o $dir/`basename $i .go` $i + done +else + libs="-r `echo $libs | sed -e 's/-L//; s/ *-L/:/g'`" + for i in $src + do + go build -ldflags="$libs" -o $dir/`basename $i .go` $i + done +fi diff --git a/vendor/github.com/pebbe/zmq4/examples/README.md b/vendor/github.com/pebbe/zmq4/examples/README.md new file mode 100644 index 0000000..764a7ea --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/README.md @@ -0,0 +1,2 @@ +These are examples from [ØMQ - The Guide](http://zguide.zeromq.org/page:all), +re-implemented for the current Go package. diff --git a/vendor/github.com/pebbe/zmq4/examples/asyncsrv.go b/vendor/github.com/pebbe/zmq4/examples/asyncsrv.go new file mode 100644 index 0000000..3c08e9d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/asyncsrv.go @@ -0,0 +1,138 @@ +// +// Asynchronous client-to-server (DEALER to ROUTER). +// +// While this example runs in a single process, that is just to make +// it easier to start and stop the example. Each task has its own +// context and conceptually acts as a separate process. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "math/rand" + "sync" + "time" +) + +// --------------------------------------------------------------------- +// This is our client task +// It connects to the server, and then sends a request once per second +// It collects responses as they arrive, and it prints them out. We will +// run several client tasks in parallel, each with a different random ID. + +func client_task() { + var mu sync.Mutex + + client, _ := zmq.NewSocket(zmq.DEALER) + defer client.Close() + + // Set random identity to make tracing easier + set_id(client) + client.Connect("tcp://localhost:5570") + + go func() { + for request_nbr := 1; true; request_nbr++ { + time.Sleep(time.Second) + mu.Lock() + client.SendMessage(fmt.Sprintf("request #%d", request_nbr)) + mu.Unlock() + } + }() + + for { + time.Sleep(10 * time.Millisecond) + mu.Lock() + msg, err := client.RecvMessage(zmq.DONTWAIT) + if err == nil { + id, _ := client.GetIdentity() + fmt.Println(msg[0], id) + } + mu.Unlock() + } +} + +// This is our server task. +// It uses the multithreaded server model to deal requests out to a pool +// of workers and route replies back to clients. One worker can handle +// one request at a time but one client can talk to multiple workers at +// once. + +func server_task() { + + // Frontend socket talks to clients over TCP + frontend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + frontend.Bind("tcp://*:5570") + + // Backend socket talks to workers over inproc + backend, _ := zmq.NewSocket(zmq.DEALER) + defer backend.Close() + backend.Bind("inproc://backend") + + // Launch pool of worker threads, precise number is not critical + for i := 0; i < 5; i++ { + go server_worker() + } + + // Connect backend to frontend via a proxy + err := zmq.Proxy(frontend, backend, nil) + log.Fatalln("Proxy interrupted:", err) +} + +// Each worker task works on one request at a time and sends a random number +// of replies back, with random delays between replies: + +func server_worker() { + + worker, _ := zmq.NewSocket(zmq.DEALER) + defer worker.Close() + worker.Connect("inproc://backend") + + for { + // The DEALER socket gives us the reply envelope and message + msg, _ := worker.RecvMessage(0) + identity, content := pop(msg) + + // Send 0..4 replies back + replies := rand.Intn(5) + for reply := 0; reply < replies; reply++ { + // Sleep for some fraction of a second + time.Sleep(time.Duration(rand.Intn(1000)+1) * time.Millisecond) + worker.SendMessage(identity, content) + } + } +} + +// The main thread simply starts several clients, and a server, and then +// waits for the server to finish. + +func main() { + rand.Seed(time.Now().UnixNano()) + + go client_task() + go client_task() + go client_task() + go server_task() + + // Run for 5 seconds then quit + time.Sleep(5 * time.Second) +} + +func set_id(soc *zmq.Socket) { + identity := fmt.Sprintf("%04X-%04X", rand.Intn(0x10000), rand.Intn(0x10000)) + soc.SetIdentity(identity) +} + +func pop(msg []string) (head, tail []string) { + if msg[1] == "" { + head = msg[:2] + tail = msg[2:] + } else { + head = msg[:1] + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/bstar/bstar.go b/vendor/github.com/pebbe/zmq4/examples/bstar/bstar.go new file mode 100644 index 0000000..0061aff --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/bstar/bstar.go @@ -0,0 +1,275 @@ +// bstar - Binary Star reactor. +package bstar + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "log" + "strconv" + "time" +) + +const ( + PRIMARY = true + BACKUP = false +) + +// States we can be in at any point in time +type state_t int + +const ( + _ = state_t(iota) + state_PRIMARY // Primary, waiting for peer to connect + state_BACKUP // Backup, waiting for peer to connect + state_ACTIVE // Active - accepting connections + state_PASSIVE // Passive - not accepting connections +) + +// Events, which start with the states our peer can be in +type event_t int + +const ( + _ = event_t(iota) + peer_PRIMARY // HA peer is pending primary + peer_BACKUP // HA peer is pending backup + peer_ACTIVE // HA peer is active + peer_PASSIVE // HA peer is passive + client_REQUEST // Client makes request +) + +// Structure of our class + +type Bstar struct { + Reactor *zmq.Reactor // Reactor loop + statepub *zmq.Socket // State publisher + statesub *zmq.Socket // State subscriber + state state_t // Current state + event event_t // Current event + peer_expiry time.Time // When peer is considered 'dead' + voter_fn func(*zmq.Socket) error // Voting socket handler + active_fn func() error // Call when become active + passive_fn func() error // Call when become passive +} + +// The finite-state machine is the same as in the proof-of-concept server. +// To understand this reactor in detail, first read the CZMQ zloop class. + +// We send state information every this often +// If peer doesn't respond in two heartbeats, it is 'dead' +const ( + bstar_HEARTBEAT = 1000 * time.Millisecond // In msecs +) + +// --------------------------------------------------------------------- +// Binary Star finite state machine (applies event to state) +// Returns error if there was an exception, nil if event was valid. + +func (bstar *Bstar) execute_fsm() (exception error) { + // Primary server is waiting for peer to connect + // Accepts client_REQUEST events in this state + if bstar.state == state_PRIMARY { + if bstar.event == peer_BACKUP { + log.Println("I: connected to backup (passive), ready as active") + bstar.state = state_ACTIVE + if bstar.active_fn != nil { + bstar.active_fn() + } + } else if bstar.event == peer_ACTIVE { + log.Println("I: connected to backup (active), ready as passive") + bstar.state = state_PASSIVE + if bstar.passive_fn != nil { + bstar.passive_fn() + } + } else if bstar.event == client_REQUEST { + // Allow client requests to turn us into the active if we've + // waited sufficiently long to believe the backup is not + // currently acting as active (i.e., after a failover) + if time.Now().After(bstar.peer_expiry) { + log.Println("I: request from client, ready as active") + bstar.state = state_ACTIVE + if bstar.active_fn != nil { + bstar.active_fn() + } + } else { + // Don't respond to clients yet - it's possible we're + // performing a failback and the backup is currently active + exception = errors.New("Exception") + } + } + } else if bstar.state == state_BACKUP { + // Backup server is waiting for peer to connect + // Rejects client_REQUEST events in this state + if bstar.event == peer_ACTIVE { + log.Println("I: connected to primary (active), ready as passive") + bstar.state = state_PASSIVE + if bstar.passive_fn != nil { + bstar.passive_fn() + } + } else if bstar.event == client_REQUEST { + exception = errors.New("Exception") + } + } else if bstar.state == state_ACTIVE { + // Server is active + // Accepts client_REQUEST events in this state + // The only way out of ACTIVE is death + if bstar.event == peer_ACTIVE { + // Two actives would mean split-brain + log.Println("E: fatal error - dual actives, aborting") + exception = errors.New("Exception") + } + } else if bstar.state == state_PASSIVE { + // Server is passive + // client_REQUEST events can trigger failover if peer looks dead + if bstar.event == peer_PRIMARY { + // Peer is restarting - become active, peer will go passive + log.Println("I: primary (passive) is restarting, ready as active") + bstar.state = state_ACTIVE + } else if bstar.event == peer_BACKUP { + // Peer is restarting - become active, peer will go passive + log.Println("I: backup (passive) is restarting, ready as active") + bstar.state = state_ACTIVE + } else if bstar.event == peer_PASSIVE { + // Two passives would mean cluster would be non-responsive + log.Println("E: fatal error - dual passives, aborting") + exception = errors.New("Exception") + } else if bstar.event == client_REQUEST { + // Peer becomes active if timeout has passed + // It's the client request that triggers the failover + if time.Now().After(bstar.peer_expiry) { + // If peer is dead, switch to the active state + log.Println("I: failover successful, ready as active") + bstar.state = state_ACTIVE + } else { + // If peer is alive, reject connections + exception = errors.New("Exception") + } + } + // Call state change handler if necessary + if bstar.state == state_ACTIVE && bstar.active_fn != nil { + bstar.active_fn() + } + } + return +} + +func (bstar *Bstar) update_peer_expiry() { + bstar.peer_expiry = time.Now().Add(2 * bstar_HEARTBEAT) +} + +// --------------------------------------------------------------------- +// Reactor event handlers... + +// Publish our state to peer +func (bstar *Bstar) send_state() (err error) { + _, err = bstar.statepub.SendMessage(int(bstar.state)) + return +} + +// Receive state from peer, execute finite state machine +func (bstar *Bstar) recv_state() (err error) { + msg, err := bstar.statesub.RecvMessage(0) + if err == nil { + e, _ := strconv.Atoi(msg[0]) + bstar.event = event_t(e) + } + return bstar.execute_fsm() +} + +// Application wants to speak to us, see if it's possible +func (bstar *Bstar) voter_ready(socket *zmq.Socket) error { + // If server can accept input now, call appl handler + bstar.event = client_REQUEST + err := bstar.execute_fsm() + if err == nil { + bstar.voter_fn(socket) + } else { + // Destroy waiting message, no-one to read it + socket.RecvMessage(0) + } + return nil +} + +// This is the constructor for our bstar class. We have to tell it whether +// we're primary or backup server, and our local and remote endpoints to +// bind and connect to: + +func New(primary bool, local, remote string) (bstar *Bstar, err error) { + + bstar = &Bstar{} + + // Initialize the Binary Star + bstar.Reactor = zmq.NewReactor() + if primary { + bstar.state = state_PRIMARY + } else { + bstar.state = state_BACKUP + } + + // Create publisher for state going to peer + bstar.statepub, err = zmq.NewSocket(zmq.PUB) + bstar.statepub.Bind(local) + + // Create subscriber for state coming from peer + bstar.statesub, err = zmq.NewSocket(zmq.SUB) + bstar.statesub.SetSubscribe("") + bstar.statesub.Connect(remote) + + // Set-up basic reactor events + bstar.Reactor.AddChannelTime(time.Tick(bstar_HEARTBEAT), 1, + func(i interface{}) error { return bstar.send_state() }) + bstar.Reactor.AddSocket(bstar.statesub, zmq.POLLIN, + func(e zmq.State) error { return bstar.recv_state() }) + + return +} + +// The voter method registers a client voter socket. Messages received +// on this socket provide the client_REQUEST events for the Binary Star +// FSM and are passed to the provided application handler. We require +// exactly one voter per bstar instance: + +func (bstar *Bstar) Voter(endpoint string, socket_type zmq.Type, handler func(*zmq.Socket) error) { + // Hold actual handler so we can call this later + socket, _ := zmq.NewSocket(socket_type) + socket.Bind(endpoint) + if bstar.voter_fn != nil { + panic("Double voter function") + } + bstar.voter_fn = handler + bstar.Reactor.AddSocket(socket, zmq.POLLIN, + func(e zmq.State) error { return bstar.voter_ready(socket) }) +} + +// Register handlers to be called each time there's a state change: + +func (bstar *Bstar) NewActive(handler func() error) { + if bstar.active_fn != nil { + panic("Double Active") + } + bstar.active_fn = handler +} + +func (bstar *Bstar) NewPassive(handler func() error) { + if bstar.passive_fn != nil { + panic("Double Passive") + } + bstar.passive_fn = handler +} + +// Enable/disable verbose tracing, for debugging: + +func (bstar *Bstar) SetVerbose(verbose bool) { + bstar.Reactor.SetVerbose(verbose) +} + +//? Finally, start the configured reactor. It will end if any handler +//? returns error to the reactor, or if the process receives SIGINT or SIGTERM: + +func (bstar *Bstar) Start() error { + if bstar.voter_fn == nil { + panic("Missing voter function") + } + bstar.update_peer_expiry() + return bstar.Reactor.Run(bstar_HEARTBEAT / 5) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/bstarcli.go b/vendor/github.com/pebbe/zmq4/examples/bstarcli.go new file mode 100644 index 0000000..0d7fdc7 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/bstarcli.go @@ -0,0 +1,83 @@ +// +// Binary Star client proof-of-concept implementation. This client does no +// real work; it just demonstrates the Binary Star failover model. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strconv" + "time" +) + +const ( + REQUEST_TIMEOUT = 1000 * time.Millisecond // msecs + SETTLE_DELAY = 2000 * time.Millisecond // Before failing over +) + +func main() { + + server := []string{"tcp://localhost:5001", "tcp://localhost:5002"} + server_nbr := 0 + + fmt.Printf("I: connecting to server at %s...\n", server[server_nbr]) + client, _ := zmq.NewSocket(zmq.REQ) + client.Connect(server[server_nbr]) + + poller := zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + + sequence := 0 +LOOP: + for { + // We send a request, then we work to get a reply + sequence++ + client.SendMessage(sequence) + + for expect_reply := true; expect_reply; { + // Poll socket for a reply, with timeout + polled, err := poller.Poll(REQUEST_TIMEOUT) + if err != nil { + break LOOP // Interrupted + } + + // We use a Lazy Pirate strategy in the client. If there's no + // reply within our timeout, we close the socket and try again. + // In Binary Star, it's the client vote which decides which + // server is primary; the client must therefore try to connect + // to each server in turn: + + if len(polled) == 1 { + // We got a reply from the server, must match sequence + reply, _ := client.RecvMessage(0) + seq, _ := strconv.Atoi(reply[0]) + if seq == sequence { + fmt.Printf("I: server replied OK (%s)\n", reply[0]) + expect_reply = false + time.Sleep(time.Second) // One request per second + } else { + fmt.Printf("E: bad reply from server: %q\n", reply) + } + + } else { + fmt.Println("W: no response from server, failing over") + + // Old socket is confused; close it and open a new one + client.Close() + server_nbr = 1 - server_nbr + time.Sleep(SETTLE_DELAY) + fmt.Printf("I: connecting to server at %s...\n", server[server_nbr]) + client, _ = zmq.NewSocket(zmq.REQ) + client.Connect(server[server_nbr]) + + poller = zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + + // Send request again, on new socket + client.SendMessage(sequence) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/bstarsrv.go b/vendor/github.com/pebbe/zmq4/examples/bstarsrv.go new file mode 100644 index 0000000..20ae9a2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/bstarsrv.go @@ -0,0 +1,194 @@ +// +// Binary Star server proof-of-concept implementation. This server does no +// real work; it just demonstrates the Binary Star failover model. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" + "strconv" + "time" +) + +// States we can be in at any point in time +type state_t int + +const ( + _ = state_t(iota) + STATE_PRIMARY // Primary, waiting for peer to connect + STATE_BACKUP // Backup, waiting for peer to connect + STATE_ACTIVE // Active - accepting connections + STATE_PASSIVE // Passive - not accepting connections +) + +// Events, which start with the states our peer can be in +type event_t int + +const ( + _ = event_t(iota) + PEER_PRIMARY // HA peer is pending primary + PEER_BACKUP // HA peer is pending backup + PEER_ACTIVE // HA peer is active + PEER_PASSIVE // HA peer is passive + CLIENT_REQUEST // Client makes request +) + +// Our finite state machine +type bstar_t struct { + state state_t // Current state + event event_t // Current event + peer_expiry time.Time // When peer is considered 'dead' +} + +// We send state information every this often +// If peer doesn't respond in two heartbeats, it is 'dead' +const ( + HEARTBEAT = 1000 * time.Millisecond // In msecs +) + +// The heart of the Binary Star design is its finite-state machine (FSM). +// The FSM runs one event at a time. We apply an event to the current state, +// which checks if the event is accepted, and if so sets a new state: + +func StateMachine(fsm *bstar_t) (exception bool) { + // These are the PRIMARY and BACKUP states; we're waiting to become + // ACTIVE or PASSIVE depending on events we get from our peer: + if fsm.state == STATE_PRIMARY { + if fsm.event == PEER_BACKUP { + fmt.Println("I: connected to backup (passive), ready as active") + fsm.state = STATE_ACTIVE + } else if fsm.event == PEER_ACTIVE { + fmt.Println("I: connected to backup (active), ready as passive") + fsm.state = STATE_PASSIVE + } + // Accept client connections + } else if fsm.state == STATE_BACKUP { + if fsm.event == PEER_ACTIVE { + fmt.Println("I: connected to primary (active), ready as passive") + fsm.state = STATE_PASSIVE + } else if fsm.event == CLIENT_REQUEST { + // Reject client connections when acting as backup + exception = true + } + } else if fsm.state == STATE_ACTIVE { + // These are the ACTIVE and PASSIVE states: + if fsm.event == PEER_ACTIVE { + // Two actives would mean split-brain + fmt.Println("E: fatal error - dual actives, aborting") + exception = true + } + } else if fsm.state == STATE_PASSIVE { + // Server is passive + // CLIENT_REQUEST events can trigger failover if peer looks dead + if fsm.event == PEER_PRIMARY { + // Peer is restarting - become active, peer will go passive + fmt.Println("I: primary (passive) is restarting, ready as active") + fsm.state = STATE_ACTIVE + } else if fsm.event == PEER_BACKUP { + // Peer is restarting - become active, peer will go passive + fmt.Println("I: backup (passive) is restarting, ready as active") + fsm.state = STATE_ACTIVE + } else if fsm.event == PEER_PASSIVE { + // Two passives would mean cluster would be non-responsive + fmt.Println("E: fatal error - dual passives, aborting") + exception = true + } else if fsm.event == CLIENT_REQUEST { + // Peer becomes active if timeout has passed + // It's the client request that triggers the failover + if time.Now().After(fsm.peer_expiry) { + // If peer is dead, switch to the active state + fmt.Println("I: failover successful, ready as active") + fsm.state = STATE_ACTIVE + } else { + // If peer is alive, reject connections + exception = true + } + } + } + return +} + +// This is our main task. First we bind/connect our sockets with our +// peer and make sure we will get state messages correctly. We use +// three sockets; one to publish state, one to subscribe to state, and +// one for client requests/replies: + +func main() { + // Arguments can be either of: + // -p primary server, at tcp://localhost:5001 + // -b backup server, at tcp://localhost:5002 + statepub, _ := zmq.NewSocket(zmq.PUB) + statesub, _ := zmq.NewSocket(zmq.SUB) + statesub.SetSubscribe("") + frontend, _ := zmq.NewSocket(zmq.ROUTER) + fsm := &bstar_t{peer_expiry: time.Now().Add(2 * HEARTBEAT)} + + if len(os.Args) == 2 && os.Args[1] == "-p" { + fmt.Println("I: Primary active, waiting for backup (passive)") + frontend.Bind("tcp://*:5001") + statepub.Bind("tcp://*:5003") + statesub.Connect("tcp://localhost:5004") + fsm.state = STATE_PRIMARY + } else if len(os.Args) == 2 && os.Args[1] == "-b" { + fmt.Println("I: Backup passive, waiting for primary (active)") + frontend.Bind("tcp://*:5002") + statepub.Bind("tcp://*:5004") + statesub.Connect("tcp://localhost:5003") + fsm.state = STATE_BACKUP + } else { + fmt.Println("Usage: bstarsrv { -p | -b }") + return + } + // We now process events on our two input sockets, and process these + // events one at a time via our finite-state machine. Our "work" for + // a client request is simply to echo it back: + + // Set timer for next outgoing state message + send_state_at := time.Now().Add(HEARTBEAT) + + poller := zmq.NewPoller() + poller.Add(frontend, zmq.POLLIN) + poller.Add(statesub, zmq.POLLIN) + +LOOP: + for { + time_left := send_state_at.Sub(time.Now()) + if time_left < 0 { + time_left = 0 + } + polled, err := poller.Poll(time_left) + if err != nil { + break // Context has been shut down + } + for _, socket := range polled { + switch socket.Socket { + case frontend: + // Have a client request + msg, _ := frontend.RecvMessage(0) + fsm.event = CLIENT_REQUEST + if !StateMachine(fsm) { + // Answer client by echoing request back + frontend.SendMessage(msg) + } + case statesub: + // Have state from our peer, execute as event + message, _ := statesub.RecvMessage(0) + i, _ := strconv.Atoi(message[0]) + fsm.event = event_t(i) + if StateMachine(fsm) { + break LOOP // Error, so exit + } + fsm.peer_expiry = time.Now().Add(2 * HEARTBEAT) + } + } + // If we timed-out, send state to peer + if time.Now().After(send_state_at) { + statepub.SendMessage(int(fsm.state)) + send_state_at = time.Now().Add(HEARTBEAT) + } + } + fmt.Println("W: interrupted") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/bstarsrv2.go b/vendor/github.com/pebbe/zmq4/examples/bstarsrv2.go new file mode 100644 index 0000000..6d5ed3c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/bstarsrv2.go @@ -0,0 +1,43 @@ +// +// Binary Star server, using bstar reactor. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/bstar" + + "fmt" + "os" +) + +// Echo service +func echo(socket *zmq.Socket) (err error) { + msg, err := socket.RecvMessage(0) + if err != nil { + return + } + _, err = socket.SendMessage(msg) + return +} + +func main() { + // Arguments can be either of: + // -p primary server, at tcp://localhost:5001 + // -b backup server, at tcp://localhost:5002 + var bst *bstar.Bstar + if len(os.Args) == 2 && os.Args[1] == "-p" { + fmt.Println("I: Primary active, waiting for backup (passive)") + bst, _ = bstar.New(bstar.PRIMARY, "tcp://*:5003", "tcp://localhost:5004") + bst.Voter("tcp://*:5001", zmq.ROUTER, echo) + } else if len(os.Args) == 2 && os.Args[1] == "-b" { + fmt.Println("I: Backup passive, waiting for primary (active)") + bst, _ = bstar.New(bstar.BACKUP, "tcp://*:5004", "tcp://localhost:5003") + bst.Voter("tcp://*:5002", zmq.ROUTER, echo) + } else { + fmt.Println("Usage: bstarsrvs { -p | -b }") + return + } + bst.Start() +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clone/clone.go b/vendor/github.com/pebbe/zmq4/examples/clone/clone.go new file mode 100644 index 0000000..49e1935 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clone/clone.go @@ -0,0 +1,304 @@ +// Clone client API stack (multithreaded). +package clone + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvmsg" + + "fmt" + "strconv" + "time" +) + +// ===================================================================== +// Synchronous part, works in our application thread + +// --------------------------------------------------------------------- +// Structure of our class + +var ( + pipe_nmb uint64 +) + +type Clone struct { + pipe *zmq.Socket // Pipe through to clone agent +} + +// This is the thread that handles our real clone class + +// Constructor for the clone class. Note that we create +// the pipe that connects our frontend to the +// backend agent: + +func New() (clone *Clone) { + clone = &Clone{} + clone.pipe, _ = zmq.NewSocket(zmq.PAIR) + pipename := fmt.Sprint("inproc://pipe", pipe_nmb) + pipe_nmb++ + clone.pipe.Bind(pipename) + go clone_agent(pipename) + return +} + +// Specify subtree for snapshot and updates, which we must do before +// connecting to a server since the subtree specification is sent as +// first command to the server. Sends a [SUBTREE][subtree] command to +// the agent: + +func (clone *Clone) Subtree(subtree string) { + clone.pipe.SendMessage("SUBTREE", subtree) +} + +// Connect to a new server endpoint. We can connect to at most two +// servers. Sends [CONNECT][endpoint][service] to the agent: + +func (clone *Clone) Connect(address, service string) { + clone.pipe.SendMessage("CONNECT", address, service) +} + +// Set a new value in the shared hashmap. Sends a [SET][key][value][ttl] +// command through to the agent which does the actual work: + +func (clone *Clone) Set(key, value string, ttl int) { + clone.pipe.SendMessage("SET", key, value, ttl) +} + +// Look-up value in distributed hash table. Sends [GET][key] to the agent and +// waits for a value response. If there is no value available, will eventually +// return error: + +func (clone *Clone) Get(key string) (value string, err error) { + + clone.pipe.SendMessage("GET", key) + + reply, e := clone.pipe.RecvMessage(0) + if e != nil { + err = e + return + } + value = reply[0] + return +} + +// The back-end agent manages a set of servers, which we implement using +// our simple class model: + +type server_t struct { + address string // Server address + port int // Server port + snapshot *zmq.Socket // Snapshot socket + subscriber *zmq.Socket // Incoming updates + expiry time.Time // When server expires + requests int64 // How many snapshot requests made? +} + +func server_new(address string, port int, subtree string) (server *server_t) { + server = &server_t{} + + fmt.Printf("I: adding server %s:%d...\n", address, port) + server.address = address + server.port = port + + server.snapshot, _ = zmq.NewSocket(zmq.DEALER) + server.snapshot.Connect(fmt.Sprintf("%s:%d", address, port)) + server.subscriber, _ = zmq.NewSocket(zmq.SUB) + server.subscriber.Connect(fmt.Sprintf("%s:%d", address, port+1)) + server.subscriber.SetSubscribe(subtree) + return +} + +// Here is the implementation of the back-end agent itself: + +const ( + // Number of servers we will talk to + server_MAX = 2 + + // Server considered dead if silent for this long + server_TTL = 5000 * time.Millisecond +) + +const ( + // States we can be in + state_INITIAL = iota // Before asking server for state + state_SYNCING // Getting state from server + state_ACTIVE // Getting new updates from server +) + +type agent_t struct { + pipe *zmq.Socket // Pipe back to application + kvmap map[string]*kvmsg.Kvmsg // Actual key/value table + subtree string // Subtree specification, if any + server [server_MAX]*server_t + nbr_servers int // 0 to SERVER_MAX + state int // Current state + cur_server int // If active, server 0 or 1 + sequence int64 // Last kvmsg processed + publisher *zmq.Socket // Outgoing updates +} + +func agent_new(pipe *zmq.Socket) (agent *agent_t) { + agent = &agent_t{} + agent.pipe = pipe + agent.kvmap = make(map[string]*kvmsg.Kvmsg) + agent.subtree = "" + agent.state = state_INITIAL + agent.publisher, _ = zmq.NewSocket(zmq.PUB) + return +} + +// Here we handle the different control messages from the front-end; +// SUBTREE, CONNECT, SET, and GET: + +func (agent *agent_t) control_message() (err error) { + msg, e := agent.pipe.RecvMessage(0) + if e != nil { + return e + } + command := msg[0] + msg = msg[1:] + + switch command { + case "SUBTREE": + agent.subtree = msg[0] + case "CONNECT": + address := msg[0] + service := msg[1] + if agent.nbr_servers < server_MAX { + serv, _ := strconv.Atoi(service) + agent.server[agent.nbr_servers] = server_new(address, serv, agent.subtree) + agent.nbr_servers++ + // We broadcast updates to all known servers + agent.publisher.Connect(fmt.Sprintf("%s:%d", address, serv+2)) + } else { + fmt.Printf("E: too many servers (max. %d)\n", server_MAX) + } + case "SET": + // When we set a property, we push the new key-value pair onto + // all our connected servers: + key := msg[0] + value := msg[1] + ttl := msg[2] + + // Send key-value pair on to server + kvmsg := kvmsg.NewKvmsg(0) + kvmsg.SetKey(key) + kvmsg.SetUuid() + kvmsg.SetBody(value) + kvmsg.SetProp("ttl", ttl) + kvmsg.Store(agent.kvmap) + kvmsg.Send(agent.publisher) + case "GET": + key := msg[0] + value := "" + if kvmsg, ok := agent.kvmap[key]; ok { + value, _ = kvmsg.GetBody() + } + agent.pipe.SendMessage(value) + } + return +} + +// The asynchronous agent manages a server pool and handles the +// request/reply dialog when the application asks for it: + +func clone_agent(pipename string) { + + pipe, _ := zmq.NewSocket(zmq.PAIR) + pipe.Connect(pipename) + + agent := agent_new(pipe) + +LOOP: + for { + poller := zmq.NewPoller() + poller.Add(pipe, zmq.POLLIN) + server := agent.server[agent.cur_server] + switch agent.state { + case state_INITIAL: + // In this state we ask the server for a snapshot, + // if we have a server to talk to... + if agent.nbr_servers > 0 { + fmt.Printf("I: waiting for server at %s:%d...\n", server.address, server.port) + if server.requests < 2 { + server.snapshot.SendMessage("ICANHAZ?", agent.subtree) + server.requests++ + } + server.expiry = time.Now().Add(server_TTL) + agent.state = state_SYNCING + poller.Add(server.snapshot, zmq.POLLIN) + } + + case state_SYNCING: + // In this state we read from snapshot and we expect + // the server to respond, else we fail over. + poller.Add(server.snapshot, zmq.POLLIN) + + case state_ACTIVE: + // In this state we read from subscriber and we expect + // the server to give hugz, else we fail over. + poller.Add(server.subscriber, zmq.POLLIN) + break + } + poll_timer := time.Duration(-1) + if server != nil { + poll_timer = server.expiry.Sub(time.Now()) + if poll_timer < 0 { + poll_timer = 0 + } + } + // We're ready to process incoming messages; if nothing at all + // comes from our server within the timeout, that means the + // server is dead: + + polled, err := poller.Poll(poll_timer) + if err != nil { + break + } + + if len(polled) > 0 { + for _, item := range polled { + switch socket := item.Socket; socket { + case pipe: + + err = agent.control_message() + if err != nil { + break LOOP + } + + default: + kvmsg, e := kvmsg.RecvKvmsg(socket) + if e != nil { + err = e + break LOOP + } + + // Anything from server resets its expiry time + server.expiry = time.Now().Add(server_TTL) + if agent.state == state_SYNCING { + // Store in snapshot until we're finished + server.requests = 0 + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + agent.sequence, _ = kvmsg.GetSequence() + agent.state = state_ACTIVE + fmt.Printf("I: received from %s:%d snapshot=%d\n", server.address, server.port, agent.sequence) + } else { + kvmsg.Store(agent.kvmap) + } + } else if agent.state == state_ACTIVE { + // Discard out-of-sequence updates, incl. hugz + if seq, _ := kvmsg.GetSequence(); seq > agent.sequence { + agent.sequence = seq + kvmsg.Store(agent.kvmap) + fmt.Printf("I: received from %s:%d update=%d\n", server.address, server.port, agent.sequence) + } + } + } + } + } else { + // Server has died, failover to next + fmt.Printf("I: server at %s:%d didn't give hugz\n", server.address, server.port) + agent.cur_server = (agent.cur_server + 1) % agent.nbr_servers + agent.state = state_INITIAL + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli1.go b/vendor/github.com/pebbe/zmq4/examples/clonecli1.go new file mode 100644 index 0000000..4b19fe6 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli1.go @@ -0,0 +1,31 @@ +// +// Clone client Model One +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" +) + +func main() { + // Prepare our context and updates socket + updates, _ := zmq.NewSocket(zmq.SUB) + updates.SetSubscribe("") + updates.Connect("tcp://localhost:5556") + + kvmap := make(map[string]*kvsimple.Kvmsg) + + sequence := int64(0) + for ; true; sequence++ { + kvmsg, err := kvsimple.RecvKvmsg(updates) + if err != nil { + break // Interrupted + } + kvmsg.Store(kvmap) + } + fmt.Printf("Interrupted\n%d messages in\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli2.go b/vendor/github.com/pebbe/zmq4/examples/clonecli2.go new file mode 100644 index 0000000..de2866f --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli2.go @@ -0,0 +1,70 @@ +// +// Clone client Model Two +// +// In the original C example, the client misses updates between snapshot +// and further updates. Sometimes, it even misses the END message of +// the snapshot, so it waits for it forever. +// This Go implementation has some modifications to improve this, but it +// is still not fully reliable. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "time" +) + +func main() { + snapshot, _ := zmq.NewSocket(zmq.DEALER) + snapshot.Connect("tcp://localhost:5556") + + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.SetRcvhwm(100000) // or messages between snapshot and next are lost + subscriber.SetSubscribe("") + subscriber.Connect("tcp://localhost:5557") + + time.Sleep(time.Second) // or messages between snapshot and next are lost + + kvmap := make(map[string]*kvsimple.Kvmsg) + + // Get state snapshot + sequence := int64(0) + snapshot.SendMessage("ICANHAZ?") + for { + kvmsg, err := kvsimple.RecvKvmsg(snapshot) + if err != nil { + fmt.Println(err) + break // Interrupted + } + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + sequence, _ = kvmsg.GetSequence() + fmt.Printf("Received snapshot=%d\n", sequence) + break // Done + } + kvmsg.Store(kvmap) + } + snapshot.Close() + + first := true + // Now apply pending updates, discard out-of-sequence messages + for { + kvmsg, err := kvsimple.RecvKvmsg(subscriber) + if err != nil { + fmt.Println(err) + break // Interrupted + } + if seq, _ := kvmsg.GetSequence(); seq > sequence { + sequence, _ = kvmsg.GetSequence() + kvmsg.Store(kvmap) + if first { + // Show what the first regular update is after the snapshot, + // to see if we missed updates. + first = false + fmt.Println("Next:", sequence) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli3.go b/vendor/github.com/pebbe/zmq4/examples/clonecli3.go new file mode 100644 index 0000000..d99c59d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli3.go @@ -0,0 +1,83 @@ +// +// Clone client Model Three +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "math/rand" + "time" +) + +func main() { + snapshot, _ := zmq.NewSocket(zmq.DEALER) + snapshot.Connect("tcp://localhost:5556") + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.SetSubscribe("") + subscriber.Connect("tcp://localhost:5557") + publisher, _ := zmq.NewSocket(zmq.PUSH) + publisher.Connect("tcp://localhost:5558") + + kvmap := make(map[string]*kvsimple.Kvmsg) + rand.Seed(time.Now().UnixNano()) + + // We first request a state snapshot: + sequence := int64(0) + snapshot.SendMessage("ICANHAZ?") + for { + kvmsg, err := kvsimple.RecvKvmsg(snapshot) + if err != nil { + break // Interrupted + } + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + sequence, _ := kvmsg.GetSequence() + fmt.Println("I: received snapshot =", sequence) + break // Done + } + kvmsg.Store(kvmap) + } + snapshot.Close() + + // Now we wait for updates from the server, and every so often, we + // send a random key-value update to the server: + + poller := zmq.NewPoller() + poller.Add(subscriber, zmq.POLLIN) + alarm := time.Now().Add(1000 * time.Millisecond) + for { + tickless := alarm.Sub(time.Now()) + if tickless < 0 { + tickless = 0 + } + polled, err := poller.Poll(tickless) + if err != nil { + break // Context has been shut down + } + if len(polled) == 1 { + kvmsg, err := kvsimple.RecvKvmsg(subscriber) + if err != nil { + break // Interrupted + } + + // Discard out-of-sequence kvmsgs, incl. heartbeats + if seq, _ := kvmsg.GetSequence(); seq > sequence { + sequence = seq + kvmsg.Store(kvmap) + fmt.Println("I: received update =", sequence) + } + } + // If we timed-out, generate a random kvmsg + if time.Now().After(alarm) { + kvmsg := kvsimple.NewKvmsg(0) + kvmsg.SetKey(fmt.Sprint(rand.Intn(10000))) + kvmsg.SetBody(fmt.Sprint(rand.Intn(1000000))) + kvmsg.Send(publisher) + alarm = time.Now().Add(1000 * time.Millisecond) + } + } + fmt.Printf("Interrupted\n%d messages in\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli4.go b/vendor/github.com/pebbe/zmq4/examples/clonecli4.go new file mode 100644 index 0000000..e3d75a6 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli4.go @@ -0,0 +1,84 @@ +// +// Clone client Model Four +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "math/rand" + "time" +) + +const ( + SUBTREE = "/client/" +) + +func main() { + snapshot, _ := zmq.NewSocket(zmq.DEALER) + snapshot.Connect("tcp://localhost:5556") + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.SetSubscribe(SUBTREE) + subscriber.Connect("tcp://localhost:5557") + publisher, _ := zmq.NewSocket(zmq.PUSH) + publisher.Connect("tcp://localhost:5558") + + kvmap := make(map[string]*kvsimple.Kvmsg) + rand.Seed(time.Now().UnixNano()) + + // We first request a state snapshot: + sequence := int64(0) + snapshot.SendMessage("ICANHAZ?", SUBTREE) + for { + kvmsg, err := kvsimple.RecvKvmsg(snapshot) + if err != nil { + break // Interrupted + } + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + sequence, _ := kvmsg.GetSequence() + fmt.Println("I: received snapshot =", sequence) + break // Done + } + kvmsg.Store(kvmap) + } + snapshot.Close() + + poller := zmq.NewPoller() + poller.Add(subscriber, zmq.POLLIN) + alarm := time.Now().Add(1000 * time.Millisecond) + for { + tickless := alarm.Sub(time.Now()) + if tickless < 0 { + tickless = 0 + } + polled, err := poller.Poll(tickless) + if err != nil { + break // Context has been shut down + } + if len(polled) == 1 { + kvmsg, err := kvsimple.RecvKvmsg(subscriber) + if err != nil { + break // Interrupted + } + + // Discard out-of-sequence kvmsgs, incl. heartbeats + if seq, _ := kvmsg.GetSequence(); seq > sequence { + sequence = seq + kvmsg.Store(kvmap) + fmt.Println("I: received update =", sequence) + } + } + // If we timed-out, generate a random kvmsg + if time.Now().After(alarm) { + kvmsg := kvsimple.NewKvmsg(0) + kvmsg.SetKey(fmt.Sprintf("%s%d", SUBTREE, rand.Intn(10000))) + kvmsg.SetBody(fmt.Sprint(rand.Intn(1000000))) + kvmsg.Send(publisher) + alarm = time.Now().Add(1000 * time.Millisecond) + } + } + fmt.Printf("Interrupted\n%d messages in\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli5.go b/vendor/github.com/pebbe/zmq4/examples/clonecli5.go new file mode 100644 index 0000000..428c995 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli5.go @@ -0,0 +1,85 @@ +// +// Clone client Model Five +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvmsg" + + "fmt" + "math/rand" + "time" +) + +const ( + SUBTREE = "/client/" +) + +func main() { + snapshot, _ := zmq.NewSocket(zmq.DEALER) + snapshot.Connect("tcp://localhost:5556") + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.SetSubscribe(SUBTREE) + subscriber.Connect("tcp://localhost:5557") + publisher, _ := zmq.NewSocket(zmq.PUSH) + publisher.Connect("tcp://localhost:5558") + + kvmap := make(map[string]*kvmsg.Kvmsg) + rand.Seed(time.Now().UnixNano()) + + // We first request a state snapshot: + sequence := int64(0) + snapshot.SendMessage("ICANHAZ?", SUBTREE) + for { + kvmsg, err := kvmsg.RecvKvmsg(snapshot) + if err != nil { + break // Interrupted + } + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + sequence, _ := kvmsg.GetSequence() + fmt.Println("I: received snapshot =", sequence) + break // Done + } + kvmsg.Store(kvmap) + } + snapshot.Close() + + poller := zmq.NewPoller() + poller.Add(subscriber, zmq.POLLIN) + alarm := time.Now().Add(1000 * time.Millisecond) + for { + tickless := alarm.Sub(time.Now()) + if tickless < 0 { + tickless = 0 + } + polled, err := poller.Poll(tickless) + if err != nil { + break // Context has been shut down + } + if len(polled) == 1 { + kvmsg, err := kvmsg.RecvKvmsg(subscriber) + if err != nil { + break // Interrupted + } + + // Discard out-of-sequence kvmsgs, incl. heartbeats + if seq, _ := kvmsg.GetSequence(); seq > sequence { + sequence = seq + kvmsg.Store(kvmap) + fmt.Println("I: received update =", sequence) + } + } + // If we timed-out, generate a random kvmsg + if time.Now().After(alarm) { + kvmsg := kvmsg.NewKvmsg(0) + kvmsg.SetKey(fmt.Sprintf("%s%d", SUBTREE, rand.Intn(10000))) + kvmsg.SetBody(fmt.Sprint(rand.Intn(1000000))) + kvmsg.SetProp("ttl", fmt.Sprintf("%d", rand.Intn((30)))) // seconds + kvmsg.Send(publisher) + alarm = time.Now().Add(1000 * time.Millisecond) + } + } + fmt.Printf("Interrupted\n%d messages in\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonecli6.go b/vendor/github.com/pebbe/zmq4/examples/clonecli6.go new file mode 100644 index 0000000..0d32e45 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonecli6.go @@ -0,0 +1,41 @@ +// +// Clone client Model Six +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/clone" + + "fmt" + "log" + "math/rand" + "time" +) + +const ( + SUBTREE = "/client/" +) + +func main() { + // Create distributed hash instance + clone := clone.New() + + // Specify configuration + clone.Subtree(SUBTREE) + clone.Connect("tcp://localhost", "5556") + clone.Connect("tcp://localhost", "5566") + + // Set random tuples into the distributed hash + for { + // Set random value, check it was stored + key := fmt.Sprintf("%s%d", SUBTREE, rand.Intn(10000)) + value := fmt.Sprint(rand.Intn(1000000)) + clone.Set(key, value, rand.Intn(30)) + v, _ := clone.Get(key) + if v != value { + log.Fatalf("Set: %v - Get: %v - Equal: %v\n", value, v, value == v) + } + time.Sleep(time.Second) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv1.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv1.go new file mode 100644 index 0000000..1f264b3 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv1.go @@ -0,0 +1,38 @@ +// +// Clone server Model One +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "math/rand" + "time" +) + +func main() { + // Prepare our context and publisher socket + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:5556") + time.Sleep(200 * time.Millisecond) + + kvmap := make(map[string]*kvsimple.Kvmsg) + rand.Seed(time.Now().UnixNano()) + + sequence := int64(1) + for ; true; sequence++ { + // Distribute as key-value message + kvmsg := kvsimple.NewKvmsg(sequence) + kvmsg.SetKey(fmt.Sprint(rand.Intn(10000))) + kvmsg.SetBody(fmt.Sprint(rand.Intn(1000000))) + err := kvmsg.Send(publisher) + kvmsg.Store(kvmap) + if err != nil { + break + } + } + fmt.Printf("Interrupted\n%d messages out\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv2.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv2.go new file mode 100644 index 0000000..7958c04 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv2.go @@ -0,0 +1,119 @@ +// +// Clone server Model Two +// +// In the original C example, the client misses updates between snapshot +// and further updates. Sometimes, it even misses the END message of +// the snapshot, so it waits for it forever. +// This Go implementation has some modifications to improve this, but it +// is still not fully reliable. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "math/rand" + "time" +) + +func main() { + // Prepare our context and sockets + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:5557") + + sequence := int64(0) + rand.Seed(time.Now().UnixNano()) + + // Start state manager and wait for synchronization signal + updates, _ := zmq.NewSocket(zmq.PAIR) + updates.Bind("inproc://pipe") + go state_manager() + updates.RecvMessage(0) // "READY" + + for { + // Distribute as key-value message + sequence++ + kvmsg := kvsimple.NewKvmsg(sequence) + kvmsg.SetKey(fmt.Sprint(rand.Intn(10000))) + kvmsg.SetBody(fmt.Sprint(rand.Intn(1000000))) + if kvmsg.Send(publisher) != nil { + break + } + if kvmsg.Send(updates) != nil { + break + } + } + fmt.Printf("Interrupted\n%d messages out\n", sequence) +} + +// The state manager task maintains the state and handles requests from +// clients for snapshots: + +func state_manager() { + kvmap := make(map[string]*kvsimple.Kvmsg) + + pipe, _ := zmq.NewSocket(zmq.PAIR) + pipe.Connect("inproc://pipe") + pipe.SendMessage("READY") + snapshot, _ := zmq.NewSocket(zmq.ROUTER) + snapshot.Bind("tcp://*:5556") + + poller := zmq.NewPoller() + poller.Add(pipe, zmq.POLLIN) + poller.Add(snapshot, zmq.POLLIN) + sequence := int64(0) // Current snapshot version number +LOOP: + for { + polled, err := poller.Poll(-1) + if err != nil { + break // Context has been shut down + } + for _, item := range polled { + switch socket := item.Socket; socket { + case pipe: + // Apply state update from main thread + kvmsg, err := kvsimple.RecvKvmsg(pipe) + if err != nil { + break LOOP // Interrupted + } + sequence, _ = kvmsg.GetSequence() + kvmsg.Store(kvmap) + case snapshot: + // Execute state snapshot request + msg, err := snapshot.RecvMessage(0) + if err != nil { + break LOOP // Interrupted + } + identity := msg[0] + // Request is in second frame of message + request := msg[1] + if request != "ICANHAZ?" { + fmt.Println("E: bad request, aborting") + break LOOP + } + // Send state snapshot to client + + // For each entry in kvmap, send kvmsg to client + for _, kvmsg := range kvmap { + snapshot.Send(identity, zmq.SNDMORE) + kvmsg.Send(snapshot) + } + + // Give client some time to deal with it. + // This reduces the risk that the client won't see + // the END message, but it doesn't eliminate the risk. + time.Sleep(100 * time.Millisecond) + + // Now send END message with sequence number + fmt.Printf("Sending state shapshot=%d\n", sequence) + snapshot.Send(identity, zmq.SNDMORE) + kvmsg := kvsimple.NewKvmsg(sequence) + kvmsg.SetKey("KTHXBAI") + kvmsg.SetBody("") + kvmsg.Send(snapshot) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv3.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv3.go new file mode 100644 index 0000000..5a3e6f8 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv3.go @@ -0,0 +1,84 @@ +// +// Clone server Model Three +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "time" +) + +func main() { + snapshot, _ := zmq.NewSocket(zmq.ROUTER) + snapshot.Bind("tcp://*:5556") + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:5557") + collector, _ := zmq.NewSocket(zmq.PULL) + collector.Bind("tcp://*:5558") + + // The body of the main task collects updates from clients and + // publishes them back out to clients: + + sequence := int64(0) + kvmap := make(map[string]*kvsimple.Kvmsg) + + poller := zmq.NewPoller() + poller.Add(collector, zmq.POLLIN) + poller.Add(snapshot, zmq.POLLIN) +LOOP: + for { + polled, err := poller.Poll(1000 * time.Millisecond) + if err != nil { + break + } + for _, item := range polled { + switch socket := item.Socket; socket { + case collector: + // Apply state update sent from client + kvmsg, err := kvsimple.RecvKvmsg(collector) + if err != nil { + break LOOP // Interrupted + } + sequence++ + kvmsg.SetSequence(sequence) + kvmsg.Send(publisher) + kvmsg.Store(kvmap) + fmt.Println("I: publishing update", sequence) + case snapshot: + // Execute state snapshot request + msg, err := snapshot.RecvMessage(0) + if err != nil { + break LOOP + } + identity := msg[0] + + // Request is in second frame of message + request := msg[1] + if request != "ICANHAZ?" { + fmt.Println("E: bad request, aborting") + break LOOP + } + // Send state snapshot to client + + // For each entry in kvmap, send kvmsg to client + for _, kvmsg := range kvmap { + snapshot.Send(identity, zmq.SNDMORE) + kvmsg.Send(snapshot) + } + + // Now send END message with sequence number + fmt.Println("I: sending shapshot =", sequence) + snapshot.Send(identity, zmq.SNDMORE) + kvmsg := kvsimple.NewKvmsg(sequence) + kvmsg.SetKey("KTHXBAI") + kvmsg.SetBody("") + kvmsg.Send(snapshot) + } + } + } + fmt.Printf("Interrupted\n%d messages handled\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv4.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv4.go new file mode 100644 index 0000000..75aac84 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv4.go @@ -0,0 +1,91 @@ +// +// Clone server Model Four +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvsimple" + + "fmt" + "strings" + "time" +) + +// The main task is identical to clonesrv3 except for where it +// handles subtrees. + +func main() { + snapshot, _ := zmq.NewSocket(zmq.ROUTER) + snapshot.Bind("tcp://*:5556") + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:5557") + collector, _ := zmq.NewSocket(zmq.PULL) + collector.Bind("tcp://*:5558") + + // The body of the main task collects updates from clients and + // publishes them back out to clients: + + sequence := int64(0) + kvmap := make(map[string]*kvsimple.Kvmsg) + + poller := zmq.NewPoller() + poller.Add(collector, zmq.POLLIN) + poller.Add(snapshot, zmq.POLLIN) +LOOP: + for { + polled, err := poller.Poll(1000 * time.Millisecond) + if err != nil { + break + } + for _, item := range polled { + switch socket := item.Socket; socket { + case collector: + // Apply state update sent from client + kvmsg, err := kvsimple.RecvKvmsg(collector) + if err != nil { + break LOOP // Interrupted + } + sequence++ + kvmsg.SetSequence(sequence) + kvmsg.Send(publisher) + kvmsg.Store(kvmap) + fmt.Println("I: publishing update", sequence) + case snapshot: + // Execute state snapshot request + msg, err := snapshot.RecvMessage(0) + if err != nil { + break LOOP + } + identity := msg[0] + + // Request is in second frame of message + request := msg[1] + if request != "ICANHAZ?" { + fmt.Println("E: bad request, aborting") + break LOOP + } + subtree := msg[2] + // Send state snapshot to client + + // For each entry in kvmap, send kvmsg to client + for _, kvmsg := range kvmap { + if key, _ := kvmsg.GetKey(); strings.HasPrefix(key, subtree) { + snapshot.Send(identity, zmq.SNDMORE) + kvmsg.Send(snapshot) + } + } + + // Now send END message with sequence number + fmt.Println("I: sending shapshot =", sequence) + snapshot.Send(identity, zmq.SNDMORE) + kvmsg := kvsimple.NewKvmsg(sequence) + kvmsg.SetKey("KTHXBAI") + kvmsg.SetBody(subtree) + kvmsg.Send(snapshot) + } + } + } + fmt.Printf("Interrupted\n%d messages handled\n", sequence) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv5.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv5.go new file mode 100644 index 0000000..5c17ae7 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv5.go @@ -0,0 +1,152 @@ +// +// Clone server Model Five +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/kvmsg" + + "errors" + "fmt" + "log" + "strconv" + "strings" + "time" +) + +// Our server is defined by these properties +type clonesrv_t struct { + kvmap map[string]*kvmsg.Kvmsg // Key-value store + port int // Main port we're working on + sequence int64 // How many updates we're at + snapshot *zmq.Socket // Handle snapshot requests + publisher *zmq.Socket // Publish updates to clients + collector *zmq.Socket // Collect updates from clients +} + +func main() { + + srv := &clonesrv_t{ + port: 5556, + kvmap: make(map[string]*kvmsg.Kvmsg), + } + + // Set up our clone server sockets + srv.snapshot, _ = zmq.NewSocket(zmq.ROUTER) + srv.snapshot.Bind(fmt.Sprint("tcp://*:", srv.port)) + srv.publisher, _ = zmq.NewSocket(zmq.PUB) + srv.publisher.Bind(fmt.Sprint("tcp://*:", srv.port+1)) + srv.collector, _ = zmq.NewSocket(zmq.PULL) + srv.collector.Bind(fmt.Sprint("tcp://*:", srv.port+2)) + + // Register our handlers with reactor + reactor := zmq.NewReactor() + reactor.AddSocket(srv.snapshot, zmq.POLLIN, + func(e zmq.State) error { return snapshots(srv) }) + reactor.AddSocket(srv.collector, zmq.POLLIN, + func(e zmq.State) error { return collector(srv) }) + reactor.AddChannelTime(time.Tick(1000*time.Millisecond), 1, + func(v interface{}) error { return flush_ttl(srv) }) + + log.Println(reactor.Run(100 * time.Millisecond)) // precision: .1 seconds +} + +// This is the reactor handler for the snapshot socket; it accepts +// just the ICANHAZ? request and replies with a state snapshot ending +// with a KTHXBAI message: + +func snapshots(srv *clonesrv_t) (err error) { + + msg, err := srv.snapshot.RecvMessage(0) + if err != nil { + return + } + identity := msg[0] + + // Request is in second frame of message + request := msg[1] + if request != "ICANHAZ?" { + err = errors.New("E: bad request, aborting") + return + } + subtree := msg[2] + + // Send state socket to client + for _, kvmsg := range srv.kvmap { + if key, _ := kvmsg.GetKey(); strings.HasPrefix(key, subtree) { + srv.snapshot.Send(identity, zmq.SNDMORE) + kvmsg.Send(srv.snapshot) + } + } + + // Now send END message with sequence number + log.Println("I: sending shapshot =", srv.sequence) + srv.snapshot.Send(identity, zmq.SNDMORE) + kvmsg := kvmsg.NewKvmsg(srv.sequence) + kvmsg.SetKey("KTHXBAI") + kvmsg.SetBody(subtree) + kvmsg.Send(srv.snapshot) + + return +} + +// We store each update with a new sequence number, and if necessary, a +// time-to-live. We publish updates immediately on our publisher socket: + +func collector(srv *clonesrv_t) (err error) { + kvmsg, err := kvmsg.RecvKvmsg(srv.collector) + if err != nil { + return + } + + srv.sequence++ + kvmsg.SetSequence(srv.sequence) + kvmsg.Send(srv.publisher) + if ttls, e := kvmsg.GetProp("ttl"); e == nil { + // change duration into specific time, using the same property: ugly! + ttl, e := strconv.ParseInt(ttls, 10, 64) + if e != nil { + err = e + return + } + kvmsg.SetProp("ttl", fmt.Sprint(time.Now().Add(time.Duration(ttl)*time.Second).Unix())) + } + kvmsg.Store(srv.kvmap) + log.Println("I: publishing update =", srv.sequence) + + return +} + +// At regular intervals we flush ephemeral values that have expired. This +// could be slow on very large data sets: + +func flush_ttl(srv *clonesrv_t) (err error) { + + for _, kvmsg := range srv.kvmap { + + // If key-value pair has expired, delete it and publish the + // fact to listening clients. + + if ttls, e := kvmsg.GetProp("ttl"); e == nil { + ttl, e := strconv.ParseInt(ttls, 10, 64) + if e != nil { + err = e + continue + } + if time.Now().After(time.Unix(ttl, 0)) { + srv.sequence++ + kvmsg.SetSequence(srv.sequence) + kvmsg.SetBody("") + e = kvmsg.Send(srv.publisher) + if e != nil { + err = e + } + kvmsg.Store(srv.kvmap) + log.Println("I: publishing delete =", srv.sequence) + } + } + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/clonesrv6.go b/vendor/github.com/pebbe/zmq4/examples/clonesrv6.go new file mode 100644 index 0000000..9ee6729 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/clonesrv6.go @@ -0,0 +1,336 @@ +// +// Clone server Model Six +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/bstar" + "github.com/pebbe/zmq4/examples/kvmsg" + + "errors" + "fmt" + "log" + "os" + "strconv" + "strings" + "time" +) + +// Our server is defined by these properties +type clonesrv_t struct { + kvmap map[string]*kvmsg.Kvmsg // Key-value store + kvmap_init bool + bstar *bstar.Bstar // Bstar reactor core + sequence int64 // How many updates we're at + port int // Main port we're working on + peer int // Main port of our peer + publisher *zmq.Socket // Publish updates and hugz + collector *zmq.Socket // Collect updates from clients + subscriber *zmq.Socket // Get updates from peer + pending []*kvmsg.Kvmsg // Pending updates from clients + primary bool // TRUE if we're primary + active bool // TRUE if we're active + passive bool // TRUE if we're passive +} + +// The main task parses the command line to decide whether to start +// as primary or backup server. We're using the Binary Star pattern +// for reliability. This interconnects the two servers so they can +// agree on which is primary, and which is backup. To allow the two +// servers to run on the same box, we use different ports for primary +// and backup. Ports 5003/5004 are used to interconnect the servers. +// Ports 5556/5566 are used to receive voting events (snapshot requests +// in the clone pattern). Ports 5557/5567 are used by the publisher, +// and ports 5558/5568 by the collector: + +func main() { + var err error + + srv := &clonesrv_t{} + + if len(os.Args) == 2 && os.Args[1] == "-p" { + log.Println("I: primary active, waiting for backup (passive)") + srv.bstar, err = bstar.New(bstar.PRIMARY, "tcp://*:5003", "tcp://localhost:5004") + if err != nil { + log.Println(err) + return + } + srv.bstar.Voter("tcp://*:5556", zmq.ROUTER, func(soc *zmq.Socket) error { return snapshots(soc, srv) }) + srv.port = 5556 + srv.peer = 5566 + srv.primary = true + } else if len(os.Args) == 2 && os.Args[1] == "-b" { + log.Println("I: backup passive, waiting for primary (active)") + srv.bstar, err = bstar.New(bstar.BACKUP, "tcp://*:5004", "tcp://localhost:5003") + srv.bstar.Voter("tcp://*:5566", zmq.ROUTER, func(soc *zmq.Socket) error { return snapshots(soc, srv) }) + srv.port = 5566 + srv.peer = 5556 + srv.primary = false + } else { + fmt.Println("Usage: clonesrv4 { -p | -b }") + return + } + // Primary server will become first active + if srv.primary { + srv.kvmap = make(map[string]*kvmsg.Kvmsg, 0) + srv.kvmap_init = true + } + + srv.pending = make([]*kvmsg.Kvmsg, 0) + srv.bstar.SetVerbose(true) + + // Set up our clone server sockets + srv.publisher, _ = zmq.NewSocket(zmq.PUB) + srv.collector, _ = zmq.NewSocket(zmq.SUB) + srv.collector.SetSubscribe("") + srv.publisher.Bind(fmt.Sprint("tcp://*:", srv.port+1)) + srv.collector.Bind(fmt.Sprint("tcp://*:", srv.port+2)) + + // Set up our own clone client interface to peer + srv.subscriber, _ = zmq.NewSocket(zmq.SUB) + srv.subscriber.SetSubscribe("") + srv.subscriber.Connect(fmt.Sprint("tcp://localhost:", srv.peer+1)) + + // After we've set-up our sockets we register our binary star + // event handlers, and then start the bstar reactor. This finishes + // when the user presses Ctrl-C, or the process receives a SIGINT + // interrupt: + + // Register state change handlers + srv.bstar.NewActive(func() error { return new_active(srv) }) + srv.bstar.NewPassive(func() error { return new_passive(srv) }) + + // Register our other handlers with the bstar reactor + srv.bstar.Reactor.AddSocket(srv.collector, zmq.POLLIN, + func(e zmq.State) error { return collector(srv) }) + srv.bstar.Reactor.AddChannelTime(time.Tick(1000*time.Millisecond), 1, + func(i interface{}) error { + if e := flush_ttl(srv); e != nil { + return e + } + return send_hugz(srv) + }) + + err = srv.bstar.Start() + log.Println(err) +} + +func snapshots(socket *zmq.Socket, srv *clonesrv_t) (err error) { + + msg, err := socket.RecvMessage(0) + if err != nil { + return + } + identity := msg[0] + + // Request is in second frame of message + request := msg[1] + if request != "ICANHAZ?" { + err = errors.New("E: bad request, aborting") + return + } + subtree := msg[2] + + // Send state socket to client + for _, kvmsg := range srv.kvmap { + if key, _ := kvmsg.GetKey(); strings.HasPrefix(key, subtree) { + socket.Send(identity, zmq.SNDMORE) + kvmsg.Send(socket) + } + } + + // Now send END message with sequence number + log.Println("I: sending shapshot =", srv.sequence) + socket.Send(identity, zmq.SNDMORE) + kvmsg := kvmsg.NewKvmsg(srv.sequence) + kvmsg.SetKey("KTHXBAI") + kvmsg.SetBody(subtree) + kvmsg.Send(socket) + + return +} + +// The collector is more complex than in the clonesrv5 example since how +// process updates depends on whether we're active or passive. The active +// applies them immediately to its kvmap, whereas the passive queues them +// as pending: + +// If message was already on pending list, remove it and return TRUE, +// else return FALSE. + +func (srv *clonesrv_t) was_pending(kvmsg *kvmsg.Kvmsg) bool { + uuid1, _ := kvmsg.GetUuid() + for i, msg := range srv.pending { + if uuid2, _ := msg.GetUuid(); uuid1 == uuid2 { + srv.pending = append(srv.pending[:i], srv.pending[i+1:]...) + return true + } + } + return false +} + +func collector(srv *clonesrv_t) (err error) { + + kvmsg, err := kvmsg.RecvKvmsg(srv.collector) + if err != nil { + return + } + + if srv.active { + srv.sequence++ + kvmsg.SetSequence(srv.sequence) + kvmsg.Send(srv.publisher) + if ttls, e := kvmsg.GetProp("ttl"); e == nil { + ttl, e := strconv.ParseInt(ttls, 10, 64) + if e != nil { + err = e + return + } + kvmsg.SetProp("ttl", fmt.Sprint(time.Now().Add(time.Duration(ttl)*time.Second).Unix())) + } + kvmsg.Store(srv.kvmap) + log.Println("I: publishing update =", srv.sequence) + } else { + // If we already got message from active, drop it, else + // hold on pending list + if !srv.was_pending(kvmsg) { + srv.pending = append(srv.pending, kvmsg) + } + } + return +} + +// We purge ephemeral values using exactly the same code as in +// the previous clonesrv5 example. +// If key-value pair has expired, delete it and publish the +// fact to listening clients. + +func flush_ttl(srv *clonesrv_t) (err error) { + for _, kvmsg := range srv.kvmap { + + // If key-value pair has expired, delete it and publish the + // fact to listening clients. + + if ttls, e := kvmsg.GetProp("ttl"); e == nil { + ttl, e := strconv.ParseInt(ttls, 10, 64) + if e != nil { + err = e + continue + } + if time.Now().After(time.Unix(ttl, 0)) { + srv.sequence++ + kvmsg.SetSequence(srv.sequence) + kvmsg.SetBody("") + e = kvmsg.Send(srv.publisher) + if e != nil { + err = e + } + kvmsg.Store(srv.kvmap) + log.Println("I: publishing delete =", srv.sequence) + } + } + } + return +} + +// // We send a HUGZ message once a second to all subscribers so that they +// // can detect if our server dies. They'll then switch over to the backup +// // server, which will become active: + +func send_hugz(srv *clonesrv_t) (err error) { + + kvmsg := kvmsg.NewKvmsg(srv.sequence) + kvmsg.SetKey("HUGZ") + kvmsg.SetBody("") + err = kvmsg.Send(srv.publisher) + return +} + +// When we switch from passive to active, we apply our pending list so that +// our kvmap is up-to-date. When we switch to passive, we wipe our kvmap +// and grab a new snapshot from the active: + +func new_active(srv *clonesrv_t) (err error) { + + srv.active = true + srv.passive = false + + // Stop subscribing to updates + srv.bstar.Reactor.RemoveSocket(srv.subscriber) + + // Apply pending list to own hash table + for _, msg := range srv.pending { + srv.sequence++ + msg.SetSequence(srv.sequence) + msg.Send(srv.publisher) + msg.Store(srv.kvmap) + fmt.Println("I: publishing pending =", srv.sequence) + } + srv.pending = srv.pending[0:0] + return +} + +func new_passive(srv *clonesrv_t) (err error) { + + srv.kvmap = make(map[string]*kvmsg.Kvmsg) + srv.kvmap_init = false + srv.active = false + srv.passive = true + + // Start subscribing to updates + srv.bstar.Reactor.AddSocket(srv.subscriber, zmq.POLLIN, + func(e zmq.State) error { return subscriber(srv) }) + + return +} + +// When we get an update, we create a new kvmap if necessary, and then +// add our update to our kvmap. We're always passive in this case: + +func subscriber(srv *clonesrv_t) (err error) { + // Get state snapshot if necessary + if !srv.kvmap_init { + srv.kvmap_init = true + snapshot, _ := zmq.NewSocket(zmq.DEALER) + snapshot.Connect(fmt.Sprint("tcp://localhost:", srv.peer)) + fmt.Printf("I: asking for snapshot from: tcp://localhost:%v\n", srv.peer) + snapshot.SendMessage("ICANHAZ?", "") // blank subtree to get all + for { + kvmsg, e := kvmsg.RecvKvmsg(snapshot) + if e != nil { + err = e + break + } + if key, _ := kvmsg.GetKey(); key == "KTHXBAI" { + srv.sequence, _ = kvmsg.GetSequence() + break // Done + } + kvmsg.Store(srv.kvmap) + } + fmt.Println("I: received snapshot =", srv.sequence) + } + // Find and remove update off pending list + kvmsg, e := kvmsg.RecvKvmsg(srv.subscriber) + if e != nil { + err = e + return + } + + if key, _ := kvmsg.GetKey(); key != "HUGZ" { + if !srv.was_pending(kvmsg) { + // If active update came before client update, flip it + // around, store active update (with sequence) on pending + // list and use to clear client update when it comes later + srv.pending = append(srv.pending, kvmsg) + } + // If update is more recent than our kvmap, apply it + if seq, _ := kvmsg.GetSequence(); seq > srv.sequence { + srv.sequence = seq + kvmsg.Store(srv.kvmap) + fmt.Println("I: received update =", srv.sequence) + } + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/eagain.go b/vendor/github.com/pebbe/zmq4/examples/eagain.go new file mode 100644 index 0000000..9245dba --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/eagain.go @@ -0,0 +1,28 @@ +// +// Shows how to provoke EAGAIN when reaching HWM +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + + mailbox, _ := zmq.NewSocket(zmq.DEALER) + mailbox.SetSndhwm(4) + mailbox.SetSndtimeo(0) + mailbox.Connect("tcp://localhost:9876") + + for count := 0; count < 10; count++ { + fmt.Println("Sending message", count) + _, err := mailbox.SendMessage(fmt.Sprint("message ", count)) + if err != nil { + fmt.Println(err) + break + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/espresso.go b/vendor/github.com/pebbe/zmq4/examples/espresso.go new file mode 100644 index 0000000..9951bd9 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/espresso.go @@ -0,0 +1,89 @@ +// +// Espresso Pattern +// This shows how to capture data using a pub-sub proxy +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +// The subscriber thread requests messages starting with +// A and B, then reads and counts incoming messages. + +func subscriber_thread() { + // Subscribe to "A" and "B" + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.Connect("tcp://localhost:6001") + subscriber.SetSubscribe("A") + subscriber.SetSubscribe("B") + defer subscriber.Close() // cancel subscribe + + for count := 0; count < 5; count++ { + _, err := subscriber.RecvMessage(0) + if err != nil { + break // Interrupted + } + } +} + +// The publisher sends random messages starting with A-J: + +func publisher_thread() { + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:6000") + + for { + s := fmt.Sprintf("%c-%05d", rand.Intn(10)+'A', rand.Intn(100000)) + _, err := publisher.SendMessage(s) + if err != nil { + break // Interrupted + } + time.Sleep(100 * time.Millisecond) // Wait for 1/10th second + } +} + +// The listener receives all messages flowing through the proxy, on its +// pipe. In CZMQ, the pipe is a pair of ZMQ_PAIR sockets that connects +// attached child threads. In other languages your mileage may vary: + +func listener_thread() { + pipe, _ := zmq.NewSocket(zmq.PAIR) + pipe.Bind("inproc://pipe") + + // Print everything that arrives on pipe + for { + msg, err := pipe.RecvMessage(0) + if err != nil { + break // Interrupted + } + fmt.Printf("%q\n", msg) + } +} + +// The main task starts the subscriber and publisher, and then sets +// itself up as a listening proxy. The listener runs as a child thread: + +func main() { + // Start child threads + go publisher_thread() + go subscriber_thread() + go listener_thread() + + time.Sleep(100 * time.Millisecond) + + subscriber, _ := zmq.NewSocket(zmq.XSUB) + subscriber.Connect("tcp://localhost:6000") + publisher, _ := zmq.NewSocket(zmq.XPUB) + publisher.Bind("tcp://*:6001") + listener, _ := zmq.NewSocket(zmq.PAIR) + listener.Connect("inproc://pipe") + zmq.Proxy(subscriber, publisher, listener) + + fmt.Println("interrupted") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/fileio1.go b/vendor/github.com/pebbe/zmq4/examples/fileio1.go new file mode 100644 index 0000000..d6d4dc0 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/fileio1.go @@ -0,0 +1,98 @@ +// File Transfer model #1 +// +// In which the server sends the entire file to the client in +// large chunks with no attempt at flow control. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "io" + "os" +) + +const ( + CHUNK_SIZE = 250000 +) + +func client_thread(pipe chan<- string) { + dealer, _ := zmq.NewSocket(zmq.DEALER) + dealer.Connect("tcp://127.0.0.1:6000") + + dealer.Send("fetch", 0) + total := 0 // Total bytes received + chunks := 0 // Total chunks received + + for { + frame, err := dealer.RecvBytes(0) + if err != nil { + break // Shutting down, quit + } + chunks++ + size := len(frame) + total += size + if size == 0 { + break // Whole file received + } + } + fmt.Printf("%v chunks received, %v bytes\n", chunks, total) + pipe <- "OK" +} + +// The server thread reads the file from disk in chunks, and sends +// each chunk to the client as a separate message. We only have one +// test file, so open that once and then serve it out as needed: + +func server_thread() { + file, err := os.Open("testdata") + if err != nil { + panic(err) + } + + router, _ := zmq.NewSocket(zmq.ROUTER) + // Default HWM is 1000, which will drop messages here + // since we send more than 1,000 chunks of test data, + // so set an infinite HWM as a simple, stupid solution: + router.SetRcvhwm(0) + router.SetSndhwm(0) + router.Bind("tcp://*:6000") + for { + // First frame in each message is the sender identity + identity, err := router.Recv(0) + if err != nil { + break // Shutting down, quit + } + + // Second frame is "fetch" command + command, _ := router.Recv(0) + if command != "fetch" { + panic("command != \"fetch\"") + } + + chunk := make([]byte, CHUNK_SIZE) + for { + n, _ := io.ReadFull(file, chunk) + router.SendMessage(identity, chunk[:n]) + if n == 0 { + break // Always end with a zero-size frame + } + } + } + file.Close() +} + +// The main task starts the client and server threads; it's easier +// to test this as a single process with threads, than as multiple +// processes: + +func main() { + pipe := make(chan string) + + // Start child threads + go server_thread() + go client_thread(pipe) + // Loop until client tells us it's done + <-pipe +} diff --git a/vendor/github.com/pebbe/zmq4/examples/fileio2.go b/vendor/github.com/pebbe/zmq4/examples/fileio2.go new file mode 100644 index 0000000..7ca557d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/fileio2.go @@ -0,0 +1,98 @@ +// File Transfer model #2 +// +// In which the client requests each chunk individually, thus +// eliminating server queue overflows, but at a cost in speed. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" + "strconv" +) + +const ( + CHUNK_SIZE = 250000 +) + +func client_thread(pipe chan<- string) { + dealer, _ := zmq.NewSocket(zmq.DEALER) + dealer.Connect("tcp://127.0.0.1:6000") + + total := 0 // Total bytes received + chunks := 0 // Total chunks received + + for { + // Ask for next chunk + dealer.SendMessage("fetch", total, CHUNK_SIZE) + + chunk, err := dealer.RecvBytes(0) + if err != nil { + break // Shutting down, quit + } + chunks++ + size := len(chunk) + total += size + if size < CHUNK_SIZE { + break // Last chunk received; exit + } + } + fmt.Printf("%v chunks received, %v bytes\n", chunks, total) + pipe <- "OK" +} + +// The server thread waits for a chunk request from a client, +// reads that chunk and sends it back to the client: + +func server_thread() { + file, err := os.Open("testdata") + if err != nil { + panic(err) + } + + router, _ := zmq.NewSocket(zmq.ROUTER) + router.SetRcvhwm(1) + router.SetSndhwm(1) + router.Bind("tcp://*:6000") + for { + msg, err := router.RecvMessage(0) + if err != nil { + break // Shutting down, quit + } + // First frame in each message is the sender identity + identity := msg[0] + + // Second frame is "fetch" command + if msg[1] != "fetch" { + panic("command != \"fetch\"") + } + + // Third frame is chunk offset in file + offset, _ := strconv.ParseInt(msg[2], 10, 64) + + // Fourth frame is maximum chunk size + chunksz, _ := strconv.Atoi(msg[3]) + + // Read chunk of data from file + chunk := make([]byte, chunksz) + n, _ := file.ReadAt(chunk, offset) + + // Send resulting chunk to client + router.SendMessage(identity, chunk[:n]) + } + file.Close() +} + +// The main task is just the same as in the first model. + +func main() { + pipe := make(chan string) + + // Start child threads + go server_thread() + go client_thread(pipe) + // Loop until client tells us it's done + <-pipe +} diff --git a/vendor/github.com/pebbe/zmq4/examples/fileio3.go b/vendor/github.com/pebbe/zmq4/examples/fileio3.go new file mode 100644 index 0000000..6bc0353 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/fileio3.go @@ -0,0 +1,111 @@ +// File Transfer model #3 +// +// In which the client requests each chunk individually, using +// command pipelining to give us a credit-based flow control. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" + "strconv" +) + +const ( + CHUNK_SIZE = 250000 + PIPELINE = 10 +) + +func client_thread(pipe chan<- string) { + dealer, _ := zmq.NewSocket(zmq.DEALER) + dealer.Connect("tcp://127.0.0.1:6000") + + // Up to this many chunks in transit + credit := PIPELINE + + total := 0 // Total bytes received + chunks := 0 // Total chunks received + offset := 0 // Offset of next chunk request + + for { + for credit > 0 { + // Ask for next chunk + dealer.SendMessage("fetch", offset, CHUNK_SIZE) + offset += CHUNK_SIZE + credit-- + } + chunk, err := dealer.RecvBytes(0) + if err != nil { + break // Shutting down, quit + } + chunks++ + credit++ + size := len(chunk) + total += size + if size < CHUNK_SIZE { + break // Last chunk received; exit + } + } + fmt.Printf("%v chunks received, %v bytes\n", chunks, total) + pipe <- "OK" +} + +// The rest of the code is exactly the same as in model 2, except +// that we set the HWM on the server's ROUTER socket to PIPELINE +// to act as a sanity check. + +// The server thread waits for a chunk request from a client, +// reads that chunk and sends it back to the client: + +func server_thread() { + file, err := os.Open("testdata") + if err != nil { + panic(err) + } + + router, _ := zmq.NewSocket(zmq.ROUTER) + router.SetRcvhwm(PIPELINE * 2) + router.SetSndhwm(PIPELINE * 2) + router.Bind("tcp://*:6000") + for { + msg, err := router.RecvMessage(0) + if err != nil { + break // Shutting down, quit + } + // First frame in each message is the sender identity + identity := msg[0] + + // Second frame is "fetch" command + if msg[1] != "fetch" { + panic("command != \"fetch\"") + } + + // Third frame is chunk offset in file + offset, _ := strconv.ParseInt(msg[2], 10, 64) + + // Fourth frame is maximum chunk size + chunksz, _ := strconv.Atoi(msg[3]) + + // Read chunk of data from file + chunk := make([]byte, chunksz) + n, _ := file.ReadAt(chunk, offset) + + // Send resulting chunk to client + router.SendMessage(identity, chunk[:n]) + } + file.Close() +} + +// The main task is just the same as in the first model. + +func main() { + pipe := make(chan string) + + // Start child threads + go server_thread() + go client_thread(pipe) + // Loop until client tells us it's done + <-pipe +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flcliapi/flcliapi.go b/vendor/github.com/pebbe/zmq4/examples/flcliapi/flcliapi.go new file mode 100644 index 0000000..a6787fb --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flcliapi/flcliapi.go @@ -0,0 +1,268 @@ +// flcliapi - Freelance Pattern agent class. +// Implements the Freelance Protocol at http://rfc.zeromq.org/spec:10. +package flcliapi + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strconv" + "time" +) + +const ( + // If no server replies within this time, abandon request + GLOBAL_TIMEOUT = 3000 * time.Millisecond + // PING interval for servers we think are alive + PING_INTERVAL = 2000 * time.Millisecond + // Server considered dead if silent for this long + SERVER_TTL = 6000 * time.Millisecond +) + +// This API works in two halves, a common pattern for APIs that need to +// run in the background. One half is an front-end object our application +// creates and works with; the other half is a back-end "agent" that runs +// in a background thread. The front-end talks to the back-end over an +// inproc pipe socket: + +// --------------------------------------------------------------------- +// Structure of our front-end class + +type Flcliapi struct { + pipe *zmq.Socket // Pipe through to flcliapi agent +} + +// This is the thread that handles our real flcliapi class + +// --------------------------------------------------------------------- +// Constructor + +func New() (flcliapi *Flcliapi) { + flcliapi = &Flcliapi{} + flcliapi.pipe, _ = zmq.NewSocket(zmq.PAIR) + flcliapi.pipe.Bind("inproc://pipe") + go flcliapi_agent() + return +} + +// To implement the connect method, the front-end object sends a multi-part +// message to the back-end agent. The first part is a string "CONNECT", and +// the second part is the endpoint. It waits 100msec for the connection to +// come up, which isn't pretty, but saves us from sending all requests to a +// single server, at start-up time: + +func (flcliapi *Flcliapi) Connect(endpoint string) { + flcliapi.pipe.SendMessage("CONNECT", endpoint) + time.Sleep(100 * time.Millisecond) // Allow connection to come up +} + +// To implement the request method, the front-end object sends a message +// to the back-end, specifying a command "REQUEST" and the request message: + +func (flcliapi *Flcliapi) Request(request []string) (reply []string, err error) { + flcliapi.pipe.SendMessage("REQUEST", request) + reply, err = flcliapi.pipe.RecvMessage(0) + if err == nil { + status := reply[0] + reply = reply[1:] + if status == "FAILED" { + reply = reply[0:0] + } + } + return +} + +// Here we see the back-end agent. It runs as an attached thread, talking +// to its parent over a pipe socket. It is a fairly complex piece of work +// so we'll break it down into pieces. First, the agent manages a set of +// servers, using our familiar class approach: + +// --------------------------------------------------------------------- +// Simple class for one server we talk to + +type server_t struct { + endpoint string // Server identity/endpoint + alive bool // true if known to be alive + ping_at time.Time // Next ping at this time + expires time.Time // Expires at this time +} + +func server_new(endpoint string) (server *server_t) { + server = &server_t{ + endpoint: endpoint, + alive: false, + ping_at: time.Now().Add(PING_INTERVAL), + expires: time.Now().Add(SERVER_TTL), + } + return +} + +func (server *server_t) ping(socket *zmq.Socket) { + if time.Now().After(server.ping_at) { + socket.SendMessage(server.endpoint, "PING") + server.ping_at = time.Now().Add(PING_INTERVAL) + } +} + +func (server *server_t) tickless(t time.Time) time.Time { + if t.After(server.ping_at) { + return server.ping_at + } + return t +} + +// We build the agent as a class that's capable of processing messages +// coming in from its various sockets: + +// --------------------------------------------------------------------- +// Simple class for one background agent + +type agent_t struct { + pipe *zmq.Socket // Socket to talk back to application + router *zmq.Socket // Socket to talk to servers + servers map[string]*server_t // Servers we've connected to + actives []*server_t // Servers we know are alive + sequence int // Number of requests ever sent + request []string // Current request if any + reply []string // Current reply if any + expires time.Time // Timeout for request/reply +} + +func agent_new() (agent *agent_t) { + agent = &agent_t{ + servers: make(map[string]*server_t), + actives: make([]*server_t, 0), + request: make([]string, 0), + reply: make([]string, 0), + } + agent.pipe, _ = zmq.NewSocket(zmq.PAIR) + agent.pipe.Connect("inproc://pipe") + agent.router, _ = zmq.NewSocket(zmq.ROUTER) + return +} + +// The control_message method processes one message from our front-end +// class (it's going to be CONNECT or REQUEST): + +func (agent *agent_t) control_message() { + msg, _ := agent.pipe.RecvMessage(0) + command := msg[0] + msg = msg[1:] + + switch command { + case "CONNECT": + endpoint := msg[0] + fmt.Printf("I: connecting to %s...\n", endpoint) + err := agent.router.Connect(endpoint) + if err != nil { + panic("agent.router.Connect(endpoint) failed") + } + server := server_new(endpoint) + agent.servers[endpoint] = server + agent.actives = append(agent.actives, server) + server.ping_at = time.Now().Add(PING_INTERVAL) + server.expires = time.Now().Add(SERVER_TTL) + case "REQUEST": + if len(agent.request) > 0 { + panic("len(agent.request) > 0") // Strict request-reply cycle + } + // Prefix request with sequence number --(and empty envelope)-- + agent.request = make([]string, 1, 1+len(msg)) + agent.sequence++ + agent.request[0] = fmt.Sprint(agent.sequence) + agent.request = append(agent.request, msg...) + // Request expires after global timeout + agent.expires = time.Now().Add(GLOBAL_TIMEOUT) + } +} + +// The router_message method processes one message from a connected +// server: + +func (agent *agent_t) router_message() { + reply, _ := agent.router.RecvMessage(0) + + // Frame 0 is server that replied + endpoint := reply[0] + reply = reply[1:] + server, ok := agent.servers[endpoint] + if !ok { + panic("No server for endpoint") + } + if !server.alive { + agent.actives = append(agent.actives, server) + server.alive = true + } + server.ping_at = time.Now().Add(PING_INTERVAL) + server.expires = time.Now().Add(SERVER_TTL) + + // Frame 1 may be sequence number for reply + sequence, _ := strconv.Atoi(reply[0]) + reply = reply[1:] + if sequence == agent.sequence { + agent.pipe.SendMessage("OK", reply) + agent.request = agent.request[0:0] + } +} + +// Finally here's the agent task itself, which polls its two sockets +// and processes incoming messages: + +func flcliapi_agent() { + + agent := agent_new() + + poller := zmq.NewPoller() + poller.Add(agent.pipe, zmq.POLLIN) + poller.Add(agent.router, zmq.POLLIN) + for { + // Calculate tickless timer, up to 1 hour + tickless := time.Now().Add(time.Hour) + if len(agent.request) > 0 && tickless.After(agent.expires) { + tickless = agent.expires + } + for key := range agent.servers { + tickless = agent.servers[key].tickless(tickless) + } + + polled, err := poller.Poll(tickless.Sub(time.Now())) + if err != nil { + break // Context has been shut down + } + + for _, item := range polled { + switch item.Socket { + case agent.pipe: + agent.control_message() + case agent.router: + agent.router_message() + } + } + + // If we're processing a request, dispatch to next server + if len(agent.request) > 0 { + if time.Now().After(agent.expires) { + // Request expired, kill it + agent.pipe.SendMessage("FAILED") + agent.request = agent.request[0:0] + } else { + // Find server to talk to, remove any expired ones + for len(agent.actives) > 0 { + server := agent.actives[0] + if time.Now().After(server.expires) { + agent.actives = agent.actives[1:] + server.alive = false + } else { + agent.router.SendMessage(server.endpoint, agent.request) + break + } + } + } + } + // --(Disconnect and delete any expired servers)-- + // Send heartbeats to idle servers if needed + for key := range agent.servers { + agent.servers[key].ping(agent.router) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flclient1.go b/vendor/github.com/pebbe/zmq4/examples/flclient1.go new file mode 100644 index 0000000..b24c756 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flclient1.go @@ -0,0 +1,77 @@ +// +// Freelance client - Model 1. +// Uses REQ socket to query one or more services +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "fmt" + "os" + "time" +) + +const ( + REQUEST_TIMEOUT = 1000 * time.Millisecond + MAX_RETRIES = 3 // Before we abandon +) + +func try_request(endpoint string, request []string) (reply []string, err error) { + fmt.Printf("I: trying echo service at %s...\n", endpoint) + client, _ := zmq.NewSocket(zmq.REQ) + client.Connect(endpoint) + + // Send request, wait safely for reply + client.SendMessage(request) + poller := zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + polled, err := poller.Poll(REQUEST_TIMEOUT) + reply = []string{} + if len(polled) == 1 { + reply, err = client.RecvMessage(0) + } else { + err = errors.New("Time out") + } + return +} + +// The client uses a Lazy Pirate strategy if it only has one server to talk +// to. If it has 2 or more servers to talk to, it will try each server just +// once: + +func main() { + request := []string{"Hello world"} + reply := []string{} + var err error + + endpoints := len(os.Args) - 1 + if endpoints == 0 { + fmt.Printf("I: syntax: %s ...\n", os.Args[0]) + } else if endpoints == 1 { + // For one endpoint, we retry N times + for retries := 0; retries < MAX_RETRIES; retries++ { + endpoint := os.Args[1] + reply, err = try_request(endpoint, request) + if err == nil { + break // Successful + } + fmt.Printf("W: no response from %s, retrying...\n", endpoint) + } + } else { + // For multiple endpoints, try each at most once + for endpoint_nbr := 0; endpoint_nbr < endpoints; endpoint_nbr++ { + endpoint := os.Args[endpoint_nbr+1] + reply, err = try_request(endpoint, request) + if err == nil { + break // Successful + } + fmt.Println("W: no response from", endpoint) + } + } + if len(reply) > 0 { + fmt.Printf("Service is running OK: %q\n", reply) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flclient2.go b/vendor/github.com/pebbe/zmq4/examples/flclient2.go new file mode 100644 index 0000000..13b3e85 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flclient2.go @@ -0,0 +1,118 @@ +// +// Freelance client - Model 2. +// Uses DEALER socket to blast one or more services +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "fmt" + "os" + "strconv" + "time" +) + +const ( + + // If not a single service replies within this time, give up + GLOBAL_TIMEOUT = 2500 * time.Millisecond +) + +func main() { + if len(os.Args) == 1 { + fmt.Printf("I: syntax: %s ...\n", os.Args[0]) + return + } + // Create new freelance client object + client := new_flclient() + + // Connect to each endpoint + for argn := 1; argn < len(os.Args); argn++ { + client.connect(os.Args[argn]) + } + + // Send a bunch of name resolution 'requests', measure time + start := time.Now() + for requests := 10000; requests > 0; requests-- { + _, err := client.request("random name") + if err != nil { + fmt.Println("E: name service not available, aborting") + break + } + } + fmt.Println("Average round trip cost:", time.Now().Sub(start)) +} + +// Here is the flclient class implementation. Each instance has +// a DEALER socket it uses to talk to the servers, a counter of how many +// servers it's connected to, and a request sequence number: + +type flclient_t struct { + socket *zmq.Socket // DEALER socket talking to servers + servers int // How many servers we have connected to + sequence int // Number of requests ever sent +} + +// -------------------------------------------------------------------- +// Constructor + +func new_flclient() (client *flclient_t) { + client = &flclient_t{} + + client.socket, _ = zmq.NewSocket(zmq.DEALER) + return +} + +// -------------------------------------------------------------------- +// Connect to new server endpoint + +func (client *flclient_t) connect(endpoint string) { + client.socket.Connect(endpoint) + client.servers++ +} + +// The request method does the hard work. It sends a request to all +// connected servers in parallel (for this to work, all connections +// have to be successful and completed by this time). It then waits +// for a single successful reply, and returns that to the caller. +// Any other replies are just dropped: + +func (client *flclient_t) request(request ...string) (reply []string, err error) { + reply = []string{} + + // Prefix request with sequence number and empty envelope + client.sequence++ + + // Blast the request to all connected servers + for server := 0; server < client.servers; server++ { + client.socket.SendMessage("", client.sequence, request) + } + // Wait for a matching reply to arrive from anywhere + // Since we can poll several times, calculate each one + endtime := time.Now().Add(GLOBAL_TIMEOUT) + poller := zmq.NewPoller() + poller.Add(client.socket, zmq.POLLIN) + for time.Now().Before(endtime) { + polled, err := poller.Poll(endtime.Sub(time.Now())) + if err == nil && len(polled) > 0 { + // Reply is [empty][sequence][OK] + reply, _ = client.socket.RecvMessage(0) + if len(reply) != 3 { + panic("len(reply) != 3") + } + sequence := reply[1] + reply = reply[2:] + sequence_nbr, _ := strconv.Atoi(sequence) + if sequence_nbr == client.sequence { + break + } + } + } + if len(reply) == 0 { + err = errors.New("No reply") + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flclient3.go b/vendor/github.com/pebbe/zmq4/examples/flclient3.go new file mode 100644 index 0000000..2956670 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flclient3.go @@ -0,0 +1,35 @@ +// +// Freelance client - Model 3. +// Uses flcliapi class to encapsulate Freelance pattern +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/flcliapi" + + "fmt" + "time" +) + +func main() { + // Create new freelance client object + client := flcliapi.New() + + // Connect to several endpoints + client.Connect("tcp://localhost:5555") + client.Connect("tcp://localhost:5556") + client.Connect("tcp://localhost:5557") + + // Send a bunch of name resolution 'requests', measure time + start := time.Now() + req := []string{"random name"} + for requests := 1000; requests > 0; requests-- { + _, err := client.Request(req) + if err != nil { + fmt.Println("E: name service not available, aborting") + break + } + } + fmt.Println("Average round trip cost:", time.Now().Sub(start)/1000) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flserver1.go b/vendor/github.com/pebbe/zmq4/examples/flserver1.go new file mode 100644 index 0000000..eb6cf57 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flserver1.go @@ -0,0 +1,32 @@ +// +// Freelance server - Model 1. +// Trivial echo service +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" +) + +func main() { + if len(os.Args) < 2 { + fmt.Printf("I: syntax: %s \n", os.Args[0]) + return + } + server, _ := zmq.NewSocket(zmq.REP) + server.Bind(os.Args[1]) + + fmt.Println("I: echo service is ready at", os.Args[1]) + for { + msg, err := server.RecvMessage(0) + if err != nil { + break // Interrupted + } + server.SendMessage(msg) + } + fmt.Println("W: interrupted") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flserver2.go b/vendor/github.com/pebbe/zmq4/examples/flserver2.go new file mode 100644 index 0000000..968d38a --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flserver2.go @@ -0,0 +1,39 @@ +// +// Freelance server - Model 2. +// Does some work, replies OK, with message sequencing +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" +) + +func main() { + if len(os.Args) < 2 { + fmt.Printf("I: syntax: %s \n", os.Args[0]) + return + } + server, _ := zmq.NewSocket(zmq.REP) + server.Bind(os.Args[1]) + + fmt.Println("I: service is ready at", os.Args[1]) + for { + request, err := server.RecvMessage(0) + if err != nil { + break // Interrupted + } + // Fail nastily if run against wrong client + if len(request) != 2 { + panic("len(request) != 2") + } + + identity := request[0] + + server.SendMessage(identity, "OK") + } + fmt.Println("W: interrupted") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/flserver3.go b/vendor/github.com/pebbe/zmq4/examples/flserver3.go new file mode 100644 index 0000000..f26d299 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/flserver3.go @@ -0,0 +1,57 @@ +// +// Freelance server - Model 3. +// Uses an ROUTER/ROUTER socket but just one thread +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" +) + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + + // Prepare server socket with predictable identity + bind_endpoint := "tcp://*:5555" + connect_endpoint := "tcp://localhost:5555" + server, _ := zmq.NewSocket(zmq.ROUTER) + server.SetIdentity(connect_endpoint) + server.Bind(bind_endpoint) + fmt.Println("I: service is ready at", bind_endpoint) + + for { + request, err := server.RecvMessage(0) + if err != nil { + break + } + if verbose { + fmt.Printf("%q\n", request) + } + + // Frame 0: identity of client + // Frame 1: PING, or client control frame + // Frame 2: request body + identity := request[0] + control := request[1] + reply := make([]string, 1, 3) + if control == "PING" { + reply = append(reply, "PONG") + } else { + reply = append(reply, control) + reply = append(reply, "OK") + } + reply[0] = identity + if verbose { + fmt.Printf("%q\n", reply) + } + server.SendMessage(reply) + } + fmt.Println("W: interrupted") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/hwclient.go b/vendor/github.com/pebbe/zmq4/examples/hwclient.go new file mode 100644 index 0000000..50148cd --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/hwclient.go @@ -0,0 +1,32 @@ +// +// Hello World client. +// Connects REQ socket to tcp://localhost:5555 +// Sends "Hello" to server, expects "World" back +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + // Socket to talk to server + fmt.Println("Connecting to hello world server...") + requester, _ := zmq.NewSocket(zmq.REQ) + defer requester.Close() + requester.Connect("tcp://localhost:5555") + + for request_nbr := 0; request_nbr != 10; request_nbr++ { + // send hello + msg := fmt.Sprintf("Hello %d", request_nbr) + fmt.Println("Sending ", msg) + requester.Send(msg, 0) + + // Wait for reply: + reply, _ := requester.Recv(0) + fmt.Println("Received ", reply) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/hwserver.go b/vendor/github.com/pebbe/zmq4/examples/hwserver.go new file mode 100644 index 0000000..e0e9aa5 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/hwserver.go @@ -0,0 +1,35 @@ +// +// Hello World server. +// Binds REP socket to tcp://*:5555 +// Expects "Hello" from client, replies with "World" +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + // Socket to talk to clients + responder, _ := zmq.NewSocket(zmq.REP) + defer responder.Close() + responder.Bind("tcp://*:5555") + + for { + // Wait for next request from client + msg, _ := responder.Recv(0) + fmt.Println("Received ", msg) + + // Do some 'work' + time.Sleep(time.Second) + + // Send reply back to client + reply := "World" + responder.Send(reply, 0) + fmt.Println("Sent ", reply) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/identity.go b/vendor/github.com/pebbe/zmq4/examples/identity.go new file mode 100644 index 0000000..2db47e3 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/identity.go @@ -0,0 +1,62 @@ +// +// Demonstrate identities as used by the request-reply pattern. +// Run this program by itself. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "regexp" +) + +var ( + all_char = regexp.MustCompile("^[^[:cntrl:]]*$") +) + +func main() { + sink, _ := zmq.NewSocket(zmq.ROUTER) + defer sink.Close() + sink.Bind("inproc://example") + + // First allow 0MQ to set the identity + anonymous, _ := zmq.NewSocket(zmq.REQ) + defer anonymous.Close() + anonymous.Connect("inproc://example") + anonymous.Send("ROUTER uses a generated UUID", 0) + dump(sink) + + // Then set the identity ourselves + identified, _ := zmq.NewSocket(zmq.REQ) + defer identified.Close() + identified.SetIdentity("PEER2") + identified.Connect("inproc://example") + identified.Send("ROUTER socket uses REQ's socket identity", 0) + dump(sink) +} + +func dump(soc *zmq.Socket) { + fmt.Println("----------------------------------------") + for { + // Process all parts of the message + message, _ := soc.Recv(0) + + // Dump the message as text or binary + fmt.Printf("[%03d] ", len(message)) + if all_char.MatchString(message) { + fmt.Print(message) + } else { + for i := 0; i < len(message); i++ { + fmt.Printf("%02X ", message[i]) + } + } + fmt.Println() + + more, _ := soc.GetRcvmore() + if !more { + break + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/interrupt.go b/vendor/github.com/pebbe/zmq4/examples/interrupt.go new file mode 100644 index 0000000..5323847 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/interrupt.go @@ -0,0 +1,58 @@ +// WARNING: This won't build on Windows and Plan9. + +// +// Handling Ctrl-C cleanly in C. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "os" + "os/signal" + "syscall" + "time" +) + +func main() { + // Socket to talk to server + fmt.Println("Connecting to hello world server...") + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + client.Connect("tcp://localhost:5555") + + // Without signal handling, Go will exit on signal, even if the signal was caught by ZeroMQ + chSignal := make(chan os.Signal, 1) + signal.Notify(chSignal, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM) + +LOOP: + for { + client.Send("HELLO", 0) + fmt.Println("Sent: HELLO") + reply, err := client.Recv(0) + if err != nil { + if zmq.AsErrno(err) == zmq.Errno(syscall.EINTR) { + // signal was caught by 0MQ + log.Println("Client Recv:", err) + break + } else { + // some error occurred + log.Panicln(err) + } + } + + fmt.Println("Received:", reply) + time.Sleep(time.Second) + + select { + case sig := <-chSignal: + // signal was caught by Go + log.Println("Signal:", sig) + break LOOP + default: + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/intface/intface.go b/vendor/github.com/pebbe/zmq4/examples/intface/intface.go new file mode 100644 index 0000000..7bab494 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/intface/intface.go @@ -0,0 +1,254 @@ +// Interface class for Chapter 8. +// This implements an "interface" to our network of nodes. +package intface + +import ( + zmq "github.com/pebbe/zmq4" + + "github.com/pborman/uuid" + + "bytes" + "errors" + "net" + "time" +) + +// ===================================================================== +// Synchronous part, works in our application thread + +// --------------------------------------------------------------------- +// Structure of our class + +type Intface struct { + pipe *zmq.Socket // Pipe through to agent +} + +// This is the thread that handles our real interface class + +// Here is the constructor for the interface class. +// Note that the class has barely any properties, it is just an excuse +// to start the background thread, and a wrapper around zmsg_recv(): + +func New() (iface *Intface) { + iface = &Intface{} + var err error + iface.pipe, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + panic(err) + } + err = iface.pipe.Bind("inproc://iface") + if err != nil { + panic(err) + } + go iface.agent() + time.Sleep(100 * time.Millisecond) + return +} + +// Here we wait for a message from the interface. This returns +// us a []string, or error if interrupted: + +func (iface *Intface) Recv() (msg []string, err error) { + msg, err = iface.pipe.RecvMessage(0) + return +} + +// ===================================================================== +// // Asynchronous part, works in the background + +// This structure defines each peer that we discover and track: + +type peer_t struct { + uuid_bytes []byte + uuid_string string + expires_at time.Time +} + +const ( + PING_PORT_NUMBER = 9999 + PING_INTERVAL = 1000 * time.Millisecond // Once per second + PEER_EXPIRY = 5000 * time.Millisecond // Five seconds and it's gone +) + +// We have a constructor for the peer class: + +func new_peer(uuid uuid.UUID) (peer *peer_t) { + peer = &peer_t{ + uuid_bytes: []byte(uuid), + uuid_string: uuid.String(), + } + return +} + +// Just resets the peers expiry time; we call this method +// whenever we get any activity from a peer. + +func (peer *peer_t) is_alive() { + peer.expires_at = time.Now().Add(PEER_EXPIRY) +} + +// This structure holds the context for our agent, so we can +// pass that around cleanly to methods which need it: + +type agent_t struct { + pipe *zmq.Socket // Pipe back to application + udp *zmq.Socket + conn *net.UDPConn + uuid_bytes []byte // Our UUID + uuid_string string + peers map[string]*peer_t // Hash of known peers, fast lookup +} + +// Now the constructor for our agent. Each interface +// has one agent object, which implements its background thread: + +func new_agent() (agent *agent_t) { + + // push output from udp into zmq socket + bcast := &net.UDPAddr{Port: PING_PORT_NUMBER, IP: net.IPv4bcast} + conn, e := net.ListenUDP("udp", bcast) + if e != nil { + panic(e) + } + go func() { + buffer := make([]byte, 1024) + udp, _ := zmq.NewSocket(zmq.PAIR) + udp.Bind("inproc://udp") + for { + if n, _, err := conn.ReadFrom(buffer); err == nil { + udp.SendBytes(buffer[:n], 0) + } + } + }() + time.Sleep(100 * time.Millisecond) + + pipe, _ := zmq.NewSocket(zmq.PAIR) + pipe.Connect("inproc://iface") + udp, _ := zmq.NewSocket(zmq.PAIR) + udp.Connect("inproc://udp") + + uuid := uuid.NewRandom() + agent = &agent_t{ + pipe: pipe, + udp: udp, + conn: conn, + uuid_bytes: []byte(uuid), + uuid_string: uuid.String(), + peers: make(map[string]*peer_t), + } + + return +} + +// Here we handle the different control messages from the front-end. + +func (agent *agent_t) control_message() (err error) { + // Get the whole message off the pipe in one go + msg, e := agent.pipe.RecvMessage(0) + if e != nil { + return e + } + command := msg[0] + + // We don't actually implement any control commands yet + // but if we did, this would be where we did it.. + switch command { + case "EXAMPLE": + default: + } + + return +} + +// This is how we handle a beacon coming into our UDP socket; +// this may be from other peers or an echo of our own broadcast +// beacon: + +func (agent *agent_t) handle_beacon() (err error) { + + msg, err := agent.udp.RecvMessage(0) + if len(msg[0]) != 16 { + return errors.New("Not a uuid") + } + + // If we got a UUID and it's not our own beacon, we have a peer + uuid := uuid.UUID(msg[0]) + if bytes.Compare(uuid, agent.uuid_bytes) != 0 { + // Find or create peer via its UUID string + uuid_string := uuid.String() + peer, ok := agent.peers[uuid_string] + if !ok { + peer = new_peer(uuid) + agent.peers[uuid_string] = peer + + // Report peer joined the network + agent.pipe.SendMessage("JOINED", uuid_string) + } + // Any activity from the peer means it's alive + peer.is_alive() + } + return +} + +// This method checks one peer item for expiry; if the peer hasn't +// sent us anything by now, it's 'dead' and we can delete it: + +func (agent *agent_t) reap_peer(peer *peer_t) { + if time.Now().After(peer.expires_at) { + // Report peer left the network + agent.pipe.SendMessage("LEFT", peer.uuid_string) + delete(agent.peers, peer.uuid_string) + } +} + +// This is the main loop for the background agent. It uses zmq_poll +// to monitor the front-end pipe (commands from the API) and the +// back-end UDP handle (beacons): + +func (iface *Intface) agent() { + // Create agent instance to pass around + agent := new_agent() + + // Send first beacon immediately + ping_at := time.Now() + + poller := zmq.NewPoller() + poller.Add(agent.pipe, zmq.POLLIN) + poller.Add(agent.udp, zmq.POLLIN) + + bcast := &net.UDPAddr{Port: PING_PORT_NUMBER, IP: net.IPv4bcast} + for { + timeout := ping_at.Add(time.Millisecond).Sub(time.Now()) + if timeout < 0 { + timeout = 0 + } + polled, err := poller.Poll(timeout) + if err != nil { + break + } + + for _, item := range polled { + switch socket := item.Socket; socket { + case agent.pipe: + // If we had activity on the pipe, go handle the control + // message. Current code never sends control messages. + agent.control_message() + + case agent.udp: + // If we had input on the UDP socket, go process that + agent.handle_beacon() + } + } + + // If we passed the 1-second mark, broadcast our beacon + now := time.Now() + if now.After(ping_at) { + agent.conn.WriteTo(agent.uuid_bytes, bcast) + ping_at = now.Add(PING_INTERVAL) + } + // Delete and report any expired peers + for _, peer := range agent.peers { + agent.reap_peer(peer) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg.go b/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg.go new file mode 100644 index 0000000..d19e38d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg.go @@ -0,0 +1,262 @@ +// kvmsg class - key-value message class for example applications +package kvmsg + +import ( + zmq "github.com/pebbe/zmq4" + + "github.com/pborman/uuid" + + "errors" + "fmt" + "os" + "strings" +) + +// Message is formatted on wire as 4 frames: +// frame 0: key (0MQ string) +// frame 1: sequence (8 bytes, network order) +// frame 2: uuid (blob, 16 bytes) +// frame 3: properties (0MQ string) +// frame 4: body (blob) +const ( + frame_KEY = 0 + frame_SEQ = 1 + frame_UUID = 2 + frame_PROPS = 3 + frame_BODY = 4 + kvmsg_FRAMES = 5 +) + +// Structure of our class +type Kvmsg struct { + // Presence indicators for each frame + present []bool + // Corresponding 0MQ message frames, if any + frame []string + // List of properties, as name=value strings + props []string +} + +// These two helpers serialize a list of properties to and from a +// message frame: + +func (kvmsg *Kvmsg) encode_props() { + kvmsg.frame[frame_PROPS] = strings.Join(kvmsg.props, "\n") + "\n" + kvmsg.present[frame_PROPS] = true +} + +func (kvmsg *Kvmsg) decode_props() { + kvmsg.props = strings.Split(kvmsg.frame[frame_PROPS], "\n") + if ln := len(kvmsg.props); ln > 0 && kvmsg.props[ln-1] == "" { + kvmsg.props = kvmsg.props[:ln-1] + } +} + +// Constructor, takes a sequence number for the new Kvmsg instance. +func NewKvmsg(sequence int64) (kvmsg *Kvmsg) { + kvmsg = &Kvmsg{ + present: make([]bool, kvmsg_FRAMES), + frame: make([]string, kvmsg_FRAMES), + props: make([]string, 0), + } + kvmsg.SetSequence(sequence) + return +} + +// The RecvKvmsg function reads a key-value message from socket, and returns a new +// Kvmsg instance. +func RecvKvmsg(socket *zmq.Socket) (kvmsg *Kvmsg, err error) { + kvmsg = &Kvmsg{ + present: make([]bool, kvmsg_FRAMES), + frame: make([]string, kvmsg_FRAMES), + } + msg, err := socket.RecvMessage(0) + if err != nil { + return + } + //fmt.Printf("Recv from %s: %q\n", socket, msg) + for i := 0; i < kvmsg_FRAMES && i < len(msg); i++ { + kvmsg.frame[i] = msg[i] + kvmsg.present[i] = true + } + kvmsg.decode_props() + return +} + +// Send key-value message to socket; any empty frames are sent as such. +func (kvmsg *Kvmsg) Send(socket *zmq.Socket) (err error) { + //fmt.Printf("Send to %s: %q\n", socket, kvmsg.frame) + kvmsg.encode_props() + _, err = socket.SendMessage(kvmsg.frame) + return +} + +// The Dup method duplicates a kvmsg instance, returns the new instance. +func (kvmsg *Kvmsg) Dup() (dup *Kvmsg) { + dup = &Kvmsg{ + present: make([]bool, kvmsg_FRAMES), + frame: make([]string, kvmsg_FRAMES), + props: make([]string, len(kvmsg.props)), + } + copy(dup.present, kvmsg.present) + copy(dup.frame, kvmsg.frame) + copy(dup.props, kvmsg.props) + return +} + +// Return key from last read message, if any, else NULL +func (kvmsg *Kvmsg) GetKey() (key string, err error) { + if !kvmsg.present[frame_KEY] { + err = errors.New("Key not set") + return + } + key = kvmsg.frame[frame_KEY] + return +} + +func (kvmsg *Kvmsg) SetKey(key string) { + kvmsg.frame[frame_KEY] = key + kvmsg.present[frame_KEY] = true +} + +func (kvmsg *Kvmsg) GetSequence() (sequence int64, err error) { + if !kvmsg.present[frame_SEQ] { + err = errors.New("Sequence not set") + return + } + source := kvmsg.frame[frame_SEQ] + sequence = int64(source[0])<<56 + + int64(source[1])<<48 + + int64(source[2])<<40 + + int64(source[3])<<32 + + int64(source[4])<<24 + + int64(source[5])<<16 + + int64(source[6])<<8 + + int64(source[7]) + return +} + +func (kvmsg *Kvmsg) SetSequence(sequence int64) { + + source := make([]byte, 8) + source[0] = byte((sequence >> 56) & 255) + source[1] = byte((sequence >> 48) & 255) + source[2] = byte((sequence >> 40) & 255) + source[3] = byte((sequence >> 32) & 255) + source[4] = byte((sequence >> 24) & 255) + source[5] = byte((sequence >> 16) & 255) + source[6] = byte((sequence >> 8) & 255) + source[7] = byte((sequence) & 255) + + kvmsg.frame[frame_SEQ] = string(source) + kvmsg.present[frame_SEQ] = true +} + +func (kvmsg *Kvmsg) GetBody() (body string, err error) { + if !kvmsg.present[frame_BODY] { + err = errors.New("Body not set") + return + } + body = kvmsg.frame[frame_BODY] + return +} + +func (kvmsg *Kvmsg) SetBody(body string) { + kvmsg.frame[frame_BODY] = body + kvmsg.present[frame_BODY] = true +} + +// The size method returns the body size of the last-read message, if any. +func (kvmsg *Kvmsg) Size() int { + if kvmsg.present[frame_BODY] { + return len(kvmsg.frame[frame_BODY]) + } + return 0 +} + +func (kvmsg *Kvmsg) GetUuid() (uuid string, err error) { + if !kvmsg.present[frame_UUID] { + err = errors.New("Uuid not set") + return + } + uuid = kvmsg.frame[frame_UUID] + return +} + +// Sets the UUID to a random generated value +func (kvmsg *Kvmsg) SetUuid() { + kvmsg.frame[frame_UUID] = string(uuid.NewRandom()) // raw 16 bytes + kvmsg.present[frame_UUID] = true + +} + +// Get message property, return error if no such property is defined. +func (kvmsg *Kvmsg) GetProp(name string) (value string, err error) { + if !kvmsg.present[frame_PROPS] { + err = errors.New("No properties set") + return + } + f := name + "=" + for _, prop := range kvmsg.props { + if strings.HasPrefix(prop, f) { + value = prop[len(f):] + return + } + } + err = errors.New("Property not set") + return +} + +// Set message property. Property name cannot contain '='. +func (kvmsg *Kvmsg) SetProp(name, value string) (err error) { + if strings.Index(name, "=") >= 0 { + err = errors.New("No '=' allowed in property name") + return + } + p := name + "=" + for i, prop := range kvmsg.props { + if strings.HasPrefix(prop, p) { + kvmsg.props = append(kvmsg.props[:i], kvmsg.props[i+1:]...) + break + } + } + kvmsg.props = append(kvmsg.props, name+"="+value) + kvmsg.present[frame_PROPS] = true + return +} + +// The store method stores the key-value message into a hash map, unless +// the key is nil. +func (kvmsg *Kvmsg) Store(kvmap map[string]*Kvmsg) { + if kvmsg.present[frame_KEY] { + if kvmsg.present[frame_BODY] && kvmsg.frame[frame_BODY] != "" { + kvmap[kvmsg.frame[frame_KEY]] = kvmsg + } else { + delete(kvmap, kvmsg.frame[frame_KEY]) + } + } +} + +// The dump method extends the kvsimple implementation with support for +// message properties. +func (kvmsg *Kvmsg) Dump() { + size := kvmsg.Size() + body, _ := kvmsg.GetBody() + seq, _ := kvmsg.GetSequence() + key, _ := kvmsg.GetKey() + fmt.Fprintf(os.Stderr, "[seq:%v][key:%v][size:%v] ", seq, key, size) + p := "[" + for _, prop := range kvmsg.props { + fmt.Fprint(os.Stderr, p, prop) + p = ";" + } + if p == ";" { + fmt.Fprint(os.Stderr, "]") + } + for char_nbr := 0; char_nbr < size; char_nbr++ { + fmt.Fprintf(os.Stderr, "%02X", body[char_nbr]) + } + fmt.Fprintln(os.Stderr) +} + +// The test function is in kvmsg_test.go diff --git a/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg_test.go b/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg_test.go new file mode 100644 index 0000000..e2dbb0b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/kvmsg/kvmsg_test.go @@ -0,0 +1,108 @@ +package kvmsg + +import ( + zmq "github.com/pebbe/zmq4" + + "os" + "testing" +) + +// The test is the same as in kvsimple with added support +// for the uuid and property features of kvmsg + +func TestKvmsg(t *testing.T) { + + // Prepare our context and sockets + output, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Error(err) + } + + err = output.Bind("ipc://kvmsg_selftest.ipc") + if err != nil { + t.Error(err) + } + + input, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Error(err) + } + + err = input.Connect("ipc://kvmsg_selftest.ipc") + if err != nil { + t.Error(err) + } + + kvmap := make(map[string]*Kvmsg) + + // Test send and receive of simple message + kvmsg := NewKvmsg(1) + kvmsg.SetKey("key") + kvmsg.SetUuid() + kvmsg.SetBody("body") + kvmsg.Dump() + err = kvmsg.Send(output) + + kvmsg.Store(kvmap) + if err != nil { + t.Error(err) + } + + kvmsg, err = RecvKvmsg(input) + if err != nil { + t.Error(err) + } + kvmsg.Dump() + key, err := kvmsg.GetKey() + if err != nil { + t.Error(err) + } + if key != "key" { + t.Error("Expected \"key\", got \"" + key + "\"") + } + kvmsg.Store(kvmap) + + // Test send and receive of message with properties + kvmsg = NewKvmsg(2) + err = kvmsg.SetProp("prop1", "value1") + if err != nil { + t.Error(err) + } + kvmsg.SetProp("prop2", "value1") + kvmsg.SetProp("prop2", "value2") + kvmsg.SetKey("key") + kvmsg.SetUuid() + kvmsg.SetBody("body") + if val, err := kvmsg.GetProp("prop2"); err != nil || val != "value2" { + if err != nil { + t.Error(err) + } + t.Error("Expected \"prop2\" = \"value2\", got \"" + val + "\"") + } + kvmsg.Dump() + err = kvmsg.Send(output) + + kvmsg, err = RecvKvmsg(input) + if err != nil { + t.Error(err) + } + kvmsg.Dump() + key, err = kvmsg.GetKey() + if err != nil { + t.Error(err) + } + if key != "key" { + t.Error("Expected \"key\", got \"" + key + "\"") + } + prop, err := kvmsg.GetProp("prop2") + if err != nil { + t.Error(err) + } + if prop != "value2" { + t.Error("Expected property \"value2\", got \"" + key + "\"") + } + + input.Close() + output.Close() + os.Remove("kvmsg_selftest.ipc") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple.go b/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple.go new file mode 100644 index 0000000..9efde5e --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple.go @@ -0,0 +1,157 @@ +// kvsimple - simple key-value message class for example applications. +// +// This is a very much unlike typical Go. +package kvsimple + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "fmt" + "os" +) + +const ( + frame_KEY = 0 + frame_SEQ = 1 + frame_BODY = 2 + kvmsg_FRAMES = 3 +) + +// The Kvmsg type holds a single key-value message consisting of a +// list of 0 or more frames. +type Kvmsg struct { + // Presence indicators for each frame + present []bool + // Corresponding 0MQ message frames, if any + frame []string +} + +// Constructor, takes a sequence number for the new Kvmsg instance. +func NewKvmsg(sequence int64) (kvmsg *Kvmsg) { + kvmsg = &Kvmsg{ + present: make([]bool, kvmsg_FRAMES), + frame: make([]string, kvmsg_FRAMES), + } + kvmsg.SetSequence(sequence) + return +} + +// The RecvKvmsg function reads a key-value message from socket, and returns a new +// Kvmsg instance. +func RecvKvmsg(socket *zmq.Socket) (kvmsg *Kvmsg, err error) { + kvmsg = &Kvmsg{ + present: make([]bool, kvmsg_FRAMES), + frame: make([]string, kvmsg_FRAMES), + } + msg, err := socket.RecvMessage(0) + if err != nil { + return + } + //fmt.Printf("Recv from %s: %q\n", socket, msg) + for i := 0; i < kvmsg_FRAMES && i < len(msg); i++ { + kvmsg.frame[i] = msg[i] + kvmsg.present[i] = true + } + return +} + +// The send method sends a multi-frame key-value message to a socket. +func (kvmsg *Kvmsg) Send(socket *zmq.Socket) (err error) { + //fmt.Printf("Send to %s: %q\n", socket, kvmsg.frame) + _, err = socket.SendMessage(kvmsg.frame) + return +} + +func (kvmsg *Kvmsg) GetKey() (key string, err error) { + if !kvmsg.present[frame_KEY] { + err = errors.New("Key not set") + return + } + key = kvmsg.frame[frame_KEY] + return +} + +func (kvmsg *Kvmsg) SetKey(key string) { + kvmsg.frame[frame_KEY] = key + kvmsg.present[frame_KEY] = true +} + +func (kvmsg *Kvmsg) GetSequence() (sequence int64, err error) { + if !kvmsg.present[frame_SEQ] { + err = errors.New("Sequence not set") + return + } + source := kvmsg.frame[frame_SEQ] + sequence = int64(source[0])<<56 + + int64(source[1])<<48 + + int64(source[2])<<40 + + int64(source[3])<<32 + + int64(source[4])<<24 + + int64(source[5])<<16 + + int64(source[6])<<8 + + int64(source[7]) + return +} + +func (kvmsg *Kvmsg) SetSequence(sequence int64) { + + source := make([]byte, 8) + source[0] = byte((sequence >> 56) & 255) + source[1] = byte((sequence >> 48) & 255) + source[2] = byte((sequence >> 40) & 255) + source[3] = byte((sequence >> 32) & 255) + source[4] = byte((sequence >> 24) & 255) + source[5] = byte((sequence >> 16) & 255) + source[6] = byte((sequence >> 8) & 255) + source[7] = byte((sequence) & 255) + + kvmsg.frame[frame_SEQ] = string(source) + kvmsg.present[frame_SEQ] = true +} + +func (kvmsg *Kvmsg) GetBody() (body string, err error) { + if !kvmsg.present[frame_BODY] { + err = errors.New("Body not set") + return + } + body = kvmsg.frame[frame_BODY] + return +} + +func (kvmsg *Kvmsg) SetBody(body string) { + kvmsg.frame[frame_BODY] = body + kvmsg.present[frame_BODY] = true +} + +// The size method returns the body size of the last-read message, if any. +func (kvmsg *Kvmsg) Size() int { + if kvmsg.present[frame_BODY] { + return len(kvmsg.frame[frame_BODY]) + } + return 0 +} + +// The store method stores the key-value message into a hash map, unless +// the key is nil. +func (kvmsg *Kvmsg) Store(kvmap map[string]*Kvmsg) { + if kvmsg.present[frame_KEY] { + kvmap[kvmsg.frame[frame_KEY]] = kvmsg + } +} + +// The dump method prints the key-value message to stderr, +// for debugging and tracing. +func (kvmsg *Kvmsg) Dump() { + size := kvmsg.Size() + body, _ := kvmsg.GetBody() + seq, _ := kvmsg.GetSequence() + key, _ := kvmsg.GetKey() + fmt.Fprintf(os.Stderr, "[seq:%v][key:%v][size:%v]", seq, key, size) + for char_nbr := 0; char_nbr < size; char_nbr++ { + fmt.Fprintf(os.Stderr, "%02X", body[char_nbr]) + } + fmt.Fprintln(os.Stderr) +} + +// The test function is in kvsimple_test.go diff --git a/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple_test.go b/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple_test.go new file mode 100644 index 0000000..6687ee0 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/kvsimple/kvsimple_test.go @@ -0,0 +1,64 @@ +package kvsimple + +import ( + zmq "github.com/pebbe/zmq4" + + "os" + "testing" +) + +func TestKvmsg(t *testing.T) { + + // Prepare our context and sockets + output, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Error(err) + } + + err = output.Bind("ipc://kvmsg_selftest.ipc") + if err != nil { + t.Error(err) + } + + input, err := zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Error(err) + } + + err = input.Connect("ipc://kvmsg_selftest.ipc") + if err != nil { + t.Error(err) + } + + kvmap := make(map[string]*Kvmsg) + + // Test send and receive of simple message + kvmsg := NewKvmsg(1) + kvmsg.SetKey("key") + kvmsg.SetBody("body") + kvmsg.Dump() + err = kvmsg.Send(output) + + kvmsg.Store(kvmap) + if err != nil { + t.Error(err) + } + + kvmsg, err = RecvKvmsg(input) + if err != nil { + t.Error(err) + } + kvmsg.Dump() + key, err := kvmsg.GetKey() + if err != nil { + t.Error(err) + } + if key != "key" { + t.Error("Expected \"key\", got \"" + key + "\"") + } + kvmsg.Store(kvmap) + + input.Close() + output.Close() + os.Remove("kvmsg_selftest.ipc") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/lbbroker.go b/vendor/github.com/pebbe/zmq4/examples/lbbroker.go new file mode 100644 index 0000000..e2c3ecd --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lbbroker.go @@ -0,0 +1,188 @@ +// +// Load-balancing broker. +// Clients and workers are shown here in-process +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + //"math/rand" + "time" +) + +const ( + NBR_CLIENTS = 10 + NBR_WORKERS = 3 +) + +// Basic request-reply client using REQ socket +// Since Go Send and Recv can handle 0MQ binary identities we +// don't need printable text identity to allow routing. + +func client_task() { + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + // set_id(client) // Set a printable identity + client.Connect("ipc://frontend.ipc") + + // Send request, get reply + client.Send("HELLO", 0) + reply, _ := client.Recv(0) + fmt.Println("Client:", reply) +} + +// While this example runs in a single process, that is just to make +// it easier to start and stop the example. +// This is the worker task, using a REQ socket to do load-balancing. +// Since Go Send and Recv can handle 0MQ binary identities we +// don't need printable text identity to allow routing. + +func worker_task() { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + // set_id(worker) + worker.Connect("ipc://backend.ipc") + + // Tell broker we're ready for work + worker.Send("READY", 0) + + for { + // Read and save all frames until we get an empty frame + // In this example there is only 1 but it could be more + identity, _ := worker.Recv(0) + empty, _ := worker.Recv(0) + if empty != "" { + panic(fmt.Sprintf("empty is not \"\": %q", empty)) + } + + // Get request, send reply + request, _ := worker.Recv(0) + fmt.Println("Worker:", request) + + worker.Send(identity, zmq.SNDMORE) + worker.Send("", zmq.SNDMORE) + worker.Send("OK", 0) + } +} + +// This is the main task. It starts the clients and workers, and then +// routes requests between the two layers. Workers signal READY when +// they start; after that we treat them as ready when they reply with +// a response back to a client. The load-balancing data structure is +// just a queue of next available workers. + +func main() { + // Prepare our sockets + frontend, _ := zmq.NewSocket(zmq.ROUTER) + backend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + defer backend.Close() + frontend.Bind("ipc://frontend.ipc") + backend.Bind("ipc://backend.ipc") + + client_nbr := 0 + for ; client_nbr < NBR_CLIENTS; client_nbr++ { + go client_task() + } + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task() + } + + // Here is the main loop for the least-recently-used queue. It has two + // sockets; a frontend for clients and a backend for workers. It polls + // the backend in all cases, and polls the frontend only when there are + // one or more workers ready. This is a neat way to use 0MQ's own queues + // to hold messages we're not ready to process yet. When we get a client + // reply, we pop the next available worker, and send the request to it, + // including the originating client identity. When a worker replies, we + // re-queue that worker, and we forward the reply to the original client, + // using the reply envelope. + + // Queue of available workers + worker_queue := make([]string, 0, 10) + + poller1 := zmq.NewPoller() + poller1.Add(backend, zmq.POLLIN) + poller2 := zmq.NewPoller() + poller2.Add(backend, zmq.POLLIN) + poller2.Add(frontend, zmq.POLLIN) + + for client_nbr > 0 { + // Poll frontend only if we have available workers + var sockets []zmq.Polled + if len(worker_queue) > 0 { + sockets, _ = poller2.Poll(-1) + } else { + sockets, _ = poller1.Poll(-1) + } + for _, socket := range sockets { + switch socket.Socket { + case backend: + + // Handle worker activity on backend + // Queue worker identity for load-balancing + worker_id, _ := backend.Recv(0) + if !(len(worker_queue) < NBR_WORKERS) { + panic("!(len(worker_queue) < NBR_WORKERS)") + } + worker_queue = append(worker_queue, worker_id) + + // Second frame is empty + empty, _ := backend.Recv(0) + if empty != "" { + panic(fmt.Sprintf("empty is not \"\": %q", empty)) + } + + // Third frame is READY or else a client reply identity + client_id, _ := backend.Recv(0) + + // If client reply, send rest back to frontend + if client_id != "READY" { + empty, _ := backend.Recv(0) + if empty != "" { + panic(fmt.Sprintf("empty is not \"\": %q", empty)) + } + reply, _ := backend.Recv(0) + frontend.Send(client_id, zmq.SNDMORE) + frontend.Send("", zmq.SNDMORE) + frontend.Send(reply, 0) + client_nbr-- + } + + case frontend: + // Here is how we handle a client request: + + // Now get next client request, route to last-used worker + // Client request is [identity][empty][request] + client_id, _ := frontend.Recv(0) + empty, _ := frontend.Recv(0) + if empty != "" { + panic(fmt.Sprintf("empty is not \"\": %q", empty)) + } + request, _ := frontend.Recv(0) + + backend.Send(worker_queue[0], zmq.SNDMORE) + backend.Send("", zmq.SNDMORE) + backend.Send(client_id, zmq.SNDMORE) + backend.Send("", zmq.SNDMORE) + backend.Send(request, 0) + + // Dequeue and drop the next worker identity + worker_queue = worker_queue[1:] + + } + } + } + + time.Sleep(100 * time.Millisecond) +} + +/* +func set_id(soc *zmq.Socket) { + identity := fmt.Sprintf("%04X-%04X", rand.Intn(0x10000), rand.Intn(0x10000)) + soc.SetIdentity(identity) +} +*/ diff --git a/vendor/github.com/pebbe/zmq4/examples/lbbroker2.go b/vendor/github.com/pebbe/zmq4/examples/lbbroker2.go new file mode 100644 index 0000000..f9e5ee2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lbbroker2.go @@ -0,0 +1,147 @@ +// +// Load-balancing broker. +// Demonstrates use of higher level functions. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strings" + "time" +) + +const ( + NBR_CLIENTS = 10 + NBR_WORKERS = 3 + WORKER_READY = "\001" // Signals worker is ready +) + +// Basic request-reply client using REQ socket +// +func client_task() { + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + client.Connect("ipc://frontend.ipc") + + // Send request, get reply + for { + client.SendMessage("HELLO") + reply, _ := client.RecvMessage(0) + if len(reply) == 0 { + break + } + fmt.Println("Client:", strings.Join(reply, "\n\t")) + time.Sleep(time.Second) + } +} + +// Worker using REQ socket to do load-balancing +// +func worker_task() { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + worker.Connect("ipc://backend.ipc") + + // Tell broker we're ready for work + worker.SendMessage(WORKER_READY) + + // Process messages as they arrive + for { + msg, e := worker.RecvMessage(0) + if e != nil { + break // Interrupted ?? + } + msg[len(msg)-1] = "OK" + worker.SendMessage(msg) + } +} + +// Now we come to the main task. This has the identical functionality to +// the previous lbbroker example but uses higher level functions to read +// and send messages: + +func main() { + // Prepare our sockets + frontend, _ := zmq.NewSocket(zmq.ROUTER) + backend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + defer backend.Close() + frontend.Bind("ipc://frontend.ipc") + backend.Bind("ipc://backend.ipc") + + for client_nbr := 0; client_nbr < NBR_CLIENTS; client_nbr++ { + go client_task() + } + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task() + } + + // Queue of available workers + workers := make([]string, 0, 10) + + poller1 := zmq.NewPoller() + poller1.Add(backend, zmq.POLLIN) + poller2 := zmq.NewPoller() + poller2.Add(backend, zmq.POLLIN) + poller2.Add(frontend, zmq.POLLIN) + +LOOP: + for { + // Poll frontend only if we have available workers + var sockets []zmq.Polled + var err error + if len(workers) > 0 { + sockets, err = poller2.Poll(-1) + } else { + sockets, err = poller1.Poll(-1) + } + if err != nil { + break // Interrupted + } + for _, socket := range sockets { + switch socket.Socket { + case backend: + // Handle worker activity on backend + + // Use worker identity for load-balancing + msg, err := backend.RecvMessage(0) + if err != nil { + break LOOP // Interrupted + } + identity, msg := unwrap(msg) + workers = append(workers, identity) + + // Forward message to client if it's not a READY + if msg[0] != WORKER_READY { + frontend.SendMessage(msg) + } + + case frontend: + // Get client request, route to first available worker + msg, err := frontend.RecvMessage(0) + if err == nil { + backend.SendMessage(workers[0], "", msg) + workers = workers[1:] + } + } + } + } + + time.Sleep(100 * time.Millisecond) +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/lbbroker3.go b/vendor/github.com/pebbe/zmq4/examples/lbbroker3.go new file mode 100644 index 0000000..a9fea4c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lbbroker3.go @@ -0,0 +1,157 @@ +// +// Load-balancing broker. +// Demonstrates use of Reactor, and other higher level functions. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strings" + "time" +) + +const ( + NBR_CLIENTS = 10 + NBR_WORKERS = 3 + WORKER_READY = "\001" // Signals worker is ready +) + +// Basic request-reply client using REQ socket +// +func client_task() { + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + client.Connect("ipc://frontend.ipc") + + // Send request, get reply + for { + client.SendMessage("HELLO") + reply, _ := client.RecvMessage(0) + if len(reply) == 0 { + break + } + fmt.Println("Client:", strings.Join(reply, "\n\t")) + time.Sleep(time.Second) + } +} + +// Worker using REQ socket to do load-balancing +// +func worker_task() { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + worker.Connect("ipc://backend.ipc") + + // Tell broker we're ready for work + worker.SendMessage(WORKER_READY) + + // Process messages as they arrive + for { + msg, e := worker.RecvMessage(0) + if e != nil { + break // Interrupted + } + msg[len(msg)-1] = "OK" + worker.SendMessage(msg) + } +} + +// Our load-balancer structure, passed to reactor handlers +type lbbroker_t struct { + frontend *zmq.Socket // Listen to clients + backend *zmq.Socket // Listen to workers + workers []string // List of ready workers + reactor *zmq.Reactor +} + +// In the reactor design, each time a message arrives on a socket, the +// reactor passes it to a handler function. We have two handlers; one +// for the frontend, one for the backend: + +// Handle input from client, on frontend +func handle_frontend(lbbroker *lbbroker_t) error { + + // Get client request, route to first available worker + msg, err := lbbroker.frontend.RecvMessage(0) + if err != nil { + return err + } + lbbroker.backend.SendMessage(lbbroker.workers[0], "", msg) + lbbroker.workers = lbbroker.workers[1:] + + // Cancel reader on frontend if we went from 1 to 0 workers + if len(lbbroker.workers) == 0 { + lbbroker.reactor.RemoveSocket(lbbroker.frontend) + } + return nil +} + +// Handle input from worker, on backend +func handle_backend(lbbroker *lbbroker_t) error { + // Use worker identity for load-balancing + msg, err := lbbroker.backend.RecvMessage(0) + if err != nil { + return err + } + identity, msg := unwrap(msg) + lbbroker.workers = append(lbbroker.workers, identity) + + // Enable reader on frontend if we went from 0 to 1 workers + if len(lbbroker.workers) == 1 { + lbbroker.reactor.AddSocket(lbbroker.frontend, zmq.POLLIN, + func(e zmq.State) error { return handle_frontend(lbbroker) }) + } + + // Forward message to client if it's not a READY + if msg[0] != WORKER_READY { + lbbroker.frontend.SendMessage(msg) + } + + return nil +} + +// Now we come to the main task. This has the identical functionality to +// the previous lbbroker example but uses higher level functions to read +// and send messages: + +func main() { + lbbroker := &lbbroker_t{} + lbbroker.frontend, _ = zmq.NewSocket(zmq.ROUTER) + lbbroker.backend, _ = zmq.NewSocket(zmq.ROUTER) + defer lbbroker.frontend.Close() + defer lbbroker.backend.Close() + lbbroker.frontend.Bind("ipc://frontend.ipc") + lbbroker.backend.Bind("ipc://backend.ipc") + + for client_nbr := 0; client_nbr < NBR_CLIENTS; client_nbr++ { + go client_task() + } + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task() + } + + // Queue of available workers + lbbroker.workers = make([]string, 0, 10) + + // Prepare reactor and fire it up + lbbroker.reactor = zmq.NewReactor() + lbbroker.reactor.AddSocket(lbbroker.backend, zmq.POLLIN, + func(e zmq.State) error { return handle_backend(lbbroker) }) + lbbroker.reactor.Run(-1) +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/lpclient.go b/vendor/github.com/pebbe/zmq4/examples/lpclient.go new file mode 100644 index 0000000..3cfb4ca --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lpclient.go @@ -0,0 +1,88 @@ +// +// Lazy Pirate client. +// Use zmq_poll to do a safe request-reply +// To run, start lpserver and then randomly kill/restart it +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strconv" + "time" +) + +const ( + REQUEST_TIMEOUT = 2500 * time.Millisecond // msecs, (> 1000!) + REQUEST_RETRIES = 3 // Before we abandon + SERVER_ENDPOINT = "tcp://localhost:5555" +) + +func main() { + fmt.Println("I: connecting to server...") + client, err := zmq.NewSocket(zmq.REQ) + if err != nil { + panic(err) + } + client.Connect(SERVER_ENDPOINT) + + poller := zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + + sequence := 0 + retries_left := REQUEST_RETRIES + for retries_left > 0 { + // We send a request, then we work to get a reply + sequence++ + client.SendMessage(sequence) + + for expect_reply := true; expect_reply; { + // Poll socket for a reply, with timeout + sockets, err := poller.Poll(REQUEST_TIMEOUT) + if err != nil { + break // Interrupted + } + + // Here we process a server reply and exit our loop if the + // reply is valid. If we didn't a reply we close the client + // socket and resend the request. We try a number of times + // before finally abandoning: + + if len(sockets) > 0 { + // We got a reply from the server, must match sequence + reply, err := client.RecvMessage(0) + if err != nil { + break // Interrupted + } + seq, _ := strconv.Atoi(reply[0]) + if seq == sequence { + fmt.Printf("I: server replied OK (%s)\n", reply[0]) + retries_left = REQUEST_RETRIES + expect_reply = false + } else { + fmt.Printf("E: malformed reply from server: %s\n", reply) + } + } else { + retries_left-- + if retries_left == 0 { + fmt.Println("E: server seems to be offline, abandoning") + break + } else { + fmt.Println("W: no response from server, retrying...") + // Old socket is confused; close it and open a new one + client.Close() + client, _ = zmq.NewSocket(zmq.REQ) + client.Connect(SERVER_ENDPOINT) + // Recreate poller for new client + poller = zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + // Send request again, on new socket + client.SendMessage(sequence) + } + } + } + } + client.Close() +} diff --git a/vendor/github.com/pebbe/zmq4/examples/lpserver.go b/vendor/github.com/pebbe/zmq4/examples/lpserver.go new file mode 100644 index 0000000..8510782 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lpserver.go @@ -0,0 +1,42 @@ +// +// Lazy Pirate server. +// Binds REQ socket to tcp://*:5555 +// Like hwserver except: +// - echoes request as-is +// - randomly runs slowly, or exits to simulate a crash. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +func main() { + rand.Seed(time.Now().UnixNano()) + + server, _ := zmq.NewSocket(zmq.REP) + defer server.Close() + server.Bind("tcp://*:5555") + + for cycles := 0; true; { + request, _ := server.RecvMessage(0) + cycles++ + + // Simulate various problems, after a few cycles + if cycles > 3 && rand.Intn(3) == 0 { + fmt.Println("I: simulating a crash") + break + } else if cycles > 3 && rand.Intn(3) == 0 { + fmt.Println("I: simulating CPU overload") + time.Sleep(2 * time.Second) + } + fmt.Printf("I: normal request (%s)\n", request) + time.Sleep(time.Second) // Do some heavy work + server.SendMessage(request) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/lvcache.go b/vendor/github.com/pebbe/zmq4/examples/lvcache.go new file mode 100644 index 0000000..f139307 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/lvcache.go @@ -0,0 +1,69 @@ +// +// Last value cache +// Uses XPUB subscription messages to re-send data +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + frontend, _ := zmq.NewSocket(zmq.SUB) + frontend.Bind("tcp://*:5557") + backend, _ := zmq.NewSocket(zmq.XPUB) + backend.Bind("tcp://*:5558") + + // Subscribe to every single topic from publisher + frontend.SetSubscribe("") + + // Store last instance of each topic in a cache + cache := make(map[string]string) + + // We route topic updates from frontend to backend, and + // we handle subscriptions by sending whatever we cached, + // if anything: + poller := zmq.NewPoller() + poller.Add(frontend, zmq.POLLIN) + poller.Add(backend, zmq.POLLIN) +LOOP: + for { + polled, err := poller.Poll(1000 * time.Millisecond) + if err != nil { + break // Interrupted + } + + for _, item := range polled { + switch socket := item.Socket; socket { + case frontend: + // Any new topic data we cache and then forward + msg, err := frontend.RecvMessage(0) + if err != nil { + break LOOP + } + cache[msg[0]] = msg[1] + backend.SendMessage(msg) + case backend: + // When we get a new subscription we pull data from the cache: + msg, err := backend.RecvMessage(0) + if err != nil { + break LOOP + } + frame := msg[0] + // Event is one byte 0=unsub or 1=sub, followed by topic + if frame[0] == 1 { + topic := frame[1:] + fmt.Println("Sending cached topic", topic) + previous, ok := cache[topic] + if ok { + backend.SendMessage(topic, previous) + } + } + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdapi/const.go b/vendor/github.com/pebbe/zmq4/examples/mdapi/const.go new file mode 100644 index 0000000..05fd08a --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdapi/const.go @@ -0,0 +1,30 @@ +// Majordomo Protocol Client and Worker API. +// Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7. +package mdapi + +const ( + // This is the version of MDP/Client we implement + MDPC_CLIENT = "MDPC01" + + // This is the version of MDP/Worker we implement + MDPW_WORKER = "MDPW01" +) + +const ( + // MDP/Server commands, as strings + MDPW_READY = string(iota + 1) + MDPW_REQUEST + MDPW_REPLY + MDPW_HEARTBEAT + MDPW_DISCONNECT +) + +var ( + MDPS_COMMANDS = map[string]string{ + MDPW_READY: "READY", + MDPW_REQUEST: "REQUEST", + MDPW_REPLY: "REPLY", + MDPW_HEARTBEAT: "HEARTBEAT", + MDPW_DISCONNECT: "DISCONNECT", + } +) diff --git a/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi.go b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi.go new file mode 100644 index 0000000..bdb4501 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi.go @@ -0,0 +1,173 @@ +// Majordomo Protocol Client API. +// Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7. + +package mdapi + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "log" + "runtime" + "time" +) + +// Structure of our class +// We access these properties only via class methods + +// Majordomo Protocol Client API. +type Mdcli struct { + broker string + client *zmq.Socket // Socket to broker + verbose bool // Print activity to stdout + timeout time.Duration // Request timeout + retries int // Request retries + poller *zmq.Poller +} + +// --------------------------------------------------------------------- + +// Connect or reconnect to broker. +func (mdcli *Mdcli) ConnectToBroker() (err error) { + if mdcli.client != nil { + mdcli.client.Close() + mdcli.client = nil + } + mdcli.client, err = zmq.NewSocket(zmq.REQ) + if err != nil { + if mdcli.verbose { + log.Println("E: ConnectToBroker() creating socket failed") + } + return + } + mdcli.poller = zmq.NewPoller() + mdcli.poller.Add(mdcli.client, zmq.POLLIN) + + if mdcli.verbose { + log.Printf("I: connecting to broker at %s...", mdcli.broker) + } + err = mdcli.client.Connect(mdcli.broker) + if err != nil && mdcli.verbose { + log.Println("E: ConnectToBroker() failed to connect to broker", mdcli.broker) + } + + return +} + +// Here we have the constructor and destructor for our mdcli class: + +// --------------------------------------------------------------------- +// Constructor + +func NewMdcli(broker string, verbose bool) (mdcli *Mdcli, err error) { + + mdcli = &Mdcli{ + broker: broker, + verbose: verbose, + timeout: time.Duration(2500 * time.Millisecond), + retries: 3, // Before we abandon + } + err = mdcli.ConnectToBroker() + runtime.SetFinalizer(mdcli, (*Mdcli).Close) + return +} + +// --------------------------------------------------------------------- +// Destructor + +func (mdcli *Mdcli) Close() (err error) { + if mdcli.client != nil { + err = mdcli.client.Close() + mdcli.client = nil + } + return +} + +// These are the class methods. We can set the request timeout and number +// of retry attempts, before sending requests: + +// --------------------------------------------------------------------- + +// Set request timeout. +func (mdcli *Mdcli) SetTimeout(timeout time.Duration) { + mdcli.timeout = timeout +} + +// --------------------------------------------------------------------- + +// Set request retries. +func (mdcli *Mdcli) SetRetries(retries int) { + mdcli.retries = retries +} + +// Here is the send method. It sends a request to the broker and gets a +// reply even if it has to retry several times. It returns the reply +// message, or error if there was no reply after multiple attempts: +func (mdcli *Mdcli) Send(service string, request ...string) (reply []string, err error) { + // Prefix request with protocol frames + // Frame 1: "MDPCxy" (six bytes, MDP/Client x.y) + // Frame 2: Service name (printable string) + + req := make([]string, 2, len(request)+2) + req = append(req, request...) + req[1] = service + req[0] = MDPC_CLIENT + if mdcli.verbose { + log.Printf("I: send request to '%s' service: %q\n", service, req) + } + for retries_left := mdcli.retries; retries_left > 0; retries_left-- { + _, err = mdcli.client.SendMessage(req) + if err != nil { + break + } + + // On any blocking call, libzmq will return -1 if there was + // an error; we could in theory check for different error codes + // but in practice it's OK to assume it was EINTR (Ctrl-C): + + var polled []zmq.Polled + polled, err = mdcli.poller.Poll(mdcli.timeout) + if err != nil { + break // Interrupted + } + + // If we got a reply, process it + if len(polled) > 0 { + var msg []string + msg, err = mdcli.client.RecvMessage(0) + if err != nil { + break + } + if mdcli.verbose { + log.Printf("I: received reply: %q\n", msg) + } + // We would handle malformed replies better in real code + if len(msg) < 3 { + panic("len(msg) < 3") + } + + if msg[0] != MDPC_CLIENT { + panic("msg[0] != MDPC_CLIENT") + } + + if msg[1] != service { + panic("msg[1] != service") + } + + reply = msg[2:] + return // Success + } else { + if mdcli.verbose { + log.Println("W: no reply, reconnecting...") + } + mdcli.ConnectToBroker() + } + } + if err == nil { + err = errors.New("permanent error") + } + if mdcli.verbose { + log.Println("W: permanent error, abandoning") + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi2.go b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi2.go new file mode 100644 index 0000000..62b1b5b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdcliapi2.go @@ -0,0 +1,171 @@ +// Majordomo Protocol Client API. +// Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7. + +package mdapi + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "log" + "runtime" + "time" +) + +var ( + errPermanent = errors.New("permanent error, abandoning request") +) + +// Structure of our class +// We access these properties only via class methods + +// Majordomo Protocol Client API. +type Mdcli2 struct { + broker string + client *zmq.Socket // Socket to broker + verbose bool // Print activity to stdout + timeout time.Duration // Request timeout + poller *zmq.Poller +} + +// --------------------------------------------------------------------- + +// Connect or reconnect to broker. In this asynchronous class we use a +// DEALER socket instead of a REQ socket; this lets us send any number +// of requests without waiting for a reply. +func (mdcli2 *Mdcli2) ConnectToBroker() (err error) { + if mdcli2.client != nil { + mdcli2.client.Close() + mdcli2.client = nil + } + mdcli2.client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + if mdcli2.verbose { + log.Println("E: ConnectToBroker() creating socket failed") + } + return + } + mdcli2.poller = zmq.NewPoller() + mdcli2.poller.Add(mdcli2.client, zmq.POLLIN) + + if mdcli2.verbose { + log.Printf("I: connecting to broker at %s...", mdcli2.broker) + } + err = mdcli2.client.Connect(mdcli2.broker) + if err != nil && mdcli2.verbose { + log.Println("E: ConnectToBroker() failed to connect to broker", mdcli2.broker) + } + + return +} + +// Here we have the constructor and destructor for our mdcli2 class: + +// The constructor and destructor are the same as in mdcliapi, except +// we don't do retries, so there's no retries property. +// --------------------------------------------------------------------- +// Constructor + +func NewMdcli2(broker string, verbose bool) (mdcli2 *Mdcli2, err error) { + + mdcli2 = &Mdcli2{ + broker: broker, + verbose: verbose, + timeout: time.Duration(2500 * time.Millisecond), + } + err = mdcli2.ConnectToBroker() + runtime.SetFinalizer(mdcli2, (*Mdcli2).Close) + return +} + +// --------------------------------------------------------------------- +// Destructor + +func (mdcli2 *Mdcli2) Close() (err error) { + if mdcli2.client != nil { + err = mdcli2.client.Close() + mdcli2.client = nil + } + return +} + +// --------------------------------------------------------------------- + +// Set request timeout. +func (mdcli2 *Mdcli2) SetTimeout(timeout time.Duration) { + mdcli2.timeout = timeout +} + +// The send method now just sends one message, without waiting for a +// reply. Since we're using a DEALER socket we have to send an empty +// frame at the start, to create the same envelope that the REQ socket +// would normally make for us: +func (mdcli2 *Mdcli2) Send(service string, request ...string) (err error) { + // Prefix request with protocol frames + // Frame 0: empty (REQ emulation) + // Frame 1: "MDPCxy" (six bytes, MDP/Client x.y) + // Frame 2: Service name (printable string) + + req := make([]string, 3, len(request)+3) + req = append(req, request...) + req[2] = service + req[1] = MDPC_CLIENT + req[0] = "" + if mdcli2.verbose { + log.Printf("I: send request to '%s' service: %q\n", service, req) + } + _, err = mdcli2.client.SendMessage(req) + return +} + +// The recv method waits for a reply message and returns that to the +// caller. +// --------------------------------------------------------------------- +// Returns the reply message or NULL if there was no reply. Does not +// attempt to recover from a broker failure, this is not possible +// without storing all unanswered requests and resending them all... + +func (mdcli2 *Mdcli2) Recv() (msg []string, err error) { + + msg = []string{} + + // Poll socket for a reply, with timeout + polled, err := mdcli2.poller.Poll(mdcli2.timeout) + if err != nil { + return // Interrupted + } + + // If we got a reply, process it + if len(polled) > 0 { + msg, err = mdcli2.client.RecvMessage(0) + if err != nil { + log.Println("W: interrupt received, killing client...") + return + } + + if mdcli2.verbose { + log.Printf("I: received reply: %q\n", msg) + } + // Don't try to handle errors, just assert noisily + if len(msg) < 4 { + panic("len(msg) < 4") + } + + if msg[0] != "" { + panic("msg[0] != \"\"") + } + + if msg[1] != MDPC_CLIENT { + panic("msg[1] != MDPC_CLIENT") + } + + msg = msg[3:] + return // Success + } + + err = errPermanent + if mdcli2.verbose { + log.Println(err) + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdapi/mdwrkapi.go b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdwrkapi.go new file mode 100644 index 0000000..5f581b6 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdapi/mdwrkapi.go @@ -0,0 +1,248 @@ +// Majordomo Protocol Worker API. +// Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7. + +package mdapi + +import ( + zmq "github.com/pebbe/zmq4" + + "log" + "runtime" + "time" +) + +const ( + heartbeat_liveness = 3 // 3-5 is reasonable +) + +// This is the structure of a worker API instance. We use a pseudo-OO +// approach in a lot of the C examples, as well as the CZMQ binding: + +// Structure of our class +// We access these properties only via class methods + +// Majordomo Protocol Worker API. +type Mdwrk struct { + broker string + service string + worker *zmq.Socket // Socket to broker + poller *zmq.Poller + verbose bool // Print activity to stdout + + // Heartbeat management + heartbeat_at time.Time // When to send HEARTBEAT + liveness int // How many attempts left + heartbeat time.Duration // Heartbeat delay, msecs + reconnect time.Duration // Reconnect delay, msecs + + expect_reply bool // False only at start + reply_to string // Return identity, if any +} + +// We have two utility functions; to send a message to the broker and +// to (re-)connect to the broker: + +// --------------------------------------------------------------------- + +// Send message to broker. +func (mdwrk *Mdwrk) SendToBroker(command string, option string, msg []string) (err error) { + + n := 3 + if option != "" { + n++ + } + m := make([]string, n, n+len(msg)) + m = append(m, msg...) + + // Stack protocol envelope to start of message + if option != "" { + m[3] = option + } + m[2] = command + m[1] = MDPW_WORKER + m[0] = "" + + if mdwrk.verbose { + log.Printf("I: sending %s to broker %q\n", MDPS_COMMANDS[command], m) + } + _, err = mdwrk.worker.SendMessage(m) + return +} + +// --------------------------------------------------------------------- + +// Connect or reconnect to broker. +func (mdwrk *Mdwrk) ConnectToBroker() (err error) { + if mdwrk.worker != nil { + mdwrk.worker.Close() + mdwrk.worker = nil + } + mdwrk.worker, err = zmq.NewSocket(zmq.DEALER) + err = mdwrk.worker.Connect(mdwrk.broker) + if mdwrk.verbose { + log.Printf("I: connecting to broker at %s...\n", mdwrk.broker) + } + mdwrk.poller = zmq.NewPoller() + mdwrk.poller.Add(mdwrk.worker, zmq.POLLIN) + + // Register service with broker + err = mdwrk.SendToBroker(MDPW_READY, mdwrk.service, []string{}) + + // If liveness hits zero, queue is considered disconnected + mdwrk.liveness = heartbeat_liveness + mdwrk.heartbeat_at = time.Now().Add(mdwrk.heartbeat) + + return +} + +// Here we have the constructor and destructor for our mdwrk class: + +// --------------------------------------------------------------------- +// Constructor + +func NewMdwrk(broker, service string, verbose bool) (mdwrk *Mdwrk, err error) { + + mdwrk = &Mdwrk{ + broker: broker, + service: service, + verbose: verbose, + heartbeat: 2500 * time.Millisecond, + reconnect: 2500 * time.Millisecond, + } + + err = mdwrk.ConnectToBroker() + + runtime.SetFinalizer(mdwrk, (*Mdwrk).Close) + + return +} + +// --------------------------------------------------------------------- +// Destructor + +func (mdwrk *Mdwrk) Close() { + if mdwrk.worker != nil { + mdwrk.worker.Close() + mdwrk.worker = nil + } +} + +// We provide two methods to configure the worker API. You can set the +// heartbeat interval and retries to match the expected network performance. + +// --------------------------------------------------------------------- + +// Set heartbeat delay. +func (mdwrk *Mdwrk) SetHeartbeat(heartbeat time.Duration) { + mdwrk.heartbeat = heartbeat +} + +// --------------------------------------------------------------------- + +// Set reconnect delay. +func (mdwrk *Mdwrk) SetReconnect(reconnect time.Duration) { + mdwrk.reconnect = reconnect +} + +// This is the recv method; it's a little misnamed since it first sends +// any reply and then waits for a new request. If you have a better name +// for this, let me know: + +// --------------------------------------------------------------------- + +// Send reply, if any, to broker and wait for next request. +func (mdwrk *Mdwrk) Recv(reply []string) (msg []string, err error) { + // Format and send the reply if we were provided one + if len(reply) == 0 && mdwrk.expect_reply { + panic("No reply, expected") + } + if len(reply) > 0 { + if mdwrk.reply_to == "" { + panic("mdwrk.reply_to == \"\"") + } + m := make([]string, 2, 2+len(reply)) + m = append(m, reply...) + m[0] = mdwrk.reply_to + m[1] = "" + err = mdwrk.SendToBroker(MDPW_REPLY, "", m) + } + mdwrk.expect_reply = true + + for { + var polled []zmq.Polled + polled, err = mdwrk.poller.Poll(mdwrk.heartbeat) + if err != nil { + break // Interrupted + } + + if len(polled) > 0 { + msg, err = mdwrk.worker.RecvMessage(0) + if err != nil { + break // Interrupted + } + if mdwrk.verbose { + log.Printf("I: received message from broker: %q\n", msg) + } + mdwrk.liveness = heartbeat_liveness + + // Don't try to handle errors, just assert noisily + if len(msg) < 3 { + panic("len(msg) < 3") + } + + if msg[0] != "" { + panic("msg[0] != \"\"") + } + + if msg[1] != MDPW_WORKER { + panic("msg[1] != MDPW_WORKER") + } + + command := msg[2] + msg = msg[3:] + switch command { + case MDPW_REQUEST: + // We should pop and save as many addresses as there are + // up to a null part, but for now, just save one... + mdwrk.reply_to, msg = unwrap(msg) + // Here is where we actually have a message to process; we + // return it to the caller application: + return // We have a request to process + case MDPW_HEARTBEAT: + // Do nothing for heartbeats + case MDPW_DISCONNECT: + mdwrk.ConnectToBroker() + default: + log.Printf("E: invalid input message %q\n", msg) + } + } else { + mdwrk.liveness-- + if mdwrk.liveness == 0 { + if mdwrk.verbose { + log.Println("W: disconnected from broker - retrying...") + } + time.Sleep(mdwrk.reconnect) + mdwrk.ConnectToBroker() + } + } + // Send HEARTBEAT if it's time + if time.Now().After(mdwrk.heartbeat_at) { + mdwrk.SendToBroker(MDPW_HEARTBEAT, "", []string{}) + mdwrk.heartbeat_at = time.Now().Add(mdwrk.heartbeat) + } + } + return +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdbroker.go b/vendor/github.com/pebbe/zmq4/examples/mdbroker.go new file mode 100644 index 0000000..ee6ae82 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdbroker.go @@ -0,0 +1,426 @@ +// +// Majordomo Protocol broker. +// A minimal Go implementation of the Majordomo Protocol as defined in +// http://rfc.zeromq.org/spec:7 and http://rfc.zeromq.org/spec:8. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + "github.com/pebbe/zmq4/examples/mdapi" + + "fmt" + "log" + "os" + "runtime" + "time" +) + +const ( + // We'd normally pull these from config data + + HEARTBEAT_LIVENESS = 3 // 3-5 is reasonable + HEARTBEAT_INTERVAL = 2500 * time.Millisecond // msecs + HEARTBEAT_EXPIRY = HEARTBEAT_INTERVAL * HEARTBEAT_LIVENESS +) + +// The broker class defines a single broker instance: + +type Broker struct { + socket *zmq.Socket // Socket for clients & workers + verbose bool // Print activity to stdout + endpoint string // Broker binds to this endpoint + services map[string]*Service // Hash of known services + workers map[string]*Worker // Hash of known workers + waiting []*Worker // List of waiting workers + heartbeat_at time.Time // When to send HEARTBEAT +} + +// The service class defines a single service instance: + +type Service struct { + broker *Broker // Broker instance + name string // Service name + requests [][]string // List of client requests + waiting []*Worker // List of waiting workers +} + +// The worker class defines a single worker, idle or active: + +type Worker struct { + broker *Broker // Broker instance + id_string string // Identity of worker as string + identity string // Identity frame for routing + service *Service // Owning service, if known + expiry time.Time // Expires at unless heartbeat +} + +// Here are the constructor and destructor for the broker: + +func NewBroker(verbose bool) (broker *Broker, err error) { + + // Initialize broker state + broker = &Broker{ + verbose: verbose, + services: make(map[string]*Service), + workers: make(map[string]*Worker), + waiting: make([]*Worker, 0), + heartbeat_at: time.Now().Add(HEARTBEAT_INTERVAL), + } + broker.socket, err = zmq.NewSocket(zmq.ROUTER) + + broker.socket.SetRcvhwm(500000) // or example mdclient2 won't work + + runtime.SetFinalizer(broker, (*Broker).Close) + return +} + +func (broker *Broker) Close() (err error) { + if broker.socket != nil { + err = broker.socket.Close() + broker.socket = nil + } + return +} + +// The bind method binds the broker instance to an endpoint. We can call +// this multiple times. Note that MDP uses a single socket for both clients +// and workers: + +func (broker *Broker) Bind(endpoint string) (err error) { + err = broker.socket.Bind(endpoint) + if err != nil { + log.Println("E: MDP broker/0.2.0 failed to bind at", endpoint) + return + } + log.Println("I: MDP broker/0.2.0 is active at", endpoint) + return +} + +// The WorkerMsg method processes one READY, REPLY, HEARTBEAT or +// DISCONNECT message sent to the broker by a worker: + +func (broker *Broker) WorkerMsg(sender string, msg []string) { + // At least, command + if len(msg) == 0 { + panic("len(msg) == 0") + } + + command, msg := popStr(msg) + id_string := fmt.Sprintf("%q", sender) + _, worker_ready := broker.workers[id_string] + worker := broker.WorkerRequire(sender) + + switch command { + case mdapi.MDPW_READY: + if worker_ready { // Not first command in session + worker.Delete(true) + } else if len(sender) >= 4 /* Reserved service name */ && sender[:4] == "mmi." { + worker.Delete(true) + } else { + // Attach worker to service and mark as idle + worker.service = broker.ServiceRequire(msg[0]) + worker.Waiting() + } + case mdapi.MDPW_REPLY: + if worker_ready { + // Remove & save client return envelope and insert the + // protocol header and service name, then rewrap envelope. + client, msg := unwrap(msg) + broker.socket.SendMessage(client, "", mdapi.MDPC_CLIENT, worker.service.name, msg) + worker.Waiting() + } else { + worker.Delete(true) + } + case mdapi.MDPW_HEARTBEAT: + if worker_ready { + worker.expiry = time.Now().Add(HEARTBEAT_EXPIRY) + } else { + worker.Delete(true) + } + case mdapi.MDPW_DISCONNECT: + worker.Delete(false) + default: + log.Printf("E: invalid input message %q\n", msg) + } +} + +// Process a request coming from a client. We implement MMI requests +// directly here (at present, we implement only the mmi.service request): + +func (broker *Broker) ClientMsg(sender string, msg []string) { + // Service name + body + if len(msg) < 2 { + panic("len(msg) < 2") + } + + service_frame, msg := popStr(msg) + service := broker.ServiceRequire(service_frame) + + // Set reply return identity to client sender + m := []string{sender, ""} + msg = append(m, msg...) + + // If we got a MMI service request, process that internally + if len(service_frame) >= 4 && service_frame[:4] == "mmi." { + var return_code string + if service_frame == "mmi.service" { + name := msg[len(msg)-1] + service, ok := broker.services[name] + if ok && len(service.waiting) > 0 { + return_code = "200" + } else { + return_code = "404" + } + } else { + return_code = "501" + } + + msg[len(msg)-1] = return_code + + // Remove & save client return envelope and insert the + // protocol header and service name, then rewrap envelope. + client, msg := unwrap(msg) + broker.socket.SendMessage(client, "", mdapi.MDPC_CLIENT, service_frame, msg) + } else { + // Else dispatch the message to the requested service + service.Dispatch(msg) + } +} + +// The purge method deletes any idle workers that haven't pinged us in a +// while. We hold workers from oldest to most recent, so we can stop +// scanning whenever we find a live worker. This means we'll mainly stop +// at the first worker, which is essential when we have large numbers of +// workers (since we call this method in our critical path): + +func (broker *Broker) Purge() { + now := time.Now() + for len(broker.waiting) > 0 { + if broker.waiting[0].expiry.After(now) { + break // Worker is alive, we're done here + } + if broker.verbose { + log.Println("I: deleting expired worker:", broker.waiting[0].id_string) + } + broker.waiting[0].Delete(false) + } +} + +// Here is the implementation of the methods that work on a service: + +// Lazy constructor that locates a service by name, or creates a new +// service if there is no service already with that name. + +func (broker *Broker) ServiceRequire(service_frame string) (service *Service) { + name := service_frame + service, ok := broker.services[name] + if !ok { + service = &Service{ + broker: broker, + name: name, + requests: make([][]string, 0), + waiting: make([]*Worker, 0), + } + broker.services[name] = service + if broker.verbose { + log.Println("I: added service:", name) + } + } + return +} + +// The dispatch method sends requests to waiting workers: + +func (service *Service) Dispatch(msg []string) { + + if len(msg) > 0 { + // Queue message if any + service.requests = append(service.requests, msg) + } + + service.broker.Purge() + for len(service.waiting) > 0 && len(service.requests) > 0 { + var worker *Worker + worker, service.waiting = popWorker(service.waiting) + service.broker.waiting = delWorker(service.broker.waiting, worker) + msg, service.requests = popMsg(service.requests) + worker.Send(mdapi.MDPW_REQUEST, "", msg) + } +} + +// Here is the implementation of the methods that work on a worker: + +// Lazy constructor that locates a worker by identity, or creates a new +// worker if there is no worker already with that identity. + +func (broker *Broker) WorkerRequire(identity string) (worker *Worker) { + + // broker.workers is keyed off worker identity + id_string := fmt.Sprintf("%q", identity) + worker, ok := broker.workers[id_string] + if !ok { + worker = &Worker{ + broker: broker, + id_string: id_string, + identity: identity, + } + broker.workers[id_string] = worker + if broker.verbose { + log.Printf("I: registering new worker: %s\n", id_string) + } + } + return +} + +// The delete method deletes the current worker. + +func (worker *Worker) Delete(disconnect bool) { + if disconnect { + worker.Send(mdapi.MDPW_DISCONNECT, "", []string{}) + } + + if worker.service != nil { + worker.service.waiting = delWorker(worker.service.waiting, worker) + } + worker.broker.waiting = delWorker(worker.broker.waiting, worker) + delete(worker.broker.workers, worker.id_string) +} + +// The send method formats and sends a command to a worker. The caller may +// also provide a command option, and a message payload: + +func (worker *Worker) Send(command, option string, msg []string) (err error) { + n := 4 + if option != "" { + n++ + } + m := make([]string, n, n+len(msg)) + m = append(m, msg...) + + // Stack protocol envelope to start of message + if option != "" { + m[4] = option + } + m[3] = command + m[2] = mdapi.MDPW_WORKER + + // Stack routing envelope to start of message + m[1] = "" + m[0] = worker.identity + + if worker.broker.verbose { + log.Printf("I: sending %s to worker %q\n", mdapi.MDPS_COMMANDS[command], m) + } + _, err = worker.broker.socket.SendMessage(m) + return +} + +// This worker is now waiting for work + +func (worker *Worker) Waiting() { + // Queue to broker and service waiting lists + worker.broker.waiting = append(worker.broker.waiting, worker) + worker.service.waiting = append(worker.service.waiting, worker) + worker.expiry = time.Now().Add(HEARTBEAT_EXPIRY) + worker.service.Dispatch([]string{}) +} + +// Finally here is the main task. We create a new broker instance and +// then processes messages on the broker socket: + +func main() { + verbose := false + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + + broker, _ := NewBroker(verbose) + broker.Bind("tcp://*:5555") + + poller := zmq.NewPoller() + poller.Add(broker.socket, zmq.POLLIN) + + // Get and process messages forever or until interrupted + for { + polled, err := poller.Poll(HEARTBEAT_INTERVAL) + if err != nil { + break // Interrupted + } + + // Process next input message, if any + if len(polled) > 0 { + msg, err := broker.socket.RecvMessage(0) + if err != nil { + break // Interrupted + } + if broker.verbose { + log.Printf("I: received message: %q\n", msg) + } + sender, msg := popStr(msg) + _, msg = popStr(msg) + header, msg := popStr(msg) + + switch header { + case mdapi.MDPC_CLIENT: + broker.ClientMsg(sender, msg) + case mdapi.MDPW_WORKER: + broker.WorkerMsg(sender, msg) + default: + log.Printf("E: invalid message: %q\n", msg) + } + } + // Disconnect and delete any expired workers + // Send heartbeats to idle workers if needed + if time.Now().After(broker.heartbeat_at) { + broker.Purge() + for _, worker := range broker.waiting { + worker.Send(mdapi.MDPW_HEARTBEAT, "", []string{}) + } + broker.heartbeat_at = time.Now().Add(HEARTBEAT_INTERVAL) + } + } + log.Println("W: interrupt received, shutting down...") +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} + +func popStr(ss []string) (s string, ss2 []string) { + s = ss[0] + ss2 = ss[1:] + return +} + +func popMsg(msgs [][]string) (msg []string, msgs2 [][]string) { + msg = msgs[0] + msgs2 = msgs[1:] + return +} + +func popWorker(workers []*Worker) (worker *Worker, workers2 []*Worker) { + worker = workers[0] + workers2 = workers[1:] + return +} + +func delWorker(workers []*Worker, worker *Worker) []*Worker { + for i := 0; i < len(workers); i++ { + if workers[i] == worker { + workers = append(workers[:i], workers[i+1:]...) + i-- + } + } + return workers +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdclient.go b/vendor/github.com/pebbe/zmq4/examples/mdclient.go new file mode 100644 index 0000000..ddfb8ca --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdclient.go @@ -0,0 +1,32 @@ +// +// Majordomo Protocol client example. +// Uses the mdcli API to hide all MDP aspects +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "fmt" + "log" + "os" +) + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + session, _ := mdapi.NewMdcli("tcp://localhost:5555", verbose) + + count := 0 + for ; count < 100000; count++ { + _, err := session.Send("echo", "Hello world") + if err != nil { + log.Println(err) + break // Interrupt or failure + } + } + fmt.Printf("%d requests/replies processed\n", count) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdclient2.go b/vendor/github.com/pebbe/zmq4/examples/mdclient2.go new file mode 100644 index 0000000..de11061 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdclient2.go @@ -0,0 +1,39 @@ +// +// Majordomo Protocol client example - asynchronous. +// Uses the mdcli API to hide all MDP aspects +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "fmt" + "log" + "os" +) + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + session, _ := mdapi.NewMdcli2("tcp://localhost:5555", verbose) + + var count int + for count = 0; count < 100000; count++ { + err := session.Send("echo", "Hello world") + if err != nil { + log.Println("Send:", err) + break + } + } + for count = 0; count < 100000; count++ { + _, err := session.Recv() + if err != nil { + log.Println("Recv:", err) + break + } + } + fmt.Printf("%d replies received\n", count) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mdworker.go b/vendor/github.com/pebbe/zmq4/examples/mdworker.go new file mode 100644 index 0000000..35c25be --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mdworker.go @@ -0,0 +1,32 @@ +// +// Majordomo Protocol worker example. +// Uses the mdwrk API to hide all MDP aspects +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "log" + "os" +) + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + session, _ := mdapi.NewMdwrk("tcp://localhost:5555", "echo", verbose) + + var err error + var request, reply []string + for { + request, err = session.Recv(reply) + if err != nil { + break // Worker was interrupted + } + reply = request // Echo is complex... :-) + } + log.Println(err) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mmiecho.go b/vendor/github.com/pebbe/zmq4/examples/mmiecho.go new file mode 100644 index 0000000..d6d5264 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mmiecho.go @@ -0,0 +1,32 @@ +// +// MMI echo query example. +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "fmt" + "os" +) + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + session, _ := mdapi.NewMdcli("tcp://localhost:5555", verbose) + + // This is the service we want to look up + request := "echo" + + // This is the service we send our request to + reply, err := session.Send("mmi.service", request) + + if err == nil { + fmt.Println("Lookup echo service:", reply[0]) + } else { + fmt.Println("E: no response from broker, make sure it's running") + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/msgqueue.go b/vendor/github.com/pebbe/zmq4/examples/msgqueue.go new file mode 100644 index 0000000..37a1e2d --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/msgqueue.go @@ -0,0 +1,36 @@ +// +// Simple message queuing broker. +// Same as request-reply broker but using QUEUE device +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "log" +) + +func main() { + var err error + + // Socket facing clients + frontend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + err = frontend.Bind("tcp://*:5559") + if err != nil { + log.Fatalln("Binding frontend:", err) + } + + // Socket facing services + backend, _ := zmq.NewSocket(zmq.DEALER) + defer backend.Close() + err = backend.Bind("tcp://*:5560") + if err != nil { + log.Fatalln("Binding backend:", err) + } + + // Start the proxy + err = zmq.Proxy(frontend, backend, nil) + log.Fatalln("Proxy interrupted:", err) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mspoller.go b/vendor/github.com/pebbe/zmq4/examples/mspoller.go new file mode 100644 index 0000000..90ad8dd --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mspoller.go @@ -0,0 +1,47 @@ +// +// Reading from multiple sockets. +// This version uses zmq.Poll() +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + + // Connect to task ventilator + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Connect("tcp://localhost:5557") + + // Connect to weather server + subscriber, _ := zmq.NewSocket(zmq.SUB) + defer subscriber.Close() + subscriber.Connect("tcp://localhost:5556") + subscriber.SetSubscribe("10001 ") + + // Initialize poll set + poller := zmq.NewPoller() + poller.Add(receiver, zmq.POLLIN) + poller.Add(subscriber, zmq.POLLIN) + // Process messages from both sockets + for { + sockets, _ := poller.Poll(-1) + for _, socket := range sockets { + switch s := socket.Socket; s { + case receiver: + task, _ := s.Recv(0) + // Process task + fmt.Println("Got task:", task) + case subscriber: + update, _ := s.Recv(0) + // Process weather update + fmt.Println("Got weather update:", update) + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/msreader.go b/vendor/github.com/pebbe/zmq4/examples/msreader.go new file mode 100644 index 0000000..5373b18 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/msreader.go @@ -0,0 +1,55 @@ +// +// Reading from multiple sockets. +// This version uses a simple recv loop +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + + // Connect to task ventilator + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Connect("tcp://localhost:5557") + + // Connect to weather server + subscriber, _ := zmq.NewSocket(zmq.SUB) + defer subscriber.Close() + subscriber.Connect("tcp://localhost:5556") + subscriber.SetSubscribe("10001 ") + + // Process messages from both sockets + // We prioritize traffic from the task ventilator + for { + + // Process any waiting tasks + for { + task, err := receiver.Recv(zmq.DONTWAIT) + if err != nil { + break + } + // process task + fmt.Println("Got task:", task) + } + + // Process any waiting weather updates + for { + udate, err := subscriber.Recv(zmq.DONTWAIT) + if err != nil { + break + } + // process weather update + fmt.Println("Got weather update:", udate) + } + + // No activity, so sleep for 1 msec + time.Sleep(time.Millisecond) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mtrelay.go b/vendor/github.com/pebbe/zmq4/examples/mtrelay.go new file mode 100644 index 0000000..7093a6c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mtrelay.go @@ -0,0 +1,52 @@ +// +// Multithreaded relay. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func step1() { + // Connect to step2 and tell it we're ready + xmitter, _ := zmq.NewSocket(zmq.PAIR) + defer xmitter.Close() + xmitter.Connect("inproc://step2") + fmt.Println("Step 1 ready, signaling step 2") + xmitter.Send("READY", 0) +} + +func step2() { + // Bind inproc socket before starting step1 + receiver, _ := zmq.NewSocket(zmq.PAIR) + defer receiver.Close() + receiver.Bind("inproc://step2") + go step1() + + // Wait for signal and pass it on + receiver.Recv(0) + + // Connect to step3 and tell it we're ready + xmitter, _ := zmq.NewSocket(zmq.PAIR) + defer xmitter.Close() + xmitter.Connect("inproc://step3") + fmt.Println("Step 2 ready, signaling step 3") + xmitter.Send("READY", 0) +} + +func main() { + + // Bind inproc socket before starting step2 + receiver, _ := zmq.NewSocket(zmq.PAIR) + defer receiver.Close() + receiver.Bind("inproc://step3") + go step2() + + // Wait for signal + receiver.Recv(0) + + fmt.Println("Test successful!") +} diff --git a/vendor/github.com/pebbe/zmq4/examples/mtserver.go b/vendor/github.com/pebbe/zmq4/examples/mtserver.go new file mode 100644 index 0000000..547b43b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/mtserver.go @@ -0,0 +1,54 @@ +// +// Multithreaded Hello World server. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "time" +) + +func worker_routine() { + // Socket to talk to dispatcher + receiver, _ := zmq.NewSocket(zmq.REP) + defer receiver.Close() + receiver.Connect("inproc://workers") + + for { + msg, e := receiver.Recv(0) + if e != nil { + break + } + fmt.Println("Received request: [" + msg + "]") + + // Do some 'work' + time.Sleep(time.Second) + + // Send reply back to client + receiver.Send("World", 0) + } +} + +func main() { + // Socket to talk to clients + clients, _ := zmq.NewSocket(zmq.ROUTER) + defer clients.Close() + clients.Bind("tcp://*:5555") + + // Socket to talk to workers + workers, _ := zmq.NewSocket(zmq.DEALER) + defer workers.Close() + workers.Bind("inproc://workers") + + // Launch pool of worker goroutines + for thread_nbr := 0; thread_nbr < 5; thread_nbr++ { + go worker_routine() + } + // Connect work threads to client threads via a queue proxy + err := zmq.Proxy(clients, workers, nil) + log.Fatalln("Proxy interrupted:", err) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/pathopub.go b/vendor/github.com/pebbe/zmq4/examples/pathopub.go new file mode 100644 index 0000000..70a0e2b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/pathopub.go @@ -0,0 +1,44 @@ +// +// Pathological publisher +// Sends out 1,000 topics and then one random update per second +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "os" + "time" +) + +func main() { + publisher, _ := zmq.NewSocket(zmq.PUB) + if len(os.Args) == 2 { + publisher.Connect(os.Args[1]) + } else { + publisher.Bind("tcp://*:5556") + } + + // Ensure subscriber connection has time to complete + time.Sleep(time.Second) + + // Send out all 1,000 topic messages + for topic_nbr := 0; topic_nbr < 1000; topic_nbr++ { + _, err := publisher.SendMessage(fmt.Sprintf("%03d", topic_nbr), "Save Roger") + if err != nil { + fmt.Println(err) + } + } + // Send one random update per second + rand.Seed(time.Now().UnixNano()) + for { + time.Sleep(time.Second) + _, err := publisher.SendMessage(fmt.Sprintf("%03d", rand.Intn(1000)), "Off with his head!") + if err != nil { + fmt.Println(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/pathosub.go b/vendor/github.com/pebbe/zmq4/examples/pathosub.go new file mode 100644 index 0000000..0f3dcac --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/pathosub.go @@ -0,0 +1,41 @@ +// +// Pathological subscriber +// Subscribes to one random topic and prints received messages +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "os" + "time" +) + +func main() { + subscriber, _ := zmq.NewSocket(zmq.SUB) + if len(os.Args) == 2 { + subscriber.Connect(os.Args[1]) + } else { + subscriber.Connect("tcp://localhost:5556") + } + + rand.Seed(time.Now().UnixNano()) + subscription := fmt.Sprintf("%03d", rand.Intn(1000)) + subscriber.SetSubscribe(subscription) + + for { + msg, err := subscriber.RecvMessage(0) + if err != nil { + break + } + topic := msg[0] + data := msg[1] + if topic != subscription { + panic("topic != subscription") + } + fmt.Println(data) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/peering1.go b/vendor/github.com/pebbe/zmq4/examples/peering1.go new file mode 100644 index 0000000..b55c3ec --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/peering1.go @@ -0,0 +1,66 @@ +// +// Broker peering simulation (part 1). +// Prototypes the state flow +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "os" + "time" +) + +func main() { + // First argument is this broker's name + // Other arguments are our peers' names + // + if len(os.Args) < 2 { + fmt.Println("syntax: peering1 me {you}...") + os.Exit(1) + } + self := os.Args[1] + fmt.Printf("I: preparing broker at %s...\n", self) + rand.Seed(time.Now().UnixNano()) + + // Bind state backend to endpoint + statebe, _ := zmq.NewSocket(zmq.PUB) + defer statebe.Close() + statebe.Bind("ipc://" + self + "-state.ipc") + + // Connect statefe to all peers + statefe, _ := zmq.NewSocket(zmq.SUB) + defer statefe.Close() + statefe.SetSubscribe("") + for _, peer := range os.Args[2:] { + fmt.Printf("I: connecting to state backend at '%s'\n", peer) + statefe.Connect("ipc://" + peer + "-state.ipc") + } + + // The main loop sends out status messages to peers, and collects + // status messages back from peers. The zmq_poll timeout defines + // our own heartbeat: + + poller := zmq.NewPoller() + poller.Add(statefe, zmq.POLLIN) + for { + // Poll for activity, or 1 second timeout + sockets, err := poller.Poll(time.Second) + if err != nil { + break + } + + // Handle incoming status messages + if len(sockets) == 1 { + msg, _ := statefe.RecvMessage(0) + peer_name := msg[0] + available := msg[1] + fmt.Printf("%s - %s workers free\n", peer_name, available) + } else { + statebe.SendMessage(self, rand.Intn(10)) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/peering2.go b/vendor/github.com/pebbe/zmq4/examples/peering2.go new file mode 100644 index 0000000..edb1deb --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/peering2.go @@ -0,0 +1,264 @@ +// +// Broker peering simulation (part 2). +// Prototypes the request-reply flow +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "math/rand" + "os" + "time" +) + +const ( + NBR_CLIENTS = 10 + NBR_WORKERS = 3 + WORKER_READY = "**READY**" // Signals worker is ready +) + +var ( + peers = make(map[string]bool) +) + +// The client task does a request-reply dialog using a standard +// synchronous REQ socket: + +func client_task(name string, i int) { + clientname := fmt.Sprintf("Client-%s-%d", name, i) + + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + client.SetIdentity(clientname) + client.Connect("ipc://" + name + "-localfe.ipc") + + for { + // Send request, get reply + client.Send("HELLO from "+clientname, 0) + reply, err := client.Recv(0) + if err != nil { + fmt.Println("client_task interrupted", name) + break // Interrupted + } + fmt.Printf("%s: %s\n", clientname, reply) + time.Sleep(time.Duration(500+rand.Intn(1000)) * time.Millisecond) + } +} + +// The worker task plugs into the load-balancer using a REQ +// socket: + +func worker_task(name string, i int) { + workername := fmt.Sprintf("Worker-%s-%d", name, i) + + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + worker.SetIdentity(workername) + worker.Connect("ipc://" + name + "-localbe.ipc") + + // Tell broker we're ready for work + worker.SendMessage(WORKER_READY) + + // Process messages as they arrive + for { + msg, err := worker.RecvMessage(0) + if err != nil { + fmt.Println("worker_task interrupted", name) + break // Interrupted + } + + i := len(msg) - 1 + fmt.Printf("%s: %s\n", workername, msg[i]) + worker.SendMessage(msg[:i], "OK from "+workername) + } +} + +// The main task begins by setting-up its frontend and backend sockets +// and then starting its client and worker tasks: + +func main() { + // First argument is this broker's name + // Other arguments are our peers' names + // + if len(os.Args) < 2 { + fmt.Println("syntax: peering2 me {you}...") + os.Exit(1) + } + for _, peer := range os.Args[2:] { + peers[peer] = true + } + + self := os.Args[1] + fmt.Println("I: preparing broker at", self) + rand.Seed(time.Now().UnixNano()) + + // Bind cloud frontend to endpoint + cloudfe, _ := zmq.NewSocket(zmq.ROUTER) + defer cloudfe.Close() + cloudfe.SetIdentity(self) + cloudfe.Bind("ipc://" + self + "-cloud.ipc") + + // Connect cloud backend to all peers + cloudbe, _ := zmq.NewSocket(zmq.ROUTER) + defer cloudbe.Close() + cloudbe.SetIdentity(self) + for _, peer := range os.Args[2:] { + fmt.Println("I: connecting to cloud frontend at", peer) + cloudbe.Connect("ipc://" + peer + "-cloud.ipc") + } + // Prepare local frontend and backend + localfe, _ := zmq.NewSocket(zmq.ROUTER) + defer localfe.Close() + localfe.Bind("ipc://" + self + "-localfe.ipc") + localbe, _ := zmq.NewSocket(zmq.ROUTER) + defer localbe.Close() + localbe.Bind("ipc://" + self + "-localbe.ipc") + + // Get user to tell us when we can start... + fmt.Print("Press Enter when all brokers are started: ") + var line string + fmt.Scanln(&line) + + // Start local workers + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task(self, worker_nbr) + } + + // Start local clients + for client_nbr := 0; client_nbr < NBR_CLIENTS; client_nbr++ { + go client_task(self, client_nbr) + } + + // Here we handle the request-reply flow. We're using load-balancing + // to poll workers at all times, and clients only when there are one or + // more workers available. + + // Least recently used queue of available workers + workers := make([]string, 0) + + backends := zmq.NewPoller() + backends.Add(localbe, zmq.POLLIN) + backends.Add(cloudbe, zmq.POLLIN) + frontends := zmq.NewPoller() + frontends.Add(localfe, zmq.POLLIN) + frontends.Add(cloudfe, zmq.POLLIN) + + msg := []string{} + number_of_peers := len(os.Args) - 2 + + for { + // First, route any waiting replies from workers + // If we have no workers anyhow, wait indefinitely + timeout := time.Second + if len(workers) == 0 { + timeout = -1 + } + sockets, err := backends.Poll(timeout) + if err != nil { + log.Println(err) + break // Interrupted + } + + msg = msg[:] + if socketInPolled(localbe, sockets) { + // Handle reply from local worker + msg, err = localbe.RecvMessage(0) + if err != nil { + log.Println(err) + break // Interrupted + } + var identity string + identity, msg = unwrap(msg) + workers = append(workers, identity) + + // If it's READY, don't route the message any further + if msg[0] == WORKER_READY { + msg = msg[0:0] + } + } else if socketInPolled(cloudbe, sockets) { + // Or handle reply from peer broker + msg, err = cloudbe.RecvMessage(0) + if err != nil { + log.Println(err) + break // Interrupted + } + + // We don't use peer broker identity for anything + _, msg = unwrap(msg) + } + + if len(msg) > 0 { + // Route reply to cloud if it's addressed to a broker + if peers[msg[0]] { + cloudfe.SendMessage(msg) + } else { + localfe.SendMessage(msg) + } + } + + // Now we route as many client requests as we have worker capacity + // for. We may reroute requests from our local frontend, but not from + // the cloud frontend. We reroute randomly now, just to test things + // out. In the next version we'll do this properly by calculating + // cloud capacity: + + for len(workers) > 0 { + sockets, err := frontends.Poll(0) + if err != nil { + log.Println(err) + break // Interrupted + } + var reroutable bool + // We'll do peer brokers first, to prevent starvation + if socketInPolled(cloudfe, sockets) { + msg, _ = cloudfe.RecvMessage(0) + reroutable = false + } else if socketInPolled(localfe, sockets) { + msg, _ = localfe.RecvMessage(0) + reroutable = true + } else { + break // No work, go back to backends + } + + // If reroutable, send to cloud 20% of the time + // Here we'd normally use cloud status information + // + if reroutable && number_of_peers > 0 && rand.Intn(5) == 0 { + // Route to random broker peer + random_peer := os.Args[2+rand.Intn(number_of_peers)] + cloudbe.SendMessage(random_peer, "", msg) + } else { + localbe.SendMessage(workers[0], "", msg) + workers = workers[1:] + } + } + } + fmt.Println("Exit") +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} + +// Returns true if *Socket is in []Polled +func socketInPolled(s *zmq.Socket, p []zmq.Polled) bool { + for _, pp := range p { + if pp.Socket == s { + return true + } + } + return false +} diff --git a/vendor/github.com/pebbe/zmq4/examples/peering3.go b/vendor/github.com/pebbe/zmq4/examples/peering3.go new file mode 100644 index 0000000..334c376 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/peering3.go @@ -0,0 +1,335 @@ +// +// Broker peering simulation (part 3). +// Prototypes the full flow of status and tasks +// + +/* + +One of the differences between peering2 and peering3 is that +peering2 always uses Poll() and then uses a helper function socketInPolled() +to check if a specific socket returned a result, while peering3 uses PollAll() +and checks the event state of the socket in a specific index in the list. + +*/ + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "os" + "strconv" + "strings" + "time" +) + +const ( + NBR_CLIENTS = 10 + NBR_WORKERS = 5 + WORKER_READY = "**READY**" // Signals worker is ready +) + +var ( + // Our own name; in practice this would be configured per node + self string +) + +// This is the client task. It issues a burst of requests and then +// sleeps for a few seconds. This simulates sporadic activity; when +// a number of clients are active at once, the local workers should +// be overloaded. The client uses a REQ socket for requests and also +// pushes statistics to the monitor socket: + +func client_task(i int) { + client, _ := zmq.NewSocket(zmq.REQ) + defer client.Close() + client.Connect("ipc://" + self + "-localfe.ipc") + monitor, _ := zmq.NewSocket(zmq.PUSH) + defer monitor.Close() + monitor.Connect("ipc://" + self + "-monitor.ipc") + + poller := zmq.NewPoller() + poller.Add(client, zmq.POLLIN) + for { + time.Sleep(time.Duration(rand.Intn(5000)) * time.Millisecond) + for burst := rand.Intn(15); burst > 0; burst-- { + task_id := fmt.Sprintf("%04X-%s-%d", rand.Intn(0x10000), self, i) + + // Send request with random hex ID + client.Send(task_id, 0) + + // Wait max ten seconds for a reply, then complain + sockets, err := poller.Poll(10 * time.Second) + if err != nil { + break // Interrupted + } + + if len(sockets) == 1 { + reply, err := client.Recv(0) + if err != nil { + break // Interrupted + } + // Worker is supposed to answer us with our task id + id := strings.Fields(reply)[0] + if id != task_id { + panic("id != task_id") + } + monitor.Send(reply, 0) + } else { + monitor.Send("E: CLIENT EXIT - lost task "+task_id, 0) + return + } + } + } +} + +// This is the worker task, which uses a REQ socket to plug into the +// load-balancer. It's the same stub worker task you've seen in other +// examples: + +func worker_task(i int) { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + worker.Connect("ipc://" + self + "-localbe.ipc") + + // Tell broker we're ready for work + worker.SendMessage(WORKER_READY) + + // Process messages as they arrive + for { + msg, err := worker.RecvMessage(0) + if err != nil { + break // Interrupted + } + + // Workers are busy for 0/1 seconds + time.Sleep(time.Duration(rand.Intn(2)) * time.Second) + n := len(msg) - 1 + worker.SendMessage(msg[:n], fmt.Sprintf("%s %s-%d", msg[n], self, i)) + } +} + +// The main task begins by setting-up all its sockets. The local frontend +// talks to clients, and our local backend talks to workers. The cloud +// frontend talks to peer brokers as if they were clients, and the cloud +// backend talks to peer brokers as if they were workers. The state +// backend publishes regular state messages, and the state frontend +// subscribes to all state backends to collect these messages. Finally, +// we use a PULL monitor socket to collect printable messages from tasks: + +func main() { + // First argument is this broker's name + // Other arguments are our peers' names + // + if len(os.Args) < 2 { + fmt.Println("syntax: peering1 me {you}...") + os.Exit(1) + } + self = os.Args[1] + fmt.Printf("I: preparing broker at %s...\n", self) + rand.Seed(time.Now().UnixNano()) + + // Prepare local frontend and backend + localfe, _ := zmq.NewSocket(zmq.ROUTER) + defer localfe.Close() + localfe.Bind("ipc://" + self + "-localfe.ipc") + + localbe, _ := zmq.NewSocket(zmq.ROUTER) + defer localbe.Close() + localbe.Bind("ipc://" + self + "-localbe.ipc") + + // Bind cloud frontend to endpoint + cloudfe, _ := zmq.NewSocket(zmq.ROUTER) + defer cloudfe.Close() + cloudfe.SetIdentity(self) + cloudfe.Bind("ipc://" + self + "-cloud.ipc") + + // Connect cloud backend to all peers + cloudbe, _ := zmq.NewSocket(zmq.ROUTER) + defer cloudbe.Close() + cloudbe.SetIdentity(self) + for _, peer := range os.Args[2:] { + fmt.Printf("I: connecting to cloud frontend at '%s'\n", peer) + cloudbe.Connect("ipc://" + peer + "-cloud.ipc") + } + // Bind state backend to endpoint + statebe, _ := zmq.NewSocket(zmq.PUB) + defer statebe.Close() + statebe.Bind("ipc://" + self + "-state.ipc") + + // Connect state frontend to all peers + statefe, _ := zmq.NewSocket(zmq.SUB) + defer statefe.Close() + statefe.SetSubscribe("") + for _, peer := range os.Args[2:] { + fmt.Printf("I: connecting to state backend at '%s'\n", peer) + statefe.Connect("ipc://" + peer + "-state.ipc") + } + // Prepare monitor socket + monitor, _ := zmq.NewSocket(zmq.PULL) + defer monitor.Close() + monitor.Bind("ipc://" + self + "-monitor.ipc") + + // After binding and connecting all our sockets, we start our child + // tasks - workers and clients: + + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task(worker_nbr) + } + + // Start local clients + for client_nbr := 0; client_nbr < NBR_CLIENTS; client_nbr++ { + go client_task(client_nbr) + } + + // Queue of available workers + local_capacity := 0 + cloud_capacity := 0 + workers := make([]string, 0) + + primary := zmq.NewPoller() + primary.Add(localbe, zmq.POLLIN) + primary.Add(cloudbe, zmq.POLLIN) + primary.Add(statefe, zmq.POLLIN) + primary.Add(monitor, zmq.POLLIN) + + secondary1 := zmq.NewPoller() + secondary1.Add(localfe, zmq.POLLIN) + secondary2 := zmq.NewPoller() + secondary2.Add(localfe, zmq.POLLIN) + secondary2.Add(cloudfe, zmq.POLLIN) + + msg := make([]string, 0) + for { + + // If we have no workers ready, wait indefinitely + timeout := time.Duration(time.Second) + if local_capacity == 0 { + timeout = -1 + } + sockets, err := primary.PollAll(timeout) + if err != nil { + break // Interrupted + } + + // Track if capacity changes during this iteration + previous := local_capacity + + // Handle reply from local worker + msg = msg[0:0] + + if sockets[0].Events&zmq.POLLIN != 0 { // 0 == localbe + msg, err = localbe.RecvMessage(0) + if err != nil { + break // Interrupted + } + var identity string + identity, msg = unwrap(msg) + workers = append(workers, identity) + local_capacity++ + + // If it's READY, don't route the message any further + if msg[0] == WORKER_READY { + msg = msg[0:0] + } + } else if sockets[1].Events&zmq.POLLIN != 0 { // 1 == cloudbe + // Or handle reply from peer broker + msg, err = cloudbe.RecvMessage(0) + if err != nil { + break // Interrupted + } + // We don't use peer broker identity for anything + _, msg = unwrap(msg) + } + + if len(msg) > 0 { + + // Route reply to cloud if it's addressed to a broker + to_broker := false + for _, peer := range os.Args[2:] { + if peer == msg[0] { + to_broker = true + break + } + } + if to_broker { + cloudfe.SendMessage(msg) + } else { + localfe.SendMessage(msg) + } + } + + // If we have input messages on our statefe or monitor sockets we + // can process these immediately: + + if sockets[2].Events&zmq.POLLIN != 0 { // 2 == statefe + var status string + m, _ := statefe.RecvMessage(0) + _, m = unwrap(m) // peer + status, _ = unwrap(m) + cloud_capacity, _ = strconv.Atoi(status) + } + if sockets[3].Events&zmq.POLLIN != 0 { // 3 == monitor + status, _ := monitor.Recv(0) + fmt.Println(status) + } + // Now route as many clients requests as we can handle. If we have + // local capacity we poll both localfe and cloudfe. If we have cloud + // capacity only, we poll just localfe. We route any request locally + // if we can, else we route to the cloud. + + for local_capacity+cloud_capacity > 0 { + var sockets []zmq.Polled + var err error + if local_capacity > 0 { + sockets, err = secondary2.PollAll(0) + } else { + sockets, err = secondary1.PollAll(0) + } + if err != nil { + panic(err) + } + + if sockets[0].Events&zmq.POLLIN != 0 { // 0 == localfe + msg, _ = localfe.RecvMessage(0) + } else if len(sockets) > 1 && sockets[1].Events&zmq.POLLIN != 0 { // 1 == cloudfe + msg, _ = cloudfe.RecvMessage(0) + } else { + break // No work, go back to primary + } + + if local_capacity > 0 { + localbe.SendMessage(workers[0], "", msg) + workers = workers[1:] + local_capacity-- + } else { + // Route to random broker peer + random_peer := rand.Intn(len(os.Args)-2) + 2 + cloudbe.SendMessage(os.Args[random_peer], "", msg) + } + } + // We broadcast capacity messages to other peers; to reduce chatter + // we do this only if our capacity changed. + + if local_capacity != previous { + // We stick our own identity onto the envelope + // Broadcast new capacity + statebe.SendMessage(self, "", local_capacity) + } + } +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/ppqueue.go b/vendor/github.com/pebbe/zmq4/examples/ppqueue.go new file mode 100644 index 0000000..9296fe2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/ppqueue.go @@ -0,0 +1,166 @@ +// +// Paranoid Pirate queue. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +const ( + HEARTBEAT_LIVENESS = 3 // 3-5 is reasonable + HEARTBEAT_INTERVAL = 1000 * time.Millisecond // msecs + + PPP_READY = "\001" // Signals worker is ready + PPP_HEARTBEAT = "\002" // Signals worker heartbeat +) + +// Here we define the worker class; a structure and a set of functions that +// as constructor, destructor, and methods on worker objects: + +type worker_t struct { + identity string // Identity of worker + id_string string // Printable identity + expire time.Time // Expires at this time +} + +// Construct new worker +func s_worker_new(identity string) worker_t { + return worker_t{ + identity: identity, + id_string: identity, + expire: time.Now().Add(HEARTBEAT_INTERVAL * HEARTBEAT_LIVENESS), + } +} + +// The ready method puts a worker to the end of the ready list: + +func s_worker_ready(self worker_t, workers []worker_t) []worker_t { + for i, worker := range workers { + if self.id_string == worker.id_string { + if i == 0 { + workers = workers[1:] + } else if i == len(workers)-1 { + workers = workers[:i] + } else { + workers = append(workers[:i], workers[i+1:]...) + } + break + } + } + return append(workers, self) +} + +// The purge method looks for and kills expired workers. We hold workers +// from oldest to most recent, so we stop at the first alive worker: + +func s_workers_purge(workers []worker_t) []worker_t { + now := time.Now() + for i, worker := range workers { + if now.Before(worker.expire) { + return workers[i:] // Worker is alive, we're done here + } + } + return workers[0:0] +} + +// The main task is a load-balancer with heartbeating on workers so we +// can detect crashed or blocked worker tasks: + +func main() { + frontend, _ := zmq.NewSocket(zmq.ROUTER) + backend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + defer backend.Close() + frontend.Bind("tcp://*:5555") // For clients + backend.Bind("tcp://*:5556") // For workers + + // List of available workers + workers := make([]worker_t, 0) + + // Send out heartbeats at regular intervals + heartbeat_at := time.Tick(HEARTBEAT_INTERVAL) + + poller1 := zmq.NewPoller() + poller1.Add(backend, zmq.POLLIN) + poller2 := zmq.NewPoller() + poller2.Add(backend, zmq.POLLIN) + poller2.Add(frontend, zmq.POLLIN) + + for { + // Poll frontend only if we have available workers + var sockets []zmq.Polled + var err error + if len(workers) > 0 { + sockets, err = poller2.Poll(HEARTBEAT_INTERVAL) + } else { + sockets, err = poller1.Poll(HEARTBEAT_INTERVAL) + } + if err != nil { + break // Interrupted + } + + for _, socket := range sockets { + switch socket.Socket { + case backend: + // Handle worker activity on backend + // Use worker identity for load-balancing + msg, err := backend.RecvMessage(0) + if err != nil { + break // Interrupted + } + + // Any sign of life from worker means it's ready + identity, msg := unwrap(msg) + workers = s_worker_ready(s_worker_new(identity), workers) + + // Validate control message, or return reply to client + if len(msg) == 1 { + if msg[0] != PPP_READY && msg[0] != PPP_HEARTBEAT { + fmt.Println("E: invalid message from worker", msg) + } + } else { + frontend.SendMessage(msg) + } + case frontend: + // Now get next client request, route to next worker + msg, err := frontend.RecvMessage(0) + if err != nil { + break // Interrupted + } + backend.SendMessage(workers[0].identity, msg) + workers = workers[1:] + } + } + + // We handle heartbeating after any socket activity. First we send + // heartbeats to any idle workers if it's time. Then we purge any + // dead workers: + + select { + case <-heartbeat_at: + for _, worker := range workers { + backend.SendMessage(worker.identity, PPP_HEARTBEAT) + } + default: + } + workers = s_workers_purge(workers) + } +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/ppworker.go b/vendor/github.com/pebbe/zmq4/examples/ppworker.go new file mode 100644 index 0000000..69c79b6 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/ppworker.go @@ -0,0 +1,130 @@ +// +// Paranoid Pirate worker. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +const ( + HEARTBEAT_LIVENESS = 3 // 3-5 is reasonable + HEARTBEAT_INTERVAL = 1000 * time.Millisecond // msecs + INTERVAL_INIT = 1000 * time.Millisecond // Initial reconnect + INTERVAL_MAX = 32000 * time.Millisecond // After exponential backoff + + // Paranoid Pirate Protocol constants + PPP_READY = "\001" // Signals worker is ready + PPP_HEARTBEAT = "\002" // Signals worker heartbeat +) + +// Helper function that returns a new configured socket +// connected to the Paranoid Pirate queue + +func s_worker_socket() (*zmq.Socket, *zmq.Poller) { + worker, _ := zmq.NewSocket(zmq.DEALER) + worker.Connect("tcp://localhost:5556") + + // Tell queue we're ready for work + fmt.Println("I: worker ready") + worker.Send(PPP_READY, 0) + + poller := zmq.NewPoller() + poller.Add(worker, zmq.POLLIN) + + return worker, poller +} + +// We have a single task, which implements the worker side of the +// Paranoid Pirate Protocol (PPP). The interesting parts here are +// the heartbeating, which lets the worker detect if the queue has +// died, and vice-versa: + +func main() { + worker, poller := s_worker_socket() + + // If liveness hits zero, queue is considered disconnected + liveness := HEARTBEAT_LIVENESS + interval := INTERVAL_INIT + + // Send out heartbeats at regular intervals + heartbeat_at := time.Tick(HEARTBEAT_INTERVAL) + + rand.Seed(time.Now().UnixNano()) + for cycles := 0; true; { + sockets, err := poller.Poll(HEARTBEAT_INTERVAL) + if err != nil { + break // Interrupted + } + + if len(sockets) == 1 { + // Get message + // - 3-part envelope + content -> request + // - 1-part HEARTBEAT -> heartbeat + msg, err := worker.RecvMessage(0) + if err != nil { + break // Interrupted + } + + // To test the robustness of the queue implementation we // + // simulate various typical problems, such as the worker + // crashing, or running very slowly. We do this after a few + // cycles so that the architecture can get up and running + // first: + if len(msg) == 3 { + cycles++ + if cycles > 3 && rand.Intn(5) == 0 { + fmt.Println("I: simulating a crash") + break + } else if cycles > 3 && rand.Intn(5) == 0 { + fmt.Println("I: simulating CPU overload") + time.Sleep(3 * time.Second) + } + fmt.Println("I: normal reply") + worker.SendMessage(msg) + liveness = HEARTBEAT_LIVENESS + time.Sleep(time.Second) // Do some heavy work + } else if len(msg) == 1 { + // When we get a heartbeat message from the queue, it means the + // queue was (recently) alive, so reset our liveness indicator: + if msg[0] == PPP_HEARTBEAT { + liveness = HEARTBEAT_LIVENESS + } else { + fmt.Printf("E: invalid message: %q\n", msg) + } + } else { + fmt.Printf("E: invalid message: %q\n", msg) + } + interval = INTERVAL_INIT + } else { + // If the queue hasn't sent us heartbeats in a while, destroy the + // socket and reconnect. This is the simplest most brutal way of + // discarding any messages we might have sent in the meantime:// + liveness-- + if liveness == 0 { + fmt.Println("W: heartbeat failure, can't reach queue") + fmt.Println("W: reconnecting in", interval) + time.Sleep(interval) + + if interval < INTERVAL_MAX { + interval = 2 * interval + } + worker, poller = s_worker_socket() + liveness = HEARTBEAT_LIVENESS + } + } + + // Send heartbeat to queue if it's time + select { + case <-heartbeat_at: + fmt.Println("I: worker heartbeat") + worker.Send(PPP_HEARTBEAT, 0) + default: + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/psenvpub.go b/vendor/github.com/pebbe/zmq4/examples/psenvpub.go new file mode 100644 index 0000000..f717ec2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/psenvpub.go @@ -0,0 +1,27 @@ +// +// Pubsub envelope publisher. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "time" +) + +func main() { + // Prepare our publisher + publisher, _ := zmq.NewSocket(zmq.PUB) + defer publisher.Close() + publisher.Bind("tcp://*:5563") + + for { + // Write two messages, each with an envelope and content + publisher.Send("A", zmq.SNDMORE) + publisher.Send("We don't want to see this", 0) + publisher.Send("B", zmq.SNDMORE) + publisher.Send("We would like to see this", 0) + time.Sleep(time.Second) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/psenvsub.go b/vendor/github.com/pebbe/zmq4/examples/psenvsub.go new file mode 100644 index 0000000..3cd61f2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/psenvsub.go @@ -0,0 +1,27 @@ +// +// Pubsub envelope subscriber. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + // Prepare our subscriber + subscriber, _ := zmq.NewSocket(zmq.SUB) + defer subscriber.Close() + subscriber.Connect("tcp://localhost:5563") + subscriber.SetSubscribe("B") + + for { + // Read envelope with address + address, _ := subscriber.Recv(0) + // Read message contents + contents, _ := subscriber.Recv(0) + fmt.Printf("[%s] %s\n", address, contents) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/rrbroker.go b/vendor/github.com/pebbe/zmq4/examples/rrbroker.go new file mode 100644 index 0000000..e29dd11 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/rrbroker.go @@ -0,0 +1,53 @@ +// +// Simple request-reply broker. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" +) + +func main() { + // Prepare our sockets + frontend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + backend, _ := zmq.NewSocket(zmq.DEALER) + defer backend.Close() + frontend.Bind("tcp://*:5559") + backend.Bind("tcp://*:5560") + + // Initialize poll set + poller := zmq.NewPoller() + poller.Add(frontend, zmq.POLLIN) + poller.Add(backend, zmq.POLLIN) + + // Switch messages between sockets + for { + sockets, _ := poller.Poll(-1) + for _, socket := range sockets { + switch s := socket.Socket; s { + case frontend: + for { + msg, _ := s.Recv(0) + if more, _ := s.GetRcvmore(); more { + backend.Send(msg, zmq.SNDMORE) + } else { + backend.Send(msg, 0) + break + } + } + case backend: + for { + msg, _ := s.Recv(0) + if more, _ := s.GetRcvmore(); more { + frontend.Send(msg, zmq.SNDMORE) + } else { + frontend.Send(msg, 0) + break + } + } + } + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/rrclient.go b/vendor/github.com/pebbe/zmq4/examples/rrclient.go new file mode 100644 index 0000000..40cca47 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/rrclient.go @@ -0,0 +1,25 @@ +// +// Request-reply client. +// Connects REQ socket to tcp://localhost:5559 +// Sends "Hello" to server, expects "World" back +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + requester, _ := zmq.NewSocket(zmq.REQ) + defer requester.Close() + requester.Connect("tcp://localhost:5559") + + for request := 0; request < 10; request++ { + requester.Send("Hello", 0) + reply, _ := requester.Recv(0) + fmt.Printf("Received reply %d [%s]\n", request, reply) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/rrworker.go b/vendor/github.com/pebbe/zmq4/examples/rrworker.go new file mode 100644 index 0000000..399f598 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/rrworker.go @@ -0,0 +1,33 @@ +// +// Hello World worker. +// Connects REP socket to tcp://*:5560 +// Expects "Hello" from client, replies with "World" +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + // Socket to talk to clients + responder, _ := zmq.NewSocket(zmq.REP) + defer responder.Close() + responder.Connect("tcp://localhost:5560") + + for { + // Wait for next request from client + request, _ := responder.Recv(0) + fmt.Printf("Received request: [%s]\n", request) + + // Do some 'work' + time.Sleep(time.Second) + + // Send reply back to client + responder.Send("World", 0) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/rtdealer.go b/vendor/github.com/pebbe/zmq4/examples/rtdealer.go new file mode 100644 index 0000000..6e8a269 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/rtdealer.go @@ -0,0 +1,84 @@ +// +// ROUTER-to-DEALER example. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +const ( + NBR_WORKERS = 10 +) + +func worker_task() { + worker, _ := zmq.NewSocket(zmq.DEALER) + defer worker.Close() + set_id(worker) // Set a printable identity + worker.Connect("tcp://localhost:5671") + + total := 0 + for { + // Tell the broker we're ready for work + worker.Send("", zmq.SNDMORE) + worker.Send("Hi Boss", 0) + + // Get workload from broker, until finished + worker.Recv(0) // Envelope delimiter + workload, _ := worker.Recv(0) + if workload == "Fired!" { + fmt.Printf("Completed: %d tasks\n", total) + break + } + total++ + + // Do some random work + time.Sleep(time.Duration(rand.Intn(500)+1) * time.Millisecond) + } +} + +func main() { + broker, _ := zmq.NewSocket(zmq.ROUTER) + defer broker.Close() + + broker.Bind("tcp://*:5671") + rand.Seed(time.Now().UnixNano()) + + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task() + } + // Run for five seconds and then tell workers to end + start_time := time.Now() + workers_fired := 0 + for { + // Next message gives us least recently used worker + identity, _ := broker.Recv(0) + broker.Send(identity, zmq.SNDMORE) + broker.Recv(0) // Envelope delimiter + broker.Recv(0) // Response from worker + broker.Send("", zmq.SNDMORE) + + // Encourage workers until it's time to fire them + if time.Since(start_time) < 5*time.Second { + broker.Send("Work harder", 0) + } else { + broker.Send("Fired!", 0) + workers_fired++ + if workers_fired == NBR_WORKERS { + break + } + } + } + + time.Sleep(time.Second) +} + +func set_id(soc *zmq.Socket) { + identity := fmt.Sprintf("%04X-%04X", rand.Intn(0x10000), rand.Intn(0x10000)) + soc.SetIdentity(identity) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/rtreq.go b/vendor/github.com/pebbe/zmq4/examples/rtreq.go new file mode 100644 index 0000000..25accd3 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/rtreq.go @@ -0,0 +1,82 @@ +// +// ROUTER-to-REQ example. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +const ( + NBR_WORKERS = 10 +) + +func worker_task() { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + set_id(worker) + worker.Connect("tcp://localhost:5671") + + total := 0 + for { + // Tell the broker we're ready for work + worker.Send("Hi Boss", 0) + + // Get workload from broker, until finished + workload, _ := worker.Recv(0) + if workload == "Fired!" { + fmt.Printf("Completed: %d tasks\n", total) + break + } + total++ + + // Do some random work + time.Sleep(time.Duration(rand.Intn(500)+1) * time.Millisecond) + } +} + +func main() { + broker, _ := zmq.NewSocket(zmq.ROUTER) + defer broker.Close() + + broker.Bind("tcp://*:5671") + rand.Seed(time.Now().UnixNano()) + + for worker_nbr := 0; worker_nbr < NBR_WORKERS; worker_nbr++ { + go worker_task() + } + // Run for five seconds and then tell workers to end + start_time := time.Now() + workers_fired := 0 + for { + // Next message gives us least recently used worker + identity, _ := broker.Recv(0) + broker.Send(identity, zmq.SNDMORE) + broker.Recv(0) // Envelope delimiter + broker.Recv(0) // Response from worker + broker.Send("", zmq.SNDMORE) + + // Encourage workers until it's time to fire them + if time.Since(start_time) < 5*time.Second { + broker.Send("Work harder", 0) + } else { + broker.Send("Fired!", 0) + workers_fired++ + if workers_fired == NBR_WORKERS { + break + } + } + } + + time.Sleep(time.Second) +} + +func set_id(soc *zmq.Socket) { + identity := fmt.Sprintf("%04X-%04X", rand.Intn(0x10000), rand.Intn(0x10000)) + soc.SetIdentity(identity) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/spqueue.go b/vendor/github.com/pebbe/zmq4/examples/spqueue.go new file mode 100644 index 0000000..dfec0dd --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/spqueue.go @@ -0,0 +1,88 @@ +// +// Simple Pirate broker. +// This is identical to load-balancing pattern, with no reliability +// mechanisms. It depends on the client for recovery. Runs forever. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" +) + +const ( + WORKER_READY = "\001" // Signals worker is ready +) + +func main() { + frontend, _ := zmq.NewSocket(zmq.ROUTER) + backend, _ := zmq.NewSocket(zmq.ROUTER) + defer frontend.Close() + defer backend.Close() + frontend.Bind("tcp://*:5555") // For clients + backend.Bind("tcp://*:5556") // For workers + + // Queue of available workers + workers := make([]string, 0) + + poller1 := zmq.NewPoller() + poller1.Add(backend, zmq.POLLIN) + poller2 := zmq.NewPoller() + poller2.Add(backend, zmq.POLLIN) + poller2.Add(frontend, zmq.POLLIN) + + // The body of this example is exactly the same as lbbroker2. +LOOP: + for { + // Poll frontend only if we have available workers + var sockets []zmq.Polled + var err error + if len(workers) > 0 { + sockets, err = poller2.Poll(-1) + } else { + sockets, err = poller1.Poll(-1) + } + if err != nil { + break // Interrupted + } + for _, socket := range sockets { + switch s := socket.Socket; s { + case backend: // Handle worker activity on backend + // Use worker identity for load-balancing + msg, err := s.RecvMessage(0) + if err != nil { + break LOOP // Interrupted + } + var identity string + identity, msg = unwrap(msg) + workers = append(workers, identity) + + // Forward message to client if it's not a READY + if msg[0] != WORKER_READY { + frontend.SendMessage(msg) + } + + case frontend: + // Get client request, route to first available worker + msg, err := s.RecvMessage(0) + if err == nil { + backend.SendMessage(workers[0], "", msg) + workers = workers[1:] + } + } + } + } +} + +// Pops frame off front of message and returns it as 'head' +// If next frame is empty, pops that empty frame. +// Return remaining frames of message as 'tail' +func unwrap(msg []string) (head string, tail []string) { + head = msg[0] + if len(msg) > 1 && msg[1] == "" { + tail = msg[2:] + } else { + tail = msg[1:] + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/examples/spworker.go b/vendor/github.com/pebbe/zmq4/examples/spworker.go new file mode 100644 index 0000000..ba14f38 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/spworker.go @@ -0,0 +1,55 @@ +// +// Simple Pirate worker. +// Connects REQ socket to tcp://*:5556 +// Implements worker part of load-balancing +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +const ( + WORKER_READY = "\001" // Signals worker is ready +) + +func main() { + worker, _ := zmq.NewSocket(zmq.REQ) + defer worker.Close() + + // Set random identity to make tracing easier + rand.Seed(time.Now().UnixNano()) + identity := fmt.Sprintf("%04X-%04X", rand.Intn(0x10000), rand.Intn(0x10000)) + worker.SetIdentity(identity) + worker.Connect("tcp://localhost:5556") + + // Tell broker we're ready for work + fmt.Printf("I: (%s) worker ready\n", identity) + worker.Send(WORKER_READY, 0) + + for cycles := 0; true; { + msg, err := worker.RecvMessage(0) + if err != nil { + break // Interrupted + } + + // Simulate various problems, after a few cycles + cycles++ + if cycles > 3 && rand.Intn(5) == 0 { + fmt.Printf("I: (%s) simulating a crash\n", identity) + break + } else if cycles > 3 && rand.Intn(5) == 0 { + fmt.Printf("I: (%s) simulating CPU overload\n", identity) + time.Sleep(3 * time.Second) + } + + fmt.Printf("I: (%s) normal reply\n", identity) + time.Sleep(time.Second) // Do some heavy work + worker.SendMessage(msg) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/suisnail.go b/vendor/github.com/pebbe/zmq4/examples/suisnail.go new file mode 100644 index 0000000..ef9d12f --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/suisnail.go @@ -0,0 +1,83 @@ +// +// Suicidal Snail +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "math/rand" + "strconv" + "time" +) + +// This is our subscriber. It connects to the publisher and subscribes to +// everything. It sleeps for a short time between messages to simulate doing +// too much work. If a message is more than 1 second late, it croaks: + +const ( + MAX_ALLOWED_DELAY = 1000 * time.Millisecond +) + +func subscriber(pipe chan<- string) { + // Subscribe to everything + subscriber, _ := zmq.NewSocket(zmq.SUB) + subscriber.SetSubscribe("") + subscriber.Connect("tcp://localhost:5556") + defer subscriber.Close() + + // Get and process messages + for { + msg, _ := subscriber.RecvMessage(0) + i, _ := strconv.Atoi(msg[0]) + clock := time.Unix(int64(i), 0) + fmt.Println(clock) + + // Suicide snail logic + if time.Now().After(clock.Add(MAX_ALLOWED_DELAY)) { + log.Println("E: subscriber cannot keep up, aborting") + break + } + // Work for 1 msec plus some random additional time + time.Sleep(time.Duration(1 + rand.Intn(2))) + } + pipe <- "gone and died" +} + +// This is our publisher task. It publishes a time-stamped message to its +// PUB socket every 1 msec: + +func publisher(pipe <-chan string) { + // Prepare publisher + publisher, _ := zmq.NewSocket(zmq.PUB) + publisher.Bind("tcp://*:5556") + defer publisher.Close() + +LOOP: + for { + // Send current clock (msecs) to subscribers + publisher.SendMessage(time.Now().Unix()) + select { + case <-pipe: + break LOOP + default: + } + time.Sleep(time.Millisecond) + } +} + +// The main task simply starts a client, and a server, and then +// waits for the client to signal that it has died: + +func main() { + pubpipe := make(chan string) + subpipe := make(chan string) + go publisher(pubpipe) + go subscriber(subpipe) + <-subpipe + pubpipe <- "break" + time.Sleep(100 * time.Millisecond) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/sync.sh b/vendor/github.com/pebbe/zmq4/examples/sync.sh new file mode 100755 index 0000000..2ac6135 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/sync.sh @@ -0,0 +1,12 @@ +#!/bin/sh +echo "Starting subscribers..." +for i in 1 2 3 4 5 6 7 8 9 10 +do + ./syncsub & +done +echo "Starting publisher..." +./syncpub +# have all subscribers finished? +sleep 1 +echo Still running instances of syncsub: +ps | grep syncsub diff --git a/vendor/github.com/pebbe/zmq4/examples/syncpub.go b/vendor/github.com/pebbe/zmq4/examples/syncpub.go new file mode 100644 index 0000000..dac0149 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/syncpub.go @@ -0,0 +1,50 @@ +// +// Synchronized publisher. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +const ( + // We wait for 10 subscribers + SUBSCRIBERS_EXPECTED = 10 +) + +func main() { + + ctx, _ := zmq.NewContext() + defer ctx.Term() + + // Socket to talk to clients + publisher, _ := ctx.NewSocket(zmq.PUB) + defer publisher.Close() + publisher.SetSndhwm(1100000) + publisher.Bind("tcp://*:5561") + + // Socket to receive signals + syncservice, _ := ctx.NewSocket(zmq.REP) + defer syncservice.Close() + syncservice.Bind("tcp://*:5562") + + // Get synchronization from subscribers + fmt.Println("Waiting for subscribers") + for subscribers := 0; subscribers < SUBSCRIBERS_EXPECTED; subscribers++ { + // - wait for synchronization request + syncservice.Recv(0) + // - send synchronization reply + syncservice.Send("", 0) + } + // Now broadcast exactly 1M updates followed by END + fmt.Println("Broadcasting messages") + for update_nbr := 0; update_nbr < 1000000; update_nbr++ { + publisher.Send("Rhubarb", 0) + } + + publisher.Send("END", 0) + +} diff --git a/vendor/github.com/pebbe/zmq4/examples/syncsub.go b/vendor/github.com/pebbe/zmq4/examples/syncsub.go new file mode 100644 index 0000000..c83f8bb --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/syncsub.go @@ -0,0 +1,51 @@ +// +// Synchronized subscriber +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "time" +) + +func main() { + + // First, connect our subscriber socket + subscriber, _ := zmq.NewSocket(zmq.SUB) + defer subscriber.Close() + subscriber.Connect("tcp://localhost:5561") + subscriber.SetSubscribe("") + + // 0MQ is so fast, we need to wait a while... + time.Sleep(time.Second) + + // Second, synchronize with publisher + syncclient, _ := zmq.NewSocket(zmq.REQ) + defer syncclient.Close() + syncclient.Connect("tcp://localhost:5562") + + // - send a synchronization request + syncclient.Send("", 0) + + // - wait for synchronization reply + syncclient.Recv(0) + + // Third, get our updates and report how many we got + update_nbr := 0 + for { + msg, e := subscriber.Recv(0) + if e != nil { + log.Println(e) + break + } + if msg == "END" { + break + } + update_nbr++ + } + fmt.Printf("Received %d updates\n", update_nbr) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/tasksink.go b/vendor/github.com/pebbe/zmq4/examples/tasksink.go new file mode 100644 index 0000000..adc6427 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/tasksink.go @@ -0,0 +1,40 @@ +// +// Task sink. +// Binds PULL socket to tcp://localhost:5558 +// Collects results from workers via that socket +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + // Prepare our socket + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Bind("tcp://*:5558") + + // Wait for start of batch + receiver.Recv(0) + + // Start our clock now + start_time := time.Now() + + // Process 100 confirmations + for task_nbr := 0; task_nbr < 100; task_nbr++ { + receiver.Recv(0) + if task_nbr%10 == 0 { + fmt.Print(":") + } else { + fmt.Print(".") + } + } + + // Calculate and report duration of batch + fmt.Println("\nTotal elapsed time:", time.Since(start_time)) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/tasksink2.go b/vendor/github.com/pebbe/zmq4/examples/tasksink2.go new file mode 100644 index 0000000..4519579 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/tasksink2.go @@ -0,0 +1,48 @@ +// +// Task sink - design 2. +// Adds pub-sub flow to send kill signal to workers +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func main() { + // Socket to receive messages on + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Bind("tcp://*:5558") + + // Socket for worker control + controller, _ := zmq.NewSocket(zmq.PUB) + defer controller.Close() + controller.Bind("tcp://*:5559") + + // Wait for start of batch + receiver.Recv(0) + + // Start our clock now + start_time := time.Now() + + // Process 100 confirmations + for task_nbr := 0; task_nbr < 100; task_nbr++ { + receiver.Recv(0) + if task_nbr%10 == 0 { + fmt.Print(":") + } else { + fmt.Print(".") + } + } + fmt.Println("\nTotal elapsed time:", time.Since(start_time)) + + // Send kill signal to workers + controller.Send("KILL", 0) + + // Finished + time.Sleep(time.Second) // Give 0MQ time to deliver +} diff --git a/vendor/github.com/pebbe/zmq4/examples/taskvent.go b/vendor/github.com/pebbe/zmq4/examples/taskvent.go new file mode 100644 index 0000000..c754132 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/taskvent.go @@ -0,0 +1,51 @@ +// +// Task ventilator. +// Binds PUSH socket to tcp://localhost:5557 +// Sends batch of tasks to workers via that socket +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +func main() { + // Socket to send messages on + sender, _ := zmq.NewSocket(zmq.PUSH) + defer sender.Close() + sender.Bind("tcp://*:5557") + + // Socket to send start of batch message on + sink, _ := zmq.NewSocket(zmq.PUSH) + defer sink.Close() + sink.Connect("tcp://localhost:5558") + + fmt.Print("Press Enter when the workers are ready: ") + var line string + fmt.Scanln(&line) + fmt.Println("Sending tasks to workers...") + + // The first message is "0" and signals start of batch + sink.Send("0", 0) + + // Initialize random number generator + rand.Seed(time.Now().UnixNano()) + + // Send 100 tasks + total_msec := 0 + for task_nbr := 0; task_nbr < 100; task_nbr++ { + // Random workload from 1 to 100msecs + workload := rand.Intn(100) + 1 + total_msec += workload + s := fmt.Sprintf("%d", workload) + sender.Send(s, 0) + } + fmt.Println("Total expected cost:", time.Duration(total_msec)*time.Millisecond) + time.Sleep(time.Second) // Give 0MQ time to deliver + +} diff --git a/vendor/github.com/pebbe/zmq4/examples/taskwork.go b/vendor/github.com/pebbe/zmq4/examples/taskwork.go new file mode 100644 index 0000000..3ea04dc --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/taskwork.go @@ -0,0 +1,44 @@ +// +// Task worker. +// Connects PULL socket to tcp://localhost:5557 +// Collects workloads from ventilator via that socket +// Connects PUSH socket to tcp://localhost:5558 +// Sends results to sink via that socket +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strconv" + "time" +) + +func main() { + // Socket to receive messages on + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Connect("tcp://localhost:5557") + + // Socket to send messages to + sender, _ := zmq.NewSocket(zmq.PUSH) + defer sender.Close() + sender.Connect("tcp://localhost:5558") + + // Process tasks forever + for { + s, _ := receiver.Recv(0) + + // Simple progress indicator for the viewer + fmt.Print(s + ".") + + // Do the work + msec, _ := strconv.Atoi(s) + time.Sleep(time.Duration(msec) * time.Millisecond) + + // Send results to sink + sender.Send("", 0) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/taskwork2.go b/vendor/github.com/pebbe/zmq4/examples/taskwork2.go new file mode 100644 index 0000000..2995991 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/taskwork2.go @@ -0,0 +1,62 @@ +// +// Task worker - design 2. +// Adds pub-sub flow to receive and respond to kill signal +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "strconv" + "time" +) + +func main() { + // Socket to receive messages on + receiver, _ := zmq.NewSocket(zmq.PULL) + defer receiver.Close() + receiver.Connect("tcp://localhost:5557") + + // Socket to send messages to + sender, _ := zmq.NewSocket(zmq.PUSH) + defer sender.Close() + sender.Connect("tcp://localhost:5558") + + // Socket for control input + controller, _ := zmq.NewSocket(zmq.SUB) + defer controller.Close() + controller.Connect("tcp://localhost:5559") + controller.SetSubscribe("") + + // Process messages from receiver and controller + poller := zmq.NewPoller() + poller.Add(receiver, zmq.POLLIN) + poller.Add(controller, zmq.POLLIN) + // Process messages from both sockets +LOOP: + for { + sockets, _ := poller.Poll(-1) + for _, socket := range sockets { + switch s := socket.Socket; s { + case receiver: + msg, _ := s.Recv(0) + + // Do the work + t, _ := strconv.Atoi(msg) + time.Sleep(time.Duration(t) * time.Millisecond) + + // Send results to sink + sender.Send(msg, 0) + + // Simple progress indicator for the viewer + fmt.Printf(".") + case controller: + // Any controller command acts as 'KILL' + break LOOP // Exit loop + } + } + } + fmt.Println() +} diff --git a/vendor/github.com/pebbe/zmq4/examples/ticlient.go b/vendor/github.com/pebbe/zmq4/examples/ticlient.go new file mode 100644 index 0000000..9b50a5c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/ticlient.go @@ -0,0 +1,81 @@ +// +// Titanic client example. +// Implements client side of http://rfc.zeromq.org/spec:9 + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "errors" + "fmt" + "os" + "time" +) + +// Calls a TSP service +// Returns response if successful (status code 200 OK), else NULL +// +func ServiceCall(session *mdapi.Mdcli, service string, request ...string) (reply []string, err error) { + reply = []string{} + msg, err := session.Send(service, request...) + if err == nil { + switch status := msg[0]; status { + case "200": + reply = msg[1:] + return + case "400": + fmt.Println("E: client fatal error, aborting") + os.Exit(1) + case "500": + fmt.Println("E: server fatal error, aborting") + os.Exit(1) + } + } else { + fmt.Println("E: " + err.Error()) + os.Exit(0) + } + + err = errors.New("Didn't succeed") + return // Didn't succeed, don't care why not +} + +// The main task tests our service call by sending an echo request: + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + session, _ := mdapi.NewMdcli("tcp://localhost:5555", verbose) + + // 1. Send 'echo' request to Titanic + reply, err := ServiceCall(session, "titanic.request", "echo", "Hello world") + if err != nil { + fmt.Println(err) + return + } + + var uuid string + if err == nil { + uuid = reply[0] + fmt.Println("I: request UUID", uuid) + } + + time.Sleep(100 * time.Millisecond) + + // 2. Wait until we get a reply + for { + reply, err := ServiceCall(session, "titanic.reply", uuid) + if err == nil { + fmt.Println("Reply:", reply[0]) + + // 3. Close request + ServiceCall(session, "titanic.close", uuid) + break + } else { + fmt.Println("I: no reply yet, trying again...") + time.Sleep(5 * time.Second) // Try again in 5 seconds + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/titanic.go b/vendor/github.com/pebbe/zmq4/examples/titanic.go new file mode 100644 index 0000000..cb32ca6 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/titanic.go @@ -0,0 +1,235 @@ +// +// Titanic service. +// +// Implements server side of http://rfc.zeromq.org/spec:9 + +package main + +import ( + "github.com/pebbe/zmq4/examples/mdapi" + + "github.com/pborman/uuid" + + "fmt" + "io/ioutil" + "os" + "strings" + "time" +) + +// Returns freshly allocated request filename for given UUID + +const ( + TITANIC_DIR = ".titanic" +) + +func RequestFilename(uuid string) string { + return TITANIC_DIR + "/" + uuid + "req" +} + +// Returns freshly allocated reply filename for given UUID + +func ReplyFilename(uuid string) string { + return TITANIC_DIR + "/" + uuid + "rep" +} + +// The "titanic.request" task waits for requests to this service. It writes +// each request to disk and returns a UUID to the client. The client picks +// up the reply asynchronously using the "titanic.reply" service: + +func TitanicRequest(chRequest chan<- string) { + worker, _ := mdapi.NewMdwrk("tcp://localhost:5555", "titanic.request", false) + + reply := []string{} + for { + // Send reply if it's not null + // And then get next request from broker + request, err := worker.Recv(reply) + if err != nil { + break // Interrupted, exit + } + + // Ensure message directory exists + os.MkdirAll(TITANIC_DIR, 0700) + + // Generate UUID and save message to disk + uuid := uuid.New() + file, err := os.Create(RequestFilename(uuid)) + fmt.Fprint(file, strings.Join(request, "\n")) + file.Close() + + // Send UUID through to message queue + chRequest <- uuid + + // Now send UUID back to client + // Done by the mdwrk_recv() at the top of the loop + reply = []string{"200", uuid} + } +} + +// The "titanic.reply" task checks if there's a reply for the specified +// request (by UUID), and returns a 200 OK, 300 Pending, or 400 Unknown +// accordingly: + +func TitanicReply() { + worker, _ := mdapi.NewMdwrk("tcp://localhost:5555", "titanic.reply", false) + + pending := []string{"300"} + unknown := []string{"400"} + reply := []string{} + for { + request, err := worker.Recv(reply) + if err != nil { + break // Interrupted, exit + } + + uuid := request[0] + req_filename := RequestFilename(uuid) + rep_filename := ReplyFilename(uuid) + data, err := ioutil.ReadFile(rep_filename) + if err == nil { + reply = strings.Split("200\n"+string(data), "\n") + } else { + _, err := os.Stat(req_filename) + if err == nil { + reply = pending + } else { + reply = unknown + } + } + } +} + +// The "titanic.close" task removes any waiting replies for the request +// (specified by UUID). It's idempotent, so safe to call more than once +// in a row: + +func TitanicClose() { + worker, _ := mdapi.NewMdwrk("tcp://localhost:5555", "titanic.close", false) + + ok := []string{"200"} + reply := []string{} + for { + request, err := worker.Recv(reply) + if err != nil { + break // Interrupted, exit + } + + uuid := request[0] + os.Remove(RequestFilename(uuid)) + os.Remove(ReplyFilename(uuid)) + + reply = ok + } + +} + +// This is the main thread for the Titanic worker. It starts three child +// threads; for the request, reply, and close services. It then dispatches +// requests to workers using a simple brute-force disk queue. It receives +// request UUIDs from the titanic.request service, saves these to a disk +// file, and then throws each request at MDP workers until it gets a +// response: + +func main() { + var verbose bool + if len(os.Args) > 1 && os.Args[1] == "-v" { + verbose = true + } + + chRequest := make(chan string) + go TitanicRequest(chRequest) + go TitanicReply() + go TitanicClose() + + // Ensure message directory exists + os.MkdirAll(TITANIC_DIR, 0700) + + // Fill the queue + queue := make([]string, 0) + files, err := ioutil.ReadDir(TITANIC_DIR) + if err == nil { + for _, file := range files { + name := file.Name() + if strings.HasSuffix(name, "req") { + uuid := name[:len(name)-3] + _, err := os.Stat(ReplyFilename(uuid)) + if err != nil { + queue = append(queue, uuid) + } + } + } + } + + // Main dispatcher loop + for { + // We'll dispatch once per second, if there's no activity + select { + case <-time.After(time.Second): + case uuid := <-chRequest: + // Append UUID to queue + queue = append(queue, uuid) + } + + // Brute-force dispatcher + queue2 := make([]string, 0, len(queue)) + for _, entry := range queue { + if verbose { + fmt.Println("I: processing request", entry) + } + if !ServiceSuccess(entry) { + queue2 = append(queue2, entry) + } + } + queue = queue2 + } +} + +// Here we first check if the requested MDP service is defined or not, +// using a MMI lookup to the Majordomo broker. If the service exists +// we send a request and wait for a reply using the conventional MDP +// client API. This is not meant to be fast, just very simple: + +func ServiceSuccess(uuid string) bool { + // If reply already exists, treat as successful + _, err := os.Stat(ReplyFilename(uuid)) + if err == nil { + return true + } + + // Load request message, service will be first frame + data, err := ioutil.ReadFile(RequestFilename(uuid)) + + // If the client already closed request, treat as successful + if err != nil { + return true + } + + request := strings.Split(string(data), "\n") + + service_name := request[0] + request = request[1:] + + // Create MDP client session with short timeout + client, err := mdapi.NewMdcli("tcp://localhost:5555", false) + client.SetTimeout(time.Second) // 1 sec + client.SetRetries(1) // only 1 retry + + // Use MMI protocol to check if service is available + mmi_reply, err := client.Send("mmi.service", service_name) + if err != nil || mmi_reply[0] != "200" { + return false + } + + reply, err := client.Send(service_name, request...) + if err != nil { + return false + } + + file, err := os.Create(ReplyFilename(uuid)) + fmt.Fprint(file, strings.Join(reply, "\n")) + file.Close() + + return true + +} diff --git a/vendor/github.com/pebbe/zmq4/examples/tripping.go b/vendor/github.com/pebbe/zmq4/examples/tripping.go new file mode 100644 index 0000000..fa89520 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/tripping.go @@ -0,0 +1,82 @@ +// +// Round-trip demonstrator. +// +// While this example runs in a single process, that is just to make +// it easier to start and stop the example. The client task signals to +// main when it's ready. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "time" +) + +func ClientTask(pipe chan<- bool) { + client, _ := zmq.NewSocket(zmq.DEALER) + client.Connect("tcp://localhost:5555") + fmt.Println("Setting up test...") + time.Sleep(100 * time.Millisecond) + + fmt.Println("Synchronous round-trip test...") + start := time.Now() + var requests int + for requests = 0; requests < 10000; requests++ { + client.Send("hello", 0) + client.Recv(0) + } + fmt.Println(requests, "calls in", time.Since(start)) + + fmt.Println("Asynchronous round-trip test...") + start = time.Now() + for requests = 0; requests < 100000; requests++ { + client.Send("hello", 0) + } + for requests = 0; requests < 100000; requests++ { + client.Recv(0) + } + fmt.Println(requests, "calls in", time.Since(start)) + pipe <- true +} + +// Here is the worker task. All it does is receive a message, and +// bounce it back the way it came: + +func WorkerTask() { + worker, _ := zmq.NewSocket(zmq.DEALER) + worker.Connect("tcp://localhost:5556") + + for { + msg, _ := worker.RecvMessage(0) + worker.SendMessage(msg) + } +} + +// Here is the broker task. It uses the zmq_proxy function to switch +// messages between frontend and backend: + +func BrokerTask() { + // Prepare our sockets + frontend, _ := zmq.NewSocket(zmq.DEALER) + frontend.Bind("tcp://*:5555") + backend, _ := zmq.NewSocket(zmq.DEALER) + backend.Bind("tcp://*:5556") + zmq.Proxy(frontend, backend, nil) +} + +// Finally, here's the main task, which starts the client, worker, and +// broker, and then runs until the client signals it to stop: + +func main() { + // Create threads + pipe := make(chan bool) + go ClientTask(pipe) + go WorkerTask() + go BrokerTask() + + // Wait for signal on client pipe + <-pipe +} diff --git a/vendor/github.com/pebbe/zmq4/examples/udpping1.go b/vendor/github.com/pebbe/zmq4/examples/udpping1.go new file mode 100644 index 0000000..7264fc7 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/udpping1.go @@ -0,0 +1,103 @@ +// +// UDP ping command +// Model 1, does UDP work inline +// + +// this doesn't use ZeroMQ at all + +package main + +import ( + "fmt" + "log" + "syscall" + "time" +) + +const ( + PING_PORT_NUMBER = 9999 + PING_MSG_SIZE = 1 + PING_INTERVAL = 1000 * time.Millisecond // Once per second +) + +func main() { + + log.SetFlags(log.Lshortfile) + + // Create UDP socket + fd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, syscall.IPPROTO_UDP) + if err != nil { + log.Fatalln(err) + } + + // Ask operating system to let us do broadcasts from socket + if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1); err != nil { + log.Fatalln(err) + } + + // Bind UDP socket to local port so we can receive pings + if err := syscall.Bind(fd, &syscall.SockaddrInet4{Port: PING_PORT_NUMBER, Addr: [4]byte{0, 0, 0, 0}}); err != nil { + log.Fatalln(err) + } + + buffer := make([]byte, PING_MSG_SIZE) + + // We use syscall.Select to wait for activity on the UDP socket. + // We send a beacon once a second, and we collect and report + // beacons that come in from other nodes: + + rfds := &syscall.FdSet{} + timeout := &syscall.Timeval{} + + // Send first ping right away + ping_at := time.Now() + + bcast := &syscall.SockaddrInet4{Port: PING_PORT_NUMBER, Addr: [4]byte{255, 255, 255, 255}} + for { + dur := int64(ping_at.Sub(time.Now()) / time.Microsecond) + if dur < 0 { + dur = 0 + } + timeout.Sec, timeout.Usec = dur/1000000, dur%1000000 + FD_ZERO(rfds) + FD_SET(rfds, fd) + _, err := syscall.Select(fd+1, rfds, nil, nil, timeout) + if err != nil { + log.Fatalln(err) + } + + // Someone answered our ping + if FD_ISSET(rfds, fd) { + _, addr, err := syscall.Recvfrom(fd, buffer, 0) + if err != nil { + log.Fatalln(err) + } + a := addr.(*syscall.SockaddrInet4) + fmt.Printf("Found peer %v.%v.%v.%v:%v\n", a.Addr[0], a.Addr[1], a.Addr[2], a.Addr[3], a.Port) + } + if time.Now().After(ping_at) { + // Broadcast our beacon + fmt.Println("Pinging peers...") + buffer[0] = '!' + if err := syscall.Sendto(fd, buffer, 0, bcast); err != nil { + log.Fatalln(err) + } + ping_at = time.Now().Add(PING_INTERVAL) + } + } + +} + +func FD_SET(p *syscall.FdSet, i int) { + p.Bits[i/64] |= 1 << uint(i) % 64 +} + +func FD_ISSET(p *syscall.FdSet, i int) bool { + return (p.Bits[i/64] & (1 << uint(i) % 64)) != 0 +} + +func FD_ZERO(p *syscall.FdSet) { + for i := range p.Bits { + p.Bits[i] = 0 + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/udpping2.go b/vendor/github.com/pebbe/zmq4/examples/udpping2.go new file mode 100644 index 0000000..d51fb8e --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/udpping2.go @@ -0,0 +1,62 @@ +// +// UDP ping command +// Model 2, uses the GO net library +// + +// this doesn't use ZeroMQ at all + +package main + +import ( + "fmt" + "log" + "net" + "time" +) + +const ( + PING_PORT_NUMBER = 9999 + PING_MSG_SIZE = 1 + PING_INTERVAL = 1000 * time.Millisecond // Once per second +) + +func main() { + + log.SetFlags(log.Lshortfile) + + // Create UDP socket + bcast := &net.UDPAddr{Port: PING_PORT_NUMBER, IP: net.IPv4bcast} + conn, err := net.ListenUDP("udp", bcast) + if err != nil { + log.Fatalln(err) + } + + buffer := make([]byte, PING_MSG_SIZE) + + // We send a beacon once a second, and we collect and report + // beacons that come in from other nodes: + + // Send first ping right away + ping_at := time.Now() + + for { + if err := conn.SetReadDeadline(ping_at); err != nil { + log.Fatalln(err) + } + + if _, addr, err := conn.ReadFrom(buffer); err == nil { + // Someone answered our ping + fmt.Println("Found peer", addr) + } + + if time.Now().After(ping_at) { + // Broadcast our beacon + fmt.Println("Pinging peers...") + buffer[0] = '!' + if _, err := conn.WriteTo(buffer, bcast); err != nil { + log.Fatalln(err) + } + ping_at = time.Now().Add(PING_INTERVAL) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/udpping3.go b/vendor/github.com/pebbe/zmq4/examples/udpping3.go new file mode 100644 index 0000000..103b719 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/udpping3.go @@ -0,0 +1,25 @@ +// +// UDP ping command +// Model 3, uses abstract network interface +// + +package main + +import ( + "github.com/pebbe/zmq4/examples/intface" + + "fmt" + "log" +) + +func main() { + log.SetFlags(log.Lshortfile) + iface := intface.New() + for { + msg, err := iface.Recv() + if err != nil { + log.Fatalln(err) + } + fmt.Printf("%q\n", msg) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples/version.go b/vendor/github.com/pebbe/zmq4/examples/version.go new file mode 100644 index 0000000..a3019a7 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/version.go @@ -0,0 +1,16 @@ +// +// Report 0MQ version. +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" +) + +func main() { + major, minor, patch := zmq.Version() + fmt.Printf("Current 0MQ version is %d.%d.%d\n", major, minor, patch) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/wuclient.go b/vendor/github.com/pebbe/zmq4/examples/wuclient.go new file mode 100644 index 0000000..5d34713 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/wuclient.go @@ -0,0 +1,46 @@ +// +// Weather update client. +// Connects SUB socket to tcp://localhost:5556 +// Collects weather updates and finds avg temp in zipcode +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "os" + "strconv" + "strings" +) + +func main() { + // Socket to talk to server + fmt.Println("Collecting updates from weather server...") + subscriber, _ := zmq.NewSocket(zmq.SUB) + defer subscriber.Close() + subscriber.Connect("tcp://localhost:5556") + + // Subscribe to zipcode, default is NYC, 10001 + filter := "10001 " + if len(os.Args) > 1 { + filter = os.Args[1] + " " + } + subscriber.SetSubscribe(filter) + + // Process 100 updates + total_temp := 0 + update_nbr := 0 + for update_nbr < 100 { + msg, _ := subscriber.Recv(0) + + if msgs := strings.Fields(msg); len(msgs) > 1 { + if temperature, err := strconv.Atoi(msgs[1]); err == nil { + total_temp += temperature + update_nbr++ + } + } + } + fmt.Printf("Average temperature for zipcode '%s' was %dF \n\n", strings.TrimSpace(filter), total_temp/update_nbr) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/wuproxy.go b/vendor/github.com/pebbe/zmq4/examples/wuproxy.go new file mode 100644 index 0000000..0f11b25 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/wuproxy.go @@ -0,0 +1,29 @@ +// +// Weather proxy device. +// +// NOT TESTED +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "log" +) + +func main() { + // This is where the weather server sits + frontend, _ := zmq.NewSocket(zmq.XSUB) + defer frontend.Close() + frontend.Connect("tcp://192.168.55.210:5556") + + // This is our public endpoint for subscribers + backend, _ := zmq.NewSocket(zmq.XPUB) + defer backend.Close() + backend.Bind("tcp://10.1.1.0:8100") + + // Run the proxy until the user interrupts us + err := zmq.Proxy(frontend, backend, nil) + log.Fatalln("Proxy interrupted:", err) +} diff --git a/vendor/github.com/pebbe/zmq4/examples/wuserver.go b/vendor/github.com/pebbe/zmq4/examples/wuserver.go new file mode 100644 index 0000000..a4e4ed2 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples/wuserver.go @@ -0,0 +1,40 @@ +// +// Weather update server. +// Binds PUB socket to tcp://*:5556 +// Publishes random weather updates +// + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "math/rand" + "time" +) + +func main() { + + // Prepare our publisher + publisher, _ := zmq.NewSocket(zmq.PUB) + defer publisher.Close() + publisher.Bind("tcp://*:5556") + publisher.Bind("ipc://weather.ipc") + + // Initialize random number generator + rand.Seed(time.Now().UnixNano()) + + // loop for a while apparently + for { + + // Get values that will fool the boss + zipcode := rand.Intn(100000) + temperature := rand.Intn(215) - 80 + relhumidity := rand.Intn(50) + 10 + + // Send message to all subscribers + msg := fmt.Sprintf("%05d %d %d", zipcode, temperature, relhumidity) + publisher.Send(msg, 0) + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples_security/Makefile b/vendor/github.com/pebbe/zmq4/examples_security/Makefile new file mode 100644 index 0000000..2ec2eee --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/Makefile @@ -0,0 +1,5 @@ + +% : %.go + go build $< + +all: grasslands strawhouse woodhouse stonehouse ironhouse diff --git a/vendor/github.com/pebbe/zmq4/examples_security/README.md b/vendor/github.com/pebbe/zmq4/examples_security/README.md new file mode 100644 index 0000000..701377c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/README.md @@ -0,0 +1,10 @@ +These are Go versions of the C examples described in +[Using ZeroMQ Security (part 2)](http://hintjens.com/blog:49) by Pieter Hintjens. +Those C examples use the [zauth module](http://czmq.zeromq.org/manual:zauth) +in the [czmq library](http://czmq.zeromq.org). + +There are some differences: + + * The zauth module doesn't handle domains. The Go version does. + * The zauth module handles files with usernames/passwords and directories with certificates. + The Go version just uses maps of usernames/passwords and lists of public user keys. diff --git a/vendor/github.com/pebbe/zmq4/examples_security/grasslands.go b/vendor/github.com/pebbe/zmq4/examples_security/grasslands.go new file mode 100644 index 0000000..7e6a296 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/grasslands.go @@ -0,0 +1,49 @@ +// The Grasslands Pattern +// +// The Classic ZeroMQ model, plain text with no protection at all. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "runtime" +) + +func main() { + + // Create and bind server socket + server, err := zmq.NewSocket(zmq.PUSH) + checkErr(err) + checkErr(server.Bind("tcp://*:9000")) + + // Create and connect client socket + client, err := zmq.NewSocket(zmq.PULL) + checkErr(err) + checkErr(client.Connect("tcp://127.0.0.1:9000")) + + // Send a single message from server to client + _, err = server.Send("Hello", 0) + checkErr(err) + message, err := client.Recv(0) + checkErr(err) + if message != "Hello" { + log.Fatalln(message, "!= Hello") + } + + fmt.Println("Grasslands test OK") +} + +func checkErr(err error) { + if err != nil { + log.SetFlags(0) + _, filename, lineno, ok := runtime.Caller(1) + if ok { + log.Fatalf("%v:%v: %v", filename, lineno, err) + } else { + log.Fatalln(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples_security/ironhouse.go b/vendor/github.com/pebbe/zmq4/examples_security/ironhouse.go new file mode 100644 index 0000000..c8ab2c5 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/ironhouse.go @@ -0,0 +1,69 @@ +// The Ironhouse Pattern +// +// Security doesn't get any stronger than this. An attacker is going to +// have to break into your systems to see data before/after encryption. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "runtime" +) + +func main() { + + // Start authentication engine + zmq.AuthSetVerbose(true) + zmq.AuthStart() + zmq.AuthAllow("domain1", "127.0.0.1/8") + + // We need two certificates, one for the client and one for + // the server. The client must know the server's public key + // to make a CURVE connection. + client_public, client_secret, err := zmq.NewCurveKeypair() + checkErr(err) + server_public, server_secret, err := zmq.NewCurveKeypair() + checkErr(err) + + // Tell authenticator to use this public client key + zmq.AuthCurveAdd("domain1", client_public) + + // Create and bind server socket + server, _ := zmq.NewSocket(zmq.PUSH) + server.ServerAuthCurve("domain1", server_secret) + server.Bind("tcp://*:9000") + + // Create and connect client socket + client, _ := zmq.NewSocket(zmq.PULL) + client.ClientAuthCurve(server_public, client_public, client_secret) + client.Connect("tcp://127.0.0.1:9000") + + // Send a single message from server to client + _, err = server.Send("Hello", 0) + checkErr(err) + message, err := client.Recv(0) + checkErr(err) + if message != "Hello" { + log.Fatalln(message, "!= Hello") + } + + zmq.AuthStop() + + fmt.Println("Ironhouse test OK") + +} + +func checkErr(err error) { + if err != nil { + log.SetFlags(0) + _, filename, lineno, ok := runtime.Caller(1) + if ok { + log.Fatalf("%v:%v: %v", filename, lineno, err) + } else { + log.Fatalln(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples_security/stonehouse.go b/vendor/github.com/pebbe/zmq4/examples_security/stonehouse.go new file mode 100644 index 0000000..b8253dd --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/stonehouse.go @@ -0,0 +1,70 @@ +// The Stonehouse Pattern +// +// Where we allow any clients to connect, but we promise clients +// that we are who we claim to be, and our conversations won't be +// tampered with or modified, or spied on. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "runtime" +) + +func main() { + + // Start authentication engine + zmq.AuthSetVerbose(true) + zmq.AuthStart() + zmq.AuthAllow("domain1", "127.0.0.1") + + // Tell the authenticator to allow any CURVE requests for this domain + zmq.AuthCurveAdd("domain1", zmq.CURVE_ALLOW_ANY) + + // We need two certificates, one for the client and one for + // the server. The client must know the server's public key + // to make a CURVE connection. + client_public, client_secret, err := zmq.NewCurveKeypair() + checkErr(err) + server_public, server_secret, err := zmq.NewCurveKeypair() + checkErr(err) + + // Create and bind server socket + server, _ := zmq.NewSocket(zmq.PUSH) + server.ServerAuthCurve("domain1", server_secret) + server.Bind("tcp://*:9000") + + // Create and connect client socket + client, _ := zmq.NewSocket(zmq.PULL) + client.ClientAuthCurve(server_public, client_public, client_secret) + client.Connect("tcp://127.0.0.1:9000") + + // Send a single message from server to client + _, err = server.Send("Hello", 0) + checkErr(err) + message, err := client.Recv(0) + checkErr(err) + if message != "Hello" { + log.Fatalln(message, "!= Hello") + } + + zmq.AuthStop() + + fmt.Println("Stonehouse test OK") + +} + +func checkErr(err error) { + if err != nil { + log.SetFlags(0) + _, filename, lineno, ok := runtime.Caller(1) + if ok { + log.Fatalf("%v:%v: %v", filename, lineno, err) + } else { + log.Fatalln(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples_security/strawhouse.go b/vendor/github.com/pebbe/zmq4/examples_security/strawhouse.go new file mode 100644 index 0000000..d08961b --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/strawhouse.go @@ -0,0 +1,65 @@ +// The Strawhouse Pattern +// +// We allow or deny clients according to their IP address. It may keep +// spammers and idiots away, but won't stop a real attacker for more +// than a heartbeat. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "runtime" +) + +func main() { + + // Get some indication of what the authenticator is deciding + zmq.AuthSetVerbose(true) + + // Start the authentication engine. This engine + // allows or denies incoming connections (talking to the libzmq + // core over a protocol called ZAP). + zmq.AuthStart() + + // Whitelist our address; any other address will be rejected + zmq.AuthAllow("domain1", "127.0.0.1") + + // Create and bind server socket + server, err := zmq.NewSocket(zmq.PUSH) + checkErr(err) + server.ServerAuthNull("domain1") + server.Bind("tcp://*:9000") + + // Create and connect client socket + client, err := zmq.NewSocket(zmq.PULL) + checkErr(err) + checkErr(client.Connect("tcp://127.0.0.1:9000")) + + // Send a single message from server to client + _, err = server.Send("Hello", 0) + checkErr(err) + message, err := client.Recv(0) + checkErr(err) + if message != "Hello" { + log.Fatalln(message, "!= Hello") + } + + zmq.AuthStop() + + fmt.Println("Strawhouse test OK") +} + +func checkErr(err error) { + if err != nil { + log.SetFlags(0) + _, filename, lineno, ok := runtime.Caller(1) + if ok { + log.Fatalf("%v:%v: %v", filename, lineno, err) + } else { + log.Fatalln(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/examples_security/woodhouse.go b/vendor/github.com/pebbe/zmq4/examples_security/woodhouse.go new file mode 100644 index 0000000..6788743 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/examples_security/woodhouse.go @@ -0,0 +1,62 @@ +// The Woodhouse Pattern +// +// It may keep some malicious people out but all it takes is a bit +// of network sniffing, and they'll be able to fake their way in. + +package main + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "log" + "runtime" +) + +func main() { + + // Start authentication engine + zmq.AuthSetVerbose(true) + zmq.AuthStart() + zmq.AuthAllow("domain1", "127.0.0.1") + + // Tell the authenticator how to handle PLAIN requests + zmq.AuthPlainAdd("domain1", "admin", "secret") + + // Create and bind server socket + server, _ := zmq.NewSocket(zmq.PUSH) + server.ServerAuthPlain("domain1") + server.Bind("tcp://*:9000") + + // Create and connect client socket + client, _ := zmq.NewSocket(zmq.PULL) + client.SetPlainUsername("admin") + client.SetPlainPassword("secret") + client.Connect("tcp://127.0.0.1:9000") + + // Send a single message from server to client + _, err := server.Send("Hello", 0) + checkErr(err) + message, err := client.Recv(0) + checkErr(err) + if message != "Hello" { + log.Fatalln(message, "!= Hello") + } + + zmq.AuthStop() + + fmt.Println("Woodhouse test OK") + +} + +func checkErr(err error) { + if err != nil { + log.SetFlags(0) + _, filename, lineno, ok := runtime.Caller(1) + if ok { + log.Fatalf("%v:%v: %v", filename, lineno, err) + } else { + log.Fatalln(err) + } + } +} diff --git a/vendor/github.com/pebbe/zmq4/polling.go b/vendor/github.com/pebbe/zmq4/polling.go new file mode 100644 index 0000000..6e20a55 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/polling.go @@ -0,0 +1,187 @@ +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "fmt" + "time" +) + +// Return type for (*Poller)Poll +type Polled struct { + Socket *Socket // socket with matched event(s) + Events State // actual matched event(s) +} + +type Poller struct { + items []C.zmq_pollitem_t + socks []*Socket +} + +// Create a new Poller +func NewPoller() *Poller { + return &Poller{ + items: make([]C.zmq_pollitem_t, 0), + socks: make([]*Socket, 0), + } +} + +// Add items to the poller +// +// Events is a bitwise OR of zmq.POLLIN and zmq.POLLOUT +// +// Returns the id of the item, which can be used as a handle to +// (*Poller)Update and as an index into the result of (*Poller)PollAll +func (p *Poller) Add(soc *Socket, events State) int { + var item C.zmq_pollitem_t + item.socket = soc.soc + item.fd = 0 + item.events = C.short(events) + p.items = append(p.items, item) + p.socks = append(p.socks, soc) + return len(p.items) - 1 +} + +// Update the events mask of a socket in the poller +// +// Replaces the Poller's bitmask for the specified id with the events parameter passed +// +// Returns the previous value, or ErrorNoSocket if the id was out of range +func (p *Poller) Update(id int, events State) (previous State, err error) { + if id >= 0 && id < len(p.items) { + previous = State(p.items[id].events) + p.items[id].events = C.short(events) + return previous, nil + } + return 0, ErrorNoSocket +} + +// Update the events mask of a socket in the poller +// +// Replaces the Poller's bitmask for the specified socket with the events parameter passed +// +// Returns the previous value, or ErrorNoSocket if the socket didn't match +func (p *Poller) UpdateBySocket(soc *Socket, events State) (previous State, err error) { + for id, s := range p.socks { + if s == soc { + previous = State(p.items[id].events) + p.items[id].events = C.short(events) + return previous, nil + } + } + return 0, ErrorNoSocket +} + +// Remove a socket from the poller +// +// Returns ErrorNoSocket if the id was out of range +func (p *Poller) Remove(id int) error { + if id >= 0 && id < len(p.items) { + if id == len(p.items)-1 { + p.items = p.items[:id] + p.socks = p.socks[:id] + } else { + p.items = append(p.items[:id], p.items[id+1:]...) + p.socks = append(p.socks[:id], p.socks[id+1:]...) + } + return nil + } + return ErrorNoSocket +} + +// Remove a socket from the poller +// +// Returns ErrorNoSocket if the socket didn't match +func (p *Poller) RemoveBySocket(soc *Socket) error { + for id, s := range p.socks { + if s == soc { + return p.Remove(id) + } + } + return ErrorNoSocket +} + +/* +Input/output multiplexing + +If timeout < 0, wait forever until a matching event is detected + +Only sockets with matching socket events are returned in the list. + +Example: + + poller := zmq.NewPoller() + poller.Add(socket0, zmq.POLLIN) + poller.Add(socket1, zmq.POLLIN) + // Process messages from both sockets + for { + sockets, _ := poller.Poll(-1) + for _, socket := range sockets { + switch s := socket.Socket; s { + case socket0: + msg, _ := s.Recv(0) + // Process msg + case socket1: + msg, _ := s.Recv(0) + // Process msg + } + } + } +*/ +func (p *Poller) Poll(timeout time.Duration) ([]Polled, error) { + return p.poll(timeout, false) +} + +/* +This is like (*Poller)Poll, but it returns a list of all sockets, +in the same order as they were added to the poller, +not just those sockets that had an event. + +For each socket in the list, you have to check the Events field +to see if there was actually an event. + +When error is not nil, the return list contains no sockets. +*/ +func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) { + return p.poll(timeout, true) +} + +func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) { + lst := make([]Polled, 0, len(p.items)) + + for _, soc := range p.socks { + if !soc.opened { + return lst, ErrorSocketClosed + } + } + + t := timeout + if t > 0 { + t = t / time.Millisecond + } + if t < 0 { + t = -1 + } + rv, err := C.zmq_poll(&p.items[0], C.int(len(p.items)), C.long(t)) + if rv < 0 { + return lst, errget(err) + } + for i, it := range p.items { + if all || it.events&it.revents != 0 { + lst = append(lst, Polled{p.socks[i], State(it.revents)}) + } + } + return lst, nil +} + +// Poller as string. +func (p *Poller) String() string { + str := make([]string, 0) + for i, poll := range p.items { + str = append(str, fmt.Sprintf("%v%v", p.socks[i], State(poll.events))) + } + return fmt.Sprint("Poller", str) +} diff --git a/vendor/github.com/pebbe/zmq4/reactor.go b/vendor/github.com/pebbe/zmq4/reactor.go new file mode 100644 index 0000000..701dc91 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/reactor.go @@ -0,0 +1,194 @@ +package zmq4 + +import ( + "errors" + "fmt" + "time" +) + +type reactor_socket struct { + e State + f func(State) error +} + +type reactor_channel struct { + ch <-chan interface{} + f func(interface{}) error + limit int +} + +type Reactor struct { + sockets map[*Socket]*reactor_socket + channels map[uint64]*reactor_channel + p *Poller + idx uint64 + remove []uint64 + verbose bool +} + +/* +Create a reactor to mix the handling of sockets and channels (timers or other channels). + +Example: + + reactor := zmq.NewReactor() + reactor.AddSocket(socket1, zmq.POLLIN, socket1_handler) + reactor.AddSocket(socket2, zmq.POLLIN, socket2_handler) + reactor.AddChannelTime(time.Tick(time.Second), 1, ticker_handler) + reactor.Run(time.Second) +*/ +func NewReactor() *Reactor { + r := &Reactor{ + sockets: make(map[*Socket]*reactor_socket), + channels: make(map[uint64]*reactor_channel), + p: NewPoller(), + remove: make([]uint64, 0), + } + return r +} + +// Add socket handler to the reactor. +// +// You can have only one handler per socket. Adding a second one will remove the first. +// +// The handler receives the socket state as an argument: POLLIN, POLLOUT, or both. +func (r *Reactor) AddSocket(soc *Socket, events State, handler func(State) error) { + r.RemoveSocket(soc) + r.sockets[soc] = &reactor_socket{e: events, f: handler} + r.p.Add(soc, events) +} + +// Remove a socket handler from the reactor. +func (r *Reactor) RemoveSocket(soc *Socket) { + if _, ok := r.sockets[soc]; ok { + delete(r.sockets, soc) + // rebuild poller + r.p = NewPoller() + for s, props := range r.sockets { + r.p.Add(s, props.e) + } + } +} + +// Add channel handler to the reactor. +// +// Returns id of added handler, that can be used later to remove it. +// +// If limit is positive, at most this many items will be handled in each run through the main loop, +// otherwise it will process as many items as possible. +// +// The handler function receives the value received from the channel. +func (r *Reactor) AddChannel(ch <-chan interface{}, limit int, handler func(interface{}) error) (id uint64) { + r.idx++ + id = r.idx + r.channels[id] = &reactor_channel{ch: ch, f: handler, limit: limit} + return +} + +// This function wraps AddChannel, using a channel of type time.Time instead of type interface{}. +func (r *Reactor) AddChannelTime(ch <-chan time.Time, limit int, handler func(interface{}) error) (id uint64) { + ch2 := make(chan interface{}) + go func() { + for { + a, ok := <-ch + if !ok { + close(ch2) + break + } + ch2 <- a + } + }() + return r.AddChannel(ch2, limit, handler) +} + +// Remove a channel from the reactor. +// +// Closed channels are removed automatically. +func (r *Reactor) RemoveChannel(id uint64) { + r.remove = append(r.remove, id) +} + +func (r *Reactor) SetVerbose(verbose bool) { + r.verbose = verbose +} + +// Run the reactor. +// +// The interval determines the time-out on the polling of sockets. +// Interval must be positive if there are channels. +// If there are no channels, you can set interval to -1. +// +// The run alternates between polling/handling sockets (using the interval as timeout), +// and reading/handling channels. The reading of channels is without time-out: if there +// is no activity on any channel, the run continues to poll sockets immediately. +// +// The run exits when any handler returns an error, returning that same error. +func (r *Reactor) Run(interval time.Duration) (err error) { + for { + + // process requests to remove channels + for _, id := range r.remove { + delete(r.channels, id) + } + r.remove = r.remove[0:0] + + CHANNELS: + for id, ch := range r.channels { + limit := ch.limit + for { + select { + case val, ok := <-ch.ch: + if !ok { + if r.verbose { + fmt.Printf("Reactor(%p) removing closed channel %d\n", r, id) + } + r.RemoveChannel(id) + continue CHANNELS + } + if r.verbose { + fmt.Printf("Reactor(%p) channel %d: %q\n", r, id, val) + } + err = ch.f(val) + if err != nil { + return + } + if ch.limit > 0 { + limit-- + if limit == 0 { + continue CHANNELS + } + } + default: + continue CHANNELS + } + } + } + + if len(r.channels) > 0 && interval < 0 { + return errors.New("There are channels, but polling time-out is infinite") + } + + if len(r.sockets) == 0 { + if len(r.channels) == 0 { + return errors.New("No sockets to poll, no channels to read") + } + time.Sleep(interval) + continue + } + + polled, e := r.p.Poll(interval) + if e != nil { + return e + } + for _, item := range polled { + if r.verbose { + fmt.Printf("Reactor(%p) %v\n", r, item) + } + err = r.sockets[item.Socket].f(item.Events) + if err != nil { + return + } + } + } + return +} diff --git a/vendor/github.com/pebbe/zmq4/socketevent_test.go b/vendor/github.com/pebbe/zmq4/socketevent_test.go new file mode 100644 index 0000000..b6f6a5a --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/socketevent_test.go @@ -0,0 +1,98 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4" + + "fmt" + "testing" + "time" +) + +func rep_socket_monitor(addr string, chMsg chan<- string) { + + defer close(chMsg) + + s, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + chMsg <- fmt.Sprint("NewSocket:", err) + return + } + defer func() { + s.SetLinger(0) + s.Close() + }() + + err = s.Connect(addr) + if err != nil { + chMsg <- fmt.Sprint("s.Connect:", err) + return + } + + for { + a, b, _, err := s.RecvEvent(0) + if err != nil { + chMsg <- fmt.Sprint("s.RecvEvent:", err) + return + } + chMsg <- fmt.Sprint(a, " ", b) + if a == zmq.EVENT_CLOSED { + break + } + } + chMsg <- "Done" +} + +func TestSocketEvent(t *testing.T) { + + var rep *zmq.Socket + defer func() { + if rep != nil { + rep.SetLinger(0) + rep.Close() + } + }() + + // REP socket + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + + // REP socket monitor, all events + err = rep.Monitor("inproc://monitor.rep", zmq.EVENT_ALL) + if err != nil { + t.Fatal("rep.Monitor:", err) + } + chMsg := make(chan string, 10) + go rep_socket_monitor("inproc://monitor.rep", chMsg) + time.Sleep(time.Second) + + // Generate an event + err = rep.Bind("tcp://*:9689") + if err != nil { + t.Fatal("rep.Bind:", err) + } + + rep.Close() + rep = nil + + expect := []string{ + "EVENT_LISTENING tcp://0.0.0.0:9689", + "EVENT_CLOSED tcp://0.0.0.0:9689", + "Done", + } + i := 0 + for msg := range chMsg { + if i < len(expect) { + if msg != expect[i] { + t.Errorf("Expected message %q, got %q", expect[i], msg) + } + i++ + } else { + t.Error("Unexpected message: %q", msg) + } + } + for ; i < len(expect); i++ { + t.Errorf("Expected message %q, got nothing", expect[i]) + } +} diff --git a/vendor/github.com/pebbe/zmq4/socketget.go b/vendor/github.com/pebbe/zmq4/socketget.go new file mode 100644 index 0000000..cf28751 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/socketget.go @@ -0,0 +1,648 @@ +package zmq4 + +/* +#include +#include +#include "zmq4.h" +*/ +import "C" + +import ( + "strings" + "time" + "unsafe" +) + +func (soc *Socket) getString(opt C.int, bufsize int) (string, error) { + if !soc.opened { + return "", ErrorSocketClosed + } + value := make([]byte, bufsize) + size := C.size_t(bufsize) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value[0]), &size); i != 0 { + return "", errget(err) + } + return strings.TrimRight(string(value[:int(size)]), "\x00"), nil +} + +func (soc *Socket) getStringRaw(opt C.int, bufsize int) (string, error) { + if !soc.opened { + return "", ErrorSocketClosed + } + value := make([]byte, bufsize) + size := C.size_t(bufsize) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value[0]), &size); i != 0 { + return "", errget(err) + } + return string(value[:int(size)]), nil +} + +func (soc *Socket) getInt(opt C.int) (int, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.int(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return int(value), nil +} + +func (soc *Socket) getInt64(opt C.int) (int64, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.int64_t(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return int64(value), nil +} + +func (soc *Socket) getUInt64(opt C.int) (uint64, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + value := C.uint64_t(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, opt, unsafe.Pointer(&value), &size); i != 0 { + return 0, errget(err) + } + return uint64(value), nil +} + +// ZMQ_TYPE: Retrieve socket type +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc43 +func (soc *Socket) GetType() (Type, error) { + v, err := soc.getInt(C.ZMQ_TYPE) + return Type(v), err +} + +// ZMQ_RCVMORE: More message data parts to follow +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc30 +func (soc *Socket) GetRcvmore() (bool, error) { + v, err := soc.getInt(C.ZMQ_RCVMORE) + return v != 0, err +} + +// ZMQ_SNDHWM: Retrieves high water mark for outbound messages +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc36 +func (soc *Socket) GetSndhwm() (int, error) { + return soc.getInt(C.ZMQ_SNDHWM) +} + +// ZMQ_RCVHWM: Retrieve high water mark for inbound messages +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc29 +func (soc *Socket) GetRcvhwm() (int, error) { + return soc.getInt(C.ZMQ_RCVHWM) +} + +// ZMQ_AFFINITY: Retrieve I/O thread affinity +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc3 +func (soc *Socket) GetAffinity() (uint64, error) { + return soc.getUInt64(C.ZMQ_AFFINITY) +} + +// ZMQ_IDENTITY: Retrieve socket identity +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc15 +func (soc *Socket) GetIdentity() (string, error) { + return soc.getString(C.ZMQ_IDENTITY, 256) +} + +// ZMQ_RATE: Retrieve multicast data rate +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc27 +func (soc *Socket) GetRate() (int, error) { + return soc.getInt(C.ZMQ_RATE) +} + +// ZMQ_RECOVERY_IVL: Get multicast recovery interval +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc34 +func (soc *Socket) GetRecoveryIvl() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECOVERY_IVL) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SNDBUF: Retrieve kernel transmit buffer size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc35 +func (soc *Socket) GetSndbuf() (int, error) { + return soc.getInt(C.ZMQ_SNDBUF) +} + +// ZMQ_RCVBUF: Retrieve kernel receive buffer size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc28 +func (soc *Socket) GetRcvbuf() (int, error) { + return soc.getInt(C.ZMQ_RCVBUF) +} + +// ZMQ_LINGER: Retrieve linger period for socket shutdown +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc20 +func (soc *Socket) GetLinger() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_LINGER) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_RECONNECT_IVL: Retrieve reconnection interval +// +// Returns time.Duration(-1) for no reconnection +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc32 +func (soc *Socket) GetReconnectIvl() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECONNECT_IVL) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc33 +func (soc *Socket) GetReconnectIvlMax() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RECONNECT_IVL_MAX) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc4 +func (soc *Socket) GetBacklog() (int, error) { + return soc.getInt(C.ZMQ_BACKLOG) +} + +// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc21 +func (soc *Socket) GetMaxmsgsize() (int64, error) { + return soc.getInt64(C.ZMQ_MAXMSGSIZE) +} + +// ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc23 +func (soc *Socket) GetMulticastHops() (int, error) { + return soc.getInt(C.ZMQ_MULTICAST_HOPS) +} + +// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc31 +func (soc *Socket) GetRcvtimeo() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_RCVTIMEO) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN +// +// Returns time.Duration(-1) for infinite +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc37 +func (soc *Socket) GetSndtimeo() (time.Duration, error) { + v, err := soc.getInt(C.ZMQ_SNDTIMEO) + if v < 0 { + return time.Duration(-1), err + } + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_IPV6: Retrieve IPv6 socket status +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc18 +func (soc *Socket) GetIpv6() (bool, error) { + v, err := soc.getInt(C.ZMQ_IPV6) + return v != 0, err +} + +// ZMQ_IMMEDIATE: Retrieve attach-on-connect value +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc16 +func (soc *Socket) GetImmediate() (bool, error) { + v, err := soc.getInt(C.ZMQ_IMMEDIATE) + return v != 0, err +} + +// ZMQ_FD: Retrieve file descriptor associated with the socket +// see socketget_unix.go and socketget_windows.go + +// ZMQ_EVENTS: Retrieve socket event state +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc8 +func (soc *Socket) GetEvents() (State, error) { + v, err := soc.getInt(C.ZMQ_EVENTS) + return State(v), err +} + +// ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc19 +func (soc *Socket) GetLastEndpoint() (string, error) { + return soc.getString(C.ZMQ_LAST_ENDPOINT, 1024) +} + +// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc38 +func (soc *Socket) GetTcpKeepalive() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE) +} + +// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS) +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc40 +func (soc *Socket) GetTcpKeepaliveIdle() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_IDLE) +} + +// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc39 +func (soc *Socket) GetTcpKeepaliveCnt() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_CNT) +} + +// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc41 +func (soc *Socket) GetTcpKeepaliveIntvl() (int, error) { + return soc.getInt(C.ZMQ_TCP_KEEPALIVE_INTVL) +} + +// ZMQ_MECHANISM: Retrieve current security mechanism +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc22 +func (soc *Socket) GetMechanism() (Mechanism, error) { + v, err := soc.getInt(C.ZMQ_MECHANISM) + return Mechanism(v), err +} + +// ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc25 +func (soc *Socket) GetPlainServer() (int, error) { + return soc.getInt(C.ZMQ_PLAIN_SERVER) +} + +// ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc26 +func (soc *Socket) GetPlainUsername() (string, error) { + s, err := soc.getString(C.ZMQ_PLAIN_USERNAME, 1024) + if n := len(s); n > 0 && s[n-1] == 0 { + s = s[:n-1] + } + return s, err +} + +// ZMQ_PLAIN_PASSWORD: Retrieve current password +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc24 +func (soc *Socket) GetPlainPassword() (string, error) { + s, err := soc.getString(C.ZMQ_PLAIN_PASSWORD, 1024) + if n := len(s); n > 0 && s[n-1] == 0 { + s = s[:n-1] + } + return s, err +} + +// ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc5 +func (soc *Socket) GetCurvePublickeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_PUBLICKEY, 32) +} + +// ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc5 +func (soc *Socket) GetCurvePublickeykeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_PUBLICKEY, 41) +} + +// ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc6 +func (soc *Socket) GetCurveSecretkeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_SECRETKEY, 32) +} + +// ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc6 +func (soc *Socket) GetCurveSecretkeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_SECRETKEY, 41) +} + +// ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc7 +func (soc *Socket) GetCurveServerkeyRaw() (string, error) { + return soc.getStringRaw(C.ZMQ_CURVE_SERVERKEY, 32) +} + +// ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc7 +func (soc *Socket) GetCurveServerkeyZ85() (string, error) { + return soc.getString(C.ZMQ_CURVE_SERVERKEY, 41) +} + +// ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc44 +func (soc *Socket) GetZapDomain() (string, error) { + return soc.getString(C.ZMQ_ZAP_DOMAIN, 1024) +} + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.1.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// D : deprecated +// o : setsockopt only +// implemented documented test +// ZMQ_ROUTER_HANDOVER o +// ZMQ_TOS + + +// ZMQ_IPC_FILTER_PID D +// ZMQ_IPC_FILTER_UID D +// ZMQ_IPC_FILTER_GID D +// ZMQ_CONNECT_RID o +// ZMQ_GSSAPI_SERVER + + +// ZMQ_GSSAPI_PRINCIPAL + + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL + + +// ZMQ_GSSAPI_PLAINTEXT + + +// ZMQ_HANDSHAKE_IVL + + +// ZMQ_SOCKS_PROXY + +// ZMQ_XPUB_NODROP o? +// +//////////////////////////////////////////////////////////////// + +// ZMQ_TOS: Retrieve the Type-of-Service socket override status +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc42 +func (soc *Socket) GetTos() (int, error) { + if minor < 1 { + return 0, ErrorNotImplemented41 + } + return soc.getInt(C.ZMQ_TOS) +} + +// ZMQ_CONNECT_RID: SET ONLY + +// ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc12 +func (soc *Socket) GetGssapiServer() (bool, error) { + if minor < 1 { + return false, ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_GSSAPI_SERVER) + return v != 0, err +} + +// ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc11 +func (soc *Socket) GetGssapiPrincipal() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_GSSAPI_PRINCIPAL, 1024) +} + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc13 +func (soc *Socket) GetGssapiServicePrincipal() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_GSSAPI_SERVICE_PRINCIPAL, 1024) +} + +// ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc10 +func (soc *Socket) GetGssapiPlaintext() (bool, error) { + if minor < 1 { + return false, ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_GSSAPI_PLAINTEXT) + return v != 0, err +} + +// ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc14 +func (soc *Socket) GetHandshakeIvl() (time.Duration, error) { + if minor < 1 { + return time.Duration(0), ErrorNotImplemented41 + } + v, err := soc.getInt(C.ZMQ_HANDSHAKE_IVL) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_SOCKS_PROXY: NOT DOCUMENTED +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +func (soc *Socket) GetSocksProxy() (string, error) { + if minor < 1 { + return "", ErrorNotImplemented41 + } + return soc.getString(C.ZMQ_SOCKS_PROXY, 1024) +} + +// ZMQ_XPUB_NODROP: SET ONLY? (not documented) + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.2.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// o : setsockopt only +// implemented documented test +// ZMQ_BLOCKY +// ZMQ_XPUB_MANUAL o +// ZMQ_XPUB_WELCOME_MSG o +// ZMQ_STREAM_NOTIFY o +// ZMQ_INVERT_MATCHING + + +// ZMQ_HEARTBEAT_IVL o +// ZMQ_HEARTBEAT_TTL o +// ZMQ_HEARTBEAT_TIMEOUT o +// ZMQ_XPUB_VERBOSER o +// ZMQ_CONNECT_TIMEOUT + + +// ZMQ_TCP_MAXRT + + +// ZMQ_THREAD_SAFE + + +// ZMQ_MULTICAST_MAXTPDU + + +// ZMQ_VMCI_BUFFER_SIZE + + +// ZMQ_VMCI_BUFFER_MIN_SIZE + + +// ZMQ_VMCI_BUFFER_MAX_SIZE + + +// ZMQ_VMCI_CONNECT_TIMEOUT + + +// ZMQ_USE_FD + + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_BLOCKY doesn't look like a socket option + +// ZMQ_INVERT_MATCHING: Retrieve inverted filtering status +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc18 +func (soc *Socket) GetInvertMatching() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_INVERT_MATCHING) +} + +// ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc5 +func (soc *Socket) GetConnectTimeout() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_CONNECT_TIMEOUT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc44 +func (soc *Socket) GetTcpMaxrt() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_TCP_MAXRT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_THREAD_SAFE: Retrieve socket thread safety +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc45 +func (soc *Socket) GetThreadSafe() (bool, error) { + if minor < 2 { + return false, ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_THREAD_SAFE) + return v != 0, err +} + +// ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc26 +func (soc *Socket) GetMulticastMaxtpdu() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_MULTICAST_MAXTPDU) +} + +// ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc49 +func (soc *Socket) GetVmciBufferSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_SIZE) +} + +// ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc50 +func (soc *Socket) GetVmciBufferMinSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_MIN_SIZE) +} + +// ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc51 +func (soc *Socket) GetVmciBufferMaxSize() (uint64, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getUInt64(C.ZMQ_VMCI_BUFFER_MAX_SIZE) +} + +// ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc52 +func (soc *Socket) GetVmciConnectTimeout() (time.Duration, error) { + if minor < 2 { + return time.Duration(0), ErrorNotImplemented42 + } + v, err := soc.getInt(C.ZMQ_VMCI_CONNECT_TIMEOUT) + return time.Duration(v) * time.Millisecond, err +} + +// ZMQ_USE_FD: Retrieve the pre-allocated socket file descriptor +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-getsockopt#toc29 +func (soc *Socket) Getusefd() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return soc.getInt(C.ZMQ_USE_FD) +} diff --git a/vendor/github.com/pebbe/zmq4/socketget_unix.go b/vendor/github.com/pebbe/zmq4/socketget_unix.go new file mode 100644 index 0000000..2671b33 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/socketget_unix.go @@ -0,0 +1,15 @@ +// +build !windows + +package zmq4 + +/* +#include +*/ +import "C" + +// ZMQ_FD: Retrieve file descriptor associated with the socket +// +// See: http://api.zeromq.org/4-1:zmq-getsockopt#toc9 +func (soc *Socket) GetFd() (int, error) { + return soc.getInt(C.ZMQ_FD) +} diff --git a/vendor/github.com/pebbe/zmq4/socketget_windows.go b/vendor/github.com/pebbe/zmq4/socketget_windows.go new file mode 100644 index 0000000..6d2a89c --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/socketget_windows.go @@ -0,0 +1,26 @@ +// +build windows + +package zmq4 + +/* +#include +*/ +import "C" + +import ( + "unsafe" +) + +/* +ZMQ_FD: Retrieve file descriptor associated with the socket + +See: http://api.zeromq.org/4-1:zmq-getsockopt#toc9 +*/ +func (soc *Socket) GetFd() (uintptr, error) { + value := C.SOCKET(0) + size := C.size_t(unsafe.Sizeof(value)) + if i, err := C.zmq_getsockopt(soc.soc, C.ZMQ_FD, unsafe.Pointer(&value), &size); i != 0 { + return uintptr(0), errget(err) + } + return uintptr(value), nil +} diff --git a/vendor/github.com/pebbe/zmq4/socketset.go b/vendor/github.com/pebbe/zmq4/socketset.go new file mode 100644 index 0000000..d5dd6f0 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/socketset.go @@ -0,0 +1,800 @@ +package zmq4 + +/* +#include +#include +#include +#include "zmq4.h" +*/ +import "C" + +import ( + "time" + "unsafe" +) + +func (soc *Socket) setString(opt C.int, s string) error { + if !soc.opened { + return ErrorSocketClosed + } + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(cs), C.size_t(len(s))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setNullString(opt C.int) error { + if !soc.opened { + return ErrorSocketClosed + } + if i, err := C.zmq_setsockopt(soc.soc, opt, nil, 0); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setInt(opt C.int, value int) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.int(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setInt64(opt C.int, value int64) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.int64_t(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +func (soc *Socket) setUInt64(opt C.int, value uint64) error { + if !soc.opened { + return ErrorSocketClosed + } + val := C.uint64_t(value) + if i, err := C.zmq_setsockopt(soc.soc, opt, unsafe.Pointer(&val), C.size_t(unsafe.Sizeof(val))); i != 0 { + return errget(err) + } + return nil +} + +// ZMQ_SNDHWM: Set high water mark for outbound messages +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc39 +func (soc *Socket) SetSndhwm(value int) error { + return soc.setInt(C.ZMQ_SNDHWM, value) +} + +// ZMQ_RCVHWM: Set high water mark for inbound messages +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc28 +func (soc *Socket) SetRcvhwm(value int) error { + return soc.setInt(C.ZMQ_RCVHWM, value) +} + +// ZMQ_AFFINITY: Set I/O thread affinity +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc3 +func (soc *Socket) SetAffinity(value uint64) error { + return soc.setUInt64(C.ZMQ_AFFINITY, value) +} + +// ZMQ_SUBSCRIBE: Establish message filter +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc41 +func (soc *Socket) SetSubscribe(filter string) error { + return soc.setString(C.ZMQ_SUBSCRIBE, filter) +} + +// ZMQ_UNSUBSCRIBE: Remove message filter +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc47 +func (soc *Socket) SetUnsubscribe(filter string) error { + return soc.setString(C.ZMQ_UNSUBSCRIBE, filter) +} + +// ZMQ_IDENTITY: Set socket identity +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc16 +func (soc *Socket) SetIdentity(value string) error { + return soc.setString(C.ZMQ_IDENTITY, value) +} + +// ZMQ_RATE: Set multicast data rate +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc26 +func (soc *Socket) SetRate(value int) error { + return soc.setInt(C.ZMQ_RATE, value) +} + +// ZMQ_RECOVERY_IVL: Set multicast recovery interval +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc32 +func (soc *Socket) SetRecoveryIvl(value time.Duration) error { + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_RECOVERY_IVL, val) +} + +// ZMQ_SNDBUF: Set kernel transmit buffer size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc38 +func (soc *Socket) SetSndbuf(value int) error { + return soc.setInt(C.ZMQ_SNDBUF, value) +} + +// ZMQ_RCVBUF: Set kernel receive buffer size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc27 +func (soc *Socket) SetRcvbuf(value int) error { + return soc.setInt(C.ZMQ_RCVBUF, value) +} + +// ZMQ_LINGER: Set linger period for socket shutdown +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc19 +func (soc *Socket) SetLinger(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_LINGER, val) +} + +// ZMQ_RECONNECT_IVL: Set reconnection interval +// +// For no reconnection, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc30 +func (soc *Socket) SetReconnectIvl(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_RECONNECT_IVL, val) +} + +// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc31 +func (soc *Socket) SetReconnectIvlMax(value time.Duration) error { + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_RECONNECT_IVL_MAX, val) +} + +// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc4 +func (soc *Socket) SetBacklog(value int) error { + return soc.setInt(C.ZMQ_BACKLOG, value) +} + +// ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc20 +func (soc *Socket) SetMaxmsgsize(value int64) error { + return soc.setInt64(C.ZMQ_MAXMSGSIZE, value) +} + +// ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc21 +func (soc *Socket) SetMulticastHops(value int) error { + return soc.setInt(C.ZMQ_MULTICAST_HOPS, value) +} + +// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc29 +func (soc *Socket) SetRcvtimeo(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_RCVTIMEO, val) +} + +// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN +// +// For infinite, use -1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc40 +func (soc *Socket) SetSndtimeo(value time.Duration) error { + val := int(value / time.Millisecond) + if value == -1 { + val = -1 + } + return soc.setInt(C.ZMQ_SNDTIMEO, val) +} + +// ZMQ_IPV6: Enable IPv6 on socket +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc18 +func (soc *Socket) SetIpv6(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_IPV6, val) +} + +// ZMQ_IMMEDIATE: Queue messages only to completed connections +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc17 +func (soc *Socket) SetImmediate(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_IMMEDIATE, val) +} + +// ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc36 +func (soc *Socket) SetRouterMandatory(value int) error { + return soc.setInt(C.ZMQ_ROUTER_MANDATORY, value) +} + +// ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode +// +// This option is deprecated since ZeroMQ version 4.1, please use ZMQ_STREAM sockets instead. +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc37 +func (soc *Socket) SetRouterRaw(value int) error { + return soc.setInt(C.ZMQ_ROUTER_RAW, value) +} + +// ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc25 +func (soc *Socket) SetProbeRouter(value int) error { + return soc.setInt(C.ZMQ_PROBE_ROUTER, value) +} + +// ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc48 +func (soc *Socket) SetXpubVerbose(value int) error { + return soc.setInt(C.ZMQ_XPUB_VERBOSE, value) +} + +// ZMQ_REQ_CORRELATE: match replies with requests +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc33 +func (soc *Socket) SetReqCorrelate(value int) error { + return soc.setInt(C.ZMQ_REQ_CORRELATE, value) +} + +// ZMQ_REQ_RELAXED: relax strict alternation between request and reply +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc34 +func (soc *Socket) SetReqRelaxed(value int) error { + return soc.setInt(C.ZMQ_REQ_RELAXED, value) +} + +// ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc42 +func (soc *Socket) SetTcpKeepalive(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE, value) +} + +// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS) +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc44 +func (soc *Socket) SetTcpKeepaliveIdle(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_IDLE, value) +} + +// ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc43 +func (soc *Socket) SetTcpKeepaliveCnt(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_CNT, value) +} + +// ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc45 +func (soc *Socket) SetTcpKeepaliveIntvl(value int) error { + return soc.setInt(C.ZMQ_TCP_KEEPALIVE_INTVL, value) +} + +// ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections +// +// This option is deprecated since ZeroMQ version 4.1, please use authentication via +// the ZAP API and IP address whitelisting / blacklisting. +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc50 +func (soc *Socket) SetTcpAcceptFilter(filter string) error { + if len(filter) == 0 { + return soc.setNullString(C.ZMQ_TCP_ACCEPT_FILTER) + } + return soc.setString(C.ZMQ_TCP_ACCEPT_FILTER, filter) +} + +// ZMQ_PLAIN_SERVER: Set PLAIN server role +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc23 +func (soc *Socket) SetPlainServer(value int) error { + return soc.setInt(C.ZMQ_PLAIN_SERVER, value) +} + +// ZMQ_PLAIN_USERNAME: Set PLAIN security username +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc24 +func (soc *Socket) SetPlainUsername(username string) error { + if len(username) == 0 { + return soc.setNullString(C.ZMQ_PLAIN_USERNAME) + } + return soc.setString(C.ZMQ_PLAIN_USERNAME, username) +} + +// ZMQ_PLAIN_PASSWORD: Set PLAIN security password +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc22 +func (soc *Socket) SetPlainPassword(password string) error { + if len(password) == 0 { + return soc.setNullString(C.ZMQ_PLAIN_PASSWORD) + } + return soc.setString(C.ZMQ_PLAIN_PASSWORD, password) +} + +// ZMQ_CURVE_SERVER: Set CURVE server role +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc9 +func (soc *Socket) SetCurveServer(value int) error { + return soc.setInt(C.ZMQ_CURVE_SERVER, value) +} + +// ZMQ_CURVE_PUBLICKEY: Set CURVE public key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc7 +func (soc *Socket) SetCurvePublickey(key string) error { + return soc.setString(C.ZMQ_CURVE_PUBLICKEY, key) +} + +// ZMQ_CURVE_SECRETKEY: Set CURVE secret key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc8 +func (soc *Socket) SetCurveSecretkey(key string) error { + return soc.setString(C.ZMQ_CURVE_SECRETKEY, key) +} + +// ZMQ_CURVE_SERVERKEY: Set CURVE server key +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc10 +func (soc *Socket) SetCurveServerkey(key string) error { + return soc.setString(C.ZMQ_CURVE_SERVERKEY, key) +} + +// ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc49 +func (soc *Socket) SetZapDomain(domain string) error { + return soc.setString(C.ZMQ_ZAP_DOMAIN, domain) +} + +// ZMQ_CONFLATE: Keep only last message +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc6 +func (soc *Socket) SetConflate(value bool) error { + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_CONFLATE, val) +} + +//////////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.1.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// D : deprecated +// implemented documented test +// ZMQ_ROUTER_HANDOVER + + +// ZMQ_TOS + + +// ZMQ_IPC_FILTER_PID D +// ZMQ_IPC_FILTER_UID D +// ZMQ_IPC_FILTER_GID D +// ZMQ_CONNECT_RID + + +// ZMQ_GSSAPI_SERVER + + +// ZMQ_GSSAPI_PRINCIPAL + + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL + + +// ZMQ_GSSAPI_PLAINTEXT + + +// ZMQ_HANDSHAKE_IVL + + +// ZMQ_SOCKS_PROXY + +// ZMQ_XPUB_NODROP + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc35 +func (soc *Socket) SetRouterHandover(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_ROUTER_HANDOVER, val) +} + +// ZMQ_TOS: Set the Type-of-Service on socket +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc46 +func (soc *Socket) SetTos(value int) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setInt(C.ZMQ_TOS, value) +} + +// ZMQ_CONNECT_RID: Assign the next outbound connection id +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc5 +func (soc *Socket) SetConnectRid(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + if value == "" { + return soc.setNullString(C.ZMQ_CONNECT_RID) + } + return soc.setString(C.ZMQ_CONNECT_RID, value) +} + +// ZMQ_GSSAPI_SERVER: Set GSSAPI server role +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc13 +func (soc *Socket) SetGssapiServer(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_GSSAPI_SERVER, val) +} + +// ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc12 +func (soc *Socket) SetGssapiPrincipal(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setString(C.ZMQ_GSSAPI_PRINCIPAL, value) +} + +// ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc14 +func (soc *Socket) SetGssapiServicePrincipal(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + return soc.setString(C.ZMQ_GSSAPI_SERVICE_PRINCIPAL, value) +} + +// ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc11 +func (soc *Socket) SetGssapiPlaintext(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_GSSAPI_PLAINTEXT, val) +} + +// ZMQ_HANDSHAKE_IVL: Set maximum handshake interval +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-1:zmq-setsockopt#toc15 +func (soc *Socket) SetHandshakeIvl(value time.Duration) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HANDSHAKE_IVL, val) +} + +// ZMQ_SOCKS_PROXY: NOT DOCUMENTED +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +func (soc *Socket) SetSocksProxy(value string) error { + if minor < 1 { + return ErrorNotImplemented41 + } + if value == "" { + return soc.setNullString(C.ZMQ_SOCKS_PROXY) + } + return soc.setString(C.ZMQ_SOCKS_PROXY, value) +} + +// Available since ZeroMQ 4.1, documented since ZeroMQ 4.2 + +// ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached +// +// Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc60 +func (soc *Socket) SetXpubNodrop(value bool) error { + if minor < 1 { + return ErrorNotImplemented41 + } + val := 0 + if value { + val = 1 + } + return soc.setInt(C.ZMQ_XPUB_NODROP, val) +} + +//////////////////////////////////////////////////////////// +// +// New in ZeroMQ 4.2.0 +// +//////////////////////////////////////////////////////////////// +// +// + : yes +// o : getsockopt only +// implemented documented test +// ZMQ_BLOCKY +// ZMQ_XPUB_MANUAL + + +// ZMQ_XPUB_WELCOME_MSG + + +// ZMQ_STREAM_NOTIFY + + +// ZMQ_INVERT_MATCHING + + +// ZMQ_HEARTBEAT_IVL + + +// ZMQ_HEARTBEAT_TTL + + +// ZMQ_HEARTBEAT_TIMEOUT + + +// ZMQ_XPUB_VERBOSER + + +// ZMQ_CONNECT_TIMEOUT + + +// ZMQ_TCP_MAXRT + + +// ZMQ_THREAD_SAFE o +// ZMQ_MULTICAST_MAXTPDU + + +// ZMQ_VMCI_BUFFER_SIZE + + +// ZMQ_VMCI_BUFFER_MIN_SIZE + + +// ZMQ_VMCI_BUFFER_MAX_SIZE + + +// ZMQ_VMCI_CONNECT_TIMEOUT + + +// ZMQ_USE_FD + + +// +//////////////////////////////////////////////////////////////// + +// ZMQ_XPUB_MANUAL: change the subscription handling to manual +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc59 +func (soc *Socket) SetXpubManual(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_XPUB_MANUAL, value) +} + +// ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by subscriber when connecting +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc61 +func (soc *Socket) SetXpubWelcomeMsg(value string) error { + if minor < 2 { + return ErrorNotImplemented42 + } + if value == "" { + return soc.setNullString(C.ZMQ_XPUB_WELCOME_MSG) + } + return soc.setString(C.ZMQ_XPUB_WELCOME_MSG, value) +} + +// ZMQ_STREAM_NOTIFY: send connect and disconnect notifications +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc48 +func (soc *Socket) SetStreamNotify(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_STREAM_NOTIFY, value) +} + +// ZMQ_INVERT_MATCHING: Invert message filtering +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc22 +func (soc *Socket) SetInvertMatching(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_INVERT_MATCHING, value) +} + +// ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc17 +func (soc *Socket) SetHeartbeatIvl(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_IVL, val) +} + +// ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc19 +func (soc *Socket) SetHeartbeatTtl(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_TTL, val) +} + +// ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc18 +func (soc *Socket) SetHeartbeatTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_HEARTBEAT_TIMEOUT, val) +} + +// ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc58 +func (soc *Socket) SetXpubVerboser(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_XPUB_VERBOSER, value) +} + +// ZMQ_CONNECT_TIMEOUT: Set connect() timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc7 +func (soc *Socket) SetConnectTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_CONNECT_TIMEOUT, val) +} + +// ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc54 +func (soc *Socket) SetTcpMaxrt(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_TCP_MAXRT, val) +} + +// ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc27 +func (soc *Socket) SetMulticastMaxtpdu(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_MULTICAST_MAXTPDU, value) +} + +// ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc68 +func (soc *Socket) SetVmciBufferSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_SIZE, value) +} + +// ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc69 +func (soc *Socket) SetVmciBufferMinSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_MIN_SIZE, value) +} + +// ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc70 +func (soc *Socket) SetVmciBufferMaxSize(value uint64) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setUInt64(C.ZMQ_VMCI_BUFFER_MAX_SIZE, value) +} + +// ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc71 +func (soc *Socket) SetVmciConnectTimeout(value time.Duration) error { + if minor < 2 { + return ErrorNotImplemented42 + } + val := int(value / time.Millisecond) + return soc.setInt(C.ZMQ_VMCI_CONNECT_TIMEOUT, val) +} + +// ZMQ_USE_FD: Set the pre-allocated socket file descriptor +// +// Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +// +// See: http://api.zeromq.org/4-2:zmq-setsockopt#toc31 +func (soc *Socket) SetUseFd(value int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return soc.setInt(C.ZMQ_USE_FD, value) +} diff --git a/vendor/github.com/pebbe/zmq4/utils.go b/vendor/github.com/pebbe/zmq4/utils.go new file mode 100644 index 0000000..3a0fa45 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/utils.go @@ -0,0 +1,206 @@ +package zmq4 + +import ( + "fmt" +) + +/* +Send multi-part message on socket. + +Any `[]string' or `[][]byte' is split into separate `string's or `[]byte's + +Any other part that isn't a `string' or `[]byte' is converted +to `string' with `fmt.Sprintf("%v", part)'. + +Returns total bytes sent. +*/ +func (soc *Socket) SendMessage(parts ...interface{}) (total int, err error) { + return soc.sendMessage(0, parts...) +} + +/* +Like SendMessage(), but adding the DONTWAIT flag. +*/ +func (soc *Socket) SendMessageDontwait(parts ...interface{}) (total int, err error) { + return soc.sendMessage(DONTWAIT, parts...) +} + +func (soc *Socket) sendMessage(dontwait Flag, parts ...interface{}) (total int, err error) { + + var last int +PARTS: + for last = len(parts) - 1; last >= 0; last-- { + switch t := parts[last].(type) { + case []string: + if len(t) > 0 { + break PARTS + } + case [][]byte: + if len(t) > 0 { + break PARTS + } + default: + break PARTS + } + } + + opt := SNDMORE | dontwait + for i := 0; i <= last; i++ { + if i == last { + opt = dontwait + } + switch t := parts[i].(type) { + case []string: + opt = SNDMORE | dontwait + n := len(t) - 1 + for j, s := range t { + if j == n && i == last { + opt = dontwait + } + c, e := soc.Send(s, opt) + if e == nil { + total += c + } else { + return -1, e + } + } + case [][]byte: + opt = SNDMORE | dontwait + n := len(t) - 1 + for j, b := range t { + if j == n && i == last { + opt = dontwait + } + c, e := soc.SendBytes(b, opt) + if e == nil { + total += c + } else { + return -1, e + } + } + case string: + c, e := soc.Send(t, opt) + if e == nil { + total += c + } else { + return -1, e + } + case []byte: + c, e := soc.SendBytes(t, opt) + if e == nil { + total += c + } else { + return -1, e + } + default: + c, e := soc.Send(fmt.Sprintf("%v", t), opt) + if e == nil { + total += c + } else { + return -1, e + } + } + } + return +} + +/* +Receive parts as message from socket. + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessage(flags Flag) (msg []string, err error) { + msg = make([]string, 0) + for { + s, e := soc.Recv(flags) + if e == nil { + msg = append(msg, s) + } else { + return msg[0:0], e + } + more, e := soc.GetRcvmore() + if e == nil { + if !more { + break + } + } else { + return msg[0:0], e + } + } + return +} + +/* +Receive parts as message from socket. + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageBytes(flags Flag) (msg [][]byte, err error) { + msg = make([][]byte, 0) + for { + b, e := soc.RecvBytes(flags) + if e == nil { + msg = append(msg, b) + } else { + return msg[0:0], e + } + more, e := soc.GetRcvmore() + if e == nil { + if !more { + break + } + } else { + return msg[0:0], e + } + } + return +} + +/* +Receive parts as message from socket, including metadata. + +Metadata is picked from the first message part. + +For details about metadata, see RecvWithMetadata(). + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageWithMetadata(flags Flag, properties ...string) (msg []string, metadata map[string]string, err error) { + b, p, err := soc.RecvMessageBytesWithMetadata(flags, properties...) + m := make([]string, len(b)) + for i, bt := range b { + m[i] = string(bt) + } + return m, p, err +} + +/* +Receive parts as message from socket, including metadata. + +Metadata is picked from the first message part. + +For details about metadata, see RecvBytesWithMetadata(). + +Returns last non-nil error code. +*/ +func (soc *Socket) RecvMessageBytesWithMetadata(flags Flag, properties ...string) (msg [][]byte, metadata map[string]string, err error) { + bb := make([][]byte, 0) + b, p, err := soc.RecvBytesWithMetadata(flags, properties...) + if err != nil { + return bb, p, err + } + for { + bb = append(bb, b) + + var more bool + more, err = soc.GetRcvmore() + if err != nil || !more { + break + } + b, err = soc.RecvBytes(flags) + if err != nil { + break + } + } + return bb, p, err +} diff --git a/vendor/github.com/pebbe/zmq4/zmq4.go b/vendor/github.com/pebbe/zmq4/zmq4.go new file mode 100644 index 0000000..86287a1 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/zmq4.go @@ -0,0 +1,1335 @@ +package zmq4 + +/* +#cgo !windows pkg-config: libzmq +#cgo windows CFLAGS: -I/usr/local/include +#cgo windows LDFLAGS: -L/usr/local/lib -lzmq +#include +#if ZMQ_VERSION_MINOR < 2 +#include +#endif +#include +#include +#include "zmq4.h" + +int + zmq4_major = ZMQ_VERSION_MAJOR, + zmq4_minor = ZMQ_VERSION_MINOR, + zmq4_patch = ZMQ_VERSION_PATCH; + +#if ZMQ_VERSION_MINOR > 0 +// Version >= 4.1.x + +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value; // value is either error code, fd or reconnect interval +} zmq_event_t; + +#else +// Version == 4.0.x + +const char *zmq_msg_gets (zmq_msg_t *msg, const char *property) { + return NULL; +} + +int zmq_has (const char *capability) { + return 0; +} + +#if ZMQ_VERSION_PATCH < 5 +// Version < 4.0.5 + +int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control) { + return -1; +} + +#endif // Version < 4.0.5 + +#endif // Version == 4.0.x + +void zmq4_get_event40(zmq_msg_t *msg, int *ev, int *val) { + zmq_event_t event; + const char* data = (char*)zmq_msg_data(msg); + memcpy(&(event.event), data, sizeof(event.event)); + memcpy(&(event.value), data+sizeof(event.event), sizeof(event.value)); + *ev = (int)(event.event); + *val = (int)(event.value); +} +void zmq4_get_event41(zmq_msg_t *msg, int *ev, int *val) { + uint8_t *data = (uint8_t *) zmq_msg_data (msg); + uint16_t event = *(uint16_t *) (data); + *ev = (int)event; + *val = (int)(*(uint32_t *) (data + 2)); +} +void *zmq4_memcpy(void *dest, const void *src, size_t n) { + return memcpy(dest, src, n); +} +*/ +import "C" + +import ( + "errors" + "fmt" + "runtime" + "strings" + "unsafe" +) + +var ( + defaultCtx *Context + + major, minor, patch int + + ErrorContextClosed = errors.New("Context is closed") + ErrorSocketClosed = errors.New("Socket is closed") + ErrorMoreExpected = errors.New("More expected") + ErrorNotImplemented405 = errors.New("Not implemented, requires 0MQ version 4.0.5") + ErrorNotImplemented41 = errors.New("Not implemented, requires 0MQ version 4.1") + ErrorNotImplemented42 = errors.New("Not implemented, requires 0MQ version 4.2") + ErrorNotImplementedWindows = errors.New("Not implemented on Windows") + ErrorNoSocket = errors.New("No such socket") + + initVersionError error + initContextError error +) + +func init() { + major, minor, patch = Version() + if major != 4 { + initVersionError = fmt.Errorf("Using zmq4 with ZeroMQ major version %d", major) + return + } + if major != int(C.zmq4_major) || minor != int(C.zmq4_minor) || patch != int(C.zmq4_patch) { + initVersionError = + fmt.Errorf( + "zmq4 was installed with ZeroMQ version %d.%d.%d, but the application links with version %d.%d.%d", + int(C.zmq4_major), int(C.zmq4_minor), int(C.zmq4_patch), + major, minor, patch) + return + } + + var err error + defaultCtx = &Context{} + defaultCtx.ctx, err = C.zmq_ctx_new() + if defaultCtx.ctx == nil || err != nil { + initContextError = fmt.Errorf("Init of ZeroMQ context failed: %v", errget(err)) + return + } + defaultCtx.opened = true +} + +//. Util + +// Report 0MQ library version. +func Version() (major, minor, patch int) { + if initVersionError != nil { + return 0, 0, 0 + } + var maj, min, pat C.int + C.zmq_version(&maj, &min, &pat) + return int(maj), int(min), int(pat) +} + +// Get 0MQ error message string. +func Error(e int) string { + return C.GoString(C.zmq_strerror(C.int(e))) +} + +//. Context + +const ( + MaxSocketsDflt = int(C.ZMQ_MAX_SOCKETS_DFLT) + IoThreadsDflt = int(C.ZMQ_IO_THREADS_DFLT) +) + +/* +A context that is not the default context. +*/ +type Context struct { + ctx unsafe.Pointer + opened bool + err error +} + +// Create a new context. +func NewContext() (ctx *Context, err error) { + if initVersionError != nil { + return nil, initVersionError + } + ctx = &Context{} + c, e := C.zmq_ctx_new() + if c == nil { + err = errget(e) + ctx.err = err + } else { + ctx.ctx = c + ctx.opened = true + runtime.SetFinalizer(ctx, (*Context).Term) + } + return +} + +/* +Terminates the default context. + +For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term +*/ +func Term() error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.Term() +} + +/* +Terminates the context. + +For linger behavior, see: http://api.zeromq.org/4-1:zmq-ctx-term +*/ +func (ctx *Context) Term() error { + if ctx.opened { + ctx.opened = false + n, err := C.zmq_ctx_term(ctx.ctx) + if n != 0 { + ctx.err = errget(err) + } + } + return ctx.err +} + +func getOption(ctx *Context, o C.int) (int, error) { + if !ctx.opened { + return 0, ErrorContextClosed + } + nc, err := C.zmq_ctx_get(ctx.ctx, o) + n := int(nc) + if n < 0 { + return n, errget(err) + } + return n, nil +} + +// Returns the size of the 0MQ thread pool in the default context. +func GetIoThreads() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetIoThreads() +} + +// Returns the size of the 0MQ thread pool. +func (ctx *Context) GetIoThreads() (int, error) { + return getOption(ctx, C.ZMQ_IO_THREADS) +} + +// Returns the maximum number of sockets allowed in the default context. +func GetMaxSockets() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetMaxSockets() +} + +// Returns the maximum number of sockets allowed. +func (ctx *Context) GetMaxSockets() (int, error) { + return getOption(ctx, C.ZMQ_MAX_SOCKETS) +} + +/* +Returns the maximum message size in the default context. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func GetMaxMsgsz() (int, error) { + if initVersionError != nil { + return 0, initVersionError + } + if initContextError != nil { + return 0, initContextError + } + return defaultCtx.GetMaxMsgsz() +} + +/* +Returns the maximum message size. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) GetMaxMsgsz() (int, error) { + if minor < 2 { + return 0, ErrorNotImplemented42 + } + return getOption(ctx, C.ZMQ_MAX_MSGSZ) +} + +// Returns the IPv6 option in the default context. +func GetIpv6() (bool, error) { + if initVersionError != nil { + return false, initVersionError + } + if initContextError != nil { + return false, initContextError + } + return defaultCtx.GetIpv6() +} + +// Returns the IPv6 option. +func (ctx *Context) GetIpv6() (bool, error) { + i, e := getOption(ctx, C.ZMQ_IPV6) + if i == 0 { + return false, e + } + return true, e +} + +/* +Returns the blocky setting in the default context. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func GetBlocky() (bool, error) { + if initVersionError != nil { + return false, initVersionError + } + if initContextError != nil { + return false, initContextError + } + return defaultCtx.GetBlocky() +} + +/* +Returns the blocky setting. + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) GetBlocky() (bool, error) { + if minor < 2 { + return false, ErrorNotImplemented42 + } + i, e := getOption(ctx, C.ZMQ_BLOCKY) + if i == 0 { + return false, e + } + return true, e +} + +func setOption(ctx *Context, o C.int, n int) error { + if !ctx.opened { + return ErrorContextClosed + } + i, err := C.zmq_ctx_set(ctx.ctx, o, C.int(n)) + if int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Specifies the size of the 0MQ thread pool to handle I/O operations in +the default context. If your application is using only the inproc +transport for messaging you may set this to zero, otherwise set it to at +least one. This option only applies before creating any sockets. + +Default value: 1 +*/ +func SetIoThreads(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetIoThreads(n) +} + +/* +Specifies the size of the 0MQ thread pool to handle I/O operations. If +your application is using only the inproc transport for messaging you +may set this to zero, otherwise set it to at least one. This option only +applies before creating any sockets. + +Default value: 1 +*/ +func (ctx *Context) SetIoThreads(n int) error { + return setOption(ctx, C.ZMQ_IO_THREADS, n) +} + +/* +Sets the scheduling policy for default context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func SetThreadSchedPolicy(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetThreadSchedPolicy(n) +} + +/* +Sets scheduling priority for default context’s thread pool. + +This option requires ZeroMQ version 4.1, and is not available on Windows. + +Supported values for this option depend on chosen scheduling policy. +Details can be found in sched.h file, or at +http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html + +This option only applies before creating any sockets on the context. + +Default value: -1 + +Returns ErrorNotImplemented41 with ZeroMQ version < 4.1 + +Returns ErrorNotImplementedWindows on Windows +*/ +func SetThreadPriority(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetThreadPriority(n) +} + +/* +Set maximum message size in the default context. + +Default value: INT_MAX + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func SetMaxMsgsz(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetMaxMsgsz(n) +} + +/* +Set maximum message size. + +Default value: INT_MAX + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) SetMaxMsgsz(n int) error { + if minor < 2 { + return ErrorNotImplemented42 + } + return setOption(ctx, C.ZMQ_MAX_MSGSZ, n) +} + +/* +Sets the maximum number of sockets allowed in the default context. + +Default value: 1024 +*/ +func SetMaxSockets(n int) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetMaxSockets(n) +} + +/* +Sets the maximum number of sockets allowed. + +Default value: 1024 +*/ +func (ctx *Context) SetMaxSockets(n int) error { + return setOption(ctx, C.ZMQ_MAX_SOCKETS, n) +} + +/* +Sets the IPv6 value for all sockets created in the default context from this point onwards. +A value of true means IPv6 is enabled, while false means the socket will use only IPv4. +When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts. + +Default value: false +*/ +func SetIpv6(i bool) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetIpv6(i) +} + +/* +Sets the IPv6 value for all sockets created in the context from this point onwards. +A value of true means IPv6 is enabled, while false means the socket will use only IPv4. +When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts. + +Default value: false +*/ +func (ctx *Context) SetIpv6(i bool) error { + n := 0 + if i { + n = 1 + } + return setOption(ctx, C.ZMQ_IPV6, n) +} + +/* +Sets the blocky behavior in the default context. + +See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3 + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func SetBlocky(i bool) error { + if initVersionError != nil { + return initVersionError + } + if initContextError != nil { + return initContextError + } + return defaultCtx.SetBlocky(i) +} + +/* +Sets the blocky behavior. + +See: http://api.zeromq.org/4-2:zmq-ctx-set#toc3 + +Returns ErrorNotImplemented42 with ZeroMQ version < 4.2 +*/ +func (ctx *Context) SetBlocky(i bool) error { + if minor < 2 { + return ErrorNotImplemented42 + } + n := 0 + if i { + n = 1 + } + return setOption(ctx, C.ZMQ_BLOCKY, n) +} + +//. Sockets + +// Specifies the type of a socket, used by NewSocket() +type Type int + +const ( + // Constants for NewSocket() + // See: http://api.zeromq.org/4-1:zmq-socket#toc3 + REQ = Type(C.ZMQ_REQ) + REP = Type(C.ZMQ_REP) + DEALER = Type(C.ZMQ_DEALER) + ROUTER = Type(C.ZMQ_ROUTER) + PUB = Type(C.ZMQ_PUB) + SUB = Type(C.ZMQ_SUB) + XPUB = Type(C.ZMQ_XPUB) + XSUB = Type(C.ZMQ_XSUB) + PUSH = Type(C.ZMQ_PUSH) + PULL = Type(C.ZMQ_PULL) + PAIR = Type(C.ZMQ_PAIR) + STREAM = Type(C.ZMQ_STREAM) +) + +/* +Socket type as string. +*/ +func (t Type) String() string { + switch t { + case REQ: + return "REQ" + case REP: + return "REP" + case DEALER: + return "DEALER" + case ROUTER: + return "ROUTER" + case PUB: + return "PUB" + case SUB: + return "SUB" + case XPUB: + return "XPUB" + case XSUB: + return "XSUB" + case PUSH: + return "PUSH" + case PULL: + return "PULL" + case PAIR: + return "PAIR" + case STREAM: + return "STREAM" + } + return "" +} + +// Used by (*Socket)Send() and (*Socket)Recv() +type Flag int + +const ( + // Flags for (*Socket)Send(), (*Socket)Recv() + // For Send, see: http://api.zeromq.org/4-1:zmq-send#toc2 + // For Recv, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + DONTWAIT = Flag(C.ZMQ_DONTWAIT) + SNDMORE = Flag(C.ZMQ_SNDMORE) +) + +/* +Socket flag as string. +*/ +func (f Flag) String() string { + ff := make([]string, 0) + if f&DONTWAIT != 0 { + ff = append(ff, "DONTWAIT") + } + if f&SNDMORE != 0 { + ff = append(ff, "SNDMORE") + } + if len(ff) == 0 { + return "" + } + return strings.Join(ff, "|") +} + +// Used by (*Socket)Monitor() and (*Socket)RecvEvent() +type Event int + +const ( + // Flags for (*Socket)Monitor() and (*Socket)RecvEvent() + // See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3 + EVENT_ALL = Event(C.ZMQ_EVENT_ALL) + EVENT_CONNECTED = Event(C.ZMQ_EVENT_CONNECTED) + EVENT_CONNECT_DELAYED = Event(C.ZMQ_EVENT_CONNECT_DELAYED) + EVENT_CONNECT_RETRIED = Event(C.ZMQ_EVENT_CONNECT_RETRIED) + EVENT_LISTENING = Event(C.ZMQ_EVENT_LISTENING) + EVENT_BIND_FAILED = Event(C.ZMQ_EVENT_BIND_FAILED) + EVENT_ACCEPTED = Event(C.ZMQ_EVENT_ACCEPTED) + EVENT_ACCEPT_FAILED = Event(C.ZMQ_EVENT_ACCEPT_FAILED) + EVENT_CLOSED = Event(C.ZMQ_EVENT_CLOSED) + EVENT_CLOSE_FAILED = Event(C.ZMQ_EVENT_CLOSE_FAILED) + EVENT_DISCONNECTED = Event(C.ZMQ_EVENT_DISCONNECTED) + EVENT_MONITOR_STOPPED = Event(C.ZMQ_EVENT_MONITOR_STOPPED) +) + +/* +Socket event as string. +*/ +func (e Event) String() string { + if e == EVENT_ALL { + return "EVENT_ALL" + } + ee := make([]string, 0) + if e&EVENT_CONNECTED != 0 { + ee = append(ee, "EVENT_CONNECTED") + } + if e&EVENT_CONNECT_DELAYED != 0 { + ee = append(ee, "EVENT_CONNECT_DELAYED") + } + if e&EVENT_CONNECT_RETRIED != 0 { + ee = append(ee, "EVENT_CONNECT_RETRIED") + } + if e&EVENT_LISTENING != 0 { + ee = append(ee, "EVENT_LISTENING") + } + if e&EVENT_BIND_FAILED != 0 { + ee = append(ee, "EVENT_BIND_FAILED") + } + if e&EVENT_ACCEPTED != 0 { + ee = append(ee, "EVENT_ACCEPTED") + } + if e&EVENT_ACCEPT_FAILED != 0 { + ee = append(ee, "EVENT_ACCEPT_FAILED") + } + if e&EVENT_CLOSED != 0 { + ee = append(ee, "EVENT_CLOSED") + } + if e&EVENT_CLOSE_FAILED != 0 { + ee = append(ee, "EVENT_CLOSE_FAILED") + } + if e&EVENT_DISCONNECTED != 0 { + ee = append(ee, "EVENT_DISCONNECTED") + } + if len(ee) == 0 { + return "" + } + return strings.Join(ee, "|") +} + +// Used by (soc *Socket)GetEvents() +type State int + +const ( + // Flags for (*Socket)GetEvents() + // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc8 + POLLIN = State(C.ZMQ_POLLIN) + POLLOUT = State(C.ZMQ_POLLOUT) +) + +/* +Socket state as string. +*/ +func (s State) String() string { + ss := make([]string, 0) + if s&POLLIN != 0 { + ss = append(ss, "POLLIN") + } + if s&POLLOUT != 0 { + ss = append(ss, "POLLOUT") + } + if len(ss) == 0 { + return "" + } + return strings.Join(ss, "|") +} + +// Specifies the security mechanism, used by (*Socket)GetMechanism() +type Mechanism int + +const ( + // Constants for (*Socket)GetMechanism() + // See: http://api.zeromq.org/4-1:zmq-getsockopt#toc22 + NULL = Mechanism(C.ZMQ_NULL) + PLAIN = Mechanism(C.ZMQ_PLAIN) + CURVE = Mechanism(C.ZMQ_CURVE) + GSSAPI = Mechanism(C.ZMQ_GSSAPI) +) + +/* +Security mechanism as string. +*/ +func (m Mechanism) String() string { + switch m { + case NULL: + return "NULL" + case PLAIN: + return "PLAIN" + case CURVE: + return "CURVE" + case GSSAPI: + return "GSSAPI" + } + return "" +} + +/* +Socket functions starting with `Set` or `Get` are used for setting and +getting socket options. +*/ +type Socket struct { + soc unsafe.Pointer + ctx *Context + opened bool + err error +} + +/* +Socket as string. +*/ +func (soc Socket) String() string { + if !soc.opened { + return "Socket(CLOSED)" + } + t, err := soc.GetType() + if err != nil { + return fmt.Sprintf("Socket(%v)", err) + } + i, err := soc.GetIdentity() + if err == nil && i != "" { + return fmt.Sprintf("Socket(%v,%q)", t, i) + } + return fmt.Sprintf("Socket(%v,%p)", t, soc.soc) +} + +/* +Create 0MQ socket in the default context. + +WARNING: +The Socket is not thread safe. This means that you cannot access the same Socket +from different goroutines without using something like a mutex. + +For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3 +*/ +func NewSocket(t Type) (soc *Socket, err error) { + if initVersionError != nil { + return nil, initVersionError + } + if initContextError != nil { + return nil, initContextError + } + return defaultCtx.NewSocket(t) +} + +/* +Create 0MQ socket in the given context. + +WARNING: +The Socket is not thread safe. This means that you cannot access the same Socket +from different goroutines without using something like a mutex. + +For a description of socket types, see: http://api.zeromq.org/4-1:zmq-socket#toc3 +*/ +func (ctx *Context) NewSocket(t Type) (soc *Socket, err error) { + soc = &Socket{} + if !ctx.opened { + return soc, ErrorContextClosed + } + s, e := C.zmq_socket(ctx.ctx, C.int(t)) + if s == nil { + err = errget(e) + soc.err = err + } else { + soc.soc = s + soc.ctx = ctx + soc.opened = true + runtime.SetFinalizer(soc, (*Socket).Close) + } + return +} + +// If not called explicitly, the socket will be closed on garbage collection +func (soc *Socket) Close() error { + if soc.opened { + soc.opened = false + if i, err := C.zmq_close(soc.soc); int(i) != 0 { + soc.err = errget(err) + } + soc.soc = unsafe.Pointer(nil) + soc.ctx = nil + } + return soc.err +} + +// Return the context associated with a socket +func (soc *Socket) Context() (*Context, error) { + if !soc.opened { + return nil, ErrorSocketClosed + } + return soc.ctx, nil +} + +/* +Accept incoming connections on a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-bind#toc2 +*/ +func (soc *Socket) Bind(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_bind(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Stop accepting connections on a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-bind#toc2 +*/ +func (soc *Socket) Unbind(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_unbind(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Create outgoing connection from socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-connect#toc2 +*/ +func (soc *Socket) Connect(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_connect(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Disconnect a socket. + +For a description of endpoint, see: http://api.zeromq.org/4-1:zmq-disconnect#toc2 +*/ +func (soc *Socket) Disconnect(endpoint string) error { + if !soc.opened { + return ErrorSocketClosed + } + s := C.CString(endpoint) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_disconnect(soc.soc, s); int(i) != 0 { + return errget(err) + } + return nil +} + +/* +Receive a message part from a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 +*/ +func (soc *Socket) Recv(flags Flag) (string, error) { + b, err := soc.RecvBytes(flags) + return string(b), err +} + +/* +Receive a message part from a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 +*/ +func (soc *Socket) RecvBytes(flags Flag) ([]byte, error) { + if !soc.opened { + return []byte{}, ErrorSocketClosed + } + var msg C.zmq_msg_t + if i, err := C.zmq_msg_init(&msg); i != 0 { + return []byte{}, errget(err) + } + defer C.zmq_msg_close(&msg) + + size, err := C.zmq_msg_recv(&msg, soc.soc, C.int(flags)) + if size < 0 { + return []byte{}, errget(err) + } + if size == 0 { + return []byte{}, nil + } + data := make([]byte, int(size)) + C.zmq4_memcpy(unsafe.Pointer(&data[0]), C.zmq_msg_data(&msg), C.size_t(size)) + return data, nil +} + +/* +Send a message part on a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2 +*/ +func (soc *Socket) Send(data string, flags Flag) (int, error) { + return soc.SendBytes([]byte(data), flags) +} + +/* +Send a message part on a socket. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-send#toc2 +*/ +func (soc *Socket) SendBytes(data []byte, flags Flag) (int, error) { + if !soc.opened { + return 0, ErrorSocketClosed + } + d := data + if len(data) == 0 { + d = []byte{0} + } + size, err := C.zmq_send(soc.soc, unsafe.Pointer(&d[0]), C.size_t(len(data)), C.int(flags)) + if size < 0 { + return int(size), errget(err) + } + return int(size), nil +} + +/* +Register a monitoring callback. + +See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc2 + +WARNING: Closing a context with a monitoring callback will lead to random crashes. +This is a bug in the ZeroMQ library. +The monitoring callback has the same context as the socket it was created for. + +Example: + + package main + + import ( + zmq "github.com/pebbe/zmq4" + "log" + "time" + ) + + func rep_socket_monitor(addr string) { + s, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + log.Fatalln(err) + } + err = s.Connect(addr) + if err != nil { + log.Fatalln(err) + } + for { + a, b, c, err := s.RecvEvent(0) + if err != nil { + log.Println(err) + break + } + log.Println(a, b, c) + } + s.Close() + } + + func main() { + + // REP socket + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + log.Fatalln(err) + } + + // REP socket monitor, all events + err = rep.Monitor("inproc://monitor.rep", zmq.EVENT_ALL) + if err != nil { + log.Fatalln(err) + } + go rep_socket_monitor("inproc://monitor.rep") + + // Generate an event + rep.Bind("tcp://*:5555") + if err != nil { + log.Fatalln(err) + } + + // Allow some time for event detection + time.Sleep(time.Second) + + rep.Close() + zmq.Term() + } +*/ +func (soc *Socket) Monitor(addr string, events Event) error { + if !soc.opened { + return ErrorSocketClosed + } + if addr == "" { + if i, err := C.zmq_socket_monitor(soc.soc, nil, C.int(events)); i != 0 { + return errget(err) + } + return nil + } + + s := C.CString(addr) + defer C.free(unsafe.Pointer(s)) + if i, err := C.zmq_socket_monitor(soc.soc, s, C.int(events)); i != 0 { + return errget(err) + } + return nil +} + +/* +Receive a message part from a socket interpreted as an event. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of event_type, see: http://api.zeromq.org/4-1:zmq-socket-monitor#toc3 + +For an example, see: func (*Socket) Monitor +*/ +func (soc *Socket) RecvEvent(flags Flag) (event_type Event, addr string, value int, err error) { + if !soc.opened { + return EVENT_ALL, "", 0, ErrorSocketClosed + } + var msg C.zmq_msg_t + if i, e := C.zmq_msg_init(&msg); i != 0 { + err = errget(e) + return + } + defer C.zmq_msg_close(&msg) + size, e := C.zmq_msg_recv(&msg, soc.soc, C.int(flags)) + if size < 0 { + err = errget(e) + return + } + et := C.int(0) + val := C.int(0) + + if minor == 0 { + C.zmq4_get_event40(&msg, &et, &val) + } else { + C.zmq4_get_event41(&msg, &et, &val) + } + more, e := soc.GetRcvmore() + if e != nil { + err = errget(e) + return + } + if !more { + err = ErrorMoreExpected + return + } + addr, e = soc.Recv(flags) + if e != nil { + err = errget(e) + return + } + + event_type = Event(et) + value = int(val) + + return +} + +/* +Start built-in ØMQ proxy + +See: http://api.zeromq.org/4-1:zmq-proxy#toc2 +*/ +func Proxy(frontend, backend, capture *Socket) error { + if !(frontend.opened && backend.opened && (capture == nil || capture.opened)) { + return ErrorSocketClosed + } + var capt unsafe.Pointer + if capture != nil { + capt = capture.soc + } + _, err := C.zmq_proxy(frontend.soc, backend.soc, capt) + return errget(err) +} + +/* +Start built-in ØMQ proxy with PAUSE/RESUME/TERMINATE control flow + +Returns ErrorNotImplemented405 with ZeroMQ version < 4.0.5 + +See: http://api.zeromq.org/4-1:zmq-proxy-steerable#toc2 +*/ +func ProxySteerable(frontend, backend, capture, control *Socket) error { + if minor == 0 && patch < 5 { + return ErrorNotImplemented405 + } + if !(frontend.opened && backend.opened && (capture == nil || capture.opened) && (control == nil || control.opened)) { + return ErrorSocketClosed + } + var capt, ctrl unsafe.Pointer + if capture != nil { + capt = capture.soc + } + if control != nil { + ctrl = control.soc + } + i, err := C.zmq_proxy_steerable(frontend.soc, backend.soc, capt, ctrl) + if i < 0 { + return errget(err) + } + return nil +} + +//. CURVE + +/* +Encode a binary key as Z85 printable text + +See: http://api.zeromq.org/4-1:zmq-z85-encode +*/ +func Z85encode(data string) string { + if initVersionError != nil { + return initVersionError.Error() + } + l1 := len(data) + if l1%4 != 0 { + panic("Z85encode: Length of data not a multiple of 4") + } + d := []byte(data) + + l2 := 5 * l1 / 4 + dest := make([]byte, l2+1) + + C.zmq_z85_encode((*C.char)(unsafe.Pointer(&dest[0])), (*C.uint8_t)(&d[0]), C.size_t(l1)) + + return string(dest[:l2]) +} + +/* +Decode a binary key from Z85 printable text + +See: http://api.zeromq.org/4-1:zmq-z85-decode +*/ +func Z85decode(s string) string { + if initVersionError != nil { + return initVersionError.Error() + } + l1 := len(s) + if l1%5 != 0 { + panic("Z85decode: Length of Z85 string not a multiple of 5") + } + l2 := 4 * l1 / 5 + dest := make([]byte, l2) + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + C.zmq_z85_decode((*C.uint8_t)(&dest[0]), cs) + return string(dest) +} + +/* +Generate a new CURVE keypair + +See: http://api.zeromq.org/4-1:zmq-curve-keypair#toc2 +*/ +func NewCurveKeypair() (z85_public_key, z85_secret_key string, err error) { + if initVersionError != nil { + return "", "", initVersionError + } + var pubkey, seckey [41]byte + if i, err := C.zmq_curve_keypair((*C.char)(unsafe.Pointer(&pubkey[0])), (*C.char)(unsafe.Pointer(&seckey[0]))); i != 0 { + return "", "", errget(err) + } + return string(pubkey[:40]), string(seckey[:40]), nil +} + +/* +Receive a message part with metadata. + +This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata. + +The returned metadata map contains only those properties that exist on the message. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3 +*/ +func (soc *Socket) RecvWithMetadata(flags Flag, properties ...string) (msg string, metadata map[string]string, err error) { + b, p, err := soc.RecvBytesWithMetadata(flags, properties...) + return string(b), p, err +} + +/* +Receive a message part with metadata. + +This requires ZeroMQ version 4.1.0. Lower versions will return the message part without metadata. + +The returned metadata map contains only those properties that exist on the message. + +For a description of flags, see: http://api.zeromq.org/4-1:zmq-msg-recv#toc2 + +For a description of metadata, see: http://api.zeromq.org/4-1:zmq-msg-gets#toc3 +*/ +func (soc *Socket) RecvBytesWithMetadata(flags Flag, properties ...string) (msg []byte, metadata map[string]string, err error) { + if !soc.opened { + return []byte{}, map[string]string{}, ErrorSocketClosed + } + + metadata = make(map[string]string) + + var m C.zmq_msg_t + if i, err := C.zmq_msg_init(&m); i != 0 { + return []byte{}, metadata, errget(err) + } + defer C.zmq_msg_close(&m) + + size, err := C.zmq_msg_recv(&m, soc.soc, C.int(flags)) + if size < 0 { + return []byte{}, metadata, errget(err) + } + + data := make([]byte, int(size)) + if size > 0 { + C.zmq4_memcpy(unsafe.Pointer(&data[0]), C.zmq_msg_data(&m), C.size_t(size)) + } + + if minor > 0 { + for _, p := range properties { + ps := C.CString(p) + s, err := C.zmq_msg_gets(&m, ps) + if err == nil { + metadata[p] = C.GoString(s) + } + C.free(unsafe.Pointer(ps)) + } + } + return data, metadata, nil +} + +func hasCap(s string) (value bool) { + if initVersionError != nil { + return false + } + if minor < 1 { + return false + } + cs := C.CString(s) + defer C.free(unsafe.Pointer(cs)) + return C.zmq_has(cs) != 0 +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the ipc:// protocol +func HasIpc() bool { + return hasCap("ipc") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the pgm:// protocol +func HasPgm() bool { + return hasCap("pgm") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the tipc:// protocol +func HasTipc() bool { + return hasCap("tipc") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the norm:// protocol +func HasNorm() bool { + return hasCap("norm") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the CURVE security mechanism +func HasCurve() bool { + return hasCap("curve") +} + +// Returns false for ZeroMQ version < 4.1.0 +// +// Else: returns true if the library supports the GSSAPI security mechanism +func HasGssapi() bool { + return hasCap("gssapi") +} diff --git a/vendor/github.com/pebbe/zmq4/zmq4.h b/vendor/github.com/pebbe/zmq4/zmq4.h new file mode 100644 index 0000000..ef4b523 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/zmq4.h @@ -0,0 +1,55 @@ +#if ZMQ_VERSION_MAJOR != 4 + +#error "You need ZeroMQ version 4 to build this" + +#endif + +#if ZMQ_VERSION_MINOR < 1 + +#define ZMQ_CONNECT_RID -1 +#define ZMQ_GSSAPI -1 +#define ZMQ_GSSAPI_PLAINTEXT -1 +#define ZMQ_GSSAPI_PRINCIPAL -1 +#define ZMQ_GSSAPI_SERVER -1 +#define ZMQ_GSSAPI_SERVICE_PRINCIPAL -1 +#define ZMQ_HANDSHAKE_IVL -1 +#define ZMQ_IPC_FILTER_GID -1 +#define ZMQ_IPC_FILTER_PID -1 +#define ZMQ_IPC_FILTER_UID -1 +#define ZMQ_ROUTER_HANDOVER -1 +#define ZMQ_SOCKS_PROXY -1 +#define ZMQ_THREAD_PRIORITY -1 +#define ZMQ_THREAD_SCHED_POLICY -1 +#define ZMQ_TOS -1 +#define ZMQ_XPUB_NODROP -1 + +#endif + +#if ZMQ_VERSION_MINOR < 2 + +#define ZMQ_MAX_MSGSZ -1 + +#define ZMQ_BLOCKY -1 +#define ZMQ_XPUB_MANUAL -1 +#define ZMQ_XPUB_WELCOME_MSG -1 +#define ZMQ_STREAM_NOTIFY -1 +#define ZMQ_INVERT_MATCHING -1 +#define ZMQ_HEARTBEAT_IVL -1 +#define ZMQ_HEARTBEAT_TTL -1 +#define ZMQ_HEARTBEAT_TIMEOUT -1 +#define ZMQ_XPUB_VERBOSER -1 +#define ZMQ_CONNECT_TIMEOUT -1 +#define ZMQ_TCP_MAXRT -1 +#define ZMQ_THREAD_SAFE -1 +#define ZMQ_MULTICAST_MAXTPDU -1 +#define ZMQ_VMCI_BUFFER_SIZE -1 +#define ZMQ_VMCI_BUFFER_MIN_SIZE -1 +#define ZMQ_VMCI_BUFFER_MAX_SIZE -1 +#define ZMQ_VMCI_CONNECT_TIMEOUT -1 +#define ZMQ_USE_FD -1 + +#define ZMQ_GROUP_MAX_LENGTH -1 + +#define ZMQ_POLLPRI -1 + +#endif diff --git a/vendor/github.com/pebbe/zmq4/zmq41_test.go b/vendor/github.com/pebbe/zmq4/zmq41_test.go new file mode 100644 index 0000000..1494172 --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/zmq41_test.go @@ -0,0 +1,74 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4" + + "testing" +) + +func TestRemoteEndpoint(t *testing.T) { + + if _, minor, _ := zmq.Version(); minor < 1 { + t.Skip("RemoteEndpoint not avalable in ZeroMQ versions prior to 4.1.0") + } + + addr := "tcp://127.0.0.1:9560" + peer := "127.0.0.1" + + var rep, req *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{rep, req} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + rep, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + req, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + + if err = rep.Bind(addr); err != nil { + t.Fatal("rep.Bind:", err) + } + if err = req.Connect(addr); err != nil { + t.Fatal("req.Connect:", err) + } + + tmp := "test" + if _, err = req.Send(tmp, 0); err != nil { + t.Fatal("req.Send:", err) + } + + // get message with peer address (remote endpoint) + msg, props, err := rep.RecvWithMetadata(0, "Peer-Address") + if err != nil { + t.Fatal("rep.RecvWithMetadata:", err) + return + } + if msg != tmp { + t.Errorf("rep.RecvWithMetadata: expected %q, got %q", tmp, msg) + } + + if p := props["Peer-Address"]; p != peer { + t.Errorf("rep.RecvWithMetadata: expected Peer-Address == %q, got %q", peer, p) + } + + err = rep.Close() + rep = nil + if err != nil { + t.Fatal("rep.Close:", err) + } + + err = req.Close() + req = nil + if err != nil { + t.Fatal("req.Close:", err) + } +} diff --git a/vendor/github.com/pebbe/zmq4/zmq4_test.go b/vendor/github.com/pebbe/zmq4/zmq4_test.go new file mode 100644 index 0000000..2058d4a --- /dev/null +++ b/vendor/github.com/pebbe/zmq4/zmq4_test.go @@ -0,0 +1,2044 @@ +package zmq4_test + +import ( + zmq "github.com/pebbe/zmq4" + + "errors" + "fmt" + "runtime" + "strconv" + "testing" + "time" +) + +var ( + err32 = errors.New("rc != 32") +) + +func TestVersion(t *testing.T) { + major, _, _ := zmq.Version() + if major != 4 { + t.Errorf("Expected major version 4, got %d", major) + } +} + +func TestMultipleContexts(t *testing.T) { + + chQuit := make(chan interface{}) + chErr := make(chan error, 2) + needQuit := false + var sock1, sock2, serv1, serv2 *zmq.Socket + var serv_ctx1, serv_ctx2, ctx1, ctx2 *zmq.Context + var err error + + defer func() { + if needQuit { + chQuit <- true + chQuit <- true + <-chErr + <-chErr + } + for _, s := range []*zmq.Socket{sock1, sock2, serv1, serv2} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + for _, c := range []*zmq.Context{serv_ctx1, serv_ctx2, ctx1, ctx2} { + if c != nil { + c.Term() + } + } + }() + + addr1 := "tcp://127.0.0.1:9997" + addr2 := "tcp://127.0.0.1:9998" + + serv_ctx1, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + serv1, err = serv_ctx1.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = serv1.Bind(addr1) + if err != nil { + t.Fatal("Bind:", err) + } + + serv_ctx2, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + serv2, err = serv_ctx2.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = serv2.Bind(addr2) + if err != nil { + t.Fatal("Bind:", err) + } + + new_service := func(sock *zmq.Socket, addr string) { + socket_handler := func(state zmq.State) error { + msg, err := sock.RecvMessage(0) + if err != nil { + return err + } + _, err = sock.SendMessage(addr, msg) + return err + } + quit_handler := func(interface{}) error { + return errors.New("quit") + } + + reactor := zmq.NewReactor() + reactor.AddSocket(sock, zmq.POLLIN, socket_handler) + reactor.AddChannel(chQuit, 1, quit_handler) + err = reactor.Run(100 * time.Millisecond) + chErr <- err + } + + go new_service(serv1, addr1) + go new_service(serv2, addr2) + needQuit = true + + time.Sleep(time.Second) + + // default context + + sock1, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + sock2, err = zmq.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = sock1.Connect(addr1) + if err != nil { + t.Fatal("sock1.Connect:", err) + } + err = sock2.Connect(addr2) + if err != nil { + t.Fatal("sock2.Connect:", err) + } + _, err = sock1.SendMessage(addr1) + if err != nil { + t.Fatal("sock1.SendMessage:", err) + } + _, err = sock2.SendMessage(addr2) + if err != nil { + t.Fatal("sock2.SendMessage:", err) + } + msg, err := sock1.RecvMessage(0) + expected := []string{addr1, addr1} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock1.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + msg, err = sock2.RecvMessage(0) + expected = []string{addr2, addr2} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock2.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + err = sock1.Close() + sock1 = nil + if err != nil { + t.Fatal("sock1.Close:", err) + } + err = sock2.Close() + sock2 = nil + if err != nil { + t.Fatal("sock2.Close:", err) + } + + // non-default contexts + + ctx1, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + ctx2, err = zmq.NewContext() + if err != nil { + t.Fatal("NewContext:", err) + } + sock1, err = ctx1.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("ctx1.NewSocket:", err) + } + sock2, err = ctx2.NewSocket(zmq.REQ) + if err != nil { + t.Fatal("ctx2.NewSocket:", err) + } + err = sock1.Connect(addr1) + if err != nil { + t.Fatal("sock1.Connect:", err) + } + err = sock2.Connect(addr2) + if err != nil { + t.Fatal("sock2.Connect:", err) + } + _, err = sock1.SendMessage(addr1) + if err != nil { + t.Fatal("sock1.SendMessage:", err) + } + _, err = sock2.SendMessage(addr2) + if err != nil { + t.Fatal("sock2.SendMessage:", err) + } + msg, err = sock1.RecvMessage(0) + expected = []string{addr1, addr1} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock1.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + msg, err = sock2.RecvMessage(0) + expected = []string{addr2, addr2} + if err != nil || !arrayEqual(msg, expected) { + t.Errorf("sock2.RecvMessage: expected %v %v, got %v %v", nil, expected, err, msg) + } + err = sock1.Close() + sock1 = nil + if err != nil { + t.Fatal("sock1.Close:", err) + } + err = sock2.Close() + sock2 = nil + if err != nil { + t.Fatal("sock2.Close:", err) + } + + err = ctx1.Term() + ctx1 = nil + if err != nil { + t.Fatal("ctx1.Term", nil) + } + err = ctx2.Term() + ctx1 = nil + if err != nil { + t.Fatal("ctx2.Term", nil) + } + + needQuit = false + for i := 0; i < 2; i++ { + // close(chQuit) doesn't work because the reactor removes closed channels, instead of acting on them + chQuit <- true + err = <-chErr + if err.Error() != "quit" { + t.Errorf("Expected error value quit, got %v", err) + } + } +} + +func TestAbstractIpc(t *testing.T) { + + var sb, sc *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + addr := "ipc://@/tmp/tester" + + // This is Linux only + if runtime.GOOS != "linux" { + t.Skip("Only on Linux") + } + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind(addr) + if err != nil { + t.Fatal("sb.Bind:", err) + } + + endpoint, err := sb.GetLastEndpoint() + expected := "ipc://@/tmp/tester" + if endpoint != expected || err != nil { + t.Fatalf("sb.GetLastEndpoint: expected 'nil' %q, got '%v' %q", expected, err, endpoint) + return + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = sc.Connect(addr) + if err != nil { + t.Fatal("sc.Bind:", err) + } + + resp, err := bounce(sb, sc) + if err != nil { + t.Error(resp, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Fatal("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Fatal("sb.Close:", err) + } +} + +func TestConflate(t *testing.T) { + + var s_in, s_out *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{s_in, s_out} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + bind_to := "tcp://127.0.0.1:5555" + + err := zmq.SetIoThreads(1) + if err != nil { + t.Fatal("SetIoThreads(1):", err) + } + + s_in, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Fatal("NewSocket 1:", err) + } + + err = s_in.SetConflate(true) + if err != nil { + t.Fatal("SetConflate(true):", err) + } + + err = s_in.Bind(bind_to) + if err != nil { + t.Fatal("s_in.Bind:", err) + } + + s_out, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Fatal("NewSocket 2:", err) + } + + err = s_out.Connect(bind_to) + if err != nil { + t.Fatal("s_out.Connect:", err) + } + + message_count := 20 + + for j := 0; j < message_count; j++ { + _, err = s_out.Send(fmt.Sprint(j), 0) + if err != nil { + t.Fatalf("s_out.Send %d: %v", j, err) + } + } + + time.Sleep(time.Second) + + payload_recved, err := s_in.Recv(0) + if err != nil { + t.Error("s_in.Recv:", err) + } else { + i, err := strconv.Atoi(payload_recved) + if err != nil { + t.Error("strconv.Atoi:", err) + } + if i != message_count-1 { + t.Error("payload_recved != message_count - 1") + } + } + + err = s_in.Close() + s_in = nil + if err != nil { + t.Error("s_in.Close:", err) + } + + err = s_out.Close() + s_out = nil + if err != nil { + t.Error("s_out.Close:", err) + } +} + +func TestConnectResolve(t *testing.T) { + + sock, err := zmq.NewSocket(zmq.PUB) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + if sock != nil { + sock.SetLinger(0) + sock.Close() + } + }() + + err = sock.Connect("tcp://localhost:1234") + if err != nil { + t.Error("sock.Connect:", err) + } + + fails := []string{ + "tcp://localhost:invalid", + "tcp://in val id:1234", + "invalid://localhost:1234", + } + for _, fail := range fails { + if err = sock.Connect(fail); err == nil { + t.Errorf("Connect %s, expected fail, got success", fail) + } + } + + err = sock.Close() + sock = nil + if err != nil { + t.Error("sock.Close:", err) + } +} + +func TestCtxOptions(t *testing.T) { + + type Result struct { + value interface{} + err error + } + + i, err := zmq.GetMaxSockets() + if err != nil { + t.Error("GetMaxSockets:", err) + } + if i != zmq.MaxSocketsDflt { + t.Errorf("MaxSockets != MaxSocketsDflt: %d != %d", i, zmq.MaxSocketsDflt) + } + + i, err = zmq.GetIoThreads() + if err != nil { + t.Error("GetIoThreads:", err) + } + if i != zmq.IoThreadsDflt { + t.Errorf("IoThreads != IoThreadsDflt: %d != %d", i, zmq.IoThreadsDflt) + } + + b, err := zmq.GetIpv6() + if b != false || err != nil { + t.Errorf("GetIpv6 1: expected false , got %v %v", b, err) + } + + zmq.SetIpv6(true) + defer zmq.SetIpv6(false) + b, err = zmq.GetIpv6() + if b != true || err != nil { + t.Errorf("GetIpv6 2: expected true , got %v %v", b, err) + } + + router, _ := zmq.NewSocket(zmq.ROUTER) + b, err = router.GetIpv6() + if b != true || err != nil { + t.Errorf("GetIpv6 3: expected true , got %v %v", b, err) + } + router.Close() +} + +func TestDisconnectInproc(t *testing.T) { + + var pubSocket, subSocket *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{pubSocket, subSocket} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + publicationsReceived := 0 + isSubscribed := false + + pubSocket, err := zmq.NewSocket(zmq.XPUB) + if err != nil { + t.Fatal("NewSocket XPUB:", err) + } + subSocket, err = zmq.NewSocket(zmq.SUB) + if err != nil { + t.Fatal("NewSocket SUB:", err) + } + err = subSocket.SetSubscribe("foo") + if err != nil { + t.Fatal("subSocket.SetSubscribe:", err) + } + + err = pubSocket.Bind("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("pubSocket.Bind:", err) + } + + iteration := 0 + + poller := zmq.NewPoller() + poller.Add(subSocket, zmq.POLLIN) // read publications + poller.Add(pubSocket, zmq.POLLIN) // read subscriptions + for { + sockets, err := poller.Poll(100 * time.Millisecond) + if err != nil { + t.Error("Poll:", err) + break // Interrupted + } + + for _, socket := range sockets { + if socket.Socket == pubSocket { + for { + buffer, err := pubSocket.Recv(0) + if err != nil { + t.Fatal("pubSocket.Recv", err) + } + exp := "\x01foo" + if isSubscribed { + exp = "\x00foo" + } + if buffer != exp { + t.Errorf("pubSocket.Recv: expected %q, got %q", exp, buffer) + } + + if buffer[0] == 0 { + if isSubscribed != true { + t.Errorf("Poller: expected subscribed") + } + isSubscribed = false + } else { + if isSubscribed != false { + t.Errorf("Poller: expected not subscribed") + } + isSubscribed = true + } + + more, err := pubSocket.GetRcvmore() + if err != nil { + t.Fatal("pubSocket.GetRcvmore:", err) + } + if !more { + break // Last message part + } + } + break + } + } + + for _, socket := range sockets { + if socket.Socket == subSocket { + for _, exp := range []string{"foo", "this is foo!", "", ""} { + msg, err := subSocket.Recv(0) + if err != nil { + t.Fatal("subSocket.Recv:", err) + } + if msg != exp { + t.Errorf("subSocket.Recv: expected %q, got %q", exp, msg) + } + more, err := subSocket.GetRcvmore() + if err != nil { + t.Fatal("subSocket.GetRcvmore:", err) + } + if !more { + publicationsReceived++ + break // Last message part + } + + } + break + } + } + + if iteration == 1 { + err := subSocket.Connect("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("subSocket.Connect", err) + } + } + if iteration == 4 { + err := subSocket.Disconnect("inproc://someInProcDescriptor") + if err != nil { + t.Fatal("subSocket.Disconnect", err) + } + } + if iteration > 4 && len(sockets) == 0 { + break + } + + _, err = pubSocket.Send("foo", zmq.SNDMORE) + if err != nil { + t.Fatal("pubSocket.Send 1", err) + } + _, err = pubSocket.Send("this is foo!", 0) + if err != nil { + t.Fatal("pubSocket.Send 2", err) + } + + iteration++ + + } + + if publicationsReceived != 3 { + t.Error("publicationsReceived != 3 ") + } + if isSubscribed { + t.Error("isSubscribed") + } + + err = pubSocket.Close() + pubSocket = nil + if err != nil { + t.Error("pubSocket.Close:", err) + } + err = subSocket.Close() + subSocket = nil + if err != nil { + t.Error("subSocket.Close:", err) + } +} + +func TestFork(t *testing.T) { + + address := "tcp://127.0.0.1:6571" + NUM_MESSAGES := 5 + + // Create and bind pull socket to receive messages + pull, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Fatal("NewSocket:", err) + } + defer func() { + if pull != nil { + pull.SetLinger(0) + pull.Close() + } + }() + err = pull.Bind(address) + if err != nil { + t.Fatal("pull.Bind:", err) + } + + ready := make(chan bool) + + go func() { + defer func() { + close(ready) + }() + + // Create new socket, connect and send some messages + + push, err := zmq.NewSocket(zmq.PUSH) + //err = fmt.Errorf("DUMMY ERROR") + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := push.Close() + if err != nil { + t.Error("push.Close:", err) + } + }() + + err = push.Connect(address) + if err != nil { + t.Error("push.Connect:", err) + return + } + + for count := 0; count < NUM_MESSAGES; count++ { + ready <- true + _, err = push.Send("Hello", 0) + if err != nil { + t.Error("push.Send:", err) + return + } + } + + }() + + for { + if r := <-ready; !r { + break + } + msg, err := pull.Recv(0) + if err != nil { + t.Error("pull.Recv:", err) + } + if msg != "Hello" { + t.Errorf("pull.Recv: expected \"Hello\", got %q", msg) + } + } + + err = pull.Close() + pull = nil + if err != nil { + t.Error("pull.Close", err) + } + + <-ready // false +} + +func TestHwm(t *testing.T) { + + MAX_SENDS := 10000 + BIND_FIRST := 1 + CONNECT_FIRST := 2 + + test_defaults := func() (result int) { + + result = -1 + + // Set up bind socket + bind_socket, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Set up connect socket + connect_socket, err := zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error("connect_socket.Close:", err) + } + }() + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("test_defaults: send_count == recv_count") + } + + return send_count + } + + count_msg := func(send_hwm, recv_hwm, testType int) (result int) { + + result = -1 + + var bind_socket, connect_socket *zmq.Socket + var err error + + if testType == BIND_FIRST { + // Set up bind socket + bind_socket, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Set up connect socket + connect_socket, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error(err) + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + } else { + // Set up connect socket + connect_socket, err = zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := connect_socket.Close() + if err != nil { + t.Error("connect_socket.Close:", err) + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Set up bind socket + bind_socket, err = zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("count_msg: send_count != recv_count") + } + + // Now it should be possible to send one more. + _, err = connect_socket.Send("", 0) + if err != nil { + t.Error("connect_socket.Send:", err) + return + } + + // Consume the remaining message. + _, err = bind_socket.Recv(0) + if err != nil { + t.Error("bind_socket.Recv:", err) + } + + return send_count + } + + test_inproc_bind_first := func(send_hwm, recv_hwm int) int { + return count_msg(send_hwm, recv_hwm, BIND_FIRST) + } + + test_inproc_connect_first := func(send_hwm, recv_hwm int) int { + return count_msg(send_hwm, recv_hwm, CONNECT_FIRST) + } + + test_inproc_connect_and_close_first := func(send_hwm, recv_hwm int) (result int) { + + result = -1 + + // Set up connect socket + connect_socket, err := zmq.NewSocket(zmq.PUSH) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + if connect_socket != nil { + connect_socket.Close() + } + }() + + err = connect_socket.SetSndhwm(send_hwm) + if err != nil { + t.Error("connect_socket.SetSndhwm:", err) + return + } + + err = connect_socket.Connect("inproc://a") + if err != nil { + t.Error("connect_socket.Connect:", err) + return + } + + // Send until we block + send_count := 0 + for send_count < MAX_SENDS { + _, err := connect_socket.Send("", zmq.DONTWAIT) + if err != nil { + break + } + send_count++ + } + + // Close connect + err = connect_socket.Close() + connect_socket = nil + if err != nil { + t.Error("connect_socket.Close:", err) + return + } + + // Set up bind socket + bind_socket, err := zmq.NewSocket(zmq.PULL) + if err != nil { + t.Error("NewSocket:", err) + return + } + defer func() { + err := bind_socket.Close() + if err != nil { + t.Error("bind_socket.Close:", err) + } + }() + + err = bind_socket.SetRcvhwm(recv_hwm) + if err != nil { + t.Error("bind_socket.SetRcvhwm:", err) + return + } + + err = bind_socket.Bind("inproc://a") + if err != nil { + t.Error("bind_socket.Bind:", err) + return + } + + // Now receive all sent messages + recv_count := 0 + for { + _, err := bind_socket.Recv(zmq.DONTWAIT) + if err != nil { + break + } + recv_count++ + } + if send_count != recv_count { + t.Error("test_inproc_connect_and_close_first: send_count != recv_count") + } + return send_count + } + + // Default values are 1000 on send and 1000 one receive, so 2000 total + if count := test_defaults(); count != 2000 { + t.Errorf("test_defaults: expected 2000, got %d", count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite send and receive buffer + if count := test_inproc_bind_first(0, 0); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(0, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(0, 0); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(0, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite send buffer + if count := test_inproc_bind_first(1, 0); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(1, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(1, 0); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(1, 0): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Infinite receive buffer + if count := test_inproc_bind_first(0, 1); count != MAX_SENDS { + t.Errorf("test_inproc_bind_first(0, 1): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(0, 1); count != MAX_SENDS { + t.Errorf("test_inproc_connect_first(0, 1): expected %d, got %d", MAX_SENDS, count) + } + time.Sleep(100 * time.Millisecond) + + // Send and recv buffers hwm 1, so total that can be queued is 2 + if count := test_inproc_bind_first(1, 1); count != 2 { + t.Errorf("test_inproc_bind_first(1, 1): expected 2, got %d", count) + } + time.Sleep(100 * time.Millisecond) + if count := test_inproc_connect_first(1, 1); count != 2 { + t.Errorf("test_inproc_connect_first(1, 1): expected 2, got %d", count) + } + time.Sleep(100 * time.Millisecond) + + // Send hwm of 1, send before bind so total that can be queued is 1 + if count := test_inproc_connect_and_close_first(1, 0); count != 1 { + t.Errorf("test_inproc_connect_and_close_first(1, 0): expected 1, got %d", count) + } + time.Sleep(100 * time.Millisecond) +} + +func TestPairIpc(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("ipc:///tmp/tester") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("ipc:///tmp/tester") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + msg, err := bounce(sb, sc) + if err != nil { + t.Error(msg, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestPairTcp(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("tcp://127.0.0.1:9736") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("tcp://127.0.0.1:9736") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + msg, err := bounce(sb, sc) + + if err != nil { + t.Error(msg, err) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestPoller(t *testing.T) { + + var sb, sc *zmq.Socket + + defer func() { + for _, s := range []*zmq.Socket{sb, sc} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + sb, err := zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sb.Bind("tcp://127.0.0.1:9737") + if err != nil { + t.Fatal("sb.Bind:", err) + } + + sc, err = zmq.NewSocket(zmq.PAIR) + if err != nil { + t.Fatal("NewSocket:", err) + } + + err = sc.Connect("tcp://127.0.0.1:9737") + if err != nil { + t.Fatal("sc.Connect:", err) + } + + poller := zmq.NewPoller() + idxb := poller.Add(sb, 0) + idxc := poller.Add(sc, 0) + if idxb != 0 || idxc != 1 { + t.Errorf("idxb=%d idxc=%d", idxb, idxc) + } + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 1:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 1 len = %d", len(pa)) + } else if pa[0].Events != 0 || pa[1].Events != 0 { + t.Errorf("PollAll 1 events = %v, %v", pa[0], pa[1]) + } + + poller.Update(idxb, zmq.POLLOUT) + poller.UpdateBySocket(sc, zmq.POLLIN) + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 2:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 2 len = %d", len(pa)) + } else if pa[0].Events != zmq.POLLOUT || pa[1].Events != 0 { + t.Errorf("PollAll 2 events = %v, %v", pa[0], pa[1]) + } + + poller.UpdateBySocket(sb, 0) + + content := "12345678ABCDEFGH12345678ABCDEFGH" + + // Send message from client to server + if rc, err := sb.Send(content, zmq.DONTWAIT); err != nil { + t.Error("sb.Send DONTWAIT:", err) + } else if rc != 32 { + t.Error("sb.Send DONTWAIT:", err32) + } + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 3:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 3 len = %d", len(pa)) + } else if pa[0].Events != 0 || pa[1].Events != zmq.POLLIN { + t.Errorf("PollAll 3 events = %v, %v", pa[0], pa[1]) + } + + // Receive message + if msg, err := sc.Recv(zmq.DONTWAIT); err != nil { + t.Error("sb.Recv DONTWAIT:", err) + } else if msg != content { + t.Error("sb.Recv msg != content") + } + + poller.UpdateBySocket(sb, zmq.POLLOUT) + poller.Update(idxc, zmq.POLLIN) + + if pa, err := poller.PollAll(100 * time.Millisecond); err != nil { + t.Error("PollAll 4:", err) + } else if len(pa) != 2 { + t.Errorf("PollAll 4 len = %d", len(pa)) + } else if pa[0].Events != zmq.POLLOUT || pa[1].Events != 0 { + t.Errorf("PollAll 4 events = %v, %v", pa[0], pa[1]) + } + + err = sc.Close() + sc = nil + if err != nil { + t.Error("sc.Close:", err) + } + + err = sb.Close() + sb = nil + if err != nil { + t.Error("sb.Close:", err) + } +} + +func TestSecurityCurve(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + if _, minor, _ := zmq.Version(); minor >= 1 && !zmq.HasCurve() { + t.Skip("Curve not available") + } + + // Generate new keypairs for this test + client_public, client_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + server_public, server_secret, err := zmq.NewCurveKeypair() + if err != nil { + t.Fatal("NewCurveKeypair:", err) + } + + handler, err = zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + // domain := msg[2] + // address := msg[3] + identity := msg[4] + mechanism := msg[5] + client_key := msg[6] + client_key_text := zmq.Z85encode(client_key) + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "CURVE" { + return errors.New("mechanism != CURVE") + } + if identity != "IDENT" { + return errors.New("identity != IDENT") + } + + if client_key_text == client_public { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "Invalid client public key", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + handler = nil + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // Server socket will accept connections + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = server.SetCurveServer(1) + if err != nil { + t.Fatal("server.SetCurveServer(1):", err) + } + err = server.SetCurveSecretkey(server_secret) + if err != nil { + t.Fatal("server.SetCurveSecretkey:", err) + } + err = server.SetIdentity("IDENT") + if err != nil { + t.Fatal("server.SetIdentity:", err) + } + server.Bind("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("server.Bind:", err) + } + + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + + // Check CURVE security with valid credentials + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage server key + // This will be caught by the curve_server class, not passed to ZAP + garbage_key := "0000111122223333444455556666777788889999" + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(garbage_key) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage client secret key + // This will be caught by the curve_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(garbage_key) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(client_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with a garbage client secret key + // This will be caught by the curve_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(client_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(garbage_key) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + time.Sleep(100 * time.Millisecond) + + // Check CURVE security with bogus client credentials + // This must be caught by the ZAP handler + + bogus_public, bogus_secret, _ := zmq.NewCurveKeypair() + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetCurveServerkey(server_public) + if err != nil { + t.Fatal("client.SetCurveServerkey:", err) + } + err = client.SetCurvePublickey(bogus_public) + if err != nil { + t.Fatal("client.SetCurvePublickey:", err) + } + err = client.SetCurveSecretkey(bogus_secret) + if err != nil { + t.Fatal("client.SetCurveSecretkey:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + // Shutdown + err = server.Close() + server = nil + if err != nil { + t.Error("server.Close:", err) + } +} + +func TestSecurityNull(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + handler, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + domain := msg[2] + // address := msg[3] + // identity := msg[4] + mechanism := msg[5] + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "NULL" { + return errors.New("mechanism != NULL") + } + + if domain == "TEST" { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "BAD DOMAIN", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + handler = nil + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // We bounce between a binding server and a connecting client + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + + // We first test client/server with no ZAP domain + // Libzmq does not call our ZAP handler, the connect must succeed + err = server.Bind("tcp://127.0.0.1:9683") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9683") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + server.Unbind("tcp://127.0.0.1:9683") + client.Disconnect("tcp://127.0.0.1:9683") + + // Now define a ZAP domain for the server; this enables + // authentication. We're using the wrong domain so this test + // must fail. + err = server.SetZapDomain("WRONG") + if err != nil { + t.Fatal("server.SetZapDomain:", err) + } + err = server.Bind("tcp://127.0.0.1:9687") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9687") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + server.Unbind("tcp://127.0.0.1:9687") + client.Disconnect("tcp://127.0.0.1:9687") + + // Now use the right domain, the test must pass + err = server.SetZapDomain("TEST") + if err != nil { + t.Fatal("server.SetZapDomain:", err) + } + err = server.Bind("tcp://127.0.0.1:9688") + if err != nil { + t.Fatal("server.Bind:", err) + } + err = client.Connect("tcp://127.0.0.1:9688") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err = bounce(server, client) + if err != nil { + t.Error(msg, err) + } + server.Unbind("tcp://127.0.0.1:9688") + client.Disconnect("tcp://127.0.0.1:9688") + + err = client.Close() + client = nil + if err != nil { + t.Error("client.Close:", err) + } + err = server.Close() + server = nil + if err != nil { + t.Error("server.Close:", err) + } +} + +func TestSecurityPlain(t *testing.T) { + + time.Sleep(100 * time.Millisecond) + + var handler, server, client *zmq.Socket + defer func() { + for _, s := range []*zmq.Socket{handler} { + if s != nil { + s.SetLinger(0) + s.Close() + } + } + }() + + handler, err := zmq.NewSocket(zmq.REP) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = handler.Bind("inproc://zeromq.zap.01") + if err != nil { + t.Fatal("handler.Bind:", err) + } + + doHandler := func(state zmq.State) error { + msg, err := handler.RecvMessage(0) + if err != nil { + return err // Terminating + } + version := msg[0] + sequence := msg[1] + // domain := msg[2] + // address := msg[3] + identity := msg[4] + mechanism := msg[5] + username := msg[6] + password := msg[7] + + if version != "1.0" { + return errors.New("version != 1.0") + } + if mechanism != "PLAIN" { + return errors.New("mechanism != PLAIN") + } + if identity != "IDENT" { + return errors.New("identity != IDENT") + } + + if username == "admin" && password == "password" { + handler.SendMessage(version, sequence, "200", "OK", "anonymous", "") + } else { + handler.SendMessage(version, sequence, "400", "Invalid username or password", "", "") + } + return nil + } + + doQuit := func(i interface{}) error { + err := handler.Close() + if err != nil { + t.Error("handler.Close:", err) + } + return errors.New("Quit") + } + quit := make(chan interface{}) + + reactor := zmq.NewReactor() + reactor.AddSocket(handler, zmq.POLLIN, doHandler) + reactor.AddChannel(quit, 0, doQuit) + go func() { + reactor.Run(100 * time.Millisecond) + quit <- true + }() + defer func() { + quit <- true + <-quit + close(quit) + }() + + // Server socket will accept connections + server, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket", err) + } + err = server.SetIdentity("IDENT") + if err != nil { + t.Fatal("server.SetIdentity:", err) + } + err = server.SetPlainServer(1) + if err != nil { + t.Fatal("server.SetPlainServer(1):", err) + } + err = server.Bind("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("server.Bind") + } + + // Check PLAIN security with correct username/password + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + err = client.SetPlainUsername("admin") + if err != nil { + t.Fatal("client.SetPlainUsername:", err) + } + err = client.SetPlainPassword("password") + if err != nil { + t.Fatal("client.SetPlainPassword:", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + msg, err := bounce(server, client) + if err != nil { + t.Error(msg, err) + } + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + // Check PLAIN security with badly configured client (as_server) + // This will be caught by the plain_server class, not passed to ZAP + client, err = zmq.NewSocket(zmq.DEALER) + if err != nil { + t.Fatal("NewSocket:", err) + } + client.SetPlainServer(1) + if err != nil { + t.Fatal("client.SetPlainServer(1):", err) + } + err = client.Connect("tcp://127.0.0.1:9998") + if err != nil { + t.Fatal("client.Connect:", err) + } + err = client.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("client.SetRcvtimeo:", err) + } + err = server.SetRcvtimeo(time.Second) + if err != nil { + t.Fatal("server.SetRcvtimeo:", err) + } + _, err = bounce(server, client) + if err == nil { + t.Error("Expected failure, got success") + } + client.SetLinger(0) + err = client.Close() + client = nil + if err != nil { + t.Fatal("client.Close:", err) + } + + err = server.Close() + server = nil + if err != nil { + t.Fatal("server.Close:", err) + } +} + +func bounce(server, client *zmq.Socket) (msg string, err error) { + + content := "12345678ABCDEFGH12345678abcdefgh" + + // Send message from client to server + rc, err := client.Send(content, zmq.SNDMORE|zmq.DONTWAIT) + if err != nil { + return "client.Send SNDMORE|DONTWAIT:", err + } + if rc != 32 { + return "client.Send SNDMORE|DONTWAIT:", err32 + } + + rc, err = client.Send(content, zmq.DONTWAIT) + if err != nil { + return "client.Send DONTWAIT:", err + } + if rc != 32 { + return "client.Send DONTWAIT:", err32 + } + + // Receive message at server side + msg, err = server.Recv(0) + if err != nil { + return "server.Recv 1:", err + } + + // Check that message is still the same + if msg != content { + return "server.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err := server.GetRcvmore() + if err != nil { + return "server.GetRcvmore 1:", err + } + if !rcvmore { + return "server.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore)) + } + + // Receive message at server side + msg, err = server.Recv(0) + if err != nil { + return "server.Recv 2:", err + } + + // Check that message is still the same + if msg != content { + return "server.Recv 2:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = server.GetRcvmore() + if err != nil { + return "server.GetRcvmore 2:", err + } + if rcvmore { + return "server.GetRcvmore 2:", errors.New(fmt.Sprint("rcvmore == ", rcvmore)) + } + + // The same, from server back to client + + // Send message from server to client + rc, err = server.Send(content, zmq.SNDMORE) + if err != nil { + return "server.Send SNDMORE:", err + } + if rc != 32 { + return "server.Send SNDMORE:", err32 + } + + rc, err = server.Send(content, 0) + if err != nil { + return "server.Send 0:", err + } + if rc != 32 { + return "server.Send 0:", err32 + } + + // Receive message at client side + msg, err = client.Recv(0) + if err != nil { + return "client.Recv 1:", err + } + + // Check that message is still the same + if msg != content { + return "client.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = client.GetRcvmore() + if err != nil { + return "client.GetRcvmore 1:", err + } + if !rcvmore { + return "client.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore)) + } + + // Receive message at client side + msg, err = client.Recv(0) + if err != nil { + return "client.Recv 2:", err + } + + // Check that message is still the same + if msg != content { + return "client.Recv 2:", errors.New(fmt.Sprintf("%q != %q", msg, content)) + } + + rcvmore, err = client.GetRcvmore() + if err != nil { + return "client.GetRcvmore 2:", err + } + if rcvmore { + return "client.GetRcvmore 2:", errors.New(fmt.Sprint("rcvmore == ", rcvmore)) + } + return "OK", nil +} + +func arrayEqual(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go deleted file mode 100644 index 003e99f..0000000 --- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ /dev/null @@ -1,772 +0,0 @@ -// Package difflib is a partial port of Python difflib module. -// -// It provides tools to compare sequences of strings and generate textual diffs. -// -// The following class and functions have been ported: -// -// - SequenceMatcher -// -// - unified_diff -// -// - context_diff -// -// Getting unified diffs was the main goal of the port. Keep in mind this code -// is mostly suitable to output text differences in a human friendly way, there -// are no guarantees generated diffs are consumable by patch(1). -package difflib - -import ( - "bufio" - "bytes" - "fmt" - "io" - "strings" -) - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} - -func calculateRatio(matches, length int) float64 { - if length > 0 { - return 2.0 * float64(matches) / float64(length) - } - return 1.0 -} - -type Match struct { - A int - B int - Size int -} - -type OpCode struct { - Tag byte - I1 int - I2 int - J1 int - J2 int -} - -// SequenceMatcher compares sequence of strings. The basic -// algorithm predates, and is a little fancier than, an algorithm -// published in the late 1980's by Ratcliff and Obershelp under the -// hyperbolic name "gestalt pattern matching". The basic idea is to find -// the longest contiguous matching subsequence that contains no "junk" -// elements (R-O doesn't address junk). The same idea is then applied -// recursively to the pieces of the sequences to the left and to the right -// of the matching subsequence. This does not yield minimal edit -// sequences, but does tend to yield matches that "look right" to people. -// -// SequenceMatcher tries to compute a "human-friendly diff" between two -// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the -// longest *contiguous* & junk-free matching subsequence. That's what -// catches peoples' eyes. The Windows(tm) windiff has another interesting -// notion, pairing up elements that appear uniquely in each sequence. -// That, and the method here, appear to yield more intuitive difference -// reports than does diff. This method appears to be the least vulnerable -// to synching up on blocks of "junk lines", though (like blank lines in -// ordinary text files, or maybe "

" lines in HTML files). That may be -// because this is the only method of the 3 that has a *concept* of -// "junk" . -// -// Timing: Basic R-O is cubic time worst case and quadratic time expected -// case. SequenceMatcher is quadratic time for the worst case and has -// expected-case behavior dependent in a complicated way on how many -// elements the sequences have in common; best case time is linear. -type SequenceMatcher struct { - a []string - b []string - b2j map[string][]int - IsJunk func(string) bool - autoJunk bool - bJunk map[string]struct{} - matchingBlocks []Match - fullBCount map[string]int - bPopular map[string]struct{} - opCodes []OpCode -} - -func NewMatcher(a, b []string) *SequenceMatcher { - m := SequenceMatcher{autoJunk: true} - m.SetSeqs(a, b) - return &m -} - -func NewMatcherWithJunk(a, b []string, autoJunk bool, - isJunk func(string) bool) *SequenceMatcher { - - m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} - m.SetSeqs(a, b) - return &m -} - -// Set two sequences to be compared. -func (m *SequenceMatcher) SetSeqs(a, b []string) { - m.SetSeq1(a) - m.SetSeq2(b) -} - -// Set the first sequence to be compared. The second sequence to be compared is -// not changed. -// -// SequenceMatcher computes and caches detailed information about the second -// sequence, so if you want to compare one sequence S against many sequences, -// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other -// sequences. -// -// See also SetSeqs() and SetSeq2(). -func (m *SequenceMatcher) SetSeq1(a []string) { - if &a == &m.a { - return - } - m.a = a - m.matchingBlocks = nil - m.opCodes = nil -} - -// Set the second sequence to be compared. The first sequence to be compared is -// not changed. -func (m *SequenceMatcher) SetSeq2(b []string) { - if &b == &m.b { - return - } - m.b = b - m.matchingBlocks = nil - m.opCodes = nil - m.fullBCount = nil - m.chainB() -} - -func (m *SequenceMatcher) chainB() { - // Populate line -> index mapping - b2j := map[string][]int{} - for i, s := range m.b { - indices := b2j[s] - indices = append(indices, i) - b2j[s] = indices - } - - // Purge junk elements - m.bJunk = map[string]struct{}{} - if m.IsJunk != nil { - junk := m.bJunk - for s, _ := range b2j { - if m.IsJunk(s) { - junk[s] = struct{}{} - } - } - for s, _ := range junk { - delete(b2j, s) - } - } - - // Purge remaining popular elements - popular := map[string]struct{}{} - n := len(m.b) - if m.autoJunk && n >= 200 { - ntest := n/100 + 1 - for s, indices := range b2j { - if len(indices) > ntest { - popular[s] = struct{}{} - } - } - for s, _ := range popular { - delete(b2j, s) - } - } - m.bPopular = popular - m.b2j = b2j -} - -func (m *SequenceMatcher) isBJunk(s string) bool { - _, ok := m.bJunk[s] - return ok -} - -// Find longest matching block in a[alo:ahi] and b[blo:bhi]. -// -// If IsJunk is not defined: -// -// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where -// alo <= i <= i+k <= ahi -// blo <= j <= j+k <= bhi -// and for all (i',j',k') meeting those conditions, -// k >= k' -// i <= i' -// and if i == i', j <= j' -// -// In other words, of all maximal matching blocks, return one that -// starts earliest in a, and of all those maximal matching blocks that -// start earliest in a, return the one that starts earliest in b. -// -// If IsJunk is defined, first the longest matching block is -// determined as above, but with the additional restriction that no -// junk element appears in the block. Then that block is extended as -// far as possible by matching (only) junk elements on both sides. So -// the resulting block never matches on junk except as identical junk -// happens to be adjacent to an "interesting" match. -// -// If no blocks match, return (alo, blo, 0). -func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { - // CAUTION: stripping common prefix or suffix would be incorrect. - // E.g., - // ab - // acab - // Longest matching block is "ab", but if common prefix is - // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so - // strip, so ends up claiming that ab is changed to acab by - // inserting "ca" in the middle. That's minimal but unintuitive: - // "it's obvious" that someone inserted "ac" at the front. - // Windiff ends up at the same place as diff, but by pairing up - // the unique 'b's and then matching the first two 'a's. - besti, bestj, bestsize := alo, blo, 0 - - // find longest junk-free match - // during an iteration of the loop, j2len[j] = length of longest - // junk-free match ending with a[i-1] and b[j] - j2len := map[int]int{} - for i := alo; i != ahi; i++ { - // look at all instances of a[i] in b; note that because - // b2j has no junk keys, the loop is skipped if a[i] is junk - newj2len := map[int]int{} - for _, j := range m.b2j[m.a[i]] { - // a[i] matches b[j] - if j < blo { - continue - } - if j >= bhi { - break - } - k := j2len[j-1] + 1 - newj2len[j] = k - if k > bestsize { - besti, bestj, bestsize = i-k+1, j-k+1, k - } - } - j2len = newj2len - } - - // Extend the best by non-junk elements on each end. In particular, - // "popular" non-junk elements aren't in b2j, which greatly speeds - // the inner loop above, but also means "the best" match so far - // doesn't contain any junk *or* popular non-junk elements. - for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - !m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - // Now that we have a wholly interesting match (albeit possibly - // empty!), we may as well suck up the matching junk on each - // side of it too. Can't think of a good reason not to, and it - // saves post-processing the (possibly considerable) expense of - // figuring out what to do with it. In the case of an empty - // interesting match, this is clearly the right thing to do, - // because no other kind of match is possible in the regions. - for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - return Match{A: besti, B: bestj, Size: bestsize} -} - -// Return list of triples describing matching subsequences. -// -// Each triple is of the form (i, j, n), and means that -// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in -// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are -// adjacent triples in the list, and the second is not the last triple in the -// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe -// adjacent equal blocks. -// -// The last triple is a dummy, (len(a), len(b), 0), and is the only -// triple with n==0. -func (m *SequenceMatcher) GetMatchingBlocks() []Match { - if m.matchingBlocks != nil { - return m.matchingBlocks - } - - var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match - matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { - match := m.findLongestMatch(alo, ahi, blo, bhi) - i, j, k := match.A, match.B, match.Size - if match.Size > 0 { - if alo < i && blo < j { - matched = matchBlocks(alo, i, blo, j, matched) - } - matched = append(matched, match) - if i+k < ahi && j+k < bhi { - matched = matchBlocks(i+k, ahi, j+k, bhi, matched) - } - } - return matched - } - matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) - - // It's possible that we have adjacent equal blocks in the - // matching_blocks list now. - nonAdjacent := []Match{} - i1, j1, k1 := 0, 0, 0 - for _, b := range matched { - // Is this block adjacent to i1, j1, k1? - i2, j2, k2 := b.A, b.B, b.Size - if i1+k1 == i2 && j1+k1 == j2 { - // Yes, so collapse them -- this just increases the length of - // the first block by the length of the second, and the first - // block so lengthened remains the block to compare against. - k1 += k2 - } else { - // Not adjacent. Remember the first block (k1==0 means it's - // the dummy we started with), and make the second block the - // new block to compare against. - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - i1, j1, k1 = i2, j2, k2 - } - } - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - - nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) - m.matchingBlocks = nonAdjacent - return m.matchingBlocks -} - -// Return list of 5-tuples describing how to turn a into b. -// -// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple -// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the -// tuple preceding it, and likewise for j1 == the previous j2. -// -// The tags are characters, with these meanings: -// -// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] -// -// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. -// -// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. -// -// 'e' (equal): a[i1:i2] == b[j1:j2] -func (m *SequenceMatcher) GetOpCodes() []OpCode { - if m.opCodes != nil { - return m.opCodes - } - i, j := 0, 0 - matching := m.GetMatchingBlocks() - opCodes := make([]OpCode, 0, len(matching)) - for _, m := range matching { - // invariant: we've pumped out correct diffs to change - // a[:i] into b[:j], and the next matching block is - // a[ai:ai+size] == b[bj:bj+size]. So we need to pump - // out a diff to change a[i:ai] into b[j:bj], pump out - // the matching block, and move (i,j) beyond the match - ai, bj, size := m.A, m.B, m.Size - tag := byte(0) - if i < ai && j < bj { - tag = 'r' - } else if i < ai { - tag = 'd' - } else if j < bj { - tag = 'i' - } - if tag > 0 { - opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) - } - i, j = ai+size, bj+size - // the list of matching blocks is terminated by a - // sentinel with size 0 - if size > 0 { - opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) - } - } - m.opCodes = opCodes - return m.opCodes -} - -// Isolate change clusters by eliminating ranges with no changes. -// -// Return a generator of groups with up to n lines of context. -// Each group is in the same format as returned by GetOpCodes(). -func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { - if n < 0 { - n = 3 - } - codes := m.GetOpCodes() - if len(codes) == 0 { - codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} - } - // Fixup leading and trailing groups if they show no changes. - if codes[0].Tag == 'e' { - c := codes[0] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} - } - if codes[len(codes)-1].Tag == 'e' { - c := codes[len(codes)-1] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} - } - nn := n + n - groups := [][]OpCode{} - group := []OpCode{} - for _, c := range codes { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - // End the current group and start a new one whenever - // there is a large range with no changes. - if c.Tag == 'e' && i2-i1 > nn { - group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), - j1, min(j2, j1+n)}) - groups = append(groups, group) - group = []OpCode{} - i1, j1 = max(i1, i2-n), max(j1, j2-n) - } - group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) - } - if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { - groups = append(groups, group) - } - return groups -} - -// Return a measure of the sequences' similarity (float in [0,1]). -// -// Where T is the total number of elements in both sequences, and -// M is the number of matches, this is 2.0*M / T. -// Note that this is 1 if the sequences are identical, and 0 if -// they have nothing in common. -// -// .Ratio() is expensive to compute if you haven't already computed -// .GetMatchingBlocks() or .GetOpCodes(), in which case you may -// want to try .QuickRatio() or .RealQuickRation() first to get an -// upper bound. -func (m *SequenceMatcher) Ratio() float64 { - matches := 0 - for _, m := range m.GetMatchingBlocks() { - matches += m.Size - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() relatively quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute. -func (m *SequenceMatcher) QuickRatio() float64 { - // viewing a and b as multisets, set matches to the cardinality - // of their intersection; this counts the number of matches - // without regard to order, so is clearly an upper bound - if m.fullBCount == nil { - m.fullBCount = map[string]int{} - for _, s := range m.b { - m.fullBCount[s] = m.fullBCount[s] + 1 - } - } - - // avail[x] is the number of times x appears in 'b' less the - // number of times we've seen it in 'a' so far ... kinda - avail := map[string]int{} - matches := 0 - for _, s := range m.a { - n, ok := avail[s] - if !ok { - n = m.fullBCount[s] - } - avail[s] = n - 1 - if n > 0 { - matches += 1 - } - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() very quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute than either .Ratio() or .QuickRatio(). -func (m *SequenceMatcher) RealQuickRatio() float64 { - la, lb := len(m.a), len(m.b) - return calculateRatio(min(la, lb), la+lb) -} - -// Convert range to the "ed" format -func formatRangeUnified(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 1 { - return fmt.Sprintf("%d", beginning) - } - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - return fmt.Sprintf("%d,%d", beginning, length) -} - -// Unified diff parameters -type UnifiedDiff struct { - A []string // First sequence lines - FromFile string // First file name - FromDate string // First file time - B []string // Second sequence lines - ToFile string // Second file name - ToDate string // Second file time - Eol string // Headers end of line, defaults to LF - Context int // Number of context lines -} - -// Compare two sequences of lines; generate the delta as a unified diff. -// -// Unified diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by 'n' which -// defaults to three. -// -// By default, the diff control lines (those with ---, +++, or @@) are -// created with a trailing newline. This is helpful so that inputs -// created from file.readlines() result in diffs that are suitable for -// file.writelines() since both the inputs and outputs have trailing -// newlines. -// -// For inputs that do not have trailing newlines, set the lineterm -// argument to "" so that the output will be uniformly newline free. -// -// The unidiff format normally has a header for filenames and modification -// times. Any or all of these may be specified using strings for -// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. -// The modification times are normally expressed in the ISO 8601 format. -func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - wf := func(format string, args ...interface{}) error { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - return err - } - ws := func(s string) error { - _, err := buf.WriteString(s) - return err - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) - if err != nil { - return err - } - err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) - if err != nil { - return err - } - } - } - first, last := g[0], g[len(g)-1] - range1 := formatRangeUnified(first.I1, last.I2) - range2 := formatRangeUnified(first.J1, last.J2) - if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { - return err - } - for _, c := range g { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - if c.Tag == 'e' { - for _, line := range diff.A[i1:i2] { - if err := ws(" " + line); err != nil { - return err - } - } - continue - } - if c.Tag == 'r' || c.Tag == 'd' { - for _, line := range diff.A[i1:i2] { - if err := ws("-" + line); err != nil { - return err - } - } - } - if c.Tag == 'r' || c.Tag == 'i' { - for _, line := range diff.B[j1:j2] { - if err := ws("+" + line); err != nil { - return err - } - } - } - } - } - return nil -} - -// Like WriteUnifiedDiff but returns the diff a string. -func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteUnifiedDiff(w, diff) - return string(w.Bytes()), err -} - -// Convert range to the "ed" format. -func formatRangeContext(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - if length <= 1 { - return fmt.Sprintf("%d", beginning) - } - return fmt.Sprintf("%d,%d", beginning, beginning+length-1) -} - -type ContextDiff UnifiedDiff - -// Compare two sequences of lines; generate the delta as a context diff. -// -// Context diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by diff.Context -// which defaults to three. -// -// By default, the diff control lines (those with *** or ---) are -// created with a trailing newline. -// -// For inputs that do not have trailing newlines, set the diff.Eol -// argument to "" so that the output will be uniformly newline free. -// -// The context diff format normally has a header for filenames and -// modification times. Any or all of these may be specified using -// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. -// The modification times are normally expressed in the ISO 8601 format. -// If not specified, the strings default to blanks. -func WriteContextDiff(writer io.Writer, diff ContextDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - var diffErr error - wf := func(format string, args ...interface{}) { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - if diffErr == nil && err != nil { - diffErr = err - } - } - ws := func(s string) { - _, err := buf.WriteString(s) - if diffErr == nil && err != nil { - diffErr = err - } - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - prefix := map[byte]string{ - 'i': "+ ", - 'd': "- ", - 'r': "! ", - 'e': " ", - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) - wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) - } - } - - first, last := g[0], g[len(g)-1] - ws("***************" + diff.Eol) - - range1 := formatRangeContext(first.I1, last.I2) - wf("*** %s ****%s", range1, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'd' { - for _, cc := range g { - if cc.Tag == 'i' { - continue - } - for _, line := range diff.A[cc.I1:cc.I2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - - range2 := formatRangeContext(first.J1, last.J2) - wf("--- %s ----%s", range2, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'i' { - for _, cc := range g { - if cc.Tag == 'd' { - continue - } - for _, line := range diff.B[cc.J1:cc.J2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - } - return diffErr -} - -// Like WriteContextDiff but returns the diff a string. -func GetContextDiffString(diff ContextDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteContextDiff(w, diff) - return string(w.Bytes()), err -} - -// Split a string on "\n" while preserving them. The output can be used -// as input for UnifiedDiff and ContextDiff structures. -func SplitLines(s string) []string { - lines := strings.SplitAfter(s, "\n") - lines[len(lines)-1] += "\n" - return lines -} diff --git a/vendor/github.com/stretchr/testify/LICENCE.txt b/vendor/github.com/stretchr/testify/LICENCE.txt deleted file mode 100644 index 473b670..0000000 --- a/vendor/github.com/stretchr/testify/LICENCE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell - -Please consider promoting this project if you find it useful. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE deleted file mode 100644 index 473b670..0000000 --- a/vendor/github.com/stretchr/testify/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell - -Please consider promoting this project if you find it useful. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go deleted file mode 100644 index e6a7960..0000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ /dev/null @@ -1,387 +0,0 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND -*/ - -package assert - -import ( - - http "net/http" - url "net/url" - time "time" -) - - -// Condition uses a Comparison to assert a complex condition. -func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { - return Condition(a.t, comp, msgAndArgs...) -} - - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'") -// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") -// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - return Contains(a.t, s, contains, msgAndArgs...) -} - - -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// a.Empty(obj) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { - return Empty(a.t, object, msgAndArgs...) -} - - -// Equal asserts that two objects are equal. -// -// a.Equal(123, 123, "123 and 123 should be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - return Equal(a.t, expected, actual, msgAndArgs...) -} - - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// if assert.Error(t, err, "An error was expected") { -// assert.Equal(t, err, expectedError) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { - return EqualError(a.t, theError, errString, msgAndArgs...) -} - - -// EqualValues asserts that two objects are equal or convertable to the same types -// and equal. -// -// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - return EqualValues(a.t, expected, actual, msgAndArgs...) -} - - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if a.Error(err, "An error was expected") { -// assert.Equal(t, err, expectedError) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { - return Error(a.t, err, msgAndArgs...) -} - - -// Exactly asserts that two objects are equal is value and type. -// -// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - return Exactly(a.t, expected, actual, msgAndArgs...) -} - - -// Fail reports a failure through -func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { - return Fail(a.t, failureMessage, msgAndArgs...) -} - - -// FailNow fails test -func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { - return FailNow(a.t, failureMessage, msgAndArgs...) -} - - -// False asserts that the specified value is false. -// -// a.False(myBool, "myBool should be false") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { - return False(a.t, value, msgAndArgs...) -} - - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { - return HTTPBodyContains(a.t, handler, method, url, values, str) -} - - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { - return HTTPBodyNotContains(a.t, handler, method, url, values, str) -} - - -// HTTPError asserts that a specified handler returns an error status code. -// -// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool { - return HTTPError(a.t, handler, method, url, values) -} - - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool { - return HTTPRedirect(a.t, handler, method, url, values) -} - - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool { - return HTTPSuccess(a.t, handler, method, url, values) -} - - -// Implements asserts that an object is implemented by the specified interface. -// -// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject") -func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - return Implements(a.t, interfaceObject, object, msgAndArgs...) -} - - -// InDelta asserts that the two numerals are within delta of each other. -// -// a.InDelta(math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - return InDelta(a.t, expected, actual, delta, msgAndArgs...) -} - - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) -} - - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) -} - - -// InEpsilonSlice is the same as InEpsilon, except it compares two slices. -func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - return InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...) -} - - -// IsType asserts that the specified objects are of the same type. -func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - return IsType(a.t, expectedType, object, msgAndArgs...) -} - - -// JSONEq asserts that two JSON strings are equivalent. -// -// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { - return JSONEq(a.t, expected, actual, msgAndArgs...) -} - - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// a.Len(mySlice, 3, "The size of slice is not 3") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { - return Len(a.t, object, length, msgAndArgs...) -} - - -// Nil asserts that the specified object is nil. -// -// a.Nil(err, "err should be nothing") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { - return Nil(a.t, object, msgAndArgs...) -} - - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoError(err) { -// assert.Equal(t, actualObj, expectedObj) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { - return NoError(a.t, err, msgAndArgs...) -} - - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") -// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") -// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - return NotContains(a.t, s, contains, msgAndArgs...) -} - - -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if a.NotEmpty(obj) { -// assert.Equal(t, "two", obj[1]) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { - return NotEmpty(a.t, object, msgAndArgs...) -} - - -// NotEqual asserts that the specified values are NOT equal. -// -// a.NotEqual(obj1, obj2, "two objects shouldn't be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - return NotEqual(a.t, expected, actual, msgAndArgs...) -} - - -// NotNil asserts that the specified object is not nil. -// -// a.NotNil(err, "err should be something") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { - return NotNil(a.t, object, msgAndArgs...) -} - - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanics(func(){ -// RemainCalm() -// }, "Calling RemainCalm() should NOT panic") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - return NotPanics(a.t, f, msgAndArgs...) -} - - -// NotRegexp asserts that a specified regexp does not match a string. -// -// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") -// a.NotRegexp("^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - return NotRegexp(a.t, rx, str, msgAndArgs...) -} - - -// NotZero asserts that i is not the zero value for its type and returns the truth. -func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { - return NotZero(a.t, i, msgAndArgs...) -} - - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panics(func(){ -// GoCrazy() -// }, "Calling GoCrazy() should panic") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - return Panics(a.t, f, msgAndArgs...) -} - - -// Regexp asserts that a specified regexp matches a string. -// -// a.Regexp(regexp.MustCompile("start"), "it's starting") -// a.Regexp("start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - return Regexp(a.t, rx, str, msgAndArgs...) -} - - -// True asserts that the specified value is true. -// -// a.True(myBool, "myBool should be true") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { - return True(a.t, value, msgAndArgs...) -} - - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) -} - - -// Zero asserts that i is the zero value for its type and returns the truth. -func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { - return Zero(a.t, i, msgAndArgs...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl deleted file mode 100644 index 99f9acf..0000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -{{.CommentWithoutT "a"}} -func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { - return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go deleted file mode 100644 index d7c16c5..0000000 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ /dev/null @@ -1,1004 +0,0 @@ -package assert - -import ( - "bufio" - "bytes" - "encoding/json" - "fmt" - "math" - "reflect" - "regexp" - "runtime" - "strings" - "time" - "unicode" - "unicode/utf8" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" -) - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Errorf(format string, args ...interface{}) -} - -// Comparison a custom function that returns true on success and false on failure -type Comparison func() (success bool) - -/* - Helper functions -*/ - -// ObjectsAreEqual determines if two objects are considered equal. -// -// This function does no assertion of any kind. -func ObjectsAreEqual(expected, actual interface{}) bool { - - if expected == nil || actual == nil { - return expected == actual - } - - return reflect.DeepEqual(expected, actual) - -} - -// ObjectsAreEqualValues gets whether two objects are equal, or if their -// values are equal. -func ObjectsAreEqualValues(expected, actual interface{}) bool { - if ObjectsAreEqual(expected, actual) { - return true - } - - actualType := reflect.TypeOf(actual) - if actualType == nil { - return false - } - expectedValue := reflect.ValueOf(expected) - if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { - // Attempt comparison after type conversion - return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) - } - - return false -} - -/* CallerInfo is necessary because the assert functions use the testing object -internally, causing it to print the file:line of the assert method, rather than where -the problem actually occured in calling code.*/ - -// CallerInfo returns an array of strings containing the file and line number -// of each stack frame leading from the current test to the assert call that -// failed. -func CallerInfo() []string { - - pc := uintptr(0) - file := "" - line := 0 - ok := false - name := "" - - callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - return nil - } - - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } - - parts := strings.Split(file, "/") - dir := parts[len(parts)-2] - file = parts[len(parts)-1] - if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) - } - - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break - } - } - - return callers -} - -// Stolen from the `go test` tool. -// isTest tells whether name looks like a test (or benchmark, according to prefix). -// It is a Test (say) if there is a character after Test that is not a lower-case letter. -// We don't want TesticularCancer. -func isTest(name, prefix string) bool { - if !strings.HasPrefix(name, prefix) { - return false - } - if len(name) == len(prefix) { // "Test" is ok - return true - } - rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) - return !unicode.IsLower(rune) -} - -// getWhitespaceString returns a string that is long enough to overwrite the default -// output from the go testing framework. -func getWhitespaceString() string { - - _, file, line, ok := runtime.Caller(1) - if !ok { - return "" - } - parts := strings.Split(file, "/") - file = parts[len(parts)-1] - - return strings.Repeat(" ", len(fmt.Sprintf("%s:%d: ", file, line))) - -} - -func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { - if len(msgAndArgs) == 0 || msgAndArgs == nil { - return "" - } - if len(msgAndArgs) == 1 { - return msgAndArgs[0].(string) - } - if len(msgAndArgs) > 1 { - return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) - } - return "" -} - -// Indents all lines of the message by appending a number of tabs to each line, in an output format compatible with Go's -// test printing (see inner comment for specifics) -func indentMessageLines(message string, tabs int) string { - outBuf := new(bytes.Buffer) - - for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { - if i != 0 { - outBuf.WriteRune('\n') - } - for ii := 0; ii < tabs; ii++ { - outBuf.WriteRune('\t') - // Bizarrely, all lines except the first need one fewer tabs prepended, so deliberately advance the counter - // by 1 prematurely. - if ii == 0 && i > 0 { - ii++ - } - } - outBuf.WriteString(scanner.Text()) - } - - return outBuf.String() -} - -type failNower interface { - FailNow() -} - -// FailNow fails test -func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - Fail(t, failureMessage, msgAndArgs...) - - // We cannot extend TestingT with FailNow() and - // maintain backwards compatibility, so we fallback - // to panicking when FailNow is not available in - // TestingT. - // See issue #263 - - if t, ok := t.(failNower); ok { - t.FailNow() - } else { - panic("test failed and t is missing `FailNow()`") - } - return false -} - -// Fail reports a failure through -func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - - message := messageFromMsgAndArgs(msgAndArgs...) - - errorTrace := strings.Join(CallerInfo(), "\n\r\t\t\t") - if len(message) > 0 { - t.Errorf("\r%s\r\tError Trace:\t%s\n"+ - "\r\tError:%s\n"+ - "\r\tMessages:\t%s\n\r", - getWhitespaceString(), - errorTrace, - indentMessageLines(failureMessage, 2), - message) - } else { - t.Errorf("\r%s\r\tError Trace:\t%s\n"+ - "\r\tError:%s\n\r", - getWhitespaceString(), - errorTrace, - indentMessageLines(failureMessage, 2)) - } - - return false -} - -// Implements asserts that an object is implemented by the specified interface. -// -// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject") -func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - - interfaceType := reflect.TypeOf(interfaceObject).Elem() - - if !reflect.TypeOf(object).Implements(interfaceType) { - return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) - } - - return true - -} - -// IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) - } - - return true -} - -// Equal asserts that two objects are equal. -// -// assert.Equal(t, 123, 123, "123 and 123 should be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - - if !ObjectsAreEqual(expected, actual) { - diff := diff(expected, actual) - return Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ - " != %#v (actual)%s", expected, actual, diff), msgAndArgs...) - } - - return true - -} - -// EqualValues asserts that two objects are equal or convertable to the same types -// and equal. -// -// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - - if !ObjectsAreEqualValues(expected, actual) { - return Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ - " != %#v (actual)", expected, actual), msgAndArgs...) - } - - return true - -} - -// Exactly asserts that two objects are equal is value and type. -// -// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - - aType := reflect.TypeOf(expected) - bType := reflect.TypeOf(actual) - - if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\r\t%v != %v", aType, bType), msgAndArgs...) - } - - return Equal(t, expected, actual, msgAndArgs...) - -} - -// NotNil asserts that the specified object is not nil. -// -// assert.NotNil(t, err, "err should be something") -// -// Returns whether the assertion was successful (true) or not (false). -func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if !isNil(object) { - return true - } - return Fail(t, "Expected value not to be nil.", msgAndArgs...) -} - -// isNil checks if a specified object is nil or not, without Failing. -func isNil(object interface{}) bool { - if object == nil { - return true - } - - value := reflect.ValueOf(object) - kind := value.Kind() - if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() { - return true - } - - return false -} - -// Nil asserts that the specified object is nil. -// -// assert.Nil(t, err, "err should be nothing") -// -// Returns whether the assertion was successful (true) or not (false). -func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if isNil(object) { - return true - } - return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) -} - -var numericZeros = []interface{}{ - int(0), - int8(0), - int16(0), - int32(0), - int64(0), - uint(0), - uint8(0), - uint16(0), - uint32(0), - uint64(0), - float32(0), - float64(0), -} - -// isEmpty gets whether the specified object is considered empty or not. -func isEmpty(object interface{}) bool { - - if object == nil { - return true - } else if object == "" { - return true - } else if object == false { - return true - } - - for _, v := range numericZeros { - if object == v { - return true - } - } - - objValue := reflect.ValueOf(object) - - switch objValue.Kind() { - case reflect.Map: - fallthrough - case reflect.Slice, reflect.Chan: - { - return (objValue.Len() == 0) - } - case reflect.Struct: - switch object.(type) { - case time.Time: - return object.(time.Time).IsZero() - } - case reflect.Ptr: - { - if objValue.IsNil() { - return true - } - switch object.(type) { - case *time.Time: - return object.(*time.Time).IsZero() - default: - return false - } - } - } - return false -} - -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// assert.Empty(t, obj) -// -// Returns whether the assertion was successful (true) or not (false). -func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - - pass := isEmpty(object) - if !pass { - Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) - } - - return pass - -} - -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if assert.NotEmpty(t, obj) { -// assert.Equal(t, "two", obj[1]) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - - pass := !isEmpty(object) - if !pass { - Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) - } - - return pass - -} - -// getLen try to get length of object. -// return (false, 0) if impossible. -func getLen(x interface{}) (ok bool, length int) { - v := reflect.ValueOf(x) - defer func() { - if e := recover(); e != nil { - ok = false - } - }() - return true, v.Len() -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// assert.Len(t, mySlice, 3, "The size of slice is not 3") -// -// Returns whether the assertion was successful (true) or not (false). -func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { - ok, l := getLen(object) - if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) - } - - if l != length { - return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) - } - return true -} - -// True asserts that the specified value is true. -// -// assert.True(t, myBool, "myBool should be true") -// -// Returns whether the assertion was successful (true) or not (false). -func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { - - if value != true { - return Fail(t, "Should be true", msgAndArgs...) - } - - return true - -} - -// False asserts that the specified value is false. -// -// assert.False(t, myBool, "myBool should be false") -// -// Returns whether the assertion was successful (true) or not (false). -func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { - - if value != false { - return Fail(t, "Should be false", msgAndArgs...) - } - - return true - -} - -// NotEqual asserts that the specified values are NOT equal. -// -// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal") -// -// Returns whether the assertion was successful (true) or not (false). -func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - - if ObjectsAreEqual(expected, actual) { - return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) - } - - return true - -} - -// containsElement try loop over the list check if the list includes the element. -// return (false, false) if impossible. -// return (true, false) if element was not found. -// return (true, true) if element was found. -func includeElement(list interface{}, element interface{}) (ok, found bool) { - - listValue := reflect.ValueOf(list) - elementValue := reflect.ValueOf(element) - defer func() { - if e := recover(); e != nil { - ok = false - found = false - } - }() - - if reflect.TypeOf(list).Kind() == reflect.String { - return true, strings.Contains(listValue.String(), elementValue.String()) - } - - if reflect.TypeOf(list).Kind() == reflect.Map { - mapKeys := listValue.MapKeys() - for i := 0; i < len(mapKeys); i++ { - if ObjectsAreEqual(mapKeys[i].Interface(), element) { - return true, true - } - } - return true, false - } - - for i := 0; i < listValue.Len(); i++ { - if ObjectsAreEqual(listValue.Index(i).Interface(), element) { - return true, true - } - } - return true, false - -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'") -// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") -// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") -// -// Returns whether the assertion was successful (true) or not (false). -func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - - ok, found := includeElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) - } - if !found { - return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", s, contains), msgAndArgs...) - } - - return true - -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") -// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") -// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") -// -// Returns whether the assertion was successful (true) or not (false). -func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - - ok, found := includeElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) - } - if found { - return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...) - } - - return true - -} - -// Condition uses a Comparison to assert a complex condition. -func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { - result := comp() - if !result { - Fail(t, "Condition failed!", msgAndArgs...) - } - return result -} - -// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics -// methods, and represents a simple func that takes no arguments, and returns nothing. -type PanicTestFunc func() - -// didPanic returns true if the function passed to it panics. Otherwise, it returns false. -func didPanic(f PanicTestFunc) (bool, interface{}) { - - didPanic := false - var message interface{} - func() { - - defer func() { - if message = recover(); message != nil { - didPanic = true - } - }() - - // call the target function - f() - - }() - - return didPanic, message - -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// assert.Panics(t, func(){ -// GoCrazy() -// }, "Calling GoCrazy() should panic") -// -// Returns whether the assertion was successful (true) or not (false). -func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - - if funcDidPanic, panicValue := didPanic(f); !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) - } - - return true -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// assert.NotPanics(t, func(){ -// RemainCalm() -// }, "Calling RemainCalm() should NOT panic") -// -// Returns whether the assertion was successful (true) or not (false). -func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - - if funcDidPanic, panicValue := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) - } - - return true -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") -// -// Returns whether the assertion was successful (true) or not (false). -func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - - dt := expected.Sub(actual) - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -func toFloat(x interface{}) (float64, bool) { - var xf float64 - xok := true - - switch xn := x.(type) { - case uint8: - xf = float64(xn) - case uint16: - xf = float64(xn) - case uint32: - xf = float64(xn) - case uint64: - xf = float64(xn) - case int: - xf = float64(xn) - case int8: - xf = float64(xn) - case int16: - xf = float64(xn) - case int32: - xf = float64(xn) - case int64: - xf = float64(xn) - case float32: - xf = float64(xn) - case float64: - xf = float64(xn) - default: - xok = false - } - - return xf, xok -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) -// -// Returns whether the assertion was successful (true) or not (false). -func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - - af, aok := toFloat(expected) - bf, bok := toFloat(actual) - - if !aok || !bok { - return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...) - } - - if math.IsNaN(af) { - return Fail(t, fmt.Sprintf("Actual must not be NaN"), msgAndArgs...) - } - - if math.IsNaN(bf) { - return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) - } - - dt := af - bf - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { - return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) - } - - actualSlice := reflect.ValueOf(actual) - expectedSlice := reflect.ValueOf(expected) - - for i := 0; i < actualSlice.Len(); i++ { - result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta) - if !result { - return result - } - } - - return true -} - -func calcRelativeError(expected, actual interface{}) (float64, error) { - af, aok := toFloat(expected) - if !aok { - return 0, fmt.Errorf("expected value %q cannot be converted to float", expected) - } - if af == 0 { - return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") - } - bf, bok := toFloat(actual) - if !bok { - return 0, fmt.Errorf("expected value %q cannot be converted to float", actual) - } - - return math.Abs(af-bf) / math.Abs(af), nil -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -// -// Returns whether the assertion was successful (true) or not (false). -func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - actualEpsilon, err := calcRelativeError(expected, actual) - if err != nil { - return Fail(t, err.Error(), msgAndArgs...) - } - if actualEpsilon > epsilon { - return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ - " < %#v (actual)", actualEpsilon, epsilon), msgAndArgs...) - } - - return true -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { - return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) - } - - actualSlice := reflect.ValueOf(actual) - expectedSlice := reflect.ValueOf(expected) - - for i := 0; i < actualSlice.Len(); i++ { - result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) - if !result { - return result - } - } - - return true -} - -/* - Errors -*/ - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if assert.NoError(t, err) { -// assert.Equal(t, actualObj, expectedObj) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { - if isNil(err) { - return true - } - - return Fail(t, fmt.Sprintf("Received unexpected error %q", err), msgAndArgs...) -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if assert.Error(t, err, "An error was expected") { -// assert.Equal(t, err, expectedError) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { - - message := messageFromMsgAndArgs(msgAndArgs...) - return NotNil(t, err, "An error is expected but got nil. %s", message) - -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// if assert.Error(t, err, "An error was expected") { -// assert.Equal(t, err, expectedError) -// } -// -// Returns whether the assertion was successful (true) or not (false). -func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { - - message := messageFromMsgAndArgs(msgAndArgs...) - if !NotNil(t, theError, "An error is expected but got nil. %s", message) { - return false - } - s := "An error with value \"%s\" is expected but got \"%s\". %s" - return Equal(t, errString, theError.Error(), - s, errString, theError.Error(), message) -} - -// matchRegexp return true if a specified regexp matches a string. -func matchRegexp(rx interface{}, str interface{}) bool { - - var r *regexp.Regexp - if rr, ok := rx.(*regexp.Regexp); ok { - r = rr - } else { - r = regexp.MustCompile(fmt.Sprint(rx)) - } - - return (r.FindStringIndex(fmt.Sprint(str)) != nil) - -} - -// Regexp asserts that a specified regexp matches a string. -// -// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") -// assert.Regexp(t, "start...$", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). -func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - - match := matchRegexp(rx, str) - - if !match { - Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) - } - - return match -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") -// assert.NotRegexp(t, "^start", "it's not starting") -// -// Returns whether the assertion was successful (true) or not (false). -func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - match := matchRegexp(rx, str) - - if match { - Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) - } - - return !match - -} - -// Zero asserts that i is the zero value for its type and returns the truth. -func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// NotZero asserts that i is not the zero value for its type and returns the truth. -func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -// -// Returns whether the assertion was successful (true) or not (false). -func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { - var expectedJSONAsInterface, actualJSONAsInterface interface{} - - if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) - } - - if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) - } - - return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) -} - -func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { - t := reflect.TypeOf(v) - k := t.Kind() - - if k == reflect.Ptr { - t = t.Elem() - k = t.Kind() - } - return t, k -} - -// diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice or array. Otherwise it returns an empty string. -func diff(expected interface{}, actual interface{}) string { - if expected == nil || actual == nil { - return "" - } - - et, ek := typeAndKind(expected) - at, _ := typeAndKind(actual) - - if et != at { - return "" - } - - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { - return "" - } - - spew.Config.SortKeys = true - e := spew.Sdump(expected) - a := spew.Sdump(actual) - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return "\n\nDiff:\n" + diff -} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go deleted file mode 100644 index c9dccc4..0000000 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ /dev/null @@ -1,45 +0,0 @@ -// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. -// -// Example Usage -// -// The following is a complete example using assert in a standard test function: -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(t, a, b, "The two words should be the same.") -// -// } -// -// if you assert many times, use the format below: -// -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// assert := assert.New(t) -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(a, b, "The two words should be the same.") -// } -// -// Assertions -// -// Assertions allow you to easily write test code, and are global funcs in the `assert` package. -// All assertion functions take, as the first argument, the `*testing.T` object provided by the -// testing framework. This allows the assertion funcs to write the failings and other details to -// the correct place. -// -// Every assertion function also takes an optional string message as the final argument, -// allowing custom error messages to be appended to the message the assertion method outputs. -package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go deleted file mode 100644 index ac9dc9d..0000000 --- a/vendor/github.com/stretchr/testify/assert/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package assert - -import ( - "errors" -) - -// AnError is an error instance useful for testing. If the code does not care -// about error specifics, and only needs to return the error for example, this -// error should be used to make the test code more readable. -var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go deleted file mode 100644 index b867e95..0000000 --- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go +++ /dev/null @@ -1,16 +0,0 @@ -package assert - -// Assertions provides assertion methods around the -// TestingT interface. -type Assertions struct { - t TestingT -} - -// New makes a new Assertions object for the specified TestingT. -func New(t TestingT) *Assertions { - return &Assertions{ - t: t, - } -} - -//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go deleted file mode 100644 index e1b9442..0000000 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ /dev/null @@ -1,106 +0,0 @@ -package assert - -import ( - "fmt" - "net/http" - "net/http/httptest" - "net/url" - "strings" -) - -// httpCode is a helper that returns HTTP code of the response. It returns -1 -// if building a new request fails. -func httpCode(handler http.HandlerFunc, method, url string, values url.Values) int { - w := httptest.NewRecorder() - req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) - if err != nil { - return -1 - } - handler(w, req) - return w.Code -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { - code := httpCode(handler, method, url, values) - if code == -1 { - return false - } - return code >= http.StatusOK && code <= http.StatusPartialContent -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { - code := httpCode(handler, method, url, values) - if code == -1 { - return false - } - return code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { - code := httpCode(handler, method, url, values) - if code == -1 { - return false - } - return code >= http.StatusBadRequest -} - -// HTTPBody is a helper that returns HTTP body of the response. It returns -// empty string if building a new request fails. -func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { - w := httptest.NewRecorder() - req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) - if err != nil { - return "" - } - handler(w, req) - return w.Body.String() -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) - } - - return contains -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if contains { - Fail(t, "Expected response body for %s to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body) - } - - return !contains -} diff --git a/vendor/golang.org/x/sync/AUTHORS b/vendor/golang.org/x/sync/AUTHORS new file mode 100644 index 0000000..15167cd --- /dev/null +++ b/vendor/golang.org/x/sync/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/sync/CONTRIBUTING.md b/vendor/golang.org/x/sync/CONTRIBUTING.md new file mode 100644 index 0000000..88dff59 --- /dev/null +++ b/vendor/golang.org/x/sync/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + + +## Filing issues + +When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +**We do not accept GitHub pull requests** +(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. + diff --git a/vendor/golang.org/x/sync/CONTRIBUTORS b/vendor/golang.org/x/sync/CONTRIBUTORS new file mode 100644 index 0000000..1c4577e --- /dev/null +++ b/vendor/golang.org/x/sync/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE new file mode 100644 index 0000000..6a66aea --- /dev/null +++ b/vendor/golang.org/x/sync/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/PATENTS b/vendor/golang.org/x/sync/PATENTS similarity index 100% rename from vendor/golang.org/x/tools/PATENTS rename to vendor/golang.org/x/sync/PATENTS diff --git a/vendor/golang.org/x/sync/README b/vendor/golang.org/x/sync/README new file mode 100644 index 0000000..59c9dcb --- /dev/null +++ b/vendor/golang.org/x/sync/README @@ -0,0 +1,2 @@ +This repository provides Go concurrency primitives in addition to the +ones provided by the language and "sync" and "sync/atomic" packages. diff --git a/vendor/golang.org/x/sync/codereview.cfg b/vendor/golang.org/x/sync/codereview.cfg new file mode 100644 index 0000000..3f8b14b --- /dev/null +++ b/vendor/golang.org/x/sync/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go new file mode 100644 index 0000000..533438d --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -0,0 +1,67 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errgroup provides synchronization, error propagation, and Context +// cancelation for groups of goroutines working on subtasks of a common task. +package errgroup + +import ( + "sync" + + "golang.org/x/net/context" +) + +// A Group is a collection of goroutines working on subtasks that are part of +// the same overall task. +// +// A zero Group is valid and does not cancel on error. +type Group struct { + cancel func() + + wg sync.WaitGroup + + errOnce sync.Once + err error +} + +// WithContext returns a new Group and an associated Context derived from ctx. +// +// The derived Context is canceled the first time a function passed to Go +// returns a non-nil error or the first time Wait returns, whichever occurs +// first. +func WithContext(ctx context.Context) (*Group, context.Context) { + ctx, cancel := context.WithCancel(ctx) + return &Group{cancel: cancel}, ctx +} + +// Wait blocks until all function calls from the Go method have returned, then +// returns the first non-nil error (if any) from them. +func (g *Group) Wait() error { + g.wg.Wait() + if g.cancel != nil { + g.cancel() + } + return g.err +} + +// Go calls the given function in a new goroutine. +// +// The first call to return a non-nil error cancels the group; its error will be +// returned by Wait. +func (g *Group) Go(f func() error) { + g.wg.Add(1) + + go func() { + defer g.wg.Done() + + if err := f(); err != nil { + g.errOnce.Do(func() { + g.err = err + if g.cancel != nil { + g.cancel() + } + }) + } + }() +} diff --git a/vendor/golang.org/x/sync/errgroup/errgroup_example_md5all_test.go b/vendor/golang.org/x/sync/errgroup/errgroup_example_md5all_test.go new file mode 100644 index 0000000..714b5ae --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup_example_md5all_test.go @@ -0,0 +1,101 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package errgroup_test + +import ( + "crypto/md5" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + + "golang.org/x/net/context" + "golang.org/x/sync/errgroup" +) + +// Pipeline demonstrates the use of a Group to implement a multi-stage +// pipeline: a version of the MD5All function with bounded parallelism from +// https://blog.golang.org/pipelines. +func ExampleGroup_pipeline() { + m, err := MD5All(context.Background(), ".") + if err != nil { + log.Fatal(err) + } + + for k, sum := range m { + fmt.Printf("%s:\t%x\n", k, sum) + } +} + +type result struct { + path string + sum [md5.Size]byte +} + +// MD5All reads all the files in the file tree rooted at root and returns a map +// from file path to the MD5 sum of the file's contents. If the directory walk +// fails or any read operation fails, MD5All returns an error. +func MD5All(ctx context.Context, root string) (map[string][md5.Size]byte, error) { + // ctx is canceled when g.Wait() returns. When this version of MD5All returns + // - even in case of error! - we know that all of the goroutines have finished + // and the memory they were using can be garbage-collected. + g, ctx := errgroup.WithContext(ctx) + paths := make(chan string) + + g.Go(func() error { + defer close(paths) + return filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if !info.Mode().IsRegular() { + return nil + } + select { + case paths <- path: + case <-ctx.Done(): + return ctx.Err() + } + return nil + }) + }) + + // Start a fixed number of goroutines to read and digest files. + c := make(chan result) + const numDigesters = 20 + for i := 0; i < numDigesters; i++ { + g.Go(func() error { + for path := range paths { + data, err := ioutil.ReadFile(path) + if err != nil { + return err + } + select { + case c <- result{path, md5.Sum(data)}: + case <-ctx.Done(): + return ctx.Err() + } + } + return nil + }) + } + go func() { + g.Wait() + close(c) + }() + + m := make(map[string][md5.Size]byte) + for r := range c { + m[r.path] = r.sum + } + // Check whether any of the goroutines failed. Since g is accumulating the + // errors, we don't need to send them (or check for them) in the individual + // results sent on the channel. + if err := g.Wait(); err != nil { + return nil, err + } + return m, nil +} diff --git a/vendor/golang.org/x/sync/errgroup/errgroup_test.go b/vendor/golang.org/x/sync/errgroup/errgroup_test.go new file mode 100644 index 0000000..6a9696e --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup_test.go @@ -0,0 +1,176 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package errgroup_test + +import ( + "errors" + "fmt" + "net/http" + "os" + "testing" + + "golang.org/x/net/context" + "golang.org/x/sync/errgroup" +) + +var ( + Web = fakeSearch("web") + Image = fakeSearch("image") + Video = fakeSearch("video") +) + +type Result string +type Search func(ctx context.Context, query string) (Result, error) + +func fakeSearch(kind string) Search { + return func(_ context.Context, query string) (Result, error) { + return Result(fmt.Sprintf("%s result for %q", kind, query)), nil + } +} + +// JustErrors illustrates the use of a Group in place of a sync.WaitGroup to +// simplify goroutine counting and error handling. This example is derived from +// the sync.WaitGroup example at https://golang.org/pkg/sync/#example_WaitGroup. +func ExampleGroup_justErrors() { + var g errgroup.Group + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.somestupidname.com/", + } + for _, url := range urls { + // Launch a goroutine to fetch the URL. + url := url // https://golang.org/doc/faq#closures_and_goroutines + g.Go(func() error { + // Fetch the URL. + resp, err := http.Get(url) + if err == nil { + resp.Body.Close() + } + return err + }) + } + // Wait for all HTTP fetches to complete. + if err := g.Wait(); err == nil { + fmt.Println("Successfully fetched all URLs.") + } +} + +// Parallel illustrates the use of a Group for synchronizing a simple parallel +// task: the "Google Search 2.0" function from +// https://talks.golang.org/2012/concurrency.slide#46, augmented with a Context +// and error-handling. +func ExampleGroup_parallel() { + Google := func(ctx context.Context, query string) ([]Result, error) { + g, ctx := errgroup.WithContext(ctx) + + searches := []Search{Web, Image, Video} + results := make([]Result, len(searches)) + for i, search := range searches { + i, search := i, search // https://golang.org/doc/faq#closures_and_goroutines + g.Go(func() error { + result, err := search(ctx, query) + if err == nil { + results[i] = result + } + return err + }) + } + if err := g.Wait(); err != nil { + return nil, err + } + return results, nil + } + + results, err := Google(context.Background(), "golang") + if err != nil { + fmt.Fprintln(os.Stderr, err) + return + } + for _, result := range results { + fmt.Println(result) + } + + // Output: + // web result for "golang" + // image result for "golang" + // video result for "golang" +} + +func TestZeroGroup(t *testing.T) { + err1 := errors.New("errgroup_test: 1") + err2 := errors.New("errgroup_test: 2") + + cases := []struct { + errs []error + }{ + {errs: []error{}}, + {errs: []error{nil}}, + {errs: []error{err1}}, + {errs: []error{err1, nil}}, + {errs: []error{err1, nil, err2}}, + } + + for _, tc := range cases { + var g errgroup.Group + + var firstErr error + for i, err := range tc.errs { + err := err + g.Go(func() error { return err }) + + if firstErr == nil && err != nil { + firstErr = err + } + + if gErr := g.Wait(); gErr != firstErr { + t.Errorf("after %T.Go(func() error { return err }) for err in %v\n"+ + "g.Wait() = %v; want %v", + g, tc.errs[:i+1], err, firstErr) + } + } + } +} + +func TestWithContext(t *testing.T) { + errDoom := errors.New("group_test: doomed") + + cases := []struct { + errs []error + want error + }{ + {want: nil}, + {errs: []error{nil}, want: nil}, + {errs: []error{errDoom}, want: errDoom}, + {errs: []error{errDoom, nil}, want: errDoom}, + } + + for _, tc := range cases { + g, ctx := errgroup.WithContext(context.Background()) + + for _, err := range tc.errs { + err := err + g.Go(func() error { return err }) + } + + if err := g.Wait(); err != tc.want { + t.Errorf("after %T.Go(func() error { return err }) for err in %v\n"+ + "g.Wait() = %v; want %v", + g, tc.errs, err, tc.want) + } + + canceled := false + select { + case <-ctx.Done(): + canceled = true + default: + } + if !canceled { + t.Errorf("after %T.Go(func() error { return err }) for err in %v\n"+ + "ctx.Done() was not closed", + g, tc.errs) + } + } +} diff --git a/vendor/golang.org/x/sync/semaphore/semaphore.go b/vendor/golang.org/x/sync/semaphore/semaphore.go new file mode 100644 index 0000000..e9d2d79 --- /dev/null +++ b/vendor/golang.org/x/sync/semaphore/semaphore.go @@ -0,0 +1,131 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package semaphore provides a weighted semaphore implementation. +package semaphore // import "golang.org/x/sync/semaphore" + +import ( + "container/list" + "sync" + + // Use the old context because packages that depend on this one + // (e.g. cloud.google.com/go/...) must run on Go 1.6. + // TODO(jba): update to "context" when possible. + "golang.org/x/net/context" +) + +type waiter struct { + n int64 + ready chan<- struct{} // Closed when semaphore acquired. +} + +// NewWeighted creates a new weighted semaphore with the given +// maximum combined weight for concurrent access. +func NewWeighted(n int64) *Weighted { + w := &Weighted{size: n} + return w +} + +// Weighted provides a way to bound concurrent access to a resource. +// The callers can request access with a given weight. +type Weighted struct { + size int64 + cur int64 + mu sync.Mutex + waiters list.List +} + +// Acquire acquires the semaphore with a weight of n, blocking only until ctx +// is done. On success, returns nil. On failure, returns ctx.Err() and leaves +// the semaphore unchanged. +// +// If ctx is already done, Acquire may still succeed without blocking. +func (s *Weighted) Acquire(ctx context.Context, n int64) error { + s.mu.Lock() + if s.size-s.cur >= n && s.waiters.Len() == 0 { + s.cur += n + s.mu.Unlock() + return nil + } + + if n > s.size { + // Don't make other Acquire calls block on one that's doomed to fail. + s.mu.Unlock() + <-ctx.Done() + return ctx.Err() + } + + ready := make(chan struct{}) + w := waiter{n: n, ready: ready} + elem := s.waiters.PushBack(w) + s.mu.Unlock() + + select { + case <-ctx.Done(): + err := ctx.Err() + s.mu.Lock() + select { + case <-ready: + // Acquired the semaphore after we were canceled. Rather than trying to + // fix up the queue, just pretend we didn't notice the cancelation. + err = nil + default: + s.waiters.Remove(elem) + } + s.mu.Unlock() + return err + + case <-ready: + return nil + } +} + +// TryAcquire acquires the semaphore with a weight of n without blocking. +// On success, returns true. On failure, returns false and leaves the semaphore unchanged. +func (s *Weighted) TryAcquire(n int64) bool { + s.mu.Lock() + success := s.size-s.cur >= n && s.waiters.Len() == 0 + if success { + s.cur += n + } + s.mu.Unlock() + return success +} + +// Release releases the semaphore with a weight of n. +func (s *Weighted) Release(n int64) { + s.mu.Lock() + s.cur -= n + if s.cur < 0 { + s.mu.Unlock() + panic("semaphore: bad release") + } + for { + next := s.waiters.Front() + if next == nil { + break // No more waiters blocked. + } + + w := next.Value.(waiter) + if s.size-s.cur < w.n { + // Not enough tokens for the next waiter. We could keep going (to try to + // find a waiter with a smaller request), but under load that could cause + // starvation for large requests; instead, we leave all remaining waiters + // blocked. + // + // Consider a semaphore used as a read-write lock, with N tokens, N + // readers, and one writer. Each reader can Acquire(1) to obtain a read + // lock. The writer can Acquire(N) to obtain a write lock, excluding all + // of the readers. If we allow the readers to jump ahead in the queue, + // the writer will starve — there is always one token available for every + // reader. + break + } + + s.cur += w.n + s.waiters.Remove(next) + close(w.ready) + } + s.mu.Unlock() +} diff --git a/vendor/golang.org/x/sync/semaphore/semaphore_bench_test.go b/vendor/golang.org/x/sync/semaphore/semaphore_bench_test.go new file mode 100644 index 0000000..5bb2fb3 --- /dev/null +++ b/vendor/golang.org/x/sync/semaphore/semaphore_bench_test.go @@ -0,0 +1,130 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.7 + +package semaphore + +import ( + "fmt" + "testing" + + "golang.org/x/net/context" +) + +// weighted is an interface matching a subset of *Weighted. It allows +// alternate implementations for testing and benchmarking. +type weighted interface { + Acquire(context.Context, int64) error + TryAcquire(int64) bool + Release(int64) +} + +// semChan implements Weighted using a channel for +// comparing against the condition variable-based implementation. +type semChan chan struct{} + +func newSemChan(n int64) semChan { + return semChan(make(chan struct{}, n)) +} + +func (s semChan) Acquire(_ context.Context, n int64) error { + for i := int64(0); i < n; i++ { + s <- struct{}{} + } + return nil +} + +func (s semChan) TryAcquire(n int64) bool { + if int64(len(s))+n > int64(cap(s)) { + return false + } + + for i := int64(0); i < n; i++ { + s <- struct{}{} + } + return true +} + +func (s semChan) Release(n int64) { + for i := int64(0); i < n; i++ { + <-s + } +} + +// acquireN calls Acquire(size) on sem N times and then calls Release(size) N times. +func acquireN(b *testing.B, sem weighted, size int64, N int) { + b.ResetTimer() + for i := 0; i < b.N; i++ { + for j := 0; j < N; j++ { + sem.Acquire(context.Background(), size) + } + for j := 0; j < N; j++ { + sem.Release(size) + } + } +} + +// tryAcquireN calls TryAcquire(size) on sem N times and then calls Release(size) N times. +func tryAcquireN(b *testing.B, sem weighted, size int64, N int) { + b.ResetTimer() + for i := 0; i < b.N; i++ { + for j := 0; j < N; j++ { + if !sem.TryAcquire(size) { + b.Fatalf("TryAcquire(%v) = false, want true", size) + } + } + for j := 0; j < N; j++ { + sem.Release(size) + } + } +} + +func BenchmarkNewSeq(b *testing.B) { + for _, cap := range []int64{1, 128} { + b.Run(fmt.Sprintf("Weighted-%d", cap), func(b *testing.B) { + for i := 0; i < b.N; i++ { + _ = NewWeighted(cap) + } + }) + b.Run(fmt.Sprintf("semChan-%d", cap), func(b *testing.B) { + for i := 0; i < b.N; i++ { + _ = newSemChan(cap) + } + }) + } +} + +func BenchmarkAcquireSeq(b *testing.B) { + for _, c := range []struct { + cap, size int64 + N int + }{ + {1, 1, 1}, + {2, 1, 1}, + {16, 1, 1}, + {128, 1, 1}, + {2, 2, 1}, + {16, 2, 8}, + {128, 2, 64}, + {2, 1, 2}, + {16, 8, 2}, + {128, 64, 2}, + } { + for _, w := range []struct { + name string + w weighted + }{ + {"Weighted", NewWeighted(c.cap)}, + {"semChan", newSemChan(c.cap)}, + } { + b.Run(fmt.Sprintf("%s-acquire-%d-%d-%d", w.name, c.cap, c.size, c.N), func(b *testing.B) { + acquireN(b, w.w, c.size, c.N) + }) + b.Run(fmt.Sprintf("%s-tryAcquire-%d-%d-%d", w.name, c.cap, c.size, c.N), func(b *testing.B) { + tryAcquireN(b, w.w, c.size, c.N) + }) + } + } +} diff --git a/vendor/golang.org/x/sync/semaphore/semaphore_test.go b/vendor/golang.org/x/sync/semaphore/semaphore_test.go new file mode 100644 index 0000000..3f3bc9f --- /dev/null +++ b/vendor/golang.org/x/sync/semaphore/semaphore_test.go @@ -0,0 +1,170 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package semaphore + +import ( + "math/rand" + "runtime" + "sync" + "testing" + "time" + + "golang.org/x/net/context" + "golang.org/x/sync/errgroup" +) + +const maxSleep = 1 * time.Millisecond + +func HammerWeighted(sem *Weighted, n int64, loops int) { + for i := 0; i < loops; i++ { + sem.Acquire(context.Background(), n) + time.Sleep(time.Duration(rand.Int63n(int64(maxSleep/time.Nanosecond))) * time.Nanosecond) + sem.Release(n) + } +} + +func TestWeighted(t *testing.T) { + t.Parallel() + + n := runtime.GOMAXPROCS(0) + loops := 10000 / n + sem := NewWeighted(int64(n)) + var wg sync.WaitGroup + wg.Add(n) + for i := 0; i < n; i++ { + i := i + go func() { + defer wg.Done() + HammerWeighted(sem, int64(i), loops) + }() + } + wg.Wait() +} + +func TestWeightedPanic(t *testing.T) { + t.Parallel() + + defer func() { + if recover() == nil { + t.Fatal("release of an unacquired weighted semaphore did not panic") + } + }() + w := NewWeighted(1) + w.Release(1) +} + +func TestWeightedTryAcquire(t *testing.T) { + t.Parallel() + + ctx := context.Background() + sem := NewWeighted(2) + tries := []bool{} + sem.Acquire(ctx, 1) + tries = append(tries, sem.TryAcquire(1)) + tries = append(tries, sem.TryAcquire(1)) + + sem.Release(2) + + tries = append(tries, sem.TryAcquire(1)) + sem.Acquire(ctx, 1) + tries = append(tries, sem.TryAcquire(1)) + + want := []bool{true, false, true, false} + for i := range tries { + if tries[i] != want[i] { + t.Errorf("tries[%d]: got %t, want %t", i, tries[i], want[i]) + } + } +} + +func TestWeightedAcquire(t *testing.T) { + t.Parallel() + + ctx := context.Background() + sem := NewWeighted(2) + tryAcquire := func(n int64) bool { + ctx, cancel := context.WithTimeout(ctx, 10*time.Millisecond) + defer cancel() + return sem.Acquire(ctx, n) == nil + } + + tries := []bool{} + sem.Acquire(ctx, 1) + tries = append(tries, tryAcquire(1)) + tries = append(tries, tryAcquire(1)) + + sem.Release(2) + + tries = append(tries, tryAcquire(1)) + sem.Acquire(ctx, 1) + tries = append(tries, tryAcquire(1)) + + want := []bool{true, false, true, false} + for i := range tries { + if tries[i] != want[i] { + t.Errorf("tries[%d]: got %t, want %t", i, tries[i], want[i]) + } + } +} + +func TestWeightedDoesntBlockIfTooBig(t *testing.T) { + t.Parallel() + + const n = 2 + sem := NewWeighted(n) + { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + go sem.Acquire(ctx, n+1) + } + + g, ctx := errgroup.WithContext(context.Background()) + for i := n * 3; i > 0; i-- { + g.Go(func() error { + err := sem.Acquire(ctx, 1) + if err == nil { + time.Sleep(1 * time.Millisecond) + sem.Release(1) + } + return err + }) + } + if err := g.Wait(); err != nil { + t.Errorf("NewWeighted(%v) failed to AcquireCtx(_, 1) with AcquireCtx(_, %v) pending", n, n+1) + } +} + +// TestLargeAcquireDoesntStarve times out if a large call to Acquire starves. +// Merely returning from the test function indicates success. +func TestLargeAcquireDoesntStarve(t *testing.T) { + t.Parallel() + + ctx := context.Background() + n := int64(runtime.GOMAXPROCS(0)) + sem := NewWeighted(n) + running := true + + var wg sync.WaitGroup + wg.Add(int(n)) + for i := n; i > 0; i-- { + sem.Acquire(ctx, 1) + go func() { + defer func() { + sem.Release(1) + wg.Done() + }() + for running { + time.Sleep(1 * time.Millisecond) + sem.Release(1) + sem.Acquire(ctx, 1) + } + }() + } + + sem.Acquire(ctx, n) + running = false + sem.Release(n) + wg.Wait() +} diff --git a/vendor/golang.org/x/sync/singleflight/singleflight.go b/vendor/golang.org/x/sync/singleflight/singleflight.go new file mode 100644 index 0000000..9a4f8d5 --- /dev/null +++ b/vendor/golang.org/x/sync/singleflight/singleflight.go @@ -0,0 +1,111 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package singleflight provides a duplicate function call suppression +// mechanism. +package singleflight // import "golang.org/x/sync/singleflight" + +import "sync" + +// call is an in-flight or completed singleflight.Do call +type call struct { + wg sync.WaitGroup + + // These fields are written once before the WaitGroup is done + // and are only read after the WaitGroup is done. + val interface{} + err error + + // These fields are read and written with the singleflight + // mutex held before the WaitGroup is done, and are read but + // not written after the WaitGroup is done. + dups int + chans []chan<- Result +} + +// Group represents a class of work and forms a namespace in +// which units of work can be executed with duplicate suppression. +type Group struct { + mu sync.Mutex // protects m + m map[string]*call // lazily initialized +} + +// Result holds the results of Do, so they can be passed +// on a channel. +type Result struct { + Val interface{} + Err error + Shared bool +} + +// Do executes and returns the results of the given function, making +// sure that only one execution is in-flight for a given key at a +// time. If a duplicate comes in, the duplicate caller waits for the +// original to complete and receives the same results. +// The return value shared indicates whether v was given to multiple callers. +func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool) { + g.mu.Lock() + if g.m == nil { + g.m = make(map[string]*call) + } + if c, ok := g.m[key]; ok { + c.dups++ + g.mu.Unlock() + c.wg.Wait() + return c.val, c.err, true + } + c := new(call) + c.wg.Add(1) + g.m[key] = c + g.mu.Unlock() + + g.doCall(c, key, fn) + return c.val, c.err, c.dups > 0 +} + +// DoChan is like Do but returns a channel that will receive the +// results when they are ready. +func (g *Group) DoChan(key string, fn func() (interface{}, error)) <-chan Result { + ch := make(chan Result, 1) + g.mu.Lock() + if g.m == nil { + g.m = make(map[string]*call) + } + if c, ok := g.m[key]; ok { + c.dups++ + c.chans = append(c.chans, ch) + g.mu.Unlock() + return ch + } + c := &call{chans: []chan<- Result{ch}} + c.wg.Add(1) + g.m[key] = c + g.mu.Unlock() + + go g.doCall(c, key, fn) + + return ch +} + +// doCall handles the single call for a key. +func (g *Group) doCall(c *call, key string, fn func() (interface{}, error)) { + c.val, c.err = fn() + c.wg.Done() + + g.mu.Lock() + delete(g.m, key) + for _, ch := range c.chans { + ch <- Result{c.val, c.err, c.dups > 0} + } + g.mu.Unlock() +} + +// Forget tells the singleflight to forget about a key. Future calls +// to Do for this key will call the function rather than waiting for +// an earlier call to complete. +func (g *Group) Forget(key string) { + g.mu.Lock() + delete(g.m, key) + g.mu.Unlock() +} diff --git a/vendor/golang.org/x/sync/singleflight/singleflight_test.go b/vendor/golang.org/x/sync/singleflight/singleflight_test.go new file mode 100644 index 0000000..5e6f1b3 --- /dev/null +++ b/vendor/golang.org/x/sync/singleflight/singleflight_test.go @@ -0,0 +1,87 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package singleflight + +import ( + "errors" + "fmt" + "sync" + "sync/atomic" + "testing" + "time" +) + +func TestDo(t *testing.T) { + var g Group + v, err, _ := g.Do("key", func() (interface{}, error) { + return "bar", nil + }) + if got, want := fmt.Sprintf("%v (%T)", v, v), "bar (string)"; got != want { + t.Errorf("Do = %v; want %v", got, want) + } + if err != nil { + t.Errorf("Do error = %v", err) + } +} + +func TestDoErr(t *testing.T) { + var g Group + someErr := errors.New("Some error") + v, err, _ := g.Do("key", func() (interface{}, error) { + return nil, someErr + }) + if err != someErr { + t.Errorf("Do error = %v; want someErr %v", err, someErr) + } + if v != nil { + t.Errorf("unexpected non-nil value %#v", v) + } +} + +func TestDoDupSuppress(t *testing.T) { + var g Group + var wg1, wg2 sync.WaitGroup + c := make(chan string, 1) + var calls int32 + fn := func() (interface{}, error) { + if atomic.AddInt32(&calls, 1) == 1 { + // First invocation. + wg1.Done() + } + v := <-c + c <- v // pump; make available for any future calls + + time.Sleep(10 * time.Millisecond) // let more goroutines enter Do + + return v, nil + } + + const n = 10 + wg1.Add(1) + for i := 0; i < n; i++ { + wg1.Add(1) + wg2.Add(1) + go func() { + defer wg2.Done() + wg1.Done() + v, err, _ := g.Do("key", fn) + if err != nil { + t.Errorf("Do error: %v", err) + return + } + if s, _ := v.(string); s != "bar" { + t.Errorf("Do = %T %v; want %q", v, v, "bar") + } + }() + } + wg1.Wait() + // At least one goroutine is in fn now and all of them have at + // least reached the line before the Do. + c <- "bar" + wg2.Wait() + if got := atomic.LoadInt32(&calls); got <= 0 || got >= n { + t.Errorf("number of calls = %d; want over 0 and less than %d", got, n) + } +} diff --git a/vendor/golang.org/x/sync/syncmap/map.go b/vendor/golang.org/x/sync/syncmap/map.go new file mode 100644 index 0000000..80e1584 --- /dev/null +++ b/vendor/golang.org/x/sync/syncmap/map.go @@ -0,0 +1,372 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package syncmap provides a concurrent map implementation. +// It is a prototype for a proposed addition to the sync package +// in the standard library. +// (https://golang.org/issue/18177) +package syncmap + +import ( + "sync" + "sync/atomic" + "unsafe" +) + +// Map is a concurrent map with amortized-constant-time loads, stores, and deletes. +// It is safe for multiple goroutines to call a Map's methods concurrently. +// +// The zero Map is valid and empty. +// +// A Map must not be copied after first use. +type Map struct { + mu sync.Mutex + + // read contains the portion of the map's contents that are safe for + // concurrent access (with or without mu held). + // + // The read field itself is always safe to load, but must only be stored with + // mu held. + // + // Entries stored in read may be updated concurrently without mu, but updating + // a previously-expunged entry requires that the entry be copied to the dirty + // map and unexpunged with mu held. + read atomic.Value // readOnly + + // dirty contains the portion of the map's contents that require mu to be + // held. To ensure that the dirty map can be promoted to the read map quickly, + // it also includes all of the non-expunged entries in the read map. + // + // Expunged entries are not stored in the dirty map. An expunged entry in the + // clean map must be unexpunged and added to the dirty map before a new value + // can be stored to it. + // + // If the dirty map is nil, the next write to the map will initialize it by + // making a shallow copy of the clean map, omitting stale entries. + dirty map[interface{}]*entry + + // misses counts the number of loads since the read map was last updated that + // needed to lock mu to determine whether the key was present. + // + // Once enough misses have occurred to cover the cost of copying the dirty + // map, the dirty map will be promoted to the read map (in the unamended + // state) and the next store to the map will make a new dirty copy. + misses int +} + +// readOnly is an immutable struct stored atomically in the Map.read field. +type readOnly struct { + m map[interface{}]*entry + amended bool // true if the dirty map contains some key not in m. +} + +// expunged is an arbitrary pointer that marks entries which have been deleted +// from the dirty map. +var expunged = unsafe.Pointer(new(interface{})) + +// An entry is a slot in the map corresponding to a particular key. +type entry struct { + // p points to the interface{} value stored for the entry. + // + // If p == nil, the entry has been deleted and m.dirty == nil. + // + // If p == expunged, the entry has been deleted, m.dirty != nil, and the entry + // is missing from m.dirty. + // + // Otherwise, the entry is valid and recorded in m.read.m[key] and, if m.dirty + // != nil, in m.dirty[key]. + // + // An entry can be deleted by atomic replacement with nil: when m.dirty is + // next created, it will atomically replace nil with expunged and leave + // m.dirty[key] unset. + // + // An entry's associated value can be updated by atomic replacement, provided + // p != expunged. If p == expunged, an entry's associated value can be updated + // only after first setting m.dirty[key] = e so that lookups using the dirty + // map find the entry. + p unsafe.Pointer // *interface{} +} + +func newEntry(i interface{}) *entry { + return &entry{p: unsafe.Pointer(&i)} +} + +// Load returns the value stored in the map for a key, or nil if no +// value is present. +// The ok result indicates whether value was found in the map. +func (m *Map) Load(key interface{}) (value interface{}, ok bool) { + read, _ := m.read.Load().(readOnly) + e, ok := read.m[key] + if !ok && read.amended { + m.mu.Lock() + // Avoid reporting a spurious miss if m.dirty got promoted while we were + // blocked on m.mu. (If further loads of the same key will not miss, it's + // not worth copying the dirty map for this key.) + read, _ = m.read.Load().(readOnly) + e, ok = read.m[key] + if !ok && read.amended { + e, ok = m.dirty[key] + // Regardless of whether the entry was present, record a miss: this key + // will take the slow path until the dirty map is promoted to the read + // map. + m.missLocked() + } + m.mu.Unlock() + } + if !ok { + return nil, false + } + return e.load() +} + +func (e *entry) load() (value interface{}, ok bool) { + p := atomic.LoadPointer(&e.p) + if p == nil || p == expunged { + return nil, false + } + return *(*interface{})(p), true +} + +// Store sets the value for a key. +func (m *Map) Store(key, value interface{}) { + read, _ := m.read.Load().(readOnly) + if e, ok := read.m[key]; ok && e.tryStore(&value) { + return + } + + m.mu.Lock() + read, _ = m.read.Load().(readOnly) + if e, ok := read.m[key]; ok { + if e.unexpungeLocked() { + // The entry was previously expunged, which implies that there is a + // non-nil dirty map and this entry is not in it. + m.dirty[key] = e + } + e.storeLocked(&value) + } else if e, ok := m.dirty[key]; ok { + e.storeLocked(&value) + } else { + if !read.amended { + // We're adding the first new key to the dirty map. + // Make sure it is allocated and mark the read-only map as incomplete. + m.dirtyLocked() + m.read.Store(readOnly{m: read.m, amended: true}) + } + m.dirty[key] = newEntry(value) + } + m.mu.Unlock() +} + +// tryStore stores a value if the entry has not been expunged. +// +// If the entry is expunged, tryStore returns false and leaves the entry +// unchanged. +func (e *entry) tryStore(i *interface{}) bool { + p := atomic.LoadPointer(&e.p) + if p == expunged { + return false + } + for { + if atomic.CompareAndSwapPointer(&e.p, p, unsafe.Pointer(i)) { + return true + } + p = atomic.LoadPointer(&e.p) + if p == expunged { + return false + } + } +} + +// unexpungeLocked ensures that the entry is not marked as expunged. +// +// If the entry was previously expunged, it must be added to the dirty map +// before m.mu is unlocked. +func (e *entry) unexpungeLocked() (wasExpunged bool) { + return atomic.CompareAndSwapPointer(&e.p, expunged, nil) +} + +// storeLocked unconditionally stores a value to the entry. +// +// The entry must be known not to be expunged. +func (e *entry) storeLocked(i *interface{}) { + atomic.StorePointer(&e.p, unsafe.Pointer(i)) +} + +// LoadOrStore returns the existing value for the key if present. +// Otherwise, it stores and returns the given value. +// The loaded result is true if the value was loaded, false if stored. +func (m *Map) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) { + // Avoid locking if it's a clean hit. + read, _ := m.read.Load().(readOnly) + if e, ok := read.m[key]; ok { + actual, loaded, ok := e.tryLoadOrStore(value) + if ok { + return actual, loaded + } + } + + m.mu.Lock() + read, _ = m.read.Load().(readOnly) + if e, ok := read.m[key]; ok { + if e.unexpungeLocked() { + m.dirty[key] = e + } + actual, loaded, _ = e.tryLoadOrStore(value) + } else if e, ok := m.dirty[key]; ok { + actual, loaded, _ = e.tryLoadOrStore(value) + m.missLocked() + } else { + if !read.amended { + // We're adding the first new key to the dirty map. + // Make sure it is allocated and mark the read-only map as incomplete. + m.dirtyLocked() + m.read.Store(readOnly{m: read.m, amended: true}) + } + m.dirty[key] = newEntry(value) + actual, loaded = value, false + } + m.mu.Unlock() + + return actual, loaded +} + +// tryLoadOrStore atomically loads or stores a value if the entry is not +// expunged. +// +// If the entry is expunged, tryLoadOrStore leaves the entry unchanged and +// returns with ok==false. +func (e *entry) tryLoadOrStore(i interface{}) (actual interface{}, loaded, ok bool) { + p := atomic.LoadPointer(&e.p) + if p == expunged { + return nil, false, false + } + if p != nil { + return *(*interface{})(p), true, true + } + + // Copy the interface after the first load to make this method more amenable + // to escape analysis: if we hit the "load" path or the entry is expunged, we + // shouldn't bother heap-allocating. + ic := i + for { + if atomic.CompareAndSwapPointer(&e.p, nil, unsafe.Pointer(&ic)) { + return i, false, true + } + p = atomic.LoadPointer(&e.p) + if p == expunged { + return nil, false, false + } + if p != nil { + return *(*interface{})(p), true, true + } + } +} + +// Delete deletes the value for a key. +func (m *Map) Delete(key interface{}) { + read, _ := m.read.Load().(readOnly) + e, ok := read.m[key] + if !ok && read.amended { + m.mu.Lock() + read, _ = m.read.Load().(readOnly) + e, ok = read.m[key] + if !ok && read.amended { + delete(m.dirty, key) + } + m.mu.Unlock() + } + if ok { + e.delete() + } +} + +func (e *entry) delete() (hadValue bool) { + for { + p := atomic.LoadPointer(&e.p) + if p == nil || p == expunged { + return false + } + if atomic.CompareAndSwapPointer(&e.p, p, nil) { + return true + } + } +} + +// Range calls f sequentially for each key and value present in the map. +// If f returns false, range stops the iteration. +// +// Range does not necessarily correspond to any consistent snapshot of the Map's +// contents: no key will be visited more than once, but if the value for any key +// is stored or deleted concurrently, Range may reflect any mapping for that key +// from any point during the Range call. +// +// Range may be O(N) with the number of elements in the map even if f returns +// false after a constant number of calls. +func (m *Map) Range(f func(key, value interface{}) bool) { + // We need to be able to iterate over all of the keys that were already + // present at the start of the call to Range. + // If read.amended is false, then read.m satisfies that property without + // requiring us to hold m.mu for a long time. + read, _ := m.read.Load().(readOnly) + if read.amended { + // m.dirty contains keys not in read.m. Fortunately, Range is already O(N) + // (assuming the caller does not break out early), so a call to Range + // amortizes an entire copy of the map: we can promote the dirty copy + // immediately! + m.mu.Lock() + read, _ = m.read.Load().(readOnly) + if read.amended { + read = readOnly{m: m.dirty} + m.read.Store(read) + m.dirty = nil + m.misses = 0 + } + m.mu.Unlock() + } + + for k, e := range read.m { + v, ok := e.load() + if !ok { + continue + } + if !f(k, v) { + break + } + } +} + +func (m *Map) missLocked() { + m.misses++ + if m.misses < len(m.dirty) { + return + } + m.read.Store(readOnly{m: m.dirty}) + m.dirty = nil + m.misses = 0 +} + +func (m *Map) dirtyLocked() { + if m.dirty != nil { + return + } + + read, _ := m.read.Load().(readOnly) + m.dirty = make(map[interface{}]*entry, len(read.m)) + for k, e := range read.m { + if !e.tryExpungeLocked() { + m.dirty[k] = e + } + } +} + +func (e *entry) tryExpungeLocked() (isExpunged bool) { + p := atomic.LoadPointer(&e.p) + for p == nil { + if atomic.CompareAndSwapPointer(&e.p, nil, expunged) { + return true + } + p = atomic.LoadPointer(&e.p) + } + return p == expunged +} diff --git a/vendor/golang.org/x/sync/syncmap/map_bench_test.go b/vendor/golang.org/x/sync/syncmap/map_bench_test.go new file mode 100644 index 0000000..b279b4f --- /dev/null +++ b/vendor/golang.org/x/sync/syncmap/map_bench_test.go @@ -0,0 +1,216 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syncmap_test + +import ( + "fmt" + "reflect" + "sync/atomic" + "testing" + + "golang.org/x/sync/syncmap" +) + +type bench struct { + setup func(*testing.B, mapInterface) + perG func(b *testing.B, pb *testing.PB, i int, m mapInterface) +} + +func benchMap(b *testing.B, bench bench) { + for _, m := range [...]mapInterface{&DeepCopyMap{}, &RWMutexMap{}, &syncmap.Map{}} { + b.Run(fmt.Sprintf("%T", m), func(b *testing.B) { + m = reflect.New(reflect.TypeOf(m).Elem()).Interface().(mapInterface) + if bench.setup != nil { + bench.setup(b, m) + } + + b.ResetTimer() + + var i int64 + b.RunParallel(func(pb *testing.PB) { + id := int(atomic.AddInt64(&i, 1) - 1) + bench.perG(b, pb, id*b.N, m) + }) + }) + } +} + +func BenchmarkLoadMostlyHits(b *testing.B) { + const hits, misses = 1023, 1 + + benchMap(b, bench{ + setup: func(_ *testing.B, m mapInterface) { + for i := 0; i < hits; i++ { + m.LoadOrStore(i, i) + } + // Prime the map to get it into a steady state. + for i := 0; i < hits*2; i++ { + m.Load(i % hits) + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.Load(i % (hits + misses)) + } + }, + }) +} + +func BenchmarkLoadMostlyMisses(b *testing.B) { + const hits, misses = 1, 1023 + + benchMap(b, bench{ + setup: func(_ *testing.B, m mapInterface) { + for i := 0; i < hits; i++ { + m.LoadOrStore(i, i) + } + // Prime the map to get it into a steady state. + for i := 0; i < hits*2; i++ { + m.Load(i % hits) + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.Load(i % (hits + misses)) + } + }, + }) +} + +func BenchmarkLoadOrStoreBalanced(b *testing.B) { + const hits, misses = 128, 128 + + benchMap(b, bench{ + setup: func(b *testing.B, m mapInterface) { + if _, ok := m.(*DeepCopyMap); ok { + b.Skip("DeepCopyMap has quadratic running time.") + } + for i := 0; i < hits; i++ { + m.LoadOrStore(i, i) + } + // Prime the map to get it into a steady state. + for i := 0; i < hits*2; i++ { + m.Load(i % hits) + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + j := i % (hits + misses) + if j < hits { + if _, ok := m.LoadOrStore(j, i); !ok { + b.Fatalf("unexpected miss for %v", j) + } + } else { + if v, loaded := m.LoadOrStore(i, i); loaded { + b.Fatalf("failed to store %v: existing value %v", i, v) + } + } + } + }, + }) +} + +func BenchmarkLoadOrStoreUnique(b *testing.B) { + benchMap(b, bench{ + setup: func(b *testing.B, m mapInterface) { + if _, ok := m.(*DeepCopyMap); ok { + b.Skip("DeepCopyMap has quadratic running time.") + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.LoadOrStore(i, i) + } + }, + }) +} + +func BenchmarkLoadOrStoreCollision(b *testing.B) { + benchMap(b, bench{ + setup: func(_ *testing.B, m mapInterface) { + m.LoadOrStore(0, 0) + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.LoadOrStore(0, 0) + } + }, + }) +} + +func BenchmarkRange(b *testing.B) { + const mapSize = 1 << 10 + + benchMap(b, bench{ + setup: func(_ *testing.B, m mapInterface) { + for i := 0; i < mapSize; i++ { + m.Store(i, i) + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.Range(func(_, _ interface{}) bool { return true }) + } + }, + }) +} + +// BenchmarkAdversarialAlloc tests performance when we store a new value +// immediately whenever the map is promoted to clean and otherwise load a +// unique, missing key. +// +// This forces the Load calls to always acquire the map's mutex. +func BenchmarkAdversarialAlloc(b *testing.B) { + benchMap(b, bench{ + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + var stores, loadsSinceStore int64 + for ; pb.Next(); i++ { + m.Load(i) + if loadsSinceStore++; loadsSinceStore > stores { + m.LoadOrStore(i, stores) + loadsSinceStore = 0 + stores++ + } + } + }, + }) +} + +// BenchmarkAdversarialDelete tests performance when we periodically delete +// one key and add a different one in a large map. +// +// This forces the Load calls to always acquire the map's mutex and periodically +// makes a full copy of the map despite changing only one entry. +func BenchmarkAdversarialDelete(b *testing.B) { + const mapSize = 1 << 10 + + benchMap(b, bench{ + setup: func(_ *testing.B, m mapInterface) { + for i := 0; i < mapSize; i++ { + m.Store(i, i) + } + }, + + perG: func(b *testing.B, pb *testing.PB, i int, m mapInterface) { + for ; pb.Next(); i++ { + m.Load(i) + + if i%mapSize == 0 { + m.Range(func(k, _ interface{}) bool { + m.Delete(k) + return false + }) + m.Store(i, i) + } + } + }, + }) +} diff --git a/vendor/golang.org/x/sync/syncmap/map_reference_test.go b/vendor/golang.org/x/sync/syncmap/map_reference_test.go new file mode 100644 index 0000000..923c51b --- /dev/null +++ b/vendor/golang.org/x/sync/syncmap/map_reference_test.go @@ -0,0 +1,151 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syncmap_test + +import ( + "sync" + "sync/atomic" +) + +// This file contains reference map implementations for unit-tests. + +// mapInterface is the interface Map implements. +type mapInterface interface { + Load(interface{}) (interface{}, bool) + Store(key, value interface{}) + LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) + Delete(interface{}) + Range(func(key, value interface{}) (shouldContinue bool)) +} + +// RWMutexMap is an implementation of mapInterface using a sync.RWMutex. +type RWMutexMap struct { + mu sync.RWMutex + dirty map[interface{}]interface{} +} + +func (m *RWMutexMap) Load(key interface{}) (value interface{}, ok bool) { + m.mu.RLock() + value, ok = m.dirty[key] + m.mu.RUnlock() + return +} + +func (m *RWMutexMap) Store(key, value interface{}) { + m.mu.Lock() + if m.dirty == nil { + m.dirty = make(map[interface{}]interface{}) + } + m.dirty[key] = value + m.mu.Unlock() +} + +func (m *RWMutexMap) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) { + m.mu.Lock() + actual, loaded = m.dirty[key] + if !loaded { + actual = value + if m.dirty == nil { + m.dirty = make(map[interface{}]interface{}) + } + m.dirty[key] = value + } + m.mu.Unlock() + return actual, loaded +} + +func (m *RWMutexMap) Delete(key interface{}) { + m.mu.Lock() + delete(m.dirty, key) + m.mu.Unlock() +} + +func (m *RWMutexMap) Range(f func(key, value interface{}) (shouldContinue bool)) { + m.mu.RLock() + keys := make([]interface{}, 0, len(m.dirty)) + for k := range m.dirty { + keys = append(keys, k) + } + m.mu.RUnlock() + + for _, k := range keys { + v, ok := m.Load(k) + if !ok { + continue + } + if !f(k, v) { + break + } + } +} + +// DeepCopyMap is an implementation of mapInterface using a Mutex and +// atomic.Value. It makes deep copies of the map on every write to avoid +// acquiring the Mutex in Load. +type DeepCopyMap struct { + mu sync.Mutex + clean atomic.Value +} + +func (m *DeepCopyMap) Load(key interface{}) (value interface{}, ok bool) { + clean, _ := m.clean.Load().(map[interface{}]interface{}) + value, ok = clean[key] + return value, ok +} + +func (m *DeepCopyMap) Store(key, value interface{}) { + m.mu.Lock() + dirty := m.dirty() + dirty[key] = value + m.clean.Store(dirty) + m.mu.Unlock() +} + +func (m *DeepCopyMap) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) { + clean, _ := m.clean.Load().(map[interface{}]interface{}) + actual, loaded = clean[key] + if loaded { + return actual, loaded + } + + m.mu.Lock() + // Reload clean in case it changed while we were waiting on m.mu. + clean, _ = m.clean.Load().(map[interface{}]interface{}) + actual, loaded = clean[key] + if !loaded { + dirty := m.dirty() + dirty[key] = value + actual = value + m.clean.Store(dirty) + } + m.mu.Unlock() + return actual, loaded +} + +func (m *DeepCopyMap) Delete(key interface{}) { + m.mu.Lock() + dirty := m.dirty() + delete(dirty, key) + m.clean.Store(dirty) + m.mu.Unlock() +} + +func (m *DeepCopyMap) Range(f func(key, value interface{}) (shouldContinue bool)) { + clean, _ := m.clean.Load().(map[interface{}]interface{}) + for k, v := range clean { + if !f(k, v) { + break + } + } +} + +func (m *DeepCopyMap) dirty() map[interface{}]interface{} { + clean, _ := m.clean.Load().(map[interface{}]interface{}) + dirty := make(map[interface{}]interface{}, len(clean)+1) + for k, v := range clean { + dirty[k] = v + } + return dirty +} diff --git a/vendor/golang.org/x/sync/syncmap/map_test.go b/vendor/golang.org/x/sync/syncmap/map_test.go new file mode 100644 index 0000000..c883f17 --- /dev/null +++ b/vendor/golang.org/x/sync/syncmap/map_test.go @@ -0,0 +1,172 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syncmap_test + +import ( + "math/rand" + "reflect" + "runtime" + "sync" + "testing" + "testing/quick" + + "golang.org/x/sync/syncmap" +) + +type mapOp string + +const ( + opLoad = mapOp("Load") + opStore = mapOp("Store") + opLoadOrStore = mapOp("LoadOrStore") + opDelete = mapOp("Delete") +) + +var mapOps = [...]mapOp{opLoad, opStore, opLoadOrStore, opDelete} + +// mapCall is a quick.Generator for calls on mapInterface. +type mapCall struct { + op mapOp + k, v interface{} +} + +func (c mapCall) apply(m mapInterface) (interface{}, bool) { + switch c.op { + case opLoad: + return m.Load(c.k) + case opStore: + m.Store(c.k, c.v) + return nil, false + case opLoadOrStore: + return m.LoadOrStore(c.k, c.v) + case opDelete: + m.Delete(c.k) + return nil, false + default: + panic("invalid mapOp") + } +} + +type mapResult struct { + value interface{} + ok bool +} + +func randValue(r *rand.Rand) interface{} { + b := make([]byte, r.Intn(4)) + for i := range b { + b[i] = 'a' + byte(rand.Intn(26)) + } + return string(b) +} + +func (mapCall) Generate(r *rand.Rand, size int) reflect.Value { + c := mapCall{op: mapOps[rand.Intn(len(mapOps))], k: randValue(r)} + switch c.op { + case opStore, opLoadOrStore: + c.v = randValue(r) + } + return reflect.ValueOf(c) +} + +func applyCalls(m mapInterface, calls []mapCall) (results []mapResult, final map[interface{}]interface{}) { + for _, c := range calls { + v, ok := c.apply(m) + results = append(results, mapResult{v, ok}) + } + + final = make(map[interface{}]interface{}) + m.Range(func(k, v interface{}) bool { + final[k] = v + return true + }) + + return results, final +} + +func applyMap(calls []mapCall) ([]mapResult, map[interface{}]interface{}) { + return applyCalls(new(syncmap.Map), calls) +} + +func applyRWMutexMap(calls []mapCall) ([]mapResult, map[interface{}]interface{}) { + return applyCalls(new(RWMutexMap), calls) +} + +func applyDeepCopyMap(calls []mapCall) ([]mapResult, map[interface{}]interface{}) { + return applyCalls(new(DeepCopyMap), calls) +} + +func TestMapMatchesRWMutex(t *testing.T) { + if err := quick.CheckEqual(applyMap, applyRWMutexMap, nil); err != nil { + t.Error(err) + } +} + +func TestMapMatchesDeepCopy(t *testing.T) { + if err := quick.CheckEqual(applyMap, applyDeepCopyMap, nil); err != nil { + t.Error(err) + } +} + +func TestConcurrentRange(t *testing.T) { + const mapSize = 1 << 10 + + m := new(syncmap.Map) + for n := int64(1); n <= mapSize; n++ { + m.Store(n, int64(n)) + } + + done := make(chan struct{}) + var wg sync.WaitGroup + defer func() { + close(done) + wg.Wait() + }() + for g := int64(runtime.GOMAXPROCS(0)); g > 0; g-- { + r := rand.New(rand.NewSource(g)) + wg.Add(1) + go func(g int64) { + defer wg.Done() + for i := int64(0); ; i++ { + select { + case <-done: + return + default: + } + for n := int64(1); n < mapSize; n++ { + if r.Int63n(mapSize) == 0 { + m.Store(n, n*i*g) + } else { + m.Load(n) + } + } + } + }(g) + } + + iters := 1 << 10 + if testing.Short() { + iters = 16 + } + for n := iters; n > 0; n-- { + seen := make(map[int64]bool, mapSize) + + m.Range(func(ki, vi interface{}) bool { + k, v := ki.(int64), vi.(int64) + if v%k != 0 { + t.Fatalf("while Storing multiples of %v, Range saw value %v", k, v) + } + if seen[k] { + t.Fatalf("Range visited key %v twice", k) + } + seen[k] = true + return true + }) + + if len(seen) != mapSize { + t.Fatalf("Range visited %v elements of %v-element Map", len(seen), mapSize) + } + } +} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go deleted file mode 100644 index 6b7052b..0000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package astutil - -// This file defines utilities for working with source positions. - -import ( - "fmt" - "go/ast" - "go/token" - "sort" -) - -// PathEnclosingInterval returns the node that encloses the source -// interval [start, end), and all its ancestors up to the AST root. -// -// The definition of "enclosing" used by this function considers -// additional whitespace abutting a node to be enclosed by it. -// In this example: -// -// z := x + y // add them -// <-A-> -// <----B-----> -// -// the ast.BinaryExpr(+) node is considered to enclose interval B -// even though its [Pos()..End()) is actually only interval A. -// This behaviour makes user interfaces more tolerant of imperfect -// input. -// -// This function treats tokens as nodes, though they are not included -// in the result. e.g. PathEnclosingInterval("+") returns the -// enclosing ast.BinaryExpr("x + y"). -// -// If start==end, the 1-char interval following start is used instead. -// -// The 'exact' result is true if the interval contains only path[0] -// and perhaps some adjacent whitespace. It is false if the interval -// overlaps multiple children of path[0], or if it contains only -// interior whitespace of path[0]. -// In this example: -// -// z := x + y // add them -// <--C--> <---E--> -// ^ -// D -// -// intervals C, D and E are inexact. C is contained by the -// z-assignment statement, because it spans three of its children (:=, -// x, +). So too is the 1-char interval D, because it contains only -// interior whitespace of the assignment. E is considered interior -// whitespace of the BlockStmt containing the assignment. -// -// Precondition: [start, end) both lie within the same file as root. -// TODO(adonovan): return (nil, false) in this case and remove precond. -// Requires FileSet; see loader.tokenFileContainsPos. -// -// Postcondition: path is never nil; it always contains at least 'root'. -// -func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { - // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging - - // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end). - var visit func(node ast.Node) bool - visit = func(node ast.Node) bool { - path = append(path, node) - - nodePos := node.Pos() - nodeEnd := node.End() - - // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging - - // Intersect [start, end) with interval of node. - if start < nodePos { - start = nodePos - } - if end > nodeEnd { - end = nodeEnd - } - - // Find sole child that contains [start, end). - children := childrenOf(node) - l := len(children) - for i, child := range children { - // [childPos, childEnd) is unaugmented interval of child. - childPos := child.Pos() - childEnd := child.End() - - // [augPos, augEnd) is whitespace-augmented interval of child. - augPos := childPos - augEnd := childEnd - if i > 0 { - augPos = children[i-1].End() // start of preceding whitespace - } - if i < l-1 { - nextChildPos := children[i+1].Pos() - // Does [start, end) lie between child and next child? - if start >= augEnd && end <= nextChildPos { - return false // inexact match - } - augEnd = nextChildPos // end of following whitespace - } - - // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n", - // i, augPos, augEnd, start, end) // debugging - - // Does augmented child strictly contain [start, end)? - if augPos <= start && end <= augEnd { - _, isToken := child.(tokenNode) - return isToken || visit(child) - } - - // Does [start, end) overlap multiple children? - // i.e. left-augmented child contains start - // but LR-augmented child does not contain end. - if start < childEnd && end > augEnd { - break - } - } - - // No single child contained [start, end), - // so node is the result. Is it exact? - - // (It's tempting to put this condition before the - // child loop, but it gives the wrong result in the - // case where a node (e.g. ExprStmt) and its sole - // child have equal intervals.) - if start == nodePos && end == nodeEnd { - return true // exact match - } - - return false // inexact: overlaps multiple children - } - - if start > end { - start, end = end, start - } - - if start < root.End() && end > root.Pos() { - if start == end { - end = start + 1 // empty interval => interval of size 1 - } - exact = visit(root) - - // Reverse the path: - for i, l := 0, len(path); i < l/2; i++ { - path[i], path[l-1-i] = path[l-1-i], path[i] - } - } else { - // Selection lies within whitespace preceding the - // first (or following the last) declaration in the file. - // The result nonetheless always includes the ast.File. - path = append(path, root) - } - - return -} - -// tokenNode is a dummy implementation of ast.Node for a single token. -// They are used transiently by PathEnclosingInterval but never escape -// this package. -// -type tokenNode struct { - pos token.Pos - end token.Pos -} - -func (n tokenNode) Pos() token.Pos { - return n.pos -} - -func (n tokenNode) End() token.Pos { - return n.end -} - -func tok(pos token.Pos, len int) ast.Node { - return tokenNode{pos, pos + token.Pos(len)} -} - -// childrenOf returns the direct non-nil children of ast.Node n. -// It may include fake ast.Node implementations for bare tokens. -// it is not safe to call (e.g.) ast.Walk on such nodes. -// -func childrenOf(n ast.Node) []ast.Node { - var children []ast.Node - - // First add nodes for all true subtrees. - ast.Inspect(n, func(node ast.Node) bool { - if node == n { // push n - return true // recur - } - if node != nil { // push child - children = append(children, node) - } - return false // no recursion - }) - - // Then add fake Nodes for bare tokens. - switch n := n.(type) { - case *ast.ArrayType: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Elt.End(), len("]"))) - - case *ast.AssignStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.BasicLit: - children = append(children, - tok(n.ValuePos, len(n.Value))) - - case *ast.BinaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.BlockStmt: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("}"))) - - case *ast.BranchStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.CallExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - if n.Ellipsis != 0 { - children = append(children, tok(n.Ellipsis, len("..."))) - } - - case *ast.CaseClause: - if n.List == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.ChanType: - switch n.Dir { - case ast.RECV: - children = append(children, tok(n.Begin, len("<-chan"))) - case ast.SEND: - children = append(children, tok(n.Begin, len("chan<-"))) - case ast.RECV | ast.SEND: - children = append(children, tok(n.Begin, len("chan"))) - } - - case *ast.CommClause: - if n.Comm == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.Comment: - // nop - - case *ast.CommentGroup: - // nop - - case *ast.CompositeLit: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("{"))) - - case *ast.DeclStmt: - // nop - - case *ast.DeferStmt: - children = append(children, - tok(n.Defer, len("defer"))) - - case *ast.Ellipsis: - children = append(children, - tok(n.Ellipsis, len("..."))) - - case *ast.EmptyStmt: - // nop - - case *ast.ExprStmt: - // nop - - case *ast.Field: - // TODO(adonovan): Field.{Doc,Comment,Tag}? - - case *ast.FieldList: - children = append(children, - tok(n.Opening, len("(")), - tok(n.Closing, len(")"))) - - case *ast.File: - // TODO test: Doc - children = append(children, - tok(n.Package, len("package"))) - - case *ast.ForStmt: - children = append(children, - tok(n.For, len("for"))) - - case *ast.FuncDecl: - // TODO(adonovan): FuncDecl.Comment? - - // Uniquely, FuncDecl breaks the invariant that - // preorder traversal yields tokens in lexical order: - // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func. - // - // As a workaround, we inline the case for FuncType - // here and order things correctly. - // - children = nil // discard ast.Walk(FuncDecl) info subtrees - children = append(children, tok(n.Type.Func, len("func"))) - if n.Recv != nil { - children = append(children, n.Recv) - } - children = append(children, n.Name) - if n.Type.Params != nil { - children = append(children, n.Type.Params) - } - if n.Type.Results != nil { - children = append(children, n.Type.Results) - } - if n.Body != nil { - children = append(children, n.Body) - } - - case *ast.FuncLit: - // nop - - case *ast.FuncType: - if n.Func != 0 { - children = append(children, - tok(n.Func, len("func"))) - } - - case *ast.GenDecl: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - if n.Lparen != 0 { - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - } - - case *ast.GoStmt: - children = append(children, - tok(n.Go, len("go"))) - - case *ast.Ident: - children = append(children, - tok(n.NamePos, len(n.Name))) - - case *ast.IfStmt: - children = append(children, - tok(n.If, len("if"))) - - case *ast.ImportSpec: - // TODO(adonovan): ImportSpec.{Doc,EndPos}? - - case *ast.IncDecStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.IndexExpr: - children = append(children, - tok(n.Lbrack, len("{")), - tok(n.Rbrack, len("}"))) - - case *ast.InterfaceType: - children = append(children, - tok(n.Interface, len("interface"))) - - case *ast.KeyValueExpr: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.LabeledStmt: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.MapType: - children = append(children, - tok(n.Map, len("map"))) - - case *ast.ParenExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.RangeStmt: - children = append(children, - tok(n.For, len("for")), - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.ReturnStmt: - children = append(children, - tok(n.Return, len("return"))) - - case *ast.SelectStmt: - children = append(children, - tok(n.Select, len("select"))) - - case *ast.SelectorExpr: - // nop - - case *ast.SendStmt: - children = append(children, - tok(n.Arrow, len("<-"))) - - case *ast.SliceExpr: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Rbrack, len("]"))) - - case *ast.StarExpr: - children = append(children, tok(n.Star, len("*"))) - - case *ast.StructType: - children = append(children, tok(n.Struct, len("struct"))) - - case *ast.SwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.TypeAssertExpr: - children = append(children, - tok(n.Lparen-1, len(".")), - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.TypeSpec: - // TODO(adonovan): TypeSpec.{Doc,Comment}? - - case *ast.TypeSwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.UnaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.ValueSpec: - // TODO(adonovan): ValueSpec.{Doc,Comment}? - - case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt: - // nop - } - - // TODO(adonovan): opt: merge the logic of ast.Inspect() into - // the switch above so we can make interleaved callbacks for - // both Nodes and Tokens in the right order and avoid the need - // to sort. - sort.Sort(byPos(children)) - - return children -} - -type byPos []ast.Node - -func (sl byPos) Len() int { - return len(sl) -} -func (sl byPos) Less(i, j int) bool { - return sl[i].Pos() < sl[j].Pos() -} -func (sl byPos) Swap(i, j int) { - sl[i], sl[j] = sl[j], sl[i] -} - -// NodeDescription returns a description of the concrete type of n suitable -// for a user interface. -// -// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, -// StarExpr) we could be much more specific given the path to the AST -// root. Perhaps we should do that. -// -func NodeDescription(n ast.Node) string { - switch n := n.(type) { - case *ast.ArrayType: - return "array type" - case *ast.AssignStmt: - return "assignment" - case *ast.BadDecl: - return "bad declaration" - case *ast.BadExpr: - return "bad expression" - case *ast.BadStmt: - return "bad statement" - case *ast.BasicLit: - return "basic literal" - case *ast.BinaryExpr: - return fmt.Sprintf("binary %s operation", n.Op) - case *ast.BlockStmt: - return "block" - case *ast.BranchStmt: - switch n.Tok { - case token.BREAK: - return "break statement" - case token.CONTINUE: - return "continue statement" - case token.GOTO: - return "goto statement" - case token.FALLTHROUGH: - return "fall-through statement" - } - case *ast.CallExpr: - if len(n.Args) == 1 && !n.Ellipsis.IsValid() { - return "function call (or conversion)" - } - return "function call" - case *ast.CaseClause: - return "case clause" - case *ast.ChanType: - return "channel type" - case *ast.CommClause: - return "communication clause" - case *ast.Comment: - return "comment" - case *ast.CommentGroup: - return "comment group" - case *ast.CompositeLit: - return "composite literal" - case *ast.DeclStmt: - return NodeDescription(n.Decl) + " statement" - case *ast.DeferStmt: - return "defer statement" - case *ast.Ellipsis: - return "ellipsis" - case *ast.EmptyStmt: - return "empty statement" - case *ast.ExprStmt: - return "expression statement" - case *ast.Field: - // Can be any of these: - // struct {x, y int} -- struct field(s) - // struct {T} -- anon struct field - // interface {I} -- interface embedding - // interface {f()} -- interface method - // func (A) func(B) C -- receiver, param(s), result(s) - return "field/method/parameter" - case *ast.FieldList: - return "field/method/parameter list" - case *ast.File: - return "source file" - case *ast.ForStmt: - return "for loop" - case *ast.FuncDecl: - return "function declaration" - case *ast.FuncLit: - return "function literal" - case *ast.FuncType: - return "function type" - case *ast.GenDecl: - switch n.Tok { - case token.IMPORT: - return "import declaration" - case token.CONST: - return "constant declaration" - case token.TYPE: - return "type declaration" - case token.VAR: - return "variable declaration" - } - case *ast.GoStmt: - return "go statement" - case *ast.Ident: - return "identifier" - case *ast.IfStmt: - return "if statement" - case *ast.ImportSpec: - return "import specification" - case *ast.IncDecStmt: - if n.Tok == token.INC { - return "increment statement" - } - return "decrement statement" - case *ast.IndexExpr: - return "index expression" - case *ast.InterfaceType: - return "interface type" - case *ast.KeyValueExpr: - return "key/value association" - case *ast.LabeledStmt: - return "statement label" - case *ast.MapType: - return "map type" - case *ast.Package: - return "package" - case *ast.ParenExpr: - return "parenthesized " + NodeDescription(n.X) - case *ast.RangeStmt: - return "range loop" - case *ast.ReturnStmt: - return "return statement" - case *ast.SelectStmt: - return "select statement" - case *ast.SelectorExpr: - return "selector" - case *ast.SendStmt: - return "channel send" - case *ast.SliceExpr: - return "slice expression" - case *ast.StarExpr: - return "*-operation" // load/store expr or pointer type - case *ast.StructType: - return "struct type" - case *ast.SwitchStmt: - return "switch statement" - case *ast.TypeAssertExpr: - return "type assertion" - case *ast.TypeSpec: - return "type specification" - case *ast.TypeSwitchStmt: - return "type switch" - case *ast.UnaryExpr: - return fmt.Sprintf("unary %s operation", n.Op) - case *ast.ValueSpec: - return "value specification" - - } - panic(fmt.Sprintf("unexpected node type: %T", n)) -} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/imports.go b/vendor/golang.org/x/tools/go/ast/astutil/imports.go deleted file mode 100644 index a47bcfa..0000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/imports.go +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package astutil contains common utilities for working with the Go AST. -package astutil - -import ( - "fmt" - "go/ast" - "go/token" - "strconv" - "strings" -) - -// AddImport adds the import path to the file f, if absent. -func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool) { - return AddNamedImport(fset, f, "", ipath) -} - -// AddNamedImport adds the import path to the file f, if absent. -// If name is not empty, it is used to rename the import. -// -// For example, calling -// AddNamedImport(fset, f, "pathpkg", "path") -// adds -// import pathpkg "path" -func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added bool) { - if imports(f, ipath) { - return false - } - - newImport := &ast.ImportSpec{ - Path: &ast.BasicLit{ - Kind: token.STRING, - Value: strconv.Quote(ipath), - }, - } - if name != "" { - newImport.Name = &ast.Ident{Name: name} - } - - // Find an import decl to add to. - // The goal is to find an existing import - // whose import path has the longest shared - // prefix with ipath. - var ( - bestMatch = -1 // length of longest shared prefix - lastImport = -1 // index in f.Decls of the file's final import decl - impDecl *ast.GenDecl // import decl containing the best match - impIndex = -1 // spec index in impDecl containing the best match - ) - for i, decl := range f.Decls { - gen, ok := decl.(*ast.GenDecl) - if ok && gen.Tok == token.IMPORT { - lastImport = i - // Do not add to import "C", to avoid disrupting the - // association with its doc comment, breaking cgo. - if declImports(gen, "C") { - continue - } - - // Match an empty import decl if that's all that is available. - if len(gen.Specs) == 0 && bestMatch == -1 { - impDecl = gen - } - - // Compute longest shared prefix with imports in this group. - for j, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - n := matchLen(importPath(impspec), ipath) - if n > bestMatch { - bestMatch = n - impDecl = gen - impIndex = j - } - } - } - } - - // If no import decl found, add one after the last import. - if impDecl == nil { - impDecl = &ast.GenDecl{ - Tok: token.IMPORT, - } - if lastImport >= 0 { - impDecl.TokPos = f.Decls[lastImport].End() - } else { - // There are no existing imports. - // Our new import goes after the package declaration and after - // the comment, if any, that starts on the same line as the - // package declaration. - impDecl.TokPos = f.Package - - file := fset.File(f.Package) - pkgLine := file.Line(f.Package) - for _, c := range f.Comments { - if file.Line(c.Pos()) > pkgLine { - break - } - impDecl.TokPos = c.End() - } - } - f.Decls = append(f.Decls, nil) - copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) - f.Decls[lastImport+1] = impDecl - } - - // Insert new import at insertAt. - insertAt := 0 - if impIndex >= 0 { - // insert after the found import - insertAt = impIndex + 1 - } - impDecl.Specs = append(impDecl.Specs, nil) - copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) - impDecl.Specs[insertAt] = newImport - pos := impDecl.Pos() - if insertAt > 0 { - // If there is a comment after an existing import, preserve the comment - // position by adding the new import after the comment. - if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil { - pos = spec.Comment.End() - } else { - // Assign same position as the previous import, - // so that the sorter sees it as being in the same block. - pos = impDecl.Specs[insertAt-1].Pos() - } - } - if newImport.Name != nil { - newImport.Name.NamePos = pos - } - newImport.Path.ValuePos = pos - newImport.EndPos = pos - - // Clean up parens. impDecl contains at least one spec. - if len(impDecl.Specs) == 1 { - // Remove unneeded parens. - impDecl.Lparen = token.NoPos - } else if !impDecl.Lparen.IsValid() { - // impDecl needs parens added. - impDecl.Lparen = impDecl.Specs[0].Pos() - } - - f.Imports = append(f.Imports, newImport) - - if len(f.Decls) <= 1 { - return true - } - - // Merge all the import declarations into the first one. - var first *ast.GenDecl - for i, decl := range f.Decls { - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { - continue - } - if first == nil { - first = gen - continue // Don't touch the first one. - } - // Move the imports of the other import declaration to the first one. - for _, spec := range gen.Specs { - spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() - first.Specs = append(first.Specs, spec) - } - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - } - - return true -} - -// DeleteImport deletes the import path from the file f, if present. -func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { - return DeleteNamedImport(fset, f, "", path) -} - -// DeleteNamedImport deletes the import with the given name and path from the file f, if present. -func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { - var delspecs []*ast.ImportSpec - - // Find the import nodes that import path, if any. - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT { - continue - } - for j := 0; j < len(gen.Specs); j++ { - spec := gen.Specs[j] - impspec := spec.(*ast.ImportSpec) - if impspec.Name == nil && name != "" { - continue - } - if impspec.Name != nil && impspec.Name.Name != name { - continue - } - if importPath(impspec) != path { - continue - } - - // We found an import spec that imports path. - // Delete it. - delspecs = append(delspecs, impspec) - deleted = true - copy(gen.Specs[j:], gen.Specs[j+1:]) - gen.Specs = gen.Specs[:len(gen.Specs)-1] - - // If this was the last import spec in this decl, - // delete the decl, too. - if len(gen.Specs) == 0 { - copy(f.Decls[i:], f.Decls[i+1:]) - f.Decls = f.Decls[:len(f.Decls)-1] - i-- - break - } else if len(gen.Specs) == 1 { - gen.Lparen = token.NoPos // drop parens - } - if j > 0 { - lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) - lastLine := fset.Position(lastImpspec.Path.ValuePos).Line - line := fset.Position(impspec.Path.ValuePos).Line - - // We deleted an entry but now there may be - // a blank line-sized hole where the import was. - if line-lastLine > 1 { - // There was a blank line immediately preceding the deleted import, - // so there's no need to close the hole. - // Do nothing. - } else { - // There was no blank line. Close the hole. - fset.File(gen.Rparen).MergeLine(line) - } - } - j-- - } - } - - // Delete them from f.Imports. - for i := 0; i < len(f.Imports); i++ { - imp := f.Imports[i] - for j, del := range delspecs { - if imp == del { - copy(f.Imports[i:], f.Imports[i+1:]) - f.Imports = f.Imports[:len(f.Imports)-1] - copy(delspecs[j:], delspecs[j+1:]) - delspecs = delspecs[:len(delspecs)-1] - i-- - break - } - } - } - - if len(delspecs) > 0 { - panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs)) - } - - return -} - -// RewriteImport rewrites any import of path oldPath to path newPath. -func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) { - for _, imp := range f.Imports { - if importPath(imp) == oldPath { - rewrote = true - // record old End, because the default is to compute - // it using the length of imp.Path.Value. - imp.EndPos = imp.End() - imp.Path.Value = strconv.Quote(newPath) - } - } - return -} - -// UsesImport reports whether a given import is used. -func UsesImport(f *ast.File, path string) (used bool) { - spec := importSpec(f, path) - if spec == nil { - return - } - - name := spec.Name.String() - switch name { - case "": - // If the package name is not explicitly specified, - // make an educated guess. This is not guaranteed to be correct. - lastSlash := strings.LastIndex(path, "/") - if lastSlash == -1 { - name = path - } else { - name = path[lastSlash+1:] - } - case "_", ".": - // Not sure if this import is used - err on the side of caution. - return true - } - - ast.Walk(visitFn(func(n ast.Node) { - sel, ok := n.(*ast.SelectorExpr) - if ok && isTopName(sel.X, name) { - used = true - } - }), f) - - return -} - -type visitFn func(node ast.Node) - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - fn(node) - return fn -} - -// imports returns true if f imports path. -func imports(f *ast.File, path string) bool { - return importSpec(f, path) != nil -} - -// importSpec returns the import spec if f imports path, -// or nil otherwise. -func importSpec(f *ast.File, path string) *ast.ImportSpec { - for _, s := range f.Imports { - if importPath(s) == path { - return s - } - } - return nil -} - -// importPath returns the unquoted import path of s, -// or "" if the path is not properly quoted. -func importPath(s *ast.ImportSpec) string { - t, err := strconv.Unquote(s.Path.Value) - if err == nil { - return t - } - return "" -} - -// declImports reports whether gen contains an import of path. -func declImports(gen *ast.GenDecl, path string) bool { - if gen.Tok != token.IMPORT { - return false - } - for _, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - if importPath(impspec) == path { - return true - } - } - return false -} - -// matchLen returns the length of the longest path segment prefix shared by x and y. -func matchLen(x, y string) int { - n := 0 - for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ { - if x[i] == '/' { - n++ - } - } - return n -} - -// isTopName returns true if n is a top-level unresolved identifier with the given name. -func isTopName(n ast.Expr, name string) bool { - id, ok := n.(*ast.Ident) - return ok && id.Name == name && id.Obj == nil -} - -// Imports returns the file imports grouped by paragraph. -func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { - var groups [][]*ast.ImportSpec - - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.IMPORT { - break - } - - group := []*ast.ImportSpec{} - - var lastLine int - for _, spec := range genDecl.Specs { - importSpec := spec.(*ast.ImportSpec) - pos := importSpec.Path.ValuePos - line := fset.Position(pos).Line - if lastLine > 0 && pos > 0 && line-lastLine > 1 { - groups = append(groups, group) - group = []*ast.ImportSpec{} - } - group = append(group, importSpec) - lastLine = line - } - groups = append(groups, group) - } - - return groups -} diff --git a/vendor/golang.org/x/tools/go/ast/astutil/util.go b/vendor/golang.org/x/tools/go/ast/astutil/util.go deleted file mode 100644 index 7630629..0000000 --- a/vendor/golang.org/x/tools/go/ast/astutil/util.go +++ /dev/null @@ -1,14 +0,0 @@ -package astutil - -import "go/ast" - -// Unparen returns e with any enclosing parentheses stripped. -func Unparen(e ast.Expr) ast.Expr { - for { - p, ok := e.(*ast.ParenExpr) - if !ok { - return e - } - e = p.X - } -} diff --git a/vendor/golang.org/x/tools/imports/fastwalk.go b/vendor/golang.org/x/tools/imports/fastwalk.go deleted file mode 100644 index 157c792..0000000 --- a/vendor/golang.org/x/tools/imports/fastwalk.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// A faster implementation of filepath.Walk. -// -// filepath.Walk's design necessarily calls os.Lstat on each file, -// even if the caller needs less info. And goimports only need to know -// the type of each file. The kernel interface provides the type in -// the Readdir call but the standard library ignored it. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399 - -package imports - -import ( - "errors" - "os" - "path/filepath" - "runtime" -) - -// traverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir. -var traverseLink = errors.New("traverse symlink, assuming target is a directory") - -// fastWalk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If fastWalk returns filepath.SkipDir, the directory is skipped. -// -// Unlike filepath.Walk: -// * file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// * multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// * fastWalk can follow symlinks if walkFn returns the traverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. -func fastWalk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - // TODO(bradfitz): start the workers as needed? maybe not worth it. - for i := 0; i < numWorkers; i++ { - go w.doWork() - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork() { - for { - select { - case <-w.donec: - return - case it := <-w.workc: - w.resc <- w.walk(it.dir, !it.callbackDone) - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == traverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/vendor/golang.org/x/tools/imports/fastwalk_dirent_fileno.go b/vendor/golang.org/x/tools/imports/fastwalk_dirent_fileno.go deleted file mode 100644 index f1fd649..0000000 --- a/vendor/golang.org/x/tools/imports/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build freebsd openbsd netbsd - -package imports - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/vendor/golang.org/x/tools/imports/fastwalk_dirent_ino.go b/vendor/golang.org/x/tools/imports/fastwalk_dirent_ino.go deleted file mode 100644 index 32fe71b..0000000 --- a/vendor/golang.org/x/tools/imports/fastwalk_dirent_ino.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin - -package imports - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Ino) -} diff --git a/vendor/golang.org/x/tools/imports/fastwalk_portable.go b/vendor/golang.org/x/tools/imports/fastwalk_portable.go deleted file mode 100644 index 996c2c2..0000000 --- a/vendor/golang.org/x/tools/imports/fastwalk_portable.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !linux,!darwin,!freebsd,!openbsd,!netbsd - -package imports - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - for _, fi := range fis { - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - return err - } - } - return nil -} diff --git a/vendor/golang.org/x/tools/imports/fastwalk_unix.go b/vendor/golang.org/x/tools/imports/fastwalk_unix.go deleted file mode 100644 index 2449523..0000000 --- a/vendor/golang.org/x/tools/imports/fastwalk_unix.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin freebsd openbsd netbsd - -package imports - -import ( - "bytes" - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := syscall.Open(dirName, 0, 0) - if err != nil { - return err - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = syscall.ReadDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if err := fn(dirName, name, typ); err != nil { - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/15653 - dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0])) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := bytes.IndexByte(nameBuf[:], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} diff --git a/vendor/golang.org/x/tools/imports/fix.go b/vendor/golang.org/x/tools/imports/fix.go deleted file mode 100644 index 4d7dfeb..0000000 --- a/vendor/golang.org/x/tools/imports/fix.go +++ /dev/null @@ -1,900 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package imports - -import ( - "bufio" - "bytes" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/token" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "sort" - "strings" - "sync" - - "golang.org/x/tools/go/ast/astutil" -) - -// Debug controls verbose logging. -var Debug = false - -var ( - inTests = false // set true by fix_test.go; if false, no need to use testMu - testMu sync.RWMutex // guards globals reset by tests; used only if inTests -) - -// If set, LocalPrefix instructs Process to sort import paths with the given -// prefix into another group after 3rd-party packages. -var LocalPrefix string - -// importToGroup is a list of functions which map from an import path to -// a group number. -var importToGroup = []func(importPath string) (num int, ok bool){ - func(importPath string) (num int, ok bool) { - if LocalPrefix != "" && strings.HasPrefix(importPath, LocalPrefix) { - return 3, true - } - return - }, - func(importPath string) (num int, ok bool) { - if strings.HasPrefix(importPath, "appengine") { - return 2, true - } - return - }, - func(importPath string) (num int, ok bool) { - if strings.Contains(importPath, ".") { - return 1, true - } - return - }, -} - -func importGroup(importPath string) int { - for _, fn := range importToGroup { - if n, ok := fn(importPath); ok { - return n - } - } - return 0 -} - -func fixImports(fset *token.FileSet, f *ast.File, filename string) (added []string, err error) { - // refs are a set of possible package references currently unsatisfied by imports. - // first key: either base package (e.g. "fmt") or renamed package - // second key: referenced package symbol (e.g. "Println") - refs := make(map[string]map[string]bool) - - // decls are the current package imports. key is base package or renamed package. - decls := make(map[string]*ast.ImportSpec) - - abs, err := filepath.Abs(filename) - if err != nil { - return nil, err - } - srcDir := filepath.Dir(abs) - if Debug { - log.Printf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir) - } - - // collect potential uses of packages. - var visitor visitFn - visitor = visitFn(func(node ast.Node) ast.Visitor { - if node == nil { - return visitor - } - switch v := node.(type) { - case *ast.ImportSpec: - if v.Name != nil { - decls[v.Name.Name] = v - break - } - ipath := strings.Trim(v.Path.Value, `"`) - if ipath == "C" { - break - } - local := importPathToName(ipath, srcDir) - decls[local] = v - case *ast.SelectorExpr: - xident, ok := v.X.(*ast.Ident) - if !ok { - break - } - if xident.Obj != nil { - // if the parser can resolve it, it's not a package ref - break - } - pkgName := xident.Name - if refs[pkgName] == nil { - refs[pkgName] = make(map[string]bool) - } - if decls[pkgName] == nil { - refs[pkgName][v.Sel.Name] = true - } - } - return visitor - }) - ast.Walk(visitor, f) - - // Nil out any unused ImportSpecs, to be removed in following passes - unusedImport := map[string]string{} - for pkg, is := range decls { - if refs[pkg] == nil && pkg != "_" && pkg != "." { - name := "" - if is.Name != nil { - name = is.Name.Name - } - unusedImport[strings.Trim(is.Path.Value, `"`)] = name - } - } - for ipath, name := range unusedImport { - if ipath == "C" { - // Don't remove cgo stuff. - continue - } - astutil.DeleteNamedImport(fset, f, name, ipath) - } - - for pkgName, symbols := range refs { - if len(symbols) == 0 { - // skip over packages already imported - delete(refs, pkgName) - } - } - - // Search for imports matching potential package references. - searches := 0 - type result struct { - ipath string // import path (if err == nil) - name string // optional name to rename import as - err error - } - results := make(chan result) - for pkgName, symbols := range refs { - go func(pkgName string, symbols map[string]bool) { - ipath, rename, err := findImport(pkgName, symbols, filename) - r := result{ipath: ipath, err: err} - if rename { - r.name = pkgName - } - results <- r - }(pkgName, symbols) - searches++ - } - for i := 0; i < searches; i++ { - result := <-results - if result.err != nil { - return nil, result.err - } - if result.ipath != "" { - if result.name != "" { - astutil.AddNamedImport(fset, f, result.name, result.ipath) - } else { - astutil.AddImport(fset, f, result.ipath) - } - added = append(added, result.ipath) - } - } - - return added, nil -} - -// importPathToName returns the package name for the given import path. -var importPathToName func(importPath, srcDir string) (packageName string) = importPathToNameGoPath - -// importPathToNameBasic assumes the package name is the base of import path. -func importPathToNameBasic(importPath, srcDir string) (packageName string) { - return path.Base(importPath) -} - -// importPathToNameGoPath finds out the actual package name, as declared in its .go files. -// If there's a problem, it falls back to using importPathToNameBasic. -func importPathToNameGoPath(importPath, srcDir string) (packageName string) { - // Fast path for standard library without going to disk. - if pkg, ok := stdImportPackage[importPath]; ok { - return pkg - } - - pkgName, err := importPathToNameGoPathParse(importPath, srcDir) - if Debug { - log.Printf("importPathToNameGoPathParse(%q, srcDir=%q) = %q, %v", importPath, srcDir, pkgName, err) - } - if err == nil { - return pkgName - } - return importPathToNameBasic(importPath, srcDir) -} - -// importPathToNameGoPathParse is a faster version of build.Import if -// the only thing desired is the package name. It uses build.FindOnly -// to find the directory and then only parses one file in the package, -// trusting that the files in the directory are consistent. -func importPathToNameGoPathParse(importPath, srcDir string) (packageName string, err error) { - buildPkg, err := build.Import(importPath, srcDir, build.FindOnly) - if err != nil { - return "", err - } - d, err := os.Open(buildPkg.Dir) - if err != nil { - return "", err - } - names, err := d.Readdirnames(-1) - d.Close() - if err != nil { - return "", err - } - sort.Strings(names) // to have predictable behavior - var lastErr error - var nfile int - for _, name := range names { - if !strings.HasSuffix(name, ".go") { - continue - } - if strings.HasSuffix(name, "_test.go") { - continue - } - nfile++ - fullFile := filepath.Join(buildPkg.Dir, name) - - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) - if err != nil { - lastErr = err - continue - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName == "main" { - // Also skip package main, assuming it's a +build ignore generator or example. - // Since you can't import a package main anyway, there's no harm here. - continue - } - return pkgName, nil - } - if lastErr != nil { - return "", lastErr - } - return "", fmt.Errorf("no importable package found in %d Go files", nfile) -} - -var stdImportPackage = map[string]string{} // "net/http" => "http" - -func init() { - // Nothing in the standard library has a package name not - // matching its import base name. - for _, pkg := range stdlib { - if _, ok := stdImportPackage[pkg]; !ok { - stdImportPackage[pkg] = path.Base(pkg) - } - } -} - -// Directory-scanning state. -var ( - // scanGoRootOnce guards calling scanGoRoot (for $GOROOT) - scanGoRootOnce sync.Once - // scanGoPathOnce guards calling scanGoPath (for $GOPATH) - scanGoPathOnce sync.Once - - // populateIgnoreOnce guards calling populateIgnore - populateIgnoreOnce sync.Once - ignoredDirs []os.FileInfo - - dirScanMu sync.RWMutex - dirScan map[string]*pkg // abs dir path => *pkg -) - -type pkg struct { - dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") - importPath string // full pkg import path ("net/http", "foo/bar/vendor/a/b") - importPathShort string // vendorless import path ("net/http", "a/b") -} - -// byImportPathShortLength sorts by the short import path length, breaking ties on the -// import string itself. -type byImportPathShortLength []*pkg - -func (s byImportPathShortLength) Len() int { return len(s) } -func (s byImportPathShortLength) Less(i, j int) bool { - vi, vj := s[i].importPathShort, s[j].importPathShort - return len(vi) < len(vj) || (len(vi) == len(vj) && vi < vj) - -} -func (s byImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// gate is a semaphore for limiting concurrency. -type gate chan struct{} - -func (g gate) enter() { g <- struct{}{} } -func (g gate) leave() { <-g } - -var visitedSymlinks struct { - sync.Mutex - m map[string]struct{} -} - -// guarded by populateIgnoreOnce; populates ignoredDirs. -func populateIgnore() { - for _, srcDir := range build.Default.SrcDirs() { - if srcDir == filepath.Join(build.Default.GOROOT, "src") { - continue - } - populateIgnoredDirs(srcDir) - } -} - -// populateIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func populateIgnoredDirs(path string) { - file := filepath.Join(path, ".goimportsignore") - slurp, err := ioutil.ReadFile(file) - if Debug { - if err != nil { - log.Print(err) - } else { - log.Printf("Read %s", file) - } - } - if err != nil { - return - } - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - full := filepath.Join(path, line) - if fi, err := os.Stat(full); err == nil { - ignoredDirs = append(ignoredDirs, fi) - if Debug { - log.Printf("Directory added to ignore list: %s", full) - } - } else if Debug { - log.Printf("Error statting entry in .goimportsignore: %v", err) - } - } -} - -func skipDir(fi os.FileInfo) bool { - for _, ignoredDir := range ignoredDirs { - if os.SameFile(fi, ignoredDir) { - return true - } - } - return false -} - -// shouldTraverse reports whether the symlink fi should, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func shouldTraverse(dir string, fi os.FileInfo) bool { - path := filepath.Join(dir, fi.Name()) - target, err := filepath.EvalSymlinks(path) - if err != nil { - if !os.IsNotExist(err) { - fmt.Fprintln(os.Stderr, err) - } - return false - } - ts, err := os.Stat(target) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return false - } - if !ts.IsDir() { - return false - } - - realParent, err := filepath.EvalSymlinks(dir) - if err != nil { - fmt.Fprint(os.Stderr, err) - return false - } - realPath := filepath.Join(realParent, fi.Name()) - visitedSymlinks.Lock() - defer visitedSymlinks.Unlock() - if visitedSymlinks.m == nil { - visitedSymlinks.m = make(map[string]struct{}) - } - if _, ok := visitedSymlinks.m[realPath]; ok { - return false - } - visitedSymlinks.m[realPath] = struct{}{} - return true -} - -var testHookScanDir = func(dir string) {} - -var scanGoRootDone = make(chan struct{}) // closed when scanGoRoot is done - -func scanGoRoot() { - go func() { - scanGoDirs(true) - close(scanGoRootDone) - }() -} - -func scanGoPath() { scanGoDirs(false) } - -func scanGoDirs(goRoot bool) { - if Debug { - which := "$GOROOT" - if !goRoot { - which = "$GOPATH" - } - log.Printf("scanning " + which) - defer log.Printf("scanned " + which) - } - dirScanMu.Lock() - if dirScan == nil { - dirScan = make(map[string]*pkg) - } - dirScanMu.Unlock() - - for _, srcDir := range build.Default.SrcDirs() { - isGoroot := srcDir == filepath.Join(build.Default.GOROOT, "src") - if isGoroot != goRoot { - continue - } - testHookScanDir(srcDir) - walkFn := func(path string, typ os.FileMode) error { - dir := filepath.Dir(path) - if typ.IsRegular() { - if dir == srcDir { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - return nil - } - if !strings.HasSuffix(path, ".go") { - return nil - } - dirScanMu.Lock() - if _, dup := dirScan[dir]; !dup { - importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):]) - dirScan[dir] = &pkg{ - importPath: importpath, - importPathShort: vendorlessImportPath(importpath), - dir: dir, - } - } - dirScanMu.Unlock() - return nil - } - if typ == os.ModeDir { - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || base == "node_modules" { - return filepath.SkipDir - } - fi, err := os.Lstat(path) - if err == nil && skipDir(fi) { - if Debug { - log.Printf("skipping directory %q under %s", fi.Name(), dir) - } - return filepath.SkipDir - } - return nil - } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil - } - fi, err := os.Lstat(path) - if err != nil { - // Just ignore it. - return nil - } - if shouldTraverse(dir, fi) { - return traverseLink - } - } - return nil - } - if err := fastWalk(srcDir, walkFn); err != nil { - log.Printf("goimports: scanning directory %v: %v", srcDir, err) - } - } -} - -// vendorlessImportPath returns the devendorized version of the provided import path. -// e.g. "foo/bar/vendor/a/b" => "a/b" -func vendorlessImportPath(ipath string) string { - // Devendorize for use in import statement. - if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { - return ipath[i+len("/vendor/"):] - } - if strings.HasPrefix(ipath, "vendor/") { - return ipath[len("vendor/"):] - } - return ipath -} - -// loadExports returns the set of exported symbols in the package at dir. -// It returns nil on error or if the package name in dir does not match expectPackage. -var loadExports func(expectPackage, dir string) map[string]bool = loadExportsGoPath - -func loadExportsGoPath(expectPackage, dir string) map[string]bool { - if Debug { - log.Printf("loading exports in dir %s (seeking package %s)", dir, expectPackage) - } - exports := make(map[string]bool) - - ctx := build.Default - - // ReadDir is like ioutil.ReadDir, but only returns *.go files - // and filters out _test.go files since they're not relevant - // and only slow things down. - ctx.ReadDir = func(dir string) (notTests []os.FileInfo, err error) { - all, err := ioutil.ReadDir(dir) - if err != nil { - return nil, err - } - notTests = all[:0] - for _, fi := range all { - name := fi.Name() - if strings.HasSuffix(name, ".go") && !strings.HasSuffix(name, "_test.go") { - notTests = append(notTests, fi) - } - } - return notTests, nil - } - - files, err := ctx.ReadDir(dir) - if err != nil { - log.Print(err) - return nil - } - - fset := token.NewFileSet() - - for _, fi := range files { - match, err := ctx.MatchFile(dir, fi.Name()) - if err != nil || !match { - continue - } - fullFile := filepath.Join(dir, fi.Name()) - f, err := parser.ParseFile(fset, fullFile, nil, 0) - if err != nil { - if Debug { - log.Printf("Parsing %s: %v", fullFile, err) - } - return nil - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName != expectPackage { - if Debug { - log.Printf("scan of dir %v is not expected package %v (actually %v)", dir, expectPackage, pkgName) - } - return nil - } - for name := range f.Scope.Objects { - if ast.IsExported(name) { - exports[name] = true - } - } - } - - if Debug { - exportList := make([]string, 0, len(exports)) - for k := range exports { - exportList = append(exportList, k) - } - sort.Strings(exportList) - log.Printf("loaded exports in dir %v (package %v): %v", dir, expectPackage, strings.Join(exportList, ", ")) - } - return exports -} - -// findImport searches for a package with the given symbols. -// If no package is found, findImport returns ("", false, nil) -// -// This is declared as a variable rather than a function so goimports -// can be easily extended by adding a file with an init function. -// -// The rename value tells goimports whether to use the package name as -// a local qualifier in an import. For example, if findImports("pkg", -// "X") returns ("foo/bar", rename=true), then goimports adds the -// import line: -// import pkg "foo/bar" -// to satisfy uses of pkg.X in the file. -var findImport func(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) = findImportGoPath - -// findImportGoPath is the normal implementation of findImport. -// (Some companies have their own internally.) -func findImportGoPath(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) { - if inTests { - testMu.RLock() - defer testMu.RUnlock() - } - - // Fast path for the standard library. - // In the common case we hopefully never have to scan the GOPATH, which can - // be slow with moving disks. - if pkg, rename, ok := findImportStdlib(pkgName, symbols); ok { - return pkg, rename, nil - } - if pkgName == "rand" && symbols["Read"] { - // Special-case rand.Read. - // - // If findImportStdlib didn't find it above, don't go - // searching for it, lest it find and pick math/rand - // in GOROOT (new as of Go 1.6) - // - // crypto/rand is the safer choice. - return "", false, nil - } - - // TODO(sameer): look at the import lines for other Go files in the - // local directory, since the user is likely to import the same packages - // in the current Go file. Return rename=true when the other Go files - // use a renamed package that's also used in the current file. - - // Read all the $GOPATH/src/.goimportsignore files before scanning directories. - populateIgnoreOnce.Do(populateIgnore) - - // Start scanning the $GOROOT asynchronously, then run the - // GOPATH scan synchronously if needed, and then wait for the - // $GOROOT to finish. - // - // TODO(bradfitz): run each $GOPATH entry async. But nobody - // really has more than one anyway, so low priority. - scanGoRootOnce.Do(scanGoRoot) // async - if !strings.HasPrefix(filename, build.Default.GOROOT) { - scanGoPathOnce.Do(scanGoPath) // blocking - } - <-scanGoRootDone - - // Find candidate packages, looking only at their directory names first. - var candidates []*pkg - for _, pkg := range dirScan { - if pkgIsCandidate(filename, pkgName, pkg) { - candidates = append(candidates, pkg) - } - } - - // Sort the candidates by their import package length, - // assuming that shorter package names are better than long - // ones. Note that this sorts by the de-vendored name, so - // there's no "penalty" for vendoring. - sort.Sort(byImportPathShortLength(candidates)) - if Debug { - for i, pkg := range candidates { - log.Printf("%s candidate %d/%d: %v", pkgName, i+1, len(candidates), pkg.importPathShort) - } - } - - // Collect exports for packages with matching names. - - done := make(chan struct{}) // closed when we find the answer - defer close(done) - - rescv := make([]chan *pkg, len(candidates)) - for i := range candidates { - rescv[i] = make(chan *pkg) - } - const maxConcurrentPackageImport = 4 - loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) - - go func() { - for i, pkg := range candidates { - select { - case loadExportsSem <- struct{}{}: - select { - case <-done: - default: - } - case <-done: - return - } - pkg := pkg - resc := rescv[i] - go func() { - if inTests { - testMu.RLock() - defer testMu.RUnlock() - } - defer func() { <-loadExportsSem }() - exports := loadExports(pkgName, pkg.dir) - - // If it doesn't have the right - // symbols, send nil to mean no match. - for symbol := range symbols { - if !exports[symbol] { - pkg = nil - break - } - } - select { - case resc <- pkg: - case <-done: - } - }() - } - }() - for _, resc := range rescv { - pkg := <-resc - if pkg == nil { - continue - } - // If the package name in the source doesn't match the import path's base, - // return true so the rewriter adds a name (import foo "github.com/bar/go-foo") - needsRename := path.Base(pkg.importPath) != pkgName - return pkg.importPathShort, needsRename, nil - } - return "", false, nil -} - -// pkgIsCandidate reports whether pkg is a candidate for satisfying the -// finding which package pkgIdent in the file named by filename is trying -// to refer to. -// -// This check is purely lexical and is meant to be as fast as possible -// because it's run over all $GOPATH directories to filter out poor -// candidates in order to limit the CPU and I/O later parsing the -// exports in candidate packages. -// -// filename is the file being formatted. -// pkgIdent is the package being searched for, like "client" (if -// searching for "client.New") -func pkgIsCandidate(filename, pkgIdent string, pkg *pkg) bool { - // Check "internal" and "vendor" visibility: - if !canUse(filename, pkg.dir) { - return false - } - - // Speed optimization to minimize disk I/O: - // the last two components on disk must contain the - // package name somewhere. - // - // This permits mismatch naming like directory - // "go-foo" being package "foo", or "pkg.v3" being "pkg", - // or directory "google.golang.org/api/cloudbilling/v1" - // being package "cloudbilling", but doesn't - // permit a directory "foo" to be package - // "bar", which is strongly discouraged - // anyway. There's no reason goimports needs - // to be slow just to accomodate that. - lastTwo := lastTwoComponents(pkg.importPathShort) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - } - - return false -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) -} - -// canUse reports whether the package in dir is usable from filename, -// respecting the Go "internal" and "vendor" visibility rules. -func canUse(filename, dir string) bool { - // Fast path check, before any allocations. If it doesn't contain vendor - // or internal, it's not tricky: - // Note that this can false-negative on directories like "notinternal", - // but we check it correctly below. This is just a fast path. - if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { - return true - } - - dirSlash := filepath.ToSlash(dir) - if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { - return true - } - // Vendor or internal directory only visible from children of parent. - // That means the path from the current directory to the target directory - // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal - // or bar/vendor or bar/internal. - // After stripping all the leading ../, the only okay place to see vendor or internal - // is at the very beginning of the path. - absfile, err := filepath.Abs(filename) - if err != nil { - return false - } - absdir, err := filepath.Abs(dir) - if err != nil { - return false - } - rel, err := filepath.Rel(absfile, absdir) - if err != nil { - return false - } - relSlash := filepath.ToSlash(rel) - if i := strings.LastIndex(relSlash, "../"); i >= 0 { - relSlash = relSlash[i+len("../"):] - } - return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -type visitFn func(node ast.Node) ast.Visitor - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - return fn(node) -} - -func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, rename, ok bool) { - for symbol := range symbols { - key := shortPkg + "." + symbol - path := stdlib[key] - if path == "" { - if key == "rand.Read" { - continue - } - return "", false, false - } - if importPath != "" && importPath != path { - // Ambiguous. Symbols pointed to different things. - return "", false, false - } - importPath = path - } - if importPath == "" && shortPkg == "rand" && symbols["Read"] { - return "crypto/rand", false, true - } - return importPath, false, importPath != "" -} diff --git a/vendor/golang.org/x/tools/imports/imports.go b/vendor/golang.org/x/tools/imports/imports.go deleted file mode 100644 index 7c6c1b6..0000000 --- a/vendor/golang.org/x/tools/imports/imports.go +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run mkstdlib.go - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports - -import ( - "bufio" - "bytes" - "fmt" - "go/ast" - "go/format" - "go/parser" - "go/printer" - "go/token" - "io" - "regexp" - "strconv" - "strings" - - "golang.org/x/tools/go/ast/astutil" -) - -// Options specifies options for processing files. -type Options struct { - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Process formats and adjusts imports for the provided file. -// If opt is nil the defaults are used. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -// To process data ``as if'' it were in filename, pass the data as a non-nil src. -func Process(filename string, src []byte, opt *Options) ([]byte, error) { - if opt == nil { - opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} - } - - fileSet := token.NewFileSet() - file, adjust, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - if !opt.FormatOnly { - _, err = fixImports(fileSet, file, filename) - if err != nil { - return nil, err - } - } - - sortImports(fileSet, file) - imps := astutil.Imports(fileSet, file) - - var spacesBefore []string // import paths we need spaces before - for _, impSection := range imps { - // Within each block of contiguous imports, see if any - // import lines are in different group numbers. If so, - // we'll need to put a space between them so it's - // compatible with gofmt. - lastGroup := -1 - for _, importSpec := range impSection { - importPath, _ := strconv.Unquote(importSpec.Path.Value) - groupNum := importGroup(importPath) - if groupNum != lastGroup && lastGroup != -1 { - spacesBefore = append(spacesBefore, importPath) - } - lastGroup = groupNum - } - - } - - printerMode := printer.UseSpaces - if opt.TabIndent { - printerMode |= printer.TabIndent - } - printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} - - var buf bytes.Buffer - err = printConfig.Fprint(&buf, fileSet, file) - if err != nil { - return nil, err - } - out := buf.Bytes() - if adjust != nil { - out = adjust(src, out) - } - if len(spacesBefore) > 0 { - out = addImportSpaces(bytes.NewReader(out), spacesBefore) - } - - out, err = format.Source(out) - if err != nil { - return nil, err - } - return out, nil -} - -// parse parses src, which was read from filename, -// as a Go source file or statement list. -func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) { - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - - // Try as whole source file. - file, err := parser.ParseFile(fset, filename, src, parserMode) - if err == nil { - return file, nil, nil - } - // If the error is that the source file didn't begin with a - // package line and we accept fragmented input, fall through to - // try as a source fragment. Stop and return on any other error. - if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") { - return nil, nil, err - } - - // If this is a declaration list, make it a source file - // by inserting a package clause. - // Insert using a ;, not a newline, so that the line numbers - // in psrc match the ones in src. - psrc := append([]byte("package main;"), src...) - file, err = parser.ParseFile(fset, filename, psrc, parserMode) - if err == nil { - // If a main function exists, we will assume this is a main - // package and leave the file. - if containsMainFunc(file) { - return file, nil, nil - } - - adjust := func(orig, src []byte) []byte { - // Remove the package clause. - // Gofmt has turned the ; into a \n. - src = src[len("package main\n"):] - return matchSpace(orig, src) - } - return file, adjust, nil - } - // If the error is that the source file didn't begin with a - // declaration, fall through to try as a statement list. - // Stop and return on any other error. - if !strings.Contains(err.Error(), "expected declaration") { - return nil, nil, err - } - - // If this is a statement list, make it a source file - // by inserting a package clause and turning the list - // into a function body. This handles expressions too. - // Insert using a ;, not a newline, so that the line numbers - // in fsrc match the ones in src. - fsrc := append(append([]byte("package p; func _() {"), src...), '}') - file, err = parser.ParseFile(fset, filename, fsrc, parserMode) - if err == nil { - adjust := func(orig, src []byte) []byte { - // Remove the wrapping. - // Gofmt has turned the ; into a \n\n. - src = src[len("package p\n\nfunc _() {"):] - src = src[:len(src)-len("}\n")] - // Gofmt has also indented the function body one level. - // Remove that indent. - src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1) - return matchSpace(orig, src) - } - return file, adjust, nil - } - - // Failed, and out of options. - return nil, nil, err -} - -// containsMainFunc checks if a file contains a function declaration with the -// function signature 'func main()' -func containsMainFunc(file *ast.File) bool { - for _, decl := range file.Decls { - if f, ok := decl.(*ast.FuncDecl); ok { - if f.Name.Name != "main" { - continue - } - - if len(f.Type.Params.List) != 0 { - continue - } - - if f.Type.Results != nil && len(f.Type.Results.List) != 0 { - continue - } - - return true - } - } - - return false -} - -func cutSpace(b []byte) (before, middle, after []byte) { - i := 0 - for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { - i++ - } - j := len(b) - for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { - j-- - } - if i <= j { - return b[:i], b[i:j], b[j:] - } - return nil, nil, b[j:] -} - -// matchSpace reformats src to use the same space context as orig. -// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src. -// 2) matchSpace copies the indentation of the first non-blank line in orig -// to every non-blank line in src. -// 3) matchSpace copies the trailing space from orig and uses it in place -// of src's trailing space. -func matchSpace(orig []byte, src []byte) []byte { - before, _, after := cutSpace(orig) - i := bytes.LastIndex(before, []byte{'\n'}) - before, indent := before[:i+1], before[i+1:] - - _, src, _ = cutSpace(src) - - var b bytes.Buffer - b.Write(before) - for len(src) > 0 { - line := src - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, src = line[:i+1], line[i+1:] - } else { - src = nil - } - if len(line) > 0 && line[0] != '\n' { // not blank - b.Write(indent) - } - b.Write(line) - } - b.Write(after) - return b.Bytes() -} - -var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`) - -func addImportSpaces(r io.Reader, breaks []string) []byte { - var out bytes.Buffer - sc := bufio.NewScanner(r) - inImports := false - done := false - for sc.Scan() { - s := sc.Text() - - if !inImports && !done && strings.HasPrefix(s, "import") { - inImports = true - } - if inImports && (strings.HasPrefix(s, "var") || - strings.HasPrefix(s, "func") || - strings.HasPrefix(s, "const") || - strings.HasPrefix(s, "type")) { - done = true - inImports = false - } - if inImports && len(breaks) > 0 { - if m := impLine.FindStringSubmatch(s); m != nil { - if m[1] == string(breaks[0]) { - out.WriteByte('\n') - breaks = breaks[1:] - } - } - } - - fmt.Fprintln(&out, s) - } - return out.Bytes() -} diff --git a/vendor/golang.org/x/tools/imports/mkindex.go b/vendor/golang.org/x/tools/imports/mkindex.go deleted file mode 100644 index 755e239..0000000 --- a/vendor/golang.org/x/tools/imports/mkindex.go +++ /dev/null @@ -1,173 +0,0 @@ -// +build ignore - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Command mkindex creates the file "pkgindex.go" containing an index of the Go -// standard library. The file is intended to be built as part of the imports -// package, so that the package may be used in environments where a GOROOT is -// not available (such as App Engine). -package main - -import ( - "bytes" - "fmt" - "go/ast" - "go/build" - "go/format" - "go/parser" - "go/token" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "strings" -) - -var ( - pkgIndex = make(map[string][]pkg) - exports = make(map[string]map[string]bool) -) - -func main() { - // Don't use GOPATH. - ctx := build.Default - ctx.GOPATH = "" - - // Populate pkgIndex global from GOROOT. - for _, path := range ctx.SrcDirs() { - f, err := os.Open(path) - if err != nil { - log.Print(err) - continue - } - children, err := f.Readdir(-1) - f.Close() - if err != nil { - log.Print(err) - continue - } - for _, child := range children { - if child.IsDir() { - loadPkg(path, child.Name()) - } - } - } - // Populate exports global. - for _, ps := range pkgIndex { - for _, p := range ps { - e := loadExports(p.dir) - if e != nil { - exports[p.dir] = e - } - } - } - - // Construct source file. - var buf bytes.Buffer - fmt.Fprint(&buf, pkgIndexHead) - fmt.Fprintf(&buf, "var pkgIndexMaster = %#v\n", pkgIndex) - fmt.Fprintf(&buf, "var exportsMaster = %#v\n", exports) - src := buf.Bytes() - - // Replace main.pkg type name with pkg. - src = bytes.Replace(src, []byte("main.pkg"), []byte("pkg"), -1) - // Replace actual GOROOT with "/go". - src = bytes.Replace(src, []byte(ctx.GOROOT), []byte("/go"), -1) - // Add some line wrapping. - src = bytes.Replace(src, []byte("}, "), []byte("},\n"), -1) - src = bytes.Replace(src, []byte("true, "), []byte("true,\n"), -1) - - var err error - src, err = format.Source(src) - if err != nil { - log.Fatal(err) - } - - // Write out source file. - err = ioutil.WriteFile("pkgindex.go", src, 0644) - if err != nil { - log.Fatal(err) - } -} - -const pkgIndexHead = `package imports - -func init() { - pkgIndexOnce.Do(func() { - pkgIndex.m = pkgIndexMaster - }) - loadExports = func(dir string) map[string]bool { - return exportsMaster[dir] - } -} -` - -type pkg struct { - importpath string // full pkg import path, e.g. "net/http" - dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt" -} - -var fset = token.NewFileSet() - -func loadPkg(root, importpath string) { - shortName := path.Base(importpath) - if shortName == "testdata" { - return - } - - dir := filepath.Join(root, importpath) - pkgIndex[shortName] = append(pkgIndex[shortName], pkg{ - importpath: importpath, - dir: dir, - }) - - pkgDir, err := os.Open(dir) - if err != nil { - return - } - children, err := pkgDir.Readdir(-1) - pkgDir.Close() - if err != nil { - return - } - for _, child := range children { - name := child.Name() - if name == "" { - continue - } - if c := name[0]; c == '.' || ('0' <= c && c <= '9') { - continue - } - if child.IsDir() { - loadPkg(root, filepath.Join(importpath, name)) - } - } -} - -func loadExports(dir string) map[string]bool { - exports := make(map[string]bool) - buildPkg, err := build.ImportDir(dir, 0) - if err != nil { - if strings.Contains(err.Error(), "no buildable Go source files in") { - return nil - } - log.Printf("could not import %q: %v", dir, err) - return nil - } - for _, file := range buildPkg.GoFiles { - f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0) - if err != nil { - log.Printf("could not parse %q: %v", file, err) - continue - } - for name := range f.Scope.Objects { - if ast.IsExported(name) { - exports[name] = true - } - } - } - return exports -} diff --git a/vendor/golang.org/x/tools/imports/mkstdlib.go b/vendor/golang.org/x/tools/imports/mkstdlib.go deleted file mode 100644 index 62f3321..0000000 --- a/vendor/golang.org/x/tools/imports/mkstdlib.go +++ /dev/null @@ -1,102 +0,0 @@ -// +build ignore - -// mkstdlib generates the zstdlib.go file, containing the Go standard -// library API symbols. It's baked into the binary to avoid scanning -// GOPATH in the common case. -package main - -import ( - "bufio" - "bytes" - "fmt" - "go/format" - "io" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "regexp" - "sort" - "strings" -) - -func mustOpen(name string) io.Reader { - f, err := os.Open(name) - if err != nil { - log.Fatal(err) - } - return f -} - -func api(base string) string { - return filepath.Join(os.Getenv("GOROOT"), "api", base) -} - -var sym = regexp.MustCompile(`^pkg (\S+).*?, (?:var|func|type|const) ([A-Z]\w*)`) - -func main() { - var buf bytes.Buffer - outf := func(format string, args ...interface{}) { - fmt.Fprintf(&buf, format, args...) - } - outf("// AUTO-GENERATED BY mkstdlib.go\n\n") - outf("package imports\n") - outf("var stdlib = map[string]string{\n") - f := io.MultiReader( - mustOpen(api("go1.txt")), - mustOpen(api("go1.1.txt")), - mustOpen(api("go1.2.txt")), - mustOpen(api("go1.3.txt")), - mustOpen(api("go1.4.txt")), - mustOpen(api("go1.5.txt")), - mustOpen(api("go1.6.txt")), - ) - sc := bufio.NewScanner(f) - fullImport := map[string]string{} // "zip.NewReader" => "archive/zip" - ambiguous := map[string]bool{} - var keys []string - for sc.Scan() { - l := sc.Text() - has := func(v string) bool { return strings.Contains(l, v) } - if has("struct, ") || has("interface, ") || has(", method (") { - continue - } - if m := sym.FindStringSubmatch(l); m != nil { - full := m[1] - key := path.Base(full) + "." + m[2] - if exist, ok := fullImport[key]; ok { - if exist != full { - ambiguous[key] = true - } - } else { - fullImport[key] = full - keys = append(keys, key) - } - } - } - if err := sc.Err(); err != nil { - log.Fatal(err) - } - sort.Strings(keys) - for _, key := range keys { - if ambiguous[key] { - outf("\t// %q is ambiguous\n", key) - } else { - outf("\t%q: %q,\n", key, fullImport[key]) - } - } - outf("\n") - for _, sym := range [...]string{"Alignof", "ArbitraryType", "Offsetof", "Pointer", "Sizeof"} { - outf("\t%q: %q,\n", "unsafe."+sym, "unsafe") - } - outf("}\n") - fmtbuf, err := format.Source(buf.Bytes()) - if err != nil { - log.Fatal(err) - } - err = ioutil.WriteFile("zstdlib.go", fmtbuf, 0666) - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/golang.org/x/tools/imports/sortimports.go b/vendor/golang.org/x/tools/imports/sortimports.go deleted file mode 100644 index 653afc5..0000000 --- a/vendor/golang.org/x/tools/imports/sortimports.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Hacked up copy of go/ast/import.go - -package imports - -import ( - "go/ast" - "go/token" - "sort" - "strconv" -) - -// sortImports sorts runs of consecutive import lines in import blocks in f. -// It also removes duplicate imports when it is possible to do so without data loss. -func sortImports(fset *token.FileSet, f *ast.File) { - for i, d := range f.Decls { - d, ok := d.(*ast.GenDecl) - if !ok || d.Tok != token.IMPORT { - // Not an import declaration, so we're done. - // Imports are always first. - break - } - - if len(d.Specs) == 0 { - // Empty import block, remove it. - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - } - - if !d.Lparen.IsValid() { - // Not a block: sorted by default. - continue - } - - // Identify and sort runs of specs on successive lines. - i := 0 - specs := d.Specs[:0] - for j, s := range d.Specs { - if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line { - // j begins a new run. End this one. - specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...) - i = j - } - } - specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...) - d.Specs = specs - - // Deduping can leave a blank line before the rparen; clean that up. - if len(d.Specs) > 0 { - lastSpec := d.Specs[len(d.Specs)-1] - lastLine := fset.Position(lastSpec.Pos()).Line - if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 { - fset.File(d.Rparen).MergeLine(rParenLine - 1) - } - } - } -} - -func importPath(s ast.Spec) string { - t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) - if err == nil { - return t - } - return "" -} - -func importName(s ast.Spec) string { - n := s.(*ast.ImportSpec).Name - if n == nil { - return "" - } - return n.Name -} - -func importComment(s ast.Spec) string { - c := s.(*ast.ImportSpec).Comment - if c == nil { - return "" - } - return c.Text() -} - -// collapse indicates whether prev may be removed, leaving only next. -func collapse(prev, next ast.Spec) bool { - if importPath(next) != importPath(prev) || importName(next) != importName(prev) { - return false - } - return prev.(*ast.ImportSpec).Comment == nil -} - -type posSpan struct { - Start token.Pos - End token.Pos -} - -func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec { - // Can't short-circuit here even if specs are already sorted, - // since they might yet need deduplication. - // A lone import, however, may be safely ignored. - if len(specs) <= 1 { - return specs - } - - // Record positions for specs. - pos := make([]posSpan, len(specs)) - for i, s := range specs { - pos[i] = posSpan{s.Pos(), s.End()} - } - - // Identify comments in this range. - // Any comment from pos[0].Start to the final line counts. - lastLine := fset.Position(pos[len(pos)-1].End).Line - cstart := len(f.Comments) - cend := len(f.Comments) - for i, g := range f.Comments { - if g.Pos() < pos[0].Start { - continue - } - if i < cstart { - cstart = i - } - if fset.Position(g.End()).Line > lastLine { - cend = i - break - } - } - comments := f.Comments[cstart:cend] - - // Assign each comment to the import spec preceding it. - importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} - specIndex := 0 - for _, g := range comments { - for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { - specIndex++ - } - s := specs[specIndex].(*ast.ImportSpec) - importComment[s] = append(importComment[s], g) - } - - // Sort the import specs by import path. - // Remove duplicates, when possible without data loss. - // Reassign the import paths to have the same position sequence. - // Reassign each comment to abut the end of its spec. - // Sort the comments by new position. - sort.Sort(byImportSpec(specs)) - - // Dedup. Thanks to our sorting, we can just consider - // adjacent pairs of imports. - deduped := specs[:0] - for i, s := range specs { - if i == len(specs)-1 || !collapse(s, specs[i+1]) { - deduped = append(deduped, s) - } else { - p := s.Pos() - fset.File(p).MergeLine(fset.Position(p).Line) - } - } - specs = deduped - - // Fix up comment positions - for i, s := range specs { - s := s.(*ast.ImportSpec) - if s.Name != nil { - s.Name.NamePos = pos[i].Start - } - s.Path.ValuePos = pos[i].Start - s.EndPos = pos[i].End - for _, g := range importComment[s] { - for _, c := range g.List { - c.Slash = pos[i].End - } - } - } - - sort.Sort(byCommentPos(comments)) - - return specs -} - -type byImportSpec []ast.Spec // slice of *ast.ImportSpec - -func (x byImportSpec) Len() int { return len(x) } -func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byImportSpec) Less(i, j int) bool { - ipath := importPath(x[i]) - jpath := importPath(x[j]) - - igroup := importGroup(ipath) - jgroup := importGroup(jpath) - if igroup != jgroup { - return igroup < jgroup - } - - if ipath != jpath { - return ipath < jpath - } - iname := importName(x[i]) - jname := importName(x[j]) - - if iname != jname { - return iname < jname - } - return importComment(x[i]) < importComment(x[j]) -} - -type byCommentPos []*ast.CommentGroup - -func (x byCommentPos) Len() int { return len(x) } -func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/vendor/golang.org/x/tools/imports/zstdlib.go b/vendor/golang.org/x/tools/imports/zstdlib.go deleted file mode 100644 index eb89b2d..0000000 --- a/vendor/golang.org/x/tools/imports/zstdlib.go +++ /dev/null @@ -1,9162 +0,0 @@ -// AUTO-GENERATED BY mkstdlib.go - -package imports - -var stdlib = map[string]string{ - "adler32.Checksum": "hash/adler32", - "adler32.New": "hash/adler32", - "adler32.Size": "hash/adler32", - "aes.BlockSize": "crypto/aes", - "aes.KeySizeError": "crypto/aes", - "aes.NewCipher": "crypto/aes", - "ascii85.CorruptInputError": "encoding/ascii85", - "ascii85.Decode": "encoding/ascii85", - "ascii85.Encode": "encoding/ascii85", - "ascii85.MaxEncodedLen": "encoding/ascii85", - "ascii85.NewDecoder": "encoding/ascii85", - "ascii85.NewEncoder": "encoding/ascii85", - "asn1.BitString": "encoding/asn1", - "asn1.ClassApplication": "encoding/asn1", - "asn1.ClassContextSpecific": "encoding/asn1", - "asn1.ClassPrivate": "encoding/asn1", - "asn1.ClassUniversal": "encoding/asn1", - "asn1.Enumerated": "encoding/asn1", - "asn1.Flag": "encoding/asn1", - "asn1.Marshal": "encoding/asn1", - "asn1.ObjectIdentifier": "encoding/asn1", - "asn1.RawContent": "encoding/asn1", - "asn1.RawValue": "encoding/asn1", - "asn1.StructuralError": "encoding/asn1", - "asn1.SyntaxError": "encoding/asn1", - "asn1.TagBitString": "encoding/asn1", - "asn1.TagBoolean": "encoding/asn1", - "asn1.TagEnum": "encoding/asn1", - "asn1.TagGeneralString": "encoding/asn1", - "asn1.TagGeneralizedTime": "encoding/asn1", - "asn1.TagIA5String": "encoding/asn1", - "asn1.TagInteger": "encoding/asn1", - "asn1.TagOID": "encoding/asn1", - "asn1.TagOctetString": "encoding/asn1", - "asn1.TagPrintableString": "encoding/asn1", - "asn1.TagSequence": "encoding/asn1", - "asn1.TagSet": "encoding/asn1", - "asn1.TagT61String": "encoding/asn1", - "asn1.TagUTCTime": "encoding/asn1", - "asn1.TagUTF8String": "encoding/asn1", - "asn1.Unmarshal": "encoding/asn1", - "asn1.UnmarshalWithParams": "encoding/asn1", - "ast.ArrayType": "go/ast", - "ast.AssignStmt": "go/ast", - "ast.Bad": "go/ast", - "ast.BadDecl": "go/ast", - "ast.BadExpr": "go/ast", - "ast.BadStmt": "go/ast", - "ast.BasicLit": "go/ast", - "ast.BinaryExpr": "go/ast", - "ast.BlockStmt": "go/ast", - "ast.BranchStmt": "go/ast", - "ast.CallExpr": "go/ast", - "ast.CaseClause": "go/ast", - "ast.ChanDir": "go/ast", - "ast.ChanType": "go/ast", - "ast.CommClause": "go/ast", - "ast.Comment": "go/ast", - "ast.CommentGroup": "go/ast", - "ast.CommentMap": "go/ast", - "ast.CompositeLit": "go/ast", - "ast.Con": "go/ast", - "ast.DeclStmt": "go/ast", - "ast.DeferStmt": "go/ast", - "ast.Ellipsis": "go/ast", - "ast.EmptyStmt": "go/ast", - "ast.ExprStmt": "go/ast", - "ast.Field": "go/ast", - "ast.FieldFilter": "go/ast", - "ast.FieldList": "go/ast", - "ast.File": "go/ast", - "ast.FileExports": "go/ast", - "ast.Filter": "go/ast", - "ast.FilterDecl": "go/ast", - "ast.FilterFile": "go/ast", - "ast.FilterFuncDuplicates": "go/ast", - "ast.FilterImportDuplicates": "go/ast", - "ast.FilterPackage": "go/ast", - "ast.FilterUnassociatedComments": "go/ast", - "ast.ForStmt": "go/ast", - "ast.Fprint": "go/ast", - "ast.Fun": "go/ast", - "ast.FuncDecl": "go/ast", - "ast.FuncLit": "go/ast", - "ast.FuncType": "go/ast", - "ast.GenDecl": "go/ast", - "ast.GoStmt": "go/ast", - "ast.Ident": "go/ast", - "ast.IfStmt": "go/ast", - "ast.ImportSpec": "go/ast", - "ast.Importer": "go/ast", - "ast.IncDecStmt": "go/ast", - "ast.IndexExpr": "go/ast", - "ast.Inspect": "go/ast", - "ast.InterfaceType": "go/ast", - "ast.IsExported": "go/ast", - "ast.KeyValueExpr": "go/ast", - "ast.LabeledStmt": "go/ast", - "ast.Lbl": "go/ast", - "ast.MapType": "go/ast", - "ast.MergeMode": "go/ast", - "ast.MergePackageFiles": "go/ast", - "ast.NewCommentMap": "go/ast", - "ast.NewIdent": "go/ast", - "ast.NewObj": "go/ast", - "ast.NewPackage": "go/ast", - "ast.NewScope": "go/ast", - "ast.Node": "go/ast", - "ast.NotNilFilter": "go/ast", - "ast.ObjKind": "go/ast", - "ast.Object": "go/ast", - "ast.Package": "go/ast", - "ast.PackageExports": "go/ast", - "ast.ParenExpr": "go/ast", - "ast.Pkg": "go/ast", - "ast.Print": "go/ast", - "ast.RECV": "go/ast", - "ast.RangeStmt": "go/ast", - "ast.ReturnStmt": "go/ast", - "ast.SEND": "go/ast", - "ast.Scope": "go/ast", - "ast.SelectStmt": "go/ast", - "ast.SelectorExpr": "go/ast", - "ast.SendStmt": "go/ast", - "ast.SliceExpr": "go/ast", - "ast.SortImports": "go/ast", - "ast.StarExpr": "go/ast", - "ast.StructType": "go/ast", - "ast.SwitchStmt": "go/ast", - "ast.Typ": "go/ast", - "ast.TypeAssertExpr": "go/ast", - "ast.TypeSpec": "go/ast", - "ast.TypeSwitchStmt": "go/ast", - "ast.UnaryExpr": "go/ast", - "ast.ValueSpec": "go/ast", - "ast.Var": "go/ast", - "ast.Visitor": "go/ast", - "ast.Walk": "go/ast", - "atomic.AddInt32": "sync/atomic", - "atomic.AddInt64": "sync/atomic", - "atomic.AddUint32": "sync/atomic", - "atomic.AddUint64": "sync/atomic", - "atomic.AddUintptr": "sync/atomic", - "atomic.CompareAndSwapInt32": "sync/atomic", - "atomic.CompareAndSwapInt64": "sync/atomic", - "atomic.CompareAndSwapPointer": "sync/atomic", - "atomic.CompareAndSwapUint32": "sync/atomic", - "atomic.CompareAndSwapUint64": "sync/atomic", - "atomic.CompareAndSwapUintptr": "sync/atomic", - "atomic.LoadInt32": "sync/atomic", - "atomic.LoadInt64": "sync/atomic", - "atomic.LoadPointer": "sync/atomic", - "atomic.LoadUint32": "sync/atomic", - "atomic.LoadUint64": "sync/atomic", - "atomic.LoadUintptr": "sync/atomic", - "atomic.StoreInt32": "sync/atomic", - "atomic.StoreInt64": "sync/atomic", - "atomic.StorePointer": "sync/atomic", - "atomic.StoreUint32": "sync/atomic", - "atomic.StoreUint64": "sync/atomic", - "atomic.StoreUintptr": "sync/atomic", - "atomic.SwapInt32": "sync/atomic", - "atomic.SwapInt64": "sync/atomic", - "atomic.SwapPointer": "sync/atomic", - "atomic.SwapUint32": "sync/atomic", - "atomic.SwapUint64": "sync/atomic", - "atomic.SwapUintptr": "sync/atomic", - "atomic.Value": "sync/atomic", - "base32.CorruptInputError": "encoding/base32", - "base32.Encoding": "encoding/base32", - "base32.HexEncoding": "encoding/base32", - "base32.NewDecoder": "encoding/base32", - "base32.NewEncoder": "encoding/base32", - "base32.NewEncoding": "encoding/base32", - "base32.StdEncoding": "encoding/base32", - "base64.CorruptInputError": "encoding/base64", - "base64.Encoding": "encoding/base64", - "base64.NewDecoder": "encoding/base64", - "base64.NewEncoder": "encoding/base64", - "base64.NewEncoding": "encoding/base64", - "base64.NoPadding": "encoding/base64", - "base64.RawStdEncoding": "encoding/base64", - "base64.RawURLEncoding": "encoding/base64", - "base64.StdEncoding": "encoding/base64", - "base64.StdPadding": "encoding/base64", - "base64.URLEncoding": "encoding/base64", - "big.Above": "math/big", - "big.Accuracy": "math/big", - "big.AwayFromZero": "math/big", - "big.Below": "math/big", - "big.ErrNaN": "math/big", - "big.Exact": "math/big", - "big.Float": "math/big", - "big.Int": "math/big", - "big.Jacobi": "math/big", - "big.MaxBase": "math/big", - "big.MaxExp": "math/big", - "big.MaxPrec": "math/big", - "big.MinExp": "math/big", - "big.NewFloat": "math/big", - "big.NewInt": "math/big", - "big.NewRat": "math/big", - "big.ParseFloat": "math/big", - "big.Rat": "math/big", - "big.RoundingMode": "math/big", - "big.ToNearestAway": "math/big", - "big.ToNearestEven": "math/big", - "big.ToNegativeInf": "math/big", - "big.ToPositiveInf": "math/big", - "big.ToZero": "math/big", - "big.Word": "math/big", - "binary.BigEndian": "encoding/binary", - "binary.ByteOrder": "encoding/binary", - "binary.LittleEndian": "encoding/binary", - "binary.MaxVarintLen16": "encoding/binary", - "binary.MaxVarintLen32": "encoding/binary", - "binary.MaxVarintLen64": "encoding/binary", - "binary.PutUvarint": "encoding/binary", - "binary.PutVarint": "encoding/binary", - "binary.Read": "encoding/binary", - "binary.ReadUvarint": "encoding/binary", - "binary.ReadVarint": "encoding/binary", - "binary.Size": "encoding/binary", - "binary.Uvarint": "encoding/binary", - "binary.Varint": "encoding/binary", - "binary.Write": "encoding/binary", - "bufio.ErrAdvanceTooFar": "bufio", - "bufio.ErrBufferFull": "bufio", - "bufio.ErrFinalToken": "bufio", - "bufio.ErrInvalidUnreadByte": "bufio", - "bufio.ErrInvalidUnreadRune": "bufio", - "bufio.ErrNegativeAdvance": "bufio", - "bufio.ErrNegativeCount": "bufio", - "bufio.ErrTooLong": "bufio", - "bufio.MaxScanTokenSize": "bufio", - "bufio.NewReadWriter": "bufio", - "bufio.NewReader": "bufio", - "bufio.NewReaderSize": "bufio", - "bufio.NewScanner": "bufio", - "bufio.NewWriter": "bufio", - "bufio.NewWriterSize": "bufio", - "bufio.ReadWriter": "bufio", - "bufio.Reader": "bufio", - "bufio.ScanBytes": "bufio", - "bufio.ScanLines": "bufio", - "bufio.ScanRunes": "bufio", - "bufio.ScanWords": "bufio", - "bufio.Scanner": "bufio", - "bufio.SplitFunc": "bufio", - "bufio.Writer": "bufio", - "build.AllowBinary": "go/build", - "build.ArchChar": "go/build", - "build.Context": "go/build", - "build.Default": "go/build", - "build.FindOnly": "go/build", - "build.IgnoreVendor": "go/build", - "build.Import": "go/build", - "build.ImportComment": "go/build", - "build.ImportDir": "go/build", - "build.ImportMode": "go/build", - "build.IsLocalImport": "go/build", - "build.MultiplePackageError": "go/build", - "build.NoGoError": "go/build", - "build.Package": "go/build", - "build.ToolDir": "go/build", - "bytes.Buffer": "bytes", - "bytes.Compare": "bytes", - "bytes.Contains": "bytes", - "bytes.Count": "bytes", - "bytes.Equal": "bytes", - "bytes.EqualFold": "bytes", - "bytes.ErrTooLarge": "bytes", - "bytes.Fields": "bytes", - "bytes.FieldsFunc": "bytes", - "bytes.HasPrefix": "bytes", - "bytes.HasSuffix": "bytes", - "bytes.Index": "bytes", - "bytes.IndexAny": "bytes", - "bytes.IndexByte": "bytes", - "bytes.IndexFunc": "bytes", - "bytes.IndexRune": "bytes", - "bytes.Join": "bytes", - "bytes.LastIndex": "bytes", - "bytes.LastIndexAny": "bytes", - "bytes.LastIndexByte": "bytes", - "bytes.LastIndexFunc": "bytes", - "bytes.Map": "bytes", - "bytes.MinRead": "bytes", - "bytes.NewBuffer": "bytes", - "bytes.NewBufferString": "bytes", - "bytes.NewReader": "bytes", - "bytes.Reader": "bytes", - "bytes.Repeat": "bytes", - "bytes.Replace": "bytes", - "bytes.Runes": "bytes", - "bytes.Split": "bytes", - "bytes.SplitAfter": "bytes", - "bytes.SplitAfterN": "bytes", - "bytes.SplitN": "bytes", - "bytes.Title": "bytes", - "bytes.ToLower": "bytes", - "bytes.ToLowerSpecial": "bytes", - "bytes.ToTitle": "bytes", - "bytes.ToTitleSpecial": "bytes", - "bytes.ToUpper": "bytes", - "bytes.ToUpperSpecial": "bytes", - "bytes.Trim": "bytes", - "bytes.TrimFunc": "bytes", - "bytes.TrimLeft": "bytes", - "bytes.TrimLeftFunc": "bytes", - "bytes.TrimPrefix": "bytes", - "bytes.TrimRight": "bytes", - "bytes.TrimRightFunc": "bytes", - "bytes.TrimSpace": "bytes", - "bytes.TrimSuffix": "bytes", - "bzip2.NewReader": "compress/bzip2", - "bzip2.StructuralError": "compress/bzip2", - "cgi.Handler": "net/http/cgi", - "cgi.Request": "net/http/cgi", - "cgi.RequestFromMap": "net/http/cgi", - "cgi.Serve": "net/http/cgi", - "cipher.AEAD": "crypto/cipher", - "cipher.Block": "crypto/cipher", - "cipher.BlockMode": "crypto/cipher", - "cipher.NewCBCDecrypter": "crypto/cipher", - "cipher.NewCBCEncrypter": "crypto/cipher", - "cipher.NewCFBDecrypter": "crypto/cipher", - "cipher.NewCFBEncrypter": "crypto/cipher", - "cipher.NewCTR": "crypto/cipher", - "cipher.NewGCM": "crypto/cipher", - "cipher.NewGCMWithNonceSize": "crypto/cipher", - "cipher.NewOFB": "crypto/cipher", - "cipher.Stream": "crypto/cipher", - "cipher.StreamReader": "crypto/cipher", - "cipher.StreamWriter": "crypto/cipher", - "cmplx.Abs": "math/cmplx", - "cmplx.Acos": "math/cmplx", - "cmplx.Acosh": "math/cmplx", - "cmplx.Asin": "math/cmplx", - "cmplx.Asinh": "math/cmplx", - "cmplx.Atan": "math/cmplx", - "cmplx.Atanh": "math/cmplx", - "cmplx.Conj": "math/cmplx", - "cmplx.Cos": "math/cmplx", - "cmplx.Cosh": "math/cmplx", - "cmplx.Cot": "math/cmplx", - "cmplx.Exp": "math/cmplx", - "cmplx.Inf": "math/cmplx", - "cmplx.IsInf": "math/cmplx", - "cmplx.IsNaN": "math/cmplx", - "cmplx.Log": "math/cmplx", - "cmplx.Log10": "math/cmplx", - "cmplx.NaN": "math/cmplx", - "cmplx.Phase": "math/cmplx", - "cmplx.Polar": "math/cmplx", - "cmplx.Pow": "math/cmplx", - "cmplx.Rect": "math/cmplx", - "cmplx.Sin": "math/cmplx", - "cmplx.Sinh": "math/cmplx", - "cmplx.Sqrt": "math/cmplx", - "cmplx.Tan": "math/cmplx", - "cmplx.Tanh": "math/cmplx", - "color.Alpha": "image/color", - "color.Alpha16": "image/color", - "color.Alpha16Model": "image/color", - "color.AlphaModel": "image/color", - "color.Black": "image/color", - "color.CMYK": "image/color", - "color.CMYKModel": "image/color", - "color.CMYKToRGB": "image/color", - "color.Color": "image/color", - "color.Gray": "image/color", - "color.Gray16": "image/color", - "color.Gray16Model": "image/color", - "color.GrayModel": "image/color", - "color.Model": "image/color", - "color.ModelFunc": "image/color", - "color.NRGBA": "image/color", - "color.NRGBA64": "image/color", - "color.NRGBA64Model": "image/color", - "color.NRGBAModel": "image/color", - "color.NYCbCrA": "image/color", - "color.NYCbCrAModel": "image/color", - "color.Opaque": "image/color", - "color.Palette": "image/color", - "color.RGBA": "image/color", - "color.RGBA64": "image/color", - "color.RGBA64Model": "image/color", - "color.RGBAModel": "image/color", - "color.RGBToCMYK": "image/color", - "color.RGBToYCbCr": "image/color", - "color.Transparent": "image/color", - "color.White": "image/color", - "color.YCbCr": "image/color", - "color.YCbCrModel": "image/color", - "color.YCbCrToRGB": "image/color", - "constant.BinaryOp": "go/constant", - "constant.BitLen": "go/constant", - "constant.Bool": "go/constant", - "constant.BoolVal": "go/constant", - "constant.Bytes": "go/constant", - "constant.Compare": "go/constant", - "constant.Complex": "go/constant", - "constant.Denom": "go/constant", - "constant.Float": "go/constant", - "constant.Float32Val": "go/constant", - "constant.Float64Val": "go/constant", - "constant.Imag": "go/constant", - "constant.Int": "go/constant", - "constant.Int64Val": "go/constant", - "constant.Kind": "go/constant", - "constant.MakeBool": "go/constant", - "constant.MakeFloat64": "go/constant", - "constant.MakeFromBytes": "go/constant", - "constant.MakeFromLiteral": "go/constant", - "constant.MakeImag": "go/constant", - "constant.MakeInt64": "go/constant", - "constant.MakeString": "go/constant", - "constant.MakeUint64": "go/constant", - "constant.MakeUnknown": "go/constant", - "constant.Num": "go/constant", - "constant.Real": "go/constant", - "constant.Shift": "go/constant", - "constant.Sign": "go/constant", - "constant.String": "go/constant", - "constant.StringVal": "go/constant", - "constant.ToComplex": "go/constant", - "constant.ToFloat": "go/constant", - "constant.ToInt": "go/constant", - "constant.Uint64Val": "go/constant", - "constant.UnaryOp": "go/constant", - "constant.Unknown": "go/constant", - "cookiejar.Jar": "net/http/cookiejar", - "cookiejar.New": "net/http/cookiejar", - "cookiejar.Options": "net/http/cookiejar", - "cookiejar.PublicSuffixList": "net/http/cookiejar", - "crc32.Castagnoli": "hash/crc32", - "crc32.Checksum": "hash/crc32", - "crc32.ChecksumIEEE": "hash/crc32", - "crc32.IEEE": "hash/crc32", - "crc32.IEEETable": "hash/crc32", - "crc32.Koopman": "hash/crc32", - "crc32.MakeTable": "hash/crc32", - "crc32.New": "hash/crc32", - "crc32.NewIEEE": "hash/crc32", - "crc32.Size": "hash/crc32", - "crc32.Table": "hash/crc32", - "crc32.Update": "hash/crc32", - "crc64.Checksum": "hash/crc64", - "crc64.ECMA": "hash/crc64", - "crc64.ISO": "hash/crc64", - "crc64.MakeTable": "hash/crc64", - "crc64.New": "hash/crc64", - "crc64.Size": "hash/crc64", - "crc64.Table": "hash/crc64", - "crc64.Update": "hash/crc64", - "crypto.Decrypter": "crypto", - "crypto.DecrypterOpts": "crypto", - "crypto.Hash": "crypto", - "crypto.MD4": "crypto", - "crypto.MD5": "crypto", - "crypto.MD5SHA1": "crypto", - "crypto.PrivateKey": "crypto", - "crypto.PublicKey": "crypto", - "crypto.RIPEMD160": "crypto", - "crypto.RegisterHash": "crypto", - "crypto.SHA1": "crypto", - "crypto.SHA224": "crypto", - "crypto.SHA256": "crypto", - "crypto.SHA384": "crypto", - "crypto.SHA3_224": "crypto", - "crypto.SHA3_256": "crypto", - "crypto.SHA3_384": "crypto", - "crypto.SHA3_512": "crypto", - "crypto.SHA512": "crypto", - "crypto.SHA512_224": "crypto", - "crypto.SHA512_256": "crypto", - "crypto.Signer": "crypto", - "crypto.SignerOpts": "crypto", - "csv.ErrBareQuote": "encoding/csv", - "csv.ErrFieldCount": "encoding/csv", - "csv.ErrQuote": "encoding/csv", - "csv.ErrTrailingComma": "encoding/csv", - "csv.NewReader": "encoding/csv", - "csv.NewWriter": "encoding/csv", - "csv.ParseError": "encoding/csv", - "csv.Reader": "encoding/csv", - "csv.Writer": "encoding/csv", - "debug.FreeOSMemory": "runtime/debug", - "debug.GCStats": "runtime/debug", - "debug.PrintStack": "runtime/debug", - "debug.ReadGCStats": "runtime/debug", - "debug.SetGCPercent": "runtime/debug", - "debug.SetMaxStack": "runtime/debug", - "debug.SetMaxThreads": "runtime/debug", - "debug.SetPanicOnFault": "runtime/debug", - "debug.SetTraceback": "runtime/debug", - "debug.Stack": "runtime/debug", - "debug.WriteHeapDump": "runtime/debug", - "des.BlockSize": "crypto/des", - "des.KeySizeError": "crypto/des", - "des.NewCipher": "crypto/des", - "des.NewTripleDESCipher": "crypto/des", - "doc.AllDecls": "go/doc", - "doc.AllMethods": "go/doc", - "doc.Example": "go/doc", - "doc.Examples": "go/doc", - "doc.Filter": "go/doc", - "doc.Func": "go/doc", - "doc.IllegalPrefixes": "go/doc", - "doc.Mode": "go/doc", - "doc.New": "go/doc", - "doc.Note": "go/doc", - "doc.Package": "go/doc", - "doc.Synopsis": "go/doc", - "doc.ToHTML": "go/doc", - "doc.ToText": "go/doc", - "doc.Type": "go/doc", - "doc.Value": "go/doc", - "draw.Draw": "image/draw", - "draw.DrawMask": "image/draw", - "draw.Drawer": "image/draw", - "draw.FloydSteinberg": "image/draw", - "draw.Image": "image/draw", - "draw.Op": "image/draw", - "draw.Over": "image/draw", - "draw.Quantizer": "image/draw", - "draw.Src": "image/draw", - "driver.Bool": "database/sql/driver", - "driver.ColumnConverter": "database/sql/driver", - "driver.Conn": "database/sql/driver", - "driver.DefaultParameterConverter": "database/sql/driver", - "driver.Driver": "database/sql/driver", - "driver.ErrBadConn": "database/sql/driver", - "driver.ErrSkip": "database/sql/driver", - "driver.Execer": "database/sql/driver", - "driver.Int32": "database/sql/driver", - "driver.IsScanValue": "database/sql/driver", - "driver.IsValue": "database/sql/driver", - "driver.NotNull": "database/sql/driver", - "driver.Null": "database/sql/driver", - "driver.Queryer": "database/sql/driver", - "driver.Result": "database/sql/driver", - "driver.ResultNoRows": "database/sql/driver", - "driver.Rows": "database/sql/driver", - "driver.RowsAffected": "database/sql/driver", - "driver.Stmt": "database/sql/driver", - "driver.String": "database/sql/driver", - "driver.Tx": "database/sql/driver", - "driver.Value": "database/sql/driver", - "driver.ValueConverter": "database/sql/driver", - "driver.Valuer": "database/sql/driver", - "dsa.ErrInvalidPublicKey": "crypto/dsa", - "dsa.GenerateKey": "crypto/dsa", - "dsa.GenerateParameters": "crypto/dsa", - "dsa.L1024N160": "crypto/dsa", - "dsa.L2048N224": "crypto/dsa", - "dsa.L2048N256": "crypto/dsa", - "dsa.L3072N256": "crypto/dsa", - "dsa.ParameterSizes": "crypto/dsa", - "dsa.Parameters": "crypto/dsa", - "dsa.PrivateKey": "crypto/dsa", - "dsa.PublicKey": "crypto/dsa", - "dsa.Sign": "crypto/dsa", - "dsa.Verify": "crypto/dsa", - "dwarf.AddrType": "debug/dwarf", - "dwarf.ArrayType": "debug/dwarf", - "dwarf.Attr": "debug/dwarf", - "dwarf.AttrAbstractOrigin": "debug/dwarf", - "dwarf.AttrAccessibility": "debug/dwarf", - "dwarf.AttrAddrClass": "debug/dwarf", - "dwarf.AttrAllocated": "debug/dwarf", - "dwarf.AttrArtificial": "debug/dwarf", - "dwarf.AttrAssociated": "debug/dwarf", - "dwarf.AttrBaseTypes": "debug/dwarf", - "dwarf.AttrBitOffset": "debug/dwarf", - "dwarf.AttrBitSize": "debug/dwarf", - "dwarf.AttrByteSize": "debug/dwarf", - "dwarf.AttrCallColumn": "debug/dwarf", - "dwarf.AttrCallFile": "debug/dwarf", - "dwarf.AttrCallLine": "debug/dwarf", - "dwarf.AttrCalling": "debug/dwarf", - "dwarf.AttrCommonRef": "debug/dwarf", - "dwarf.AttrCompDir": "debug/dwarf", - "dwarf.AttrConstValue": "debug/dwarf", - "dwarf.AttrContainingType": "debug/dwarf", - "dwarf.AttrCount": "debug/dwarf", - "dwarf.AttrDataLocation": "debug/dwarf", - "dwarf.AttrDataMemberLoc": "debug/dwarf", - "dwarf.AttrDeclColumn": "debug/dwarf", - "dwarf.AttrDeclFile": "debug/dwarf", - "dwarf.AttrDeclLine": "debug/dwarf", - "dwarf.AttrDeclaration": "debug/dwarf", - "dwarf.AttrDefaultValue": "debug/dwarf", - "dwarf.AttrDescription": "debug/dwarf", - "dwarf.AttrDiscr": "debug/dwarf", - "dwarf.AttrDiscrList": "debug/dwarf", - "dwarf.AttrDiscrValue": "debug/dwarf", - "dwarf.AttrEncoding": "debug/dwarf", - "dwarf.AttrEntrypc": "debug/dwarf", - "dwarf.AttrExtension": "debug/dwarf", - "dwarf.AttrExternal": "debug/dwarf", - "dwarf.AttrFrameBase": "debug/dwarf", - "dwarf.AttrFriend": "debug/dwarf", - "dwarf.AttrHighpc": "debug/dwarf", - "dwarf.AttrIdentifierCase": "debug/dwarf", - "dwarf.AttrImport": "debug/dwarf", - "dwarf.AttrInline": "debug/dwarf", - "dwarf.AttrIsOptional": "debug/dwarf", - "dwarf.AttrLanguage": "debug/dwarf", - "dwarf.AttrLocation": "debug/dwarf", - "dwarf.AttrLowerBound": "debug/dwarf", - "dwarf.AttrLowpc": "debug/dwarf", - "dwarf.AttrMacroInfo": "debug/dwarf", - "dwarf.AttrName": "debug/dwarf", - "dwarf.AttrNamelistItem": "debug/dwarf", - "dwarf.AttrOrdering": "debug/dwarf", - "dwarf.AttrPriority": "debug/dwarf", - "dwarf.AttrProducer": "debug/dwarf", - "dwarf.AttrPrototyped": "debug/dwarf", - "dwarf.AttrRanges": "debug/dwarf", - "dwarf.AttrReturnAddr": "debug/dwarf", - "dwarf.AttrSegment": "debug/dwarf", - "dwarf.AttrSibling": "debug/dwarf", - "dwarf.AttrSpecification": "debug/dwarf", - "dwarf.AttrStartScope": "debug/dwarf", - "dwarf.AttrStaticLink": "debug/dwarf", - "dwarf.AttrStmtList": "debug/dwarf", - "dwarf.AttrStride": "debug/dwarf", - "dwarf.AttrStrideSize": "debug/dwarf", - "dwarf.AttrStringLength": "debug/dwarf", - "dwarf.AttrTrampoline": "debug/dwarf", - "dwarf.AttrType": "debug/dwarf", - "dwarf.AttrUpperBound": "debug/dwarf", - "dwarf.AttrUseLocation": "debug/dwarf", - "dwarf.AttrUseUTF8": "debug/dwarf", - "dwarf.AttrVarParam": "debug/dwarf", - "dwarf.AttrVirtuality": "debug/dwarf", - "dwarf.AttrVisibility": "debug/dwarf", - "dwarf.AttrVtableElemLoc": "debug/dwarf", - "dwarf.BasicType": "debug/dwarf", - "dwarf.BoolType": "debug/dwarf", - "dwarf.CharType": "debug/dwarf", - "dwarf.Class": "debug/dwarf", - "dwarf.ClassAddress": "debug/dwarf", - "dwarf.ClassBlock": "debug/dwarf", - "dwarf.ClassConstant": "debug/dwarf", - "dwarf.ClassExprLoc": "debug/dwarf", - "dwarf.ClassFlag": "debug/dwarf", - "dwarf.ClassLinePtr": "debug/dwarf", - "dwarf.ClassLocListPtr": "debug/dwarf", - "dwarf.ClassMacPtr": "debug/dwarf", - "dwarf.ClassRangeListPtr": "debug/dwarf", - "dwarf.ClassReference": "debug/dwarf", - "dwarf.ClassReferenceAlt": "debug/dwarf", - "dwarf.ClassReferenceSig": "debug/dwarf", - "dwarf.ClassString": "debug/dwarf", - "dwarf.ClassStringAlt": "debug/dwarf", - "dwarf.ClassUnknown": "debug/dwarf", - "dwarf.CommonType": "debug/dwarf", - "dwarf.ComplexType": "debug/dwarf", - "dwarf.Data": "debug/dwarf", - "dwarf.DecodeError": "debug/dwarf", - "dwarf.DotDotDotType": "debug/dwarf", - "dwarf.Entry": "debug/dwarf", - "dwarf.EnumType": "debug/dwarf", - "dwarf.EnumValue": "debug/dwarf", - "dwarf.ErrUnknownPC": "debug/dwarf", - "dwarf.Field": "debug/dwarf", - "dwarf.FloatType": "debug/dwarf", - "dwarf.FuncType": "debug/dwarf", - "dwarf.IntType": "debug/dwarf", - "dwarf.LineEntry": "debug/dwarf", - "dwarf.LineFile": "debug/dwarf", - "dwarf.LineReader": "debug/dwarf", - "dwarf.LineReaderPos": "debug/dwarf", - "dwarf.New": "debug/dwarf", - "dwarf.Offset": "debug/dwarf", - "dwarf.PtrType": "debug/dwarf", - "dwarf.QualType": "debug/dwarf", - "dwarf.Reader": "debug/dwarf", - "dwarf.StructField": "debug/dwarf", - "dwarf.StructType": "debug/dwarf", - "dwarf.Tag": "debug/dwarf", - "dwarf.TagAccessDeclaration": "debug/dwarf", - "dwarf.TagArrayType": "debug/dwarf", - "dwarf.TagBaseType": "debug/dwarf", - "dwarf.TagCatchDwarfBlock": "debug/dwarf", - "dwarf.TagClassType": "debug/dwarf", - "dwarf.TagCommonDwarfBlock": "debug/dwarf", - "dwarf.TagCommonInclusion": "debug/dwarf", - "dwarf.TagCompileUnit": "debug/dwarf", - "dwarf.TagCondition": "debug/dwarf", - "dwarf.TagConstType": "debug/dwarf", - "dwarf.TagConstant": "debug/dwarf", - "dwarf.TagDwarfProcedure": "debug/dwarf", - "dwarf.TagEntryPoint": "debug/dwarf", - "dwarf.TagEnumerationType": "debug/dwarf", - "dwarf.TagEnumerator": "debug/dwarf", - "dwarf.TagFileType": "debug/dwarf", - "dwarf.TagFormalParameter": "debug/dwarf", - "dwarf.TagFriend": "debug/dwarf", - "dwarf.TagImportedDeclaration": "debug/dwarf", - "dwarf.TagImportedModule": "debug/dwarf", - "dwarf.TagImportedUnit": "debug/dwarf", - "dwarf.TagInheritance": "debug/dwarf", - "dwarf.TagInlinedSubroutine": "debug/dwarf", - "dwarf.TagInterfaceType": "debug/dwarf", - "dwarf.TagLabel": "debug/dwarf", - "dwarf.TagLexDwarfBlock": "debug/dwarf", - "dwarf.TagMember": "debug/dwarf", - "dwarf.TagModule": "debug/dwarf", - "dwarf.TagMutableType": "debug/dwarf", - "dwarf.TagNamelist": "debug/dwarf", - "dwarf.TagNamelistItem": "debug/dwarf", - "dwarf.TagNamespace": "debug/dwarf", - "dwarf.TagPackedType": "debug/dwarf", - "dwarf.TagPartialUnit": "debug/dwarf", - "dwarf.TagPointerType": "debug/dwarf", - "dwarf.TagPtrToMemberType": "debug/dwarf", - "dwarf.TagReferenceType": "debug/dwarf", - "dwarf.TagRestrictType": "debug/dwarf", - "dwarf.TagRvalueReferenceType": "debug/dwarf", - "dwarf.TagSetType": "debug/dwarf", - "dwarf.TagSharedType": "debug/dwarf", - "dwarf.TagStringType": "debug/dwarf", - "dwarf.TagStructType": "debug/dwarf", - "dwarf.TagSubprogram": "debug/dwarf", - "dwarf.TagSubrangeType": "debug/dwarf", - "dwarf.TagSubroutineType": "debug/dwarf", - "dwarf.TagTemplateAlias": "debug/dwarf", - "dwarf.TagTemplateTypeParameter": "debug/dwarf", - "dwarf.TagTemplateValueParameter": "debug/dwarf", - "dwarf.TagThrownType": "debug/dwarf", - "dwarf.TagTryDwarfBlock": "debug/dwarf", - "dwarf.TagTypeUnit": "debug/dwarf", - "dwarf.TagTypedef": "debug/dwarf", - "dwarf.TagUnionType": "debug/dwarf", - "dwarf.TagUnspecifiedParameters": "debug/dwarf", - "dwarf.TagUnspecifiedType": "debug/dwarf", - "dwarf.TagVariable": "debug/dwarf", - "dwarf.TagVariant": "debug/dwarf", - "dwarf.TagVariantPart": "debug/dwarf", - "dwarf.TagVolatileType": "debug/dwarf", - "dwarf.TagWithStmt": "debug/dwarf", - "dwarf.Type": "debug/dwarf", - "dwarf.TypedefType": "debug/dwarf", - "dwarf.UcharType": "debug/dwarf", - "dwarf.UintType": "debug/dwarf", - "dwarf.UnspecifiedType": "debug/dwarf", - "dwarf.VoidType": "debug/dwarf", - "ecdsa.GenerateKey": "crypto/ecdsa", - "ecdsa.PrivateKey": "crypto/ecdsa", - "ecdsa.PublicKey": "crypto/ecdsa", - "ecdsa.Sign": "crypto/ecdsa", - "ecdsa.Verify": "crypto/ecdsa", - "elf.ARM_MAGIC_TRAMP_NUMBER": "debug/elf", - "elf.COMPRESS_HIOS": "debug/elf", - "elf.COMPRESS_HIPROC": "debug/elf", - "elf.COMPRESS_LOOS": "debug/elf", - "elf.COMPRESS_LOPROC": "debug/elf", - "elf.COMPRESS_ZLIB": "debug/elf", - "elf.Chdr32": "debug/elf", - "elf.Chdr64": "debug/elf", - "elf.Class": "debug/elf", - "elf.CompressionType": "debug/elf", - "elf.DF_BIND_NOW": "debug/elf", - "elf.DF_ORIGIN": "debug/elf", - "elf.DF_STATIC_TLS": "debug/elf", - "elf.DF_SYMBOLIC": "debug/elf", - "elf.DF_TEXTREL": "debug/elf", - "elf.DT_BIND_NOW": "debug/elf", - "elf.DT_DEBUG": "debug/elf", - "elf.DT_ENCODING": "debug/elf", - "elf.DT_FINI": "debug/elf", - "elf.DT_FINI_ARRAY": "debug/elf", - "elf.DT_FINI_ARRAYSZ": "debug/elf", - "elf.DT_FLAGS": "debug/elf", - "elf.DT_HASH": "debug/elf", - "elf.DT_HIOS": "debug/elf", - "elf.DT_HIPROC": "debug/elf", - "elf.DT_INIT": "debug/elf", - "elf.DT_INIT_ARRAY": "debug/elf", - "elf.DT_INIT_ARRAYSZ": "debug/elf", - "elf.DT_JMPREL": "debug/elf", - "elf.DT_LOOS": "debug/elf", - "elf.DT_LOPROC": "debug/elf", - "elf.DT_NEEDED": "debug/elf", - "elf.DT_NULL": "debug/elf", - "elf.DT_PLTGOT": "debug/elf", - "elf.DT_PLTREL": "debug/elf", - "elf.DT_PLTRELSZ": "debug/elf", - "elf.DT_PREINIT_ARRAY": "debug/elf", - "elf.DT_PREINIT_ARRAYSZ": "debug/elf", - "elf.DT_REL": "debug/elf", - "elf.DT_RELA": "debug/elf", - "elf.DT_RELAENT": "debug/elf", - "elf.DT_RELASZ": "debug/elf", - "elf.DT_RELENT": "debug/elf", - "elf.DT_RELSZ": "debug/elf", - "elf.DT_RPATH": "debug/elf", - "elf.DT_RUNPATH": "debug/elf", - "elf.DT_SONAME": "debug/elf", - "elf.DT_STRSZ": "debug/elf", - "elf.DT_STRTAB": "debug/elf", - "elf.DT_SYMBOLIC": "debug/elf", - "elf.DT_SYMENT": "debug/elf", - "elf.DT_SYMTAB": "debug/elf", - "elf.DT_TEXTREL": "debug/elf", - "elf.DT_VERNEED": "debug/elf", - "elf.DT_VERNEEDNUM": "debug/elf", - "elf.DT_VERSYM": "debug/elf", - "elf.Data": "debug/elf", - "elf.Dyn32": "debug/elf", - "elf.Dyn64": "debug/elf", - "elf.DynFlag": "debug/elf", - "elf.DynTag": "debug/elf", - "elf.EI_ABIVERSION": "debug/elf", - "elf.EI_CLASS": "debug/elf", - "elf.EI_DATA": "debug/elf", - "elf.EI_NIDENT": "debug/elf", - "elf.EI_OSABI": "debug/elf", - "elf.EI_PAD": "debug/elf", - "elf.EI_VERSION": "debug/elf", - "elf.ELFCLASS32": "debug/elf", - "elf.ELFCLASS64": "debug/elf", - "elf.ELFCLASSNONE": "debug/elf", - "elf.ELFDATA2LSB": "debug/elf", - "elf.ELFDATA2MSB": "debug/elf", - "elf.ELFDATANONE": "debug/elf", - "elf.ELFMAG": "debug/elf", - "elf.ELFOSABI_86OPEN": "debug/elf", - "elf.ELFOSABI_AIX": "debug/elf", - "elf.ELFOSABI_ARM": "debug/elf", - "elf.ELFOSABI_FREEBSD": "debug/elf", - "elf.ELFOSABI_HPUX": "debug/elf", - "elf.ELFOSABI_HURD": "debug/elf", - "elf.ELFOSABI_IRIX": "debug/elf", - "elf.ELFOSABI_LINUX": "debug/elf", - "elf.ELFOSABI_MODESTO": "debug/elf", - "elf.ELFOSABI_NETBSD": "debug/elf", - "elf.ELFOSABI_NONE": "debug/elf", - "elf.ELFOSABI_NSK": "debug/elf", - "elf.ELFOSABI_OPENBSD": "debug/elf", - "elf.ELFOSABI_OPENVMS": "debug/elf", - "elf.ELFOSABI_SOLARIS": "debug/elf", - "elf.ELFOSABI_STANDALONE": "debug/elf", - "elf.ELFOSABI_TRU64": "debug/elf", - "elf.EM_386": "debug/elf", - "elf.EM_486": "debug/elf", - "elf.EM_68HC12": "debug/elf", - "elf.EM_68K": "debug/elf", - "elf.EM_860": "debug/elf", - "elf.EM_88K": "debug/elf", - "elf.EM_960": "debug/elf", - "elf.EM_AARCH64": "debug/elf", - "elf.EM_ALPHA": "debug/elf", - "elf.EM_ALPHA_STD": "debug/elf", - "elf.EM_ARC": "debug/elf", - "elf.EM_ARM": "debug/elf", - "elf.EM_COLDFIRE": "debug/elf", - "elf.EM_FR20": "debug/elf", - "elf.EM_H8S": "debug/elf", - "elf.EM_H8_300": "debug/elf", - "elf.EM_H8_300H": "debug/elf", - "elf.EM_H8_500": "debug/elf", - "elf.EM_IA_64": "debug/elf", - "elf.EM_M32": "debug/elf", - "elf.EM_ME16": "debug/elf", - "elf.EM_MIPS": "debug/elf", - "elf.EM_MIPS_RS3_LE": "debug/elf", - "elf.EM_MIPS_RS4_BE": "debug/elf", - "elf.EM_MIPS_X": "debug/elf", - "elf.EM_MMA": "debug/elf", - "elf.EM_NCPU": "debug/elf", - "elf.EM_NDR1": "debug/elf", - "elf.EM_NONE": "debug/elf", - "elf.EM_PARISC": "debug/elf", - "elf.EM_PCP": "debug/elf", - "elf.EM_PPC": "debug/elf", - "elf.EM_PPC64": "debug/elf", - "elf.EM_RCE": "debug/elf", - "elf.EM_RH32": "debug/elf", - "elf.EM_S370": "debug/elf", - "elf.EM_S390": "debug/elf", - "elf.EM_SH": "debug/elf", - "elf.EM_SPARC": "debug/elf", - "elf.EM_SPARC32PLUS": "debug/elf", - "elf.EM_SPARCV9": "debug/elf", - "elf.EM_ST100": "debug/elf", - "elf.EM_STARCORE": "debug/elf", - "elf.EM_TINYJ": "debug/elf", - "elf.EM_TRICORE": "debug/elf", - "elf.EM_V800": "debug/elf", - "elf.EM_VPP500": "debug/elf", - "elf.EM_X86_64": "debug/elf", - "elf.ET_CORE": "debug/elf", - "elf.ET_DYN": "debug/elf", - "elf.ET_EXEC": "debug/elf", - "elf.ET_HIOS": "debug/elf", - "elf.ET_HIPROC": "debug/elf", - "elf.ET_LOOS": "debug/elf", - "elf.ET_LOPROC": "debug/elf", - "elf.ET_NONE": "debug/elf", - "elf.ET_REL": "debug/elf", - "elf.EV_CURRENT": "debug/elf", - "elf.EV_NONE": "debug/elf", - "elf.ErrNoSymbols": "debug/elf", - "elf.File": "debug/elf", - "elf.FileHeader": "debug/elf", - "elf.FormatError": "debug/elf", - "elf.Header32": "debug/elf", - "elf.Header64": "debug/elf", - "elf.ImportedSymbol": "debug/elf", - "elf.Machine": "debug/elf", - "elf.NT_FPREGSET": "debug/elf", - "elf.NT_PRPSINFO": "debug/elf", - "elf.NT_PRSTATUS": "debug/elf", - "elf.NType": "debug/elf", - "elf.NewFile": "debug/elf", - "elf.OSABI": "debug/elf", - "elf.Open": "debug/elf", - "elf.PF_MASKOS": "debug/elf", - "elf.PF_MASKPROC": "debug/elf", - "elf.PF_R": "debug/elf", - "elf.PF_W": "debug/elf", - "elf.PF_X": "debug/elf", - "elf.PT_DYNAMIC": "debug/elf", - "elf.PT_HIOS": "debug/elf", - "elf.PT_HIPROC": "debug/elf", - "elf.PT_INTERP": "debug/elf", - "elf.PT_LOAD": "debug/elf", - "elf.PT_LOOS": "debug/elf", - "elf.PT_LOPROC": "debug/elf", - "elf.PT_NOTE": "debug/elf", - "elf.PT_NULL": "debug/elf", - "elf.PT_PHDR": "debug/elf", - "elf.PT_SHLIB": "debug/elf", - "elf.PT_TLS": "debug/elf", - "elf.Prog": "debug/elf", - "elf.Prog32": "debug/elf", - "elf.Prog64": "debug/elf", - "elf.ProgFlag": "debug/elf", - "elf.ProgHeader": "debug/elf", - "elf.ProgType": "debug/elf", - "elf.R_386": "debug/elf", - "elf.R_386_32": "debug/elf", - "elf.R_386_COPY": "debug/elf", - "elf.R_386_GLOB_DAT": "debug/elf", - "elf.R_386_GOT32": "debug/elf", - "elf.R_386_GOTOFF": "debug/elf", - "elf.R_386_GOTPC": "debug/elf", - "elf.R_386_JMP_SLOT": "debug/elf", - "elf.R_386_NONE": "debug/elf", - "elf.R_386_PC32": "debug/elf", - "elf.R_386_PLT32": "debug/elf", - "elf.R_386_RELATIVE": "debug/elf", - "elf.R_386_TLS_DTPMOD32": "debug/elf", - "elf.R_386_TLS_DTPOFF32": "debug/elf", - "elf.R_386_TLS_GD": "debug/elf", - "elf.R_386_TLS_GD_32": "debug/elf", - "elf.R_386_TLS_GD_CALL": "debug/elf", - "elf.R_386_TLS_GD_POP": "debug/elf", - "elf.R_386_TLS_GD_PUSH": "debug/elf", - "elf.R_386_TLS_GOTIE": "debug/elf", - "elf.R_386_TLS_IE": "debug/elf", - "elf.R_386_TLS_IE_32": "debug/elf", - "elf.R_386_TLS_LDM": "debug/elf", - "elf.R_386_TLS_LDM_32": "debug/elf", - "elf.R_386_TLS_LDM_CALL": "debug/elf", - "elf.R_386_TLS_LDM_POP": "debug/elf", - "elf.R_386_TLS_LDM_PUSH": "debug/elf", - "elf.R_386_TLS_LDO_32": "debug/elf", - "elf.R_386_TLS_LE": "debug/elf", - "elf.R_386_TLS_LE_32": "debug/elf", - "elf.R_386_TLS_TPOFF": "debug/elf", - "elf.R_386_TLS_TPOFF32": "debug/elf", - "elf.R_AARCH64": "debug/elf", - "elf.R_AARCH64_ABS16": "debug/elf", - "elf.R_AARCH64_ABS32": "debug/elf", - "elf.R_AARCH64_ABS64": "debug/elf", - "elf.R_AARCH64_ADD_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_ADR_GOT_PAGE": "debug/elf", - "elf.R_AARCH64_ADR_PREL_LO21": "debug/elf", - "elf.R_AARCH64_ADR_PREL_PG_HI21": "debug/elf", - "elf.R_AARCH64_ADR_PREL_PG_HI21_NC": "debug/elf", - "elf.R_AARCH64_CALL26": "debug/elf", - "elf.R_AARCH64_CONDBR19": "debug/elf", - "elf.R_AARCH64_COPY": "debug/elf", - "elf.R_AARCH64_GLOB_DAT": "debug/elf", - "elf.R_AARCH64_GOT_LD_PREL19": "debug/elf", - "elf.R_AARCH64_IRELATIVE": "debug/elf", - "elf.R_AARCH64_JUMP26": "debug/elf", - "elf.R_AARCH64_JUMP_SLOT": "debug/elf", - "elf.R_AARCH64_LD64_GOT_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST128_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST16_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST32_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST64_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST8_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LD_PREL_LO19": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G0": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G1": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G2": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G0": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G0_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G1": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G1_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G2": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G2_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G3": "debug/elf", - "elf.R_AARCH64_NONE": "debug/elf", - "elf.R_AARCH64_NULL": "debug/elf", - "elf.R_AARCH64_P32_ABS16": "debug/elf", - "elf.R_AARCH64_P32_ABS32": "debug/elf", - "elf.R_AARCH64_P32_ADD_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_ADR_GOT_PAGE": "debug/elf", - "elf.R_AARCH64_P32_ADR_PREL_LO21": "debug/elf", - "elf.R_AARCH64_P32_ADR_PREL_PG_HI21": "debug/elf", - "elf.R_AARCH64_P32_CALL26": "debug/elf", - "elf.R_AARCH64_P32_CONDBR19": "debug/elf", - "elf.R_AARCH64_P32_COPY": "debug/elf", - "elf.R_AARCH64_P32_GLOB_DAT": "debug/elf", - "elf.R_AARCH64_P32_GOT_LD_PREL19": "debug/elf", - "elf.R_AARCH64_P32_IRELATIVE": "debug/elf", - "elf.R_AARCH64_P32_JUMP26": "debug/elf", - "elf.R_AARCH64_P32_JUMP_SLOT": "debug/elf", - "elf.R_AARCH64_P32_LD32_GOT_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST128_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST16_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST32_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST64_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST8_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LD_PREL_LO19": "debug/elf", - "elf.R_AARCH64_P32_MOVW_SABS_G0": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G0": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G0_NC": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G1": "debug/elf", - "elf.R_AARCH64_P32_PREL16": "debug/elf", - "elf.R_AARCH64_P32_PREL32": "debug/elf", - "elf.R_AARCH64_P32_RELATIVE": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADR_PREL21": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_CALL": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_LD32_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_LD_PREL19": "debug/elf", - "elf.R_AARCH64_P32_TLSGD_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSGD_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_HI12": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G1": "debug/elf", - "elf.R_AARCH64_P32_TLS_DTPMOD": "debug/elf", - "elf.R_AARCH64_P32_TLS_DTPREL": "debug/elf", - "elf.R_AARCH64_P32_TLS_TPREL": "debug/elf", - "elf.R_AARCH64_P32_TSTBR14": "debug/elf", - "elf.R_AARCH64_PREL16": "debug/elf", - "elf.R_AARCH64_PREL32": "debug/elf", - "elf.R_AARCH64_PREL64": "debug/elf", - "elf.R_AARCH64_RELATIVE": "debug/elf", - "elf.R_AARCH64_TLSDESC": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADD": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADR_PREL21": "debug/elf", - "elf.R_AARCH64_TLSDESC_CALL": "debug/elf", - "elf.R_AARCH64_TLSDESC_LD64_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_LDR": "debug/elf", - "elf.R_AARCH64_TLSDESC_LD_PREL19": "debug/elf", - "elf.R_AARCH64_TLSDESC_OFF_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_OFF_G1": "debug/elf", - "elf.R_AARCH64_TLSGD_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSGD_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", - "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G1": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_HI12": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G2": "debug/elf", - "elf.R_AARCH64_TLS_DTPMOD64": "debug/elf", - "elf.R_AARCH64_TLS_DTPREL64": "debug/elf", - "elf.R_AARCH64_TLS_TPREL64": "debug/elf", - "elf.R_AARCH64_TSTBR14": "debug/elf", - "elf.R_ALPHA": "debug/elf", - "elf.R_ALPHA_BRADDR": "debug/elf", - "elf.R_ALPHA_COPY": "debug/elf", - "elf.R_ALPHA_GLOB_DAT": "debug/elf", - "elf.R_ALPHA_GPDISP": "debug/elf", - "elf.R_ALPHA_GPREL32": "debug/elf", - "elf.R_ALPHA_GPRELHIGH": "debug/elf", - "elf.R_ALPHA_GPRELLOW": "debug/elf", - "elf.R_ALPHA_GPVALUE": "debug/elf", - "elf.R_ALPHA_HINT": "debug/elf", - "elf.R_ALPHA_IMMED_BR_HI32": "debug/elf", - "elf.R_ALPHA_IMMED_GP_16": "debug/elf", - "elf.R_ALPHA_IMMED_GP_HI32": "debug/elf", - "elf.R_ALPHA_IMMED_LO32": "debug/elf", - "elf.R_ALPHA_IMMED_SCN_HI32": "debug/elf", - "elf.R_ALPHA_JMP_SLOT": "debug/elf", - "elf.R_ALPHA_LITERAL": "debug/elf", - "elf.R_ALPHA_LITUSE": "debug/elf", - "elf.R_ALPHA_NONE": "debug/elf", - "elf.R_ALPHA_OP_PRSHIFT": "debug/elf", - "elf.R_ALPHA_OP_PSUB": "debug/elf", - "elf.R_ALPHA_OP_PUSH": "debug/elf", - "elf.R_ALPHA_OP_STORE": "debug/elf", - "elf.R_ALPHA_REFLONG": "debug/elf", - "elf.R_ALPHA_REFQUAD": "debug/elf", - "elf.R_ALPHA_RELATIVE": "debug/elf", - "elf.R_ALPHA_SREL16": "debug/elf", - "elf.R_ALPHA_SREL32": "debug/elf", - "elf.R_ALPHA_SREL64": "debug/elf", - "elf.R_ARM": "debug/elf", - "elf.R_ARM_ABS12": "debug/elf", - "elf.R_ARM_ABS16": "debug/elf", - "elf.R_ARM_ABS32": "debug/elf", - "elf.R_ARM_ABS8": "debug/elf", - "elf.R_ARM_AMP_VCALL9": "debug/elf", - "elf.R_ARM_COPY": "debug/elf", - "elf.R_ARM_GLOB_DAT": "debug/elf", - "elf.R_ARM_GNU_VTENTRY": "debug/elf", - "elf.R_ARM_GNU_VTINHERIT": "debug/elf", - "elf.R_ARM_GOT32": "debug/elf", - "elf.R_ARM_GOTOFF": "debug/elf", - "elf.R_ARM_GOTPC": "debug/elf", - "elf.R_ARM_JUMP_SLOT": "debug/elf", - "elf.R_ARM_NONE": "debug/elf", - "elf.R_ARM_PC13": "debug/elf", - "elf.R_ARM_PC24": "debug/elf", - "elf.R_ARM_PLT32": "debug/elf", - "elf.R_ARM_RABS32": "debug/elf", - "elf.R_ARM_RBASE": "debug/elf", - "elf.R_ARM_REL32": "debug/elf", - "elf.R_ARM_RELATIVE": "debug/elf", - "elf.R_ARM_RPC24": "debug/elf", - "elf.R_ARM_RREL32": "debug/elf", - "elf.R_ARM_RSBREL32": "debug/elf", - "elf.R_ARM_SBREL32": "debug/elf", - "elf.R_ARM_SWI24": "debug/elf", - "elf.R_ARM_THM_ABS5": "debug/elf", - "elf.R_ARM_THM_PC22": "debug/elf", - "elf.R_ARM_THM_PC8": "debug/elf", - "elf.R_ARM_THM_RPC22": "debug/elf", - "elf.R_ARM_THM_SWI8": "debug/elf", - "elf.R_ARM_THM_XPC22": "debug/elf", - "elf.R_ARM_XPC25": "debug/elf", - "elf.R_INFO": "debug/elf", - "elf.R_INFO32": "debug/elf", - "elf.R_MIPS": "debug/elf", - "elf.R_MIPS_16": "debug/elf", - "elf.R_MIPS_26": "debug/elf", - "elf.R_MIPS_32": "debug/elf", - "elf.R_MIPS_64": "debug/elf", - "elf.R_MIPS_ADD_IMMEDIATE": "debug/elf", - "elf.R_MIPS_CALL16": "debug/elf", - "elf.R_MIPS_CALL_HI16": "debug/elf", - "elf.R_MIPS_CALL_LO16": "debug/elf", - "elf.R_MIPS_DELETE": "debug/elf", - "elf.R_MIPS_GOT16": "debug/elf", - "elf.R_MIPS_GOT_DISP": "debug/elf", - "elf.R_MIPS_GOT_HI16": "debug/elf", - "elf.R_MIPS_GOT_LO16": "debug/elf", - "elf.R_MIPS_GOT_OFST": "debug/elf", - "elf.R_MIPS_GOT_PAGE": "debug/elf", - "elf.R_MIPS_GPREL16": "debug/elf", - "elf.R_MIPS_GPREL32": "debug/elf", - "elf.R_MIPS_HI16": "debug/elf", - "elf.R_MIPS_HIGHER": "debug/elf", - "elf.R_MIPS_HIGHEST": "debug/elf", - "elf.R_MIPS_INSERT_A": "debug/elf", - "elf.R_MIPS_INSERT_B": "debug/elf", - "elf.R_MIPS_JALR": "debug/elf", - "elf.R_MIPS_LITERAL": "debug/elf", - "elf.R_MIPS_LO16": "debug/elf", - "elf.R_MIPS_NONE": "debug/elf", - "elf.R_MIPS_PC16": "debug/elf", - "elf.R_MIPS_PJUMP": "debug/elf", - "elf.R_MIPS_REL16": "debug/elf", - "elf.R_MIPS_REL32": "debug/elf", - "elf.R_MIPS_RELGOT": "debug/elf", - "elf.R_MIPS_SCN_DISP": "debug/elf", - "elf.R_MIPS_SHIFT5": "debug/elf", - "elf.R_MIPS_SHIFT6": "debug/elf", - "elf.R_MIPS_SUB": "debug/elf", - "elf.R_MIPS_TLS_DTPMOD32": "debug/elf", - "elf.R_MIPS_TLS_DTPMOD64": "debug/elf", - "elf.R_MIPS_TLS_DTPREL32": "debug/elf", - "elf.R_MIPS_TLS_DTPREL64": "debug/elf", - "elf.R_MIPS_TLS_DTPREL_HI16": "debug/elf", - "elf.R_MIPS_TLS_DTPREL_LO16": "debug/elf", - "elf.R_MIPS_TLS_GD": "debug/elf", - "elf.R_MIPS_TLS_GOTTPREL": "debug/elf", - "elf.R_MIPS_TLS_LDM": "debug/elf", - "elf.R_MIPS_TLS_TPREL32": "debug/elf", - "elf.R_MIPS_TLS_TPREL64": "debug/elf", - "elf.R_MIPS_TLS_TPREL_HI16": "debug/elf", - "elf.R_MIPS_TLS_TPREL_LO16": "debug/elf", - "elf.R_PPC": "debug/elf", - "elf.R_PPC64": "debug/elf", - "elf.R_PPC64_ADDR14": "debug/elf", - "elf.R_PPC64_ADDR14_BRNTAKEN": "debug/elf", - "elf.R_PPC64_ADDR14_BRTAKEN": "debug/elf", - "elf.R_PPC64_ADDR16": "debug/elf", - "elf.R_PPC64_ADDR16_DS": "debug/elf", - "elf.R_PPC64_ADDR16_HA": "debug/elf", - "elf.R_PPC64_ADDR16_HI": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHER": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHERA": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHEST": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHESTA": "debug/elf", - "elf.R_PPC64_ADDR16_LO": "debug/elf", - "elf.R_PPC64_ADDR16_LO_DS": "debug/elf", - "elf.R_PPC64_ADDR24": "debug/elf", - "elf.R_PPC64_ADDR32": "debug/elf", - "elf.R_PPC64_ADDR64": "debug/elf", - "elf.R_PPC64_DTPMOD64": "debug/elf", - "elf.R_PPC64_DTPREL16": "debug/elf", - "elf.R_PPC64_DTPREL16_DS": "debug/elf", - "elf.R_PPC64_DTPREL16_HA": "debug/elf", - "elf.R_PPC64_DTPREL16_HI": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHER": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHERA": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHEST": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHESTA": "debug/elf", - "elf.R_PPC64_DTPREL16_LO": "debug/elf", - "elf.R_PPC64_DTPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_DTPREL64": "debug/elf", - "elf.R_PPC64_GOT16": "debug/elf", - "elf.R_PPC64_GOT16_DS": "debug/elf", - "elf.R_PPC64_GOT16_HA": "debug/elf", - "elf.R_PPC64_GOT16_HI": "debug/elf", - "elf.R_PPC64_GOT16_LO": "debug/elf", - "elf.R_PPC64_GOT16_LO_DS": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_DS": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_HA": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_HI": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_HA": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_HI": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_LO": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_HA": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_HI": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_LO": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_DS": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_HA": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_HI": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_JMP_SLOT": "debug/elf", - "elf.R_PPC64_NONE": "debug/elf", - "elf.R_PPC64_REL14": "debug/elf", - "elf.R_PPC64_REL14_BRNTAKEN": "debug/elf", - "elf.R_PPC64_REL14_BRTAKEN": "debug/elf", - "elf.R_PPC64_REL16": "debug/elf", - "elf.R_PPC64_REL16_HA": "debug/elf", - "elf.R_PPC64_REL16_HI": "debug/elf", - "elf.R_PPC64_REL16_LO": "debug/elf", - "elf.R_PPC64_REL24": "debug/elf", - "elf.R_PPC64_REL32": "debug/elf", - "elf.R_PPC64_REL64": "debug/elf", - "elf.R_PPC64_TLS": "debug/elf", - "elf.R_PPC64_TLSGD": "debug/elf", - "elf.R_PPC64_TLSLD": "debug/elf", - "elf.R_PPC64_TOC": "debug/elf", - "elf.R_PPC64_TOC16": "debug/elf", - "elf.R_PPC64_TOC16_DS": "debug/elf", - "elf.R_PPC64_TOC16_HA": "debug/elf", - "elf.R_PPC64_TOC16_HI": "debug/elf", - "elf.R_PPC64_TOC16_LO": "debug/elf", - "elf.R_PPC64_TOC16_LO_DS": "debug/elf", - "elf.R_PPC64_TPREL16": "debug/elf", - "elf.R_PPC64_TPREL16_DS": "debug/elf", - "elf.R_PPC64_TPREL16_HA": "debug/elf", - "elf.R_PPC64_TPREL16_HI": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHER": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHERA": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHEST": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHESTA": "debug/elf", - "elf.R_PPC64_TPREL16_LO": "debug/elf", - "elf.R_PPC64_TPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_TPREL64": "debug/elf", - "elf.R_PPC_ADDR14": "debug/elf", - "elf.R_PPC_ADDR14_BRNTAKEN": "debug/elf", - "elf.R_PPC_ADDR14_BRTAKEN": "debug/elf", - "elf.R_PPC_ADDR16": "debug/elf", - "elf.R_PPC_ADDR16_HA": "debug/elf", - "elf.R_PPC_ADDR16_HI": "debug/elf", - "elf.R_PPC_ADDR16_LO": "debug/elf", - "elf.R_PPC_ADDR24": "debug/elf", - "elf.R_PPC_ADDR32": "debug/elf", - "elf.R_PPC_COPY": "debug/elf", - "elf.R_PPC_DTPMOD32": "debug/elf", - "elf.R_PPC_DTPREL16": "debug/elf", - "elf.R_PPC_DTPREL16_HA": "debug/elf", - "elf.R_PPC_DTPREL16_HI": "debug/elf", - "elf.R_PPC_DTPREL16_LO": "debug/elf", - "elf.R_PPC_DTPREL32": "debug/elf", - "elf.R_PPC_EMB_BIT_FLD": "debug/elf", - "elf.R_PPC_EMB_MRKREF": "debug/elf", - "elf.R_PPC_EMB_NADDR16": "debug/elf", - "elf.R_PPC_EMB_NADDR16_HA": "debug/elf", - "elf.R_PPC_EMB_NADDR16_HI": "debug/elf", - "elf.R_PPC_EMB_NADDR16_LO": "debug/elf", - "elf.R_PPC_EMB_NADDR32": "debug/elf", - "elf.R_PPC_EMB_RELSDA": "debug/elf", - "elf.R_PPC_EMB_RELSEC16": "debug/elf", - "elf.R_PPC_EMB_RELST_HA": "debug/elf", - "elf.R_PPC_EMB_RELST_HI": "debug/elf", - "elf.R_PPC_EMB_RELST_LO": "debug/elf", - "elf.R_PPC_EMB_SDA21": "debug/elf", - "elf.R_PPC_EMB_SDA2I16": "debug/elf", - "elf.R_PPC_EMB_SDA2REL": "debug/elf", - "elf.R_PPC_EMB_SDAI16": "debug/elf", - "elf.R_PPC_GLOB_DAT": "debug/elf", - "elf.R_PPC_GOT16": "debug/elf", - "elf.R_PPC_GOT16_HA": "debug/elf", - "elf.R_PPC_GOT16_HI": "debug/elf", - "elf.R_PPC_GOT16_LO": "debug/elf", - "elf.R_PPC_GOT_TLSGD16": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_HA": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_HI": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_LO": "debug/elf", - "elf.R_PPC_GOT_TLSLD16": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_HA": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_HI": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_LO": "debug/elf", - "elf.R_PPC_GOT_TPREL16": "debug/elf", - "elf.R_PPC_GOT_TPREL16_HA": "debug/elf", - "elf.R_PPC_GOT_TPREL16_HI": "debug/elf", - "elf.R_PPC_GOT_TPREL16_LO": "debug/elf", - "elf.R_PPC_JMP_SLOT": "debug/elf", - "elf.R_PPC_LOCAL24PC": "debug/elf", - "elf.R_PPC_NONE": "debug/elf", - "elf.R_PPC_PLT16_HA": "debug/elf", - "elf.R_PPC_PLT16_HI": "debug/elf", - "elf.R_PPC_PLT16_LO": "debug/elf", - "elf.R_PPC_PLT32": "debug/elf", - "elf.R_PPC_PLTREL24": "debug/elf", - "elf.R_PPC_PLTREL32": "debug/elf", - "elf.R_PPC_REL14": "debug/elf", - "elf.R_PPC_REL14_BRNTAKEN": "debug/elf", - "elf.R_PPC_REL14_BRTAKEN": "debug/elf", - "elf.R_PPC_REL24": "debug/elf", - "elf.R_PPC_REL32": "debug/elf", - "elf.R_PPC_RELATIVE": "debug/elf", - "elf.R_PPC_SDAREL16": "debug/elf", - "elf.R_PPC_SECTOFF": "debug/elf", - "elf.R_PPC_SECTOFF_HA": "debug/elf", - "elf.R_PPC_SECTOFF_HI": "debug/elf", - "elf.R_PPC_SECTOFF_LO": "debug/elf", - "elf.R_PPC_TLS": "debug/elf", - "elf.R_PPC_TPREL16": "debug/elf", - "elf.R_PPC_TPREL16_HA": "debug/elf", - "elf.R_PPC_TPREL16_HI": "debug/elf", - "elf.R_PPC_TPREL16_LO": "debug/elf", - "elf.R_PPC_TPREL32": "debug/elf", - "elf.R_PPC_UADDR16": "debug/elf", - "elf.R_PPC_UADDR32": "debug/elf", - "elf.R_SPARC": "debug/elf", - "elf.R_SPARC_10": "debug/elf", - "elf.R_SPARC_11": "debug/elf", - "elf.R_SPARC_13": "debug/elf", - "elf.R_SPARC_16": "debug/elf", - "elf.R_SPARC_22": "debug/elf", - "elf.R_SPARC_32": "debug/elf", - "elf.R_SPARC_5": "debug/elf", - "elf.R_SPARC_6": "debug/elf", - "elf.R_SPARC_64": "debug/elf", - "elf.R_SPARC_7": "debug/elf", - "elf.R_SPARC_8": "debug/elf", - "elf.R_SPARC_COPY": "debug/elf", - "elf.R_SPARC_DISP16": "debug/elf", - "elf.R_SPARC_DISP32": "debug/elf", - "elf.R_SPARC_DISP64": "debug/elf", - "elf.R_SPARC_DISP8": "debug/elf", - "elf.R_SPARC_GLOB_DAT": "debug/elf", - "elf.R_SPARC_GLOB_JMP": "debug/elf", - "elf.R_SPARC_GOT10": "debug/elf", - "elf.R_SPARC_GOT13": "debug/elf", - "elf.R_SPARC_GOT22": "debug/elf", - "elf.R_SPARC_H44": "debug/elf", - "elf.R_SPARC_HH22": "debug/elf", - "elf.R_SPARC_HI22": "debug/elf", - "elf.R_SPARC_HIPLT22": "debug/elf", - "elf.R_SPARC_HIX22": "debug/elf", - "elf.R_SPARC_HM10": "debug/elf", - "elf.R_SPARC_JMP_SLOT": "debug/elf", - "elf.R_SPARC_L44": "debug/elf", - "elf.R_SPARC_LM22": "debug/elf", - "elf.R_SPARC_LO10": "debug/elf", - "elf.R_SPARC_LOPLT10": "debug/elf", - "elf.R_SPARC_LOX10": "debug/elf", - "elf.R_SPARC_M44": "debug/elf", - "elf.R_SPARC_NONE": "debug/elf", - "elf.R_SPARC_OLO10": "debug/elf", - "elf.R_SPARC_PC10": "debug/elf", - "elf.R_SPARC_PC22": "debug/elf", - "elf.R_SPARC_PCPLT10": "debug/elf", - "elf.R_SPARC_PCPLT22": "debug/elf", - "elf.R_SPARC_PCPLT32": "debug/elf", - "elf.R_SPARC_PC_HH22": "debug/elf", - "elf.R_SPARC_PC_HM10": "debug/elf", - "elf.R_SPARC_PC_LM22": "debug/elf", - "elf.R_SPARC_PLT32": "debug/elf", - "elf.R_SPARC_PLT64": "debug/elf", - "elf.R_SPARC_REGISTER": "debug/elf", - "elf.R_SPARC_RELATIVE": "debug/elf", - "elf.R_SPARC_UA16": "debug/elf", - "elf.R_SPARC_UA32": "debug/elf", - "elf.R_SPARC_UA64": "debug/elf", - "elf.R_SPARC_WDISP16": "debug/elf", - "elf.R_SPARC_WDISP19": "debug/elf", - "elf.R_SPARC_WDISP22": "debug/elf", - "elf.R_SPARC_WDISP30": "debug/elf", - "elf.R_SPARC_WPLT30": "debug/elf", - "elf.R_SYM32": "debug/elf", - "elf.R_SYM64": "debug/elf", - "elf.R_TYPE32": "debug/elf", - "elf.R_TYPE64": "debug/elf", - "elf.R_X86_64": "debug/elf", - "elf.R_X86_64_16": "debug/elf", - "elf.R_X86_64_32": "debug/elf", - "elf.R_X86_64_32S": "debug/elf", - "elf.R_X86_64_64": "debug/elf", - "elf.R_X86_64_8": "debug/elf", - "elf.R_X86_64_COPY": "debug/elf", - "elf.R_X86_64_DTPMOD64": "debug/elf", - "elf.R_X86_64_DTPOFF32": "debug/elf", - "elf.R_X86_64_DTPOFF64": "debug/elf", - "elf.R_X86_64_GLOB_DAT": "debug/elf", - "elf.R_X86_64_GOT32": "debug/elf", - "elf.R_X86_64_GOTPCREL": "debug/elf", - "elf.R_X86_64_GOTTPOFF": "debug/elf", - "elf.R_X86_64_JMP_SLOT": "debug/elf", - "elf.R_X86_64_NONE": "debug/elf", - "elf.R_X86_64_PC16": "debug/elf", - "elf.R_X86_64_PC32": "debug/elf", - "elf.R_X86_64_PC8": "debug/elf", - "elf.R_X86_64_PLT32": "debug/elf", - "elf.R_X86_64_RELATIVE": "debug/elf", - "elf.R_X86_64_TLSGD": "debug/elf", - "elf.R_X86_64_TLSLD": "debug/elf", - "elf.R_X86_64_TPOFF32": "debug/elf", - "elf.R_X86_64_TPOFF64": "debug/elf", - "elf.Rel32": "debug/elf", - "elf.Rel64": "debug/elf", - "elf.Rela32": "debug/elf", - "elf.Rela64": "debug/elf", - "elf.SHF_ALLOC": "debug/elf", - "elf.SHF_COMPRESSED": "debug/elf", - "elf.SHF_EXECINSTR": "debug/elf", - "elf.SHF_GROUP": "debug/elf", - "elf.SHF_INFO_LINK": "debug/elf", - "elf.SHF_LINK_ORDER": "debug/elf", - "elf.SHF_MASKOS": "debug/elf", - "elf.SHF_MASKPROC": "debug/elf", - "elf.SHF_MERGE": "debug/elf", - "elf.SHF_OS_NONCONFORMING": "debug/elf", - "elf.SHF_STRINGS": "debug/elf", - "elf.SHF_TLS": "debug/elf", - "elf.SHF_WRITE": "debug/elf", - "elf.SHN_ABS": "debug/elf", - "elf.SHN_COMMON": "debug/elf", - "elf.SHN_HIOS": "debug/elf", - "elf.SHN_HIPROC": "debug/elf", - "elf.SHN_HIRESERVE": "debug/elf", - "elf.SHN_LOOS": "debug/elf", - "elf.SHN_LOPROC": "debug/elf", - "elf.SHN_LORESERVE": "debug/elf", - "elf.SHN_UNDEF": "debug/elf", - "elf.SHN_XINDEX": "debug/elf", - "elf.SHT_DYNAMIC": "debug/elf", - "elf.SHT_DYNSYM": "debug/elf", - "elf.SHT_FINI_ARRAY": "debug/elf", - "elf.SHT_GNU_ATTRIBUTES": "debug/elf", - "elf.SHT_GNU_HASH": "debug/elf", - "elf.SHT_GNU_LIBLIST": "debug/elf", - "elf.SHT_GNU_VERDEF": "debug/elf", - "elf.SHT_GNU_VERNEED": "debug/elf", - "elf.SHT_GNU_VERSYM": "debug/elf", - "elf.SHT_GROUP": "debug/elf", - "elf.SHT_HASH": "debug/elf", - "elf.SHT_HIOS": "debug/elf", - "elf.SHT_HIPROC": "debug/elf", - "elf.SHT_HIUSER": "debug/elf", - "elf.SHT_INIT_ARRAY": "debug/elf", - "elf.SHT_LOOS": "debug/elf", - "elf.SHT_LOPROC": "debug/elf", - "elf.SHT_LOUSER": "debug/elf", - "elf.SHT_NOBITS": "debug/elf", - "elf.SHT_NOTE": "debug/elf", - "elf.SHT_NULL": "debug/elf", - "elf.SHT_PREINIT_ARRAY": "debug/elf", - "elf.SHT_PROGBITS": "debug/elf", - "elf.SHT_REL": "debug/elf", - "elf.SHT_RELA": "debug/elf", - "elf.SHT_SHLIB": "debug/elf", - "elf.SHT_STRTAB": "debug/elf", - "elf.SHT_SYMTAB": "debug/elf", - "elf.SHT_SYMTAB_SHNDX": "debug/elf", - "elf.STB_GLOBAL": "debug/elf", - "elf.STB_HIOS": "debug/elf", - "elf.STB_HIPROC": "debug/elf", - "elf.STB_LOCAL": "debug/elf", - "elf.STB_LOOS": "debug/elf", - "elf.STB_LOPROC": "debug/elf", - "elf.STB_WEAK": "debug/elf", - "elf.STT_COMMON": "debug/elf", - "elf.STT_FILE": "debug/elf", - "elf.STT_FUNC": "debug/elf", - "elf.STT_HIOS": "debug/elf", - "elf.STT_HIPROC": "debug/elf", - "elf.STT_LOOS": "debug/elf", - "elf.STT_LOPROC": "debug/elf", - "elf.STT_NOTYPE": "debug/elf", - "elf.STT_OBJECT": "debug/elf", - "elf.STT_SECTION": "debug/elf", - "elf.STT_TLS": "debug/elf", - "elf.STV_DEFAULT": "debug/elf", - "elf.STV_HIDDEN": "debug/elf", - "elf.STV_INTERNAL": "debug/elf", - "elf.STV_PROTECTED": "debug/elf", - "elf.ST_BIND": "debug/elf", - "elf.ST_INFO": "debug/elf", - "elf.ST_TYPE": "debug/elf", - "elf.ST_VISIBILITY": "debug/elf", - "elf.Section": "debug/elf", - "elf.Section32": "debug/elf", - "elf.Section64": "debug/elf", - "elf.SectionFlag": "debug/elf", - "elf.SectionHeader": "debug/elf", - "elf.SectionIndex": "debug/elf", - "elf.SectionType": "debug/elf", - "elf.Sym32": "debug/elf", - "elf.Sym32Size": "debug/elf", - "elf.Sym64": "debug/elf", - "elf.Sym64Size": "debug/elf", - "elf.SymBind": "debug/elf", - "elf.SymType": "debug/elf", - "elf.SymVis": "debug/elf", - "elf.Symbol": "debug/elf", - "elf.Type": "debug/elf", - "elf.Version": "debug/elf", - "elliptic.Curve": "crypto/elliptic", - "elliptic.CurveParams": "crypto/elliptic", - "elliptic.GenerateKey": "crypto/elliptic", - "elliptic.Marshal": "crypto/elliptic", - "elliptic.P224": "crypto/elliptic", - "elliptic.P256": "crypto/elliptic", - "elliptic.P384": "crypto/elliptic", - "elliptic.P521": "crypto/elliptic", - "elliptic.Unmarshal": "crypto/elliptic", - "encoding.BinaryMarshaler": "encoding", - "encoding.BinaryUnmarshaler": "encoding", - "encoding.TextMarshaler": "encoding", - "encoding.TextUnmarshaler": "encoding", - "errors.New": "errors", - "exec.Cmd": "os/exec", - "exec.Command": "os/exec", - "exec.ErrNotFound": "os/exec", - "exec.Error": "os/exec", - "exec.ExitError": "os/exec", - "exec.LookPath": "os/exec", - "expvar.Do": "expvar", - "expvar.Float": "expvar", - "expvar.Func": "expvar", - "expvar.Get": "expvar", - "expvar.Int": "expvar", - "expvar.KeyValue": "expvar", - "expvar.Map": "expvar", - "expvar.NewFloat": "expvar", - "expvar.NewInt": "expvar", - "expvar.NewMap": "expvar", - "expvar.NewString": "expvar", - "expvar.Publish": "expvar", - "expvar.String": "expvar", - "expvar.Var": "expvar", - "fcgi.ErrConnClosed": "net/http/fcgi", - "fcgi.ErrRequestAborted": "net/http/fcgi", - "fcgi.Serve": "net/http/fcgi", - "filepath.Abs": "path/filepath", - "filepath.Base": "path/filepath", - "filepath.Clean": "path/filepath", - "filepath.Dir": "path/filepath", - "filepath.ErrBadPattern": "path/filepath", - "filepath.EvalSymlinks": "path/filepath", - "filepath.Ext": "path/filepath", - "filepath.FromSlash": "path/filepath", - "filepath.Glob": "path/filepath", - "filepath.HasPrefix": "path/filepath", - "filepath.IsAbs": "path/filepath", - "filepath.Join": "path/filepath", - "filepath.ListSeparator": "path/filepath", - "filepath.Match": "path/filepath", - "filepath.Rel": "path/filepath", - "filepath.Separator": "path/filepath", - "filepath.SkipDir": "path/filepath", - "filepath.Split": "path/filepath", - "filepath.SplitList": "path/filepath", - "filepath.ToSlash": "path/filepath", - "filepath.VolumeName": "path/filepath", - "filepath.Walk": "path/filepath", - "filepath.WalkFunc": "path/filepath", - "flag.Arg": "flag", - "flag.Args": "flag", - "flag.Bool": "flag", - "flag.BoolVar": "flag", - "flag.CommandLine": "flag", - "flag.ContinueOnError": "flag", - "flag.Duration": "flag", - "flag.DurationVar": "flag", - "flag.ErrHelp": "flag", - "flag.ErrorHandling": "flag", - "flag.ExitOnError": "flag", - "flag.Flag": "flag", - "flag.FlagSet": "flag", - "flag.Float64": "flag", - "flag.Float64Var": "flag", - "flag.Getter": "flag", - "flag.Int": "flag", - "flag.Int64": "flag", - "flag.Int64Var": "flag", - "flag.IntVar": "flag", - "flag.Lookup": "flag", - "flag.NArg": "flag", - "flag.NFlag": "flag", - "flag.NewFlagSet": "flag", - "flag.PanicOnError": "flag", - "flag.Parse": "flag", - "flag.Parsed": "flag", - "flag.PrintDefaults": "flag", - "flag.Set": "flag", - "flag.String": "flag", - "flag.StringVar": "flag", - "flag.Uint": "flag", - "flag.Uint64": "flag", - "flag.Uint64Var": "flag", - "flag.UintVar": "flag", - "flag.UnquoteUsage": "flag", - "flag.Usage": "flag", - "flag.Value": "flag", - "flag.Var": "flag", - "flag.Visit": "flag", - "flag.VisitAll": "flag", - "flate.BestCompression": "compress/flate", - "flate.BestSpeed": "compress/flate", - "flate.CorruptInputError": "compress/flate", - "flate.DefaultCompression": "compress/flate", - "flate.InternalError": "compress/flate", - "flate.NewReader": "compress/flate", - "flate.NewReaderDict": "compress/flate", - "flate.NewWriter": "compress/flate", - "flate.NewWriterDict": "compress/flate", - "flate.NoCompression": "compress/flate", - "flate.ReadError": "compress/flate", - "flate.Reader": "compress/flate", - "flate.Resetter": "compress/flate", - "flate.WriteError": "compress/flate", - "flate.Writer": "compress/flate", - "fmt.Errorf": "fmt", - "fmt.Formatter": "fmt", - "fmt.Fprint": "fmt", - "fmt.Fprintf": "fmt", - "fmt.Fprintln": "fmt", - "fmt.Fscan": "fmt", - "fmt.Fscanf": "fmt", - "fmt.Fscanln": "fmt", - "fmt.GoStringer": "fmt", - "fmt.Print": "fmt", - "fmt.Printf": "fmt", - "fmt.Println": "fmt", - "fmt.Scan": "fmt", - "fmt.ScanState": "fmt", - "fmt.Scanf": "fmt", - "fmt.Scanln": "fmt", - "fmt.Scanner": "fmt", - "fmt.Sprint": "fmt", - "fmt.Sprintf": "fmt", - "fmt.Sprintln": "fmt", - "fmt.Sscan": "fmt", - "fmt.Sscanf": "fmt", - "fmt.Sscanln": "fmt", - "fmt.State": "fmt", - "fmt.Stringer": "fmt", - "fnv.New32": "hash/fnv", - "fnv.New32a": "hash/fnv", - "fnv.New64": "hash/fnv", - "fnv.New64a": "hash/fnv", - "format.Node": "go/format", - "format.Source": "go/format", - "gif.Decode": "image/gif", - "gif.DecodeAll": "image/gif", - "gif.DecodeConfig": "image/gif", - "gif.DisposalBackground": "image/gif", - "gif.DisposalNone": "image/gif", - "gif.DisposalPrevious": "image/gif", - "gif.Encode": "image/gif", - "gif.EncodeAll": "image/gif", - "gif.GIF": "image/gif", - "gif.Options": "image/gif", - "gob.CommonType": "encoding/gob", - "gob.Decoder": "encoding/gob", - "gob.Encoder": "encoding/gob", - "gob.GobDecoder": "encoding/gob", - "gob.GobEncoder": "encoding/gob", - "gob.NewDecoder": "encoding/gob", - "gob.NewEncoder": "encoding/gob", - "gob.Register": "encoding/gob", - "gob.RegisterName": "encoding/gob", - "gosym.DecodingError": "debug/gosym", - "gosym.Func": "debug/gosym", - "gosym.LineTable": "debug/gosym", - "gosym.NewLineTable": "debug/gosym", - "gosym.NewTable": "debug/gosym", - "gosym.Obj": "debug/gosym", - "gosym.Sym": "debug/gosym", - "gosym.Table": "debug/gosym", - "gosym.UnknownFileError": "debug/gosym", - "gosym.UnknownLineError": "debug/gosym", - "gzip.BestCompression": "compress/gzip", - "gzip.BestSpeed": "compress/gzip", - "gzip.DefaultCompression": "compress/gzip", - "gzip.ErrChecksum": "compress/gzip", - "gzip.ErrHeader": "compress/gzip", - "gzip.Header": "compress/gzip", - "gzip.NewReader": "compress/gzip", - "gzip.NewWriter": "compress/gzip", - "gzip.NewWriterLevel": "compress/gzip", - "gzip.NoCompression": "compress/gzip", - "gzip.Reader": "compress/gzip", - "gzip.Writer": "compress/gzip", - "hash.Hash": "hash", - "hash.Hash32": "hash", - "hash.Hash64": "hash", - "heap.Fix": "container/heap", - "heap.Init": "container/heap", - "heap.Interface": "container/heap", - "heap.Pop": "container/heap", - "heap.Push": "container/heap", - "heap.Remove": "container/heap", - "hex.Decode": "encoding/hex", - "hex.DecodeString": "encoding/hex", - "hex.DecodedLen": "encoding/hex", - "hex.Dump": "encoding/hex", - "hex.Dumper": "encoding/hex", - "hex.Encode": "encoding/hex", - "hex.EncodeToString": "encoding/hex", - "hex.EncodedLen": "encoding/hex", - "hex.ErrLength": "encoding/hex", - "hex.InvalidByteError": "encoding/hex", - "hmac.Equal": "crypto/hmac", - "hmac.New": "crypto/hmac", - "html.EscapeString": "html", - "html.UnescapeString": "html", - "http.CanonicalHeaderKey": "net/http", - "http.Client": "net/http", - "http.CloseNotifier": "net/http", - "http.ConnState": "net/http", - "http.Cookie": "net/http", - "http.CookieJar": "net/http", - "http.DefaultClient": "net/http", - "http.DefaultMaxHeaderBytes": "net/http", - "http.DefaultMaxIdleConnsPerHost": "net/http", - "http.DefaultServeMux": "net/http", - "http.DefaultTransport": "net/http", - "http.DetectContentType": "net/http", - "http.Dir": "net/http", - "http.ErrBodyNotAllowed": "net/http", - "http.ErrBodyReadAfterClose": "net/http", - "http.ErrContentLength": "net/http", - "http.ErrHandlerTimeout": "net/http", - "http.ErrHeaderTooLong": "net/http", - "http.ErrHijacked": "net/http", - "http.ErrLineTooLong": "net/http", - "http.ErrMissingBoundary": "net/http", - "http.ErrMissingContentLength": "net/http", - "http.ErrMissingFile": "net/http", - "http.ErrNoCookie": "net/http", - "http.ErrNoLocation": "net/http", - "http.ErrNotMultipart": "net/http", - "http.ErrNotSupported": "net/http", - "http.ErrShortBody": "net/http", - "http.ErrSkipAltProtocol": "net/http", - "http.ErrUnexpectedTrailer": "net/http", - "http.ErrWriteAfterFlush": "net/http", - "http.Error": "net/http", - "http.File": "net/http", - "http.FileServer": "net/http", - "http.FileSystem": "net/http", - "http.Flusher": "net/http", - "http.Get": "net/http", - "http.Handle": "net/http", - "http.HandleFunc": "net/http", - "http.Handler": "net/http", - "http.HandlerFunc": "net/http", - "http.Head": "net/http", - "http.Header": "net/http", - "http.Hijacker": "net/http", - "http.ListenAndServe": "net/http", - "http.ListenAndServeTLS": "net/http", - "http.MaxBytesReader": "net/http", - "http.MethodConnect": "net/http", - "http.MethodDelete": "net/http", - "http.MethodGet": "net/http", - "http.MethodHead": "net/http", - "http.MethodOptions": "net/http", - "http.MethodPatch": "net/http", - "http.MethodPost": "net/http", - "http.MethodPut": "net/http", - "http.MethodTrace": "net/http", - "http.NewFileTransport": "net/http", - "http.NewRequest": "net/http", - "http.NewServeMux": "net/http", - "http.NotFound": "net/http", - "http.NotFoundHandler": "net/http", - "http.ParseHTTPVersion": "net/http", - "http.ParseTime": "net/http", - "http.Post": "net/http", - "http.PostForm": "net/http", - "http.ProtocolError": "net/http", - "http.ProxyFromEnvironment": "net/http", - "http.ProxyURL": "net/http", - "http.ReadRequest": "net/http", - "http.ReadResponse": "net/http", - "http.Redirect": "net/http", - "http.RedirectHandler": "net/http", - "http.Request": "net/http", - "http.Response": "net/http", - "http.ResponseWriter": "net/http", - "http.RoundTripper": "net/http", - "http.Serve": "net/http", - "http.ServeContent": "net/http", - "http.ServeFile": "net/http", - "http.ServeMux": "net/http", - "http.Server": "net/http", - "http.SetCookie": "net/http", - "http.StateActive": "net/http", - "http.StateClosed": "net/http", - "http.StateHijacked": "net/http", - "http.StateIdle": "net/http", - "http.StateNew": "net/http", - "http.StatusAccepted": "net/http", - "http.StatusBadGateway": "net/http", - "http.StatusBadRequest": "net/http", - "http.StatusConflict": "net/http", - "http.StatusContinue": "net/http", - "http.StatusCreated": "net/http", - "http.StatusExpectationFailed": "net/http", - "http.StatusForbidden": "net/http", - "http.StatusFound": "net/http", - "http.StatusGatewayTimeout": "net/http", - "http.StatusGone": "net/http", - "http.StatusHTTPVersionNotSupported": "net/http", - "http.StatusInternalServerError": "net/http", - "http.StatusLengthRequired": "net/http", - "http.StatusMethodNotAllowed": "net/http", - "http.StatusMovedPermanently": "net/http", - "http.StatusMultipleChoices": "net/http", - "http.StatusNetworkAuthenticationRequired": "net/http", - "http.StatusNoContent": "net/http", - "http.StatusNonAuthoritativeInfo": "net/http", - "http.StatusNotAcceptable": "net/http", - "http.StatusNotFound": "net/http", - "http.StatusNotImplemented": "net/http", - "http.StatusNotModified": "net/http", - "http.StatusOK": "net/http", - "http.StatusPartialContent": "net/http", - "http.StatusPaymentRequired": "net/http", - "http.StatusPreconditionFailed": "net/http", - "http.StatusPreconditionRequired": "net/http", - "http.StatusProxyAuthRequired": "net/http", - "http.StatusRequestEntityTooLarge": "net/http", - "http.StatusRequestHeaderFieldsTooLarge": "net/http", - "http.StatusRequestTimeout": "net/http", - "http.StatusRequestURITooLong": "net/http", - "http.StatusRequestedRangeNotSatisfiable": "net/http", - "http.StatusResetContent": "net/http", - "http.StatusSeeOther": "net/http", - "http.StatusServiceUnavailable": "net/http", - "http.StatusSwitchingProtocols": "net/http", - "http.StatusTeapot": "net/http", - "http.StatusTemporaryRedirect": "net/http", - "http.StatusText": "net/http", - "http.StatusTooManyRequests": "net/http", - "http.StatusUnauthorized": "net/http", - "http.StatusUnavailableForLegalReasons": "net/http", - "http.StatusUnsupportedMediaType": "net/http", - "http.StatusUseProxy": "net/http", - "http.StripPrefix": "net/http", - "http.TimeFormat": "net/http", - "http.TimeoutHandler": "net/http", - "http.Transport": "net/http", - "httptest.DefaultRemoteAddr": "net/http/httptest", - "httptest.NewRecorder": "net/http/httptest", - "httptest.NewServer": "net/http/httptest", - "httptest.NewTLSServer": "net/http/httptest", - "httptest.NewUnstartedServer": "net/http/httptest", - "httptest.ResponseRecorder": "net/http/httptest", - "httptest.Server": "net/http/httptest", - "httputil.BufferPool": "net/http/httputil", - "httputil.ClientConn": "net/http/httputil", - "httputil.DumpRequest": "net/http/httputil", - "httputil.DumpRequestOut": "net/http/httputil", - "httputil.DumpResponse": "net/http/httputil", - "httputil.ErrClosed": "net/http/httputil", - "httputil.ErrLineTooLong": "net/http/httputil", - "httputil.ErrPersistEOF": "net/http/httputil", - "httputil.ErrPipeline": "net/http/httputil", - "httputil.NewChunkedReader": "net/http/httputil", - "httputil.NewChunkedWriter": "net/http/httputil", - "httputil.NewClientConn": "net/http/httputil", - "httputil.NewProxyClientConn": "net/http/httputil", - "httputil.NewServerConn": "net/http/httputil", - "httputil.NewSingleHostReverseProxy": "net/http/httputil", - "httputil.ReverseProxy": "net/http/httputil", - "httputil.ServerConn": "net/http/httputil", - "image.Alpha": "image", - "image.Alpha16": "image", - "image.Black": "image", - "image.CMYK": "image", - "image.Config": "image", - "image.Decode": "image", - "image.DecodeConfig": "image", - "image.ErrFormat": "image", - "image.Gray": "image", - "image.Gray16": "image", - "image.Image": "image", - "image.NRGBA": "image", - "image.NRGBA64": "image", - "image.NYCbCrA": "image", - "image.NewAlpha": "image", - "image.NewAlpha16": "image", - "image.NewCMYK": "image", - "image.NewGray": "image", - "image.NewGray16": "image", - "image.NewNRGBA": "image", - "image.NewNRGBA64": "image", - "image.NewNYCbCrA": "image", - "image.NewPaletted": "image", - "image.NewRGBA": "image", - "image.NewRGBA64": "image", - "image.NewUniform": "image", - "image.NewYCbCr": "image", - "image.Opaque": "image", - "image.Paletted": "image", - "image.PalettedImage": "image", - "image.Point": "image", - "image.Pt": "image", - "image.RGBA": "image", - "image.RGBA64": "image", - "image.Rect": "image", - "image.Rectangle": "image", - "image.RegisterFormat": "image", - "image.Transparent": "image", - "image.Uniform": "image", - "image.White": "image", - "image.YCbCr": "image", - "image.YCbCrSubsampleRatio": "image", - "image.YCbCrSubsampleRatio410": "image", - "image.YCbCrSubsampleRatio411": "image", - "image.YCbCrSubsampleRatio420": "image", - "image.YCbCrSubsampleRatio422": "image", - "image.YCbCrSubsampleRatio440": "image", - "image.YCbCrSubsampleRatio444": "image", - "image.ZP": "image", - "image.ZR": "image", - "importer.Default": "go/importer", - "importer.For": "go/importer", - "importer.Lookup": "go/importer", - "io.ByteReader": "io", - "io.ByteScanner": "io", - "io.ByteWriter": "io", - "io.Closer": "io", - "io.Copy": "io", - "io.CopyBuffer": "io", - "io.CopyN": "io", - "io.EOF": "io", - "io.ErrClosedPipe": "io", - "io.ErrNoProgress": "io", - "io.ErrShortBuffer": "io", - "io.ErrShortWrite": "io", - "io.ErrUnexpectedEOF": "io", - "io.LimitReader": "io", - "io.LimitedReader": "io", - "io.MultiReader": "io", - "io.MultiWriter": "io", - "io.NewSectionReader": "io", - "io.Pipe": "io", - "io.PipeReader": "io", - "io.PipeWriter": "io", - "io.ReadAtLeast": "io", - "io.ReadCloser": "io", - "io.ReadFull": "io", - "io.ReadSeeker": "io", - "io.ReadWriteCloser": "io", - "io.ReadWriteSeeker": "io", - "io.ReadWriter": "io", - "io.Reader": "io", - "io.ReaderAt": "io", - "io.ReaderFrom": "io", - "io.RuneReader": "io", - "io.RuneScanner": "io", - "io.SectionReader": "io", - "io.Seeker": "io", - "io.TeeReader": "io", - "io.WriteCloser": "io", - "io.WriteSeeker": "io", - "io.WriteString": "io", - "io.Writer": "io", - "io.WriterAt": "io", - "io.WriterTo": "io", - "iotest.DataErrReader": "testing/iotest", - "iotest.ErrTimeout": "testing/iotest", - "iotest.HalfReader": "testing/iotest", - "iotest.NewReadLogger": "testing/iotest", - "iotest.NewWriteLogger": "testing/iotest", - "iotest.OneByteReader": "testing/iotest", - "iotest.TimeoutReader": "testing/iotest", - "iotest.TruncateWriter": "testing/iotest", - "ioutil.Discard": "io/ioutil", - "ioutil.NopCloser": "io/ioutil", - "ioutil.ReadAll": "io/ioutil", - "ioutil.ReadDir": "io/ioutil", - "ioutil.ReadFile": "io/ioutil", - "ioutil.TempDir": "io/ioutil", - "ioutil.TempFile": "io/ioutil", - "ioutil.WriteFile": "io/ioutil", - "jpeg.Decode": "image/jpeg", - "jpeg.DecodeConfig": "image/jpeg", - "jpeg.DefaultQuality": "image/jpeg", - "jpeg.Encode": "image/jpeg", - "jpeg.FormatError": "image/jpeg", - "jpeg.Options": "image/jpeg", - "jpeg.Reader": "image/jpeg", - "jpeg.UnsupportedError": "image/jpeg", - "json.Compact": "encoding/json", - "json.Decoder": "encoding/json", - "json.Delim": "encoding/json", - "json.Encoder": "encoding/json", - "json.HTMLEscape": "encoding/json", - "json.Indent": "encoding/json", - "json.InvalidUTF8Error": "encoding/json", - "json.InvalidUnmarshalError": "encoding/json", - "json.Marshal": "encoding/json", - "json.MarshalIndent": "encoding/json", - "json.Marshaler": "encoding/json", - "json.MarshalerError": "encoding/json", - "json.NewDecoder": "encoding/json", - "json.NewEncoder": "encoding/json", - "json.Number": "encoding/json", - "json.RawMessage": "encoding/json", - "json.SyntaxError": "encoding/json", - "json.Token": "encoding/json", - "json.Unmarshal": "encoding/json", - "json.UnmarshalFieldError": "encoding/json", - "json.UnmarshalTypeError": "encoding/json", - "json.Unmarshaler": "encoding/json", - "json.UnsupportedTypeError": "encoding/json", - "json.UnsupportedValueError": "encoding/json", - "jsonrpc.Dial": "net/rpc/jsonrpc", - "jsonrpc.NewClient": "net/rpc/jsonrpc", - "jsonrpc.NewClientCodec": "net/rpc/jsonrpc", - "jsonrpc.NewServerCodec": "net/rpc/jsonrpc", - "jsonrpc.ServeConn": "net/rpc/jsonrpc", - "list.Element": "container/list", - "list.List": "container/list", - "list.New": "container/list", - "log.Fatal": "log", - "log.Fatalf": "log", - "log.Fatalln": "log", - "log.Flags": "log", - "log.LUTC": "log", - "log.Ldate": "log", - "log.Llongfile": "log", - "log.Lmicroseconds": "log", - "log.Logger": "log", - "log.Lshortfile": "log", - "log.LstdFlags": "log", - "log.Ltime": "log", - "log.New": "log", - "log.Output": "log", - "log.Panic": "log", - "log.Panicf": "log", - "log.Panicln": "log", - "log.Prefix": "log", - "log.Print": "log", - "log.Printf": "log", - "log.Println": "log", - "log.SetFlags": "log", - "log.SetOutput": "log", - "log.SetPrefix": "log", - "lzw.LSB": "compress/lzw", - "lzw.MSB": "compress/lzw", - "lzw.NewReader": "compress/lzw", - "lzw.NewWriter": "compress/lzw", - "lzw.Order": "compress/lzw", - "macho.Cpu": "debug/macho", - "macho.Cpu386": "debug/macho", - "macho.CpuAmd64": "debug/macho", - "macho.CpuArm": "debug/macho", - "macho.CpuPpc": "debug/macho", - "macho.CpuPpc64": "debug/macho", - "macho.Dylib": "debug/macho", - "macho.DylibCmd": "debug/macho", - "macho.Dysymtab": "debug/macho", - "macho.DysymtabCmd": "debug/macho", - "macho.ErrNotFat": "debug/macho", - "macho.FatArch": "debug/macho", - "macho.FatArchHeader": "debug/macho", - "macho.FatFile": "debug/macho", - "macho.File": "debug/macho", - "macho.FileHeader": "debug/macho", - "macho.FormatError": "debug/macho", - "macho.Load": "debug/macho", - "macho.LoadBytes": "debug/macho", - "macho.LoadCmd": "debug/macho", - "macho.LoadCmdDylib": "debug/macho", - "macho.LoadCmdDylinker": "debug/macho", - "macho.LoadCmdDysymtab": "debug/macho", - "macho.LoadCmdSegment": "debug/macho", - "macho.LoadCmdSegment64": "debug/macho", - "macho.LoadCmdSymtab": "debug/macho", - "macho.LoadCmdThread": "debug/macho", - "macho.LoadCmdUnixThread": "debug/macho", - "macho.Magic32": "debug/macho", - "macho.Magic64": "debug/macho", - "macho.MagicFat": "debug/macho", - "macho.NewFatFile": "debug/macho", - "macho.NewFile": "debug/macho", - "macho.Nlist32": "debug/macho", - "macho.Nlist64": "debug/macho", - "macho.Open": "debug/macho", - "macho.OpenFat": "debug/macho", - "macho.Regs386": "debug/macho", - "macho.RegsAMD64": "debug/macho", - "macho.Section": "debug/macho", - "macho.Section32": "debug/macho", - "macho.Section64": "debug/macho", - "macho.SectionHeader": "debug/macho", - "macho.Segment": "debug/macho", - "macho.Segment32": "debug/macho", - "macho.Segment64": "debug/macho", - "macho.SegmentHeader": "debug/macho", - "macho.Symbol": "debug/macho", - "macho.Symtab": "debug/macho", - "macho.SymtabCmd": "debug/macho", - "macho.Thread": "debug/macho", - "macho.Type": "debug/macho", - "macho.TypeBundle": "debug/macho", - "macho.TypeDylib": "debug/macho", - "macho.TypeExec": "debug/macho", - "macho.TypeObj": "debug/macho", - "mail.Address": "net/mail", - "mail.AddressParser": "net/mail", - "mail.ErrHeaderNotPresent": "net/mail", - "mail.Header": "net/mail", - "mail.Message": "net/mail", - "mail.ParseAddress": "net/mail", - "mail.ParseAddressList": "net/mail", - "mail.ReadMessage": "net/mail", - "math.Abs": "math", - "math.Acos": "math", - "math.Acosh": "math", - "math.Asin": "math", - "math.Asinh": "math", - "math.Atan": "math", - "math.Atan2": "math", - "math.Atanh": "math", - "math.Cbrt": "math", - "math.Ceil": "math", - "math.Copysign": "math", - "math.Cos": "math", - "math.Cosh": "math", - "math.Dim": "math", - "math.E": "math", - "math.Erf": "math", - "math.Erfc": "math", - "math.Exp": "math", - "math.Exp2": "math", - "math.Expm1": "math", - "math.Float32bits": "math", - "math.Float32frombits": "math", - "math.Float64bits": "math", - "math.Float64frombits": "math", - "math.Floor": "math", - "math.Frexp": "math", - "math.Gamma": "math", - "math.Hypot": "math", - "math.Ilogb": "math", - "math.Inf": "math", - "math.IsInf": "math", - "math.IsNaN": "math", - "math.J0": "math", - "math.J1": "math", - "math.Jn": "math", - "math.Ldexp": "math", - "math.Lgamma": "math", - "math.Ln10": "math", - "math.Ln2": "math", - "math.Log": "math", - "math.Log10": "math", - "math.Log10E": "math", - "math.Log1p": "math", - "math.Log2": "math", - "math.Log2E": "math", - "math.Logb": "math", - "math.Max": "math", - "math.MaxFloat32": "math", - "math.MaxFloat64": "math", - "math.MaxInt16": "math", - "math.MaxInt32": "math", - "math.MaxInt64": "math", - "math.MaxInt8": "math", - "math.MaxUint16": "math", - "math.MaxUint32": "math", - "math.MaxUint64": "math", - "math.MaxUint8": "math", - "math.Min": "math", - "math.MinInt16": "math", - "math.MinInt32": "math", - "math.MinInt64": "math", - "math.MinInt8": "math", - "math.Mod": "math", - "math.Modf": "math", - "math.NaN": "math", - "math.Nextafter": "math", - "math.Nextafter32": "math", - "math.Phi": "math", - "math.Pi": "math", - "math.Pow": "math", - "math.Pow10": "math", - "math.Remainder": "math", - "math.Signbit": "math", - "math.Sin": "math", - "math.Sincos": "math", - "math.Sinh": "math", - "math.SmallestNonzeroFloat32": "math", - "math.SmallestNonzeroFloat64": "math", - "math.Sqrt": "math", - "math.Sqrt2": "math", - "math.SqrtE": "math", - "math.SqrtPhi": "math", - "math.SqrtPi": "math", - "math.Tan": "math", - "math.Tanh": "math", - "math.Trunc": "math", - "math.Y0": "math", - "math.Y1": "math", - "math.Yn": "math", - "md5.BlockSize": "crypto/md5", - "md5.New": "crypto/md5", - "md5.Size": "crypto/md5", - "md5.Sum": "crypto/md5", - "mime.AddExtensionType": "mime", - "mime.BEncoding": "mime", - "mime.ExtensionsByType": "mime", - "mime.FormatMediaType": "mime", - "mime.ParseMediaType": "mime", - "mime.QEncoding": "mime", - "mime.TypeByExtension": "mime", - "mime.WordDecoder": "mime", - "mime.WordEncoder": "mime", - "multipart.File": "mime/multipart", - "multipart.FileHeader": "mime/multipart", - "multipart.Form": "mime/multipart", - "multipart.NewReader": "mime/multipart", - "multipart.NewWriter": "mime/multipart", - "multipart.Part": "mime/multipart", - "multipart.Reader": "mime/multipart", - "multipart.Writer": "mime/multipart", - "net.Addr": "net", - "net.AddrError": "net", - "net.CIDRMask": "net", - "net.Conn": "net", - "net.DNSConfigError": "net", - "net.DNSError": "net", - "net.Dial": "net", - "net.DialIP": "net", - "net.DialTCP": "net", - "net.DialTimeout": "net", - "net.DialUDP": "net", - "net.DialUnix": "net", - "net.Dialer": "net", - "net.ErrWriteToConnected": "net", - "net.Error": "net", - "net.FileConn": "net", - "net.FileListener": "net", - "net.FilePacketConn": "net", - "net.FlagBroadcast": "net", - "net.FlagLoopback": "net", - "net.FlagMulticast": "net", - "net.FlagPointToPoint": "net", - "net.FlagUp": "net", - "net.Flags": "net", - "net.HardwareAddr": "net", - "net.IP": "net", - "net.IPAddr": "net", - "net.IPConn": "net", - "net.IPMask": "net", - "net.IPNet": "net", - "net.IPv4": "net", - "net.IPv4Mask": "net", - "net.IPv4allrouter": "net", - "net.IPv4allsys": "net", - "net.IPv4bcast": "net", - "net.IPv4len": "net", - "net.IPv4zero": "net", - "net.IPv6interfacelocalallnodes": "net", - "net.IPv6len": "net", - "net.IPv6linklocalallnodes": "net", - "net.IPv6linklocalallrouters": "net", - "net.IPv6loopback": "net", - "net.IPv6unspecified": "net", - "net.IPv6zero": "net", - "net.Interface": "net", - "net.InterfaceAddrs": "net", - "net.InterfaceByIndex": "net", - "net.InterfaceByName": "net", - "net.Interfaces": "net", - "net.InvalidAddrError": "net", - "net.JoinHostPort": "net", - "net.Listen": "net", - "net.ListenIP": "net", - "net.ListenMulticastUDP": "net", - "net.ListenPacket": "net", - "net.ListenTCP": "net", - "net.ListenUDP": "net", - "net.ListenUnix": "net", - "net.ListenUnixgram": "net", - "net.Listener": "net", - "net.LookupAddr": "net", - "net.LookupCNAME": "net", - "net.LookupHost": "net", - "net.LookupIP": "net", - "net.LookupMX": "net", - "net.LookupNS": "net", - "net.LookupPort": "net", - "net.LookupSRV": "net", - "net.LookupTXT": "net", - "net.MX": "net", - "net.NS": "net", - "net.OpError": "net", - "net.PacketConn": "net", - "net.ParseCIDR": "net", - "net.ParseError": "net", - "net.ParseIP": "net", - "net.ParseMAC": "net", - "net.Pipe": "net", - "net.ResolveIPAddr": "net", - "net.ResolveTCPAddr": "net", - "net.ResolveUDPAddr": "net", - "net.ResolveUnixAddr": "net", - "net.SRV": "net", - "net.SplitHostPort": "net", - "net.TCPAddr": "net", - "net.TCPConn": "net", - "net.TCPListener": "net", - "net.UDPAddr": "net", - "net.UDPConn": "net", - "net.UnixAddr": "net", - "net.UnixConn": "net", - "net.UnixListener": "net", - "net.UnknownNetworkError": "net", - "os.Args": "os", - "os.Chdir": "os", - "os.Chmod": "os", - "os.Chown": "os", - "os.Chtimes": "os", - "os.Clearenv": "os", - "os.Create": "os", - "os.DevNull": "os", - "os.Environ": "os", - "os.ErrExist": "os", - "os.ErrInvalid": "os", - "os.ErrNotExist": "os", - "os.ErrPermission": "os", - "os.Exit": "os", - "os.Expand": "os", - "os.ExpandEnv": "os", - "os.File": "os", - "os.FileInfo": "os", - "os.FileMode": "os", - "os.FindProcess": "os", - "os.Getegid": "os", - "os.Getenv": "os", - "os.Geteuid": "os", - "os.Getgid": "os", - "os.Getgroups": "os", - "os.Getpagesize": "os", - "os.Getpid": "os", - "os.Getppid": "os", - "os.Getuid": "os", - "os.Getwd": "os", - "os.Hostname": "os", - "os.Interrupt": "os", - "os.IsExist": "os", - "os.IsNotExist": "os", - "os.IsPathSeparator": "os", - "os.IsPermission": "os", - "os.Kill": "os", - "os.Lchown": "os", - "os.Link": "os", - "os.LinkError": "os", - "os.LookupEnv": "os", - "os.Lstat": "os", - "os.Mkdir": "os", - "os.MkdirAll": "os", - "os.ModeAppend": "os", - "os.ModeCharDevice": "os", - "os.ModeDevice": "os", - "os.ModeDir": "os", - "os.ModeExclusive": "os", - "os.ModeNamedPipe": "os", - "os.ModePerm": "os", - "os.ModeSetgid": "os", - "os.ModeSetuid": "os", - "os.ModeSocket": "os", - "os.ModeSticky": "os", - "os.ModeSymlink": "os", - "os.ModeTemporary": "os", - "os.ModeType": "os", - "os.NewFile": "os", - "os.NewSyscallError": "os", - "os.O_APPEND": "os", - "os.O_CREATE": "os", - "os.O_EXCL": "os", - "os.O_RDONLY": "os", - "os.O_RDWR": "os", - "os.O_SYNC": "os", - "os.O_TRUNC": "os", - "os.O_WRONLY": "os", - "os.Open": "os", - "os.OpenFile": "os", - "os.PathError": "os", - "os.PathListSeparator": "os", - "os.PathSeparator": "os", - "os.Pipe": "os", - "os.ProcAttr": "os", - "os.Process": "os", - "os.ProcessState": "os", - "os.Readlink": "os", - "os.Remove": "os", - "os.RemoveAll": "os", - "os.Rename": "os", - "os.SEEK_CUR": "os", - "os.SEEK_END": "os", - "os.SEEK_SET": "os", - "os.SameFile": "os", - "os.Setenv": "os", - "os.Signal": "os", - "os.StartProcess": "os", - "os.Stat": "os", - "os.Stderr": "os", - "os.Stdin": "os", - "os.Stdout": "os", - "os.Symlink": "os", - "os.SyscallError": "os", - "os.TempDir": "os", - "os.Truncate": "os", - "os.Unsetenv": "os", - "palette.Plan9": "image/color/palette", - "palette.WebSafe": "image/color/palette", - "parse.ActionNode": "text/template/parse", - "parse.BoolNode": "text/template/parse", - "parse.BranchNode": "text/template/parse", - "parse.ChainNode": "text/template/parse", - "parse.CommandNode": "text/template/parse", - "parse.DotNode": "text/template/parse", - "parse.FieldNode": "text/template/parse", - "parse.IdentifierNode": "text/template/parse", - "parse.IfNode": "text/template/parse", - "parse.IsEmptyTree": "text/template/parse", - "parse.ListNode": "text/template/parse", - "parse.New": "text/template/parse", - "parse.NewIdentifier": "text/template/parse", - "parse.NilNode": "text/template/parse", - "parse.Node": "text/template/parse", - "parse.NodeAction": "text/template/parse", - "parse.NodeBool": "text/template/parse", - "parse.NodeChain": "text/template/parse", - "parse.NodeCommand": "text/template/parse", - "parse.NodeDot": "text/template/parse", - "parse.NodeField": "text/template/parse", - "parse.NodeIdentifier": "text/template/parse", - "parse.NodeIf": "text/template/parse", - "parse.NodeList": "text/template/parse", - "parse.NodeNil": "text/template/parse", - "parse.NodeNumber": "text/template/parse", - "parse.NodePipe": "text/template/parse", - "parse.NodeRange": "text/template/parse", - "parse.NodeString": "text/template/parse", - "parse.NodeTemplate": "text/template/parse", - "parse.NodeText": "text/template/parse", - "parse.NodeType": "text/template/parse", - "parse.NodeVariable": "text/template/parse", - "parse.NodeWith": "text/template/parse", - "parse.NumberNode": "text/template/parse", - "parse.Parse": "text/template/parse", - "parse.PipeNode": "text/template/parse", - "parse.Pos": "text/template/parse", - "parse.RangeNode": "text/template/parse", - "parse.StringNode": "text/template/parse", - "parse.TemplateNode": "text/template/parse", - "parse.TextNode": "text/template/parse", - "parse.Tree": "text/template/parse", - "parse.VariableNode": "text/template/parse", - "parse.WithNode": "text/template/parse", - "parser.AllErrors": "go/parser", - "parser.DeclarationErrors": "go/parser", - "parser.ImportsOnly": "go/parser", - "parser.Mode": "go/parser", - "parser.PackageClauseOnly": "go/parser", - "parser.ParseComments": "go/parser", - "parser.ParseDir": "go/parser", - "parser.ParseExpr": "go/parser", - "parser.ParseExprFrom": "go/parser", - "parser.ParseFile": "go/parser", - "parser.SpuriousErrors": "go/parser", - "parser.Trace": "go/parser", - "path.Base": "path", - "path.Clean": "path", - "path.Dir": "path", - "path.ErrBadPattern": "path", - "path.Ext": "path", - "path.IsAbs": "path", - "path.Join": "path", - "path.Match": "path", - "path.Split": "path", - "pe.COFFSymbol": "debug/pe", - "pe.COFFSymbolSize": "debug/pe", - "pe.DataDirectory": "debug/pe", - "pe.File": "debug/pe", - "pe.FileHeader": "debug/pe", - "pe.FormatError": "debug/pe", - "pe.IMAGE_FILE_MACHINE_AM33": "debug/pe", - "pe.IMAGE_FILE_MACHINE_AMD64": "debug/pe", - "pe.IMAGE_FILE_MACHINE_ARM": "debug/pe", - "pe.IMAGE_FILE_MACHINE_EBC": "debug/pe", - "pe.IMAGE_FILE_MACHINE_I386": "debug/pe", - "pe.IMAGE_FILE_MACHINE_IA64": "debug/pe", - "pe.IMAGE_FILE_MACHINE_M32R": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPS16": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPSFPU": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPSFPU16": "debug/pe", - "pe.IMAGE_FILE_MACHINE_POWERPC": "debug/pe", - "pe.IMAGE_FILE_MACHINE_POWERPCFP": "debug/pe", - "pe.IMAGE_FILE_MACHINE_R4000": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH3": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH3DSP": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH4": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH5": "debug/pe", - "pe.IMAGE_FILE_MACHINE_THUMB": "debug/pe", - "pe.IMAGE_FILE_MACHINE_UNKNOWN": "debug/pe", - "pe.IMAGE_FILE_MACHINE_WCEMIPSV2": "debug/pe", - "pe.ImportDirectory": "debug/pe", - "pe.NewFile": "debug/pe", - "pe.Open": "debug/pe", - "pe.OptionalHeader32": "debug/pe", - "pe.OptionalHeader64": "debug/pe", - "pe.Section": "debug/pe", - "pe.SectionHeader": "debug/pe", - "pe.SectionHeader32": "debug/pe", - "pe.Symbol": "debug/pe", - "pem.Block": "encoding/pem", - "pem.Decode": "encoding/pem", - "pem.Encode": "encoding/pem", - "pem.EncodeToMemory": "encoding/pem", - "pkix.AlgorithmIdentifier": "crypto/x509/pkix", - "pkix.AttributeTypeAndValue": "crypto/x509/pkix", - "pkix.AttributeTypeAndValueSET": "crypto/x509/pkix", - "pkix.CertificateList": "crypto/x509/pkix", - "pkix.Extension": "crypto/x509/pkix", - "pkix.Name": "crypto/x509/pkix", - "pkix.RDNSequence": "crypto/x509/pkix", - "pkix.RelativeDistinguishedNameSET": "crypto/x509/pkix", - "pkix.RevokedCertificate": "crypto/x509/pkix", - "pkix.TBSCertificateList": "crypto/x509/pkix", - "plan9obj.File": "debug/plan9obj", - "plan9obj.FileHeader": "debug/plan9obj", - "plan9obj.Magic386": "debug/plan9obj", - "plan9obj.Magic64": "debug/plan9obj", - "plan9obj.MagicAMD64": "debug/plan9obj", - "plan9obj.MagicARM": "debug/plan9obj", - "plan9obj.NewFile": "debug/plan9obj", - "plan9obj.Open": "debug/plan9obj", - "plan9obj.Section": "debug/plan9obj", - "plan9obj.SectionHeader": "debug/plan9obj", - "plan9obj.Sym": "debug/plan9obj", - "png.BestCompression": "image/png", - "png.BestSpeed": "image/png", - "png.CompressionLevel": "image/png", - "png.Decode": "image/png", - "png.DecodeConfig": "image/png", - "png.DefaultCompression": "image/png", - "png.Encode": "image/png", - "png.Encoder": "image/png", - "png.FormatError": "image/png", - "png.NoCompression": "image/png", - "png.UnsupportedError": "image/png", - "pprof.Cmdline": "net/http/pprof", - "pprof.Handler": "net/http/pprof", - "pprof.Index": "net/http/pprof", - "pprof.Lookup": "runtime/pprof", - "pprof.NewProfile": "runtime/pprof", - // "pprof.Profile" is ambiguous - "pprof.Profiles": "runtime/pprof", - "pprof.StartCPUProfile": "runtime/pprof", - "pprof.StopCPUProfile": "runtime/pprof", - "pprof.Symbol": "net/http/pprof", - "pprof.Trace": "net/http/pprof", - "pprof.WriteHeapProfile": "runtime/pprof", - "printer.CommentedNode": "go/printer", - "printer.Config": "go/printer", - "printer.Fprint": "go/printer", - "printer.Mode": "go/printer", - "printer.RawFormat": "go/printer", - "printer.SourcePos": "go/printer", - "printer.TabIndent": "go/printer", - "printer.UseSpaces": "go/printer", - "quick.Check": "testing/quick", - "quick.CheckEqual": "testing/quick", - "quick.CheckEqualError": "testing/quick", - "quick.CheckError": "testing/quick", - "quick.Config": "testing/quick", - "quick.Generator": "testing/quick", - "quick.SetupError": "testing/quick", - "quick.Value": "testing/quick", - "quotedprintable.NewReader": "mime/quotedprintable", - "quotedprintable.NewWriter": "mime/quotedprintable", - "quotedprintable.Reader": "mime/quotedprintable", - "quotedprintable.Writer": "mime/quotedprintable", - "rand.ExpFloat64": "math/rand", - "rand.Float32": "math/rand", - "rand.Float64": "math/rand", - // "rand.Int" is ambiguous - "rand.Int31": "math/rand", - "rand.Int31n": "math/rand", - "rand.Int63": "math/rand", - "rand.Int63n": "math/rand", - "rand.Intn": "math/rand", - "rand.New": "math/rand", - "rand.NewSource": "math/rand", - "rand.NewZipf": "math/rand", - "rand.NormFloat64": "math/rand", - "rand.Perm": "math/rand", - "rand.Prime": "crypto/rand", - "rand.Rand": "math/rand", - // "rand.Read" is ambiguous - "rand.Reader": "crypto/rand", - "rand.Seed": "math/rand", - "rand.Source": "math/rand", - "rand.Uint32": "math/rand", - "rand.Zipf": "math/rand", - "rc4.Cipher": "crypto/rc4", - "rc4.KeySizeError": "crypto/rc4", - "rc4.NewCipher": "crypto/rc4", - "reflect.Append": "reflect", - "reflect.AppendSlice": "reflect", - "reflect.Array": "reflect", - "reflect.ArrayOf": "reflect", - "reflect.Bool": "reflect", - "reflect.BothDir": "reflect", - "reflect.Chan": "reflect", - "reflect.ChanDir": "reflect", - "reflect.ChanOf": "reflect", - "reflect.Complex128": "reflect", - "reflect.Complex64": "reflect", - "reflect.Copy": "reflect", - "reflect.DeepEqual": "reflect", - "reflect.Float32": "reflect", - "reflect.Float64": "reflect", - "reflect.Func": "reflect", - "reflect.FuncOf": "reflect", - "reflect.Indirect": "reflect", - "reflect.Int": "reflect", - "reflect.Int16": "reflect", - "reflect.Int32": "reflect", - "reflect.Int64": "reflect", - "reflect.Int8": "reflect", - "reflect.Interface": "reflect", - "reflect.Invalid": "reflect", - "reflect.Kind": "reflect", - "reflect.MakeChan": "reflect", - "reflect.MakeFunc": "reflect", - "reflect.MakeMap": "reflect", - "reflect.MakeSlice": "reflect", - "reflect.Map": "reflect", - "reflect.MapOf": "reflect", - "reflect.Method": "reflect", - "reflect.New": "reflect", - "reflect.NewAt": "reflect", - "reflect.Ptr": "reflect", - "reflect.PtrTo": "reflect", - "reflect.RecvDir": "reflect", - "reflect.Select": "reflect", - "reflect.SelectCase": "reflect", - "reflect.SelectDefault": "reflect", - "reflect.SelectDir": "reflect", - "reflect.SelectRecv": "reflect", - "reflect.SelectSend": "reflect", - "reflect.SendDir": "reflect", - "reflect.Slice": "reflect", - "reflect.SliceHeader": "reflect", - "reflect.SliceOf": "reflect", - "reflect.String": "reflect", - "reflect.StringHeader": "reflect", - "reflect.Struct": "reflect", - "reflect.StructField": "reflect", - "reflect.StructTag": "reflect", - "reflect.TypeOf": "reflect", - "reflect.Uint": "reflect", - "reflect.Uint16": "reflect", - "reflect.Uint32": "reflect", - "reflect.Uint64": "reflect", - "reflect.Uint8": "reflect", - "reflect.Uintptr": "reflect", - "reflect.UnsafePointer": "reflect", - "reflect.Value": "reflect", - "reflect.ValueError": "reflect", - "reflect.ValueOf": "reflect", - "reflect.Zero": "reflect", - "regexp.Compile": "regexp", - "regexp.CompilePOSIX": "regexp", - "regexp.Match": "regexp", - "regexp.MatchReader": "regexp", - "regexp.MatchString": "regexp", - "regexp.MustCompile": "regexp", - "regexp.MustCompilePOSIX": "regexp", - "regexp.QuoteMeta": "regexp", - "regexp.Regexp": "regexp", - "ring.New": "container/ring", - "ring.Ring": "container/ring", - "rpc.Accept": "net/rpc", - "rpc.Call": "net/rpc", - "rpc.Client": "net/rpc", - "rpc.ClientCodec": "net/rpc", - "rpc.DefaultDebugPath": "net/rpc", - "rpc.DefaultRPCPath": "net/rpc", - "rpc.DefaultServer": "net/rpc", - "rpc.Dial": "net/rpc", - "rpc.DialHTTP": "net/rpc", - "rpc.DialHTTPPath": "net/rpc", - "rpc.ErrShutdown": "net/rpc", - "rpc.HandleHTTP": "net/rpc", - "rpc.NewClient": "net/rpc", - "rpc.NewClientWithCodec": "net/rpc", - "rpc.NewServer": "net/rpc", - "rpc.Register": "net/rpc", - "rpc.RegisterName": "net/rpc", - "rpc.Request": "net/rpc", - "rpc.Response": "net/rpc", - "rpc.ServeCodec": "net/rpc", - "rpc.ServeConn": "net/rpc", - "rpc.ServeRequest": "net/rpc", - "rpc.Server": "net/rpc", - "rpc.ServerCodec": "net/rpc", - "rpc.ServerError": "net/rpc", - "rsa.CRTValue": "crypto/rsa", - "rsa.DecryptOAEP": "crypto/rsa", - "rsa.DecryptPKCS1v15": "crypto/rsa", - "rsa.DecryptPKCS1v15SessionKey": "crypto/rsa", - "rsa.EncryptOAEP": "crypto/rsa", - "rsa.EncryptPKCS1v15": "crypto/rsa", - "rsa.ErrDecryption": "crypto/rsa", - "rsa.ErrMessageTooLong": "crypto/rsa", - "rsa.ErrVerification": "crypto/rsa", - "rsa.GenerateKey": "crypto/rsa", - "rsa.GenerateMultiPrimeKey": "crypto/rsa", - "rsa.OAEPOptions": "crypto/rsa", - "rsa.PKCS1v15DecryptOptions": "crypto/rsa", - "rsa.PSSOptions": "crypto/rsa", - "rsa.PSSSaltLengthAuto": "crypto/rsa", - "rsa.PSSSaltLengthEqualsHash": "crypto/rsa", - "rsa.PrecomputedValues": "crypto/rsa", - "rsa.PrivateKey": "crypto/rsa", - "rsa.PublicKey": "crypto/rsa", - "rsa.SignPKCS1v15": "crypto/rsa", - "rsa.SignPSS": "crypto/rsa", - "rsa.VerifyPKCS1v15": "crypto/rsa", - "rsa.VerifyPSS": "crypto/rsa", - "runtime.BlockProfile": "runtime", - "runtime.BlockProfileRecord": "runtime", - "runtime.Breakpoint": "runtime", - "runtime.CPUProfile": "runtime", - "runtime.Caller": "runtime", - "runtime.Callers": "runtime", - "runtime.Compiler": "runtime", - "runtime.Error": "runtime", - "runtime.Func": "runtime", - "runtime.FuncForPC": "runtime", - "runtime.GC": "runtime", - "runtime.GOARCH": "runtime", - "runtime.GOMAXPROCS": "runtime", - "runtime.GOOS": "runtime", - "runtime.GOROOT": "runtime", - "runtime.Goexit": "runtime", - "runtime.GoroutineProfile": "runtime", - "runtime.Gosched": "runtime", - "runtime.LockOSThread": "runtime", - "runtime.MemProfile": "runtime", - "runtime.MemProfileRate": "runtime", - "runtime.MemProfileRecord": "runtime", - "runtime.MemStats": "runtime", - "runtime.NumCPU": "runtime", - "runtime.NumCgoCall": "runtime", - "runtime.NumGoroutine": "runtime", - "runtime.ReadMemStats": "runtime", - "runtime.ReadTrace": "runtime", - "runtime.SetBlockProfileRate": "runtime", - "runtime.SetCPUProfileRate": "runtime", - "runtime.SetFinalizer": "runtime", - "runtime.Stack": "runtime", - "runtime.StackRecord": "runtime", - "runtime.StartTrace": "runtime", - "runtime.StopTrace": "runtime", - "runtime.ThreadCreateProfile": "runtime", - "runtime.TypeAssertionError": "runtime", - "runtime.UnlockOSThread": "runtime", - "runtime.Version": "runtime", - "scanner.Char": "text/scanner", - "scanner.Comment": "text/scanner", - "scanner.EOF": "text/scanner", - "scanner.Error": "go/scanner", - "scanner.ErrorHandler": "go/scanner", - "scanner.ErrorList": "go/scanner", - "scanner.Float": "text/scanner", - "scanner.GoTokens": "text/scanner", - "scanner.GoWhitespace": "text/scanner", - "scanner.Ident": "text/scanner", - "scanner.Int": "text/scanner", - "scanner.Mode": "go/scanner", - "scanner.Position": "text/scanner", - "scanner.PrintError": "go/scanner", - "scanner.RawString": "text/scanner", - "scanner.ScanChars": "text/scanner", - // "scanner.ScanComments" is ambiguous - "scanner.ScanFloats": "text/scanner", - "scanner.ScanIdents": "text/scanner", - "scanner.ScanInts": "text/scanner", - "scanner.ScanRawStrings": "text/scanner", - "scanner.ScanStrings": "text/scanner", - // "scanner.Scanner" is ambiguous - "scanner.SkipComments": "text/scanner", - "scanner.String": "text/scanner", - "scanner.TokenString": "text/scanner", - "sha1.BlockSize": "crypto/sha1", - "sha1.New": "crypto/sha1", - "sha1.Size": "crypto/sha1", - "sha1.Sum": "crypto/sha1", - "sha256.BlockSize": "crypto/sha256", - "sha256.New": "crypto/sha256", - "sha256.New224": "crypto/sha256", - "sha256.Size": "crypto/sha256", - "sha256.Size224": "crypto/sha256", - "sha256.Sum224": "crypto/sha256", - "sha256.Sum256": "crypto/sha256", - "sha512.BlockSize": "crypto/sha512", - "sha512.New": "crypto/sha512", - "sha512.New384": "crypto/sha512", - "sha512.New512_224": "crypto/sha512", - "sha512.New512_256": "crypto/sha512", - "sha512.Size": "crypto/sha512", - "sha512.Size224": "crypto/sha512", - "sha512.Size256": "crypto/sha512", - "sha512.Size384": "crypto/sha512", - "sha512.Sum384": "crypto/sha512", - "sha512.Sum512": "crypto/sha512", - "sha512.Sum512_224": "crypto/sha512", - "sha512.Sum512_256": "crypto/sha512", - "signal.Ignore": "os/signal", - "signal.Notify": "os/signal", - "signal.Reset": "os/signal", - "signal.Stop": "os/signal", - "smtp.Auth": "net/smtp", - "smtp.CRAMMD5Auth": "net/smtp", - "smtp.Client": "net/smtp", - "smtp.Dial": "net/smtp", - "smtp.NewClient": "net/smtp", - "smtp.PlainAuth": "net/smtp", - "smtp.SendMail": "net/smtp", - "smtp.ServerInfo": "net/smtp", - "sort.Float64Slice": "sort", - "sort.Float64s": "sort", - "sort.Float64sAreSorted": "sort", - "sort.IntSlice": "sort", - "sort.Interface": "sort", - "sort.Ints": "sort", - "sort.IntsAreSorted": "sort", - "sort.IsSorted": "sort", - "sort.Reverse": "sort", - "sort.Search": "sort", - "sort.SearchFloat64s": "sort", - "sort.SearchInts": "sort", - "sort.SearchStrings": "sort", - "sort.Sort": "sort", - "sort.Stable": "sort", - "sort.StringSlice": "sort", - "sort.Strings": "sort", - "sort.StringsAreSorted": "sort", - "sql.DB": "database/sql", - "sql.DBStats": "database/sql", - "sql.Drivers": "database/sql", - "sql.ErrNoRows": "database/sql", - "sql.ErrTxDone": "database/sql", - "sql.NullBool": "database/sql", - "sql.NullFloat64": "database/sql", - "sql.NullInt64": "database/sql", - "sql.NullString": "database/sql", - "sql.Open": "database/sql", - "sql.RawBytes": "database/sql", - "sql.Register": "database/sql", - "sql.Result": "database/sql", - "sql.Row": "database/sql", - "sql.Rows": "database/sql", - "sql.Scanner": "database/sql", - "sql.Stmt": "database/sql", - "sql.Tx": "database/sql", - "strconv.AppendBool": "strconv", - "strconv.AppendFloat": "strconv", - "strconv.AppendInt": "strconv", - "strconv.AppendQuote": "strconv", - "strconv.AppendQuoteRune": "strconv", - "strconv.AppendQuoteRuneToASCII": "strconv", - "strconv.AppendQuoteRuneToGraphic": "strconv", - "strconv.AppendQuoteToASCII": "strconv", - "strconv.AppendQuoteToGraphic": "strconv", - "strconv.AppendUint": "strconv", - "strconv.Atoi": "strconv", - "strconv.CanBackquote": "strconv", - "strconv.ErrRange": "strconv", - "strconv.ErrSyntax": "strconv", - "strconv.FormatBool": "strconv", - "strconv.FormatFloat": "strconv", - "strconv.FormatInt": "strconv", - "strconv.FormatUint": "strconv", - "strconv.IntSize": "strconv", - "strconv.IsGraphic": "strconv", - "strconv.IsPrint": "strconv", - "strconv.Itoa": "strconv", - "strconv.NumError": "strconv", - "strconv.ParseBool": "strconv", - "strconv.ParseFloat": "strconv", - "strconv.ParseInt": "strconv", - "strconv.ParseUint": "strconv", - "strconv.Quote": "strconv", - "strconv.QuoteRune": "strconv", - "strconv.QuoteRuneToASCII": "strconv", - "strconv.QuoteRuneToGraphic": "strconv", - "strconv.QuoteToASCII": "strconv", - "strconv.QuoteToGraphic": "strconv", - "strconv.Unquote": "strconv", - "strconv.UnquoteChar": "strconv", - "strings.Compare": "strings", - "strings.Contains": "strings", - "strings.ContainsAny": "strings", - "strings.ContainsRune": "strings", - "strings.Count": "strings", - "strings.EqualFold": "strings", - "strings.Fields": "strings", - "strings.FieldsFunc": "strings", - "strings.HasPrefix": "strings", - "strings.HasSuffix": "strings", - "strings.Index": "strings", - "strings.IndexAny": "strings", - "strings.IndexByte": "strings", - "strings.IndexFunc": "strings", - "strings.IndexRune": "strings", - "strings.Join": "strings", - "strings.LastIndex": "strings", - "strings.LastIndexAny": "strings", - "strings.LastIndexByte": "strings", - "strings.LastIndexFunc": "strings", - "strings.Map": "strings", - "strings.NewReader": "strings", - "strings.NewReplacer": "strings", - "strings.Reader": "strings", - "strings.Repeat": "strings", - "strings.Replace": "strings", - "strings.Replacer": "strings", - "strings.Split": "strings", - "strings.SplitAfter": "strings", - "strings.SplitAfterN": "strings", - "strings.SplitN": "strings", - "strings.Title": "strings", - "strings.ToLower": "strings", - "strings.ToLowerSpecial": "strings", - "strings.ToTitle": "strings", - "strings.ToTitleSpecial": "strings", - "strings.ToUpper": "strings", - "strings.ToUpperSpecial": "strings", - "strings.Trim": "strings", - "strings.TrimFunc": "strings", - "strings.TrimLeft": "strings", - "strings.TrimLeftFunc": "strings", - "strings.TrimPrefix": "strings", - "strings.TrimRight": "strings", - "strings.TrimRightFunc": "strings", - "strings.TrimSpace": "strings", - "strings.TrimSuffix": "strings", - "subtle.ConstantTimeByteEq": "crypto/subtle", - "subtle.ConstantTimeCompare": "crypto/subtle", - "subtle.ConstantTimeCopy": "crypto/subtle", - "subtle.ConstantTimeEq": "crypto/subtle", - "subtle.ConstantTimeLessOrEq": "crypto/subtle", - "subtle.ConstantTimeSelect": "crypto/subtle", - "suffixarray.Index": "index/suffixarray", - "suffixarray.New": "index/suffixarray", - "sync.Cond": "sync", - "sync.Locker": "sync", - "sync.Mutex": "sync", - "sync.NewCond": "sync", - "sync.Once": "sync", - "sync.Pool": "sync", - "sync.RWMutex": "sync", - "sync.WaitGroup": "sync", - "syntax.ClassNL": "regexp/syntax", - "syntax.Compile": "regexp/syntax", - "syntax.DotNL": "regexp/syntax", - "syntax.EmptyBeginLine": "regexp/syntax", - "syntax.EmptyBeginText": "regexp/syntax", - "syntax.EmptyEndLine": "regexp/syntax", - "syntax.EmptyEndText": "regexp/syntax", - "syntax.EmptyNoWordBoundary": "regexp/syntax", - "syntax.EmptyOp": "regexp/syntax", - "syntax.EmptyOpContext": "regexp/syntax", - "syntax.EmptyWordBoundary": "regexp/syntax", - "syntax.ErrInternalError": "regexp/syntax", - "syntax.ErrInvalidCharClass": "regexp/syntax", - "syntax.ErrInvalidCharRange": "regexp/syntax", - "syntax.ErrInvalidEscape": "regexp/syntax", - "syntax.ErrInvalidNamedCapture": "regexp/syntax", - "syntax.ErrInvalidPerlOp": "regexp/syntax", - "syntax.ErrInvalidRepeatOp": "regexp/syntax", - "syntax.ErrInvalidRepeatSize": "regexp/syntax", - "syntax.ErrInvalidUTF8": "regexp/syntax", - "syntax.ErrMissingBracket": "regexp/syntax", - "syntax.ErrMissingParen": "regexp/syntax", - "syntax.ErrMissingRepeatArgument": "regexp/syntax", - "syntax.ErrTrailingBackslash": "regexp/syntax", - "syntax.ErrUnexpectedParen": "regexp/syntax", - "syntax.Error": "regexp/syntax", - "syntax.ErrorCode": "regexp/syntax", - "syntax.Flags": "regexp/syntax", - "syntax.FoldCase": "regexp/syntax", - "syntax.Inst": "regexp/syntax", - "syntax.InstAlt": "regexp/syntax", - "syntax.InstAltMatch": "regexp/syntax", - "syntax.InstCapture": "regexp/syntax", - "syntax.InstEmptyWidth": "regexp/syntax", - "syntax.InstFail": "regexp/syntax", - "syntax.InstMatch": "regexp/syntax", - "syntax.InstNop": "regexp/syntax", - "syntax.InstOp": "regexp/syntax", - "syntax.InstRune": "regexp/syntax", - "syntax.InstRune1": "regexp/syntax", - "syntax.InstRuneAny": "regexp/syntax", - "syntax.InstRuneAnyNotNL": "regexp/syntax", - "syntax.IsWordChar": "regexp/syntax", - "syntax.Literal": "regexp/syntax", - "syntax.MatchNL": "regexp/syntax", - "syntax.NonGreedy": "regexp/syntax", - "syntax.OneLine": "regexp/syntax", - "syntax.Op": "regexp/syntax", - "syntax.OpAlternate": "regexp/syntax", - "syntax.OpAnyChar": "regexp/syntax", - "syntax.OpAnyCharNotNL": "regexp/syntax", - "syntax.OpBeginLine": "regexp/syntax", - "syntax.OpBeginText": "regexp/syntax", - "syntax.OpCapture": "regexp/syntax", - "syntax.OpCharClass": "regexp/syntax", - "syntax.OpConcat": "regexp/syntax", - "syntax.OpEmptyMatch": "regexp/syntax", - "syntax.OpEndLine": "regexp/syntax", - "syntax.OpEndText": "regexp/syntax", - "syntax.OpLiteral": "regexp/syntax", - "syntax.OpNoMatch": "regexp/syntax", - "syntax.OpNoWordBoundary": "regexp/syntax", - "syntax.OpPlus": "regexp/syntax", - "syntax.OpQuest": "regexp/syntax", - "syntax.OpRepeat": "regexp/syntax", - "syntax.OpStar": "regexp/syntax", - "syntax.OpWordBoundary": "regexp/syntax", - "syntax.POSIX": "regexp/syntax", - "syntax.Parse": "regexp/syntax", - "syntax.Perl": "regexp/syntax", - "syntax.PerlX": "regexp/syntax", - "syntax.Prog": "regexp/syntax", - "syntax.Regexp": "regexp/syntax", - "syntax.Simple": "regexp/syntax", - "syntax.UnicodeGroups": "regexp/syntax", - "syntax.WasDollar": "regexp/syntax", - "syscall.AF_ALG": "syscall", - "syscall.AF_APPLETALK": "syscall", - "syscall.AF_ARP": "syscall", - "syscall.AF_ASH": "syscall", - "syscall.AF_ATM": "syscall", - "syscall.AF_ATMPVC": "syscall", - "syscall.AF_ATMSVC": "syscall", - "syscall.AF_AX25": "syscall", - "syscall.AF_BLUETOOTH": "syscall", - "syscall.AF_BRIDGE": "syscall", - "syscall.AF_CAIF": "syscall", - "syscall.AF_CAN": "syscall", - "syscall.AF_CCITT": "syscall", - "syscall.AF_CHAOS": "syscall", - "syscall.AF_CNT": "syscall", - "syscall.AF_COIP": "syscall", - "syscall.AF_DATAKIT": "syscall", - "syscall.AF_DECnet": "syscall", - "syscall.AF_DLI": "syscall", - "syscall.AF_E164": "syscall", - "syscall.AF_ECMA": "syscall", - "syscall.AF_ECONET": "syscall", - "syscall.AF_ENCAP": "syscall", - "syscall.AF_FILE": "syscall", - "syscall.AF_HYLINK": "syscall", - "syscall.AF_IEEE80211": "syscall", - "syscall.AF_IEEE802154": "syscall", - "syscall.AF_IMPLINK": "syscall", - "syscall.AF_INET": "syscall", - "syscall.AF_INET6": "syscall", - "syscall.AF_INET6_SDP": "syscall", - "syscall.AF_INET_SDP": "syscall", - "syscall.AF_IPX": "syscall", - "syscall.AF_IRDA": "syscall", - "syscall.AF_ISDN": "syscall", - "syscall.AF_ISO": "syscall", - "syscall.AF_IUCV": "syscall", - "syscall.AF_KEY": "syscall", - "syscall.AF_LAT": "syscall", - "syscall.AF_LINK": "syscall", - "syscall.AF_LLC": "syscall", - "syscall.AF_LOCAL": "syscall", - "syscall.AF_MAX": "syscall", - "syscall.AF_MPLS": "syscall", - "syscall.AF_NATM": "syscall", - "syscall.AF_NDRV": "syscall", - "syscall.AF_NETBEUI": "syscall", - "syscall.AF_NETBIOS": "syscall", - "syscall.AF_NETGRAPH": "syscall", - "syscall.AF_NETLINK": "syscall", - "syscall.AF_NETROM": "syscall", - "syscall.AF_NS": "syscall", - "syscall.AF_OROUTE": "syscall", - "syscall.AF_OSI": "syscall", - "syscall.AF_PACKET": "syscall", - "syscall.AF_PHONET": "syscall", - "syscall.AF_PPP": "syscall", - "syscall.AF_PPPOX": "syscall", - "syscall.AF_PUP": "syscall", - "syscall.AF_RDS": "syscall", - "syscall.AF_RESERVED_36": "syscall", - "syscall.AF_ROSE": "syscall", - "syscall.AF_ROUTE": "syscall", - "syscall.AF_RXRPC": "syscall", - "syscall.AF_SCLUSTER": "syscall", - "syscall.AF_SECURITY": "syscall", - "syscall.AF_SIP": "syscall", - "syscall.AF_SLOW": "syscall", - "syscall.AF_SNA": "syscall", - "syscall.AF_SYSTEM": "syscall", - "syscall.AF_TIPC": "syscall", - "syscall.AF_UNIX": "syscall", - "syscall.AF_UNSPEC": "syscall", - "syscall.AF_VENDOR00": "syscall", - "syscall.AF_VENDOR01": "syscall", - "syscall.AF_VENDOR02": "syscall", - "syscall.AF_VENDOR03": "syscall", - "syscall.AF_VENDOR04": "syscall", - "syscall.AF_VENDOR05": "syscall", - "syscall.AF_VENDOR06": "syscall", - "syscall.AF_VENDOR07": "syscall", - "syscall.AF_VENDOR08": "syscall", - "syscall.AF_VENDOR09": "syscall", - "syscall.AF_VENDOR10": "syscall", - "syscall.AF_VENDOR11": "syscall", - "syscall.AF_VENDOR12": "syscall", - "syscall.AF_VENDOR13": "syscall", - "syscall.AF_VENDOR14": "syscall", - "syscall.AF_VENDOR15": "syscall", - "syscall.AF_VENDOR16": "syscall", - "syscall.AF_VENDOR17": "syscall", - "syscall.AF_VENDOR18": "syscall", - "syscall.AF_VENDOR19": "syscall", - "syscall.AF_VENDOR20": "syscall", - "syscall.AF_VENDOR21": "syscall", - "syscall.AF_VENDOR22": "syscall", - "syscall.AF_VENDOR23": "syscall", - "syscall.AF_VENDOR24": "syscall", - "syscall.AF_VENDOR25": "syscall", - "syscall.AF_VENDOR26": "syscall", - "syscall.AF_VENDOR27": "syscall", - "syscall.AF_VENDOR28": "syscall", - "syscall.AF_VENDOR29": "syscall", - "syscall.AF_VENDOR30": "syscall", - "syscall.AF_VENDOR31": "syscall", - "syscall.AF_VENDOR32": "syscall", - "syscall.AF_VENDOR33": "syscall", - "syscall.AF_VENDOR34": "syscall", - "syscall.AF_VENDOR35": "syscall", - "syscall.AF_VENDOR36": "syscall", - "syscall.AF_VENDOR37": "syscall", - "syscall.AF_VENDOR38": "syscall", - "syscall.AF_VENDOR39": "syscall", - "syscall.AF_VENDOR40": "syscall", - "syscall.AF_VENDOR41": "syscall", - "syscall.AF_VENDOR42": "syscall", - "syscall.AF_VENDOR43": "syscall", - "syscall.AF_VENDOR44": "syscall", - "syscall.AF_VENDOR45": "syscall", - "syscall.AF_VENDOR46": "syscall", - "syscall.AF_VENDOR47": "syscall", - "syscall.AF_WANPIPE": "syscall", - "syscall.AF_X25": "syscall", - "syscall.AI_CANONNAME": "syscall", - "syscall.AI_NUMERICHOST": "syscall", - "syscall.AI_PASSIVE": "syscall", - "syscall.APPLICATION_ERROR": "syscall", - "syscall.ARPHRD_ADAPT": "syscall", - "syscall.ARPHRD_APPLETLK": "syscall", - "syscall.ARPHRD_ARCNET": "syscall", - "syscall.ARPHRD_ASH": "syscall", - "syscall.ARPHRD_ATM": "syscall", - "syscall.ARPHRD_AX25": "syscall", - "syscall.ARPHRD_BIF": "syscall", - "syscall.ARPHRD_CHAOS": "syscall", - "syscall.ARPHRD_CISCO": "syscall", - "syscall.ARPHRD_CSLIP": "syscall", - "syscall.ARPHRD_CSLIP6": "syscall", - "syscall.ARPHRD_DDCMP": "syscall", - "syscall.ARPHRD_DLCI": "syscall", - "syscall.ARPHRD_ECONET": "syscall", - "syscall.ARPHRD_EETHER": "syscall", - "syscall.ARPHRD_ETHER": "syscall", - "syscall.ARPHRD_EUI64": "syscall", - "syscall.ARPHRD_FCAL": "syscall", - "syscall.ARPHRD_FCFABRIC": "syscall", - "syscall.ARPHRD_FCPL": "syscall", - "syscall.ARPHRD_FCPP": "syscall", - "syscall.ARPHRD_FDDI": "syscall", - "syscall.ARPHRD_FRAD": "syscall", - "syscall.ARPHRD_FRELAY": "syscall", - "syscall.ARPHRD_HDLC": "syscall", - "syscall.ARPHRD_HIPPI": "syscall", - "syscall.ARPHRD_HWX25": "syscall", - "syscall.ARPHRD_IEEE1394": "syscall", - "syscall.ARPHRD_IEEE802": "syscall", - "syscall.ARPHRD_IEEE80211": "syscall", - "syscall.ARPHRD_IEEE80211_PRISM": "syscall", - "syscall.ARPHRD_IEEE80211_RADIOTAP": "syscall", - "syscall.ARPHRD_IEEE802154": "syscall", - "syscall.ARPHRD_IEEE802154_PHY": "syscall", - "syscall.ARPHRD_IEEE802_TR": "syscall", - "syscall.ARPHRD_INFINIBAND": "syscall", - "syscall.ARPHRD_IPDDP": "syscall", - "syscall.ARPHRD_IPGRE": "syscall", - "syscall.ARPHRD_IRDA": "syscall", - "syscall.ARPHRD_LAPB": "syscall", - "syscall.ARPHRD_LOCALTLK": "syscall", - "syscall.ARPHRD_LOOPBACK": "syscall", - "syscall.ARPHRD_METRICOM": "syscall", - "syscall.ARPHRD_NETROM": "syscall", - "syscall.ARPHRD_NONE": "syscall", - "syscall.ARPHRD_PIMREG": "syscall", - "syscall.ARPHRD_PPP": "syscall", - "syscall.ARPHRD_PRONET": "syscall", - "syscall.ARPHRD_RAWHDLC": "syscall", - "syscall.ARPHRD_ROSE": "syscall", - "syscall.ARPHRD_RSRVD": "syscall", - "syscall.ARPHRD_SIT": "syscall", - "syscall.ARPHRD_SKIP": "syscall", - "syscall.ARPHRD_SLIP": "syscall", - "syscall.ARPHRD_SLIP6": "syscall", - "syscall.ARPHRD_STRIP": "syscall", - "syscall.ARPHRD_TUNNEL": "syscall", - "syscall.ARPHRD_TUNNEL6": "syscall", - "syscall.ARPHRD_VOID": "syscall", - "syscall.ARPHRD_X25": "syscall", - "syscall.AUTHTYPE_CLIENT": "syscall", - "syscall.AUTHTYPE_SERVER": "syscall", - "syscall.Accept": "syscall", - "syscall.Accept4": "syscall", - "syscall.AcceptEx": "syscall", - "syscall.Access": "syscall", - "syscall.Acct": "syscall", - "syscall.AddrinfoW": "syscall", - "syscall.Adjtime": "syscall", - "syscall.Adjtimex": "syscall", - "syscall.AttachLsf": "syscall", - "syscall.B0": "syscall", - "syscall.B1000000": "syscall", - "syscall.B110": "syscall", - "syscall.B115200": "syscall", - "syscall.B1152000": "syscall", - "syscall.B1200": "syscall", - "syscall.B134": "syscall", - "syscall.B14400": "syscall", - "syscall.B150": "syscall", - "syscall.B1500000": "syscall", - "syscall.B1800": "syscall", - "syscall.B19200": "syscall", - "syscall.B200": "syscall", - "syscall.B2000000": "syscall", - "syscall.B230400": "syscall", - "syscall.B2400": "syscall", - "syscall.B2500000": "syscall", - "syscall.B28800": "syscall", - "syscall.B300": "syscall", - "syscall.B3000000": "syscall", - "syscall.B3500000": "syscall", - "syscall.B38400": "syscall", - "syscall.B4000000": "syscall", - "syscall.B460800": "syscall", - "syscall.B4800": "syscall", - "syscall.B50": "syscall", - "syscall.B500000": "syscall", - "syscall.B57600": "syscall", - "syscall.B576000": "syscall", - "syscall.B600": "syscall", - "syscall.B7200": "syscall", - "syscall.B75": "syscall", - "syscall.B76800": "syscall", - "syscall.B921600": "syscall", - "syscall.B9600": "syscall", - "syscall.BASE_PROTOCOL": "syscall", - "syscall.BIOCFEEDBACK": "syscall", - "syscall.BIOCFLUSH": "syscall", - "syscall.BIOCGBLEN": "syscall", - "syscall.BIOCGDIRECTION": "syscall", - "syscall.BIOCGDIRFILT": "syscall", - "syscall.BIOCGDLT": "syscall", - "syscall.BIOCGDLTLIST": "syscall", - "syscall.BIOCGETBUFMODE": "syscall", - "syscall.BIOCGETIF": "syscall", - "syscall.BIOCGETZMAX": "syscall", - "syscall.BIOCGFEEDBACK": "syscall", - "syscall.BIOCGFILDROP": "syscall", - "syscall.BIOCGHDRCMPLT": "syscall", - "syscall.BIOCGRSIG": "syscall", - "syscall.BIOCGRTIMEOUT": "syscall", - "syscall.BIOCGSEESENT": "syscall", - "syscall.BIOCGSTATS": "syscall", - "syscall.BIOCGSTATSOLD": "syscall", - "syscall.BIOCGTSTAMP": "syscall", - "syscall.BIOCIMMEDIATE": "syscall", - "syscall.BIOCLOCK": "syscall", - "syscall.BIOCPROMISC": "syscall", - "syscall.BIOCROTZBUF": "syscall", - "syscall.BIOCSBLEN": "syscall", - "syscall.BIOCSDIRECTION": "syscall", - "syscall.BIOCSDIRFILT": "syscall", - "syscall.BIOCSDLT": "syscall", - "syscall.BIOCSETBUFMODE": "syscall", - "syscall.BIOCSETF": "syscall", - "syscall.BIOCSETFNR": "syscall", - "syscall.BIOCSETIF": "syscall", - "syscall.BIOCSETWF": "syscall", - "syscall.BIOCSETZBUF": "syscall", - "syscall.BIOCSFEEDBACK": "syscall", - "syscall.BIOCSFILDROP": "syscall", - "syscall.BIOCSHDRCMPLT": "syscall", - "syscall.BIOCSRSIG": "syscall", - "syscall.BIOCSRTIMEOUT": "syscall", - "syscall.BIOCSSEESENT": "syscall", - "syscall.BIOCSTCPF": "syscall", - "syscall.BIOCSTSTAMP": "syscall", - "syscall.BIOCSUDPF": "syscall", - "syscall.BIOCVERSION": "syscall", - "syscall.BPF_A": "syscall", - "syscall.BPF_ABS": "syscall", - "syscall.BPF_ADD": "syscall", - "syscall.BPF_ALIGNMENT": "syscall", - "syscall.BPF_ALIGNMENT32": "syscall", - "syscall.BPF_ALU": "syscall", - "syscall.BPF_AND": "syscall", - "syscall.BPF_B": "syscall", - "syscall.BPF_BUFMODE_BUFFER": "syscall", - "syscall.BPF_BUFMODE_ZBUF": "syscall", - "syscall.BPF_DFLTBUFSIZE": "syscall", - "syscall.BPF_DIRECTION_IN": "syscall", - "syscall.BPF_DIRECTION_OUT": "syscall", - "syscall.BPF_DIV": "syscall", - "syscall.BPF_H": "syscall", - "syscall.BPF_IMM": "syscall", - "syscall.BPF_IND": "syscall", - "syscall.BPF_JA": "syscall", - "syscall.BPF_JEQ": "syscall", - "syscall.BPF_JGE": "syscall", - "syscall.BPF_JGT": "syscall", - "syscall.BPF_JMP": "syscall", - "syscall.BPF_JSET": "syscall", - "syscall.BPF_K": "syscall", - "syscall.BPF_LD": "syscall", - "syscall.BPF_LDX": "syscall", - "syscall.BPF_LEN": "syscall", - "syscall.BPF_LSH": "syscall", - "syscall.BPF_MAJOR_VERSION": "syscall", - "syscall.BPF_MAXBUFSIZE": "syscall", - "syscall.BPF_MAXINSNS": "syscall", - "syscall.BPF_MEM": "syscall", - "syscall.BPF_MEMWORDS": "syscall", - "syscall.BPF_MINBUFSIZE": "syscall", - "syscall.BPF_MINOR_VERSION": "syscall", - "syscall.BPF_MISC": "syscall", - "syscall.BPF_MSH": "syscall", - "syscall.BPF_MUL": "syscall", - "syscall.BPF_NEG": "syscall", - "syscall.BPF_OR": "syscall", - "syscall.BPF_RELEASE": "syscall", - "syscall.BPF_RET": "syscall", - "syscall.BPF_RSH": "syscall", - "syscall.BPF_ST": "syscall", - "syscall.BPF_STX": "syscall", - "syscall.BPF_SUB": "syscall", - "syscall.BPF_TAX": "syscall", - "syscall.BPF_TXA": "syscall", - "syscall.BPF_T_BINTIME": "syscall", - "syscall.BPF_T_BINTIME_FAST": "syscall", - "syscall.BPF_T_BINTIME_MONOTONIC": "syscall", - "syscall.BPF_T_BINTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_FAST": "syscall", - "syscall.BPF_T_FLAG_MASK": "syscall", - "syscall.BPF_T_FORMAT_MASK": "syscall", - "syscall.BPF_T_MICROTIME": "syscall", - "syscall.BPF_T_MICROTIME_FAST": "syscall", - "syscall.BPF_T_MICROTIME_MONOTONIC": "syscall", - "syscall.BPF_T_MICROTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_MONOTONIC": "syscall", - "syscall.BPF_T_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_NANOTIME": "syscall", - "syscall.BPF_T_NANOTIME_FAST": "syscall", - "syscall.BPF_T_NANOTIME_MONOTONIC": "syscall", - "syscall.BPF_T_NANOTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_NONE": "syscall", - "syscall.BPF_T_NORMAL": "syscall", - "syscall.BPF_W": "syscall", - "syscall.BPF_X": "syscall", - "syscall.BRKINT": "syscall", - "syscall.Bind": "syscall", - "syscall.BindToDevice": "syscall", - "syscall.BpfBuflen": "syscall", - "syscall.BpfDatalink": "syscall", - "syscall.BpfHdr": "syscall", - "syscall.BpfHeadercmpl": "syscall", - "syscall.BpfInsn": "syscall", - "syscall.BpfInterface": "syscall", - "syscall.BpfJump": "syscall", - "syscall.BpfProgram": "syscall", - "syscall.BpfStat": "syscall", - "syscall.BpfStats": "syscall", - "syscall.BpfStmt": "syscall", - "syscall.BpfTimeout": "syscall", - "syscall.BpfTimeval": "syscall", - "syscall.BpfVersion": "syscall", - "syscall.BpfZbuf": "syscall", - "syscall.BpfZbufHeader": "syscall", - "syscall.ByHandleFileInformation": "syscall", - "syscall.BytePtrFromString": "syscall", - "syscall.ByteSliceFromString": "syscall", - "syscall.CCR0_FLUSH": "syscall", - "syscall.CERT_CHAIN_POLICY_AUTHENTICODE": "syscall", - "syscall.CERT_CHAIN_POLICY_AUTHENTICODE_TS": "syscall", - "syscall.CERT_CHAIN_POLICY_BASE": "syscall", - "syscall.CERT_CHAIN_POLICY_BASIC_CONSTRAINTS": "syscall", - "syscall.CERT_CHAIN_POLICY_EV": "syscall", - "syscall.CERT_CHAIN_POLICY_MICROSOFT_ROOT": "syscall", - "syscall.CERT_CHAIN_POLICY_NT_AUTH": "syscall", - "syscall.CERT_CHAIN_POLICY_SSL": "syscall", - "syscall.CERT_E_CN_NO_MATCH": "syscall", - "syscall.CERT_E_EXPIRED": "syscall", - "syscall.CERT_E_PURPOSE": "syscall", - "syscall.CERT_E_ROLE": "syscall", - "syscall.CERT_E_UNTRUSTEDROOT": "syscall", - "syscall.CERT_STORE_ADD_ALWAYS": "syscall", - "syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG": "syscall", - "syscall.CERT_STORE_PROV_MEMORY": "syscall", - "syscall.CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_INVALID_BASIC_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_INVALID_EXTENSION": "syscall", - "syscall.CERT_TRUST_INVALID_NAME_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_INVALID_POLICY_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_IS_CYCLIC": "syscall", - "syscall.CERT_TRUST_IS_EXPLICIT_DISTRUST": "syscall", - "syscall.CERT_TRUST_IS_NOT_SIGNATURE_VALID": "syscall", - "syscall.CERT_TRUST_IS_NOT_TIME_VALID": "syscall", - "syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE": "syscall", - "syscall.CERT_TRUST_IS_OFFLINE_REVOCATION": "syscall", - "syscall.CERT_TRUST_IS_REVOKED": "syscall", - "syscall.CERT_TRUST_IS_UNTRUSTED_ROOT": "syscall", - "syscall.CERT_TRUST_NO_ERROR": "syscall", - "syscall.CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY": "syscall", - "syscall.CERT_TRUST_REVOCATION_STATUS_UNKNOWN": "syscall", - "syscall.CFLUSH": "syscall", - "syscall.CLOCAL": "syscall", - "syscall.CLONE_CHILD_CLEARTID": "syscall", - "syscall.CLONE_CHILD_SETTID": "syscall", - "syscall.CLONE_CSIGNAL": "syscall", - "syscall.CLONE_DETACHED": "syscall", - "syscall.CLONE_FILES": "syscall", - "syscall.CLONE_FS": "syscall", - "syscall.CLONE_IO": "syscall", - "syscall.CLONE_NEWIPC": "syscall", - "syscall.CLONE_NEWNET": "syscall", - "syscall.CLONE_NEWNS": "syscall", - "syscall.CLONE_NEWPID": "syscall", - "syscall.CLONE_NEWUSER": "syscall", - "syscall.CLONE_NEWUTS": "syscall", - "syscall.CLONE_PARENT": "syscall", - "syscall.CLONE_PARENT_SETTID": "syscall", - "syscall.CLONE_PID": "syscall", - "syscall.CLONE_PTRACE": "syscall", - "syscall.CLONE_SETTLS": "syscall", - "syscall.CLONE_SIGHAND": "syscall", - "syscall.CLONE_SYSVSEM": "syscall", - "syscall.CLONE_THREAD": "syscall", - "syscall.CLONE_UNTRACED": "syscall", - "syscall.CLONE_VFORK": "syscall", - "syscall.CLONE_VM": "syscall", - "syscall.CPUID_CFLUSH": "syscall", - "syscall.CREAD": "syscall", - "syscall.CREATE_ALWAYS": "syscall", - "syscall.CREATE_NEW": "syscall", - "syscall.CREATE_NEW_PROCESS_GROUP": "syscall", - "syscall.CREATE_UNICODE_ENVIRONMENT": "syscall", - "syscall.CRYPT_DEFAULT_CONTAINER_OPTIONAL": "syscall", - "syscall.CRYPT_DELETEKEYSET": "syscall", - "syscall.CRYPT_MACHINE_KEYSET": "syscall", - "syscall.CRYPT_NEWKEYSET": "syscall", - "syscall.CRYPT_SILENT": "syscall", - "syscall.CRYPT_VERIFYCONTEXT": "syscall", - "syscall.CS5": "syscall", - "syscall.CS6": "syscall", - "syscall.CS7": "syscall", - "syscall.CS8": "syscall", - "syscall.CSIZE": "syscall", - "syscall.CSTART": "syscall", - "syscall.CSTATUS": "syscall", - "syscall.CSTOP": "syscall", - "syscall.CSTOPB": "syscall", - "syscall.CSUSP": "syscall", - "syscall.CTL_MAXNAME": "syscall", - "syscall.CTL_NET": "syscall", - "syscall.CTL_QUERY": "syscall", - "syscall.CTRL_BREAK_EVENT": "syscall", - "syscall.CTRL_C_EVENT": "syscall", - "syscall.CancelIo": "syscall", - "syscall.CancelIoEx": "syscall", - "syscall.CertAddCertificateContextToStore": "syscall", - "syscall.CertChainContext": "syscall", - "syscall.CertChainElement": "syscall", - "syscall.CertChainPara": "syscall", - "syscall.CertChainPolicyPara": "syscall", - "syscall.CertChainPolicyStatus": "syscall", - "syscall.CertCloseStore": "syscall", - "syscall.CertContext": "syscall", - "syscall.CertCreateCertificateContext": "syscall", - "syscall.CertEnhKeyUsage": "syscall", - "syscall.CertEnumCertificatesInStore": "syscall", - "syscall.CertFreeCertificateChain": "syscall", - "syscall.CertFreeCertificateContext": "syscall", - "syscall.CertGetCertificateChain": "syscall", - "syscall.CertOpenStore": "syscall", - "syscall.CertOpenSystemStore": "syscall", - "syscall.CertRevocationInfo": "syscall", - "syscall.CertSimpleChain": "syscall", - "syscall.CertTrustStatus": "syscall", - "syscall.CertUsageMatch": "syscall", - "syscall.CertVerifyCertificateChainPolicy": "syscall", - "syscall.Chdir": "syscall", - "syscall.CheckBpfVersion": "syscall", - "syscall.Chflags": "syscall", - "syscall.Chmod": "syscall", - "syscall.Chown": "syscall", - "syscall.Chroot": "syscall", - "syscall.Clearenv": "syscall", - "syscall.Close": "syscall", - "syscall.CloseHandle": "syscall", - "syscall.CloseOnExec": "syscall", - "syscall.Closesocket": "syscall", - "syscall.CmsgLen": "syscall", - "syscall.CmsgSpace": "syscall", - "syscall.Cmsghdr": "syscall", - "syscall.CommandLineToArgv": "syscall", - "syscall.ComputerName": "syscall", - "syscall.Connect": "syscall", - "syscall.ConnectEx": "syscall", - "syscall.ConvertSidToStringSid": "syscall", - "syscall.ConvertStringSidToSid": "syscall", - "syscall.CopySid": "syscall", - "syscall.Creat": "syscall", - "syscall.CreateDirectory": "syscall", - "syscall.CreateFile": "syscall", - "syscall.CreateFileMapping": "syscall", - "syscall.CreateHardLink": "syscall", - "syscall.CreateIoCompletionPort": "syscall", - "syscall.CreatePipe": "syscall", - "syscall.CreateProcess": "syscall", - "syscall.CreateSymbolicLink": "syscall", - "syscall.CreateToolhelp32Snapshot": "syscall", - "syscall.Credential": "syscall", - "syscall.CryptAcquireContext": "syscall", - "syscall.CryptGenRandom": "syscall", - "syscall.CryptReleaseContext": "syscall", - "syscall.DIOCBSFLUSH": "syscall", - "syscall.DIOCOSFPFLUSH": "syscall", - "syscall.DLL": "syscall", - "syscall.DLLError": "syscall", - "syscall.DLT_A429": "syscall", - "syscall.DLT_A653_ICM": "syscall", - "syscall.DLT_AIRONET_HEADER": "syscall", - "syscall.DLT_AOS": "syscall", - "syscall.DLT_APPLE_IP_OVER_IEEE1394": "syscall", - "syscall.DLT_ARCNET": "syscall", - "syscall.DLT_ARCNET_LINUX": "syscall", - "syscall.DLT_ATM_CLIP": "syscall", - "syscall.DLT_ATM_RFC1483": "syscall", - "syscall.DLT_AURORA": "syscall", - "syscall.DLT_AX25": "syscall", - "syscall.DLT_AX25_KISS": "syscall", - "syscall.DLT_BACNET_MS_TP": "syscall", - "syscall.DLT_BLUETOOTH_HCI_H4": "syscall", - "syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "syscall", - "syscall.DLT_CAN20B": "syscall", - "syscall.DLT_CAN_SOCKETCAN": "syscall", - "syscall.DLT_CHAOS": "syscall", - "syscall.DLT_CHDLC": "syscall", - "syscall.DLT_CISCO_IOS": "syscall", - "syscall.DLT_C_HDLC": "syscall", - "syscall.DLT_C_HDLC_WITH_DIR": "syscall", - "syscall.DLT_DBUS": "syscall", - "syscall.DLT_DECT": "syscall", - "syscall.DLT_DOCSIS": "syscall", - "syscall.DLT_DVB_CI": "syscall", - "syscall.DLT_ECONET": "syscall", - "syscall.DLT_EN10MB": "syscall", - "syscall.DLT_EN3MB": "syscall", - "syscall.DLT_ENC": "syscall", - "syscall.DLT_ERF": "syscall", - "syscall.DLT_ERF_ETH": "syscall", - "syscall.DLT_ERF_POS": "syscall", - "syscall.DLT_FC_2": "syscall", - "syscall.DLT_FC_2_WITH_FRAME_DELIMS": "syscall", - "syscall.DLT_FDDI": "syscall", - "syscall.DLT_FLEXRAY": "syscall", - "syscall.DLT_FRELAY": "syscall", - "syscall.DLT_FRELAY_WITH_DIR": "syscall", - "syscall.DLT_GCOM_SERIAL": "syscall", - "syscall.DLT_GCOM_T1E1": "syscall", - "syscall.DLT_GPF_F": "syscall", - "syscall.DLT_GPF_T": "syscall", - "syscall.DLT_GPRS_LLC": "syscall", - "syscall.DLT_GSMTAP_ABIS": "syscall", - "syscall.DLT_GSMTAP_UM": "syscall", - "syscall.DLT_HDLC": "syscall", - "syscall.DLT_HHDLC": "syscall", - "syscall.DLT_HIPPI": "syscall", - "syscall.DLT_IBM_SN": "syscall", - "syscall.DLT_IBM_SP": "syscall", - "syscall.DLT_IEEE802": "syscall", - "syscall.DLT_IEEE802_11": "syscall", - "syscall.DLT_IEEE802_11_RADIO": "syscall", - "syscall.DLT_IEEE802_11_RADIO_AVS": "syscall", - "syscall.DLT_IEEE802_15_4": "syscall", - "syscall.DLT_IEEE802_15_4_LINUX": "syscall", - "syscall.DLT_IEEE802_15_4_NOFCS": "syscall", - "syscall.DLT_IEEE802_15_4_NONASK_PHY": "syscall", - "syscall.DLT_IEEE802_16_MAC_CPS": "syscall", - "syscall.DLT_IEEE802_16_MAC_CPS_RADIO": "syscall", - "syscall.DLT_IPFILTER": "syscall", - "syscall.DLT_IPMB": "syscall", - "syscall.DLT_IPMB_LINUX": "syscall", - "syscall.DLT_IPNET": "syscall", - "syscall.DLT_IPOIB": "syscall", - "syscall.DLT_IPV4": "syscall", - "syscall.DLT_IPV6": "syscall", - "syscall.DLT_IP_OVER_FC": "syscall", - "syscall.DLT_JUNIPER_ATM1": "syscall", - "syscall.DLT_JUNIPER_ATM2": "syscall", - "syscall.DLT_JUNIPER_ATM_CEMIC": "syscall", - "syscall.DLT_JUNIPER_CHDLC": "syscall", - "syscall.DLT_JUNIPER_ES": "syscall", - "syscall.DLT_JUNIPER_ETHER": "syscall", - "syscall.DLT_JUNIPER_FIBRECHANNEL": "syscall", - "syscall.DLT_JUNIPER_FRELAY": "syscall", - "syscall.DLT_JUNIPER_GGSN": "syscall", - "syscall.DLT_JUNIPER_ISM": "syscall", - "syscall.DLT_JUNIPER_MFR": "syscall", - "syscall.DLT_JUNIPER_MLFR": "syscall", - "syscall.DLT_JUNIPER_MLPPP": "syscall", - "syscall.DLT_JUNIPER_MONITOR": "syscall", - "syscall.DLT_JUNIPER_PIC_PEER": "syscall", - "syscall.DLT_JUNIPER_PPP": "syscall", - "syscall.DLT_JUNIPER_PPPOE": "syscall", - "syscall.DLT_JUNIPER_PPPOE_ATM": "syscall", - "syscall.DLT_JUNIPER_SERVICES": "syscall", - "syscall.DLT_JUNIPER_SRX_E2E": "syscall", - "syscall.DLT_JUNIPER_ST": "syscall", - "syscall.DLT_JUNIPER_VP": "syscall", - "syscall.DLT_JUNIPER_VS": "syscall", - "syscall.DLT_LAPB_WITH_DIR": "syscall", - "syscall.DLT_LAPD": "syscall", - "syscall.DLT_LIN": "syscall", - "syscall.DLT_LINUX_EVDEV": "syscall", - "syscall.DLT_LINUX_IRDA": "syscall", - "syscall.DLT_LINUX_LAPD": "syscall", - "syscall.DLT_LINUX_PPP_WITHDIRECTION": "syscall", - "syscall.DLT_LINUX_SLL": "syscall", - "syscall.DLT_LOOP": "syscall", - "syscall.DLT_LTALK": "syscall", - "syscall.DLT_MATCHING_MAX": "syscall", - "syscall.DLT_MATCHING_MIN": "syscall", - "syscall.DLT_MFR": "syscall", - "syscall.DLT_MOST": "syscall", - "syscall.DLT_MPEG_2_TS": "syscall", - "syscall.DLT_MPLS": "syscall", - "syscall.DLT_MTP2": "syscall", - "syscall.DLT_MTP2_WITH_PHDR": "syscall", - "syscall.DLT_MTP3": "syscall", - "syscall.DLT_MUX27010": "syscall", - "syscall.DLT_NETANALYZER": "syscall", - "syscall.DLT_NETANALYZER_TRANSPARENT": "syscall", - "syscall.DLT_NFC_LLCP": "syscall", - "syscall.DLT_NFLOG": "syscall", - "syscall.DLT_NG40": "syscall", - "syscall.DLT_NULL": "syscall", - "syscall.DLT_PCI_EXP": "syscall", - "syscall.DLT_PFLOG": "syscall", - "syscall.DLT_PFSYNC": "syscall", - "syscall.DLT_PPI": "syscall", - "syscall.DLT_PPP": "syscall", - "syscall.DLT_PPP_BSDOS": "syscall", - "syscall.DLT_PPP_ETHER": "syscall", - "syscall.DLT_PPP_PPPD": "syscall", - "syscall.DLT_PPP_SERIAL": "syscall", - "syscall.DLT_PPP_WITH_DIR": "syscall", - "syscall.DLT_PPP_WITH_DIRECTION": "syscall", - "syscall.DLT_PRISM_HEADER": "syscall", - "syscall.DLT_PRONET": "syscall", - "syscall.DLT_RAIF1": "syscall", - "syscall.DLT_RAW": "syscall", - "syscall.DLT_RAWAF_MASK": "syscall", - "syscall.DLT_RIO": "syscall", - "syscall.DLT_SCCP": "syscall", - "syscall.DLT_SITA": "syscall", - "syscall.DLT_SLIP": "syscall", - "syscall.DLT_SLIP_BSDOS": "syscall", - "syscall.DLT_STANAG_5066_D_PDU": "syscall", - "syscall.DLT_SUNATM": "syscall", - "syscall.DLT_SYMANTEC_FIREWALL": "syscall", - "syscall.DLT_TZSP": "syscall", - "syscall.DLT_USB": "syscall", - "syscall.DLT_USB_LINUX": "syscall", - "syscall.DLT_USB_LINUX_MMAPPED": "syscall", - "syscall.DLT_USER0": "syscall", - "syscall.DLT_USER1": "syscall", - "syscall.DLT_USER10": "syscall", - "syscall.DLT_USER11": "syscall", - "syscall.DLT_USER12": "syscall", - "syscall.DLT_USER13": "syscall", - "syscall.DLT_USER14": "syscall", - "syscall.DLT_USER15": "syscall", - "syscall.DLT_USER2": "syscall", - "syscall.DLT_USER3": "syscall", - "syscall.DLT_USER4": "syscall", - "syscall.DLT_USER5": "syscall", - "syscall.DLT_USER6": "syscall", - "syscall.DLT_USER7": "syscall", - "syscall.DLT_USER8": "syscall", - "syscall.DLT_USER9": "syscall", - "syscall.DLT_WIHART": "syscall", - "syscall.DLT_X2E_SERIAL": "syscall", - "syscall.DLT_X2E_XORAYA": "syscall", - "syscall.DNSMXData": "syscall", - "syscall.DNSPTRData": "syscall", - "syscall.DNSRecord": "syscall", - "syscall.DNSSRVData": "syscall", - "syscall.DNSTXTData": "syscall", - "syscall.DNS_INFO_NO_RECORDS": "syscall", - "syscall.DNS_TYPE_A": "syscall", - "syscall.DNS_TYPE_A6": "syscall", - "syscall.DNS_TYPE_AAAA": "syscall", - "syscall.DNS_TYPE_ADDRS": "syscall", - "syscall.DNS_TYPE_AFSDB": "syscall", - "syscall.DNS_TYPE_ALL": "syscall", - "syscall.DNS_TYPE_ANY": "syscall", - "syscall.DNS_TYPE_ATMA": "syscall", - "syscall.DNS_TYPE_AXFR": "syscall", - "syscall.DNS_TYPE_CERT": "syscall", - "syscall.DNS_TYPE_CNAME": "syscall", - "syscall.DNS_TYPE_DHCID": "syscall", - "syscall.DNS_TYPE_DNAME": "syscall", - "syscall.DNS_TYPE_DNSKEY": "syscall", - "syscall.DNS_TYPE_DS": "syscall", - "syscall.DNS_TYPE_EID": "syscall", - "syscall.DNS_TYPE_GID": "syscall", - "syscall.DNS_TYPE_GPOS": "syscall", - "syscall.DNS_TYPE_HINFO": "syscall", - "syscall.DNS_TYPE_ISDN": "syscall", - "syscall.DNS_TYPE_IXFR": "syscall", - "syscall.DNS_TYPE_KEY": "syscall", - "syscall.DNS_TYPE_KX": "syscall", - "syscall.DNS_TYPE_LOC": "syscall", - "syscall.DNS_TYPE_MAILA": "syscall", - "syscall.DNS_TYPE_MAILB": "syscall", - "syscall.DNS_TYPE_MB": "syscall", - "syscall.DNS_TYPE_MD": "syscall", - "syscall.DNS_TYPE_MF": "syscall", - "syscall.DNS_TYPE_MG": "syscall", - "syscall.DNS_TYPE_MINFO": "syscall", - "syscall.DNS_TYPE_MR": "syscall", - "syscall.DNS_TYPE_MX": "syscall", - "syscall.DNS_TYPE_NAPTR": "syscall", - "syscall.DNS_TYPE_NBSTAT": "syscall", - "syscall.DNS_TYPE_NIMLOC": "syscall", - "syscall.DNS_TYPE_NS": "syscall", - "syscall.DNS_TYPE_NSAP": "syscall", - "syscall.DNS_TYPE_NSAPPTR": "syscall", - "syscall.DNS_TYPE_NSEC": "syscall", - "syscall.DNS_TYPE_NULL": "syscall", - "syscall.DNS_TYPE_NXT": "syscall", - "syscall.DNS_TYPE_OPT": "syscall", - "syscall.DNS_TYPE_PTR": "syscall", - "syscall.DNS_TYPE_PX": "syscall", - "syscall.DNS_TYPE_RP": "syscall", - "syscall.DNS_TYPE_RRSIG": "syscall", - "syscall.DNS_TYPE_RT": "syscall", - "syscall.DNS_TYPE_SIG": "syscall", - "syscall.DNS_TYPE_SINK": "syscall", - "syscall.DNS_TYPE_SOA": "syscall", - "syscall.DNS_TYPE_SRV": "syscall", - "syscall.DNS_TYPE_TEXT": "syscall", - "syscall.DNS_TYPE_TKEY": "syscall", - "syscall.DNS_TYPE_TSIG": "syscall", - "syscall.DNS_TYPE_UID": "syscall", - "syscall.DNS_TYPE_UINFO": "syscall", - "syscall.DNS_TYPE_UNSPEC": "syscall", - "syscall.DNS_TYPE_WINS": "syscall", - "syscall.DNS_TYPE_WINSR": "syscall", - "syscall.DNS_TYPE_WKS": "syscall", - "syscall.DNS_TYPE_X25": "syscall", - "syscall.DT_BLK": "syscall", - "syscall.DT_CHR": "syscall", - "syscall.DT_DIR": "syscall", - "syscall.DT_FIFO": "syscall", - "syscall.DT_LNK": "syscall", - "syscall.DT_REG": "syscall", - "syscall.DT_SOCK": "syscall", - "syscall.DT_UNKNOWN": "syscall", - "syscall.DT_WHT": "syscall", - "syscall.DUPLICATE_CLOSE_SOURCE": "syscall", - "syscall.DUPLICATE_SAME_ACCESS": "syscall", - "syscall.DeleteFile": "syscall", - "syscall.DetachLsf": "syscall", - "syscall.DeviceIoControl": "syscall", - "syscall.Dirent": "syscall", - "syscall.DnsNameCompare": "syscall", - "syscall.DnsQuery": "syscall", - "syscall.DnsRecordListFree": "syscall", - "syscall.DnsSectionAdditional": "syscall", - "syscall.DnsSectionAnswer": "syscall", - "syscall.DnsSectionAuthority": "syscall", - "syscall.DnsSectionQuestion": "syscall", - "syscall.Dup": "syscall", - "syscall.Dup2": "syscall", - "syscall.Dup3": "syscall", - "syscall.DuplicateHandle": "syscall", - "syscall.E2BIG": "syscall", - "syscall.EACCES": "syscall", - "syscall.EADDRINUSE": "syscall", - "syscall.EADDRNOTAVAIL": "syscall", - "syscall.EADV": "syscall", - "syscall.EAFNOSUPPORT": "syscall", - "syscall.EAGAIN": "syscall", - "syscall.EALREADY": "syscall", - "syscall.EAUTH": "syscall", - "syscall.EBADARCH": "syscall", - "syscall.EBADE": "syscall", - "syscall.EBADEXEC": "syscall", - "syscall.EBADF": "syscall", - "syscall.EBADFD": "syscall", - "syscall.EBADMACHO": "syscall", - "syscall.EBADMSG": "syscall", - "syscall.EBADR": "syscall", - "syscall.EBADRPC": "syscall", - "syscall.EBADRQC": "syscall", - "syscall.EBADSLT": "syscall", - "syscall.EBFONT": "syscall", - "syscall.EBUSY": "syscall", - "syscall.ECANCELED": "syscall", - "syscall.ECAPMODE": "syscall", - "syscall.ECHILD": "syscall", - "syscall.ECHO": "syscall", - "syscall.ECHOCTL": "syscall", - "syscall.ECHOE": "syscall", - "syscall.ECHOK": "syscall", - "syscall.ECHOKE": "syscall", - "syscall.ECHONL": "syscall", - "syscall.ECHOPRT": "syscall", - "syscall.ECHRNG": "syscall", - "syscall.ECOMM": "syscall", - "syscall.ECONNABORTED": "syscall", - "syscall.ECONNREFUSED": "syscall", - "syscall.ECONNRESET": "syscall", - "syscall.EDEADLK": "syscall", - "syscall.EDEADLOCK": "syscall", - "syscall.EDESTADDRREQ": "syscall", - "syscall.EDEVERR": "syscall", - "syscall.EDOM": "syscall", - "syscall.EDOOFUS": "syscall", - "syscall.EDOTDOT": "syscall", - "syscall.EDQUOT": "syscall", - "syscall.EEXIST": "syscall", - "syscall.EFAULT": "syscall", - "syscall.EFBIG": "syscall", - "syscall.EFER_LMA": "syscall", - "syscall.EFER_LME": "syscall", - "syscall.EFER_NXE": "syscall", - "syscall.EFER_SCE": "syscall", - "syscall.EFTYPE": "syscall", - "syscall.EHOSTDOWN": "syscall", - "syscall.EHOSTUNREACH": "syscall", - "syscall.EHWPOISON": "syscall", - "syscall.EIDRM": "syscall", - "syscall.EILSEQ": "syscall", - "syscall.EINPROGRESS": "syscall", - "syscall.EINTR": "syscall", - "syscall.EINVAL": "syscall", - "syscall.EIO": "syscall", - "syscall.EIPSEC": "syscall", - "syscall.EISCONN": "syscall", - "syscall.EISDIR": "syscall", - "syscall.EISNAM": "syscall", - "syscall.EKEYEXPIRED": "syscall", - "syscall.EKEYREJECTED": "syscall", - "syscall.EKEYREVOKED": "syscall", - "syscall.EL2HLT": "syscall", - "syscall.EL2NSYNC": "syscall", - "syscall.EL3HLT": "syscall", - "syscall.EL3RST": "syscall", - "syscall.ELAST": "syscall", - "syscall.ELF_NGREG": "syscall", - "syscall.ELF_PRARGSZ": "syscall", - "syscall.ELIBACC": "syscall", - "syscall.ELIBBAD": "syscall", - "syscall.ELIBEXEC": "syscall", - "syscall.ELIBMAX": "syscall", - "syscall.ELIBSCN": "syscall", - "syscall.ELNRNG": "syscall", - "syscall.ELOOP": "syscall", - "syscall.EMEDIUMTYPE": "syscall", - "syscall.EMFILE": "syscall", - "syscall.EMLINK": "syscall", - "syscall.EMSGSIZE": "syscall", - "syscall.EMT_TAGOVF": "syscall", - "syscall.EMULTIHOP": "syscall", - "syscall.EMUL_ENABLED": "syscall", - "syscall.EMUL_LINUX": "syscall", - "syscall.EMUL_LINUX32": "syscall", - "syscall.EMUL_MAXID": "syscall", - "syscall.EMUL_NATIVE": "syscall", - "syscall.ENAMETOOLONG": "syscall", - "syscall.ENAVAIL": "syscall", - "syscall.ENDRUNDISC": "syscall", - "syscall.ENEEDAUTH": "syscall", - "syscall.ENETDOWN": "syscall", - "syscall.ENETRESET": "syscall", - "syscall.ENETUNREACH": "syscall", - "syscall.ENFILE": "syscall", - "syscall.ENOANO": "syscall", - "syscall.ENOATTR": "syscall", - "syscall.ENOBUFS": "syscall", - "syscall.ENOCSI": "syscall", - "syscall.ENODATA": "syscall", - "syscall.ENODEV": "syscall", - "syscall.ENOENT": "syscall", - "syscall.ENOEXEC": "syscall", - "syscall.ENOKEY": "syscall", - "syscall.ENOLCK": "syscall", - "syscall.ENOLINK": "syscall", - "syscall.ENOMEDIUM": "syscall", - "syscall.ENOMEM": "syscall", - "syscall.ENOMSG": "syscall", - "syscall.ENONET": "syscall", - "syscall.ENOPKG": "syscall", - "syscall.ENOPOLICY": "syscall", - "syscall.ENOPROTOOPT": "syscall", - "syscall.ENOSPC": "syscall", - "syscall.ENOSR": "syscall", - "syscall.ENOSTR": "syscall", - "syscall.ENOSYS": "syscall", - "syscall.ENOTBLK": "syscall", - "syscall.ENOTCAPABLE": "syscall", - "syscall.ENOTCONN": "syscall", - "syscall.ENOTDIR": "syscall", - "syscall.ENOTEMPTY": "syscall", - "syscall.ENOTNAM": "syscall", - "syscall.ENOTRECOVERABLE": "syscall", - "syscall.ENOTSOCK": "syscall", - "syscall.ENOTSUP": "syscall", - "syscall.ENOTTY": "syscall", - "syscall.ENOTUNIQ": "syscall", - "syscall.ENXIO": "syscall", - "syscall.EN_SW_CTL_INF": "syscall", - "syscall.EN_SW_CTL_PREC": "syscall", - "syscall.EN_SW_CTL_ROUND": "syscall", - "syscall.EN_SW_DATACHAIN": "syscall", - "syscall.EN_SW_DENORM": "syscall", - "syscall.EN_SW_INVOP": "syscall", - "syscall.EN_SW_OVERFLOW": "syscall", - "syscall.EN_SW_PRECLOSS": "syscall", - "syscall.EN_SW_UNDERFLOW": "syscall", - "syscall.EN_SW_ZERODIV": "syscall", - "syscall.EOPNOTSUPP": "syscall", - "syscall.EOVERFLOW": "syscall", - "syscall.EOWNERDEAD": "syscall", - "syscall.EPERM": "syscall", - "syscall.EPFNOSUPPORT": "syscall", - "syscall.EPIPE": "syscall", - "syscall.EPOLLERR": "syscall", - "syscall.EPOLLET": "syscall", - "syscall.EPOLLHUP": "syscall", - "syscall.EPOLLIN": "syscall", - "syscall.EPOLLMSG": "syscall", - "syscall.EPOLLONESHOT": "syscall", - "syscall.EPOLLOUT": "syscall", - "syscall.EPOLLPRI": "syscall", - "syscall.EPOLLRDBAND": "syscall", - "syscall.EPOLLRDHUP": "syscall", - "syscall.EPOLLRDNORM": "syscall", - "syscall.EPOLLWRBAND": "syscall", - "syscall.EPOLLWRNORM": "syscall", - "syscall.EPOLL_CLOEXEC": "syscall", - "syscall.EPOLL_CTL_ADD": "syscall", - "syscall.EPOLL_CTL_DEL": "syscall", - "syscall.EPOLL_CTL_MOD": "syscall", - "syscall.EPOLL_NONBLOCK": "syscall", - "syscall.EPROCLIM": "syscall", - "syscall.EPROCUNAVAIL": "syscall", - "syscall.EPROGMISMATCH": "syscall", - "syscall.EPROGUNAVAIL": "syscall", - "syscall.EPROTO": "syscall", - "syscall.EPROTONOSUPPORT": "syscall", - "syscall.EPROTOTYPE": "syscall", - "syscall.EPWROFF": "syscall", - "syscall.ERANGE": "syscall", - "syscall.EREMCHG": "syscall", - "syscall.EREMOTE": "syscall", - "syscall.EREMOTEIO": "syscall", - "syscall.ERESTART": "syscall", - "syscall.ERFKILL": "syscall", - "syscall.EROFS": "syscall", - "syscall.ERPCMISMATCH": "syscall", - "syscall.ERROR_ACCESS_DENIED": "syscall", - "syscall.ERROR_ALREADY_EXISTS": "syscall", - "syscall.ERROR_BROKEN_PIPE": "syscall", - "syscall.ERROR_BUFFER_OVERFLOW": "syscall", - "syscall.ERROR_ENVVAR_NOT_FOUND": "syscall", - "syscall.ERROR_FILE_EXISTS": "syscall", - "syscall.ERROR_FILE_NOT_FOUND": "syscall", - "syscall.ERROR_HANDLE_EOF": "syscall", - "syscall.ERROR_INSUFFICIENT_BUFFER": "syscall", - "syscall.ERROR_IO_PENDING": "syscall", - "syscall.ERROR_MOD_NOT_FOUND": "syscall", - "syscall.ERROR_MORE_DATA": "syscall", - "syscall.ERROR_NETNAME_DELETED": "syscall", - "syscall.ERROR_NOT_FOUND": "syscall", - "syscall.ERROR_NO_MORE_FILES": "syscall", - "syscall.ERROR_OPERATION_ABORTED": "syscall", - "syscall.ERROR_PATH_NOT_FOUND": "syscall", - "syscall.ERROR_PRIVILEGE_NOT_HELD": "syscall", - "syscall.ERROR_PROC_NOT_FOUND": "syscall", - "syscall.ESHLIBVERS": "syscall", - "syscall.ESHUTDOWN": "syscall", - "syscall.ESOCKTNOSUPPORT": "syscall", - "syscall.ESPIPE": "syscall", - "syscall.ESRCH": "syscall", - "syscall.ESRMNT": "syscall", - "syscall.ESTALE": "syscall", - "syscall.ESTRPIPE": "syscall", - "syscall.ETHERCAP_JUMBO_MTU": "syscall", - "syscall.ETHERCAP_VLAN_HWTAGGING": "syscall", - "syscall.ETHERCAP_VLAN_MTU": "syscall", - "syscall.ETHERMIN": "syscall", - "syscall.ETHERMTU": "syscall", - "syscall.ETHERMTU_JUMBO": "syscall", - "syscall.ETHERTYPE_8023": "syscall", - "syscall.ETHERTYPE_AARP": "syscall", - "syscall.ETHERTYPE_ACCTON": "syscall", - "syscall.ETHERTYPE_AEONIC": "syscall", - "syscall.ETHERTYPE_ALPHA": "syscall", - "syscall.ETHERTYPE_AMBER": "syscall", - "syscall.ETHERTYPE_AMOEBA": "syscall", - "syscall.ETHERTYPE_AOE": "syscall", - "syscall.ETHERTYPE_APOLLO": "syscall", - "syscall.ETHERTYPE_APOLLODOMAIN": "syscall", - "syscall.ETHERTYPE_APPLETALK": "syscall", - "syscall.ETHERTYPE_APPLITEK": "syscall", - "syscall.ETHERTYPE_ARGONAUT": "syscall", - "syscall.ETHERTYPE_ARP": "syscall", - "syscall.ETHERTYPE_AT": "syscall", - "syscall.ETHERTYPE_ATALK": "syscall", - "syscall.ETHERTYPE_ATOMIC": "syscall", - "syscall.ETHERTYPE_ATT": "syscall", - "syscall.ETHERTYPE_ATTSTANFORD": "syscall", - "syscall.ETHERTYPE_AUTOPHON": "syscall", - "syscall.ETHERTYPE_AXIS": "syscall", - "syscall.ETHERTYPE_BCLOOP": "syscall", - "syscall.ETHERTYPE_BOFL": "syscall", - "syscall.ETHERTYPE_CABLETRON": "syscall", - "syscall.ETHERTYPE_CHAOS": "syscall", - "syscall.ETHERTYPE_COMDESIGN": "syscall", - "syscall.ETHERTYPE_COMPUGRAPHIC": "syscall", - "syscall.ETHERTYPE_COUNTERPOINT": "syscall", - "syscall.ETHERTYPE_CRONUS": "syscall", - "syscall.ETHERTYPE_CRONUSVLN": "syscall", - "syscall.ETHERTYPE_DCA": "syscall", - "syscall.ETHERTYPE_DDE": "syscall", - "syscall.ETHERTYPE_DEBNI": "syscall", - "syscall.ETHERTYPE_DECAM": "syscall", - "syscall.ETHERTYPE_DECCUST": "syscall", - "syscall.ETHERTYPE_DECDIAG": "syscall", - "syscall.ETHERTYPE_DECDNS": "syscall", - "syscall.ETHERTYPE_DECDTS": "syscall", - "syscall.ETHERTYPE_DECEXPER": "syscall", - "syscall.ETHERTYPE_DECLAST": "syscall", - "syscall.ETHERTYPE_DECLTM": "syscall", - "syscall.ETHERTYPE_DECMUMPS": "syscall", - "syscall.ETHERTYPE_DECNETBIOS": "syscall", - "syscall.ETHERTYPE_DELTACON": "syscall", - "syscall.ETHERTYPE_DIDDLE": "syscall", - "syscall.ETHERTYPE_DLOG1": "syscall", - "syscall.ETHERTYPE_DLOG2": "syscall", - "syscall.ETHERTYPE_DN": "syscall", - "syscall.ETHERTYPE_DOGFIGHT": "syscall", - "syscall.ETHERTYPE_DSMD": "syscall", - "syscall.ETHERTYPE_ECMA": "syscall", - "syscall.ETHERTYPE_ENCRYPT": "syscall", - "syscall.ETHERTYPE_ES": "syscall", - "syscall.ETHERTYPE_EXCELAN": "syscall", - "syscall.ETHERTYPE_EXPERDATA": "syscall", - "syscall.ETHERTYPE_FLIP": "syscall", - "syscall.ETHERTYPE_FLOWCONTROL": "syscall", - "syscall.ETHERTYPE_FRARP": "syscall", - "syscall.ETHERTYPE_GENDYN": "syscall", - "syscall.ETHERTYPE_HAYES": "syscall", - "syscall.ETHERTYPE_HIPPI_FP": "syscall", - "syscall.ETHERTYPE_HITACHI": "syscall", - "syscall.ETHERTYPE_HP": "syscall", - "syscall.ETHERTYPE_IEEEPUP": "syscall", - "syscall.ETHERTYPE_IEEEPUPAT": "syscall", - "syscall.ETHERTYPE_IMLBL": "syscall", - "syscall.ETHERTYPE_IMLBLDIAG": "syscall", - "syscall.ETHERTYPE_IP": "syscall", - "syscall.ETHERTYPE_IPAS": "syscall", - "syscall.ETHERTYPE_IPV6": "syscall", - "syscall.ETHERTYPE_IPX": "syscall", - "syscall.ETHERTYPE_IPXNEW": "syscall", - "syscall.ETHERTYPE_KALPANA": "syscall", - "syscall.ETHERTYPE_LANBRIDGE": "syscall", - "syscall.ETHERTYPE_LANPROBE": "syscall", - "syscall.ETHERTYPE_LAT": "syscall", - "syscall.ETHERTYPE_LBACK": "syscall", - "syscall.ETHERTYPE_LITTLE": "syscall", - "syscall.ETHERTYPE_LLDP": "syscall", - "syscall.ETHERTYPE_LOGICRAFT": "syscall", - "syscall.ETHERTYPE_LOOPBACK": "syscall", - "syscall.ETHERTYPE_MATRA": "syscall", - "syscall.ETHERTYPE_MAX": "syscall", - "syscall.ETHERTYPE_MERIT": "syscall", - "syscall.ETHERTYPE_MICP": "syscall", - "syscall.ETHERTYPE_MOPDL": "syscall", - "syscall.ETHERTYPE_MOPRC": "syscall", - "syscall.ETHERTYPE_MOTOROLA": "syscall", - "syscall.ETHERTYPE_MPLS": "syscall", - "syscall.ETHERTYPE_MPLS_MCAST": "syscall", - "syscall.ETHERTYPE_MUMPS": "syscall", - "syscall.ETHERTYPE_NBPCC": "syscall", - "syscall.ETHERTYPE_NBPCLAIM": "syscall", - "syscall.ETHERTYPE_NBPCLREQ": "syscall", - "syscall.ETHERTYPE_NBPCLRSP": "syscall", - "syscall.ETHERTYPE_NBPCREQ": "syscall", - "syscall.ETHERTYPE_NBPCRSP": "syscall", - "syscall.ETHERTYPE_NBPDG": "syscall", - "syscall.ETHERTYPE_NBPDGB": "syscall", - "syscall.ETHERTYPE_NBPDLTE": "syscall", - "syscall.ETHERTYPE_NBPRAR": "syscall", - "syscall.ETHERTYPE_NBPRAS": "syscall", - "syscall.ETHERTYPE_NBPRST": "syscall", - "syscall.ETHERTYPE_NBPSCD": "syscall", - "syscall.ETHERTYPE_NBPVCD": "syscall", - "syscall.ETHERTYPE_NBS": "syscall", - "syscall.ETHERTYPE_NCD": "syscall", - "syscall.ETHERTYPE_NESTAR": "syscall", - "syscall.ETHERTYPE_NETBEUI": "syscall", - "syscall.ETHERTYPE_NOVELL": "syscall", - "syscall.ETHERTYPE_NS": "syscall", - "syscall.ETHERTYPE_NSAT": "syscall", - "syscall.ETHERTYPE_NSCOMPAT": "syscall", - "syscall.ETHERTYPE_NTRAILER": "syscall", - "syscall.ETHERTYPE_OS9": "syscall", - "syscall.ETHERTYPE_OS9NET": "syscall", - "syscall.ETHERTYPE_PACER": "syscall", - "syscall.ETHERTYPE_PAE": "syscall", - "syscall.ETHERTYPE_PCS": "syscall", - "syscall.ETHERTYPE_PLANNING": "syscall", - "syscall.ETHERTYPE_PPP": "syscall", - "syscall.ETHERTYPE_PPPOE": "syscall", - "syscall.ETHERTYPE_PPPOEDISC": "syscall", - "syscall.ETHERTYPE_PRIMENTS": "syscall", - "syscall.ETHERTYPE_PUP": "syscall", - "syscall.ETHERTYPE_PUPAT": "syscall", - "syscall.ETHERTYPE_QINQ": "syscall", - "syscall.ETHERTYPE_RACAL": "syscall", - "syscall.ETHERTYPE_RATIONAL": "syscall", - "syscall.ETHERTYPE_RAWFR": "syscall", - "syscall.ETHERTYPE_RCL": "syscall", - "syscall.ETHERTYPE_RDP": "syscall", - "syscall.ETHERTYPE_RETIX": "syscall", - "syscall.ETHERTYPE_REVARP": "syscall", - "syscall.ETHERTYPE_SCA": "syscall", - "syscall.ETHERTYPE_SECTRA": "syscall", - "syscall.ETHERTYPE_SECUREDATA": "syscall", - "syscall.ETHERTYPE_SGITW": "syscall", - "syscall.ETHERTYPE_SG_BOUNCE": "syscall", - "syscall.ETHERTYPE_SG_DIAG": "syscall", - "syscall.ETHERTYPE_SG_NETGAMES": "syscall", - "syscall.ETHERTYPE_SG_RESV": "syscall", - "syscall.ETHERTYPE_SIMNET": "syscall", - "syscall.ETHERTYPE_SLOW": "syscall", - "syscall.ETHERTYPE_SLOWPROTOCOLS": "syscall", - "syscall.ETHERTYPE_SNA": "syscall", - "syscall.ETHERTYPE_SNMP": "syscall", - "syscall.ETHERTYPE_SONIX": "syscall", - "syscall.ETHERTYPE_SPIDER": "syscall", - "syscall.ETHERTYPE_SPRITE": "syscall", - "syscall.ETHERTYPE_STP": "syscall", - "syscall.ETHERTYPE_TALARIS": "syscall", - "syscall.ETHERTYPE_TALARISMC": "syscall", - "syscall.ETHERTYPE_TCPCOMP": "syscall", - "syscall.ETHERTYPE_TCPSM": "syscall", - "syscall.ETHERTYPE_TEC": "syscall", - "syscall.ETHERTYPE_TIGAN": "syscall", - "syscall.ETHERTYPE_TRAIL": "syscall", - "syscall.ETHERTYPE_TRANSETHER": "syscall", - "syscall.ETHERTYPE_TYMSHARE": "syscall", - "syscall.ETHERTYPE_UBBST": "syscall", - "syscall.ETHERTYPE_UBDEBUG": "syscall", - "syscall.ETHERTYPE_UBDIAGLOOP": "syscall", - "syscall.ETHERTYPE_UBDL": "syscall", - "syscall.ETHERTYPE_UBNIU": "syscall", - "syscall.ETHERTYPE_UBNMC": "syscall", - "syscall.ETHERTYPE_VALID": "syscall", - "syscall.ETHERTYPE_VARIAN": "syscall", - "syscall.ETHERTYPE_VAXELN": "syscall", - "syscall.ETHERTYPE_VEECO": "syscall", - "syscall.ETHERTYPE_VEXP": "syscall", - "syscall.ETHERTYPE_VGLAB": "syscall", - "syscall.ETHERTYPE_VINES": "syscall", - "syscall.ETHERTYPE_VINESECHO": "syscall", - "syscall.ETHERTYPE_VINESLOOP": "syscall", - "syscall.ETHERTYPE_VITAL": "syscall", - "syscall.ETHERTYPE_VLAN": "syscall", - "syscall.ETHERTYPE_VLTLMAN": "syscall", - "syscall.ETHERTYPE_VPROD": "syscall", - "syscall.ETHERTYPE_VURESERVED": "syscall", - "syscall.ETHERTYPE_WATERLOO": "syscall", - "syscall.ETHERTYPE_WELLFLEET": "syscall", - "syscall.ETHERTYPE_X25": "syscall", - "syscall.ETHERTYPE_X75": "syscall", - "syscall.ETHERTYPE_XNSSM": "syscall", - "syscall.ETHERTYPE_XTP": "syscall", - "syscall.ETHER_ADDR_LEN": "syscall", - "syscall.ETHER_ALIGN": "syscall", - "syscall.ETHER_CRC_LEN": "syscall", - "syscall.ETHER_CRC_POLY_BE": "syscall", - "syscall.ETHER_CRC_POLY_LE": "syscall", - "syscall.ETHER_HDR_LEN": "syscall", - "syscall.ETHER_MAX_DIX_LEN": "syscall", - "syscall.ETHER_MAX_LEN": "syscall", - "syscall.ETHER_MAX_LEN_JUMBO": "syscall", - "syscall.ETHER_MIN_LEN": "syscall", - "syscall.ETHER_PPPOE_ENCAP_LEN": "syscall", - "syscall.ETHER_TYPE_LEN": "syscall", - "syscall.ETHER_VLAN_ENCAP_LEN": "syscall", - "syscall.ETH_P_1588": "syscall", - "syscall.ETH_P_8021Q": "syscall", - "syscall.ETH_P_802_2": "syscall", - "syscall.ETH_P_802_3": "syscall", - "syscall.ETH_P_AARP": "syscall", - "syscall.ETH_P_ALL": "syscall", - "syscall.ETH_P_AOE": "syscall", - "syscall.ETH_P_ARCNET": "syscall", - "syscall.ETH_P_ARP": "syscall", - "syscall.ETH_P_ATALK": "syscall", - "syscall.ETH_P_ATMFATE": "syscall", - "syscall.ETH_P_ATMMPOA": "syscall", - "syscall.ETH_P_AX25": "syscall", - "syscall.ETH_P_BPQ": "syscall", - "syscall.ETH_P_CAIF": "syscall", - "syscall.ETH_P_CAN": "syscall", - "syscall.ETH_P_CONTROL": "syscall", - "syscall.ETH_P_CUST": "syscall", - "syscall.ETH_P_DDCMP": "syscall", - "syscall.ETH_P_DEC": "syscall", - "syscall.ETH_P_DIAG": "syscall", - "syscall.ETH_P_DNA_DL": "syscall", - "syscall.ETH_P_DNA_RC": "syscall", - "syscall.ETH_P_DNA_RT": "syscall", - "syscall.ETH_P_DSA": "syscall", - "syscall.ETH_P_ECONET": "syscall", - "syscall.ETH_P_EDSA": "syscall", - "syscall.ETH_P_FCOE": "syscall", - "syscall.ETH_P_FIP": "syscall", - "syscall.ETH_P_HDLC": "syscall", - "syscall.ETH_P_IEEE802154": "syscall", - "syscall.ETH_P_IEEEPUP": "syscall", - "syscall.ETH_P_IEEEPUPAT": "syscall", - "syscall.ETH_P_IP": "syscall", - "syscall.ETH_P_IPV6": "syscall", - "syscall.ETH_P_IPX": "syscall", - "syscall.ETH_P_IRDA": "syscall", - "syscall.ETH_P_LAT": "syscall", - "syscall.ETH_P_LINK_CTL": "syscall", - "syscall.ETH_P_LOCALTALK": "syscall", - "syscall.ETH_P_LOOP": "syscall", - "syscall.ETH_P_MOBITEX": "syscall", - "syscall.ETH_P_MPLS_MC": "syscall", - "syscall.ETH_P_MPLS_UC": "syscall", - "syscall.ETH_P_PAE": "syscall", - "syscall.ETH_P_PAUSE": "syscall", - "syscall.ETH_P_PHONET": "syscall", - "syscall.ETH_P_PPPTALK": "syscall", - "syscall.ETH_P_PPP_DISC": "syscall", - "syscall.ETH_P_PPP_MP": "syscall", - "syscall.ETH_P_PPP_SES": "syscall", - "syscall.ETH_P_PUP": "syscall", - "syscall.ETH_P_PUPAT": "syscall", - "syscall.ETH_P_RARP": "syscall", - "syscall.ETH_P_SCA": "syscall", - "syscall.ETH_P_SLOW": "syscall", - "syscall.ETH_P_SNAP": "syscall", - "syscall.ETH_P_TEB": "syscall", - "syscall.ETH_P_TIPC": "syscall", - "syscall.ETH_P_TRAILER": "syscall", - "syscall.ETH_P_TR_802_2": "syscall", - "syscall.ETH_P_WAN_PPP": "syscall", - "syscall.ETH_P_WCCP": "syscall", - "syscall.ETH_P_X25": "syscall", - "syscall.ETIME": "syscall", - "syscall.ETIMEDOUT": "syscall", - "syscall.ETOOMANYREFS": "syscall", - "syscall.ETXTBSY": "syscall", - "syscall.EUCLEAN": "syscall", - "syscall.EUNATCH": "syscall", - "syscall.EUSERS": "syscall", - "syscall.EVFILT_AIO": "syscall", - "syscall.EVFILT_FS": "syscall", - "syscall.EVFILT_LIO": "syscall", - "syscall.EVFILT_MACHPORT": "syscall", - "syscall.EVFILT_PROC": "syscall", - "syscall.EVFILT_READ": "syscall", - "syscall.EVFILT_SIGNAL": "syscall", - "syscall.EVFILT_SYSCOUNT": "syscall", - "syscall.EVFILT_THREADMARKER": "syscall", - "syscall.EVFILT_TIMER": "syscall", - "syscall.EVFILT_USER": "syscall", - "syscall.EVFILT_VM": "syscall", - "syscall.EVFILT_VNODE": "syscall", - "syscall.EVFILT_WRITE": "syscall", - "syscall.EV_ADD": "syscall", - "syscall.EV_CLEAR": "syscall", - "syscall.EV_DELETE": "syscall", - "syscall.EV_DISABLE": "syscall", - "syscall.EV_DISPATCH": "syscall", - "syscall.EV_DROP": "syscall", - "syscall.EV_ENABLE": "syscall", - "syscall.EV_EOF": "syscall", - "syscall.EV_ERROR": "syscall", - "syscall.EV_FLAG0": "syscall", - "syscall.EV_FLAG1": "syscall", - "syscall.EV_ONESHOT": "syscall", - "syscall.EV_OOBAND": "syscall", - "syscall.EV_POLL": "syscall", - "syscall.EV_RECEIPT": "syscall", - "syscall.EV_SYSFLAGS": "syscall", - "syscall.EWINDOWS": "syscall", - "syscall.EWOULDBLOCK": "syscall", - "syscall.EXDEV": "syscall", - "syscall.EXFULL": "syscall", - "syscall.EXTA": "syscall", - "syscall.EXTB": "syscall", - "syscall.EXTPROC": "syscall", - "syscall.Environ": "syscall", - "syscall.EpollCreate": "syscall", - "syscall.EpollCreate1": "syscall", - "syscall.EpollCtl": "syscall", - "syscall.EpollEvent": "syscall", - "syscall.EpollWait": "syscall", - "syscall.Errno": "syscall", - "syscall.EscapeArg": "syscall", - "syscall.Exchangedata": "syscall", - "syscall.Exec": "syscall", - "syscall.Exit": "syscall", - "syscall.ExitProcess": "syscall", - "syscall.FD_CLOEXEC": "syscall", - "syscall.FD_SETSIZE": "syscall", - "syscall.FILE_ACTION_ADDED": "syscall", - "syscall.FILE_ACTION_MODIFIED": "syscall", - "syscall.FILE_ACTION_REMOVED": "syscall", - "syscall.FILE_ACTION_RENAMED_NEW_NAME": "syscall", - "syscall.FILE_ACTION_RENAMED_OLD_NAME": "syscall", - "syscall.FILE_APPEND_DATA": "syscall", - "syscall.FILE_ATTRIBUTE_ARCHIVE": "syscall", - "syscall.FILE_ATTRIBUTE_DIRECTORY": "syscall", - "syscall.FILE_ATTRIBUTE_HIDDEN": "syscall", - "syscall.FILE_ATTRIBUTE_NORMAL": "syscall", - "syscall.FILE_ATTRIBUTE_READONLY": "syscall", - "syscall.FILE_ATTRIBUTE_REPARSE_POINT": "syscall", - "syscall.FILE_ATTRIBUTE_SYSTEM": "syscall", - "syscall.FILE_BEGIN": "syscall", - "syscall.FILE_CURRENT": "syscall", - "syscall.FILE_END": "syscall", - "syscall.FILE_FLAG_BACKUP_SEMANTICS": "syscall", - "syscall.FILE_FLAG_OPEN_REPARSE_POINT": "syscall", - "syscall.FILE_FLAG_OVERLAPPED": "syscall", - "syscall.FILE_LIST_DIRECTORY": "syscall", - "syscall.FILE_MAP_COPY": "syscall", - "syscall.FILE_MAP_EXECUTE": "syscall", - "syscall.FILE_MAP_READ": "syscall", - "syscall.FILE_MAP_WRITE": "syscall", - "syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES": "syscall", - "syscall.FILE_NOTIFY_CHANGE_CREATION": "syscall", - "syscall.FILE_NOTIFY_CHANGE_DIR_NAME": "syscall", - "syscall.FILE_NOTIFY_CHANGE_FILE_NAME": "syscall", - "syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS": "syscall", - "syscall.FILE_NOTIFY_CHANGE_LAST_WRITE": "syscall", - "syscall.FILE_NOTIFY_CHANGE_SIZE": "syscall", - "syscall.FILE_SHARE_DELETE": "syscall", - "syscall.FILE_SHARE_READ": "syscall", - "syscall.FILE_SHARE_WRITE": "syscall", - "syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS": "syscall", - "syscall.FILE_SKIP_SET_EVENT_ON_HANDLE": "syscall", - "syscall.FILE_TYPE_CHAR": "syscall", - "syscall.FILE_TYPE_DISK": "syscall", - "syscall.FILE_TYPE_PIPE": "syscall", - "syscall.FILE_TYPE_REMOTE": "syscall", - "syscall.FILE_TYPE_UNKNOWN": "syscall", - "syscall.FILE_WRITE_ATTRIBUTES": "syscall", - "syscall.FLUSHO": "syscall", - "syscall.FORMAT_MESSAGE_ALLOCATE_BUFFER": "syscall", - "syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY": "syscall", - "syscall.FORMAT_MESSAGE_FROM_HMODULE": "syscall", - "syscall.FORMAT_MESSAGE_FROM_STRING": "syscall", - "syscall.FORMAT_MESSAGE_FROM_SYSTEM": "syscall", - "syscall.FORMAT_MESSAGE_IGNORE_INSERTS": "syscall", - "syscall.FORMAT_MESSAGE_MAX_WIDTH_MASK": "syscall", - "syscall.FSCTL_GET_REPARSE_POINT": "syscall", - "syscall.F_ADDFILESIGS": "syscall", - "syscall.F_ADDSIGS": "syscall", - "syscall.F_ALLOCATEALL": "syscall", - "syscall.F_ALLOCATECONTIG": "syscall", - "syscall.F_CANCEL": "syscall", - "syscall.F_CHKCLEAN": "syscall", - "syscall.F_CLOSEM": "syscall", - "syscall.F_DUP2FD": "syscall", - "syscall.F_DUP2FD_CLOEXEC": "syscall", - "syscall.F_DUPFD": "syscall", - "syscall.F_DUPFD_CLOEXEC": "syscall", - "syscall.F_EXLCK": "syscall", - "syscall.F_FLUSH_DATA": "syscall", - "syscall.F_FREEZE_FS": "syscall", - "syscall.F_FSCTL": "syscall", - "syscall.F_FSDIRMASK": "syscall", - "syscall.F_FSIN": "syscall", - "syscall.F_FSINOUT": "syscall", - "syscall.F_FSOUT": "syscall", - "syscall.F_FSPRIV": "syscall", - "syscall.F_FSVOID": "syscall", - "syscall.F_FULLFSYNC": "syscall", - "syscall.F_GETFD": "syscall", - "syscall.F_GETFL": "syscall", - "syscall.F_GETLEASE": "syscall", - "syscall.F_GETLK": "syscall", - "syscall.F_GETLK64": "syscall", - "syscall.F_GETLKPID": "syscall", - "syscall.F_GETNOSIGPIPE": "syscall", - "syscall.F_GETOWN": "syscall", - "syscall.F_GETOWN_EX": "syscall", - "syscall.F_GETPATH": "syscall", - "syscall.F_GETPATH_MTMINFO": "syscall", - "syscall.F_GETPIPE_SZ": "syscall", - "syscall.F_GETPROTECTIONCLASS": "syscall", - "syscall.F_GETSIG": "syscall", - "syscall.F_GLOBAL_NOCACHE": "syscall", - "syscall.F_LOCK": "syscall", - "syscall.F_LOG2PHYS": "syscall", - "syscall.F_LOG2PHYS_EXT": "syscall", - "syscall.F_MARKDEPENDENCY": "syscall", - "syscall.F_MAXFD": "syscall", - "syscall.F_NOCACHE": "syscall", - "syscall.F_NODIRECT": "syscall", - "syscall.F_NOTIFY": "syscall", - "syscall.F_OGETLK": "syscall", - "syscall.F_OK": "syscall", - "syscall.F_OSETLK": "syscall", - "syscall.F_OSETLKW": "syscall", - "syscall.F_PARAM_MASK": "syscall", - "syscall.F_PARAM_MAX": "syscall", - "syscall.F_PATHPKG_CHECK": "syscall", - "syscall.F_PEOFPOSMODE": "syscall", - "syscall.F_PREALLOCATE": "syscall", - "syscall.F_RDADVISE": "syscall", - "syscall.F_RDAHEAD": "syscall", - "syscall.F_RDLCK": "syscall", - "syscall.F_READAHEAD": "syscall", - "syscall.F_READBOOTSTRAP": "syscall", - "syscall.F_SETBACKINGSTORE": "syscall", - "syscall.F_SETFD": "syscall", - "syscall.F_SETFL": "syscall", - "syscall.F_SETLEASE": "syscall", - "syscall.F_SETLK": "syscall", - "syscall.F_SETLK64": "syscall", - "syscall.F_SETLKW": "syscall", - "syscall.F_SETLKW64": "syscall", - "syscall.F_SETLK_REMOTE": "syscall", - "syscall.F_SETNOSIGPIPE": "syscall", - "syscall.F_SETOWN": "syscall", - "syscall.F_SETOWN_EX": "syscall", - "syscall.F_SETPIPE_SZ": "syscall", - "syscall.F_SETPROTECTIONCLASS": "syscall", - "syscall.F_SETSIG": "syscall", - "syscall.F_SETSIZE": "syscall", - "syscall.F_SHLCK": "syscall", - "syscall.F_TEST": "syscall", - "syscall.F_THAW_FS": "syscall", - "syscall.F_TLOCK": "syscall", - "syscall.F_ULOCK": "syscall", - "syscall.F_UNLCK": "syscall", - "syscall.F_UNLCKSYS": "syscall", - "syscall.F_VOLPOSMODE": "syscall", - "syscall.F_WRITEBOOTSTRAP": "syscall", - "syscall.F_WRLCK": "syscall", - "syscall.Faccessat": "syscall", - "syscall.Fallocate": "syscall", - "syscall.Fbootstraptransfer_t": "syscall", - "syscall.Fchdir": "syscall", - "syscall.Fchflags": "syscall", - "syscall.Fchmod": "syscall", - "syscall.Fchmodat": "syscall", - "syscall.Fchown": "syscall", - "syscall.Fchownat": "syscall", - "syscall.FcntlFlock": "syscall", - "syscall.FdSet": "syscall", - "syscall.Fdatasync": "syscall", - "syscall.FileNotifyInformation": "syscall", - "syscall.Filetime": "syscall", - "syscall.FindClose": "syscall", - "syscall.FindFirstFile": "syscall", - "syscall.FindNextFile": "syscall", - "syscall.Flock": "syscall", - "syscall.Flock_t": "syscall", - "syscall.FlushBpf": "syscall", - "syscall.FlushFileBuffers": "syscall", - "syscall.FlushViewOfFile": "syscall", - "syscall.ForkExec": "syscall", - "syscall.ForkLock": "syscall", - "syscall.FormatMessage": "syscall", - "syscall.Fpathconf": "syscall", - "syscall.FreeAddrInfoW": "syscall", - "syscall.FreeEnvironmentStrings": "syscall", - "syscall.FreeLibrary": "syscall", - "syscall.Fsid": "syscall", - "syscall.Fstat": "syscall", - "syscall.Fstatfs": "syscall", - "syscall.Fstore_t": "syscall", - "syscall.Fsync": "syscall", - "syscall.Ftruncate": "syscall", - "syscall.FullPath": "syscall", - "syscall.Futimes": "syscall", - "syscall.Futimesat": "syscall", - "syscall.GENERIC_ALL": "syscall", - "syscall.GENERIC_EXECUTE": "syscall", - "syscall.GENERIC_READ": "syscall", - "syscall.GENERIC_WRITE": "syscall", - "syscall.GUID": "syscall", - "syscall.GetAcceptExSockaddrs": "syscall", - "syscall.GetAdaptersInfo": "syscall", - "syscall.GetAddrInfoW": "syscall", - "syscall.GetCommandLine": "syscall", - "syscall.GetComputerName": "syscall", - "syscall.GetConsoleMode": "syscall", - "syscall.GetCurrentDirectory": "syscall", - "syscall.GetCurrentProcess": "syscall", - "syscall.GetEnvironmentStrings": "syscall", - "syscall.GetEnvironmentVariable": "syscall", - "syscall.GetExitCodeProcess": "syscall", - "syscall.GetFileAttributes": "syscall", - "syscall.GetFileAttributesEx": "syscall", - "syscall.GetFileExInfoStandard": "syscall", - "syscall.GetFileExMaxInfoLevel": "syscall", - "syscall.GetFileInformationByHandle": "syscall", - "syscall.GetFileType": "syscall", - "syscall.GetFullPathName": "syscall", - "syscall.GetHostByName": "syscall", - "syscall.GetIfEntry": "syscall", - "syscall.GetLastError": "syscall", - "syscall.GetLengthSid": "syscall", - "syscall.GetLongPathName": "syscall", - "syscall.GetProcAddress": "syscall", - "syscall.GetProcessTimes": "syscall", - "syscall.GetProtoByName": "syscall", - "syscall.GetQueuedCompletionStatus": "syscall", - "syscall.GetServByName": "syscall", - "syscall.GetShortPathName": "syscall", - "syscall.GetStartupInfo": "syscall", - "syscall.GetStdHandle": "syscall", - "syscall.GetSystemTimeAsFileTime": "syscall", - "syscall.GetTempPath": "syscall", - "syscall.GetTimeZoneInformation": "syscall", - "syscall.GetTokenInformation": "syscall", - "syscall.GetUserNameEx": "syscall", - "syscall.GetUserProfileDirectory": "syscall", - "syscall.GetVersion": "syscall", - "syscall.Getcwd": "syscall", - "syscall.Getdents": "syscall", - "syscall.Getdirentries": "syscall", - "syscall.Getdtablesize": "syscall", - "syscall.Getegid": "syscall", - "syscall.Getenv": "syscall", - "syscall.Geteuid": "syscall", - "syscall.Getfsstat": "syscall", - "syscall.Getgid": "syscall", - "syscall.Getgroups": "syscall", - "syscall.Getpagesize": "syscall", - "syscall.Getpeername": "syscall", - "syscall.Getpgid": "syscall", - "syscall.Getpgrp": "syscall", - "syscall.Getpid": "syscall", - "syscall.Getppid": "syscall", - "syscall.Getpriority": "syscall", - "syscall.Getrlimit": "syscall", - "syscall.Getrusage": "syscall", - "syscall.Getsid": "syscall", - "syscall.Getsockname": "syscall", - "syscall.Getsockopt": "syscall", - "syscall.GetsockoptByte": "syscall", - "syscall.GetsockoptICMPv6Filter": "syscall", - "syscall.GetsockoptIPMreq": "syscall", - "syscall.GetsockoptIPMreqn": "syscall", - "syscall.GetsockoptIPv6MTUInfo": "syscall", - "syscall.GetsockoptIPv6Mreq": "syscall", - "syscall.GetsockoptInet4Addr": "syscall", - "syscall.GetsockoptInt": "syscall", - "syscall.GetsockoptUcred": "syscall", - "syscall.Gettid": "syscall", - "syscall.Gettimeofday": "syscall", - "syscall.Getuid": "syscall", - "syscall.Getwd": "syscall", - "syscall.Getxattr": "syscall", - "syscall.HANDLE_FLAG_INHERIT": "syscall", - "syscall.HKEY_CLASSES_ROOT": "syscall", - "syscall.HKEY_CURRENT_CONFIG": "syscall", - "syscall.HKEY_CURRENT_USER": "syscall", - "syscall.HKEY_DYN_DATA": "syscall", - "syscall.HKEY_LOCAL_MACHINE": "syscall", - "syscall.HKEY_PERFORMANCE_DATA": "syscall", - "syscall.HKEY_USERS": "syscall", - "syscall.HUPCL": "syscall", - "syscall.Handle": "syscall", - "syscall.Hostent": "syscall", - "syscall.ICANON": "syscall", - "syscall.ICMP6_FILTER": "syscall", - "syscall.ICMPV6_FILTER": "syscall", - "syscall.ICMPv6Filter": "syscall", - "syscall.ICRNL": "syscall", - "syscall.IEXTEN": "syscall", - "syscall.IFAN_ARRIVAL": "syscall", - "syscall.IFAN_DEPARTURE": "syscall", - "syscall.IFA_ADDRESS": "syscall", - "syscall.IFA_ANYCAST": "syscall", - "syscall.IFA_BROADCAST": "syscall", - "syscall.IFA_CACHEINFO": "syscall", - "syscall.IFA_F_DADFAILED": "syscall", - "syscall.IFA_F_DEPRECATED": "syscall", - "syscall.IFA_F_HOMEADDRESS": "syscall", - "syscall.IFA_F_NODAD": "syscall", - "syscall.IFA_F_OPTIMISTIC": "syscall", - "syscall.IFA_F_PERMANENT": "syscall", - "syscall.IFA_F_SECONDARY": "syscall", - "syscall.IFA_F_TEMPORARY": "syscall", - "syscall.IFA_F_TENTATIVE": "syscall", - "syscall.IFA_LABEL": "syscall", - "syscall.IFA_LOCAL": "syscall", - "syscall.IFA_MAX": "syscall", - "syscall.IFA_MULTICAST": "syscall", - "syscall.IFA_ROUTE": "syscall", - "syscall.IFA_UNSPEC": "syscall", - "syscall.IFF_ALLMULTI": "syscall", - "syscall.IFF_ALTPHYS": "syscall", - "syscall.IFF_AUTOMEDIA": "syscall", - "syscall.IFF_BROADCAST": "syscall", - "syscall.IFF_CANTCHANGE": "syscall", - "syscall.IFF_CANTCONFIG": "syscall", - "syscall.IFF_DEBUG": "syscall", - "syscall.IFF_DRV_OACTIVE": "syscall", - "syscall.IFF_DRV_RUNNING": "syscall", - "syscall.IFF_DYING": "syscall", - "syscall.IFF_DYNAMIC": "syscall", - "syscall.IFF_LINK0": "syscall", - "syscall.IFF_LINK1": "syscall", - "syscall.IFF_LINK2": "syscall", - "syscall.IFF_LOOPBACK": "syscall", - "syscall.IFF_MASTER": "syscall", - "syscall.IFF_MONITOR": "syscall", - "syscall.IFF_MULTICAST": "syscall", - "syscall.IFF_NOARP": "syscall", - "syscall.IFF_NOTRAILERS": "syscall", - "syscall.IFF_NO_PI": "syscall", - "syscall.IFF_OACTIVE": "syscall", - "syscall.IFF_ONE_QUEUE": "syscall", - "syscall.IFF_POINTOPOINT": "syscall", - "syscall.IFF_POINTTOPOINT": "syscall", - "syscall.IFF_PORTSEL": "syscall", - "syscall.IFF_PPROMISC": "syscall", - "syscall.IFF_PROMISC": "syscall", - "syscall.IFF_RENAMING": "syscall", - "syscall.IFF_RUNNING": "syscall", - "syscall.IFF_SIMPLEX": "syscall", - "syscall.IFF_SLAVE": "syscall", - "syscall.IFF_SMART": "syscall", - "syscall.IFF_STATICARP": "syscall", - "syscall.IFF_TAP": "syscall", - "syscall.IFF_TUN": "syscall", - "syscall.IFF_TUN_EXCL": "syscall", - "syscall.IFF_UP": "syscall", - "syscall.IFF_VNET_HDR": "syscall", - "syscall.IFLA_ADDRESS": "syscall", - "syscall.IFLA_BROADCAST": "syscall", - "syscall.IFLA_COST": "syscall", - "syscall.IFLA_IFALIAS": "syscall", - "syscall.IFLA_IFNAME": "syscall", - "syscall.IFLA_LINK": "syscall", - "syscall.IFLA_LINKINFO": "syscall", - "syscall.IFLA_LINKMODE": "syscall", - "syscall.IFLA_MAP": "syscall", - "syscall.IFLA_MASTER": "syscall", - "syscall.IFLA_MAX": "syscall", - "syscall.IFLA_MTU": "syscall", - "syscall.IFLA_NET_NS_PID": "syscall", - "syscall.IFLA_OPERSTATE": "syscall", - "syscall.IFLA_PRIORITY": "syscall", - "syscall.IFLA_PROTINFO": "syscall", - "syscall.IFLA_QDISC": "syscall", - "syscall.IFLA_STATS": "syscall", - "syscall.IFLA_TXQLEN": "syscall", - "syscall.IFLA_UNSPEC": "syscall", - "syscall.IFLA_WEIGHT": "syscall", - "syscall.IFLA_WIRELESS": "syscall", - "syscall.IFNAMSIZ": "syscall", - "syscall.IFT_1822": "syscall", - "syscall.IFT_A12MPPSWITCH": "syscall", - "syscall.IFT_AAL2": "syscall", - "syscall.IFT_AAL5": "syscall", - "syscall.IFT_ADSL": "syscall", - "syscall.IFT_AFLANE8023": "syscall", - "syscall.IFT_AFLANE8025": "syscall", - "syscall.IFT_ARAP": "syscall", - "syscall.IFT_ARCNET": "syscall", - "syscall.IFT_ARCNETPLUS": "syscall", - "syscall.IFT_ASYNC": "syscall", - "syscall.IFT_ATM": "syscall", - "syscall.IFT_ATMDXI": "syscall", - "syscall.IFT_ATMFUNI": "syscall", - "syscall.IFT_ATMIMA": "syscall", - "syscall.IFT_ATMLOGICAL": "syscall", - "syscall.IFT_ATMRADIO": "syscall", - "syscall.IFT_ATMSUBINTERFACE": "syscall", - "syscall.IFT_ATMVCIENDPT": "syscall", - "syscall.IFT_ATMVIRTUAL": "syscall", - "syscall.IFT_BGPPOLICYACCOUNTING": "syscall", - "syscall.IFT_BLUETOOTH": "syscall", - "syscall.IFT_BRIDGE": "syscall", - "syscall.IFT_BSC": "syscall", - "syscall.IFT_CARP": "syscall", - "syscall.IFT_CCTEMUL": "syscall", - "syscall.IFT_CELLULAR": "syscall", - "syscall.IFT_CEPT": "syscall", - "syscall.IFT_CES": "syscall", - "syscall.IFT_CHANNEL": "syscall", - "syscall.IFT_CNR": "syscall", - "syscall.IFT_COFFEE": "syscall", - "syscall.IFT_COMPOSITELINK": "syscall", - "syscall.IFT_DCN": "syscall", - "syscall.IFT_DIGITALPOWERLINE": "syscall", - "syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL": "syscall", - "syscall.IFT_DLSW": "syscall", - "syscall.IFT_DOCSCABLEDOWNSTREAM": "syscall", - "syscall.IFT_DOCSCABLEMACLAYER": "syscall", - "syscall.IFT_DOCSCABLEUPSTREAM": "syscall", - "syscall.IFT_DOCSCABLEUPSTREAMCHANNEL": "syscall", - "syscall.IFT_DS0": "syscall", - "syscall.IFT_DS0BUNDLE": "syscall", - "syscall.IFT_DS1FDL": "syscall", - "syscall.IFT_DS3": "syscall", - "syscall.IFT_DTM": "syscall", - "syscall.IFT_DUMMY": "syscall", - "syscall.IFT_DVBASILN": "syscall", - "syscall.IFT_DVBASIOUT": "syscall", - "syscall.IFT_DVBRCCDOWNSTREAM": "syscall", - "syscall.IFT_DVBRCCMACLAYER": "syscall", - "syscall.IFT_DVBRCCUPSTREAM": "syscall", - "syscall.IFT_ECONET": "syscall", - "syscall.IFT_ENC": "syscall", - "syscall.IFT_EON": "syscall", - "syscall.IFT_EPLRS": "syscall", - "syscall.IFT_ESCON": "syscall", - "syscall.IFT_ETHER": "syscall", - "syscall.IFT_FAITH": "syscall", - "syscall.IFT_FAST": "syscall", - "syscall.IFT_FASTETHER": "syscall", - "syscall.IFT_FASTETHERFX": "syscall", - "syscall.IFT_FDDI": "syscall", - "syscall.IFT_FIBRECHANNEL": "syscall", - "syscall.IFT_FRAMERELAYINTERCONNECT": "syscall", - "syscall.IFT_FRAMERELAYMPI": "syscall", - "syscall.IFT_FRDLCIENDPT": "syscall", - "syscall.IFT_FRELAY": "syscall", - "syscall.IFT_FRELAYDCE": "syscall", - "syscall.IFT_FRF16MFRBUNDLE": "syscall", - "syscall.IFT_FRFORWARD": "syscall", - "syscall.IFT_G703AT2MB": "syscall", - "syscall.IFT_G703AT64K": "syscall", - "syscall.IFT_GIF": "syscall", - "syscall.IFT_GIGABITETHERNET": "syscall", - "syscall.IFT_GR303IDT": "syscall", - "syscall.IFT_GR303RDT": "syscall", - "syscall.IFT_H323GATEKEEPER": "syscall", - "syscall.IFT_H323PROXY": "syscall", - "syscall.IFT_HDH1822": "syscall", - "syscall.IFT_HDLC": "syscall", - "syscall.IFT_HDSL2": "syscall", - "syscall.IFT_HIPERLAN2": "syscall", - "syscall.IFT_HIPPI": "syscall", - "syscall.IFT_HIPPIINTERFACE": "syscall", - "syscall.IFT_HOSTPAD": "syscall", - "syscall.IFT_HSSI": "syscall", - "syscall.IFT_HY": "syscall", - "syscall.IFT_IBM370PARCHAN": "syscall", - "syscall.IFT_IDSL": "syscall", - "syscall.IFT_IEEE1394": "syscall", - "syscall.IFT_IEEE80211": "syscall", - "syscall.IFT_IEEE80212": "syscall", - "syscall.IFT_IEEE8023ADLAG": "syscall", - "syscall.IFT_IFGSN": "syscall", - "syscall.IFT_IMT": "syscall", - "syscall.IFT_INFINIBAND": "syscall", - "syscall.IFT_INTERLEAVE": "syscall", - "syscall.IFT_IP": "syscall", - "syscall.IFT_IPFORWARD": "syscall", - "syscall.IFT_IPOVERATM": "syscall", - "syscall.IFT_IPOVERCDLC": "syscall", - "syscall.IFT_IPOVERCLAW": "syscall", - "syscall.IFT_IPSWITCH": "syscall", - "syscall.IFT_IPXIP": "syscall", - "syscall.IFT_ISDN": "syscall", - "syscall.IFT_ISDNBASIC": "syscall", - "syscall.IFT_ISDNPRIMARY": "syscall", - "syscall.IFT_ISDNS": "syscall", - "syscall.IFT_ISDNU": "syscall", - "syscall.IFT_ISO88022LLC": "syscall", - "syscall.IFT_ISO88023": "syscall", - "syscall.IFT_ISO88024": "syscall", - "syscall.IFT_ISO88025": "syscall", - "syscall.IFT_ISO88025CRFPINT": "syscall", - "syscall.IFT_ISO88025DTR": "syscall", - "syscall.IFT_ISO88025FIBER": "syscall", - "syscall.IFT_ISO88026": "syscall", - "syscall.IFT_ISUP": "syscall", - "syscall.IFT_L2VLAN": "syscall", - "syscall.IFT_L3IPVLAN": "syscall", - "syscall.IFT_L3IPXVLAN": "syscall", - "syscall.IFT_LAPB": "syscall", - "syscall.IFT_LAPD": "syscall", - "syscall.IFT_LAPF": "syscall", - "syscall.IFT_LINEGROUP": "syscall", - "syscall.IFT_LOCALTALK": "syscall", - "syscall.IFT_LOOP": "syscall", - "syscall.IFT_MEDIAMAILOVERIP": "syscall", - "syscall.IFT_MFSIGLINK": "syscall", - "syscall.IFT_MIOX25": "syscall", - "syscall.IFT_MODEM": "syscall", - "syscall.IFT_MPC": "syscall", - "syscall.IFT_MPLS": "syscall", - "syscall.IFT_MPLSTUNNEL": "syscall", - "syscall.IFT_MSDSL": "syscall", - "syscall.IFT_MVL": "syscall", - "syscall.IFT_MYRINET": "syscall", - "syscall.IFT_NFAS": "syscall", - "syscall.IFT_NSIP": "syscall", - "syscall.IFT_OPTICALCHANNEL": "syscall", - "syscall.IFT_OPTICALTRANSPORT": "syscall", - "syscall.IFT_OTHER": "syscall", - "syscall.IFT_P10": "syscall", - "syscall.IFT_P80": "syscall", - "syscall.IFT_PARA": "syscall", - "syscall.IFT_PDP": "syscall", - "syscall.IFT_PFLOG": "syscall", - "syscall.IFT_PFLOW": "syscall", - "syscall.IFT_PFSYNC": "syscall", - "syscall.IFT_PLC": "syscall", - "syscall.IFT_PON155": "syscall", - "syscall.IFT_PON622": "syscall", - "syscall.IFT_POS": "syscall", - "syscall.IFT_PPP": "syscall", - "syscall.IFT_PPPMULTILINKBUNDLE": "syscall", - "syscall.IFT_PROPATM": "syscall", - "syscall.IFT_PROPBWAP2MP": "syscall", - "syscall.IFT_PROPCNLS": "syscall", - "syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM": "syscall", - "syscall.IFT_PROPDOCSWIRELESSMACLAYER": "syscall", - "syscall.IFT_PROPDOCSWIRELESSUPSTREAM": "syscall", - "syscall.IFT_PROPMUX": "syscall", - "syscall.IFT_PROPVIRTUAL": "syscall", - "syscall.IFT_PROPWIRELESSP2P": "syscall", - "syscall.IFT_PTPSERIAL": "syscall", - "syscall.IFT_PVC": "syscall", - "syscall.IFT_Q2931": "syscall", - "syscall.IFT_QLLC": "syscall", - "syscall.IFT_RADIOMAC": "syscall", - "syscall.IFT_RADSL": "syscall", - "syscall.IFT_REACHDSL": "syscall", - "syscall.IFT_RFC1483": "syscall", - "syscall.IFT_RS232": "syscall", - "syscall.IFT_RSRB": "syscall", - "syscall.IFT_SDLC": "syscall", - "syscall.IFT_SDSL": "syscall", - "syscall.IFT_SHDSL": "syscall", - "syscall.IFT_SIP": "syscall", - "syscall.IFT_SIPSIG": "syscall", - "syscall.IFT_SIPTG": "syscall", - "syscall.IFT_SLIP": "syscall", - "syscall.IFT_SMDSDXI": "syscall", - "syscall.IFT_SMDSICIP": "syscall", - "syscall.IFT_SONET": "syscall", - "syscall.IFT_SONETOVERHEADCHANNEL": "syscall", - "syscall.IFT_SONETPATH": "syscall", - "syscall.IFT_SONETVT": "syscall", - "syscall.IFT_SRP": "syscall", - "syscall.IFT_SS7SIGLINK": "syscall", - "syscall.IFT_STACKTOSTACK": "syscall", - "syscall.IFT_STARLAN": "syscall", - "syscall.IFT_STF": "syscall", - "syscall.IFT_T1": "syscall", - "syscall.IFT_TDLC": "syscall", - "syscall.IFT_TELINK": "syscall", - "syscall.IFT_TERMPAD": "syscall", - "syscall.IFT_TR008": "syscall", - "syscall.IFT_TRANSPHDLC": "syscall", - "syscall.IFT_TUNNEL": "syscall", - "syscall.IFT_ULTRA": "syscall", - "syscall.IFT_USB": "syscall", - "syscall.IFT_V11": "syscall", - "syscall.IFT_V35": "syscall", - "syscall.IFT_V36": "syscall", - "syscall.IFT_V37": "syscall", - "syscall.IFT_VDSL": "syscall", - "syscall.IFT_VIRTUALIPADDRESS": "syscall", - "syscall.IFT_VIRTUALTG": "syscall", - "syscall.IFT_VOICEDID": "syscall", - "syscall.IFT_VOICEEM": "syscall", - "syscall.IFT_VOICEEMFGD": "syscall", - "syscall.IFT_VOICEENCAP": "syscall", - "syscall.IFT_VOICEFGDEANA": "syscall", - "syscall.IFT_VOICEFXO": "syscall", - "syscall.IFT_VOICEFXS": "syscall", - "syscall.IFT_VOICEOVERATM": "syscall", - "syscall.IFT_VOICEOVERCABLE": "syscall", - "syscall.IFT_VOICEOVERFRAMERELAY": "syscall", - "syscall.IFT_VOICEOVERIP": "syscall", - "syscall.IFT_X213": "syscall", - "syscall.IFT_X25": "syscall", - "syscall.IFT_X25DDN": "syscall", - "syscall.IFT_X25HUNTGROUP": "syscall", - "syscall.IFT_X25MLP": "syscall", - "syscall.IFT_X25PLE": "syscall", - "syscall.IFT_XETHER": "syscall", - "syscall.IGNBRK": "syscall", - "syscall.IGNCR": "syscall", - "syscall.IGNORE": "syscall", - "syscall.IGNPAR": "syscall", - "syscall.IMAXBEL": "syscall", - "syscall.INFINITE": "syscall", - "syscall.INLCR": "syscall", - "syscall.INPCK": "syscall", - "syscall.INVALID_FILE_ATTRIBUTES": "syscall", - "syscall.IN_ACCESS": "syscall", - "syscall.IN_ALL_EVENTS": "syscall", - "syscall.IN_ATTRIB": "syscall", - "syscall.IN_CLASSA_HOST": "syscall", - "syscall.IN_CLASSA_MAX": "syscall", - "syscall.IN_CLASSA_NET": "syscall", - "syscall.IN_CLASSA_NSHIFT": "syscall", - "syscall.IN_CLASSB_HOST": "syscall", - "syscall.IN_CLASSB_MAX": "syscall", - "syscall.IN_CLASSB_NET": "syscall", - "syscall.IN_CLASSB_NSHIFT": "syscall", - "syscall.IN_CLASSC_HOST": "syscall", - "syscall.IN_CLASSC_NET": "syscall", - "syscall.IN_CLASSC_NSHIFT": "syscall", - "syscall.IN_CLASSD_HOST": "syscall", - "syscall.IN_CLASSD_NET": "syscall", - "syscall.IN_CLASSD_NSHIFT": "syscall", - "syscall.IN_CLOEXEC": "syscall", - "syscall.IN_CLOSE": "syscall", - "syscall.IN_CLOSE_NOWRITE": "syscall", - "syscall.IN_CLOSE_WRITE": "syscall", - "syscall.IN_CREATE": "syscall", - "syscall.IN_DELETE": "syscall", - "syscall.IN_DELETE_SELF": "syscall", - "syscall.IN_DONT_FOLLOW": "syscall", - "syscall.IN_EXCL_UNLINK": "syscall", - "syscall.IN_IGNORED": "syscall", - "syscall.IN_ISDIR": "syscall", - "syscall.IN_LINKLOCALNETNUM": "syscall", - "syscall.IN_LOOPBACKNET": "syscall", - "syscall.IN_MASK_ADD": "syscall", - "syscall.IN_MODIFY": "syscall", - "syscall.IN_MOVE": "syscall", - "syscall.IN_MOVED_FROM": "syscall", - "syscall.IN_MOVED_TO": "syscall", - "syscall.IN_MOVE_SELF": "syscall", - "syscall.IN_NONBLOCK": "syscall", - "syscall.IN_ONESHOT": "syscall", - "syscall.IN_ONLYDIR": "syscall", - "syscall.IN_OPEN": "syscall", - "syscall.IN_Q_OVERFLOW": "syscall", - "syscall.IN_RFC3021_HOST": "syscall", - "syscall.IN_RFC3021_MASK": "syscall", - "syscall.IN_RFC3021_NET": "syscall", - "syscall.IN_RFC3021_NSHIFT": "syscall", - "syscall.IN_UNMOUNT": "syscall", - "syscall.IOC_IN": "syscall", - "syscall.IOC_INOUT": "syscall", - "syscall.IOC_OUT": "syscall", - "syscall.IOC_VENDOR": "syscall", - "syscall.IOC_WS2": "syscall", - "syscall.IO_REPARSE_TAG_SYMLINK": "syscall", - "syscall.IPMreq": "syscall", - "syscall.IPMreqn": "syscall", - "syscall.IPPROTO_3PC": "syscall", - "syscall.IPPROTO_ADFS": "syscall", - "syscall.IPPROTO_AH": "syscall", - "syscall.IPPROTO_AHIP": "syscall", - "syscall.IPPROTO_APES": "syscall", - "syscall.IPPROTO_ARGUS": "syscall", - "syscall.IPPROTO_AX25": "syscall", - "syscall.IPPROTO_BHA": "syscall", - "syscall.IPPROTO_BLT": "syscall", - "syscall.IPPROTO_BRSATMON": "syscall", - "syscall.IPPROTO_CARP": "syscall", - "syscall.IPPROTO_CFTP": "syscall", - "syscall.IPPROTO_CHAOS": "syscall", - "syscall.IPPROTO_CMTP": "syscall", - "syscall.IPPROTO_COMP": "syscall", - "syscall.IPPROTO_CPHB": "syscall", - "syscall.IPPROTO_CPNX": "syscall", - "syscall.IPPROTO_DCCP": "syscall", - "syscall.IPPROTO_DDP": "syscall", - "syscall.IPPROTO_DGP": "syscall", - "syscall.IPPROTO_DIVERT": "syscall", - "syscall.IPPROTO_DIVERT_INIT": "syscall", - "syscall.IPPROTO_DIVERT_RESP": "syscall", - "syscall.IPPROTO_DONE": "syscall", - "syscall.IPPROTO_DSTOPTS": "syscall", - "syscall.IPPROTO_EGP": "syscall", - "syscall.IPPROTO_EMCON": "syscall", - "syscall.IPPROTO_ENCAP": "syscall", - "syscall.IPPROTO_EON": "syscall", - "syscall.IPPROTO_ESP": "syscall", - "syscall.IPPROTO_ETHERIP": "syscall", - "syscall.IPPROTO_FRAGMENT": "syscall", - "syscall.IPPROTO_GGP": "syscall", - "syscall.IPPROTO_GMTP": "syscall", - "syscall.IPPROTO_GRE": "syscall", - "syscall.IPPROTO_HELLO": "syscall", - "syscall.IPPROTO_HMP": "syscall", - "syscall.IPPROTO_HOPOPTS": "syscall", - "syscall.IPPROTO_ICMP": "syscall", - "syscall.IPPROTO_ICMPV6": "syscall", - "syscall.IPPROTO_IDP": "syscall", - "syscall.IPPROTO_IDPR": "syscall", - "syscall.IPPROTO_IDRP": "syscall", - "syscall.IPPROTO_IGMP": "syscall", - "syscall.IPPROTO_IGP": "syscall", - "syscall.IPPROTO_IGRP": "syscall", - "syscall.IPPROTO_IL": "syscall", - "syscall.IPPROTO_INLSP": "syscall", - "syscall.IPPROTO_INP": "syscall", - "syscall.IPPROTO_IP": "syscall", - "syscall.IPPROTO_IPCOMP": "syscall", - "syscall.IPPROTO_IPCV": "syscall", - "syscall.IPPROTO_IPEIP": "syscall", - "syscall.IPPROTO_IPIP": "syscall", - "syscall.IPPROTO_IPPC": "syscall", - "syscall.IPPROTO_IPV4": "syscall", - "syscall.IPPROTO_IPV6": "syscall", - "syscall.IPPROTO_IPV6_ICMP": "syscall", - "syscall.IPPROTO_IRTP": "syscall", - "syscall.IPPROTO_KRYPTOLAN": "syscall", - "syscall.IPPROTO_LARP": "syscall", - "syscall.IPPROTO_LEAF1": "syscall", - "syscall.IPPROTO_LEAF2": "syscall", - "syscall.IPPROTO_MAX": "syscall", - "syscall.IPPROTO_MAXID": "syscall", - "syscall.IPPROTO_MEAS": "syscall", - "syscall.IPPROTO_MH": "syscall", - "syscall.IPPROTO_MHRP": "syscall", - "syscall.IPPROTO_MICP": "syscall", - "syscall.IPPROTO_MOBILE": "syscall", - "syscall.IPPROTO_MPLS": "syscall", - "syscall.IPPROTO_MTP": "syscall", - "syscall.IPPROTO_MUX": "syscall", - "syscall.IPPROTO_ND": "syscall", - "syscall.IPPROTO_NHRP": "syscall", - "syscall.IPPROTO_NONE": "syscall", - "syscall.IPPROTO_NSP": "syscall", - "syscall.IPPROTO_NVPII": "syscall", - "syscall.IPPROTO_OLD_DIVERT": "syscall", - "syscall.IPPROTO_OSPFIGP": "syscall", - "syscall.IPPROTO_PFSYNC": "syscall", - "syscall.IPPROTO_PGM": "syscall", - "syscall.IPPROTO_PIGP": "syscall", - "syscall.IPPROTO_PIM": "syscall", - "syscall.IPPROTO_PRM": "syscall", - "syscall.IPPROTO_PUP": "syscall", - "syscall.IPPROTO_PVP": "syscall", - "syscall.IPPROTO_RAW": "syscall", - "syscall.IPPROTO_RCCMON": "syscall", - "syscall.IPPROTO_RDP": "syscall", - "syscall.IPPROTO_ROUTING": "syscall", - "syscall.IPPROTO_RSVP": "syscall", - "syscall.IPPROTO_RVD": "syscall", - "syscall.IPPROTO_SATEXPAK": "syscall", - "syscall.IPPROTO_SATMON": "syscall", - "syscall.IPPROTO_SCCSP": "syscall", - "syscall.IPPROTO_SCTP": "syscall", - "syscall.IPPROTO_SDRP": "syscall", - "syscall.IPPROTO_SEND": "syscall", - "syscall.IPPROTO_SEP": "syscall", - "syscall.IPPROTO_SKIP": "syscall", - "syscall.IPPROTO_SPACER": "syscall", - "syscall.IPPROTO_SRPC": "syscall", - "syscall.IPPROTO_ST": "syscall", - "syscall.IPPROTO_SVMTP": "syscall", - "syscall.IPPROTO_SWIPE": "syscall", - "syscall.IPPROTO_TCF": "syscall", - "syscall.IPPROTO_TCP": "syscall", - "syscall.IPPROTO_TLSP": "syscall", - "syscall.IPPROTO_TP": "syscall", - "syscall.IPPROTO_TPXX": "syscall", - "syscall.IPPROTO_TRUNK1": "syscall", - "syscall.IPPROTO_TRUNK2": "syscall", - "syscall.IPPROTO_TTP": "syscall", - "syscall.IPPROTO_UDP": "syscall", - "syscall.IPPROTO_UDPLITE": "syscall", - "syscall.IPPROTO_VINES": "syscall", - "syscall.IPPROTO_VISA": "syscall", - "syscall.IPPROTO_VMTP": "syscall", - "syscall.IPPROTO_VRRP": "syscall", - "syscall.IPPROTO_WBEXPAK": "syscall", - "syscall.IPPROTO_WBMON": "syscall", - "syscall.IPPROTO_WSN": "syscall", - "syscall.IPPROTO_XNET": "syscall", - "syscall.IPPROTO_XTP": "syscall", - "syscall.IPV6_2292DSTOPTS": "syscall", - "syscall.IPV6_2292HOPLIMIT": "syscall", - "syscall.IPV6_2292HOPOPTS": "syscall", - "syscall.IPV6_2292NEXTHOP": "syscall", - "syscall.IPV6_2292PKTINFO": "syscall", - "syscall.IPV6_2292PKTOPTIONS": "syscall", - "syscall.IPV6_2292RTHDR": "syscall", - "syscall.IPV6_ADDRFORM": "syscall", - "syscall.IPV6_ADD_MEMBERSHIP": "syscall", - "syscall.IPV6_AUTHHDR": "syscall", - "syscall.IPV6_AUTH_LEVEL": "syscall", - "syscall.IPV6_AUTOFLOWLABEL": "syscall", - "syscall.IPV6_BINDANY": "syscall", - "syscall.IPV6_BINDV6ONLY": "syscall", - "syscall.IPV6_BOUND_IF": "syscall", - "syscall.IPV6_CHECKSUM": "syscall", - "syscall.IPV6_DEFAULT_MULTICAST_HOPS": "syscall", - "syscall.IPV6_DEFAULT_MULTICAST_LOOP": "syscall", - "syscall.IPV6_DEFHLIM": "syscall", - "syscall.IPV6_DONTFRAG": "syscall", - "syscall.IPV6_DROP_MEMBERSHIP": "syscall", - "syscall.IPV6_DSTOPTS": "syscall", - "syscall.IPV6_ESP_NETWORK_LEVEL": "syscall", - "syscall.IPV6_ESP_TRANS_LEVEL": "syscall", - "syscall.IPV6_FAITH": "syscall", - "syscall.IPV6_FLOWINFO_MASK": "syscall", - "syscall.IPV6_FLOWLABEL_MASK": "syscall", - "syscall.IPV6_FRAGTTL": "syscall", - "syscall.IPV6_FW_ADD": "syscall", - "syscall.IPV6_FW_DEL": "syscall", - "syscall.IPV6_FW_FLUSH": "syscall", - "syscall.IPV6_FW_GET": "syscall", - "syscall.IPV6_FW_ZERO": "syscall", - "syscall.IPV6_HLIMDEC": "syscall", - "syscall.IPV6_HOPLIMIT": "syscall", - "syscall.IPV6_HOPOPTS": "syscall", - "syscall.IPV6_IPCOMP_LEVEL": "syscall", - "syscall.IPV6_IPSEC_POLICY": "syscall", - "syscall.IPV6_JOIN_ANYCAST": "syscall", - "syscall.IPV6_JOIN_GROUP": "syscall", - "syscall.IPV6_LEAVE_ANYCAST": "syscall", - "syscall.IPV6_LEAVE_GROUP": "syscall", - "syscall.IPV6_MAXHLIM": "syscall", - "syscall.IPV6_MAXOPTHDR": "syscall", - "syscall.IPV6_MAXPACKET": "syscall", - "syscall.IPV6_MAX_GROUP_SRC_FILTER": "syscall", - "syscall.IPV6_MAX_MEMBERSHIPS": "syscall", - "syscall.IPV6_MAX_SOCK_SRC_FILTER": "syscall", - "syscall.IPV6_MIN_MEMBERSHIPS": "syscall", - "syscall.IPV6_MMTU": "syscall", - "syscall.IPV6_MSFILTER": "syscall", - "syscall.IPV6_MTU": "syscall", - "syscall.IPV6_MTU_DISCOVER": "syscall", - "syscall.IPV6_MULTICAST_HOPS": "syscall", - "syscall.IPV6_MULTICAST_IF": "syscall", - "syscall.IPV6_MULTICAST_LOOP": "syscall", - "syscall.IPV6_NEXTHOP": "syscall", - "syscall.IPV6_OPTIONS": "syscall", - "syscall.IPV6_PATHMTU": "syscall", - "syscall.IPV6_PIPEX": "syscall", - "syscall.IPV6_PKTINFO": "syscall", - "syscall.IPV6_PMTUDISC_DO": "syscall", - "syscall.IPV6_PMTUDISC_DONT": "syscall", - "syscall.IPV6_PMTUDISC_PROBE": "syscall", - "syscall.IPV6_PMTUDISC_WANT": "syscall", - "syscall.IPV6_PORTRANGE": "syscall", - "syscall.IPV6_PORTRANGE_DEFAULT": "syscall", - "syscall.IPV6_PORTRANGE_HIGH": "syscall", - "syscall.IPV6_PORTRANGE_LOW": "syscall", - "syscall.IPV6_PREFER_TEMPADDR": "syscall", - "syscall.IPV6_RECVDSTOPTS": "syscall", - "syscall.IPV6_RECVDSTPORT": "syscall", - "syscall.IPV6_RECVERR": "syscall", - "syscall.IPV6_RECVHOPLIMIT": "syscall", - "syscall.IPV6_RECVHOPOPTS": "syscall", - "syscall.IPV6_RECVPATHMTU": "syscall", - "syscall.IPV6_RECVPKTINFO": "syscall", - "syscall.IPV6_RECVRTHDR": "syscall", - "syscall.IPV6_RECVTCLASS": "syscall", - "syscall.IPV6_ROUTER_ALERT": "syscall", - "syscall.IPV6_RTABLE": "syscall", - "syscall.IPV6_RTHDR": "syscall", - "syscall.IPV6_RTHDRDSTOPTS": "syscall", - "syscall.IPV6_RTHDR_LOOSE": "syscall", - "syscall.IPV6_RTHDR_STRICT": "syscall", - "syscall.IPV6_RTHDR_TYPE_0": "syscall", - "syscall.IPV6_RXDSTOPTS": "syscall", - "syscall.IPV6_RXHOPOPTS": "syscall", - "syscall.IPV6_SOCKOPT_RESERVED1": "syscall", - "syscall.IPV6_TCLASS": "syscall", - "syscall.IPV6_UNICAST_HOPS": "syscall", - "syscall.IPV6_USE_MIN_MTU": "syscall", - "syscall.IPV6_V6ONLY": "syscall", - "syscall.IPV6_VERSION": "syscall", - "syscall.IPV6_VERSION_MASK": "syscall", - "syscall.IPV6_XFRM_POLICY": "syscall", - "syscall.IP_ADD_MEMBERSHIP": "syscall", - "syscall.IP_ADD_SOURCE_MEMBERSHIP": "syscall", - "syscall.IP_AUTH_LEVEL": "syscall", - "syscall.IP_BINDANY": "syscall", - "syscall.IP_BLOCK_SOURCE": "syscall", - "syscall.IP_BOUND_IF": "syscall", - "syscall.IP_DEFAULT_MULTICAST_LOOP": "syscall", - "syscall.IP_DEFAULT_MULTICAST_TTL": "syscall", - "syscall.IP_DF": "syscall", - "syscall.IP_DIVERTFL": "syscall", - "syscall.IP_DONTFRAG": "syscall", - "syscall.IP_DROP_MEMBERSHIP": "syscall", - "syscall.IP_DROP_SOURCE_MEMBERSHIP": "syscall", - "syscall.IP_DUMMYNET3": "syscall", - "syscall.IP_DUMMYNET_CONFIGURE": "syscall", - "syscall.IP_DUMMYNET_DEL": "syscall", - "syscall.IP_DUMMYNET_FLUSH": "syscall", - "syscall.IP_DUMMYNET_GET": "syscall", - "syscall.IP_EF": "syscall", - "syscall.IP_ERRORMTU": "syscall", - "syscall.IP_ESP_NETWORK_LEVEL": "syscall", - "syscall.IP_ESP_TRANS_LEVEL": "syscall", - "syscall.IP_FAITH": "syscall", - "syscall.IP_FREEBIND": "syscall", - "syscall.IP_FW3": "syscall", - "syscall.IP_FW_ADD": "syscall", - "syscall.IP_FW_DEL": "syscall", - "syscall.IP_FW_FLUSH": "syscall", - "syscall.IP_FW_GET": "syscall", - "syscall.IP_FW_NAT_CFG": "syscall", - "syscall.IP_FW_NAT_DEL": "syscall", - "syscall.IP_FW_NAT_GET_CONFIG": "syscall", - "syscall.IP_FW_NAT_GET_LOG": "syscall", - "syscall.IP_FW_RESETLOG": "syscall", - "syscall.IP_FW_TABLE_ADD": "syscall", - "syscall.IP_FW_TABLE_DEL": "syscall", - "syscall.IP_FW_TABLE_FLUSH": "syscall", - "syscall.IP_FW_TABLE_GETSIZE": "syscall", - "syscall.IP_FW_TABLE_LIST": "syscall", - "syscall.IP_FW_ZERO": "syscall", - "syscall.IP_HDRINCL": "syscall", - "syscall.IP_IPCOMP_LEVEL": "syscall", - "syscall.IP_IPSECFLOWINFO": "syscall", - "syscall.IP_IPSEC_LOCAL_AUTH": "syscall", - "syscall.IP_IPSEC_LOCAL_CRED": "syscall", - "syscall.IP_IPSEC_LOCAL_ID": "syscall", - "syscall.IP_IPSEC_POLICY": "syscall", - "syscall.IP_IPSEC_REMOTE_AUTH": "syscall", - "syscall.IP_IPSEC_REMOTE_CRED": "syscall", - "syscall.IP_IPSEC_REMOTE_ID": "syscall", - "syscall.IP_MAXPACKET": "syscall", - "syscall.IP_MAX_GROUP_SRC_FILTER": "syscall", - "syscall.IP_MAX_MEMBERSHIPS": "syscall", - "syscall.IP_MAX_SOCK_MUTE_FILTER": "syscall", - "syscall.IP_MAX_SOCK_SRC_FILTER": "syscall", - "syscall.IP_MAX_SOURCE_FILTER": "syscall", - "syscall.IP_MF": "syscall", - "syscall.IP_MINFRAGSIZE": "syscall", - "syscall.IP_MINTTL": "syscall", - "syscall.IP_MIN_MEMBERSHIPS": "syscall", - "syscall.IP_MSFILTER": "syscall", - "syscall.IP_MSS": "syscall", - "syscall.IP_MTU": "syscall", - "syscall.IP_MTU_DISCOVER": "syscall", - "syscall.IP_MULTICAST_IF": "syscall", - "syscall.IP_MULTICAST_IFINDEX": "syscall", - "syscall.IP_MULTICAST_LOOP": "syscall", - "syscall.IP_MULTICAST_TTL": "syscall", - "syscall.IP_MULTICAST_VIF": "syscall", - "syscall.IP_NAT__XXX": "syscall", - "syscall.IP_OFFMASK": "syscall", - "syscall.IP_OLD_FW_ADD": "syscall", - "syscall.IP_OLD_FW_DEL": "syscall", - "syscall.IP_OLD_FW_FLUSH": "syscall", - "syscall.IP_OLD_FW_GET": "syscall", - "syscall.IP_OLD_FW_RESETLOG": "syscall", - "syscall.IP_OLD_FW_ZERO": "syscall", - "syscall.IP_ONESBCAST": "syscall", - "syscall.IP_OPTIONS": "syscall", - "syscall.IP_ORIGDSTADDR": "syscall", - "syscall.IP_PASSSEC": "syscall", - "syscall.IP_PIPEX": "syscall", - "syscall.IP_PKTINFO": "syscall", - "syscall.IP_PKTOPTIONS": "syscall", - "syscall.IP_PMTUDISC": "syscall", - "syscall.IP_PMTUDISC_DO": "syscall", - "syscall.IP_PMTUDISC_DONT": "syscall", - "syscall.IP_PMTUDISC_PROBE": "syscall", - "syscall.IP_PMTUDISC_WANT": "syscall", - "syscall.IP_PORTRANGE": "syscall", - "syscall.IP_PORTRANGE_DEFAULT": "syscall", - "syscall.IP_PORTRANGE_HIGH": "syscall", - "syscall.IP_PORTRANGE_LOW": "syscall", - "syscall.IP_RECVDSTADDR": "syscall", - "syscall.IP_RECVDSTPORT": "syscall", - "syscall.IP_RECVERR": "syscall", - "syscall.IP_RECVIF": "syscall", - "syscall.IP_RECVOPTS": "syscall", - "syscall.IP_RECVORIGDSTADDR": "syscall", - "syscall.IP_RECVPKTINFO": "syscall", - "syscall.IP_RECVRETOPTS": "syscall", - "syscall.IP_RECVRTABLE": "syscall", - "syscall.IP_RECVTOS": "syscall", - "syscall.IP_RECVTTL": "syscall", - "syscall.IP_RETOPTS": "syscall", - "syscall.IP_RF": "syscall", - "syscall.IP_ROUTER_ALERT": "syscall", - "syscall.IP_RSVP_OFF": "syscall", - "syscall.IP_RSVP_ON": "syscall", - "syscall.IP_RSVP_VIF_OFF": "syscall", - "syscall.IP_RSVP_VIF_ON": "syscall", - "syscall.IP_RTABLE": "syscall", - "syscall.IP_SENDSRCADDR": "syscall", - "syscall.IP_STRIPHDR": "syscall", - "syscall.IP_TOS": "syscall", - "syscall.IP_TRAFFIC_MGT_BACKGROUND": "syscall", - "syscall.IP_TRANSPARENT": "syscall", - "syscall.IP_TTL": "syscall", - "syscall.IP_UNBLOCK_SOURCE": "syscall", - "syscall.IP_XFRM_POLICY": "syscall", - "syscall.IPv6MTUInfo": "syscall", - "syscall.IPv6Mreq": "syscall", - "syscall.ISIG": "syscall", - "syscall.ISTRIP": "syscall", - "syscall.IUCLC": "syscall", - "syscall.IUTF8": "syscall", - "syscall.IXANY": "syscall", - "syscall.IXOFF": "syscall", - "syscall.IXON": "syscall", - "syscall.IfAddrmsg": "syscall", - "syscall.IfAnnounceMsghdr": "syscall", - "syscall.IfData": "syscall", - "syscall.IfInfomsg": "syscall", - "syscall.IfMsghdr": "syscall", - "syscall.IfaMsghdr": "syscall", - "syscall.IfmaMsghdr": "syscall", - "syscall.IfmaMsghdr2": "syscall", - "syscall.ImplementsGetwd": "syscall", - "syscall.Inet4Pktinfo": "syscall", - "syscall.Inet6Pktinfo": "syscall", - "syscall.InotifyAddWatch": "syscall", - "syscall.InotifyEvent": "syscall", - "syscall.InotifyInit": "syscall", - "syscall.InotifyInit1": "syscall", - "syscall.InotifyRmWatch": "syscall", - "syscall.InterfaceAddrMessage": "syscall", - "syscall.InterfaceAnnounceMessage": "syscall", - "syscall.InterfaceInfo": "syscall", - "syscall.InterfaceMessage": "syscall", - "syscall.InterfaceMulticastAddrMessage": "syscall", - "syscall.InvalidHandle": "syscall", - "syscall.Ioperm": "syscall", - "syscall.Iopl": "syscall", - "syscall.Iovec": "syscall", - "syscall.IpAdapterInfo": "syscall", - "syscall.IpAddrString": "syscall", - "syscall.IpAddressString": "syscall", - "syscall.IpMaskString": "syscall", - "syscall.Issetugid": "syscall", - "syscall.KEY_ALL_ACCESS": "syscall", - "syscall.KEY_CREATE_LINK": "syscall", - "syscall.KEY_CREATE_SUB_KEY": "syscall", - "syscall.KEY_ENUMERATE_SUB_KEYS": "syscall", - "syscall.KEY_EXECUTE": "syscall", - "syscall.KEY_NOTIFY": "syscall", - "syscall.KEY_QUERY_VALUE": "syscall", - "syscall.KEY_READ": "syscall", - "syscall.KEY_SET_VALUE": "syscall", - "syscall.KEY_WOW64_32KEY": "syscall", - "syscall.KEY_WOW64_64KEY": "syscall", - "syscall.KEY_WRITE": "syscall", - "syscall.Kevent": "syscall", - "syscall.Kevent_t": "syscall", - "syscall.Kill": "syscall", - "syscall.Klogctl": "syscall", - "syscall.Kqueue": "syscall", - "syscall.LANG_ENGLISH": "syscall", - "syscall.LAYERED_PROTOCOL": "syscall", - "syscall.LCNT_OVERLOAD_FLUSH": "syscall", - "syscall.LINUX_REBOOT_CMD_CAD_OFF": "syscall", - "syscall.LINUX_REBOOT_CMD_CAD_ON": "syscall", - "syscall.LINUX_REBOOT_CMD_HALT": "syscall", - "syscall.LINUX_REBOOT_CMD_KEXEC": "syscall", - "syscall.LINUX_REBOOT_CMD_POWER_OFF": "syscall", - "syscall.LINUX_REBOOT_CMD_RESTART": "syscall", - "syscall.LINUX_REBOOT_CMD_RESTART2": "syscall", - "syscall.LINUX_REBOOT_CMD_SW_SUSPEND": "syscall", - "syscall.LINUX_REBOOT_MAGIC1": "syscall", - "syscall.LINUX_REBOOT_MAGIC2": "syscall", - "syscall.LOCK_EX": "syscall", - "syscall.LOCK_NB": "syscall", - "syscall.LOCK_SH": "syscall", - "syscall.LOCK_UN": "syscall", - "syscall.LazyDLL": "syscall", - "syscall.LazyProc": "syscall", - "syscall.Lchown": "syscall", - "syscall.Linger": "syscall", - "syscall.Link": "syscall", - "syscall.Listen": "syscall", - "syscall.Listxattr": "syscall", - "syscall.LoadCancelIoEx": "syscall", - "syscall.LoadConnectEx": "syscall", - "syscall.LoadCreateSymbolicLink": "syscall", - "syscall.LoadDLL": "syscall", - "syscall.LoadGetAddrInfo": "syscall", - "syscall.LoadLibrary": "syscall", - "syscall.LoadSetFileCompletionNotificationModes": "syscall", - "syscall.LocalFree": "syscall", - "syscall.Log2phys_t": "syscall", - "syscall.LookupAccountName": "syscall", - "syscall.LookupAccountSid": "syscall", - "syscall.LookupSID": "syscall", - "syscall.LsfJump": "syscall", - "syscall.LsfSocket": "syscall", - "syscall.LsfStmt": "syscall", - "syscall.Lstat": "syscall", - "syscall.MADV_AUTOSYNC": "syscall", - "syscall.MADV_CAN_REUSE": "syscall", - "syscall.MADV_CORE": "syscall", - "syscall.MADV_DOFORK": "syscall", - "syscall.MADV_DONTFORK": "syscall", - "syscall.MADV_DONTNEED": "syscall", - "syscall.MADV_FREE": "syscall", - "syscall.MADV_FREE_REUSABLE": "syscall", - "syscall.MADV_FREE_REUSE": "syscall", - "syscall.MADV_HUGEPAGE": "syscall", - "syscall.MADV_HWPOISON": "syscall", - "syscall.MADV_MERGEABLE": "syscall", - "syscall.MADV_NOCORE": "syscall", - "syscall.MADV_NOHUGEPAGE": "syscall", - "syscall.MADV_NORMAL": "syscall", - "syscall.MADV_NOSYNC": "syscall", - "syscall.MADV_PROTECT": "syscall", - "syscall.MADV_RANDOM": "syscall", - "syscall.MADV_REMOVE": "syscall", - "syscall.MADV_SEQUENTIAL": "syscall", - "syscall.MADV_SPACEAVAIL": "syscall", - "syscall.MADV_UNMERGEABLE": "syscall", - "syscall.MADV_WILLNEED": "syscall", - "syscall.MADV_ZERO_WIRED_PAGES": "syscall", - "syscall.MAP_32BIT": "syscall", - "syscall.MAP_ALIGNED_SUPER": "syscall", - "syscall.MAP_ALIGNMENT_16MB": "syscall", - "syscall.MAP_ALIGNMENT_1TB": "syscall", - "syscall.MAP_ALIGNMENT_256TB": "syscall", - "syscall.MAP_ALIGNMENT_4GB": "syscall", - "syscall.MAP_ALIGNMENT_64KB": "syscall", - "syscall.MAP_ALIGNMENT_64PB": "syscall", - "syscall.MAP_ALIGNMENT_MASK": "syscall", - "syscall.MAP_ALIGNMENT_SHIFT": "syscall", - "syscall.MAP_ANON": "syscall", - "syscall.MAP_ANONYMOUS": "syscall", - "syscall.MAP_COPY": "syscall", - "syscall.MAP_DENYWRITE": "syscall", - "syscall.MAP_EXECUTABLE": "syscall", - "syscall.MAP_FILE": "syscall", - "syscall.MAP_FIXED": "syscall", - "syscall.MAP_FLAGMASK": "syscall", - "syscall.MAP_GROWSDOWN": "syscall", - "syscall.MAP_HASSEMAPHORE": "syscall", - "syscall.MAP_HUGETLB": "syscall", - "syscall.MAP_INHERIT": "syscall", - "syscall.MAP_INHERIT_COPY": "syscall", - "syscall.MAP_INHERIT_DEFAULT": "syscall", - "syscall.MAP_INHERIT_DONATE_COPY": "syscall", - "syscall.MAP_INHERIT_NONE": "syscall", - "syscall.MAP_INHERIT_SHARE": "syscall", - "syscall.MAP_JIT": "syscall", - "syscall.MAP_LOCKED": "syscall", - "syscall.MAP_NOCACHE": "syscall", - "syscall.MAP_NOCORE": "syscall", - "syscall.MAP_NOEXTEND": "syscall", - "syscall.MAP_NONBLOCK": "syscall", - "syscall.MAP_NORESERVE": "syscall", - "syscall.MAP_NOSYNC": "syscall", - "syscall.MAP_POPULATE": "syscall", - "syscall.MAP_PREFAULT_READ": "syscall", - "syscall.MAP_PRIVATE": "syscall", - "syscall.MAP_RENAME": "syscall", - "syscall.MAP_RESERVED0080": "syscall", - "syscall.MAP_RESERVED0100": "syscall", - "syscall.MAP_SHARED": "syscall", - "syscall.MAP_STACK": "syscall", - "syscall.MAP_TRYFIXED": "syscall", - "syscall.MAP_TYPE": "syscall", - "syscall.MAP_WIRED": "syscall", - "syscall.MAXIMUM_REPARSE_DATA_BUFFER_SIZE": "syscall", - "syscall.MAXLEN_IFDESCR": "syscall", - "syscall.MAXLEN_PHYSADDR": "syscall", - "syscall.MAX_ADAPTER_ADDRESS_LENGTH": "syscall", - "syscall.MAX_ADAPTER_DESCRIPTION_LENGTH": "syscall", - "syscall.MAX_ADAPTER_NAME_LENGTH": "syscall", - "syscall.MAX_COMPUTERNAME_LENGTH": "syscall", - "syscall.MAX_INTERFACE_NAME_LEN": "syscall", - "syscall.MAX_LONG_PATH": "syscall", - "syscall.MAX_PATH": "syscall", - "syscall.MAX_PROTOCOL_CHAIN": "syscall", - "syscall.MCL_CURRENT": "syscall", - "syscall.MCL_FUTURE": "syscall", - "syscall.MNT_DETACH": "syscall", - "syscall.MNT_EXPIRE": "syscall", - "syscall.MNT_FORCE": "syscall", - "syscall.MSG_BCAST": "syscall", - "syscall.MSG_CMSG_CLOEXEC": "syscall", - "syscall.MSG_COMPAT": "syscall", - "syscall.MSG_CONFIRM": "syscall", - "syscall.MSG_CONTROLMBUF": "syscall", - "syscall.MSG_CTRUNC": "syscall", - "syscall.MSG_DONTROUTE": "syscall", - "syscall.MSG_DONTWAIT": "syscall", - "syscall.MSG_EOF": "syscall", - "syscall.MSG_EOR": "syscall", - "syscall.MSG_ERRQUEUE": "syscall", - "syscall.MSG_FASTOPEN": "syscall", - "syscall.MSG_FIN": "syscall", - "syscall.MSG_FLUSH": "syscall", - "syscall.MSG_HAVEMORE": "syscall", - "syscall.MSG_HOLD": "syscall", - "syscall.MSG_IOVUSRSPACE": "syscall", - "syscall.MSG_LENUSRSPACE": "syscall", - "syscall.MSG_MCAST": "syscall", - "syscall.MSG_MORE": "syscall", - "syscall.MSG_NAMEMBUF": "syscall", - "syscall.MSG_NBIO": "syscall", - "syscall.MSG_NEEDSA": "syscall", - "syscall.MSG_NOSIGNAL": "syscall", - "syscall.MSG_NOTIFICATION": "syscall", - "syscall.MSG_OOB": "syscall", - "syscall.MSG_PEEK": "syscall", - "syscall.MSG_PROXY": "syscall", - "syscall.MSG_RCVMORE": "syscall", - "syscall.MSG_RST": "syscall", - "syscall.MSG_SEND": "syscall", - "syscall.MSG_SYN": "syscall", - "syscall.MSG_TRUNC": "syscall", - "syscall.MSG_TRYHARD": "syscall", - "syscall.MSG_USERFLAGS": "syscall", - "syscall.MSG_WAITALL": "syscall", - "syscall.MSG_WAITFORONE": "syscall", - "syscall.MSG_WAITSTREAM": "syscall", - "syscall.MS_ACTIVE": "syscall", - "syscall.MS_ASYNC": "syscall", - "syscall.MS_BIND": "syscall", - "syscall.MS_DEACTIVATE": "syscall", - "syscall.MS_DIRSYNC": "syscall", - "syscall.MS_INVALIDATE": "syscall", - "syscall.MS_I_VERSION": "syscall", - "syscall.MS_KERNMOUNT": "syscall", - "syscall.MS_KILLPAGES": "syscall", - "syscall.MS_MANDLOCK": "syscall", - "syscall.MS_MGC_MSK": "syscall", - "syscall.MS_MGC_VAL": "syscall", - "syscall.MS_MOVE": "syscall", - "syscall.MS_NOATIME": "syscall", - "syscall.MS_NODEV": "syscall", - "syscall.MS_NODIRATIME": "syscall", - "syscall.MS_NOEXEC": "syscall", - "syscall.MS_NOSUID": "syscall", - "syscall.MS_NOUSER": "syscall", - "syscall.MS_POSIXACL": "syscall", - "syscall.MS_PRIVATE": "syscall", - "syscall.MS_RDONLY": "syscall", - "syscall.MS_REC": "syscall", - "syscall.MS_RELATIME": "syscall", - "syscall.MS_REMOUNT": "syscall", - "syscall.MS_RMT_MASK": "syscall", - "syscall.MS_SHARED": "syscall", - "syscall.MS_SILENT": "syscall", - "syscall.MS_SLAVE": "syscall", - "syscall.MS_STRICTATIME": "syscall", - "syscall.MS_SYNC": "syscall", - "syscall.MS_SYNCHRONOUS": "syscall", - "syscall.MS_UNBINDABLE": "syscall", - "syscall.Madvise": "syscall", - "syscall.MapViewOfFile": "syscall", - "syscall.MaxTokenInfoClass": "syscall", - "syscall.Mclpool": "syscall", - "syscall.MibIfRow": "syscall", - "syscall.Mkdir": "syscall", - "syscall.Mkdirat": "syscall", - "syscall.Mkfifo": "syscall", - "syscall.Mknod": "syscall", - "syscall.Mknodat": "syscall", - "syscall.Mlock": "syscall", - "syscall.Mlockall": "syscall", - "syscall.Mmap": "syscall", - "syscall.Mount": "syscall", - "syscall.MoveFile": "syscall", - "syscall.Mprotect": "syscall", - "syscall.Msghdr": "syscall", - "syscall.Munlock": "syscall", - "syscall.Munlockall": "syscall", - "syscall.Munmap": "syscall", - "syscall.MustLoadDLL": "syscall", - "syscall.NAME_MAX": "syscall", - "syscall.NETLINK_ADD_MEMBERSHIP": "syscall", - "syscall.NETLINK_AUDIT": "syscall", - "syscall.NETLINK_BROADCAST_ERROR": "syscall", - "syscall.NETLINK_CONNECTOR": "syscall", - "syscall.NETLINK_DNRTMSG": "syscall", - "syscall.NETLINK_DROP_MEMBERSHIP": "syscall", - "syscall.NETLINK_ECRYPTFS": "syscall", - "syscall.NETLINK_FIB_LOOKUP": "syscall", - "syscall.NETLINK_FIREWALL": "syscall", - "syscall.NETLINK_GENERIC": "syscall", - "syscall.NETLINK_INET_DIAG": "syscall", - "syscall.NETLINK_IP6_FW": "syscall", - "syscall.NETLINK_ISCSI": "syscall", - "syscall.NETLINK_KOBJECT_UEVENT": "syscall", - "syscall.NETLINK_NETFILTER": "syscall", - "syscall.NETLINK_NFLOG": "syscall", - "syscall.NETLINK_NO_ENOBUFS": "syscall", - "syscall.NETLINK_PKTINFO": "syscall", - "syscall.NETLINK_RDMA": "syscall", - "syscall.NETLINK_ROUTE": "syscall", - "syscall.NETLINK_SCSITRANSPORT": "syscall", - "syscall.NETLINK_SELINUX": "syscall", - "syscall.NETLINK_UNUSED": "syscall", - "syscall.NETLINK_USERSOCK": "syscall", - "syscall.NETLINK_XFRM": "syscall", - "syscall.NET_RT_DUMP": "syscall", - "syscall.NET_RT_DUMP2": "syscall", - "syscall.NET_RT_FLAGS": "syscall", - "syscall.NET_RT_IFLIST": "syscall", - "syscall.NET_RT_IFLIST2": "syscall", - "syscall.NET_RT_IFLISTL": "syscall", - "syscall.NET_RT_IFMALIST": "syscall", - "syscall.NET_RT_MAXID": "syscall", - "syscall.NET_RT_OIFLIST": "syscall", - "syscall.NET_RT_OOIFLIST": "syscall", - "syscall.NET_RT_STAT": "syscall", - "syscall.NET_RT_STATS": "syscall", - "syscall.NET_RT_TABLE": "syscall", - "syscall.NET_RT_TRASH": "syscall", - "syscall.NLA_ALIGNTO": "syscall", - "syscall.NLA_F_NESTED": "syscall", - "syscall.NLA_F_NET_BYTEORDER": "syscall", - "syscall.NLA_HDRLEN": "syscall", - "syscall.NLMSG_ALIGNTO": "syscall", - "syscall.NLMSG_DONE": "syscall", - "syscall.NLMSG_ERROR": "syscall", - "syscall.NLMSG_HDRLEN": "syscall", - "syscall.NLMSG_MIN_TYPE": "syscall", - "syscall.NLMSG_NOOP": "syscall", - "syscall.NLMSG_OVERRUN": "syscall", - "syscall.NLM_F_ACK": "syscall", - "syscall.NLM_F_APPEND": "syscall", - "syscall.NLM_F_ATOMIC": "syscall", - "syscall.NLM_F_CREATE": "syscall", - "syscall.NLM_F_DUMP": "syscall", - "syscall.NLM_F_ECHO": "syscall", - "syscall.NLM_F_EXCL": "syscall", - "syscall.NLM_F_MATCH": "syscall", - "syscall.NLM_F_MULTI": "syscall", - "syscall.NLM_F_REPLACE": "syscall", - "syscall.NLM_F_REQUEST": "syscall", - "syscall.NLM_F_ROOT": "syscall", - "syscall.NOFLSH": "syscall", - "syscall.NOTE_ABSOLUTE": "syscall", - "syscall.NOTE_ATTRIB": "syscall", - "syscall.NOTE_CHILD": "syscall", - "syscall.NOTE_DELETE": "syscall", - "syscall.NOTE_EOF": "syscall", - "syscall.NOTE_EXEC": "syscall", - "syscall.NOTE_EXIT": "syscall", - "syscall.NOTE_EXITSTATUS": "syscall", - "syscall.NOTE_EXTEND": "syscall", - "syscall.NOTE_FFAND": "syscall", - "syscall.NOTE_FFCOPY": "syscall", - "syscall.NOTE_FFCTRLMASK": "syscall", - "syscall.NOTE_FFLAGSMASK": "syscall", - "syscall.NOTE_FFNOP": "syscall", - "syscall.NOTE_FFOR": "syscall", - "syscall.NOTE_FORK": "syscall", - "syscall.NOTE_LINK": "syscall", - "syscall.NOTE_LOWAT": "syscall", - "syscall.NOTE_NONE": "syscall", - "syscall.NOTE_NSECONDS": "syscall", - "syscall.NOTE_PCTRLMASK": "syscall", - "syscall.NOTE_PDATAMASK": "syscall", - "syscall.NOTE_REAP": "syscall", - "syscall.NOTE_RENAME": "syscall", - "syscall.NOTE_RESOURCEEND": "syscall", - "syscall.NOTE_REVOKE": "syscall", - "syscall.NOTE_SECONDS": "syscall", - "syscall.NOTE_SIGNAL": "syscall", - "syscall.NOTE_TRACK": "syscall", - "syscall.NOTE_TRACKERR": "syscall", - "syscall.NOTE_TRIGGER": "syscall", - "syscall.NOTE_TRUNCATE": "syscall", - "syscall.NOTE_USECONDS": "syscall", - "syscall.NOTE_VM_ERROR": "syscall", - "syscall.NOTE_VM_PRESSURE": "syscall", - "syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE": "syscall", - "syscall.NOTE_VM_PRESSURE_TERMINATE": "syscall", - "syscall.NOTE_WRITE": "syscall", - "syscall.NameCanonical": "syscall", - "syscall.NameCanonicalEx": "syscall", - "syscall.NameDisplay": "syscall", - "syscall.NameDnsDomain": "syscall", - "syscall.NameFullyQualifiedDN": "syscall", - "syscall.NameSamCompatible": "syscall", - "syscall.NameServicePrincipal": "syscall", - "syscall.NameUniqueId": "syscall", - "syscall.NameUnknown": "syscall", - "syscall.NameUserPrincipal": "syscall", - "syscall.Nanosleep": "syscall", - "syscall.NetApiBufferFree": "syscall", - "syscall.NetGetJoinInformation": "syscall", - "syscall.NetSetupDomainName": "syscall", - "syscall.NetSetupUnjoined": "syscall", - "syscall.NetSetupUnknownStatus": "syscall", - "syscall.NetSetupWorkgroupName": "syscall", - "syscall.NetUserGetInfo": "syscall", - "syscall.NetlinkMessage": "syscall", - "syscall.NetlinkRIB": "syscall", - "syscall.NetlinkRouteAttr": "syscall", - "syscall.NetlinkRouteRequest": "syscall", - "syscall.NewCallback": "syscall", - "syscall.NewCallbackCDecl": "syscall", - "syscall.NewLazyDLL": "syscall", - "syscall.NlAttr": "syscall", - "syscall.NlMsgerr": "syscall", - "syscall.NlMsghdr": "syscall", - "syscall.NsecToFiletime": "syscall", - "syscall.NsecToTimespec": "syscall", - "syscall.NsecToTimeval": "syscall", - "syscall.Ntohs": "syscall", - "syscall.OCRNL": "syscall", - "syscall.OFDEL": "syscall", - "syscall.OFILL": "syscall", - "syscall.OFIOGETBMAP": "syscall", - "syscall.OID_PKIX_KP_SERVER_AUTH": "syscall", - "syscall.OID_SERVER_GATED_CRYPTO": "syscall", - "syscall.OID_SGC_NETSCAPE": "syscall", - "syscall.OLCUC": "syscall", - "syscall.ONLCR": "syscall", - "syscall.ONLRET": "syscall", - "syscall.ONOCR": "syscall", - "syscall.ONOEOT": "syscall", - "syscall.OPEN_ALWAYS": "syscall", - "syscall.OPEN_EXISTING": "syscall", - "syscall.OPOST": "syscall", - "syscall.O_ACCMODE": "syscall", - "syscall.O_ALERT": "syscall", - "syscall.O_ALT_IO": "syscall", - "syscall.O_APPEND": "syscall", - "syscall.O_ASYNC": "syscall", - "syscall.O_CLOEXEC": "syscall", - "syscall.O_CREAT": "syscall", - "syscall.O_DIRECT": "syscall", - "syscall.O_DIRECTORY": "syscall", - "syscall.O_DSYNC": "syscall", - "syscall.O_EVTONLY": "syscall", - "syscall.O_EXCL": "syscall", - "syscall.O_EXEC": "syscall", - "syscall.O_EXLOCK": "syscall", - "syscall.O_FSYNC": "syscall", - "syscall.O_LARGEFILE": "syscall", - "syscall.O_NDELAY": "syscall", - "syscall.O_NOATIME": "syscall", - "syscall.O_NOCTTY": "syscall", - "syscall.O_NOFOLLOW": "syscall", - "syscall.O_NONBLOCK": "syscall", - "syscall.O_NOSIGPIPE": "syscall", - "syscall.O_POPUP": "syscall", - "syscall.O_RDONLY": "syscall", - "syscall.O_RDWR": "syscall", - "syscall.O_RSYNC": "syscall", - "syscall.O_SHLOCK": "syscall", - "syscall.O_SYMLINK": "syscall", - "syscall.O_SYNC": "syscall", - "syscall.O_TRUNC": "syscall", - "syscall.O_TTY_INIT": "syscall", - "syscall.O_WRONLY": "syscall", - "syscall.Open": "syscall", - "syscall.OpenCurrentProcessToken": "syscall", - "syscall.OpenProcess": "syscall", - "syscall.OpenProcessToken": "syscall", - "syscall.Openat": "syscall", - "syscall.Overlapped": "syscall", - "syscall.PACKET_ADD_MEMBERSHIP": "syscall", - "syscall.PACKET_BROADCAST": "syscall", - "syscall.PACKET_DROP_MEMBERSHIP": "syscall", - "syscall.PACKET_FASTROUTE": "syscall", - "syscall.PACKET_HOST": "syscall", - "syscall.PACKET_LOOPBACK": "syscall", - "syscall.PACKET_MR_ALLMULTI": "syscall", - "syscall.PACKET_MR_MULTICAST": "syscall", - "syscall.PACKET_MR_PROMISC": "syscall", - "syscall.PACKET_MULTICAST": "syscall", - "syscall.PACKET_OTHERHOST": "syscall", - "syscall.PACKET_OUTGOING": "syscall", - "syscall.PACKET_RECV_OUTPUT": "syscall", - "syscall.PACKET_RX_RING": "syscall", - "syscall.PACKET_STATISTICS": "syscall", - "syscall.PAGE_EXECUTE_READ": "syscall", - "syscall.PAGE_EXECUTE_READWRITE": "syscall", - "syscall.PAGE_EXECUTE_WRITECOPY": "syscall", - "syscall.PAGE_READONLY": "syscall", - "syscall.PAGE_READWRITE": "syscall", - "syscall.PAGE_WRITECOPY": "syscall", - "syscall.PARENB": "syscall", - "syscall.PARMRK": "syscall", - "syscall.PARODD": "syscall", - "syscall.PENDIN": "syscall", - "syscall.PFL_HIDDEN": "syscall", - "syscall.PFL_MATCHES_PROTOCOL_ZERO": "syscall", - "syscall.PFL_MULTIPLE_PROTO_ENTRIES": "syscall", - "syscall.PFL_NETWORKDIRECT_PROVIDER": "syscall", - "syscall.PFL_RECOMMENDED_PROTO_ENTRY": "syscall", - "syscall.PF_FLUSH": "syscall", - "syscall.PKCS_7_ASN_ENCODING": "syscall", - "syscall.PMC5_PIPELINE_FLUSH": "syscall", - "syscall.PRIO_PGRP": "syscall", - "syscall.PRIO_PROCESS": "syscall", - "syscall.PRIO_USER": "syscall", - "syscall.PRI_IOFLUSH": "syscall", - "syscall.PROCESS_QUERY_INFORMATION": "syscall", - "syscall.PROCESS_TERMINATE": "syscall", - "syscall.PROT_EXEC": "syscall", - "syscall.PROT_GROWSDOWN": "syscall", - "syscall.PROT_GROWSUP": "syscall", - "syscall.PROT_NONE": "syscall", - "syscall.PROT_READ": "syscall", - "syscall.PROT_WRITE": "syscall", - "syscall.PROV_DH_SCHANNEL": "syscall", - "syscall.PROV_DSS": "syscall", - "syscall.PROV_DSS_DH": "syscall", - "syscall.PROV_EC_ECDSA_FULL": "syscall", - "syscall.PROV_EC_ECDSA_SIG": "syscall", - "syscall.PROV_EC_ECNRA_FULL": "syscall", - "syscall.PROV_EC_ECNRA_SIG": "syscall", - "syscall.PROV_FORTEZZA": "syscall", - "syscall.PROV_INTEL_SEC": "syscall", - "syscall.PROV_MS_EXCHANGE": "syscall", - "syscall.PROV_REPLACE_OWF": "syscall", - "syscall.PROV_RNG": "syscall", - "syscall.PROV_RSA_AES": "syscall", - "syscall.PROV_RSA_FULL": "syscall", - "syscall.PROV_RSA_SCHANNEL": "syscall", - "syscall.PROV_RSA_SIG": "syscall", - "syscall.PROV_SPYRUS_LYNKS": "syscall", - "syscall.PROV_SSL": "syscall", - "syscall.PR_CAPBSET_DROP": "syscall", - "syscall.PR_CAPBSET_READ": "syscall", - "syscall.PR_CLEAR_SECCOMP_FILTER": "syscall", - "syscall.PR_ENDIAN_BIG": "syscall", - "syscall.PR_ENDIAN_LITTLE": "syscall", - "syscall.PR_ENDIAN_PPC_LITTLE": "syscall", - "syscall.PR_FPEMU_NOPRINT": "syscall", - "syscall.PR_FPEMU_SIGFPE": "syscall", - "syscall.PR_FP_EXC_ASYNC": "syscall", - "syscall.PR_FP_EXC_DISABLED": "syscall", - "syscall.PR_FP_EXC_DIV": "syscall", - "syscall.PR_FP_EXC_INV": "syscall", - "syscall.PR_FP_EXC_NONRECOV": "syscall", - "syscall.PR_FP_EXC_OVF": "syscall", - "syscall.PR_FP_EXC_PRECISE": "syscall", - "syscall.PR_FP_EXC_RES": "syscall", - "syscall.PR_FP_EXC_SW_ENABLE": "syscall", - "syscall.PR_FP_EXC_UND": "syscall", - "syscall.PR_GET_DUMPABLE": "syscall", - "syscall.PR_GET_ENDIAN": "syscall", - "syscall.PR_GET_FPEMU": "syscall", - "syscall.PR_GET_FPEXC": "syscall", - "syscall.PR_GET_KEEPCAPS": "syscall", - "syscall.PR_GET_NAME": "syscall", - "syscall.PR_GET_PDEATHSIG": "syscall", - "syscall.PR_GET_SECCOMP": "syscall", - "syscall.PR_GET_SECCOMP_FILTER": "syscall", - "syscall.PR_GET_SECUREBITS": "syscall", - "syscall.PR_GET_TIMERSLACK": "syscall", - "syscall.PR_GET_TIMING": "syscall", - "syscall.PR_GET_TSC": "syscall", - "syscall.PR_GET_UNALIGN": "syscall", - "syscall.PR_MCE_KILL": "syscall", - "syscall.PR_MCE_KILL_CLEAR": "syscall", - "syscall.PR_MCE_KILL_DEFAULT": "syscall", - "syscall.PR_MCE_KILL_EARLY": "syscall", - "syscall.PR_MCE_KILL_GET": "syscall", - "syscall.PR_MCE_KILL_LATE": "syscall", - "syscall.PR_MCE_KILL_SET": "syscall", - "syscall.PR_SECCOMP_FILTER_EVENT": "syscall", - "syscall.PR_SECCOMP_FILTER_SYSCALL": "syscall", - "syscall.PR_SET_DUMPABLE": "syscall", - "syscall.PR_SET_ENDIAN": "syscall", - "syscall.PR_SET_FPEMU": "syscall", - "syscall.PR_SET_FPEXC": "syscall", - "syscall.PR_SET_KEEPCAPS": "syscall", - "syscall.PR_SET_NAME": "syscall", - "syscall.PR_SET_PDEATHSIG": "syscall", - "syscall.PR_SET_PTRACER": "syscall", - "syscall.PR_SET_SECCOMP": "syscall", - "syscall.PR_SET_SECCOMP_FILTER": "syscall", - "syscall.PR_SET_SECUREBITS": "syscall", - "syscall.PR_SET_TIMERSLACK": "syscall", - "syscall.PR_SET_TIMING": "syscall", - "syscall.PR_SET_TSC": "syscall", - "syscall.PR_SET_UNALIGN": "syscall", - "syscall.PR_TASK_PERF_EVENTS_DISABLE": "syscall", - "syscall.PR_TASK_PERF_EVENTS_ENABLE": "syscall", - "syscall.PR_TIMING_STATISTICAL": "syscall", - "syscall.PR_TIMING_TIMESTAMP": "syscall", - "syscall.PR_TSC_ENABLE": "syscall", - "syscall.PR_TSC_SIGSEGV": "syscall", - "syscall.PR_UNALIGN_NOPRINT": "syscall", - "syscall.PR_UNALIGN_SIGBUS": "syscall", - "syscall.PTRACE_ARCH_PRCTL": "syscall", - "syscall.PTRACE_ATTACH": "syscall", - "syscall.PTRACE_CONT": "syscall", - "syscall.PTRACE_DETACH": "syscall", - "syscall.PTRACE_EVENT_CLONE": "syscall", - "syscall.PTRACE_EVENT_EXEC": "syscall", - "syscall.PTRACE_EVENT_EXIT": "syscall", - "syscall.PTRACE_EVENT_FORK": "syscall", - "syscall.PTRACE_EVENT_VFORK": "syscall", - "syscall.PTRACE_EVENT_VFORK_DONE": "syscall", - "syscall.PTRACE_GETCRUNCHREGS": "syscall", - "syscall.PTRACE_GETEVENTMSG": "syscall", - "syscall.PTRACE_GETFPREGS": "syscall", - "syscall.PTRACE_GETFPXREGS": "syscall", - "syscall.PTRACE_GETHBPREGS": "syscall", - "syscall.PTRACE_GETREGS": "syscall", - "syscall.PTRACE_GETREGSET": "syscall", - "syscall.PTRACE_GETSIGINFO": "syscall", - "syscall.PTRACE_GETVFPREGS": "syscall", - "syscall.PTRACE_GETWMMXREGS": "syscall", - "syscall.PTRACE_GET_THREAD_AREA": "syscall", - "syscall.PTRACE_KILL": "syscall", - "syscall.PTRACE_OLDSETOPTIONS": "syscall", - "syscall.PTRACE_O_MASK": "syscall", - "syscall.PTRACE_O_TRACECLONE": "syscall", - "syscall.PTRACE_O_TRACEEXEC": "syscall", - "syscall.PTRACE_O_TRACEEXIT": "syscall", - "syscall.PTRACE_O_TRACEFORK": "syscall", - "syscall.PTRACE_O_TRACESYSGOOD": "syscall", - "syscall.PTRACE_O_TRACEVFORK": "syscall", - "syscall.PTRACE_O_TRACEVFORKDONE": "syscall", - "syscall.PTRACE_PEEKDATA": "syscall", - "syscall.PTRACE_PEEKTEXT": "syscall", - "syscall.PTRACE_PEEKUSR": "syscall", - "syscall.PTRACE_POKEDATA": "syscall", - "syscall.PTRACE_POKETEXT": "syscall", - "syscall.PTRACE_POKEUSR": "syscall", - "syscall.PTRACE_SETCRUNCHREGS": "syscall", - "syscall.PTRACE_SETFPREGS": "syscall", - "syscall.PTRACE_SETFPXREGS": "syscall", - "syscall.PTRACE_SETHBPREGS": "syscall", - "syscall.PTRACE_SETOPTIONS": "syscall", - "syscall.PTRACE_SETREGS": "syscall", - "syscall.PTRACE_SETREGSET": "syscall", - "syscall.PTRACE_SETSIGINFO": "syscall", - "syscall.PTRACE_SETVFPREGS": "syscall", - "syscall.PTRACE_SETWMMXREGS": "syscall", - "syscall.PTRACE_SET_SYSCALL": "syscall", - "syscall.PTRACE_SET_THREAD_AREA": "syscall", - "syscall.PTRACE_SINGLEBLOCK": "syscall", - "syscall.PTRACE_SINGLESTEP": "syscall", - "syscall.PTRACE_SYSCALL": "syscall", - "syscall.PTRACE_SYSEMU": "syscall", - "syscall.PTRACE_SYSEMU_SINGLESTEP": "syscall", - "syscall.PTRACE_TRACEME": "syscall", - "syscall.PT_ATTACH": "syscall", - "syscall.PT_ATTACHEXC": "syscall", - "syscall.PT_CONTINUE": "syscall", - "syscall.PT_DATA_ADDR": "syscall", - "syscall.PT_DENY_ATTACH": "syscall", - "syscall.PT_DETACH": "syscall", - "syscall.PT_FIRSTMACH": "syscall", - "syscall.PT_FORCEQUOTA": "syscall", - "syscall.PT_KILL": "syscall", - "syscall.PT_MASK": "syscall", - "syscall.PT_READ_D": "syscall", - "syscall.PT_READ_I": "syscall", - "syscall.PT_READ_U": "syscall", - "syscall.PT_SIGEXC": "syscall", - "syscall.PT_STEP": "syscall", - "syscall.PT_TEXT_ADDR": "syscall", - "syscall.PT_TEXT_END_ADDR": "syscall", - "syscall.PT_THUPDATE": "syscall", - "syscall.PT_TRACE_ME": "syscall", - "syscall.PT_WRITE_D": "syscall", - "syscall.PT_WRITE_I": "syscall", - "syscall.PT_WRITE_U": "syscall", - "syscall.ParseDirent": "syscall", - "syscall.ParseNetlinkMessage": "syscall", - "syscall.ParseNetlinkRouteAttr": "syscall", - "syscall.ParseRoutingMessage": "syscall", - "syscall.ParseRoutingSockaddr": "syscall", - "syscall.ParseSocketControlMessage": "syscall", - "syscall.ParseUnixCredentials": "syscall", - "syscall.ParseUnixRights": "syscall", - "syscall.PathMax": "syscall", - "syscall.Pathconf": "syscall", - "syscall.Pause": "syscall", - "syscall.Pipe": "syscall", - "syscall.Pipe2": "syscall", - "syscall.PivotRoot": "syscall", - "syscall.PostQueuedCompletionStatus": "syscall", - "syscall.Pread": "syscall", - "syscall.Proc": "syscall", - "syscall.ProcAttr": "syscall", - "syscall.Process32First": "syscall", - "syscall.Process32Next": "syscall", - "syscall.ProcessEntry32": "syscall", - "syscall.ProcessInformation": "syscall", - "syscall.Protoent": "syscall", - "syscall.PtraceAttach": "syscall", - "syscall.PtraceCont": "syscall", - "syscall.PtraceDetach": "syscall", - "syscall.PtraceGetEventMsg": "syscall", - "syscall.PtraceGetRegs": "syscall", - "syscall.PtracePeekData": "syscall", - "syscall.PtracePeekText": "syscall", - "syscall.PtracePokeData": "syscall", - "syscall.PtracePokeText": "syscall", - "syscall.PtraceRegs": "syscall", - "syscall.PtraceSetOptions": "syscall", - "syscall.PtraceSetRegs": "syscall", - "syscall.PtraceSingleStep": "syscall", - "syscall.PtraceSyscall": "syscall", - "syscall.Pwrite": "syscall", - "syscall.REG_BINARY": "syscall", - "syscall.REG_DWORD": "syscall", - "syscall.REG_DWORD_BIG_ENDIAN": "syscall", - "syscall.REG_DWORD_LITTLE_ENDIAN": "syscall", - "syscall.REG_EXPAND_SZ": "syscall", - "syscall.REG_FULL_RESOURCE_DESCRIPTOR": "syscall", - "syscall.REG_LINK": "syscall", - "syscall.REG_MULTI_SZ": "syscall", - "syscall.REG_NONE": "syscall", - "syscall.REG_QWORD": "syscall", - "syscall.REG_QWORD_LITTLE_ENDIAN": "syscall", - "syscall.REG_RESOURCE_LIST": "syscall", - "syscall.REG_RESOURCE_REQUIREMENTS_LIST": "syscall", - "syscall.REG_SZ": "syscall", - "syscall.RLIMIT_AS": "syscall", - "syscall.RLIMIT_CORE": "syscall", - "syscall.RLIMIT_CPU": "syscall", - "syscall.RLIMIT_DATA": "syscall", - "syscall.RLIMIT_FSIZE": "syscall", - "syscall.RLIMIT_NOFILE": "syscall", - "syscall.RLIMIT_STACK": "syscall", - "syscall.RLIM_INFINITY": "syscall", - "syscall.RTAX_ADVMSS": "syscall", - "syscall.RTAX_AUTHOR": "syscall", - "syscall.RTAX_BRD": "syscall", - "syscall.RTAX_CWND": "syscall", - "syscall.RTAX_DST": "syscall", - "syscall.RTAX_FEATURES": "syscall", - "syscall.RTAX_FEATURE_ALLFRAG": "syscall", - "syscall.RTAX_FEATURE_ECN": "syscall", - "syscall.RTAX_FEATURE_SACK": "syscall", - "syscall.RTAX_FEATURE_TIMESTAMP": "syscall", - "syscall.RTAX_GATEWAY": "syscall", - "syscall.RTAX_GENMASK": "syscall", - "syscall.RTAX_HOPLIMIT": "syscall", - "syscall.RTAX_IFA": "syscall", - "syscall.RTAX_IFP": "syscall", - "syscall.RTAX_INITCWND": "syscall", - "syscall.RTAX_INITRWND": "syscall", - "syscall.RTAX_LABEL": "syscall", - "syscall.RTAX_LOCK": "syscall", - "syscall.RTAX_MAX": "syscall", - "syscall.RTAX_MTU": "syscall", - "syscall.RTAX_NETMASK": "syscall", - "syscall.RTAX_REORDERING": "syscall", - "syscall.RTAX_RTO_MIN": "syscall", - "syscall.RTAX_RTT": "syscall", - "syscall.RTAX_RTTVAR": "syscall", - "syscall.RTAX_SRC": "syscall", - "syscall.RTAX_SRCMASK": "syscall", - "syscall.RTAX_SSTHRESH": "syscall", - "syscall.RTAX_TAG": "syscall", - "syscall.RTAX_UNSPEC": "syscall", - "syscall.RTAX_WINDOW": "syscall", - "syscall.RTA_ALIGNTO": "syscall", - "syscall.RTA_AUTHOR": "syscall", - "syscall.RTA_BRD": "syscall", - "syscall.RTA_CACHEINFO": "syscall", - "syscall.RTA_DST": "syscall", - "syscall.RTA_FLOW": "syscall", - "syscall.RTA_GATEWAY": "syscall", - "syscall.RTA_GENMASK": "syscall", - "syscall.RTA_IFA": "syscall", - "syscall.RTA_IFP": "syscall", - "syscall.RTA_IIF": "syscall", - "syscall.RTA_LABEL": "syscall", - "syscall.RTA_MAX": "syscall", - "syscall.RTA_METRICS": "syscall", - "syscall.RTA_MULTIPATH": "syscall", - "syscall.RTA_NETMASK": "syscall", - "syscall.RTA_OIF": "syscall", - "syscall.RTA_PREFSRC": "syscall", - "syscall.RTA_PRIORITY": "syscall", - "syscall.RTA_SRC": "syscall", - "syscall.RTA_SRCMASK": "syscall", - "syscall.RTA_TABLE": "syscall", - "syscall.RTA_TAG": "syscall", - "syscall.RTA_UNSPEC": "syscall", - "syscall.RTCF_DIRECTSRC": "syscall", - "syscall.RTCF_DOREDIRECT": "syscall", - "syscall.RTCF_LOG": "syscall", - "syscall.RTCF_MASQ": "syscall", - "syscall.RTCF_NAT": "syscall", - "syscall.RTCF_VALVE": "syscall", - "syscall.RTF_ADDRCLASSMASK": "syscall", - "syscall.RTF_ADDRCONF": "syscall", - "syscall.RTF_ALLONLINK": "syscall", - "syscall.RTF_ANNOUNCE": "syscall", - "syscall.RTF_BLACKHOLE": "syscall", - "syscall.RTF_BROADCAST": "syscall", - "syscall.RTF_CACHE": "syscall", - "syscall.RTF_CLONED": "syscall", - "syscall.RTF_CLONING": "syscall", - "syscall.RTF_CONDEMNED": "syscall", - "syscall.RTF_DEFAULT": "syscall", - "syscall.RTF_DELCLONE": "syscall", - "syscall.RTF_DONE": "syscall", - "syscall.RTF_DYNAMIC": "syscall", - "syscall.RTF_FLOW": "syscall", - "syscall.RTF_FMASK": "syscall", - "syscall.RTF_GATEWAY": "syscall", - "syscall.RTF_GWFLAG_COMPAT": "syscall", - "syscall.RTF_HOST": "syscall", - "syscall.RTF_IFREF": "syscall", - "syscall.RTF_IFSCOPE": "syscall", - "syscall.RTF_INTERFACE": "syscall", - "syscall.RTF_IRTT": "syscall", - "syscall.RTF_LINKRT": "syscall", - "syscall.RTF_LLDATA": "syscall", - "syscall.RTF_LLINFO": "syscall", - "syscall.RTF_LOCAL": "syscall", - "syscall.RTF_MASK": "syscall", - "syscall.RTF_MODIFIED": "syscall", - "syscall.RTF_MPATH": "syscall", - "syscall.RTF_MPLS": "syscall", - "syscall.RTF_MSS": "syscall", - "syscall.RTF_MTU": "syscall", - "syscall.RTF_MULTICAST": "syscall", - "syscall.RTF_NAT": "syscall", - "syscall.RTF_NOFORWARD": "syscall", - "syscall.RTF_NONEXTHOP": "syscall", - "syscall.RTF_NOPMTUDISC": "syscall", - "syscall.RTF_PERMANENT_ARP": "syscall", - "syscall.RTF_PINNED": "syscall", - "syscall.RTF_POLICY": "syscall", - "syscall.RTF_PRCLONING": "syscall", - "syscall.RTF_PROTO1": "syscall", - "syscall.RTF_PROTO2": "syscall", - "syscall.RTF_PROTO3": "syscall", - "syscall.RTF_REINSTATE": "syscall", - "syscall.RTF_REJECT": "syscall", - "syscall.RTF_RNH_LOCKED": "syscall", - "syscall.RTF_SOURCE": "syscall", - "syscall.RTF_SRC": "syscall", - "syscall.RTF_STATIC": "syscall", - "syscall.RTF_STICKY": "syscall", - "syscall.RTF_THROW": "syscall", - "syscall.RTF_TUNNEL": "syscall", - "syscall.RTF_UP": "syscall", - "syscall.RTF_USETRAILERS": "syscall", - "syscall.RTF_WASCLONED": "syscall", - "syscall.RTF_WINDOW": "syscall", - "syscall.RTF_XRESOLVE": "syscall", - "syscall.RTM_ADD": "syscall", - "syscall.RTM_BASE": "syscall", - "syscall.RTM_CHANGE": "syscall", - "syscall.RTM_CHGADDR": "syscall", - "syscall.RTM_DELACTION": "syscall", - "syscall.RTM_DELADDR": "syscall", - "syscall.RTM_DELADDRLABEL": "syscall", - "syscall.RTM_DELETE": "syscall", - "syscall.RTM_DELLINK": "syscall", - "syscall.RTM_DELMADDR": "syscall", - "syscall.RTM_DELNEIGH": "syscall", - "syscall.RTM_DELQDISC": "syscall", - "syscall.RTM_DELROUTE": "syscall", - "syscall.RTM_DELRULE": "syscall", - "syscall.RTM_DELTCLASS": "syscall", - "syscall.RTM_DELTFILTER": "syscall", - "syscall.RTM_DESYNC": "syscall", - "syscall.RTM_F_CLONED": "syscall", - "syscall.RTM_F_EQUALIZE": "syscall", - "syscall.RTM_F_NOTIFY": "syscall", - "syscall.RTM_F_PREFIX": "syscall", - "syscall.RTM_GET": "syscall", - "syscall.RTM_GET2": "syscall", - "syscall.RTM_GETACTION": "syscall", - "syscall.RTM_GETADDR": "syscall", - "syscall.RTM_GETADDRLABEL": "syscall", - "syscall.RTM_GETANYCAST": "syscall", - "syscall.RTM_GETDCB": "syscall", - "syscall.RTM_GETLINK": "syscall", - "syscall.RTM_GETMULTICAST": "syscall", - "syscall.RTM_GETNEIGH": "syscall", - "syscall.RTM_GETNEIGHTBL": "syscall", - "syscall.RTM_GETQDISC": "syscall", - "syscall.RTM_GETROUTE": "syscall", - "syscall.RTM_GETRULE": "syscall", - "syscall.RTM_GETTCLASS": "syscall", - "syscall.RTM_GETTFILTER": "syscall", - "syscall.RTM_IEEE80211": "syscall", - "syscall.RTM_IFANNOUNCE": "syscall", - "syscall.RTM_IFINFO": "syscall", - "syscall.RTM_IFINFO2": "syscall", - "syscall.RTM_LLINFO_UPD": "syscall", - "syscall.RTM_LOCK": "syscall", - "syscall.RTM_LOSING": "syscall", - "syscall.RTM_MAX": "syscall", - "syscall.RTM_MAXSIZE": "syscall", - "syscall.RTM_MISS": "syscall", - "syscall.RTM_NEWACTION": "syscall", - "syscall.RTM_NEWADDR": "syscall", - "syscall.RTM_NEWADDRLABEL": "syscall", - "syscall.RTM_NEWLINK": "syscall", - "syscall.RTM_NEWMADDR": "syscall", - "syscall.RTM_NEWMADDR2": "syscall", - "syscall.RTM_NEWNDUSEROPT": "syscall", - "syscall.RTM_NEWNEIGH": "syscall", - "syscall.RTM_NEWNEIGHTBL": "syscall", - "syscall.RTM_NEWPREFIX": "syscall", - "syscall.RTM_NEWQDISC": "syscall", - "syscall.RTM_NEWROUTE": "syscall", - "syscall.RTM_NEWRULE": "syscall", - "syscall.RTM_NEWTCLASS": "syscall", - "syscall.RTM_NEWTFILTER": "syscall", - "syscall.RTM_NR_FAMILIES": "syscall", - "syscall.RTM_NR_MSGTYPES": "syscall", - "syscall.RTM_OIFINFO": "syscall", - "syscall.RTM_OLDADD": "syscall", - "syscall.RTM_OLDDEL": "syscall", - "syscall.RTM_OOIFINFO": "syscall", - "syscall.RTM_REDIRECT": "syscall", - "syscall.RTM_RESOLVE": "syscall", - "syscall.RTM_RTTUNIT": "syscall", - "syscall.RTM_SETDCB": "syscall", - "syscall.RTM_SETGATE": "syscall", - "syscall.RTM_SETLINK": "syscall", - "syscall.RTM_SETNEIGHTBL": "syscall", - "syscall.RTM_VERSION": "syscall", - "syscall.RTNH_ALIGNTO": "syscall", - "syscall.RTNH_F_DEAD": "syscall", - "syscall.RTNH_F_ONLINK": "syscall", - "syscall.RTNH_F_PERVASIVE": "syscall", - "syscall.RTNLGRP_IPV4_IFADDR": "syscall", - "syscall.RTNLGRP_IPV4_MROUTE": "syscall", - "syscall.RTNLGRP_IPV4_ROUTE": "syscall", - "syscall.RTNLGRP_IPV4_RULE": "syscall", - "syscall.RTNLGRP_IPV6_IFADDR": "syscall", - "syscall.RTNLGRP_IPV6_IFINFO": "syscall", - "syscall.RTNLGRP_IPV6_MROUTE": "syscall", - "syscall.RTNLGRP_IPV6_PREFIX": "syscall", - "syscall.RTNLGRP_IPV6_ROUTE": "syscall", - "syscall.RTNLGRP_IPV6_RULE": "syscall", - "syscall.RTNLGRP_LINK": "syscall", - "syscall.RTNLGRP_ND_USEROPT": "syscall", - "syscall.RTNLGRP_NEIGH": "syscall", - "syscall.RTNLGRP_NONE": "syscall", - "syscall.RTNLGRP_NOTIFY": "syscall", - "syscall.RTNLGRP_TC": "syscall", - "syscall.RTN_ANYCAST": "syscall", - "syscall.RTN_BLACKHOLE": "syscall", - "syscall.RTN_BROADCAST": "syscall", - "syscall.RTN_LOCAL": "syscall", - "syscall.RTN_MAX": "syscall", - "syscall.RTN_MULTICAST": "syscall", - "syscall.RTN_NAT": "syscall", - "syscall.RTN_PROHIBIT": "syscall", - "syscall.RTN_THROW": "syscall", - "syscall.RTN_UNICAST": "syscall", - "syscall.RTN_UNREACHABLE": "syscall", - "syscall.RTN_UNSPEC": "syscall", - "syscall.RTN_XRESOLVE": "syscall", - "syscall.RTPROT_BIRD": "syscall", - "syscall.RTPROT_BOOT": "syscall", - "syscall.RTPROT_DHCP": "syscall", - "syscall.RTPROT_DNROUTED": "syscall", - "syscall.RTPROT_GATED": "syscall", - "syscall.RTPROT_KERNEL": "syscall", - "syscall.RTPROT_MRT": "syscall", - "syscall.RTPROT_NTK": "syscall", - "syscall.RTPROT_RA": "syscall", - "syscall.RTPROT_REDIRECT": "syscall", - "syscall.RTPROT_STATIC": "syscall", - "syscall.RTPROT_UNSPEC": "syscall", - "syscall.RTPROT_XORP": "syscall", - "syscall.RTPROT_ZEBRA": "syscall", - "syscall.RTV_EXPIRE": "syscall", - "syscall.RTV_HOPCOUNT": "syscall", - "syscall.RTV_MTU": "syscall", - "syscall.RTV_RPIPE": "syscall", - "syscall.RTV_RTT": "syscall", - "syscall.RTV_RTTVAR": "syscall", - "syscall.RTV_SPIPE": "syscall", - "syscall.RTV_SSTHRESH": "syscall", - "syscall.RTV_WEIGHT": "syscall", - "syscall.RT_CACHING_CONTEXT": "syscall", - "syscall.RT_CLASS_DEFAULT": "syscall", - "syscall.RT_CLASS_LOCAL": "syscall", - "syscall.RT_CLASS_MAIN": "syscall", - "syscall.RT_CLASS_MAX": "syscall", - "syscall.RT_CLASS_UNSPEC": "syscall", - "syscall.RT_DEFAULT_FIB": "syscall", - "syscall.RT_NORTREF": "syscall", - "syscall.RT_SCOPE_HOST": "syscall", - "syscall.RT_SCOPE_LINK": "syscall", - "syscall.RT_SCOPE_NOWHERE": "syscall", - "syscall.RT_SCOPE_SITE": "syscall", - "syscall.RT_SCOPE_UNIVERSE": "syscall", - "syscall.RT_TABLEID_MAX": "syscall", - "syscall.RT_TABLE_COMPAT": "syscall", - "syscall.RT_TABLE_DEFAULT": "syscall", - "syscall.RT_TABLE_LOCAL": "syscall", - "syscall.RT_TABLE_MAIN": "syscall", - "syscall.RT_TABLE_MAX": "syscall", - "syscall.RT_TABLE_UNSPEC": "syscall", - "syscall.RUSAGE_CHILDREN": "syscall", - "syscall.RUSAGE_SELF": "syscall", - "syscall.RUSAGE_THREAD": "syscall", - "syscall.Radvisory_t": "syscall", - "syscall.RawSockaddr": "syscall", - "syscall.RawSockaddrAny": "syscall", - "syscall.RawSockaddrDatalink": "syscall", - "syscall.RawSockaddrInet4": "syscall", - "syscall.RawSockaddrInet6": "syscall", - "syscall.RawSockaddrLinklayer": "syscall", - "syscall.RawSockaddrNetlink": "syscall", - "syscall.RawSockaddrUnix": "syscall", - "syscall.RawSyscall": "syscall", - "syscall.RawSyscall6": "syscall", - "syscall.Read": "syscall", - "syscall.ReadConsole": "syscall", - "syscall.ReadDirectoryChanges": "syscall", - "syscall.ReadDirent": "syscall", - "syscall.ReadFile": "syscall", - "syscall.Readlink": "syscall", - "syscall.Reboot": "syscall", - "syscall.Recvfrom": "syscall", - "syscall.Recvmsg": "syscall", - "syscall.RegCloseKey": "syscall", - "syscall.RegEnumKeyEx": "syscall", - "syscall.RegOpenKeyEx": "syscall", - "syscall.RegQueryInfoKey": "syscall", - "syscall.RegQueryValueEx": "syscall", - "syscall.RemoveDirectory": "syscall", - "syscall.Removexattr": "syscall", - "syscall.Rename": "syscall", - "syscall.Renameat": "syscall", - "syscall.Revoke": "syscall", - "syscall.Rlimit": "syscall", - "syscall.Rmdir": "syscall", - "syscall.RouteMessage": "syscall", - "syscall.RouteRIB": "syscall", - "syscall.RtAttr": "syscall", - "syscall.RtGenmsg": "syscall", - "syscall.RtMetrics": "syscall", - "syscall.RtMsg": "syscall", - "syscall.RtMsghdr": "syscall", - "syscall.RtNexthop": "syscall", - "syscall.Rusage": "syscall", - "syscall.SCM_BINTIME": "syscall", - "syscall.SCM_CREDENTIALS": "syscall", - "syscall.SCM_CREDS": "syscall", - "syscall.SCM_RIGHTS": "syscall", - "syscall.SCM_TIMESTAMP": "syscall", - "syscall.SCM_TIMESTAMPING": "syscall", - "syscall.SCM_TIMESTAMPNS": "syscall", - "syscall.SCM_TIMESTAMP_MONOTONIC": "syscall", - "syscall.SHUT_RD": "syscall", - "syscall.SHUT_RDWR": "syscall", - "syscall.SHUT_WR": "syscall", - "syscall.SID": "syscall", - "syscall.SIDAndAttributes": "syscall", - "syscall.SIGABRT": "syscall", - "syscall.SIGALRM": "syscall", - "syscall.SIGBUS": "syscall", - "syscall.SIGCHLD": "syscall", - "syscall.SIGCLD": "syscall", - "syscall.SIGCONT": "syscall", - "syscall.SIGEMT": "syscall", - "syscall.SIGFPE": "syscall", - "syscall.SIGHUP": "syscall", - "syscall.SIGILL": "syscall", - "syscall.SIGINFO": "syscall", - "syscall.SIGINT": "syscall", - "syscall.SIGIO": "syscall", - "syscall.SIGIOT": "syscall", - "syscall.SIGKILL": "syscall", - "syscall.SIGLIBRT": "syscall", - "syscall.SIGLWP": "syscall", - "syscall.SIGPIPE": "syscall", - "syscall.SIGPOLL": "syscall", - "syscall.SIGPROF": "syscall", - "syscall.SIGPWR": "syscall", - "syscall.SIGQUIT": "syscall", - "syscall.SIGSEGV": "syscall", - "syscall.SIGSTKFLT": "syscall", - "syscall.SIGSTOP": "syscall", - "syscall.SIGSYS": "syscall", - "syscall.SIGTERM": "syscall", - "syscall.SIGTHR": "syscall", - "syscall.SIGTRAP": "syscall", - "syscall.SIGTSTP": "syscall", - "syscall.SIGTTIN": "syscall", - "syscall.SIGTTOU": "syscall", - "syscall.SIGUNUSED": "syscall", - "syscall.SIGURG": "syscall", - "syscall.SIGUSR1": "syscall", - "syscall.SIGUSR2": "syscall", - "syscall.SIGVTALRM": "syscall", - "syscall.SIGWINCH": "syscall", - "syscall.SIGXCPU": "syscall", - "syscall.SIGXFSZ": "syscall", - "syscall.SIOCADDDLCI": "syscall", - "syscall.SIOCADDMULTI": "syscall", - "syscall.SIOCADDRT": "syscall", - "syscall.SIOCAIFADDR": "syscall", - "syscall.SIOCAIFGROUP": "syscall", - "syscall.SIOCALIFADDR": "syscall", - "syscall.SIOCARPIPLL": "syscall", - "syscall.SIOCATMARK": "syscall", - "syscall.SIOCAUTOADDR": "syscall", - "syscall.SIOCAUTONETMASK": "syscall", - "syscall.SIOCBRDGADD": "syscall", - "syscall.SIOCBRDGADDS": "syscall", - "syscall.SIOCBRDGARL": "syscall", - "syscall.SIOCBRDGDADDR": "syscall", - "syscall.SIOCBRDGDEL": "syscall", - "syscall.SIOCBRDGDELS": "syscall", - "syscall.SIOCBRDGFLUSH": "syscall", - "syscall.SIOCBRDGFRL": "syscall", - "syscall.SIOCBRDGGCACHE": "syscall", - "syscall.SIOCBRDGGFD": "syscall", - "syscall.SIOCBRDGGHT": "syscall", - "syscall.SIOCBRDGGIFFLGS": "syscall", - "syscall.SIOCBRDGGMA": "syscall", - "syscall.SIOCBRDGGPARAM": "syscall", - "syscall.SIOCBRDGGPRI": "syscall", - "syscall.SIOCBRDGGRL": "syscall", - "syscall.SIOCBRDGGSIFS": "syscall", - "syscall.SIOCBRDGGTO": "syscall", - "syscall.SIOCBRDGIFS": "syscall", - "syscall.SIOCBRDGRTS": "syscall", - "syscall.SIOCBRDGSADDR": "syscall", - "syscall.SIOCBRDGSCACHE": "syscall", - "syscall.SIOCBRDGSFD": "syscall", - "syscall.SIOCBRDGSHT": "syscall", - "syscall.SIOCBRDGSIFCOST": "syscall", - "syscall.SIOCBRDGSIFFLGS": "syscall", - "syscall.SIOCBRDGSIFPRIO": "syscall", - "syscall.SIOCBRDGSMA": "syscall", - "syscall.SIOCBRDGSPRI": "syscall", - "syscall.SIOCBRDGSPROTO": "syscall", - "syscall.SIOCBRDGSTO": "syscall", - "syscall.SIOCBRDGSTXHC": "syscall", - "syscall.SIOCDARP": "syscall", - "syscall.SIOCDELDLCI": "syscall", - "syscall.SIOCDELMULTI": "syscall", - "syscall.SIOCDELRT": "syscall", - "syscall.SIOCDEVPRIVATE": "syscall", - "syscall.SIOCDIFADDR": "syscall", - "syscall.SIOCDIFGROUP": "syscall", - "syscall.SIOCDIFPHYADDR": "syscall", - "syscall.SIOCDLIFADDR": "syscall", - "syscall.SIOCDRARP": "syscall", - "syscall.SIOCGARP": "syscall", - "syscall.SIOCGDRVSPEC": "syscall", - "syscall.SIOCGETKALIVE": "syscall", - "syscall.SIOCGETLABEL": "syscall", - "syscall.SIOCGETPFLOW": "syscall", - "syscall.SIOCGETPFSYNC": "syscall", - "syscall.SIOCGETSGCNT": "syscall", - "syscall.SIOCGETVIFCNT": "syscall", - "syscall.SIOCGETVLAN": "syscall", - "syscall.SIOCGHIWAT": "syscall", - "syscall.SIOCGIFADDR": "syscall", - "syscall.SIOCGIFADDRPREF": "syscall", - "syscall.SIOCGIFALIAS": "syscall", - "syscall.SIOCGIFALTMTU": "syscall", - "syscall.SIOCGIFASYNCMAP": "syscall", - "syscall.SIOCGIFBOND": "syscall", - "syscall.SIOCGIFBR": "syscall", - "syscall.SIOCGIFBRDADDR": "syscall", - "syscall.SIOCGIFCAP": "syscall", - "syscall.SIOCGIFCONF": "syscall", - "syscall.SIOCGIFCOUNT": "syscall", - "syscall.SIOCGIFDATA": "syscall", - "syscall.SIOCGIFDESCR": "syscall", - "syscall.SIOCGIFDEVMTU": "syscall", - "syscall.SIOCGIFDLT": "syscall", - "syscall.SIOCGIFDSTADDR": "syscall", - "syscall.SIOCGIFENCAP": "syscall", - "syscall.SIOCGIFFIB": "syscall", - "syscall.SIOCGIFFLAGS": "syscall", - "syscall.SIOCGIFGATTR": "syscall", - "syscall.SIOCGIFGENERIC": "syscall", - "syscall.SIOCGIFGMEMB": "syscall", - "syscall.SIOCGIFGROUP": "syscall", - "syscall.SIOCGIFHARDMTU": "syscall", - "syscall.SIOCGIFHWADDR": "syscall", - "syscall.SIOCGIFINDEX": "syscall", - "syscall.SIOCGIFKPI": "syscall", - "syscall.SIOCGIFMAC": "syscall", - "syscall.SIOCGIFMAP": "syscall", - "syscall.SIOCGIFMEDIA": "syscall", - "syscall.SIOCGIFMEM": "syscall", - "syscall.SIOCGIFMETRIC": "syscall", - "syscall.SIOCGIFMTU": "syscall", - "syscall.SIOCGIFNAME": "syscall", - "syscall.SIOCGIFNETMASK": "syscall", - "syscall.SIOCGIFPDSTADDR": "syscall", - "syscall.SIOCGIFPFLAGS": "syscall", - "syscall.SIOCGIFPHYS": "syscall", - "syscall.SIOCGIFPRIORITY": "syscall", - "syscall.SIOCGIFPSRCADDR": "syscall", - "syscall.SIOCGIFRDOMAIN": "syscall", - "syscall.SIOCGIFRTLABEL": "syscall", - "syscall.SIOCGIFSLAVE": "syscall", - "syscall.SIOCGIFSTATUS": "syscall", - "syscall.SIOCGIFTIMESLOT": "syscall", - "syscall.SIOCGIFTXQLEN": "syscall", - "syscall.SIOCGIFVLAN": "syscall", - "syscall.SIOCGIFWAKEFLAGS": "syscall", - "syscall.SIOCGIFXFLAGS": "syscall", - "syscall.SIOCGLIFADDR": "syscall", - "syscall.SIOCGLIFPHYADDR": "syscall", - "syscall.SIOCGLIFPHYRTABLE": "syscall", - "syscall.SIOCGLIFPHYTTL": "syscall", - "syscall.SIOCGLINKSTR": "syscall", - "syscall.SIOCGLOWAT": "syscall", - "syscall.SIOCGPGRP": "syscall", - "syscall.SIOCGPRIVATE_0": "syscall", - "syscall.SIOCGPRIVATE_1": "syscall", - "syscall.SIOCGRARP": "syscall", - "syscall.SIOCGSPPPPARAMS": "syscall", - "syscall.SIOCGSTAMP": "syscall", - "syscall.SIOCGSTAMPNS": "syscall", - "syscall.SIOCGVH": "syscall", - "syscall.SIOCGVNETID": "syscall", - "syscall.SIOCIFCREATE": "syscall", - "syscall.SIOCIFCREATE2": "syscall", - "syscall.SIOCIFDESTROY": "syscall", - "syscall.SIOCIFGCLONERS": "syscall", - "syscall.SIOCINITIFADDR": "syscall", - "syscall.SIOCPROTOPRIVATE": "syscall", - "syscall.SIOCRSLVMULTI": "syscall", - "syscall.SIOCRTMSG": "syscall", - "syscall.SIOCSARP": "syscall", - "syscall.SIOCSDRVSPEC": "syscall", - "syscall.SIOCSETKALIVE": "syscall", - "syscall.SIOCSETLABEL": "syscall", - "syscall.SIOCSETPFLOW": "syscall", - "syscall.SIOCSETPFSYNC": "syscall", - "syscall.SIOCSETVLAN": "syscall", - "syscall.SIOCSHIWAT": "syscall", - "syscall.SIOCSIFADDR": "syscall", - "syscall.SIOCSIFADDRPREF": "syscall", - "syscall.SIOCSIFALTMTU": "syscall", - "syscall.SIOCSIFASYNCMAP": "syscall", - "syscall.SIOCSIFBOND": "syscall", - "syscall.SIOCSIFBR": "syscall", - "syscall.SIOCSIFBRDADDR": "syscall", - "syscall.SIOCSIFCAP": "syscall", - "syscall.SIOCSIFDESCR": "syscall", - "syscall.SIOCSIFDSTADDR": "syscall", - "syscall.SIOCSIFENCAP": "syscall", - "syscall.SIOCSIFFIB": "syscall", - "syscall.SIOCSIFFLAGS": "syscall", - "syscall.SIOCSIFGATTR": "syscall", - "syscall.SIOCSIFGENERIC": "syscall", - "syscall.SIOCSIFHWADDR": "syscall", - "syscall.SIOCSIFHWBROADCAST": "syscall", - "syscall.SIOCSIFKPI": "syscall", - "syscall.SIOCSIFLINK": "syscall", - "syscall.SIOCSIFLLADDR": "syscall", - "syscall.SIOCSIFMAC": "syscall", - "syscall.SIOCSIFMAP": "syscall", - "syscall.SIOCSIFMEDIA": "syscall", - "syscall.SIOCSIFMEM": "syscall", - "syscall.SIOCSIFMETRIC": "syscall", - "syscall.SIOCSIFMTU": "syscall", - "syscall.SIOCSIFNAME": "syscall", - "syscall.SIOCSIFNETMASK": "syscall", - "syscall.SIOCSIFPFLAGS": "syscall", - "syscall.SIOCSIFPHYADDR": "syscall", - "syscall.SIOCSIFPHYS": "syscall", - "syscall.SIOCSIFPRIORITY": "syscall", - "syscall.SIOCSIFRDOMAIN": "syscall", - "syscall.SIOCSIFRTLABEL": "syscall", - "syscall.SIOCSIFRVNET": "syscall", - "syscall.SIOCSIFSLAVE": "syscall", - "syscall.SIOCSIFTIMESLOT": "syscall", - "syscall.SIOCSIFTXQLEN": "syscall", - "syscall.SIOCSIFVLAN": "syscall", - "syscall.SIOCSIFVNET": "syscall", - "syscall.SIOCSIFXFLAGS": "syscall", - "syscall.SIOCSLIFPHYADDR": "syscall", - "syscall.SIOCSLIFPHYRTABLE": "syscall", - "syscall.SIOCSLIFPHYTTL": "syscall", - "syscall.SIOCSLINKSTR": "syscall", - "syscall.SIOCSLOWAT": "syscall", - "syscall.SIOCSPGRP": "syscall", - "syscall.SIOCSRARP": "syscall", - "syscall.SIOCSSPPPPARAMS": "syscall", - "syscall.SIOCSVH": "syscall", - "syscall.SIOCSVNETID": "syscall", - "syscall.SIOCZIFDATA": "syscall", - "syscall.SIO_GET_EXTENSION_FUNCTION_POINTER": "syscall", - "syscall.SIO_GET_INTERFACE_LIST": "syscall", - "syscall.SIO_KEEPALIVE_VALS": "syscall", - "syscall.SIO_UDP_CONNRESET": "syscall", - "syscall.SOCK_CLOEXEC": "syscall", - "syscall.SOCK_DCCP": "syscall", - "syscall.SOCK_DGRAM": "syscall", - "syscall.SOCK_FLAGS_MASK": "syscall", - "syscall.SOCK_MAXADDRLEN": "syscall", - "syscall.SOCK_NONBLOCK": "syscall", - "syscall.SOCK_NOSIGPIPE": "syscall", - "syscall.SOCK_PACKET": "syscall", - "syscall.SOCK_RAW": "syscall", - "syscall.SOCK_RDM": "syscall", - "syscall.SOCK_SEQPACKET": "syscall", - "syscall.SOCK_STREAM": "syscall", - "syscall.SOL_AAL": "syscall", - "syscall.SOL_ATM": "syscall", - "syscall.SOL_DECNET": "syscall", - "syscall.SOL_ICMPV6": "syscall", - "syscall.SOL_IP": "syscall", - "syscall.SOL_IPV6": "syscall", - "syscall.SOL_IRDA": "syscall", - "syscall.SOL_PACKET": "syscall", - "syscall.SOL_RAW": "syscall", - "syscall.SOL_SOCKET": "syscall", - "syscall.SOL_TCP": "syscall", - "syscall.SOL_X25": "syscall", - "syscall.SOMAXCONN": "syscall", - "syscall.SO_ACCEPTCONN": "syscall", - "syscall.SO_ACCEPTFILTER": "syscall", - "syscall.SO_ATTACH_FILTER": "syscall", - "syscall.SO_BINDANY": "syscall", - "syscall.SO_BINDTODEVICE": "syscall", - "syscall.SO_BINTIME": "syscall", - "syscall.SO_BROADCAST": "syscall", - "syscall.SO_BSDCOMPAT": "syscall", - "syscall.SO_DEBUG": "syscall", - "syscall.SO_DETACH_FILTER": "syscall", - "syscall.SO_DOMAIN": "syscall", - "syscall.SO_DONTROUTE": "syscall", - "syscall.SO_DONTTRUNC": "syscall", - "syscall.SO_ERROR": "syscall", - "syscall.SO_KEEPALIVE": "syscall", - "syscall.SO_LABEL": "syscall", - "syscall.SO_LINGER": "syscall", - "syscall.SO_LINGER_SEC": "syscall", - "syscall.SO_LISTENINCQLEN": "syscall", - "syscall.SO_LISTENQLEN": "syscall", - "syscall.SO_LISTENQLIMIT": "syscall", - "syscall.SO_MARK": "syscall", - "syscall.SO_NETPROC": "syscall", - "syscall.SO_NKE": "syscall", - "syscall.SO_NOADDRERR": "syscall", - "syscall.SO_NOHEADER": "syscall", - "syscall.SO_NOSIGPIPE": "syscall", - "syscall.SO_NOTIFYCONFLICT": "syscall", - "syscall.SO_NO_CHECK": "syscall", - "syscall.SO_NO_DDP": "syscall", - "syscall.SO_NO_OFFLOAD": "syscall", - "syscall.SO_NP_EXTENSIONS": "syscall", - "syscall.SO_NREAD": "syscall", - "syscall.SO_NWRITE": "syscall", - "syscall.SO_OOBINLINE": "syscall", - "syscall.SO_OVERFLOWED": "syscall", - "syscall.SO_PASSCRED": "syscall", - "syscall.SO_PASSSEC": "syscall", - "syscall.SO_PEERCRED": "syscall", - "syscall.SO_PEERLABEL": "syscall", - "syscall.SO_PEERNAME": "syscall", - "syscall.SO_PEERSEC": "syscall", - "syscall.SO_PRIORITY": "syscall", - "syscall.SO_PROTOCOL": "syscall", - "syscall.SO_PROTOTYPE": "syscall", - "syscall.SO_RANDOMPORT": "syscall", - "syscall.SO_RCVBUF": "syscall", - "syscall.SO_RCVBUFFORCE": "syscall", - "syscall.SO_RCVLOWAT": "syscall", - "syscall.SO_RCVTIMEO": "syscall", - "syscall.SO_RESTRICTIONS": "syscall", - "syscall.SO_RESTRICT_DENYIN": "syscall", - "syscall.SO_RESTRICT_DENYOUT": "syscall", - "syscall.SO_RESTRICT_DENYSET": "syscall", - "syscall.SO_REUSEADDR": "syscall", - "syscall.SO_REUSEPORT": "syscall", - "syscall.SO_REUSESHAREUID": "syscall", - "syscall.SO_RTABLE": "syscall", - "syscall.SO_RXQ_OVFL": "syscall", - "syscall.SO_SECURITY_AUTHENTICATION": "syscall", - "syscall.SO_SECURITY_ENCRYPTION_NETWORK": "syscall", - "syscall.SO_SECURITY_ENCRYPTION_TRANSPORT": "syscall", - "syscall.SO_SETFIB": "syscall", - "syscall.SO_SNDBUF": "syscall", - "syscall.SO_SNDBUFFORCE": "syscall", - "syscall.SO_SNDLOWAT": "syscall", - "syscall.SO_SNDTIMEO": "syscall", - "syscall.SO_SPLICE": "syscall", - "syscall.SO_TIMESTAMP": "syscall", - "syscall.SO_TIMESTAMPING": "syscall", - "syscall.SO_TIMESTAMPNS": "syscall", - "syscall.SO_TIMESTAMP_MONOTONIC": "syscall", - "syscall.SO_TYPE": "syscall", - "syscall.SO_UPCALLCLOSEWAIT": "syscall", - "syscall.SO_UPDATE_ACCEPT_CONTEXT": "syscall", - "syscall.SO_UPDATE_CONNECT_CONTEXT": "syscall", - "syscall.SO_USELOOPBACK": "syscall", - "syscall.SO_USER_COOKIE": "syscall", - "syscall.SO_VENDOR": "syscall", - "syscall.SO_WANTMORE": "syscall", - "syscall.SO_WANTOOBFLAG": "syscall", - "syscall.SSLExtraCertChainPolicyPara": "syscall", - "syscall.STANDARD_RIGHTS_ALL": "syscall", - "syscall.STANDARD_RIGHTS_EXECUTE": "syscall", - "syscall.STANDARD_RIGHTS_READ": "syscall", - "syscall.STANDARD_RIGHTS_REQUIRED": "syscall", - "syscall.STANDARD_RIGHTS_WRITE": "syscall", - "syscall.STARTF_USESHOWWINDOW": "syscall", - "syscall.STARTF_USESTDHANDLES": "syscall", - "syscall.STD_ERROR_HANDLE": "syscall", - "syscall.STD_INPUT_HANDLE": "syscall", - "syscall.STD_OUTPUT_HANDLE": "syscall", - "syscall.SUBLANG_ENGLISH_US": "syscall", - "syscall.SW_FORCEMINIMIZE": "syscall", - "syscall.SW_HIDE": "syscall", - "syscall.SW_MAXIMIZE": "syscall", - "syscall.SW_MINIMIZE": "syscall", - "syscall.SW_NORMAL": "syscall", - "syscall.SW_RESTORE": "syscall", - "syscall.SW_SHOW": "syscall", - "syscall.SW_SHOWDEFAULT": "syscall", - "syscall.SW_SHOWMAXIMIZED": "syscall", - "syscall.SW_SHOWMINIMIZED": "syscall", - "syscall.SW_SHOWMINNOACTIVE": "syscall", - "syscall.SW_SHOWNA": "syscall", - "syscall.SW_SHOWNOACTIVATE": "syscall", - "syscall.SW_SHOWNORMAL": "syscall", - "syscall.SYMBOLIC_LINK_FLAG_DIRECTORY": "syscall", - "syscall.SYNCHRONIZE": "syscall", - "syscall.SYSCTL_VERSION": "syscall", - "syscall.SYSCTL_VERS_0": "syscall", - "syscall.SYSCTL_VERS_1": "syscall", - "syscall.SYSCTL_VERS_MASK": "syscall", - "syscall.SYS_ABORT2": "syscall", - "syscall.SYS_ACCEPT": "syscall", - "syscall.SYS_ACCEPT4": "syscall", - "syscall.SYS_ACCEPT_NOCANCEL": "syscall", - "syscall.SYS_ACCESS": "syscall", - "syscall.SYS_ACCESS_EXTENDED": "syscall", - "syscall.SYS_ACCT": "syscall", - "syscall.SYS_ADD_KEY": "syscall", - "syscall.SYS_ADD_PROFIL": "syscall", - "syscall.SYS_ADJFREQ": "syscall", - "syscall.SYS_ADJTIME": "syscall", - "syscall.SYS_ADJTIMEX": "syscall", - "syscall.SYS_AFS_SYSCALL": "syscall", - "syscall.SYS_AIO_CANCEL": "syscall", - "syscall.SYS_AIO_ERROR": "syscall", - "syscall.SYS_AIO_FSYNC": "syscall", - "syscall.SYS_AIO_READ": "syscall", - "syscall.SYS_AIO_RETURN": "syscall", - "syscall.SYS_AIO_SUSPEND": "syscall", - "syscall.SYS_AIO_SUSPEND_NOCANCEL": "syscall", - "syscall.SYS_AIO_WRITE": "syscall", - "syscall.SYS_ALARM": "syscall", - "syscall.SYS_ARCH_PRCTL": "syscall", - "syscall.SYS_ARM_FADVISE64_64": "syscall", - "syscall.SYS_ARM_SYNC_FILE_RANGE": "syscall", - "syscall.SYS_ATGETMSG": "syscall", - "syscall.SYS_ATPGETREQ": "syscall", - "syscall.SYS_ATPGETRSP": "syscall", - "syscall.SYS_ATPSNDREQ": "syscall", - "syscall.SYS_ATPSNDRSP": "syscall", - "syscall.SYS_ATPUTMSG": "syscall", - "syscall.SYS_ATSOCKET": "syscall", - "syscall.SYS_AUDIT": "syscall", - "syscall.SYS_AUDITCTL": "syscall", - "syscall.SYS_AUDITON": "syscall", - "syscall.SYS_AUDIT_SESSION_JOIN": "syscall", - "syscall.SYS_AUDIT_SESSION_PORT": "syscall", - "syscall.SYS_AUDIT_SESSION_SELF": "syscall", - "syscall.SYS_BDFLUSH": "syscall", - "syscall.SYS_BIND": "syscall", - "syscall.SYS_BINDAT": "syscall", - "syscall.SYS_BREAK": "syscall", - "syscall.SYS_BRK": "syscall", - "syscall.SYS_BSDTHREAD_CREATE": "syscall", - "syscall.SYS_BSDTHREAD_REGISTER": "syscall", - "syscall.SYS_BSDTHREAD_TERMINATE": "syscall", - "syscall.SYS_CAPGET": "syscall", - "syscall.SYS_CAPSET": "syscall", - "syscall.SYS_CAP_ENTER": "syscall", - "syscall.SYS_CAP_FCNTLS_GET": "syscall", - "syscall.SYS_CAP_FCNTLS_LIMIT": "syscall", - "syscall.SYS_CAP_GETMODE": "syscall", - "syscall.SYS_CAP_GETRIGHTS": "syscall", - "syscall.SYS_CAP_IOCTLS_GET": "syscall", - "syscall.SYS_CAP_IOCTLS_LIMIT": "syscall", - "syscall.SYS_CAP_NEW": "syscall", - "syscall.SYS_CAP_RIGHTS_GET": "syscall", - "syscall.SYS_CAP_RIGHTS_LIMIT": "syscall", - "syscall.SYS_CHDIR": "syscall", - "syscall.SYS_CHFLAGS": "syscall", - "syscall.SYS_CHFLAGSAT": "syscall", - "syscall.SYS_CHMOD": "syscall", - "syscall.SYS_CHMOD_EXTENDED": "syscall", - "syscall.SYS_CHOWN": "syscall", - "syscall.SYS_CHOWN32": "syscall", - "syscall.SYS_CHROOT": "syscall", - "syscall.SYS_CHUD": "syscall", - "syscall.SYS_CLOCK_ADJTIME": "syscall", - "syscall.SYS_CLOCK_GETCPUCLOCKID2": "syscall", - "syscall.SYS_CLOCK_GETRES": "syscall", - "syscall.SYS_CLOCK_GETTIME": "syscall", - "syscall.SYS_CLOCK_NANOSLEEP": "syscall", - "syscall.SYS_CLOCK_SETTIME": "syscall", - "syscall.SYS_CLONE": "syscall", - "syscall.SYS_CLOSE": "syscall", - "syscall.SYS_CLOSEFROM": "syscall", - "syscall.SYS_CLOSE_NOCANCEL": "syscall", - "syscall.SYS_CONNECT": "syscall", - "syscall.SYS_CONNECTAT": "syscall", - "syscall.SYS_CONNECT_NOCANCEL": "syscall", - "syscall.SYS_COPYFILE": "syscall", - "syscall.SYS_CPUSET": "syscall", - "syscall.SYS_CPUSET_GETAFFINITY": "syscall", - "syscall.SYS_CPUSET_GETID": "syscall", - "syscall.SYS_CPUSET_SETAFFINITY": "syscall", - "syscall.SYS_CPUSET_SETID": "syscall", - "syscall.SYS_CREAT": "syscall", - "syscall.SYS_CREATE_MODULE": "syscall", - "syscall.SYS_CSOPS": "syscall", - "syscall.SYS_DELETE": "syscall", - "syscall.SYS_DELETE_MODULE": "syscall", - "syscall.SYS_DUP": "syscall", - "syscall.SYS_DUP2": "syscall", - "syscall.SYS_DUP3": "syscall", - "syscall.SYS_EACCESS": "syscall", - "syscall.SYS_EPOLL_CREATE": "syscall", - "syscall.SYS_EPOLL_CREATE1": "syscall", - "syscall.SYS_EPOLL_CTL": "syscall", - "syscall.SYS_EPOLL_CTL_OLD": "syscall", - "syscall.SYS_EPOLL_PWAIT": "syscall", - "syscall.SYS_EPOLL_WAIT": "syscall", - "syscall.SYS_EPOLL_WAIT_OLD": "syscall", - "syscall.SYS_EVENTFD": "syscall", - "syscall.SYS_EVENTFD2": "syscall", - "syscall.SYS_EXCHANGEDATA": "syscall", - "syscall.SYS_EXECVE": "syscall", - "syscall.SYS_EXIT": "syscall", - "syscall.SYS_EXIT_GROUP": "syscall", - "syscall.SYS_EXTATTRCTL": "syscall", - "syscall.SYS_EXTATTR_DELETE_FD": "syscall", - "syscall.SYS_EXTATTR_DELETE_FILE": "syscall", - "syscall.SYS_EXTATTR_DELETE_LINK": "syscall", - "syscall.SYS_EXTATTR_GET_FD": "syscall", - "syscall.SYS_EXTATTR_GET_FILE": "syscall", - "syscall.SYS_EXTATTR_GET_LINK": "syscall", - "syscall.SYS_EXTATTR_LIST_FD": "syscall", - "syscall.SYS_EXTATTR_LIST_FILE": "syscall", - "syscall.SYS_EXTATTR_LIST_LINK": "syscall", - "syscall.SYS_EXTATTR_SET_FD": "syscall", - "syscall.SYS_EXTATTR_SET_FILE": "syscall", - "syscall.SYS_EXTATTR_SET_LINK": "syscall", - "syscall.SYS_FACCESSAT": "syscall", - "syscall.SYS_FADVISE64": "syscall", - "syscall.SYS_FADVISE64_64": "syscall", - "syscall.SYS_FALLOCATE": "syscall", - "syscall.SYS_FANOTIFY_INIT": "syscall", - "syscall.SYS_FANOTIFY_MARK": "syscall", - "syscall.SYS_FCHDIR": "syscall", - "syscall.SYS_FCHFLAGS": "syscall", - "syscall.SYS_FCHMOD": "syscall", - "syscall.SYS_FCHMODAT": "syscall", - "syscall.SYS_FCHMOD_EXTENDED": "syscall", - "syscall.SYS_FCHOWN": "syscall", - "syscall.SYS_FCHOWN32": "syscall", - "syscall.SYS_FCHOWNAT": "syscall", - "syscall.SYS_FCHROOT": "syscall", - "syscall.SYS_FCNTL": "syscall", - "syscall.SYS_FCNTL64": "syscall", - "syscall.SYS_FCNTL_NOCANCEL": "syscall", - "syscall.SYS_FDATASYNC": "syscall", - "syscall.SYS_FEXECVE": "syscall", - "syscall.SYS_FFCLOCK_GETCOUNTER": "syscall", - "syscall.SYS_FFCLOCK_GETESTIMATE": "syscall", - "syscall.SYS_FFCLOCK_SETESTIMATE": "syscall", - "syscall.SYS_FFSCTL": "syscall", - "syscall.SYS_FGETATTRLIST": "syscall", - "syscall.SYS_FGETXATTR": "syscall", - "syscall.SYS_FHOPEN": "syscall", - "syscall.SYS_FHSTAT": "syscall", - "syscall.SYS_FHSTATFS": "syscall", - "syscall.SYS_FILEPORT_MAKEFD": "syscall", - "syscall.SYS_FILEPORT_MAKEPORT": "syscall", - "syscall.SYS_FKTRACE": "syscall", - "syscall.SYS_FLISTXATTR": "syscall", - "syscall.SYS_FLOCK": "syscall", - "syscall.SYS_FORK": "syscall", - "syscall.SYS_FPATHCONF": "syscall", - "syscall.SYS_FREEBSD6_FTRUNCATE": "syscall", - "syscall.SYS_FREEBSD6_LSEEK": "syscall", - "syscall.SYS_FREEBSD6_MMAP": "syscall", - "syscall.SYS_FREEBSD6_PREAD": "syscall", - "syscall.SYS_FREEBSD6_PWRITE": "syscall", - "syscall.SYS_FREEBSD6_TRUNCATE": "syscall", - "syscall.SYS_FREMOVEXATTR": "syscall", - "syscall.SYS_FSCTL": "syscall", - "syscall.SYS_FSETATTRLIST": "syscall", - "syscall.SYS_FSETXATTR": "syscall", - "syscall.SYS_FSGETPATH": "syscall", - "syscall.SYS_FSTAT": "syscall", - "syscall.SYS_FSTAT64": "syscall", - "syscall.SYS_FSTAT64_EXTENDED": "syscall", - "syscall.SYS_FSTATAT": "syscall", - "syscall.SYS_FSTATAT64": "syscall", - "syscall.SYS_FSTATFS": "syscall", - "syscall.SYS_FSTATFS64": "syscall", - "syscall.SYS_FSTATV": "syscall", - "syscall.SYS_FSTATVFS1": "syscall", - "syscall.SYS_FSTAT_EXTENDED": "syscall", - "syscall.SYS_FSYNC": "syscall", - "syscall.SYS_FSYNC_NOCANCEL": "syscall", - "syscall.SYS_FSYNC_RANGE": "syscall", - "syscall.SYS_FTIME": "syscall", - "syscall.SYS_FTRUNCATE": "syscall", - "syscall.SYS_FTRUNCATE64": "syscall", - "syscall.SYS_FUTEX": "syscall", - "syscall.SYS_FUTIMENS": "syscall", - "syscall.SYS_FUTIMES": "syscall", - "syscall.SYS_FUTIMESAT": "syscall", - "syscall.SYS_GETATTRLIST": "syscall", - "syscall.SYS_GETAUDIT": "syscall", - "syscall.SYS_GETAUDIT_ADDR": "syscall", - "syscall.SYS_GETAUID": "syscall", - "syscall.SYS_GETCONTEXT": "syscall", - "syscall.SYS_GETCPU": "syscall", - "syscall.SYS_GETCWD": "syscall", - "syscall.SYS_GETDENTS": "syscall", - "syscall.SYS_GETDENTS64": "syscall", - "syscall.SYS_GETDIRENTRIES": "syscall", - "syscall.SYS_GETDIRENTRIES64": "syscall", - "syscall.SYS_GETDIRENTRIESATTR": "syscall", - "syscall.SYS_GETDTABLECOUNT": "syscall", - "syscall.SYS_GETDTABLESIZE": "syscall", - "syscall.SYS_GETEGID": "syscall", - "syscall.SYS_GETEGID32": "syscall", - "syscall.SYS_GETEUID": "syscall", - "syscall.SYS_GETEUID32": "syscall", - "syscall.SYS_GETFH": "syscall", - "syscall.SYS_GETFSSTAT": "syscall", - "syscall.SYS_GETFSSTAT64": "syscall", - "syscall.SYS_GETGID": "syscall", - "syscall.SYS_GETGID32": "syscall", - "syscall.SYS_GETGROUPS": "syscall", - "syscall.SYS_GETGROUPS32": "syscall", - "syscall.SYS_GETHOSTUUID": "syscall", - "syscall.SYS_GETITIMER": "syscall", - "syscall.SYS_GETLCID": "syscall", - "syscall.SYS_GETLOGIN": "syscall", - "syscall.SYS_GETLOGINCLASS": "syscall", - "syscall.SYS_GETPEERNAME": "syscall", - "syscall.SYS_GETPGID": "syscall", - "syscall.SYS_GETPGRP": "syscall", - "syscall.SYS_GETPID": "syscall", - "syscall.SYS_GETPMSG": "syscall", - "syscall.SYS_GETPPID": "syscall", - "syscall.SYS_GETPRIORITY": "syscall", - "syscall.SYS_GETRESGID": "syscall", - "syscall.SYS_GETRESGID32": "syscall", - "syscall.SYS_GETRESUID": "syscall", - "syscall.SYS_GETRESUID32": "syscall", - "syscall.SYS_GETRLIMIT": "syscall", - "syscall.SYS_GETRTABLE": "syscall", - "syscall.SYS_GETRUSAGE": "syscall", - "syscall.SYS_GETSGROUPS": "syscall", - "syscall.SYS_GETSID": "syscall", - "syscall.SYS_GETSOCKNAME": "syscall", - "syscall.SYS_GETSOCKOPT": "syscall", - "syscall.SYS_GETTHRID": "syscall", - "syscall.SYS_GETTID": "syscall", - "syscall.SYS_GETTIMEOFDAY": "syscall", - "syscall.SYS_GETUID": "syscall", - "syscall.SYS_GETUID32": "syscall", - "syscall.SYS_GETVFSSTAT": "syscall", - "syscall.SYS_GETWGROUPS": "syscall", - "syscall.SYS_GETXATTR": "syscall", - "syscall.SYS_GET_KERNEL_SYMS": "syscall", - "syscall.SYS_GET_MEMPOLICY": "syscall", - "syscall.SYS_GET_ROBUST_LIST": "syscall", - "syscall.SYS_GET_THREAD_AREA": "syscall", - "syscall.SYS_GTTY": "syscall", - "syscall.SYS_IDENTITYSVC": "syscall", - "syscall.SYS_IDLE": "syscall", - "syscall.SYS_INITGROUPS": "syscall", - "syscall.SYS_INIT_MODULE": "syscall", - "syscall.SYS_INOTIFY_ADD_WATCH": "syscall", - "syscall.SYS_INOTIFY_INIT": "syscall", - "syscall.SYS_INOTIFY_INIT1": "syscall", - "syscall.SYS_INOTIFY_RM_WATCH": "syscall", - "syscall.SYS_IOCTL": "syscall", - "syscall.SYS_IOPERM": "syscall", - "syscall.SYS_IOPL": "syscall", - "syscall.SYS_IOPOLICYSYS": "syscall", - "syscall.SYS_IOPRIO_GET": "syscall", - "syscall.SYS_IOPRIO_SET": "syscall", - "syscall.SYS_IO_CANCEL": "syscall", - "syscall.SYS_IO_DESTROY": "syscall", - "syscall.SYS_IO_GETEVENTS": "syscall", - "syscall.SYS_IO_SETUP": "syscall", - "syscall.SYS_IO_SUBMIT": "syscall", - "syscall.SYS_IPC": "syscall", - "syscall.SYS_ISSETUGID": "syscall", - "syscall.SYS_JAIL": "syscall", - "syscall.SYS_JAIL_ATTACH": "syscall", - "syscall.SYS_JAIL_GET": "syscall", - "syscall.SYS_JAIL_REMOVE": "syscall", - "syscall.SYS_JAIL_SET": "syscall", - "syscall.SYS_KDEBUG_TRACE": "syscall", - "syscall.SYS_KENV": "syscall", - "syscall.SYS_KEVENT": "syscall", - "syscall.SYS_KEVENT64": "syscall", - "syscall.SYS_KEXEC_LOAD": "syscall", - "syscall.SYS_KEYCTL": "syscall", - "syscall.SYS_KILL": "syscall", - "syscall.SYS_KLDFIND": "syscall", - "syscall.SYS_KLDFIRSTMOD": "syscall", - "syscall.SYS_KLDLOAD": "syscall", - "syscall.SYS_KLDNEXT": "syscall", - "syscall.SYS_KLDSTAT": "syscall", - "syscall.SYS_KLDSYM": "syscall", - "syscall.SYS_KLDUNLOAD": "syscall", - "syscall.SYS_KLDUNLOADF": "syscall", - "syscall.SYS_KQUEUE": "syscall", - "syscall.SYS_KQUEUE1": "syscall", - "syscall.SYS_KTIMER_CREATE": "syscall", - "syscall.SYS_KTIMER_DELETE": "syscall", - "syscall.SYS_KTIMER_GETOVERRUN": "syscall", - "syscall.SYS_KTIMER_GETTIME": "syscall", - "syscall.SYS_KTIMER_SETTIME": "syscall", - "syscall.SYS_KTRACE": "syscall", - "syscall.SYS_LCHFLAGS": "syscall", - "syscall.SYS_LCHMOD": "syscall", - "syscall.SYS_LCHOWN": "syscall", - "syscall.SYS_LCHOWN32": "syscall", - "syscall.SYS_LGETFH": "syscall", - "syscall.SYS_LGETXATTR": "syscall", - "syscall.SYS_LINK": "syscall", - "syscall.SYS_LINKAT": "syscall", - "syscall.SYS_LIO_LISTIO": "syscall", - "syscall.SYS_LISTEN": "syscall", - "syscall.SYS_LISTXATTR": "syscall", - "syscall.SYS_LLISTXATTR": "syscall", - "syscall.SYS_LOCK": "syscall", - "syscall.SYS_LOOKUP_DCOOKIE": "syscall", - "syscall.SYS_LPATHCONF": "syscall", - "syscall.SYS_LREMOVEXATTR": "syscall", - "syscall.SYS_LSEEK": "syscall", - "syscall.SYS_LSETXATTR": "syscall", - "syscall.SYS_LSTAT": "syscall", - "syscall.SYS_LSTAT64": "syscall", - "syscall.SYS_LSTAT64_EXTENDED": "syscall", - "syscall.SYS_LSTATV": "syscall", - "syscall.SYS_LSTAT_EXTENDED": "syscall", - "syscall.SYS_LUTIMES": "syscall", - "syscall.SYS_MAC_SYSCALL": "syscall", - "syscall.SYS_MADVISE": "syscall", - "syscall.SYS_MADVISE1": "syscall", - "syscall.SYS_MAXSYSCALL": "syscall", - "syscall.SYS_MBIND": "syscall", - "syscall.SYS_MIGRATE_PAGES": "syscall", - "syscall.SYS_MINCORE": "syscall", - "syscall.SYS_MINHERIT": "syscall", - "syscall.SYS_MKCOMPLEX": "syscall", - "syscall.SYS_MKDIR": "syscall", - "syscall.SYS_MKDIRAT": "syscall", - "syscall.SYS_MKDIR_EXTENDED": "syscall", - "syscall.SYS_MKFIFO": "syscall", - "syscall.SYS_MKFIFOAT": "syscall", - "syscall.SYS_MKFIFO_EXTENDED": "syscall", - "syscall.SYS_MKNOD": "syscall", - "syscall.SYS_MKNODAT": "syscall", - "syscall.SYS_MLOCK": "syscall", - "syscall.SYS_MLOCKALL": "syscall", - "syscall.SYS_MMAP": "syscall", - "syscall.SYS_MMAP2": "syscall", - "syscall.SYS_MODCTL": "syscall", - "syscall.SYS_MODFIND": "syscall", - "syscall.SYS_MODFNEXT": "syscall", - "syscall.SYS_MODIFY_LDT": "syscall", - "syscall.SYS_MODNEXT": "syscall", - "syscall.SYS_MODSTAT": "syscall", - "syscall.SYS_MODWATCH": "syscall", - "syscall.SYS_MOUNT": "syscall", - "syscall.SYS_MOVE_PAGES": "syscall", - "syscall.SYS_MPROTECT": "syscall", - "syscall.SYS_MPX": "syscall", - "syscall.SYS_MQUERY": "syscall", - "syscall.SYS_MQ_GETSETATTR": "syscall", - "syscall.SYS_MQ_NOTIFY": "syscall", - "syscall.SYS_MQ_OPEN": "syscall", - "syscall.SYS_MQ_TIMEDRECEIVE": "syscall", - "syscall.SYS_MQ_TIMEDSEND": "syscall", - "syscall.SYS_MQ_UNLINK": "syscall", - "syscall.SYS_MREMAP": "syscall", - "syscall.SYS_MSGCTL": "syscall", - "syscall.SYS_MSGGET": "syscall", - "syscall.SYS_MSGRCV": "syscall", - "syscall.SYS_MSGRCV_NOCANCEL": "syscall", - "syscall.SYS_MSGSND": "syscall", - "syscall.SYS_MSGSND_NOCANCEL": "syscall", - "syscall.SYS_MSGSYS": "syscall", - "syscall.SYS_MSYNC": "syscall", - "syscall.SYS_MSYNC_NOCANCEL": "syscall", - "syscall.SYS_MUNLOCK": "syscall", - "syscall.SYS_MUNLOCKALL": "syscall", - "syscall.SYS_MUNMAP": "syscall", - "syscall.SYS_NAME_TO_HANDLE_AT": "syscall", - "syscall.SYS_NANOSLEEP": "syscall", - "syscall.SYS_NEWFSTATAT": "syscall", - "syscall.SYS_NFSCLNT": "syscall", - "syscall.SYS_NFSSERVCTL": "syscall", - "syscall.SYS_NFSSVC": "syscall", - "syscall.SYS_NFSTAT": "syscall", - "syscall.SYS_NICE": "syscall", - "syscall.SYS_NLSTAT": "syscall", - "syscall.SYS_NMOUNT": "syscall", - "syscall.SYS_NSTAT": "syscall", - "syscall.SYS_NTP_ADJTIME": "syscall", - "syscall.SYS_NTP_GETTIME": "syscall", - "syscall.SYS_OABI_SYSCALL_BASE": "syscall", - "syscall.SYS_OBREAK": "syscall", - "syscall.SYS_OLDFSTAT": "syscall", - "syscall.SYS_OLDLSTAT": "syscall", - "syscall.SYS_OLDOLDUNAME": "syscall", - "syscall.SYS_OLDSTAT": "syscall", - "syscall.SYS_OLDUNAME": "syscall", - "syscall.SYS_OPEN": "syscall", - "syscall.SYS_OPENAT": "syscall", - "syscall.SYS_OPENBSD_POLL": "syscall", - "syscall.SYS_OPEN_BY_HANDLE_AT": "syscall", - "syscall.SYS_OPEN_EXTENDED": "syscall", - "syscall.SYS_OPEN_NOCANCEL": "syscall", - "syscall.SYS_OVADVISE": "syscall", - "syscall.SYS_PACCEPT": "syscall", - "syscall.SYS_PATHCONF": "syscall", - "syscall.SYS_PAUSE": "syscall", - "syscall.SYS_PCICONFIG_IOBASE": "syscall", - "syscall.SYS_PCICONFIG_READ": "syscall", - "syscall.SYS_PCICONFIG_WRITE": "syscall", - "syscall.SYS_PDFORK": "syscall", - "syscall.SYS_PDGETPID": "syscall", - "syscall.SYS_PDKILL": "syscall", - "syscall.SYS_PERF_EVENT_OPEN": "syscall", - "syscall.SYS_PERSONALITY": "syscall", - "syscall.SYS_PID_HIBERNATE": "syscall", - "syscall.SYS_PID_RESUME": "syscall", - "syscall.SYS_PID_SHUTDOWN_SOCKETS": "syscall", - "syscall.SYS_PID_SUSPEND": "syscall", - "syscall.SYS_PIPE": "syscall", - "syscall.SYS_PIPE2": "syscall", - "syscall.SYS_PIVOT_ROOT": "syscall", - "syscall.SYS_PMC_CONTROL": "syscall", - "syscall.SYS_PMC_GET_INFO": "syscall", - "syscall.SYS_POLL": "syscall", - "syscall.SYS_POLLTS": "syscall", - "syscall.SYS_POLL_NOCANCEL": "syscall", - "syscall.SYS_POSIX_FADVISE": "syscall", - "syscall.SYS_POSIX_FALLOCATE": "syscall", - "syscall.SYS_POSIX_OPENPT": "syscall", - "syscall.SYS_POSIX_SPAWN": "syscall", - "syscall.SYS_PPOLL": "syscall", - "syscall.SYS_PRCTL": "syscall", - "syscall.SYS_PREAD": "syscall", - "syscall.SYS_PREAD64": "syscall", - "syscall.SYS_PREADV": "syscall", - "syscall.SYS_PREAD_NOCANCEL": "syscall", - "syscall.SYS_PRLIMIT64": "syscall", - "syscall.SYS_PROCCTL": "syscall", - "syscall.SYS_PROCESS_POLICY": "syscall", - "syscall.SYS_PROCESS_VM_READV": "syscall", - "syscall.SYS_PROCESS_VM_WRITEV": "syscall", - "syscall.SYS_PROC_INFO": "syscall", - "syscall.SYS_PROF": "syscall", - "syscall.SYS_PROFIL": "syscall", - "syscall.SYS_PSELECT": "syscall", - "syscall.SYS_PSELECT6": "syscall", - "syscall.SYS_PSET_ASSIGN": "syscall", - "syscall.SYS_PSET_CREATE": "syscall", - "syscall.SYS_PSET_DESTROY": "syscall", - "syscall.SYS_PSYNCH_CVBROAD": "syscall", - "syscall.SYS_PSYNCH_CVCLRPREPOST": "syscall", - "syscall.SYS_PSYNCH_CVSIGNAL": "syscall", - "syscall.SYS_PSYNCH_CVWAIT": "syscall", - "syscall.SYS_PSYNCH_MUTEXDROP": "syscall", - "syscall.SYS_PSYNCH_MUTEXWAIT": "syscall", - "syscall.SYS_PSYNCH_RW_DOWNGRADE": "syscall", - "syscall.SYS_PSYNCH_RW_LONGRDLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_RDLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_UNLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_UNLOCK2": "syscall", - "syscall.SYS_PSYNCH_RW_UPGRADE": "syscall", - "syscall.SYS_PSYNCH_RW_WRLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_YIELDWRLOCK": "syscall", - "syscall.SYS_PTRACE": "syscall", - "syscall.SYS_PUTPMSG": "syscall", - "syscall.SYS_PWRITE": "syscall", - "syscall.SYS_PWRITE64": "syscall", - "syscall.SYS_PWRITEV": "syscall", - "syscall.SYS_PWRITE_NOCANCEL": "syscall", - "syscall.SYS_QUERY_MODULE": "syscall", - "syscall.SYS_QUOTACTL": "syscall", - "syscall.SYS_RASCTL": "syscall", - "syscall.SYS_RCTL_ADD_RULE": "syscall", - "syscall.SYS_RCTL_GET_LIMITS": "syscall", - "syscall.SYS_RCTL_GET_RACCT": "syscall", - "syscall.SYS_RCTL_GET_RULES": "syscall", - "syscall.SYS_RCTL_REMOVE_RULE": "syscall", - "syscall.SYS_READ": "syscall", - "syscall.SYS_READAHEAD": "syscall", - "syscall.SYS_READDIR": "syscall", - "syscall.SYS_READLINK": "syscall", - "syscall.SYS_READLINKAT": "syscall", - "syscall.SYS_READV": "syscall", - "syscall.SYS_READV_NOCANCEL": "syscall", - "syscall.SYS_READ_NOCANCEL": "syscall", - "syscall.SYS_REBOOT": "syscall", - "syscall.SYS_RECV": "syscall", - "syscall.SYS_RECVFROM": "syscall", - "syscall.SYS_RECVFROM_NOCANCEL": "syscall", - "syscall.SYS_RECVMMSG": "syscall", - "syscall.SYS_RECVMSG": "syscall", - "syscall.SYS_RECVMSG_NOCANCEL": "syscall", - "syscall.SYS_REMAP_FILE_PAGES": "syscall", - "syscall.SYS_REMOVEXATTR": "syscall", - "syscall.SYS_RENAME": "syscall", - "syscall.SYS_RENAMEAT": "syscall", - "syscall.SYS_REQUEST_KEY": "syscall", - "syscall.SYS_RESTART_SYSCALL": "syscall", - "syscall.SYS_REVOKE": "syscall", - "syscall.SYS_RFORK": "syscall", - "syscall.SYS_RMDIR": "syscall", - "syscall.SYS_RTPRIO": "syscall", - "syscall.SYS_RTPRIO_THREAD": "syscall", - "syscall.SYS_RT_SIGACTION": "syscall", - "syscall.SYS_RT_SIGPENDING": "syscall", - "syscall.SYS_RT_SIGPROCMASK": "syscall", - "syscall.SYS_RT_SIGQUEUEINFO": "syscall", - "syscall.SYS_RT_SIGRETURN": "syscall", - "syscall.SYS_RT_SIGSUSPEND": "syscall", - "syscall.SYS_RT_SIGTIMEDWAIT": "syscall", - "syscall.SYS_RT_TGSIGQUEUEINFO": "syscall", - "syscall.SYS_SBRK": "syscall", - "syscall.SYS_SCHED_GETAFFINITY": "syscall", - "syscall.SYS_SCHED_GETPARAM": "syscall", - "syscall.SYS_SCHED_GETSCHEDULER": "syscall", - "syscall.SYS_SCHED_GET_PRIORITY_MAX": "syscall", - "syscall.SYS_SCHED_GET_PRIORITY_MIN": "syscall", - "syscall.SYS_SCHED_RR_GET_INTERVAL": "syscall", - "syscall.SYS_SCHED_SETAFFINITY": "syscall", - "syscall.SYS_SCHED_SETPARAM": "syscall", - "syscall.SYS_SCHED_SETSCHEDULER": "syscall", - "syscall.SYS_SCHED_YIELD": "syscall", - "syscall.SYS_SCTP_GENERIC_RECVMSG": "syscall", - "syscall.SYS_SCTP_GENERIC_SENDMSG": "syscall", - "syscall.SYS_SCTP_GENERIC_SENDMSG_IOV": "syscall", - "syscall.SYS_SCTP_PEELOFF": "syscall", - "syscall.SYS_SEARCHFS": "syscall", - "syscall.SYS_SECURITY": "syscall", - "syscall.SYS_SELECT": "syscall", - "syscall.SYS_SELECT_NOCANCEL": "syscall", - "syscall.SYS_SEMCONFIG": "syscall", - "syscall.SYS_SEMCTL": "syscall", - "syscall.SYS_SEMGET": "syscall", - "syscall.SYS_SEMOP": "syscall", - "syscall.SYS_SEMSYS": "syscall", - "syscall.SYS_SEMTIMEDOP": "syscall", - "syscall.SYS_SEM_CLOSE": "syscall", - "syscall.SYS_SEM_DESTROY": "syscall", - "syscall.SYS_SEM_GETVALUE": "syscall", - "syscall.SYS_SEM_INIT": "syscall", - "syscall.SYS_SEM_OPEN": "syscall", - "syscall.SYS_SEM_POST": "syscall", - "syscall.SYS_SEM_TRYWAIT": "syscall", - "syscall.SYS_SEM_UNLINK": "syscall", - "syscall.SYS_SEM_WAIT": "syscall", - "syscall.SYS_SEM_WAIT_NOCANCEL": "syscall", - "syscall.SYS_SEND": "syscall", - "syscall.SYS_SENDFILE": "syscall", - "syscall.SYS_SENDFILE64": "syscall", - "syscall.SYS_SENDMMSG": "syscall", - "syscall.SYS_SENDMSG": "syscall", - "syscall.SYS_SENDMSG_NOCANCEL": "syscall", - "syscall.SYS_SENDTO": "syscall", - "syscall.SYS_SENDTO_NOCANCEL": "syscall", - "syscall.SYS_SETATTRLIST": "syscall", - "syscall.SYS_SETAUDIT": "syscall", - "syscall.SYS_SETAUDIT_ADDR": "syscall", - "syscall.SYS_SETAUID": "syscall", - "syscall.SYS_SETCONTEXT": "syscall", - "syscall.SYS_SETDOMAINNAME": "syscall", - "syscall.SYS_SETEGID": "syscall", - "syscall.SYS_SETEUID": "syscall", - "syscall.SYS_SETFIB": "syscall", - "syscall.SYS_SETFSGID": "syscall", - "syscall.SYS_SETFSGID32": "syscall", - "syscall.SYS_SETFSUID": "syscall", - "syscall.SYS_SETFSUID32": "syscall", - "syscall.SYS_SETGID": "syscall", - "syscall.SYS_SETGID32": "syscall", - "syscall.SYS_SETGROUPS": "syscall", - "syscall.SYS_SETGROUPS32": "syscall", - "syscall.SYS_SETHOSTNAME": "syscall", - "syscall.SYS_SETITIMER": "syscall", - "syscall.SYS_SETLCID": "syscall", - "syscall.SYS_SETLOGIN": "syscall", - "syscall.SYS_SETLOGINCLASS": "syscall", - "syscall.SYS_SETNS": "syscall", - "syscall.SYS_SETPGID": "syscall", - "syscall.SYS_SETPRIORITY": "syscall", - "syscall.SYS_SETPRIVEXEC": "syscall", - "syscall.SYS_SETREGID": "syscall", - "syscall.SYS_SETREGID32": "syscall", - "syscall.SYS_SETRESGID": "syscall", - "syscall.SYS_SETRESGID32": "syscall", - "syscall.SYS_SETRESUID": "syscall", - "syscall.SYS_SETRESUID32": "syscall", - "syscall.SYS_SETREUID": "syscall", - "syscall.SYS_SETREUID32": "syscall", - "syscall.SYS_SETRLIMIT": "syscall", - "syscall.SYS_SETRTABLE": "syscall", - "syscall.SYS_SETSGROUPS": "syscall", - "syscall.SYS_SETSID": "syscall", - "syscall.SYS_SETSOCKOPT": "syscall", - "syscall.SYS_SETTID": "syscall", - "syscall.SYS_SETTID_WITH_PID": "syscall", - "syscall.SYS_SETTIMEOFDAY": "syscall", - "syscall.SYS_SETUID": "syscall", - "syscall.SYS_SETUID32": "syscall", - "syscall.SYS_SETWGROUPS": "syscall", - "syscall.SYS_SETXATTR": "syscall", - "syscall.SYS_SET_MEMPOLICY": "syscall", - "syscall.SYS_SET_ROBUST_LIST": "syscall", - "syscall.SYS_SET_THREAD_AREA": "syscall", - "syscall.SYS_SET_TID_ADDRESS": "syscall", - "syscall.SYS_SGETMASK": "syscall", - "syscall.SYS_SHARED_REGION_CHECK_NP": "syscall", - "syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP": "syscall", - "syscall.SYS_SHMAT": "syscall", - "syscall.SYS_SHMCTL": "syscall", - "syscall.SYS_SHMDT": "syscall", - "syscall.SYS_SHMGET": "syscall", - "syscall.SYS_SHMSYS": "syscall", - "syscall.SYS_SHM_OPEN": "syscall", - "syscall.SYS_SHM_UNLINK": "syscall", - "syscall.SYS_SHUTDOWN": "syscall", - "syscall.SYS_SIGACTION": "syscall", - "syscall.SYS_SIGALTSTACK": "syscall", - "syscall.SYS_SIGNAL": "syscall", - "syscall.SYS_SIGNALFD": "syscall", - "syscall.SYS_SIGNALFD4": "syscall", - "syscall.SYS_SIGPENDING": "syscall", - "syscall.SYS_SIGPROCMASK": "syscall", - "syscall.SYS_SIGQUEUE": "syscall", - "syscall.SYS_SIGQUEUEINFO": "syscall", - "syscall.SYS_SIGRETURN": "syscall", - "syscall.SYS_SIGSUSPEND": "syscall", - "syscall.SYS_SIGSUSPEND_NOCANCEL": "syscall", - "syscall.SYS_SIGTIMEDWAIT": "syscall", - "syscall.SYS_SIGWAIT": "syscall", - "syscall.SYS_SIGWAITINFO": "syscall", - "syscall.SYS_SOCKET": "syscall", - "syscall.SYS_SOCKETCALL": "syscall", - "syscall.SYS_SOCKETPAIR": "syscall", - "syscall.SYS_SPLICE": "syscall", - "syscall.SYS_SSETMASK": "syscall", - "syscall.SYS_SSTK": "syscall", - "syscall.SYS_STACK_SNAPSHOT": "syscall", - "syscall.SYS_STAT": "syscall", - "syscall.SYS_STAT64": "syscall", - "syscall.SYS_STAT64_EXTENDED": "syscall", - "syscall.SYS_STATFS": "syscall", - "syscall.SYS_STATFS64": "syscall", - "syscall.SYS_STATV": "syscall", - "syscall.SYS_STATVFS1": "syscall", - "syscall.SYS_STAT_EXTENDED": "syscall", - "syscall.SYS_STIME": "syscall", - "syscall.SYS_STTY": "syscall", - "syscall.SYS_SWAPCONTEXT": "syscall", - "syscall.SYS_SWAPCTL": "syscall", - "syscall.SYS_SWAPOFF": "syscall", - "syscall.SYS_SWAPON": "syscall", - "syscall.SYS_SYMLINK": "syscall", - "syscall.SYS_SYMLINKAT": "syscall", - "syscall.SYS_SYNC": "syscall", - "syscall.SYS_SYNCFS": "syscall", - "syscall.SYS_SYNC_FILE_RANGE": "syscall", - "syscall.SYS_SYSARCH": "syscall", - "syscall.SYS_SYSCALL": "syscall", - "syscall.SYS_SYSCALL_BASE": "syscall", - "syscall.SYS_SYSFS": "syscall", - "syscall.SYS_SYSINFO": "syscall", - "syscall.SYS_SYSLOG": "syscall", - "syscall.SYS_TEE": "syscall", - "syscall.SYS_TGKILL": "syscall", - "syscall.SYS_THREAD_SELFID": "syscall", - "syscall.SYS_THR_CREATE": "syscall", - "syscall.SYS_THR_EXIT": "syscall", - "syscall.SYS_THR_KILL": "syscall", - "syscall.SYS_THR_KILL2": "syscall", - "syscall.SYS_THR_NEW": "syscall", - "syscall.SYS_THR_SELF": "syscall", - "syscall.SYS_THR_SET_NAME": "syscall", - "syscall.SYS_THR_SUSPEND": "syscall", - "syscall.SYS_THR_WAKE": "syscall", - "syscall.SYS_TIME": "syscall", - "syscall.SYS_TIMERFD_CREATE": "syscall", - "syscall.SYS_TIMERFD_GETTIME": "syscall", - "syscall.SYS_TIMERFD_SETTIME": "syscall", - "syscall.SYS_TIMER_CREATE": "syscall", - "syscall.SYS_TIMER_DELETE": "syscall", - "syscall.SYS_TIMER_GETOVERRUN": "syscall", - "syscall.SYS_TIMER_GETTIME": "syscall", - "syscall.SYS_TIMER_SETTIME": "syscall", - "syscall.SYS_TIMES": "syscall", - "syscall.SYS_TKILL": "syscall", - "syscall.SYS_TRUNCATE": "syscall", - "syscall.SYS_TRUNCATE64": "syscall", - "syscall.SYS_TUXCALL": "syscall", - "syscall.SYS_UGETRLIMIT": "syscall", - "syscall.SYS_ULIMIT": "syscall", - "syscall.SYS_UMASK": "syscall", - "syscall.SYS_UMASK_EXTENDED": "syscall", - "syscall.SYS_UMOUNT": "syscall", - "syscall.SYS_UMOUNT2": "syscall", - "syscall.SYS_UNAME": "syscall", - "syscall.SYS_UNDELETE": "syscall", - "syscall.SYS_UNLINK": "syscall", - "syscall.SYS_UNLINKAT": "syscall", - "syscall.SYS_UNMOUNT": "syscall", - "syscall.SYS_UNSHARE": "syscall", - "syscall.SYS_USELIB": "syscall", - "syscall.SYS_USTAT": "syscall", - "syscall.SYS_UTIME": "syscall", - "syscall.SYS_UTIMENSAT": "syscall", - "syscall.SYS_UTIMES": "syscall", - "syscall.SYS_UTRACE": "syscall", - "syscall.SYS_UUIDGEN": "syscall", - "syscall.SYS_VADVISE": "syscall", - "syscall.SYS_VFORK": "syscall", - "syscall.SYS_VHANGUP": "syscall", - "syscall.SYS_VM86": "syscall", - "syscall.SYS_VM86OLD": "syscall", - "syscall.SYS_VMSPLICE": "syscall", - "syscall.SYS_VM_PRESSURE_MONITOR": "syscall", - "syscall.SYS_VSERVER": "syscall", - "syscall.SYS_WAIT4": "syscall", - "syscall.SYS_WAIT4_NOCANCEL": "syscall", - "syscall.SYS_WAIT6": "syscall", - "syscall.SYS_WAITEVENT": "syscall", - "syscall.SYS_WAITID": "syscall", - "syscall.SYS_WAITID_NOCANCEL": "syscall", - "syscall.SYS_WAITPID": "syscall", - "syscall.SYS_WATCHEVENT": "syscall", - "syscall.SYS_WORKQ_KERNRETURN": "syscall", - "syscall.SYS_WORKQ_OPEN": "syscall", - "syscall.SYS_WRITE": "syscall", - "syscall.SYS_WRITEV": "syscall", - "syscall.SYS_WRITEV_NOCANCEL": "syscall", - "syscall.SYS_WRITE_NOCANCEL": "syscall", - "syscall.SYS_YIELD": "syscall", - "syscall.SYS__LLSEEK": "syscall", - "syscall.SYS__LWP_CONTINUE": "syscall", - "syscall.SYS__LWP_CREATE": "syscall", - "syscall.SYS__LWP_CTL": "syscall", - "syscall.SYS__LWP_DETACH": "syscall", - "syscall.SYS__LWP_EXIT": "syscall", - "syscall.SYS__LWP_GETNAME": "syscall", - "syscall.SYS__LWP_GETPRIVATE": "syscall", - "syscall.SYS__LWP_KILL": "syscall", - "syscall.SYS__LWP_PARK": "syscall", - "syscall.SYS__LWP_SELF": "syscall", - "syscall.SYS__LWP_SETNAME": "syscall", - "syscall.SYS__LWP_SETPRIVATE": "syscall", - "syscall.SYS__LWP_SUSPEND": "syscall", - "syscall.SYS__LWP_UNPARK": "syscall", - "syscall.SYS__LWP_UNPARK_ALL": "syscall", - "syscall.SYS__LWP_WAIT": "syscall", - "syscall.SYS__LWP_WAKEUP": "syscall", - "syscall.SYS__NEWSELECT": "syscall", - "syscall.SYS__PSET_BIND": "syscall", - "syscall.SYS__SCHED_GETAFFINITY": "syscall", - "syscall.SYS__SCHED_GETPARAM": "syscall", - "syscall.SYS__SCHED_SETAFFINITY": "syscall", - "syscall.SYS__SCHED_SETPARAM": "syscall", - "syscall.SYS__SYSCTL": "syscall", - "syscall.SYS__UMTX_LOCK": "syscall", - "syscall.SYS__UMTX_OP": "syscall", - "syscall.SYS__UMTX_UNLOCK": "syscall", - "syscall.SYS___ACL_ACLCHECK_FD": "syscall", - "syscall.SYS___ACL_ACLCHECK_FILE": "syscall", - "syscall.SYS___ACL_ACLCHECK_LINK": "syscall", - "syscall.SYS___ACL_DELETE_FD": "syscall", - "syscall.SYS___ACL_DELETE_FILE": "syscall", - "syscall.SYS___ACL_DELETE_LINK": "syscall", - "syscall.SYS___ACL_GET_FD": "syscall", - "syscall.SYS___ACL_GET_FILE": "syscall", - "syscall.SYS___ACL_GET_LINK": "syscall", - "syscall.SYS___ACL_SET_FD": "syscall", - "syscall.SYS___ACL_SET_FILE": "syscall", - "syscall.SYS___ACL_SET_LINK": "syscall", - "syscall.SYS___CLONE": "syscall", - "syscall.SYS___DISABLE_THREADSIGNAL": "syscall", - "syscall.SYS___GETCWD": "syscall", - "syscall.SYS___GETLOGIN": "syscall", - "syscall.SYS___GET_TCB": "syscall", - "syscall.SYS___MAC_EXECVE": "syscall", - "syscall.SYS___MAC_GETFSSTAT": "syscall", - "syscall.SYS___MAC_GET_FD": "syscall", - "syscall.SYS___MAC_GET_FILE": "syscall", - "syscall.SYS___MAC_GET_LCID": "syscall", - "syscall.SYS___MAC_GET_LCTX": "syscall", - "syscall.SYS___MAC_GET_LINK": "syscall", - "syscall.SYS___MAC_GET_MOUNT": "syscall", - "syscall.SYS___MAC_GET_PID": "syscall", - "syscall.SYS___MAC_GET_PROC": "syscall", - "syscall.SYS___MAC_MOUNT": "syscall", - "syscall.SYS___MAC_SET_FD": "syscall", - "syscall.SYS___MAC_SET_FILE": "syscall", - "syscall.SYS___MAC_SET_LCTX": "syscall", - "syscall.SYS___MAC_SET_LINK": "syscall", - "syscall.SYS___MAC_SET_PROC": "syscall", - "syscall.SYS___MAC_SYSCALL": "syscall", - "syscall.SYS___OLD_SEMWAIT_SIGNAL": "syscall", - "syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": "syscall", - "syscall.SYS___POSIX_CHOWN": "syscall", - "syscall.SYS___POSIX_FCHOWN": "syscall", - "syscall.SYS___POSIX_LCHOWN": "syscall", - "syscall.SYS___POSIX_RENAME": "syscall", - "syscall.SYS___PTHREAD_CANCELED": "syscall", - "syscall.SYS___PTHREAD_CHDIR": "syscall", - "syscall.SYS___PTHREAD_FCHDIR": "syscall", - "syscall.SYS___PTHREAD_KILL": "syscall", - "syscall.SYS___PTHREAD_MARKCANCEL": "syscall", - "syscall.SYS___PTHREAD_SIGMASK": "syscall", - "syscall.SYS___QUOTACTL": "syscall", - "syscall.SYS___SEMCTL": "syscall", - "syscall.SYS___SEMWAIT_SIGNAL": "syscall", - "syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL": "syscall", - "syscall.SYS___SETLOGIN": "syscall", - "syscall.SYS___SETUGID": "syscall", - "syscall.SYS___SET_TCB": "syscall", - "syscall.SYS___SIGACTION_SIGTRAMP": "syscall", - "syscall.SYS___SIGTIMEDWAIT": "syscall", - "syscall.SYS___SIGWAIT": "syscall", - "syscall.SYS___SIGWAIT_NOCANCEL": "syscall", - "syscall.SYS___SYSCTL": "syscall", - "syscall.SYS___TFORK": "syscall", - "syscall.SYS___THREXIT": "syscall", - "syscall.SYS___THRSIGDIVERT": "syscall", - "syscall.SYS___THRSLEEP": "syscall", - "syscall.SYS___THRWAKEUP": "syscall", - "syscall.S_ARCH1": "syscall", - "syscall.S_ARCH2": "syscall", - "syscall.S_BLKSIZE": "syscall", - "syscall.S_IEXEC": "syscall", - "syscall.S_IFBLK": "syscall", - "syscall.S_IFCHR": "syscall", - "syscall.S_IFDIR": "syscall", - "syscall.S_IFIFO": "syscall", - "syscall.S_IFLNK": "syscall", - "syscall.S_IFMT": "syscall", - "syscall.S_IFREG": "syscall", - "syscall.S_IFSOCK": "syscall", - "syscall.S_IFWHT": "syscall", - "syscall.S_IREAD": "syscall", - "syscall.S_IRGRP": "syscall", - "syscall.S_IROTH": "syscall", - "syscall.S_IRUSR": "syscall", - "syscall.S_IRWXG": "syscall", - "syscall.S_IRWXO": "syscall", - "syscall.S_IRWXU": "syscall", - "syscall.S_ISGID": "syscall", - "syscall.S_ISTXT": "syscall", - "syscall.S_ISUID": "syscall", - "syscall.S_ISVTX": "syscall", - "syscall.S_IWGRP": "syscall", - "syscall.S_IWOTH": "syscall", - "syscall.S_IWRITE": "syscall", - "syscall.S_IWUSR": "syscall", - "syscall.S_IXGRP": "syscall", - "syscall.S_IXOTH": "syscall", - "syscall.S_IXUSR": "syscall", - "syscall.S_LOGIN_SET": "syscall", - "syscall.SecurityAttributes": "syscall", - "syscall.Seek": "syscall", - "syscall.Select": "syscall", - "syscall.Sendfile": "syscall", - "syscall.Sendmsg": "syscall", - "syscall.SendmsgN": "syscall", - "syscall.Sendto": "syscall", - "syscall.Servent": "syscall", - "syscall.SetBpf": "syscall", - "syscall.SetBpfBuflen": "syscall", - "syscall.SetBpfDatalink": "syscall", - "syscall.SetBpfHeadercmpl": "syscall", - "syscall.SetBpfImmediate": "syscall", - "syscall.SetBpfInterface": "syscall", - "syscall.SetBpfPromisc": "syscall", - "syscall.SetBpfTimeout": "syscall", - "syscall.SetCurrentDirectory": "syscall", - "syscall.SetEndOfFile": "syscall", - "syscall.SetEnvironmentVariable": "syscall", - "syscall.SetFileAttributes": "syscall", - "syscall.SetFileCompletionNotificationModes": "syscall", - "syscall.SetFilePointer": "syscall", - "syscall.SetFileTime": "syscall", - "syscall.SetHandleInformation": "syscall", - "syscall.SetKevent": "syscall", - "syscall.SetLsfPromisc": "syscall", - "syscall.SetNonblock": "syscall", - "syscall.Setdomainname": "syscall", - "syscall.Setegid": "syscall", - "syscall.Setenv": "syscall", - "syscall.Seteuid": "syscall", - "syscall.Setfsgid": "syscall", - "syscall.Setfsuid": "syscall", - "syscall.Setgid": "syscall", - "syscall.Setgroups": "syscall", - "syscall.Sethostname": "syscall", - "syscall.Setlogin": "syscall", - "syscall.Setpgid": "syscall", - "syscall.Setpriority": "syscall", - "syscall.Setprivexec": "syscall", - "syscall.Setregid": "syscall", - "syscall.Setresgid": "syscall", - "syscall.Setresuid": "syscall", - "syscall.Setreuid": "syscall", - "syscall.Setrlimit": "syscall", - "syscall.Setsid": "syscall", - "syscall.Setsockopt": "syscall", - "syscall.SetsockoptByte": "syscall", - "syscall.SetsockoptICMPv6Filter": "syscall", - "syscall.SetsockoptIPMreq": "syscall", - "syscall.SetsockoptIPMreqn": "syscall", - "syscall.SetsockoptIPv6Mreq": "syscall", - "syscall.SetsockoptInet4Addr": "syscall", - "syscall.SetsockoptInt": "syscall", - "syscall.SetsockoptLinger": "syscall", - "syscall.SetsockoptString": "syscall", - "syscall.SetsockoptTimeval": "syscall", - "syscall.Settimeofday": "syscall", - "syscall.Setuid": "syscall", - "syscall.Setxattr": "syscall", - "syscall.Shutdown": "syscall", - "syscall.SidTypeAlias": "syscall", - "syscall.SidTypeComputer": "syscall", - "syscall.SidTypeDeletedAccount": "syscall", - "syscall.SidTypeDomain": "syscall", - "syscall.SidTypeGroup": "syscall", - "syscall.SidTypeInvalid": "syscall", - "syscall.SidTypeLabel": "syscall", - "syscall.SidTypeUnknown": "syscall", - "syscall.SidTypeUser": "syscall", - "syscall.SidTypeWellKnownGroup": "syscall", - "syscall.Signal": "syscall", - "syscall.SizeofBpfHdr": "syscall", - "syscall.SizeofBpfInsn": "syscall", - "syscall.SizeofBpfProgram": "syscall", - "syscall.SizeofBpfStat": "syscall", - "syscall.SizeofBpfVersion": "syscall", - "syscall.SizeofBpfZbuf": "syscall", - "syscall.SizeofBpfZbufHeader": "syscall", - "syscall.SizeofCmsghdr": "syscall", - "syscall.SizeofICMPv6Filter": "syscall", - "syscall.SizeofIPMreq": "syscall", - "syscall.SizeofIPMreqn": "syscall", - "syscall.SizeofIPv6MTUInfo": "syscall", - "syscall.SizeofIPv6Mreq": "syscall", - "syscall.SizeofIfAddrmsg": "syscall", - "syscall.SizeofIfAnnounceMsghdr": "syscall", - "syscall.SizeofIfData": "syscall", - "syscall.SizeofIfInfomsg": "syscall", - "syscall.SizeofIfMsghdr": "syscall", - "syscall.SizeofIfaMsghdr": "syscall", - "syscall.SizeofIfmaMsghdr": "syscall", - "syscall.SizeofIfmaMsghdr2": "syscall", - "syscall.SizeofInet4Pktinfo": "syscall", - "syscall.SizeofInet6Pktinfo": "syscall", - "syscall.SizeofInotifyEvent": "syscall", - "syscall.SizeofLinger": "syscall", - "syscall.SizeofMsghdr": "syscall", - "syscall.SizeofNlAttr": "syscall", - "syscall.SizeofNlMsgerr": "syscall", - "syscall.SizeofNlMsghdr": "syscall", - "syscall.SizeofRtAttr": "syscall", - "syscall.SizeofRtGenmsg": "syscall", - "syscall.SizeofRtMetrics": "syscall", - "syscall.SizeofRtMsg": "syscall", - "syscall.SizeofRtMsghdr": "syscall", - "syscall.SizeofRtNexthop": "syscall", - "syscall.SizeofSockFilter": "syscall", - "syscall.SizeofSockFprog": "syscall", - "syscall.SizeofSockaddrAny": "syscall", - "syscall.SizeofSockaddrDatalink": "syscall", - "syscall.SizeofSockaddrInet4": "syscall", - "syscall.SizeofSockaddrInet6": "syscall", - "syscall.SizeofSockaddrLinklayer": "syscall", - "syscall.SizeofSockaddrNetlink": "syscall", - "syscall.SizeofSockaddrUnix": "syscall", - "syscall.SizeofTCPInfo": "syscall", - "syscall.SizeofUcred": "syscall", - "syscall.SlicePtrFromStrings": "syscall", - "syscall.SockFilter": "syscall", - "syscall.SockFprog": "syscall", - "syscall.SockaddrDatalink": "syscall", - "syscall.SockaddrGen": "syscall", - "syscall.SockaddrInet4": "syscall", - "syscall.SockaddrInet6": "syscall", - "syscall.SockaddrLinklayer": "syscall", - "syscall.SockaddrNetlink": "syscall", - "syscall.SockaddrUnix": "syscall", - "syscall.Socket": "syscall", - "syscall.SocketControlMessage": "syscall", - "syscall.SocketDisableIPv6": "syscall", - "syscall.Socketpair": "syscall", - "syscall.Splice": "syscall", - "syscall.StartProcess": "syscall", - "syscall.StartupInfo": "syscall", - "syscall.Stat": "syscall", - "syscall.Stat_t": "syscall", - "syscall.Statfs": "syscall", - "syscall.Statfs_t": "syscall", - "syscall.Stderr": "syscall", - "syscall.Stdin": "syscall", - "syscall.Stdout": "syscall", - "syscall.StringBytePtr": "syscall", - "syscall.StringByteSlice": "syscall", - "syscall.StringSlicePtr": "syscall", - "syscall.StringToSid": "syscall", - "syscall.StringToUTF16": "syscall", - "syscall.StringToUTF16Ptr": "syscall", - "syscall.Symlink": "syscall", - "syscall.Sync": "syscall", - "syscall.SyncFileRange": "syscall", - "syscall.SysProcAttr": "syscall", - "syscall.SysProcIDMap": "syscall", - "syscall.Syscall": "syscall", - "syscall.Syscall12": "syscall", - "syscall.Syscall15": "syscall", - "syscall.Syscall6": "syscall", - "syscall.Syscall9": "syscall", - "syscall.Sysctl": "syscall", - "syscall.SysctlUint32": "syscall", - "syscall.Sysctlnode": "syscall", - "syscall.Sysinfo": "syscall", - "syscall.Sysinfo_t": "syscall", - "syscall.Systemtime": "syscall", - "syscall.TCGETS": "syscall", - "syscall.TCIFLUSH": "syscall", - "syscall.TCIOFLUSH": "syscall", - "syscall.TCOFLUSH": "syscall", - "syscall.TCPInfo": "syscall", - "syscall.TCPKeepalive": "syscall", - "syscall.TCP_CA_NAME_MAX": "syscall", - "syscall.TCP_CONGCTL": "syscall", - "syscall.TCP_CONGESTION": "syscall", - "syscall.TCP_CONNECTIONTIMEOUT": "syscall", - "syscall.TCP_CORK": "syscall", - "syscall.TCP_DEFER_ACCEPT": "syscall", - "syscall.TCP_INFO": "syscall", - "syscall.TCP_KEEPALIVE": "syscall", - "syscall.TCP_KEEPCNT": "syscall", - "syscall.TCP_KEEPIDLE": "syscall", - "syscall.TCP_KEEPINIT": "syscall", - "syscall.TCP_KEEPINTVL": "syscall", - "syscall.TCP_LINGER2": "syscall", - "syscall.TCP_MAXBURST": "syscall", - "syscall.TCP_MAXHLEN": "syscall", - "syscall.TCP_MAXOLEN": "syscall", - "syscall.TCP_MAXSEG": "syscall", - "syscall.TCP_MAXWIN": "syscall", - "syscall.TCP_MAX_SACK": "syscall", - "syscall.TCP_MAX_WINSHIFT": "syscall", - "syscall.TCP_MD5SIG": "syscall", - "syscall.TCP_MD5SIG_MAXKEYLEN": "syscall", - "syscall.TCP_MINMSS": "syscall", - "syscall.TCP_MINMSSOVERLOAD": "syscall", - "syscall.TCP_MSS": "syscall", - "syscall.TCP_NODELAY": "syscall", - "syscall.TCP_NOOPT": "syscall", - "syscall.TCP_NOPUSH": "syscall", - "syscall.TCP_NSTATES": "syscall", - "syscall.TCP_QUICKACK": "syscall", - "syscall.TCP_RXT_CONNDROPTIME": "syscall", - "syscall.TCP_RXT_FINDROP": "syscall", - "syscall.TCP_SACK_ENABLE": "syscall", - "syscall.TCP_SYNCNT": "syscall", - "syscall.TCP_VENDOR": "syscall", - "syscall.TCP_WINDOW_CLAMP": "syscall", - "syscall.TCSAFLUSH": "syscall", - "syscall.TCSETS": "syscall", - "syscall.TF_DISCONNECT": "syscall", - "syscall.TF_REUSE_SOCKET": "syscall", - "syscall.TF_USE_DEFAULT_WORKER": "syscall", - "syscall.TF_USE_KERNEL_APC": "syscall", - "syscall.TF_USE_SYSTEM_THREAD": "syscall", - "syscall.TF_WRITE_BEHIND": "syscall", - "syscall.TH32CS_INHERIT": "syscall", - "syscall.TH32CS_SNAPALL": "syscall", - "syscall.TH32CS_SNAPHEAPLIST": "syscall", - "syscall.TH32CS_SNAPMODULE": "syscall", - "syscall.TH32CS_SNAPMODULE32": "syscall", - "syscall.TH32CS_SNAPPROCESS": "syscall", - "syscall.TH32CS_SNAPTHREAD": "syscall", - "syscall.TIME_ZONE_ID_DAYLIGHT": "syscall", - "syscall.TIME_ZONE_ID_STANDARD": "syscall", - "syscall.TIME_ZONE_ID_UNKNOWN": "syscall", - "syscall.TIOCCBRK": "syscall", - "syscall.TIOCCDTR": "syscall", - "syscall.TIOCCONS": "syscall", - "syscall.TIOCDCDTIMESTAMP": "syscall", - "syscall.TIOCDRAIN": "syscall", - "syscall.TIOCDSIMICROCODE": "syscall", - "syscall.TIOCEXCL": "syscall", - "syscall.TIOCEXT": "syscall", - "syscall.TIOCFLAG_CDTRCTS": "syscall", - "syscall.TIOCFLAG_CLOCAL": "syscall", - "syscall.TIOCFLAG_CRTSCTS": "syscall", - "syscall.TIOCFLAG_MDMBUF": "syscall", - "syscall.TIOCFLAG_PPS": "syscall", - "syscall.TIOCFLAG_SOFTCAR": "syscall", - "syscall.TIOCFLUSH": "syscall", - "syscall.TIOCGDEV": "syscall", - "syscall.TIOCGDRAINWAIT": "syscall", - "syscall.TIOCGETA": "syscall", - "syscall.TIOCGETD": "syscall", - "syscall.TIOCGFLAGS": "syscall", - "syscall.TIOCGICOUNT": "syscall", - "syscall.TIOCGLCKTRMIOS": "syscall", - "syscall.TIOCGLINED": "syscall", - "syscall.TIOCGPGRP": "syscall", - "syscall.TIOCGPTN": "syscall", - "syscall.TIOCGQSIZE": "syscall", - "syscall.TIOCGRANTPT": "syscall", - "syscall.TIOCGRS485": "syscall", - "syscall.TIOCGSERIAL": "syscall", - "syscall.TIOCGSID": "syscall", - "syscall.TIOCGSIZE": "syscall", - "syscall.TIOCGSOFTCAR": "syscall", - "syscall.TIOCGTSTAMP": "syscall", - "syscall.TIOCGWINSZ": "syscall", - "syscall.TIOCINQ": "syscall", - "syscall.TIOCIXOFF": "syscall", - "syscall.TIOCIXON": "syscall", - "syscall.TIOCLINUX": "syscall", - "syscall.TIOCMBIC": "syscall", - "syscall.TIOCMBIS": "syscall", - "syscall.TIOCMGDTRWAIT": "syscall", - "syscall.TIOCMGET": "syscall", - "syscall.TIOCMIWAIT": "syscall", - "syscall.TIOCMODG": "syscall", - "syscall.TIOCMODS": "syscall", - "syscall.TIOCMSDTRWAIT": "syscall", - "syscall.TIOCMSET": "syscall", - "syscall.TIOCM_CAR": "syscall", - "syscall.TIOCM_CD": "syscall", - "syscall.TIOCM_CTS": "syscall", - "syscall.TIOCM_DCD": "syscall", - "syscall.TIOCM_DSR": "syscall", - "syscall.TIOCM_DTR": "syscall", - "syscall.TIOCM_LE": "syscall", - "syscall.TIOCM_RI": "syscall", - "syscall.TIOCM_RNG": "syscall", - "syscall.TIOCM_RTS": "syscall", - "syscall.TIOCM_SR": "syscall", - "syscall.TIOCM_ST": "syscall", - "syscall.TIOCNOTTY": "syscall", - "syscall.TIOCNXCL": "syscall", - "syscall.TIOCOUTQ": "syscall", - "syscall.TIOCPKT": "syscall", - "syscall.TIOCPKT_DATA": "syscall", - "syscall.TIOCPKT_DOSTOP": "syscall", - "syscall.TIOCPKT_FLUSHREAD": "syscall", - "syscall.TIOCPKT_FLUSHWRITE": "syscall", - "syscall.TIOCPKT_IOCTL": "syscall", - "syscall.TIOCPKT_NOSTOP": "syscall", - "syscall.TIOCPKT_START": "syscall", - "syscall.TIOCPKT_STOP": "syscall", - "syscall.TIOCPTMASTER": "syscall", - "syscall.TIOCPTMGET": "syscall", - "syscall.TIOCPTSNAME": "syscall", - "syscall.TIOCPTYGNAME": "syscall", - "syscall.TIOCPTYGRANT": "syscall", - "syscall.TIOCPTYUNLK": "syscall", - "syscall.TIOCRCVFRAME": "syscall", - "syscall.TIOCREMOTE": "syscall", - "syscall.TIOCSBRK": "syscall", - "syscall.TIOCSCONS": "syscall", - "syscall.TIOCSCTTY": "syscall", - "syscall.TIOCSDRAINWAIT": "syscall", - "syscall.TIOCSDTR": "syscall", - "syscall.TIOCSERCONFIG": "syscall", - "syscall.TIOCSERGETLSR": "syscall", - "syscall.TIOCSERGETMULTI": "syscall", - "syscall.TIOCSERGSTRUCT": "syscall", - "syscall.TIOCSERGWILD": "syscall", - "syscall.TIOCSERSETMULTI": "syscall", - "syscall.TIOCSERSWILD": "syscall", - "syscall.TIOCSER_TEMT": "syscall", - "syscall.TIOCSETA": "syscall", - "syscall.TIOCSETAF": "syscall", - "syscall.TIOCSETAW": "syscall", - "syscall.TIOCSETD": "syscall", - "syscall.TIOCSFLAGS": "syscall", - "syscall.TIOCSIG": "syscall", - "syscall.TIOCSLCKTRMIOS": "syscall", - "syscall.TIOCSLINED": "syscall", - "syscall.TIOCSPGRP": "syscall", - "syscall.TIOCSPTLCK": "syscall", - "syscall.TIOCSQSIZE": "syscall", - "syscall.TIOCSRS485": "syscall", - "syscall.TIOCSSERIAL": "syscall", - "syscall.TIOCSSIZE": "syscall", - "syscall.TIOCSSOFTCAR": "syscall", - "syscall.TIOCSTART": "syscall", - "syscall.TIOCSTAT": "syscall", - "syscall.TIOCSTI": "syscall", - "syscall.TIOCSTOP": "syscall", - "syscall.TIOCSTSTAMP": "syscall", - "syscall.TIOCSWINSZ": "syscall", - "syscall.TIOCTIMESTAMP": "syscall", - "syscall.TIOCUCNTL": "syscall", - "syscall.TIOCVHANGUP": "syscall", - "syscall.TIOCXMTFRAME": "syscall", - "syscall.TOKEN_ADJUST_DEFAULT": "syscall", - "syscall.TOKEN_ADJUST_GROUPS": "syscall", - "syscall.TOKEN_ADJUST_PRIVILEGES": "syscall", - "syscall.TOKEN_ALL_ACCESS": "syscall", - "syscall.TOKEN_ASSIGN_PRIMARY": "syscall", - "syscall.TOKEN_DUPLICATE": "syscall", - "syscall.TOKEN_EXECUTE": "syscall", - "syscall.TOKEN_IMPERSONATE": "syscall", - "syscall.TOKEN_QUERY": "syscall", - "syscall.TOKEN_QUERY_SOURCE": "syscall", - "syscall.TOKEN_READ": "syscall", - "syscall.TOKEN_WRITE": "syscall", - "syscall.TOSTOP": "syscall", - "syscall.TRUNCATE_EXISTING": "syscall", - "syscall.TUNATTACHFILTER": "syscall", - "syscall.TUNDETACHFILTER": "syscall", - "syscall.TUNGETFEATURES": "syscall", - "syscall.TUNGETIFF": "syscall", - "syscall.TUNGETSNDBUF": "syscall", - "syscall.TUNGETVNETHDRSZ": "syscall", - "syscall.TUNSETDEBUG": "syscall", - "syscall.TUNSETGROUP": "syscall", - "syscall.TUNSETIFF": "syscall", - "syscall.TUNSETLINK": "syscall", - "syscall.TUNSETNOCSUM": "syscall", - "syscall.TUNSETOFFLOAD": "syscall", - "syscall.TUNSETOWNER": "syscall", - "syscall.TUNSETPERSIST": "syscall", - "syscall.TUNSETSNDBUF": "syscall", - "syscall.TUNSETTXFILTER": "syscall", - "syscall.TUNSETVNETHDRSZ": "syscall", - "syscall.Tee": "syscall", - "syscall.TerminateProcess": "syscall", - "syscall.Termios": "syscall", - "syscall.Tgkill": "syscall", - "syscall.Time": "syscall", - "syscall.Time_t": "syscall", - "syscall.Times": "syscall", - "syscall.Timespec": "syscall", - "syscall.TimespecToNsec": "syscall", - "syscall.Timeval": "syscall", - "syscall.Timeval32": "syscall", - "syscall.TimevalToNsec": "syscall", - "syscall.Timex": "syscall", - "syscall.Timezoneinformation": "syscall", - "syscall.Tms": "syscall", - "syscall.Token": "syscall", - "syscall.TokenAccessInformation": "syscall", - "syscall.TokenAuditPolicy": "syscall", - "syscall.TokenDefaultDacl": "syscall", - "syscall.TokenElevation": "syscall", - "syscall.TokenElevationType": "syscall", - "syscall.TokenGroups": "syscall", - "syscall.TokenGroupsAndPrivileges": "syscall", - "syscall.TokenHasRestrictions": "syscall", - "syscall.TokenImpersonationLevel": "syscall", - "syscall.TokenIntegrityLevel": "syscall", - "syscall.TokenLinkedToken": "syscall", - "syscall.TokenLogonSid": "syscall", - "syscall.TokenMandatoryPolicy": "syscall", - "syscall.TokenOrigin": "syscall", - "syscall.TokenOwner": "syscall", - "syscall.TokenPrimaryGroup": "syscall", - "syscall.TokenPrivileges": "syscall", - "syscall.TokenRestrictedSids": "syscall", - "syscall.TokenSandBoxInert": "syscall", - "syscall.TokenSessionId": "syscall", - "syscall.TokenSessionReference": "syscall", - "syscall.TokenSource": "syscall", - "syscall.TokenStatistics": "syscall", - "syscall.TokenType": "syscall", - "syscall.TokenUIAccess": "syscall", - "syscall.TokenUser": "syscall", - "syscall.TokenVirtualizationAllowed": "syscall", - "syscall.TokenVirtualizationEnabled": "syscall", - "syscall.Tokenprimarygroup": "syscall", - "syscall.Tokenuser": "syscall", - "syscall.TranslateAccountName": "syscall", - "syscall.TranslateName": "syscall", - "syscall.TransmitFile": "syscall", - "syscall.TransmitFileBuffers": "syscall", - "syscall.Truncate": "syscall", - "syscall.USAGE_MATCH_TYPE_AND": "syscall", - "syscall.USAGE_MATCH_TYPE_OR": "syscall", - "syscall.UTF16FromString": "syscall", - "syscall.UTF16PtrFromString": "syscall", - "syscall.UTF16ToString": "syscall", - "syscall.Ucred": "syscall", - "syscall.Umask": "syscall", - "syscall.Uname": "syscall", - "syscall.Undelete": "syscall", - "syscall.UnixCredentials": "syscall", - "syscall.UnixRights": "syscall", - "syscall.Unlink": "syscall", - "syscall.Unlinkat": "syscall", - "syscall.UnmapViewOfFile": "syscall", - "syscall.Unmount": "syscall", - "syscall.Unsetenv": "syscall", - "syscall.Unshare": "syscall", - "syscall.UserInfo10": "syscall", - "syscall.Ustat": "syscall", - "syscall.Ustat_t": "syscall", - "syscall.Utimbuf": "syscall", - "syscall.Utime": "syscall", - "syscall.Utimes": "syscall", - "syscall.UtimesNano": "syscall", - "syscall.Utsname": "syscall", - "syscall.VDISCARD": "syscall", - "syscall.VDSUSP": "syscall", - "syscall.VEOF": "syscall", - "syscall.VEOL": "syscall", - "syscall.VEOL2": "syscall", - "syscall.VERASE": "syscall", - "syscall.VERASE2": "syscall", - "syscall.VINTR": "syscall", - "syscall.VKILL": "syscall", - "syscall.VLNEXT": "syscall", - "syscall.VMIN": "syscall", - "syscall.VQUIT": "syscall", - "syscall.VREPRINT": "syscall", - "syscall.VSTART": "syscall", - "syscall.VSTATUS": "syscall", - "syscall.VSTOP": "syscall", - "syscall.VSUSP": "syscall", - "syscall.VSWTC": "syscall", - "syscall.VT0": "syscall", - "syscall.VT1": "syscall", - "syscall.VTDLY": "syscall", - "syscall.VTIME": "syscall", - "syscall.VWERASE": "syscall", - "syscall.VirtualLock": "syscall", - "syscall.VirtualUnlock": "syscall", - "syscall.WAIT_ABANDONED": "syscall", - "syscall.WAIT_FAILED": "syscall", - "syscall.WAIT_OBJECT_0": "syscall", - "syscall.WAIT_TIMEOUT": "syscall", - "syscall.WALL": "syscall", - "syscall.WALLSIG": "syscall", - "syscall.WALTSIG": "syscall", - "syscall.WCLONE": "syscall", - "syscall.WCONTINUED": "syscall", - "syscall.WCOREFLAG": "syscall", - "syscall.WEXITED": "syscall", - "syscall.WLINUXCLONE": "syscall", - "syscall.WNOHANG": "syscall", - "syscall.WNOTHREAD": "syscall", - "syscall.WNOWAIT": "syscall", - "syscall.WNOZOMBIE": "syscall", - "syscall.WOPTSCHECKED": "syscall", - "syscall.WORDSIZE": "syscall", - "syscall.WSABuf": "syscall", - "syscall.WSACleanup": "syscall", - "syscall.WSADESCRIPTION_LEN": "syscall", - "syscall.WSAData": "syscall", - "syscall.WSAEACCES": "syscall", - "syscall.WSAECONNRESET": "syscall", - "syscall.WSAEnumProtocols": "syscall", - "syscall.WSAID_CONNECTEX": "syscall", - "syscall.WSAIoctl": "syscall", - "syscall.WSAPROTOCOL_LEN": "syscall", - "syscall.WSAProtocolChain": "syscall", - "syscall.WSAProtocolInfo": "syscall", - "syscall.WSARecv": "syscall", - "syscall.WSARecvFrom": "syscall", - "syscall.WSASYS_STATUS_LEN": "syscall", - "syscall.WSASend": "syscall", - "syscall.WSASendTo": "syscall", - "syscall.WSASendto": "syscall", - "syscall.WSAStartup": "syscall", - "syscall.WSTOPPED": "syscall", - "syscall.WTRAPPED": "syscall", - "syscall.WUNTRACED": "syscall", - "syscall.Wait4": "syscall", - "syscall.WaitForSingleObject": "syscall", - "syscall.WaitStatus": "syscall", - "syscall.Win32FileAttributeData": "syscall", - "syscall.Win32finddata": "syscall", - "syscall.Write": "syscall", - "syscall.WriteConsole": "syscall", - "syscall.WriteFile": "syscall", - "syscall.X509_ASN_ENCODING": "syscall", - "syscall.XCASE": "syscall", - "syscall.XP1_CONNECTIONLESS": "syscall", - "syscall.XP1_CONNECT_DATA": "syscall", - "syscall.XP1_DISCONNECT_DATA": "syscall", - "syscall.XP1_EXPEDITED_DATA": "syscall", - "syscall.XP1_GRACEFUL_CLOSE": "syscall", - "syscall.XP1_GUARANTEED_DELIVERY": "syscall", - "syscall.XP1_GUARANTEED_ORDER": "syscall", - "syscall.XP1_IFS_HANDLES": "syscall", - "syscall.XP1_MESSAGE_ORIENTED": "syscall", - "syscall.XP1_MULTIPOINT_CONTROL_PLANE": "syscall", - "syscall.XP1_MULTIPOINT_DATA_PLANE": "syscall", - "syscall.XP1_PARTIAL_MESSAGE": "syscall", - "syscall.XP1_PSEUDO_STREAM": "syscall", - "syscall.XP1_QOS_SUPPORTED": "syscall", - "syscall.XP1_SAN_SUPPORT_SDP": "syscall", - "syscall.XP1_SUPPORT_BROADCAST": "syscall", - "syscall.XP1_SUPPORT_MULTIPOINT": "syscall", - "syscall.XP1_UNI_RECV": "syscall", - "syscall.XP1_UNI_SEND": "syscall", - "syslog.Dial": "log/syslog", - "syslog.LOG_ALERT": "log/syslog", - "syslog.LOG_AUTH": "log/syslog", - "syslog.LOG_AUTHPRIV": "log/syslog", - "syslog.LOG_CRIT": "log/syslog", - "syslog.LOG_CRON": "log/syslog", - "syslog.LOG_DAEMON": "log/syslog", - "syslog.LOG_DEBUG": "log/syslog", - "syslog.LOG_EMERG": "log/syslog", - "syslog.LOG_ERR": "log/syslog", - "syslog.LOG_FTP": "log/syslog", - "syslog.LOG_INFO": "log/syslog", - "syslog.LOG_KERN": "log/syslog", - "syslog.LOG_LOCAL0": "log/syslog", - "syslog.LOG_LOCAL1": "log/syslog", - "syslog.LOG_LOCAL2": "log/syslog", - "syslog.LOG_LOCAL3": "log/syslog", - "syslog.LOG_LOCAL4": "log/syslog", - "syslog.LOG_LOCAL5": "log/syslog", - "syslog.LOG_LOCAL6": "log/syslog", - "syslog.LOG_LOCAL7": "log/syslog", - "syslog.LOG_LPR": "log/syslog", - "syslog.LOG_MAIL": "log/syslog", - "syslog.LOG_NEWS": "log/syslog", - "syslog.LOG_NOTICE": "log/syslog", - "syslog.LOG_SYSLOG": "log/syslog", - "syslog.LOG_USER": "log/syslog", - "syslog.LOG_UUCP": "log/syslog", - "syslog.LOG_WARNING": "log/syslog", - "syslog.New": "log/syslog", - "syslog.NewLogger": "log/syslog", - "syslog.Priority": "log/syslog", - "syslog.Writer": "log/syslog", - "tabwriter.AlignRight": "text/tabwriter", - "tabwriter.Debug": "text/tabwriter", - "tabwriter.DiscardEmptyColumns": "text/tabwriter", - "tabwriter.Escape": "text/tabwriter", - "tabwriter.FilterHTML": "text/tabwriter", - "tabwriter.NewWriter": "text/tabwriter", - "tabwriter.StripEscape": "text/tabwriter", - "tabwriter.TabIndent": "text/tabwriter", - "tabwriter.Writer": "text/tabwriter", - "tar.ErrFieldTooLong": "archive/tar", - "tar.ErrHeader": "archive/tar", - "tar.ErrWriteAfterClose": "archive/tar", - "tar.ErrWriteTooLong": "archive/tar", - "tar.FileInfoHeader": "archive/tar", - "tar.Header": "archive/tar", - "tar.NewReader": "archive/tar", - "tar.NewWriter": "archive/tar", - "tar.Reader": "archive/tar", - "tar.TypeBlock": "archive/tar", - "tar.TypeChar": "archive/tar", - "tar.TypeCont": "archive/tar", - "tar.TypeDir": "archive/tar", - "tar.TypeFifo": "archive/tar", - "tar.TypeGNULongLink": "archive/tar", - "tar.TypeGNULongName": "archive/tar", - "tar.TypeGNUSparse": "archive/tar", - "tar.TypeLink": "archive/tar", - "tar.TypeReg": "archive/tar", - "tar.TypeRegA": "archive/tar", - "tar.TypeSymlink": "archive/tar", - "tar.TypeXGlobalHeader": "archive/tar", - "tar.TypeXHeader": "archive/tar", - "tar.Writer": "archive/tar", - "template.CSS": "html/template", - "template.ErrAmbigContext": "html/template", - "template.ErrBadHTML": "html/template", - "template.ErrBranchEnd": "html/template", - "template.ErrEndContext": "html/template", - "template.ErrNoSuchTemplate": "html/template", - "template.ErrOutputContext": "html/template", - "template.ErrPartialCharset": "html/template", - "template.ErrPartialEscape": "html/template", - "template.ErrRangeLoopReentry": "html/template", - "template.ErrSlashAmbig": "html/template", - "template.Error": "html/template", - "template.ErrorCode": "html/template", - "template.ExecError": "text/template", - // "template.FuncMap" is ambiguous - "template.HTML": "html/template", - "template.HTMLAttr": "html/template", - // "template.HTMLEscape" is ambiguous - // "template.HTMLEscapeString" is ambiguous - // "template.HTMLEscaper" is ambiguous - // "template.IsTrue" is ambiguous - "template.JS": "html/template", - // "template.JSEscape" is ambiguous - // "template.JSEscapeString" is ambiguous - // "template.JSEscaper" is ambiguous - "template.JSStr": "html/template", - // "template.Must" is ambiguous - // "template.New" is ambiguous - "template.OK": "html/template", - // "template.ParseFiles" is ambiguous - // "template.ParseGlob" is ambiguous - // "template.Template" is ambiguous - "template.URL": "html/template", - // "template.URLQueryEscaper" is ambiguous - "testing.AllocsPerRun": "testing", - "testing.B": "testing", - "testing.Benchmark": "testing", - "testing.BenchmarkResult": "testing", - "testing.Cover": "testing", - "testing.CoverBlock": "testing", - "testing.Coverage": "testing", - "testing.InternalBenchmark": "testing", - "testing.InternalExample": "testing", - "testing.InternalTest": "testing", - "testing.M": "testing", - "testing.Main": "testing", - "testing.MainStart": "testing", - "testing.PB": "testing", - "testing.RegisterCover": "testing", - "testing.RunBenchmarks": "testing", - "testing.RunExamples": "testing", - "testing.RunTests": "testing", - "testing.Short": "testing", - "testing.T": "testing", - "testing.Verbose": "testing", - "textproto.CanonicalMIMEHeaderKey": "net/textproto", - "textproto.Conn": "net/textproto", - "textproto.Dial": "net/textproto", - "textproto.Error": "net/textproto", - "textproto.MIMEHeader": "net/textproto", - "textproto.NewConn": "net/textproto", - "textproto.NewReader": "net/textproto", - "textproto.NewWriter": "net/textproto", - "textproto.Pipeline": "net/textproto", - "textproto.ProtocolError": "net/textproto", - "textproto.Reader": "net/textproto", - "textproto.TrimBytes": "net/textproto", - "textproto.TrimString": "net/textproto", - "textproto.Writer": "net/textproto", - "time.ANSIC": "time", - "time.After": "time", - "time.AfterFunc": "time", - "time.April": "time", - "time.August": "time", - "time.Date": "time", - "time.December": "time", - "time.Duration": "time", - "time.February": "time", - "time.FixedZone": "time", - "time.Friday": "time", - "time.Hour": "time", - "time.January": "time", - "time.July": "time", - "time.June": "time", - "time.Kitchen": "time", - "time.LoadLocation": "time", - "time.Local": "time", - "time.Location": "time", - "time.March": "time", - "time.May": "time", - "time.Microsecond": "time", - "time.Millisecond": "time", - "time.Minute": "time", - "time.Monday": "time", - "time.Month": "time", - "time.Nanosecond": "time", - "time.NewTicker": "time", - "time.NewTimer": "time", - "time.November": "time", - "time.Now": "time", - "time.October": "time", - "time.Parse": "time", - "time.ParseDuration": "time", - "time.ParseError": "time", - "time.ParseInLocation": "time", - "time.RFC1123": "time", - "time.RFC1123Z": "time", - "time.RFC3339": "time", - "time.RFC3339Nano": "time", - "time.RFC822": "time", - "time.RFC822Z": "time", - "time.RFC850": "time", - "time.RubyDate": "time", - "time.Saturday": "time", - "time.Second": "time", - "time.September": "time", - "time.Since": "time", - "time.Sleep": "time", - "time.Stamp": "time", - "time.StampMicro": "time", - "time.StampMilli": "time", - "time.StampNano": "time", - "time.Sunday": "time", - "time.Thursday": "time", - "time.Tick": "time", - "time.Ticker": "time", - "time.Time": "time", - "time.Timer": "time", - "time.Tuesday": "time", - "time.UTC": "time", - "time.Unix": "time", - "time.UnixDate": "time", - "time.Wednesday": "time", - "time.Weekday": "time", - "tls.Certificate": "crypto/tls", - "tls.Client": "crypto/tls", - "tls.ClientAuthType": "crypto/tls", - "tls.ClientHelloInfo": "crypto/tls", - "tls.ClientSessionCache": "crypto/tls", - "tls.ClientSessionState": "crypto/tls", - "tls.Config": "crypto/tls", - "tls.Conn": "crypto/tls", - "tls.ConnectionState": "crypto/tls", - "tls.CurveID": "crypto/tls", - "tls.CurveP256": "crypto/tls", - "tls.CurveP384": "crypto/tls", - "tls.CurveP521": "crypto/tls", - "tls.Dial": "crypto/tls", - "tls.DialWithDialer": "crypto/tls", - "tls.Listen": "crypto/tls", - "tls.LoadX509KeyPair": "crypto/tls", - "tls.NewLRUClientSessionCache": "crypto/tls", - "tls.NewListener": "crypto/tls", - "tls.NoClientCert": "crypto/tls", - "tls.RecordHeaderError": "crypto/tls", - "tls.RequestClientCert": "crypto/tls", - "tls.RequireAndVerifyClientCert": "crypto/tls", - "tls.RequireAnyClientCert": "crypto/tls", - "tls.Server": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.TLS_FALLBACK_SCSV": "crypto/tls", - "tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_RSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.VerifyClientCertIfGiven": "crypto/tls", - "tls.VersionSSL30": "crypto/tls", - "tls.VersionTLS10": "crypto/tls", - "tls.VersionTLS11": "crypto/tls", - "tls.VersionTLS12": "crypto/tls", - "tls.X509KeyPair": "crypto/tls", - "token.ADD": "go/token", - "token.ADD_ASSIGN": "go/token", - "token.AND": "go/token", - "token.AND_ASSIGN": "go/token", - "token.AND_NOT": "go/token", - "token.AND_NOT_ASSIGN": "go/token", - "token.ARROW": "go/token", - "token.ASSIGN": "go/token", - "token.BREAK": "go/token", - "token.CASE": "go/token", - "token.CHAN": "go/token", - "token.CHAR": "go/token", - "token.COLON": "go/token", - "token.COMMA": "go/token", - "token.COMMENT": "go/token", - "token.CONST": "go/token", - "token.CONTINUE": "go/token", - "token.DEC": "go/token", - "token.DEFAULT": "go/token", - "token.DEFER": "go/token", - "token.DEFINE": "go/token", - "token.ELLIPSIS": "go/token", - "token.ELSE": "go/token", - "token.EOF": "go/token", - "token.EQL": "go/token", - "token.FALLTHROUGH": "go/token", - "token.FLOAT": "go/token", - "token.FOR": "go/token", - "token.FUNC": "go/token", - "token.File": "go/token", - "token.FileSet": "go/token", - "token.GEQ": "go/token", - "token.GO": "go/token", - "token.GOTO": "go/token", - "token.GTR": "go/token", - "token.HighestPrec": "go/token", - "token.IDENT": "go/token", - "token.IF": "go/token", - "token.ILLEGAL": "go/token", - "token.IMAG": "go/token", - "token.IMPORT": "go/token", - "token.INC": "go/token", - "token.INT": "go/token", - "token.INTERFACE": "go/token", - "token.LAND": "go/token", - "token.LBRACE": "go/token", - "token.LBRACK": "go/token", - "token.LEQ": "go/token", - "token.LOR": "go/token", - "token.LPAREN": "go/token", - "token.LSS": "go/token", - "token.Lookup": "go/token", - "token.LowestPrec": "go/token", - "token.MAP": "go/token", - "token.MUL": "go/token", - "token.MUL_ASSIGN": "go/token", - "token.NEQ": "go/token", - "token.NOT": "go/token", - "token.NewFileSet": "go/token", - "token.NoPos": "go/token", - "token.OR": "go/token", - "token.OR_ASSIGN": "go/token", - "token.PACKAGE": "go/token", - "token.PERIOD": "go/token", - "token.Pos": "go/token", - "token.Position": "go/token", - "token.QUO": "go/token", - "token.QUO_ASSIGN": "go/token", - "token.RANGE": "go/token", - "token.RBRACE": "go/token", - "token.RBRACK": "go/token", - "token.REM": "go/token", - "token.REM_ASSIGN": "go/token", - "token.RETURN": "go/token", - "token.RPAREN": "go/token", - "token.SELECT": "go/token", - "token.SEMICOLON": "go/token", - "token.SHL": "go/token", - "token.SHL_ASSIGN": "go/token", - "token.SHR": "go/token", - "token.SHR_ASSIGN": "go/token", - "token.STRING": "go/token", - "token.STRUCT": "go/token", - "token.SUB": "go/token", - "token.SUB_ASSIGN": "go/token", - "token.SWITCH": "go/token", - "token.TYPE": "go/token", - "token.Token": "go/token", - "token.UnaryPrec": "go/token", - "token.VAR": "go/token", - "token.XOR": "go/token", - "token.XOR_ASSIGN": "go/token", - "trace.Start": "runtime/trace", - "trace.Stop": "runtime/trace", - "types.Array": "go/types", - "types.AssertableTo": "go/types", - "types.AssignableTo": "go/types", - "types.Basic": "go/types", - "types.BasicInfo": "go/types", - "types.BasicKind": "go/types", - "types.Bool": "go/types", - "types.Builtin": "go/types", - "types.Byte": "go/types", - "types.Chan": "go/types", - "types.ChanDir": "go/types", - "types.Checker": "go/types", - "types.Comparable": "go/types", - "types.Complex128": "go/types", - "types.Complex64": "go/types", - "types.Config": "go/types", - "types.Const": "go/types", - "types.ConvertibleTo": "go/types", - "types.DefPredeclaredTestFuncs": "go/types", - "types.Error": "go/types", - "types.Eval": "go/types", - "types.ExprString": "go/types", - "types.FieldVal": "go/types", - "types.Float32": "go/types", - "types.Float64": "go/types", - "types.Func": "go/types", - "types.Id": "go/types", - "types.Identical": "go/types", - "types.Implements": "go/types", - "types.ImportMode": "go/types", - "types.Importer": "go/types", - "types.ImporterFrom": "go/types", - "types.Info": "go/types", - "types.Initializer": "go/types", - "types.Int": "go/types", - "types.Int16": "go/types", - "types.Int32": "go/types", - "types.Int64": "go/types", - "types.Int8": "go/types", - "types.Interface": "go/types", - "types.Invalid": "go/types", - "types.IsBoolean": "go/types", - "types.IsComplex": "go/types", - "types.IsConstType": "go/types", - "types.IsFloat": "go/types", - "types.IsInteger": "go/types", - "types.IsInterface": "go/types", - "types.IsNumeric": "go/types", - "types.IsOrdered": "go/types", - "types.IsString": "go/types", - "types.IsUnsigned": "go/types", - "types.IsUntyped": "go/types", - "types.Label": "go/types", - "types.LookupFieldOrMethod": "go/types", - "types.Map": "go/types", - "types.MethodExpr": "go/types", - "types.MethodSet": "go/types", - "types.MethodVal": "go/types", - "types.MissingMethod": "go/types", - "types.Named": "go/types", - "types.NewArray": "go/types", - "types.NewChan": "go/types", - "types.NewChecker": "go/types", - "types.NewConst": "go/types", - "types.NewField": "go/types", - "types.NewFunc": "go/types", - "types.NewInterface": "go/types", - "types.NewLabel": "go/types", - "types.NewMap": "go/types", - "types.NewMethodSet": "go/types", - "types.NewNamed": "go/types", - "types.NewPackage": "go/types", - "types.NewParam": "go/types", - "types.NewPkgName": "go/types", - "types.NewPointer": "go/types", - "types.NewScope": "go/types", - "types.NewSignature": "go/types", - "types.NewSlice": "go/types", - "types.NewStruct": "go/types", - "types.NewTuple": "go/types", - "types.NewTypeName": "go/types", - "types.NewVar": "go/types", - "types.Nil": "go/types", - "types.ObjectString": "go/types", - "types.Package": "go/types", - "types.PkgName": "go/types", - "types.Pointer": "go/types", - "types.Qualifier": "go/types", - "types.RecvOnly": "go/types", - "types.RelativeTo": "go/types", - "types.Rune": "go/types", - "types.Scope": "go/types", - "types.Selection": "go/types", - "types.SelectionKind": "go/types", - "types.SelectionString": "go/types", - "types.SendOnly": "go/types", - "types.SendRecv": "go/types", - "types.Signature": "go/types", - "types.Sizes": "go/types", - "types.Slice": "go/types", - "types.StdSizes": "go/types", - "types.String": "go/types", - "types.Struct": "go/types", - "types.Tuple": "go/types", - "types.Typ": "go/types", - "types.Type": "go/types", - "types.TypeAndValue": "go/types", - "types.TypeName": "go/types", - "types.TypeString": "go/types", - "types.Uint": "go/types", - "types.Uint16": "go/types", - "types.Uint32": "go/types", - "types.Uint64": "go/types", - "types.Uint8": "go/types", - "types.Uintptr": "go/types", - "types.Universe": "go/types", - "types.Unsafe": "go/types", - "types.UnsafePointer": "go/types", - "types.UntypedBool": "go/types", - "types.UntypedComplex": "go/types", - "types.UntypedFloat": "go/types", - "types.UntypedInt": "go/types", - "types.UntypedNil": "go/types", - "types.UntypedRune": "go/types", - "types.UntypedString": "go/types", - "types.Var": "go/types", - "types.WriteExpr": "go/types", - "types.WriteSignature": "go/types", - "types.WriteType": "go/types", - "unicode.ASCII_Hex_Digit": "unicode", - "unicode.Ahom": "unicode", - "unicode.Anatolian_Hieroglyphs": "unicode", - "unicode.Arabic": "unicode", - "unicode.Armenian": "unicode", - "unicode.Avestan": "unicode", - "unicode.AzeriCase": "unicode", - "unicode.Balinese": "unicode", - "unicode.Bamum": "unicode", - "unicode.Bassa_Vah": "unicode", - "unicode.Batak": "unicode", - "unicode.Bengali": "unicode", - "unicode.Bidi_Control": "unicode", - "unicode.Bopomofo": "unicode", - "unicode.Brahmi": "unicode", - "unicode.Braille": "unicode", - "unicode.Buginese": "unicode", - "unicode.Buhid": "unicode", - "unicode.C": "unicode", - "unicode.Canadian_Aboriginal": "unicode", - "unicode.Carian": "unicode", - "unicode.CaseRange": "unicode", - "unicode.CaseRanges": "unicode", - "unicode.Categories": "unicode", - "unicode.Caucasian_Albanian": "unicode", - "unicode.Cc": "unicode", - "unicode.Cf": "unicode", - "unicode.Chakma": "unicode", - "unicode.Cham": "unicode", - "unicode.Cherokee": "unicode", - "unicode.Co": "unicode", - "unicode.Common": "unicode", - "unicode.Coptic": "unicode", - "unicode.Cs": "unicode", - "unicode.Cuneiform": "unicode", - "unicode.Cypriot": "unicode", - "unicode.Cyrillic": "unicode", - "unicode.Dash": "unicode", - "unicode.Deprecated": "unicode", - "unicode.Deseret": "unicode", - "unicode.Devanagari": "unicode", - "unicode.Diacritic": "unicode", - "unicode.Digit": "unicode", - "unicode.Duployan": "unicode", - "unicode.Egyptian_Hieroglyphs": "unicode", - "unicode.Elbasan": "unicode", - "unicode.Ethiopic": "unicode", - "unicode.Extender": "unicode", - "unicode.FoldCategory": "unicode", - "unicode.FoldScript": "unicode", - "unicode.Georgian": "unicode", - "unicode.Glagolitic": "unicode", - "unicode.Gothic": "unicode", - "unicode.Grantha": "unicode", - "unicode.GraphicRanges": "unicode", - "unicode.Greek": "unicode", - "unicode.Gujarati": "unicode", - "unicode.Gurmukhi": "unicode", - "unicode.Han": "unicode", - "unicode.Hangul": "unicode", - "unicode.Hanunoo": "unicode", - "unicode.Hatran": "unicode", - "unicode.Hebrew": "unicode", - "unicode.Hex_Digit": "unicode", - "unicode.Hiragana": "unicode", - "unicode.Hyphen": "unicode", - "unicode.IDS_Binary_Operator": "unicode", - "unicode.IDS_Trinary_Operator": "unicode", - "unicode.Ideographic": "unicode", - "unicode.Imperial_Aramaic": "unicode", - "unicode.In": "unicode", - "unicode.Inherited": "unicode", - "unicode.Inscriptional_Pahlavi": "unicode", - "unicode.Inscriptional_Parthian": "unicode", - "unicode.Is": "unicode", - "unicode.IsControl": "unicode", - "unicode.IsDigit": "unicode", - "unicode.IsGraphic": "unicode", - "unicode.IsLetter": "unicode", - "unicode.IsLower": "unicode", - "unicode.IsMark": "unicode", - "unicode.IsNumber": "unicode", - "unicode.IsOneOf": "unicode", - "unicode.IsPrint": "unicode", - "unicode.IsPunct": "unicode", - "unicode.IsSpace": "unicode", - "unicode.IsSymbol": "unicode", - "unicode.IsTitle": "unicode", - "unicode.IsUpper": "unicode", - "unicode.Javanese": "unicode", - "unicode.Join_Control": "unicode", - "unicode.Kaithi": "unicode", - "unicode.Kannada": "unicode", - "unicode.Katakana": "unicode", - "unicode.Kayah_Li": "unicode", - "unicode.Kharoshthi": "unicode", - "unicode.Khmer": "unicode", - "unicode.Khojki": "unicode", - "unicode.Khudawadi": "unicode", - "unicode.L": "unicode", - "unicode.Lao": "unicode", - "unicode.Latin": "unicode", - "unicode.Lepcha": "unicode", - "unicode.Letter": "unicode", - "unicode.Limbu": "unicode", - "unicode.Linear_A": "unicode", - "unicode.Linear_B": "unicode", - "unicode.Lisu": "unicode", - "unicode.Ll": "unicode", - "unicode.Lm": "unicode", - "unicode.Lo": "unicode", - "unicode.Logical_Order_Exception": "unicode", - "unicode.Lower": "unicode", - "unicode.LowerCase": "unicode", - "unicode.Lt": "unicode", - "unicode.Lu": "unicode", - "unicode.Lycian": "unicode", - "unicode.Lydian": "unicode", - "unicode.M": "unicode", - "unicode.Mahajani": "unicode", - "unicode.Malayalam": "unicode", - "unicode.Mandaic": "unicode", - "unicode.Manichaean": "unicode", - "unicode.Mark": "unicode", - "unicode.MaxASCII": "unicode", - "unicode.MaxCase": "unicode", - "unicode.MaxLatin1": "unicode", - "unicode.MaxRune": "unicode", - "unicode.Mc": "unicode", - "unicode.Me": "unicode", - "unicode.Meetei_Mayek": "unicode", - "unicode.Mende_Kikakui": "unicode", - "unicode.Meroitic_Cursive": "unicode", - "unicode.Meroitic_Hieroglyphs": "unicode", - "unicode.Miao": "unicode", - "unicode.Mn": "unicode", - "unicode.Modi": "unicode", - "unicode.Mongolian": "unicode", - "unicode.Mro": "unicode", - "unicode.Multani": "unicode", - "unicode.Myanmar": "unicode", - "unicode.N": "unicode", - "unicode.Nabataean": "unicode", - "unicode.Nd": "unicode", - "unicode.New_Tai_Lue": "unicode", - "unicode.Nko": "unicode", - "unicode.Nl": "unicode", - "unicode.No": "unicode", - "unicode.Noncharacter_Code_Point": "unicode", - "unicode.Number": "unicode", - "unicode.Ogham": "unicode", - "unicode.Ol_Chiki": "unicode", - "unicode.Old_Hungarian": "unicode", - "unicode.Old_Italic": "unicode", - "unicode.Old_North_Arabian": "unicode", - "unicode.Old_Permic": "unicode", - "unicode.Old_Persian": "unicode", - "unicode.Old_South_Arabian": "unicode", - "unicode.Old_Turkic": "unicode", - "unicode.Oriya": "unicode", - "unicode.Osmanya": "unicode", - "unicode.Other": "unicode", - "unicode.Other_Alphabetic": "unicode", - "unicode.Other_Default_Ignorable_Code_Point": "unicode", - "unicode.Other_Grapheme_Extend": "unicode", - "unicode.Other_ID_Continue": "unicode", - "unicode.Other_ID_Start": "unicode", - "unicode.Other_Lowercase": "unicode", - "unicode.Other_Math": "unicode", - "unicode.Other_Uppercase": "unicode", - "unicode.P": "unicode", - "unicode.Pahawh_Hmong": "unicode", - "unicode.Palmyrene": "unicode", - "unicode.Pattern_Syntax": "unicode", - "unicode.Pattern_White_Space": "unicode", - "unicode.Pau_Cin_Hau": "unicode", - "unicode.Pc": "unicode", - "unicode.Pd": "unicode", - "unicode.Pe": "unicode", - "unicode.Pf": "unicode", - "unicode.Phags_Pa": "unicode", - "unicode.Phoenician": "unicode", - "unicode.Pi": "unicode", - "unicode.Po": "unicode", - "unicode.PrintRanges": "unicode", - "unicode.Properties": "unicode", - "unicode.Ps": "unicode", - "unicode.Psalter_Pahlavi": "unicode", - "unicode.Punct": "unicode", - "unicode.Quotation_Mark": "unicode", - "unicode.Radical": "unicode", - "unicode.Range16": "unicode", - "unicode.Range32": "unicode", - "unicode.RangeTable": "unicode", - "unicode.Rejang": "unicode", - "unicode.ReplacementChar": "unicode", - "unicode.Runic": "unicode", - "unicode.S": "unicode", - "unicode.STerm": "unicode", - "unicode.Samaritan": "unicode", - "unicode.Saurashtra": "unicode", - "unicode.Sc": "unicode", - "unicode.Scripts": "unicode", - "unicode.Sharada": "unicode", - "unicode.Shavian": "unicode", - "unicode.Siddham": "unicode", - "unicode.SignWriting": "unicode", - "unicode.SimpleFold": "unicode", - "unicode.Sinhala": "unicode", - "unicode.Sk": "unicode", - "unicode.Sm": "unicode", - "unicode.So": "unicode", - "unicode.Soft_Dotted": "unicode", - "unicode.Sora_Sompeng": "unicode", - "unicode.Space": "unicode", - "unicode.SpecialCase": "unicode", - "unicode.Sundanese": "unicode", - "unicode.Syloti_Nagri": "unicode", - "unicode.Symbol": "unicode", - "unicode.Syriac": "unicode", - "unicode.Tagalog": "unicode", - "unicode.Tagbanwa": "unicode", - "unicode.Tai_Le": "unicode", - "unicode.Tai_Tham": "unicode", - "unicode.Tai_Viet": "unicode", - "unicode.Takri": "unicode", - "unicode.Tamil": "unicode", - "unicode.Telugu": "unicode", - "unicode.Terminal_Punctuation": "unicode", - "unicode.Thaana": "unicode", - "unicode.Thai": "unicode", - "unicode.Tibetan": "unicode", - "unicode.Tifinagh": "unicode", - "unicode.Tirhuta": "unicode", - "unicode.Title": "unicode", - "unicode.TitleCase": "unicode", - "unicode.To": "unicode", - "unicode.ToLower": "unicode", - "unicode.ToTitle": "unicode", - "unicode.ToUpper": "unicode", - "unicode.TurkishCase": "unicode", - "unicode.Ugaritic": "unicode", - "unicode.Unified_Ideograph": "unicode", - "unicode.Upper": "unicode", - "unicode.UpperCase": "unicode", - "unicode.UpperLower": "unicode", - "unicode.Vai": "unicode", - "unicode.Variation_Selector": "unicode", - "unicode.Version": "unicode", - "unicode.Warang_Citi": "unicode", - "unicode.White_Space": "unicode", - "unicode.Yi": "unicode", - "unicode.Z": "unicode", - "unicode.Zl": "unicode", - "unicode.Zp": "unicode", - "unicode.Zs": "unicode", - "url.Error": "net/url", - "url.EscapeError": "net/url", - "url.InvalidHostError": "net/url", - "url.Parse": "net/url", - "url.ParseQuery": "net/url", - "url.ParseRequestURI": "net/url", - "url.QueryEscape": "net/url", - "url.QueryUnescape": "net/url", - "url.URL": "net/url", - "url.User": "net/url", - "url.UserPassword": "net/url", - "url.Userinfo": "net/url", - "url.Values": "net/url", - "user.Current": "os/user", - "user.Lookup": "os/user", - "user.LookupId": "os/user", - "user.UnknownUserError": "os/user", - "user.UnknownUserIdError": "os/user", - "user.User": "os/user", - "utf16.Decode": "unicode/utf16", - "utf16.DecodeRune": "unicode/utf16", - "utf16.Encode": "unicode/utf16", - "utf16.EncodeRune": "unicode/utf16", - "utf16.IsSurrogate": "unicode/utf16", - "utf8.DecodeLastRune": "unicode/utf8", - "utf8.DecodeLastRuneInString": "unicode/utf8", - "utf8.DecodeRune": "unicode/utf8", - "utf8.DecodeRuneInString": "unicode/utf8", - "utf8.EncodeRune": "unicode/utf8", - "utf8.FullRune": "unicode/utf8", - "utf8.FullRuneInString": "unicode/utf8", - "utf8.MaxRune": "unicode/utf8", - "utf8.RuneCount": "unicode/utf8", - "utf8.RuneCountInString": "unicode/utf8", - "utf8.RuneError": "unicode/utf8", - "utf8.RuneLen": "unicode/utf8", - "utf8.RuneSelf": "unicode/utf8", - "utf8.RuneStart": "unicode/utf8", - "utf8.UTFMax": "unicode/utf8", - "utf8.Valid": "unicode/utf8", - "utf8.ValidRune": "unicode/utf8", - "utf8.ValidString": "unicode/utf8", - "x509.CANotAuthorizedForThisName": "crypto/x509", - "x509.CertPool": "crypto/x509", - "x509.Certificate": "crypto/x509", - "x509.CertificateInvalidError": "crypto/x509", - "x509.CertificateRequest": "crypto/x509", - "x509.ConstraintViolationError": "crypto/x509", - "x509.CreateCertificate": "crypto/x509", - "x509.CreateCertificateRequest": "crypto/x509", - "x509.DSA": "crypto/x509", - "x509.DSAWithSHA1": "crypto/x509", - "x509.DSAWithSHA256": "crypto/x509", - "x509.DecryptPEMBlock": "crypto/x509", - "x509.ECDSA": "crypto/x509", - "x509.ECDSAWithSHA1": "crypto/x509", - "x509.ECDSAWithSHA256": "crypto/x509", - "x509.ECDSAWithSHA384": "crypto/x509", - "x509.ECDSAWithSHA512": "crypto/x509", - "x509.EncryptPEMBlock": "crypto/x509", - "x509.ErrUnsupportedAlgorithm": "crypto/x509", - "x509.Expired": "crypto/x509", - "x509.ExtKeyUsage": "crypto/x509", - "x509.ExtKeyUsageAny": "crypto/x509", - "x509.ExtKeyUsageClientAuth": "crypto/x509", - "x509.ExtKeyUsageCodeSigning": "crypto/x509", - "x509.ExtKeyUsageEmailProtection": "crypto/x509", - "x509.ExtKeyUsageIPSECEndSystem": "crypto/x509", - "x509.ExtKeyUsageIPSECTunnel": "crypto/x509", - "x509.ExtKeyUsageIPSECUser": "crypto/x509", - "x509.ExtKeyUsageMicrosoftServerGatedCrypto": "crypto/x509", - "x509.ExtKeyUsageNetscapeServerGatedCrypto": "crypto/x509", - "x509.ExtKeyUsageOCSPSigning": "crypto/x509", - "x509.ExtKeyUsageServerAuth": "crypto/x509", - "x509.ExtKeyUsageTimeStamping": "crypto/x509", - "x509.HostnameError": "crypto/x509", - "x509.IncompatibleUsage": "crypto/x509", - "x509.IncorrectPasswordError": "crypto/x509", - "x509.InsecureAlgorithmError": "crypto/x509", - "x509.InvalidReason": "crypto/x509", - "x509.IsEncryptedPEMBlock": "crypto/x509", - "x509.KeyUsage": "crypto/x509", - "x509.KeyUsageCRLSign": "crypto/x509", - "x509.KeyUsageCertSign": "crypto/x509", - "x509.KeyUsageContentCommitment": "crypto/x509", - "x509.KeyUsageDataEncipherment": "crypto/x509", - "x509.KeyUsageDecipherOnly": "crypto/x509", - "x509.KeyUsageDigitalSignature": "crypto/x509", - "x509.KeyUsageEncipherOnly": "crypto/x509", - "x509.KeyUsageKeyAgreement": "crypto/x509", - "x509.KeyUsageKeyEncipherment": "crypto/x509", - "x509.MD2WithRSA": "crypto/x509", - "x509.MD5WithRSA": "crypto/x509", - "x509.MarshalECPrivateKey": "crypto/x509", - "x509.MarshalPKCS1PrivateKey": "crypto/x509", - "x509.MarshalPKIXPublicKey": "crypto/x509", - "x509.NewCertPool": "crypto/x509", - "x509.NotAuthorizedToSign": "crypto/x509", - "x509.PEMCipher": "crypto/x509", - "x509.PEMCipher3DES": "crypto/x509", - "x509.PEMCipherAES128": "crypto/x509", - "x509.PEMCipherAES192": "crypto/x509", - "x509.PEMCipherAES256": "crypto/x509", - "x509.PEMCipherDES": "crypto/x509", - "x509.ParseCRL": "crypto/x509", - "x509.ParseCertificate": "crypto/x509", - "x509.ParseCertificateRequest": "crypto/x509", - "x509.ParseCertificates": "crypto/x509", - "x509.ParseDERCRL": "crypto/x509", - "x509.ParseECPrivateKey": "crypto/x509", - "x509.ParsePKCS1PrivateKey": "crypto/x509", - "x509.ParsePKCS8PrivateKey": "crypto/x509", - "x509.ParsePKIXPublicKey": "crypto/x509", - "x509.PublicKeyAlgorithm": "crypto/x509", - "x509.RSA": "crypto/x509", - "x509.SHA1WithRSA": "crypto/x509", - "x509.SHA256WithRSA": "crypto/x509", - "x509.SHA384WithRSA": "crypto/x509", - "x509.SHA512WithRSA": "crypto/x509", - "x509.SignatureAlgorithm": "crypto/x509", - "x509.SystemRootsError": "crypto/x509", - "x509.TooManyIntermediates": "crypto/x509", - "x509.UnhandledCriticalExtension": "crypto/x509", - "x509.UnknownAuthorityError": "crypto/x509", - "x509.UnknownPublicKeyAlgorithm": "crypto/x509", - "x509.UnknownSignatureAlgorithm": "crypto/x509", - "x509.VerifyOptions": "crypto/x509", - "xml.Attr": "encoding/xml", - "xml.CharData": "encoding/xml", - "xml.Comment": "encoding/xml", - "xml.CopyToken": "encoding/xml", - "xml.Decoder": "encoding/xml", - "xml.Directive": "encoding/xml", - "xml.Encoder": "encoding/xml", - "xml.EndElement": "encoding/xml", - "xml.Escape": "encoding/xml", - "xml.EscapeText": "encoding/xml", - "xml.HTMLAutoClose": "encoding/xml", - "xml.HTMLEntity": "encoding/xml", - "xml.Header": "encoding/xml", - "xml.Marshal": "encoding/xml", - "xml.MarshalIndent": "encoding/xml", - "xml.Marshaler": "encoding/xml", - "xml.MarshalerAttr": "encoding/xml", - "xml.Name": "encoding/xml", - "xml.NewDecoder": "encoding/xml", - "xml.NewEncoder": "encoding/xml", - "xml.ProcInst": "encoding/xml", - "xml.StartElement": "encoding/xml", - "xml.SyntaxError": "encoding/xml", - "xml.TagPathError": "encoding/xml", - "xml.Token": "encoding/xml", - "xml.Unmarshal": "encoding/xml", - "xml.UnmarshalError": "encoding/xml", - "xml.Unmarshaler": "encoding/xml", - "xml.UnmarshalerAttr": "encoding/xml", - "xml.UnsupportedTypeError": "encoding/xml", - "zip.Compressor": "archive/zip", - "zip.Decompressor": "archive/zip", - "zip.Deflate": "archive/zip", - "zip.ErrAlgorithm": "archive/zip", - "zip.ErrChecksum": "archive/zip", - "zip.ErrFormat": "archive/zip", - "zip.File": "archive/zip", - "zip.FileHeader": "archive/zip", - "zip.FileInfoHeader": "archive/zip", - "zip.NewReader": "archive/zip", - "zip.NewWriter": "archive/zip", - "zip.OpenReader": "archive/zip", - "zip.ReadCloser": "archive/zip", - "zip.Reader": "archive/zip", - "zip.RegisterCompressor": "archive/zip", - "zip.RegisterDecompressor": "archive/zip", - "zip.Store": "archive/zip", - "zip.Writer": "archive/zip", - "zlib.BestCompression": "compress/zlib", - "zlib.BestSpeed": "compress/zlib", - "zlib.DefaultCompression": "compress/zlib", - "zlib.ErrChecksum": "compress/zlib", - "zlib.ErrDictionary": "compress/zlib", - "zlib.ErrHeader": "compress/zlib", - "zlib.NewReader": "compress/zlib", - "zlib.NewReaderDict": "compress/zlib", - "zlib.NewWriter": "compress/zlib", - "zlib.NewWriterLevel": "compress/zlib", - "zlib.NewWriterLevelDict": "compress/zlib", - "zlib.NoCompression": "compress/zlib", - "zlib.Resetter": "compress/zlib", - "zlib.Writer": "compress/zlib", - - "unsafe.Alignof": "unsafe", - "unsafe.ArbitraryType": "unsafe", - "unsafe.Offsetof": "unsafe", - "unsafe.Pointer": "unsafe", - "unsafe.Sizeof": "unsafe", -} diff --git a/zmq-win/build.bat b/zmq-win/build.bat index abc1d36..46ace00 100644 --- a/zmq-win/build.bat +++ b/zmq-win/build.bat @@ -14,7 +14,7 @@ set mydir=%mydir:\=/% set CGO_CFLAGS=-I %mydir%include set CGO_LDFLAGS=-L %mydir%lib-%target% -l zmq -go build -tags zmq_4_x github.com/gopherds/gophernotes +go build -tags zmq_4_x github.com/gopherdata/gophernotes :QUIT endlocal