vendor: update chroma and x/sys dependencies
This commit is contained in:
		
							parent
							
								
									de865fd332
								
							
						
					
					
						commit
						429297d66f
					
				| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[projects]]
 | 
					[[projects]]
 | 
				
			||||||
  digest = "1:a41877f8e11b1ad96a7d47ba3585e145217679cd9ad2236ad93c5643db15fc48"
 | 
					  digest = "1:1ac38c116b56bcb0729b224191e3d2bc86883cd0b82d02c3ea0b006db395de91"
 | 
				
			||||||
  name = "github.com/alecthomas/chroma"
 | 
					  name = "github.com/alecthomas/chroma"
 | 
				
			||||||
  packages = [
 | 
					  packages = [
 | 
				
			||||||
    ".",
 | 
					    ".",
 | 
				
			||||||
| 
						 | 
					@ -38,15 +38,7 @@
 | 
				
			||||||
    "styles",
 | 
					    "styles",
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
  pruneopts = "UT"
 | 
					  pruneopts = "UT"
 | 
				
			||||||
  revision = "v0.9.2"
 | 
					  revision = "v0.9.4"
 | 
				
			||||||
 | 
					 | 
				
			||||||
[[projects]]
 | 
					 | 
				
			||||||
  branch = "master"
 | 
					 | 
				
			||||||
  digest = "1:710109527a119c813d4fac773712dd92f449ed7c2f7b81f49822f94d290c8f72"
 | 
					 | 
				
			||||||
  name = "github.com/danwakefield/fnmatch"
 | 
					 | 
				
			||||||
  packages = ["."]
 | 
					 | 
				
			||||||
  pruneopts = "UT"
 | 
					 | 
				
			||||||
  revision = "cbb64ac3d964b81592e64f957ad53df015803288"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[projects]]
 | 
					[[projects]]
 | 
				
			||||||
  digest = "1:1d760033af7697966e33f900ddd0e68bfa2637b50fa25e7384e45f73f54e3276"
 | 
					  digest = "1:1d760033af7697966e33f900ddd0e68bfa2637b50fa25e7384e45f73f54e3276"
 | 
				
			||||||
| 
						 | 
					@ -60,14 +52,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[projects]]
 | 
					[[projects]]
 | 
				
			||||||
  branch = "master"
 | 
					  branch = "master"
 | 
				
			||||||
  digest = "1:d85f9416a95aba57c985b1f48f900da97404d8258c3374cce4e49616c57bf8c9"
 | 
					  digest = "1:b1e96c96cf2bfb86229921c95c15c34b56dbaffac891ee24c365ac527aaf5b80"
 | 
				
			||||||
  name = "golang.org/x/sys"
 | 
					  name = "golang.org/x/sys"
 | 
				
			||||||
  packages = [
 | 
					  packages = [
 | 
				
			||||||
    "internal/unsafeheader",
 | 
					    "internal/unsafeheader",
 | 
				
			||||||
    "unix",
 | 
					    "unix",
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
  pruneopts = "UT"
 | 
					  pruneopts = "UT"
 | 
				
			||||||
  revision = "6aff5f38e54f06f432ddfd9b4af5bf0de052bc08"
 | 
					  revision = "da31bd327af904dd4721b4eefa7c505bb3afd214"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[solve-meta]
 | 
					[solve-meta]
 | 
				
			||||||
  analyzer-name = "dep"
 | 
					  analyzer-name = "dep"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[constraint]]
 | 
					[[constraint]]
 | 
				
			||||||
  name = "github.com/alecthomas/chroma"
 | 
					  name = "github.com/alecthomas/chroma"
 | 
				
			||||||
  revision = "v0.9.2"
 | 
					  revision = "v0.9.4"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[override]]
 | 
					[[override]]
 | 
				
			||||||
  name = "github.com/dlclark/regexp2"
 | 
					  name = "github.com/dlclark/regexp2"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,11 +14,13 @@ builds:
 | 
				
			||||||
    - darwin
 | 
					    - darwin
 | 
				
			||||||
    - windows
 | 
					    - windows
 | 
				
			||||||
  goarch:
 | 
					  goarch:
 | 
				
			||||||
 | 
					    - arm64
 | 
				
			||||||
    - amd64
 | 
					    - amd64
 | 
				
			||||||
    - "386"
 | 
					    - "386"
 | 
				
			||||||
  goarm:
 | 
					  goarm:
 | 
				
			||||||
    - "6"
 | 
					    - "6"
 | 
				
			||||||
  main: ./cmd/chroma/main.go
 | 
					  dir: ./cmd/chroma
 | 
				
			||||||
 | 
					  main: .
 | 
				
			||||||
  ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
 | 
					  ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
 | 
				
			||||||
  binary: chroma
 | 
					  binary: chroma
 | 
				
			||||||
archives:
 | 
					archives:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
# Chroma — A general purpose syntax highlighter in pure Go [](https://godoc.org/github.com/alecthomas/chroma) [](https://circleci.com/gh/alecthomas/chroma) [](https://goreportcard.com/report/github.com/alecthomas/chroma) [](https://invite.slack.golangbridge.org/)
 | 
					# Chroma — A general purpose syntax highlighter in pure Go
 | 
				
			||||||
 | 
					[](https://godoc.org/github.com/alecthomas/chroma) [](https://github.com/alecthomas/chroma/actions/workflows/ci.yml) [](https://invite.slack.golangbridge.org/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly.
 | 
					> **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,7 +50,7 @@ K | Kotlin
 | 
				
			||||||
L | Lighttpd configuration file, LLVM, Lua
 | 
					L | Lighttpd configuration file, LLVM, Lua
 | 
				
			||||||
M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
 | 
					M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
 | 
				
			||||||
N | NASM, Newspeak, Nginx configuration file, Nim, Nix
 | 
					N | NASM, Newspeak, Nginx configuration file, Nim, Nix
 | 
				
			||||||
O | Objective-C, OCaml, Octave, OpenSCAD, Org Mode
 | 
					O | Objective-C, OCaml, Octave, OnesEnterprise, OpenSCAD, Org Mode
 | 
				
			||||||
P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python 2, Python
 | 
					P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python 2, Python
 | 
				
			||||||
Q | QBasic
 | 
					Q | QBasic
 | 
				
			||||||
R | R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust
 | 
					R | R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust
 | 
				
			||||||
| 
						 | 
					@ -249,11 +250,9 @@ For a quick overview of the available styles and how they look, check out the [C
 | 
				
			||||||
<a id="markdown-command-line-interface" name="command-line-interface"></a>
 | 
					<a id="markdown-command-line-interface" name="command-line-interface"></a>
 | 
				
			||||||
## Command-line interface
 | 
					## Command-line interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A command-line interface to Chroma is included. It can be installed with:
 | 
					A command-line interface to Chroma is included.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```sh
 | 
					Binaries are available to install from [the releases page](https://github.com/alecthomas/chroma/releases).
 | 
				
			||||||
go get -u github.com/alecthomas/chroma/cmd/chroma
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
The CLI can be used as a preprocessor to colorise output of `less(1)`,
 | 
					The CLI can be used as a preprocessor to colorise output of `less(1)`,
 | 
				
			||||||
see documentation for the `LESSOPEN` environment variable.
 | 
					see documentation for the `LESSOPEN` environment variable.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					hermit
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					.goreleaser-0.182.1.pkg
 | 
				
			||||||
| 
						 | 
					@ -3,16 +3,7 @@ module github.com/alecthomas/chroma
 | 
				
			||||||
go 1.13
 | 
					go 1.13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
 | 
						github.com/davecgh/go-spew v1.1.1 // indirect
 | 
				
			||||||
	github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect
 | 
					 | 
				
			||||||
	github.com/alecthomas/kong v0.2.4
 | 
					 | 
				
			||||||
	github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 // indirect
 | 
					 | 
				
			||||||
	github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
 | 
					 | 
				
			||||||
	github.com/dlclark/regexp2 v1.4.0
 | 
						github.com/dlclark/regexp2 v1.4.0
 | 
				
			||||||
	github.com/mattn/go-colorable v0.1.6
 | 
						github.com/stretchr/testify v1.7.0
 | 
				
			||||||
	github.com/mattn/go-isatty v0.0.12
 | 
					 | 
				
			||||||
	github.com/pkg/errors v0.9.1 // indirect
 | 
					 | 
				
			||||||
	github.com/sergi/go-diff v1.0.0 // indirect
 | 
					 | 
				
			||||||
	github.com/stretchr/testify v1.3.0 // indirect
 | 
					 | 
				
			||||||
	golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,34 +1,14 @@
 | 
				
			||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
 | 
					 | 
				
			||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
 | 
					 | 
				
			||||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
 | 
					 | 
				
			||||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
 | 
					 | 
				
			||||||
github.com/alecthomas/kong v0.2.4 h1:Y0ZBCHAvHhTHw7FFJ2FzCAAG4pkbTgA45nc7BpMhDNk=
 | 
					 | 
				
			||||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
 | 
					 | 
				
			||||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=
 | 
					 | 
				
			||||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
 | 
					 | 
				
			||||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
 | 
					 | 
				
			||||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
 | 
					 | 
				
			||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
					github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 | 
				
			||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
				
			||||||
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
 | 
					github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
 | 
				
			||||||
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
 | 
					github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
 | 
				
			||||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
 | 
					 | 
				
			||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 | 
					 | 
				
			||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
 | 
					 | 
				
			||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
 | 
					 | 
				
			||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
					 | 
				
			||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
 | 
					 | 
				
			||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
					 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
					github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
					github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
				
			||||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
 | 
					 | 
				
			||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 | 
					 | 
				
			||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
					github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
				
			||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
					github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 | 
				
			||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
 | 
					github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
				
			||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
					gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
					gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
 | 
					gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
				
			||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,13 +30,12 @@ func alRules() Rules {
 | 
				
			||||||
			{`\b(?i:(ARRAY|ASSERTERROR|BEGIN|BREAK|CASE|DO|DOWNTO|ELSE|END|EVENT|EXIT|FOR|FOREACH|FUNCTION|IF|IMPLEMENTS|IN|INDATASET|INTERFACE|INTERNAL|LOCAL|OF|PROCEDURE|PROGRAM|PROTECTED|REPEAT|RUNONCLIENT|SECURITYFILTERING|SUPPRESSDISPOSE|TEMPORARY|THEN|TO|TRIGGER|UNTIL|VAR|WHILE|WITH|WITHEVENTS))\b`, Keyword, nil},
 | 
								{`\b(?i:(ARRAY|ASSERTERROR|BEGIN|BREAK|CASE|DO|DOWNTO|ELSE|END|EVENT|EXIT|FOR|FOREACH|FUNCTION|IF|IMPLEMENTS|IN|INDATASET|INTERFACE|INTERNAL|LOCAL|OF|PROCEDURE|PROGRAM|PROTECTED|REPEAT|RUNONCLIENT|SECURITYFILTERING|SUPPRESSDISPOSE|TEMPORARY|THEN|TO|TRIGGER|UNTIL|VAR|WHILE|WITH|WITHEVENTS))\b`, Keyword, nil},
 | 
				
			||||||
			{`\b(?i:(AND|DIV|MOD|NOT|OR|XOR))\b`, OperatorWord, nil},
 | 
								{`\b(?i:(AND|DIV|MOD|NOT|OR|XOR))\b`, OperatorWord, nil},
 | 
				
			||||||
			{`\b(?i:(AVERAGE|CONST|COUNT|EXIST|FIELD|FILTER|LOOKUP|MAX|MIN|ORDER|SORTING|SUM|TABLEDATA|UPPERLIMIT|WHERE|ASCENDING|DESCENDING))\b`, Keyword, nil},
 | 
								{`\b(?i:(AVERAGE|CONST|COUNT|EXIST|FIELD|FILTER|LOOKUP|MAX|MIN|ORDER|SORTING|SUM|TABLEDATA|UPPERLIMIT|WHERE|ASCENDING|DESCENDING))\b`, Keyword, nil},
 | 
				
			||||||
			// Added new objects types of BC 2021 wave 1 (REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension)
 | 
								{`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|INTERFACE|PERMISSIONSET|PERMISSIONSETEXTENSION|ENTITLEMENT))\b`, Keyword, nil},
 | 
				
			||||||
			{`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension))\b`, Keyword, nil},
 | 
					 | 
				
			||||||
			{`\b(?i:(Action|Array|Automation|BigInteger|BigText|Blob|Boolean|Byte|Char|ClientType|Code|Codeunit|CompletionTriggerErrorLevel|ConnectionType|Database|DataClassification|DataScope|Date|DateFormula|DateTime|Decimal|DefaultLayout|Dialog|Dictionary|DotNet|DotNetAssembly|DotNetTypeDeclaration|Duration|Enum|ErrorInfo|ErrorType|ExecutionContext|ExecutionMode|FieldClass|FieldRef|FieldType|File|FilterPageBuilder|Guid|InStream|Integer|Joker|KeyRef|List|ModuleDependencyInfo|ModuleInfo|None|Notification|NotificationScope|ObjectType|Option|OutStream|Page|PageResult|Query|Record|RecordId|RecordRef|Report|ReportFormat|SecurityFilter|SecurityFiltering|Table|TableConnectionType|TableFilter|TestAction|TestField|TestFilterField|TestPage|TestPermissions|TestRequestPage|Text|TextBuilder|TextConst|TextEncoding|Time|TransactionModel|TransactionType|Variant|Verbosity|Version|XmlPort|HttpContent|HttpHeaders|HttpClient|HttpRequestMessage|HttpResponseMessage|JsonToken|JsonValue|JsonArray|JsonObject|View|Views|XmlAttribute|XmlAttributeCollection|XmlComment|XmlCData|XmlDeclaration|XmlDocument|XmlDocumentType|XmlElement|XmlNamespaceManager|XmlNameTable|XmlNode|XmlNodeList|XmlProcessingInstruction|XmlReadOptions|XmlText|XmlWriteOptions|WebServiceActionContext|WebServiceActionResultCode|SessionSettings))\b`, Keyword, nil},
 | 
								{`\b(?i:(Action|Array|Automation|BigInteger|BigText|Blob|Boolean|Byte|Char|ClientType|Code|Codeunit|CompletionTriggerErrorLevel|ConnectionType|Database|DataClassification|DataScope|Date|DateFormula|DateTime|Decimal|DefaultLayout|Dialog|Dictionary|DotNet|DotNetAssembly|DotNetTypeDeclaration|Duration|Enum|ErrorInfo|ErrorType|ExecutionContext|ExecutionMode|FieldClass|FieldRef|FieldType|File|FilterPageBuilder|Guid|InStream|Integer|Joker|KeyRef|List|ModuleDependencyInfo|ModuleInfo|None|Notification|NotificationScope|ObjectType|Option|OutStream|Page|PageResult|Query|Record|RecordId|RecordRef|Report|ReportFormat|SecurityFilter|SecurityFiltering|Table|TableConnectionType|TableFilter|TestAction|TestField|TestFilterField|TestPage|TestPermissions|TestRequestPage|Text|TextBuilder|TextConst|TextEncoding|Time|TransactionModel|TransactionType|Variant|Verbosity|Version|XmlPort|HttpContent|HttpHeaders|HttpClient|HttpRequestMessage|HttpResponseMessage|JsonToken|JsonValue|JsonArray|JsonObject|View|Views|XmlAttribute|XmlAttributeCollection|XmlComment|XmlCData|XmlDeclaration|XmlDocument|XmlDocumentType|XmlElement|XmlNamespaceManager|XmlNameTable|XmlNode|XmlNodeList|XmlProcessingInstruction|XmlReadOptions|XmlText|XmlWriteOptions|WebServiceActionContext|WebServiceActionResultCode|SessionSettings))\b`, Keyword, nil},
 | 
				
			||||||
			{`\b([<>]=|<>|<|>)\b?`, Operator, nil},
 | 
								{`\b([<>]=|<>|<|>)\b?`, Operator, nil},
 | 
				
			||||||
			{`\b(\-|\+|\/|\*)\b`, Operator, nil},
 | 
								{`\b(\-|\+|\/|\*)\b`, Operator, nil},
 | 
				
			||||||
			{`\s*(\:=|\+=|-=|\/=|\*=)\s*?`, Operator, nil},
 | 
								{`\s*(\:=|\+=|-=|\/=|\*=)\s*?`, Operator, nil},
 | 
				
			||||||
			{`\b(?i:(ADDFIRST|ADDLAST|ADDAFTER|ADDBEFORE|ACTION|ACTIONS|AREA|ASSEMBLY|CHARTPART|CUEGROUP|CUSTOMIZES|COLUMN|DATAITEM|DATASET|ELEMENTS|EXTENDS|FIELD|FIELDGROUP|FIELDATTRIBUTE|FIELDELEMENT|FIELDGROUPS|FIELDS|FILTER|FIXED|GRID|GROUP|MOVEAFTER|MOVEBEFORE|KEY|KEYS|LABEL|LABELS|LAYOUT|MODIFY|MOVEFIRST|MOVELAST|MOVEBEFORE|MOVEAFTER|PART|REPEATER|USERCONTROL|REQUESTPAGE|SCHEMA|SEPARATOR|SYSTEMPART|TABLEELEMENT|TEXTATTRIBUTE|TEXTELEMENT|TYPE))\b`, Keyword, nil},
 | 
								{`\b(?i:(ADD|ADDFIRST|ADDLAST|ADDAFTER|ADDBEFORE|ACTION|ACTIONS|AREA|ASSEMBLY|CHARTPART|CUEGROUP|CUSTOMIZES|COLUMN|DATAITEM|DATASET|ELEMENTS|EXTENDS|FIELD|FIELDGROUP|FIELDATTRIBUTE|FIELDELEMENT|FIELDGROUPS|FIELDS|FILTER|FIXED|GRID|GROUP|MOVEAFTER|MOVEBEFORE|KEY|KEYS|LABEL|LABELS|LAYOUT|MODIFY|MOVEFIRST|MOVELAST|MOVEBEFORE|MOVEAFTER|PART|REPEATER|USERCONTROL|REQUESTPAGE|SCHEMA|SEPARATOR|SYSTEMPART|TABLEELEMENT|TEXTATTRIBUTE|TEXTELEMENT|TYPE))\b`, Keyword, nil},
 | 
				
			||||||
			{`\s*[(\.\.)&\|]\s*`, Operator, nil},
 | 
								{`\s*[(\.\.)&\|]\s*`, Operator, nil},
 | 
				
			||||||
			{`\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b`, LiteralNumber, nil},
 | 
								{`\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b`, LiteralNumber, nil},
 | 
				
			||||||
			{`[;:,]`, Punctuation, nil},
 | 
								{`[;:,]`, Punctuation, nil},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,10 +26,10 @@ func aplRules() Rules {
 | 
				
			||||||
			{`[⋄◇()]`, Punctuation, nil},
 | 
								{`[⋄◇()]`, Punctuation, nil},
 | 
				
			||||||
			{`[\[\];]`, LiteralStringRegex, nil},
 | 
								{`[\[\];]`, LiteralStringRegex, nil},
 | 
				
			||||||
			{`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil},
 | 
								{`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil},
 | 
				
			||||||
			{`[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil},
 | 
								{`[A-Za-zΔ∆⍙_][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil},
 | 
				
			||||||
			{`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil},
 | 
								{`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil},
 | 
				
			||||||
			{`[\.\\/⌿⍀¨⍣⍨⍠⍤∘]`, NameAttribute, nil},
 | 
								{`[\.\\/⌿⍀¨⍣⍨⍠⍤∘⍥@⌺⌶⍢]`, NameAttribute, nil},
 | 
				
			||||||
			{`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗]`, Operator, nil},
 | 
								{`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗⊆⍸]`, Operator, nil},
 | 
				
			||||||
			{`⍬`, NameConstant, nil},
 | 
								{`⍬`, NameConstant, nil},
 | 
				
			||||||
			{`[⎕⍞]`, NameVariableGlobal, nil},
 | 
								{`[⎕⍞]`, NameVariableGlobal, nil},
 | 
				
			||||||
			{`[←→]`, KeywordDeclaration, nil},
 | 
								{`[←→]`, KeywordDeclaration, nil},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,72 @@
 | 
				
			||||||
 | 
					package a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var ArmAsm = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:      "ArmAsm",
 | 
				
			||||||
 | 
							Aliases:   []string{"armasm"},
 | 
				
			||||||
 | 
							EnsureNL:  true,
 | 
				
			||||||
 | 
							Filenames: []string{"*.s", "*.S"},
 | 
				
			||||||
 | 
							MimeTypes: []string{"text/x-armasm", "text/x-asm"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						armasmRules,
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func armasmRules() Rules {
 | 
				
			||||||
 | 
						return Rules{
 | 
				
			||||||
 | 
							"commentsandwhitespace": {
 | 
				
			||||||
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
 | 
								{`[@;].*?\n`, CommentSingle, nil},
 | 
				
			||||||
 | 
								{`/\*.*?\*/`, CommentMultiline, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"literal": {
 | 
				
			||||||
 | 
								// Binary
 | 
				
			||||||
 | 
								{`0b[01]+`, NumberBin, Pop(1)},
 | 
				
			||||||
 | 
								// Hex
 | 
				
			||||||
 | 
								{`0x\w{1,8}`, NumberHex, Pop(1)},
 | 
				
			||||||
 | 
								// Octal
 | 
				
			||||||
 | 
								{`0\d+`, NumberOct, Pop(1)},
 | 
				
			||||||
 | 
								// Float
 | 
				
			||||||
 | 
								{`\d+?\.\d+?`, NumberFloat, Pop(1)},
 | 
				
			||||||
 | 
								// Integer
 | 
				
			||||||
 | 
								{`\d+`, NumberInteger, Pop(1)},
 | 
				
			||||||
 | 
								// String
 | 
				
			||||||
 | 
								{`(")(.+)(")`, ByGroups(Punctuation, StringDouble, Punctuation), Pop(1)},
 | 
				
			||||||
 | 
								// Char
 | 
				
			||||||
 | 
								{`(')(.{1}|\\.{1})(')`, ByGroups(Punctuation, StringChar, Punctuation), Pop(1)},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"opcode": {
 | 
				
			||||||
 | 
								// Escape at line end
 | 
				
			||||||
 | 
								{`\n`, Text, Pop(1)},
 | 
				
			||||||
 | 
								// Comment
 | 
				
			||||||
 | 
								{`(@|;).*\n`, CommentSingle, Pop(1)},
 | 
				
			||||||
 | 
								// Whitespace
 | 
				
			||||||
 | 
								{`(\s+|,)`, Text, nil},
 | 
				
			||||||
 | 
								// Register by number
 | 
				
			||||||
 | 
								{`[rapcfxwbhsdqv]\d{1,2}`, NameClass, nil},
 | 
				
			||||||
 | 
								// Address by hex
 | 
				
			||||||
 | 
								{`=0x\w+`, ByGroups(Text, NameLabel), nil},
 | 
				
			||||||
 | 
								// Pseudo address by label
 | 
				
			||||||
 | 
								{`(=)(\w+)`, ByGroups(Text, NameLabel), nil},
 | 
				
			||||||
 | 
								// Immediate
 | 
				
			||||||
 | 
								{`#`, Text, Push("literal")},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"root": {
 | 
				
			||||||
 | 
								Include("commentsandwhitespace"),
 | 
				
			||||||
 | 
								// Directive with optional param
 | 
				
			||||||
 | 
								{`(\.\w+)([ \t]+\w+\s+?)?`, ByGroups(KeywordNamespace, NameLabel), nil},
 | 
				
			||||||
 | 
								// Label with data
 | 
				
			||||||
 | 
								{`(\w+)(:)(\s+\.\w+\s+)`, ByGroups(NameLabel, Punctuation, KeywordNamespace), Push("literal")},
 | 
				
			||||||
 | 
								// Label
 | 
				
			||||||
 | 
								{`(\w+)(:)`, ByGroups(NameLabel, Punctuation), nil},
 | 
				
			||||||
 | 
								// Syscall Op
 | 
				
			||||||
 | 
								{`svc\s+\w+`, NameNamespace, nil},
 | 
				
			||||||
 | 
								// Opcode
 | 
				
			||||||
 | 
								{`[a-zA-Z]+`, Text, Push("opcode")},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					package b
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// BashSession lexer.
 | 
				
			||||||
 | 
					var BashSession = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:      "BashSession",
 | 
				
			||||||
 | 
							Aliases:   []string{"bash-session", "console", "shell-session"},
 | 
				
			||||||
 | 
							Filenames: []string{".sh-session"},
 | 
				
			||||||
 | 
							MimeTypes: []string{"text/x-sh"},
 | 
				
			||||||
 | 
							EnsureNL:  true,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						bashsessionRules,
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func bashsessionRules() Rules {
 | 
				
			||||||
 | 
						return Rules{
 | 
				
			||||||
 | 
							"root": {
 | 
				
			||||||
 | 
								{`(^[#$%>]\s*)(.*\n?)`, ByGroups(GenericPrompt, Using(Bash)), nil},
 | 
				
			||||||
 | 
								{`^.+\n?`, GenericOutput, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ func phpCommonRules() Rules {
 | 
				
			||||||
			{`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil},
 | 
								{`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil},
 | 
				
			||||||
			{`0[0-7]+`, LiteralNumberOct, nil},
 | 
								{`0[0-7]+`, LiteralNumberOct, nil},
 | 
				
			||||||
			{`0x[a-f0-9_]+`, LiteralNumberHex, nil},
 | 
								{`0x[a-f0-9_]+`, LiteralNumberHex, nil},
 | 
				
			||||||
			{`[\d_]+`, LiteralNumberInteger, nil},
 | 
								{`\d[\d_]*`, LiteralNumberInteger, nil},
 | 
				
			||||||
			{`0b[01]+`, LiteralNumberBin, nil},
 | 
								{`0b[01]+`, LiteralNumberBin, nil},
 | 
				
			||||||
			{`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil},
 | 
								{`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil},
 | 
				
			||||||
			{"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil},
 | 
								{"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,66 @@
 | 
				
			||||||
 | 
					package f
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Fennel lexer.
 | 
				
			||||||
 | 
					var Fennel = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:      "Fennel",
 | 
				
			||||||
 | 
							Aliases:   []string{"fennel", "fnl"},
 | 
				
			||||||
 | 
							Filenames: []string{"*.fennel"},
 | 
				
			||||||
 | 
							MimeTypes: []string{"text/x-fennel", "application/x-fennel"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						fennelRules,
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Here's some Fennel code used to generate the lists of keywords:
 | 
				
			||||||
 | 
					// (local fennel (require :fennel))
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// (fn member? [t x] (each [_ y (ipairs t)] (when (= y x) (lua "return true"))))
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// (local declarations [:fn :lambda :λ :local :var :global :macro :macros])
 | 
				
			||||||
 | 
					// (local keywords [])
 | 
				
			||||||
 | 
					// (local globals [])
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// (each [name data (pairs (fennel.syntax))]
 | 
				
			||||||
 | 
					//   (if (member? declarations name) nil ; already populated
 | 
				
			||||||
 | 
					//       data.special? (table.insert keywords name)
 | 
				
			||||||
 | 
					//       data.macro? (table.insert keywords name)
 | 
				
			||||||
 | 
					//       data.global? (table.insert globals name)))
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// (fn quoted [tbl]
 | 
				
			||||||
 | 
					//   (table.sort tbl)
 | 
				
			||||||
 | 
					//   (table.concat (icollect [_ k (ipairs tbl)]
 | 
				
			||||||
 | 
					//                   (string.format "`%s`" k)) ", "))
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// (print :Keyword (quoted keywords))
 | 
				
			||||||
 | 
					// (print :KeywordDeclaration (quoted declarations))
 | 
				
			||||||
 | 
					// (print :NameBuiltin (quoted globals))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func fennelRules() Rules {
 | 
				
			||||||
 | 
						return Rules{
 | 
				
			||||||
 | 
							"root": {
 | 
				
			||||||
 | 
								{`;.*$`, CommentSingle, nil},
 | 
				
			||||||
 | 
								{`\s+`, Whitespace, nil},
 | 
				
			||||||
 | 
								{`-?\d+\.\d+`, LiteralNumberFloat, nil},
 | 
				
			||||||
 | 
								{`-?\d+`, LiteralNumberInteger, nil},
 | 
				
			||||||
 | 
								{`0x-?[abcdef\d]+`, LiteralNumberHex, nil},
 | 
				
			||||||
 | 
								{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
 | 
				
			||||||
 | 
								{`'(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil},
 | 
				
			||||||
 | 
								{`\\(.|[a-z]+)`, LiteralStringChar, nil},
 | 
				
			||||||
 | 
								{`::?#?(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil},
 | 
				
			||||||
 | 
								{"~@|[`\\'#^~&@]", Operator, nil},
 | 
				
			||||||
 | 
								{Words(``, ` `, `#`, `%`, `*`, `+`, `-`, `->`, `->>`, `-?>`, `-?>>`, `.`, `..`, `/`, `//`, `:`, `<`, `<=`, `=`, `>`, `>=`, `?.`, `^`, `accumulate`, `and`, `band`, `bnot`, `bor`, `bxor`, `collect`, `comment`, `do`, `doc`, `doto`, `each`, `eval-compiler`, `for`, `hashfn`, `icollect`, `if`, `import-macros`, `include`, `length`, `let`, `lshift`, `lua`, `macrodebug`, `match`, `not`, `not=`, `or`, `partial`, `pick-args`, `pick-values`, `quote`, `require-macros`, `rshift`, `set`, `set-forcibly!`, `tset`, `values`, `when`, `while`, `with-open`, `~=`), Keyword, nil},
 | 
				
			||||||
 | 
								{Words(``, ` `, `fn`, `global`, `lambda`, `local`, `macro`, `macros`, `var`, `λ`), KeywordDeclaration, nil},
 | 
				
			||||||
 | 
								{Words(``, ` `, `_G`, `arg`, `assert`, `bit32`, `bit32.arshift`, `bit32.band`, `bit32.bnot`, `bit32.bor`, `bit32.btest`, `bit32.bxor`, `bit32.extract`, `bit32.lrotate`, `bit32.lshift`, `bit32.replace`, `bit32.rrotate`, `bit32.rshift`, `collectgarbage`, `coroutine`, `coroutine.create`, `coroutine.resume`, `coroutine.running`, `coroutine.status`, `coroutine.wrap`, `coroutine.yield`, `debug`, `debug.debug`, `debug.gethook`, `debug.getinfo`, `debug.getlocal`, `debug.getmetatable`, `debug.getregistry`, `debug.getupvalue`, `debug.getuservalue`, `debug.sethook`, `debug.setlocal`, `debug.setmetatable`, `debug.setupvalue`, `debug.setuservalue`, `debug.traceback`, `debug.upvalueid`, `debug.upvaluejoin`, `dofile`, `error`, `getmetatable`, `io`, `io.close`, `io.flush`, `io.input`, `io.lines`, `io.open`, `io.output`, `io.popen`, `io.read`, `io.tmpfile`, `io.type`, `io.write`, `ipairs`, `load`, `loadfile`, `loadstring`, `math`, `math.abs`, `math.acos`, `math.asin`, `math.atan`, `math.atan2`, `math.ceil`, `math.cos`, `math.cosh`, `math.deg`, `math.exp`, `math.floor`, `math.fmod`, `math.frexp`, `math.ldexp`, `math.log`, `math.log10`, `math.max`, `math.min`, `math.modf`, `math.pow`, `math.rad`, `math.random`, `math.randomseed`, `math.sin`, `math.sinh`, `math.sqrt`, `math.tan`, `math.tanh`, `module`, `next`, `os`, `os.clock`, `os.date`, `os.difftime`, `os.execute`, `os.exit`, `os.getenv`, `os.remove`, `os.rename`, `os.setlocale`, `os.time`, `os.tmpname`, `package`, `package.loadlib`, `package.searchpath`, `package.seeall`, `pairs`, `pcall`, `print`, `rawequal`, `rawget`, `rawlen`, `rawset`, `require`, `select`, `setmetatable`, `string`, `string.byte`, `string.char`, `string.dump`, `string.find`, `string.format`, `string.gmatch`, `string.gsub`, `string.len`, `string.lower`, `string.match`, `string.rep`, `string.reverse`, `string.sub`, `string.upper`, `table`, `table.concat`, `table.insert`, `table.maxn`, `table.pack`, `table.remove`, `table.sort`, `table.unpack`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`), NameBuiltin, nil},
 | 
				
			||||||
 | 
								{`(?<=\()(?!#)[\w!$%*+<=>?/.#-]+`, NameFunction, nil},
 | 
				
			||||||
 | 
								{`(?!#)[\w!$%*+<=>?/.#-]+`, NameVariable, nil},
 | 
				
			||||||
 | 
								{`(\[|\])`, Punctuation, nil},
 | 
				
			||||||
 | 
								{`(\{|\})`, Punctuation, nil},
 | 
				
			||||||
 | 
								{`(\(|\))`, Punctuation, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ func fishRules() Rules {
 | 
				
			||||||
			{`&&|\|\||&|\||\^|<|>`, Operator, nil},
 | 
								{`&&|\|\||&|\||\^|<|>`, Operator, nil},
 | 
				
			||||||
			{`\s+`, Text, nil},
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
			{`\b\d+\b`, LiteralNumber, nil},
 | 
								{`\b\d+\b`, LiteralNumber, nil},
 | 
				
			||||||
			{`--?[^\d][\w-]*`, NameAttribute, nil},
 | 
								{`(?<=\s+)--?[^\d][\w-]*`, NameAttribute, nil},
 | 
				
			||||||
			{".+?", Text, nil},
 | 
								{".+?", Text, nil},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"string": {
 | 
							"string": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,6 +50,7 @@ func goRules() Rules {
 | 
				
			||||||
			{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
								{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
				
			||||||
			{`0[0-7]+`, LiteralNumberOct, nil},
 | 
								{`0[0-7]+`, LiteralNumberOct, nil},
 | 
				
			||||||
			{`0[xX][0-9a-fA-F_]+`, LiteralNumberHex, nil},
 | 
								{`0[xX][0-9a-fA-F_]+`, LiteralNumberHex, nil},
 | 
				
			||||||
 | 
								{`0b[01_]+`, LiteralNumberBin, nil},
 | 
				
			||||||
			{`(0|[1-9][0-9_]*)`, LiteralNumberInteger, nil},
 | 
								{`(0|[1-9][0-9_]*)`, LiteralNumberInteger, nil},
 | 
				
			||||||
			{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
								{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
				
			||||||
			{"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil},
 | 
								{"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil},
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,7 @@ func goTemplateRules() Rules {
 | 
				
			||||||
			{`-?\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
								{`-?\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
				
			||||||
			{`-?0[0-7]+`, LiteralNumberOct, nil},
 | 
								{`-?0[0-7]+`, LiteralNumberOct, nil},
 | 
				
			||||||
			{`-?0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
								{`-?0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
				
			||||||
 | 
								{`-?0b[01_]+`, LiteralNumberBin, nil},
 | 
				
			||||||
			{`-?(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
 | 
								{`-?(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
 | 
				
			||||||
			{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
								{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
				
			||||||
			{"`[^`]*`", LiteralString, nil},
 | 
								{"`[^`]*`", LiteralString, nil},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,10 +27,10 @@ func haskellRules() Rules {
 | 
				
			||||||
			{`\berror\b`, NameException, nil},
 | 
								{`\berror\b`, NameException, nil},
 | 
				
			||||||
			{`\b(case|class|data|default|deriving|do|else|family|if|in|infix[lr]?|instance|let|newtype|of|then|type|where|_)(?!\')\b`, KeywordReserved, nil},
 | 
								{`\b(case|class|data|default|deriving|do|else|family|if|in|infix[lr]?|instance|let|newtype|of|then|type|where|_)(?!\')\b`, KeywordReserved, nil},
 | 
				
			||||||
			{`'[^\\]'`, LiteralStringChar, nil},
 | 
								{`'[^\\]'`, LiteralStringChar, nil},
 | 
				
			||||||
			{`^[_a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w\']*`, NameFunction, nil},
 | 
								{`^[_\p{Ll}][\w\']*`, NameFunction, nil},
 | 
				
			||||||
			{`'?[_a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w']*`, Name, nil},
 | 
								{`'?[_\p{Ll}][\w']*`, Name, nil},
 | 
				
			||||||
			{`('')?[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w\']*`, KeywordType, nil},
 | 
								{`('')?[\p{Lu}][\w\']*`, KeywordType, nil},
 | 
				
			||||||
			{`(')[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w\']*`, KeywordType, nil},
 | 
								{`(')[\p{Lu}][\w\']*`, KeywordType, nil},
 | 
				
			||||||
			{`(')\[[^\]]*\]`, KeywordType, nil},
 | 
								{`(')\[[^\]]*\]`, KeywordType, nil},
 | 
				
			||||||
			{`(')\([^)]*\)`, KeywordType, nil},
 | 
								{`(')\([^)]*\)`, KeywordType, nil},
 | 
				
			||||||
			{`\\(?![:!#$%&*+.\\/<=>?@^|~-]+)`, NameFunction, nil},
 | 
								{`\\(?![:!#$%&*+.\\/<=>?@^|~-]+)`, NameFunction, nil},
 | 
				
			||||||
| 
						 | 
					@ -53,20 +53,20 @@ func haskellRules() Rules {
 | 
				
			||||||
			{`"`, LiteralString, Push("string")},
 | 
								{`"`, LiteralString, Push("string")},
 | 
				
			||||||
			{`\)`, Punctuation, Pop(1)},
 | 
								{`\)`, Punctuation, Pop(1)},
 | 
				
			||||||
			{`qualified\b`, Keyword, nil},
 | 
								{`qualified\b`, Keyword, nil},
 | 
				
			||||||
			{`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(as)(\s+)([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)`, ByGroups(NameNamespace, Text, Keyword, Text, Name), Pop(1)},
 | 
								{`([\p{Lu}][\w.]*)(\s+)(as)(\s+)([\p{Lu}][\w.]*)`, ByGroups(NameNamespace, Text, Keyword, Text, Name), Pop(1)},
 | 
				
			||||||
			{`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(hiding)(\s+)(\()`, ByGroups(NameNamespace, Text, Keyword, Text, Punctuation), Push("funclist")},
 | 
								{`([\p{Lu}][\w.]*)(\s+)(hiding)(\s+)(\()`, ByGroups(NameNamespace, Text, Keyword, Text, Punctuation), Push("funclist")},
 | 
				
			||||||
			{`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")},
 | 
								{`([\p{Lu}][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")},
 | 
				
			||||||
			{`[\w.]+`, NameNamespace, Pop(1)},
 | 
								{`[\w.]+`, NameNamespace, Pop(1)},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"module": {
 | 
							"module": {
 | 
				
			||||||
			{`\s+`, Text, nil},
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
			{`([A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")},
 | 
								{`([\p{Lu}][\w.]*)(\s+)(\()`, ByGroups(NameNamespace, Text, Punctuation), Push("funclist")},
 | 
				
			||||||
			{`[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊][\w.]*`, NameNamespace, Pop(1)},
 | 
								{`[\p{Lu}][\w.]*`, NameNamespace, Pop(1)},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"funclist": {
 | 
							"funclist": {
 | 
				
			||||||
			{`\s+`, Text, nil},
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
			{`[A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊]\w*`, KeywordType, nil},
 | 
								{`[\p{Lu}]\w*`, KeywordType, nil},
 | 
				
			||||||
			{`(_[\w\']+|[a-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķ-ĸĺļľŀłńņň-ʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌ-ƍƒƕƙ-ƛƞơƣƥƨƪ-ƫƭưƴƶƹ-ƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜ-ǝǟǡǣǥǧǩǫǭǯ-ǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿ-ɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐ-ϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻ-ϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎ-ӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶ-ᾷιῂ-ῄῆ-ῇῐ-ΐῖ-ῗῠ-ῧῲ-ῴῶ-ῷℊℎ-ℏℓℯℴℹℼ-ℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥ-ⱦⱨⱪⱬⱱⱳ-ⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ-ⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-z𐐨-𐑏𝐚-𝐳𝑎-𝑔𝑖-𝑧𝒂-𝒛𝒶-𝒹𝒻𝒽-𝓃𝓅-𝓏𝓪-𝔃𝔞-𝔷𝕒-𝕫𝖆-𝖟𝖺-𝗓𝗮-𝘇𝘢-𝘻𝙖-𝙯𝚊-𝚥𝛂-𝛚𝛜-𝛡𝛼-𝜔𝜖-𝜛𝜶-𝝎𝝐-𝝕𝝰-𝞈𝞊-𝞏𝞪-𝟂𝟄-𝟉𝟋][\w\']*)`, NameFunction, nil},
 | 
								{`(_[\w\']+|[\p{Ll}][\w\']*)`, NameFunction, nil},
 | 
				
			||||||
			{`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil},
 | 
								{`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil},
 | 
				
			||||||
			{`\{-`, CommentMultiline, Push("comment")},
 | 
								{`\{-`, CommentMultiline, Push("comment")},
 | 
				
			||||||
			{`,`, Punctuation, nil},
 | 
								{`,`, Punctuation, nil},
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ func haskellRules() Rules {
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"escape": {
 | 
							"escape": {
 | 
				
			||||||
			{`[abfnrtv"\'&\\]`, LiteralStringEscape, Pop(1)},
 | 
								{`[abfnrtv"\'&\\]`, LiteralStringEscape, Pop(1)},
 | 
				
			||||||
			{`\^[][A-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸ-ŹŻŽƁ-ƂƄƆ-ƇƉ-ƋƎ-ƑƓ-ƔƖ-ƘƜ-ƝƟ-ƠƢƤƦ-ƧƩƬƮ-ƯƱ-ƳƵƷ-ƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺ-ȻȽ-ȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎ-ΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹ-ϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀ-ӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾ-ℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽ-ꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-Z𐐀-𐐧𝐀-𝐙𝐴-𝑍𝑨-𝒁𝒜𝒞-𝒟𝒢𝒥-𝒦𝒩-𝒬𝒮-𝒵𝓐-𝓩𝔄-𝔅𝔇-𝔊𝔍-𝔔𝔖-𝔜𝔸-𝔹𝔻-𝔾𝕀-𝕄𝕆𝕊-𝕐𝕬-𝖅𝖠-𝖹𝗔-𝗭𝘈-𝘡𝘼-𝙕𝙰-𝚉𝚨-𝛀𝛢-𝛺𝜜-𝜴𝝖-𝝮𝞐-𝞨𝟊@^_]`, LiteralStringEscape, Pop(1)},
 | 
								{`\^[][\p{Lu}@^_]`, LiteralStringEscape, Pop(1)},
 | 
				
			||||||
			{`NUL|SOH|[SE]TX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|S[OI]|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|[FGRU]S|SP|DEL`, LiteralStringEscape, Pop(1)},
 | 
								{`NUL|SOH|[SE]TX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|S[OI]|DLE|DC[1-4]|NAK|SYN|ETB|CAN|EM|SUB|ESC|[FGRU]S|SP|DEL`, LiteralStringEscape, Pop(1)},
 | 
				
			||||||
			{`o[0-7]+`, LiteralStringEscape, Pop(1)},
 | 
								{`o[0-7]+`, LiteralStringEscape, Pop(1)},
 | 
				
			||||||
			{`x[\da-fA-F]+`, LiteralStringEscape, Pop(1)},
 | 
								{`x[\da-fA-F]+`, LiteralStringEscape, Pop(1)},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,6 @@ import (
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/danwakefield/fnmatch"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"github.com/alecthomas/chroma"
 | 
						"github.com/alecthomas/chroma"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,8 +13,8 @@ var (
 | 
				
			||||||
	ignoredSuffixes = [...]string{
 | 
						ignoredSuffixes = [...]string{
 | 
				
			||||||
		// Editor backups
 | 
							// Editor backups
 | 
				
			||||||
		"~", ".bak", ".old", ".orig",
 | 
							"~", ".bak", ".old", ".orig",
 | 
				
			||||||
		// Debian and derivatives apt/dpkg backups
 | 
							// Debian and derivatives apt/dpkg/ucf backups
 | 
				
			||||||
		".dpkg-dist", ".dpkg-old",
 | 
							".dpkg-dist", ".dpkg-old", ".ucf-dist", ".ucf-new", ".ucf-old",
 | 
				
			||||||
		// Red Hat and derivatives rpm backups
 | 
							// Red Hat and derivatives rpm backups
 | 
				
			||||||
		".rpmnew", ".rpmorig", ".rpmsave",
 | 
							".rpmnew", ".rpmorig", ".rpmsave",
 | 
				
			||||||
		// Build system input/template files
 | 
							// Build system input/template files
 | 
				
			||||||
| 
						 | 
					@ -104,11 +102,17 @@ func Match(filename string) chroma.Lexer {
 | 
				
			||||||
	for _, lexer := range Registry.Lexers {
 | 
						for _, lexer := range Registry.Lexers {
 | 
				
			||||||
		config := lexer.Config()
 | 
							config := lexer.Config()
 | 
				
			||||||
		for _, glob := range config.Filenames {
 | 
							for _, glob := range config.Filenames {
 | 
				
			||||||
			if fnmatch.Match(glob, filename, 0) {
 | 
								ok, err := filepath.Match(glob, filename)
 | 
				
			||||||
 | 
								if err != nil { // nolint
 | 
				
			||||||
 | 
									panic(err)
 | 
				
			||||||
 | 
								} else if ok {
 | 
				
			||||||
				matched = append(matched, lexer)
 | 
									matched = append(matched, lexer)
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				for _, suf := range &ignoredSuffixes {
 | 
									for _, suf := range &ignoredSuffixes {
 | 
				
			||||||
					if fnmatch.Match(glob+suf, filename, 0) {
 | 
										ok, err := filepath.Match(glob+suf, filename)
 | 
				
			||||||
 | 
										if err != nil {
 | 
				
			||||||
 | 
											panic(err)
 | 
				
			||||||
 | 
										} else if ok {
 | 
				
			||||||
						matched = append(matched, lexer)
 | 
											matched = append(matched, lexer)
 | 
				
			||||||
						break
 | 
											break
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					@ -125,11 +129,17 @@ func Match(filename string) chroma.Lexer {
 | 
				
			||||||
	for _, lexer := range Registry.Lexers {
 | 
						for _, lexer := range Registry.Lexers {
 | 
				
			||||||
		config := lexer.Config()
 | 
							config := lexer.Config()
 | 
				
			||||||
		for _, glob := range config.AliasFilenames {
 | 
							for _, glob := range config.AliasFilenames {
 | 
				
			||||||
			if fnmatch.Match(glob, filename, 0) {
 | 
								ok, err := filepath.Match(glob, filename)
 | 
				
			||||||
 | 
								if err != nil { // nolint
 | 
				
			||||||
 | 
									panic(err)
 | 
				
			||||||
 | 
								} else if ok {
 | 
				
			||||||
				matched = append(matched, lexer)
 | 
									matched = append(matched, lexer)
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				for _, suf := range &ignoredSuffixes {
 | 
									for _, suf := range &ignoredSuffixes {
 | 
				
			||||||
					if fnmatch.Match(glob+suf, filename, 0) {
 | 
										ok, err := filepath.Match(glob+suf, filename)
 | 
				
			||||||
 | 
										if err != nil {
 | 
				
			||||||
 | 
											panic(err)
 | 
				
			||||||
 | 
										} else if ok {
 | 
				
			||||||
						matched = append(matched, lexer)
 | 
											matched = append(matched, lexer)
 | 
				
			||||||
						break
 | 
											break
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -23,6 +23,9 @@ func jsonRules() Rules {
 | 
				
			||||||
		"whitespace": {
 | 
							"whitespace": {
 | 
				
			||||||
			{`\s+`, Text, nil},
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							"comment": {
 | 
				
			||||||
 | 
								{`//.*?\n`, CommentSingle, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		"simplevalue": {
 | 
							"simplevalue": {
 | 
				
			||||||
			{`(true|false|null)\b`, KeywordConstant, nil},
 | 
								{`(true|false|null)\b`, KeywordConstant, nil},
 | 
				
			||||||
			{`-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)`, LiteralNumberFloat, nil},
 | 
								{`-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)`, LiteralNumberFloat, nil},
 | 
				
			||||||
| 
						 | 
					@ -37,18 +40,21 @@ func jsonRules() Rules {
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"objectvalue": {
 | 
							"objectvalue": {
 | 
				
			||||||
			Include("whitespace"),
 | 
								Include("whitespace"),
 | 
				
			||||||
 | 
								Include("comment"),
 | 
				
			||||||
			{`"(\\\\|\\"|[^"])*"`, NameTag, Push("objectattribute")},
 | 
								{`"(\\\\|\\"|[^"])*"`, NameTag, Push("objectattribute")},
 | 
				
			||||||
			{`\}`, Punctuation, Pop(1)},
 | 
								{`\}`, Punctuation, Pop(1)},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"arrayvalue": {
 | 
							"arrayvalue": {
 | 
				
			||||||
			Include("whitespace"),
 | 
								Include("whitespace"),
 | 
				
			||||||
			Include("value"),
 | 
								Include("value"),
 | 
				
			||||||
 | 
								Include("comment"),
 | 
				
			||||||
			{`,`, Punctuation, nil},
 | 
								{`,`, Punctuation, nil},
 | 
				
			||||||
			{`\]`, Punctuation, Pop(1)},
 | 
								{`\]`, Punctuation, Pop(1)},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"value": {
 | 
							"value": {
 | 
				
			||||||
			Include("whitespace"),
 | 
								Include("whitespace"),
 | 
				
			||||||
			Include("simplevalue"),
 | 
								Include("simplevalue"),
 | 
				
			||||||
 | 
								Include("comment"),
 | 
				
			||||||
			{`\{`, Punctuation, Push("objectvalue")},
 | 
								{`\{`, Punctuation, Push("objectvalue")},
 | 
				
			||||||
			{`\[`, Punctuation, Push("arrayvalue")},
 | 
								{`\[`, Punctuation, Push("arrayvalue")},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					package m
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Meson lexer.
 | 
				
			||||||
 | 
					var Meson = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:      "Meson",
 | 
				
			||||||
 | 
							Aliases:   []string{"meson", "meson.build"},
 | 
				
			||||||
 | 
							Filenames: []string{"meson.build", "meson_options.txt"},
 | 
				
			||||||
 | 
							MimeTypes: []string{"text/x-meson"},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						func() Rules {
 | 
				
			||||||
 | 
							return Rules{
 | 
				
			||||||
 | 
								"root": {
 | 
				
			||||||
 | 
									{`#.*?$`, Comment, nil},
 | 
				
			||||||
 | 
									{`'''.*'''`, LiteralStringSingle, nil},
 | 
				
			||||||
 | 
									{`[1-9][0-9]*`, LiteralNumberInteger, nil},
 | 
				
			||||||
 | 
									{`0o[0-7]+`, LiteralNumberOct, nil},
 | 
				
			||||||
 | 
									{`0x[a-fA-F0-9]+`, LiteralNumberHex, nil},
 | 
				
			||||||
 | 
									Include("string"),
 | 
				
			||||||
 | 
									Include("keywords"),
 | 
				
			||||||
 | 
									Include("expr"),
 | 
				
			||||||
 | 
									{`[a-zA-Z_][a-zA-Z_0-9]*`, Name, nil},
 | 
				
			||||||
 | 
									{`\s+`, TextWhitespace, nil},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								"string": {
 | 
				
			||||||
 | 
									{`[']{3}([']{0,2}([^\\']|\\(.|\n)))*[']{3}`, LiteralString, nil},
 | 
				
			||||||
 | 
									{`'.*?(?<!\\)(\\\\)*?'`, LiteralString, nil},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								"keywords": {
 | 
				
			||||||
 | 
									{Words(``, `\b`, `if`, `elif`, `else`, `endif`, `foreach`, `endforeach`, `break`, `continue`), Keyword, nil},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								"expr": {
 | 
				
			||||||
 | 
									{`(in|and|or|not)\b`, OperatorWord, nil},
 | 
				
			||||||
 | 
									{`(\*=|/=|%=|\+]=|-=|==|!=|\+|-|=)`, Operator, nil},
 | 
				
			||||||
 | 
									{`[\[\]{}:().,?]`, Punctuation, nil},
 | 
				
			||||||
 | 
									{Words(``, `\b`, `true`, `false`), KeywordConstant, nil},
 | 
				
			||||||
 | 
									Include("builtins"),
 | 
				
			||||||
 | 
									{Words(``, `\b`, `meson`, `build_machine`, `host_machine`, `target_machine`), NameVariableMagic, nil},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								"builtins": {
 | 
				
			||||||
 | 
									{Words(`(?<!\.)`, `\b`, `add_global_arguments`, `add_global_link_arguments`, `add_languages`, `add_project_arguments`, `add_project_link_arguments`, `add_test_setup`, `assert`, `benchmark`, `both_libraries`, `build_target`, `configuration_data`, `configure_file`, `custom_target`, `declare_dependency`, `dependency`, `disabler`, `environment`, `error`, `executable`, `files`, `find_library`, `find_program`, `generator`, `get_option`, `get_variable`, `include_directories`, `install_data`, `install_headers`, `install_man`, `install_subdir`, `is_disabler`, `is_variable`, `jar`, `join_paths`, `library`, `message`, `project`, `range`, `run_command`, `set_variable`, `shared_library`, `shared_module`, `static_library`, `subdir`, `subdir_done`, `subproject`, `summary`, `test`, `vcs_tag`, `warning`), NameBuiltin, nil},
 | 
				
			||||||
 | 
									{`(?<!\.)import\b`, NameNamespace, nil},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,50 @@
 | 
				
			||||||
 | 
					package o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 1S:Enterprise lexer.
 | 
				
			||||||
 | 
					var OnesEnterprise = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:            "OnesEnterprise",
 | 
				
			||||||
 | 
							Aliases:         []string{"ones", "onesenterprise", "1S", "1S:Enterprise"},
 | 
				
			||||||
 | 
							Filenames:       []string{"*.EPF", "*.epf", "*.ERF", "*.erf"},
 | 
				
			||||||
 | 
							MimeTypes:       []string{"application/octet-stream"},
 | 
				
			||||||
 | 
							CaseInsensitive: true,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						onesRules,
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func onesRules() Rules {
 | 
				
			||||||
 | 
						return Rules{
 | 
				
			||||||
 | 
							"root": {
 | 
				
			||||||
 | 
								{`\n`, Text, nil},
 | 
				
			||||||
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
 | 
								{`\\\n`, Text, nil},
 | 
				
			||||||
 | 
								{`[^\S\n]+`, Text, nil},
 | 
				
			||||||
 | 
								{`//(.*?)\n`, Comment, nil},
 | 
				
			||||||
 | 
								{`(#область|#region|#конецобласти|#endregion|#если|#if|#иначе|#else|#конецесли|#endif).*`, CommentPreproc, nil},
 | 
				
			||||||
 | 
								{`(&наклиенте|&atclient|&насервере|&atserver|&насерверебезконтекста|&atservernocontext|&наклиентенасерверебезконтекста|&atclientatservernocontext).*`, CommentPreproc, nil},
 | 
				
			||||||
 | 
								{`(>=|<=|<>|\+|-|=|>|<|\*|/|%)`, Operator, nil},
 | 
				
			||||||
 | 
								{`(;|,|\)|\(|\.)`, Punctuation, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `истина`, `true`, `ложь`, `false`, `и`, `and`, `или`, `or`, `не`, `not`), Operator, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `если`, `if`, `тогда`, `then`, `иначе`, `else`, `иначеесли`, `elsif`, `конецесли`, `endif`), Operator, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `для`, `for`, `каждого`, `each`, `из`, `in`, `цикл`, `do`, `пока`, `while`, `конеццикла`, `enddo`, `по`, `to`), Operator, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `прервать`, `break`, `продолжить`, `continue`, `возврат`, `return`, `перейти`, `goto`), Operator, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `процедура`, `procedure`, `конецпроцедуры`, `endprocedure`, `функция`, `function`, `конецфункции`, `endfunction`), Keyword, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `новый`, `new`, `знач`, `val`, `экспорт`, `export`, `перем`, `var`), Keyword, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `попытка`, `try`, `исключение`, `except`, `вызватьисключение`, `raise`, `конецпопытки`, `endtry`), Keyword, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `выполнить`, `execute`, `вычислить`, `eval`), Keyword, nil},
 | 
				
			||||||
 | 
								{`"`, LiteralString, Push("string")},
 | 
				
			||||||
 | 
								{`[_а-яА-Я0-9][а-яА-Я0-9]*`, Name, nil},
 | 
				
			||||||
 | 
								{`[_\w][\w]*`, Name, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"string": {
 | 
				
			||||||
 | 
								{`""`, LiteralString, nil},
 | 
				
			||||||
 | 
								{`"C?`, LiteralString, Pop(1)},
 | 
				
			||||||
 | 
								{`[^"]+`, LiteralString, nil},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -9,9 +9,9 @@ import (
 | 
				
			||||||
var Rust = internal.Register(MustNewLazyLexer(
 | 
					var Rust = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
	&Config{
 | 
						&Config{
 | 
				
			||||||
		Name:      "Rust",
 | 
							Name:      "Rust",
 | 
				
			||||||
		Aliases:   []string{"rust"},
 | 
							Aliases:   []string{"rust", "rs"},
 | 
				
			||||||
		Filenames: []string{"*.rs", "*.rs.in"},
 | 
							Filenames: []string{"*.rs", "*.rs.in"},
 | 
				
			||||||
		MimeTypes: []string{"text/rust"},
 | 
							MimeTypes: []string{"text/rust", "text/x-rust"},
 | 
				
			||||||
		EnsureNL:  true,
 | 
							EnsureNL:  true,
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	rustRules,
 | 
						rustRules,
 | 
				
			||||||
| 
						 | 
					@ -35,20 +35,22 @@ func rustRules() Rules {
 | 
				
			||||||
			{`r#*"(?:\\.|[^\\;])*"#*`, LiteralString, nil},
 | 
								{`r#*"(?:\\.|[^\\;])*"#*`, LiteralString, nil},
 | 
				
			||||||
			{`"(?:\\.|[^\\"])*"`, LiteralString, nil},
 | 
								{`"(?:\\.|[^\\"])*"`, LiteralString, nil},
 | 
				
			||||||
			{`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil},
 | 
								{`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil},
 | 
				
			||||||
			{Words(``, `\b`, `as`, `async`, `await`, `const`, `crate`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil},
 | 
								{Words(``, `\b`, `as`, `async`, `await`, `box`, `const`, `crate`, `dyn`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil},
 | 
				
			||||||
			{Words(``, `\b`, `abstract`, `become`, `box`, `do`, `final`, `macro`, `override`, `priv`, `try`, `typeof`, `unsized`, `virtual`, `yield`), KeywordReserved, nil},
 | 
								{Words(``, `\b`, `abstract`, `become`, `do`, `final`, `macro`, `override`, `priv`, `typeof`, `try`, `unsized`, `virtual`, `yield`), KeywordReserved, nil},
 | 
				
			||||||
			{`(true|false)\b`, KeywordConstant, nil},
 | 
								{`(true|false)\b`, KeywordConstant, nil},
 | 
				
			||||||
 | 
								{`self\b`, NameBuiltinPseudo, nil},
 | 
				
			||||||
			{`mod\b`, Keyword, Push("modname")},
 | 
								{`mod\b`, Keyword, Push("modname")},
 | 
				
			||||||
			{`let\b`, KeywordDeclaration, nil},
 | 
								{`let\b`, KeywordDeclaration, nil},
 | 
				
			||||||
			{`fn\b`, Keyword, Push("funcname")},
 | 
								{`fn\b`, Keyword, Push("funcname")},
 | 
				
			||||||
			{`(struct|enum|type|union)\b`, Keyword, Push("typename")},
 | 
								{`(struct|enum|type|union)\b`, Keyword, Push("typename")},
 | 
				
			||||||
			{`(default)(\s+)(type|fn)\b`, ByGroups(Keyword, Text, Keyword), nil},
 | 
								{`(default)(\s+)(type|fn)\b`, ByGroups(Keyword, Text, Keyword), nil},
 | 
				
			||||||
			{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil},
 | 
								{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`, `usize`, `isize`, `f32`, `f64`, `char`, `str`, `bool`), KeywordType, nil},
 | 
				
			||||||
			{`self\b`, NameBuiltinPseudo, nil},
 | 
								{`[sS]elf\b`, NameBuiltinPseudo, nil},
 | 
				
			||||||
			{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
 | 
								{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Unpin`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `drop`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
 | 
				
			||||||
 | 
								{Words(``, `!`, `asm`, `assert`, `assert_eq`, `assert_ne`, `cfg`, `column`, `compile_error`, `concat`, `concat_idents`, `dbg`, `debug_assert`, `debug_assert_eq`, `debug_assert_ne`, `env`, `eprint`, `eprintln`, `file`, `format`, `format_args`, `format_args_nl`, `global_asm`, `include`, `include_bytes`, `include_str`, `is_aarch64_feature_detected`, `is_arm_feature_detected`, `is_mips64_feature_detected`, `is_mips_feature_detected`, `is_powerpc64_feature_detected`, `is_powerpc_feature_detected`, `is_x86_feature_detected`, `line`, `llvm_asm`, `log_syntax`, `macro_rules`, `matches`, `module_path`, `option_env`, `panic`, `print`, `println`, `stringify`, `thread_local`, `todo`, `trace_macros`, `unimplemented`, `unreachable`, `vec`, `write`, `writeln`), NameFunctionMagic, nil},
 | 
				
			||||||
			{`::\b`, Text, nil},
 | 
								{`::\b`, Text, nil},
 | 
				
			||||||
			{`(?::|->)`, Text, Push("typename")},
 | 
								{`(?::|->)`, Text, Push("typename")},
 | 
				
			||||||
			{`(break|continue)(\s*)(\'[A-Za-z_]\w*)?`, ByGroups(Keyword, TextWhitespace, NameLabel), nil},
 | 
								{`(break|continue)(\b\s*)(\'[A-Za-z_]\w*)?`, ByGroups(Keyword, TextWhitespace, NameLabel), nil},
 | 
				
			||||||
			{`'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil},
 | 
								{`'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil},
 | 
				
			||||||
			{`b'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil},
 | 
								{`b'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\0|\\u\{[0-9a-fA-F]{1,6}\}|.)'`, LiteralStringChar, nil},
 | 
				
			||||||
			{`0b[01_]+`, LiteralNumberBin, Push("number_lit")},
 | 
								{`0b[01_]+`, LiteralNumberBin, Push("number_lit")},
 | 
				
			||||||
| 
						 | 
					@ -57,15 +59,15 @@ func rustRules() Rules {
 | 
				
			||||||
			{`[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)`, LiteralNumberFloat, Push("number_lit")},
 | 
								{`[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)`, LiteralNumberFloat, Push("number_lit")},
 | 
				
			||||||
			{`[0-9][0-9_]*`, LiteralNumberInteger, Push("number_lit")},
 | 
								{`[0-9][0-9_]*`, LiteralNumberInteger, Push("number_lit")},
 | 
				
			||||||
			{`b"`, LiteralString, Push("bytestring")},
 | 
								{`b"`, LiteralString, Push("bytestring")},
 | 
				
			||||||
			{`b?r(#*)".*?"\1`, LiteralString, nil},
 | 
								{`(?s)b?r(#*)".*?"\1`, LiteralString, nil},
 | 
				
			||||||
			{`'static`, NameBuiltin, nil},
 | 
								{`'`, Operator, Push("lifetime")},
 | 
				
			||||||
			{`'[a-zA-Z_]\w*`, NameAttribute, nil},
 | 
								{`\.\.=?`, Operator, nil},
 | 
				
			||||||
			{`[{}()\[\],.;]`, Punctuation, nil},
 | 
								{`[{}()\[\],.;]`, Punctuation, nil},
 | 
				
			||||||
			{`[+\-*/%&|<>^!~@=:?]`, Operator, nil},
 | 
								{`[+\-*/%&|<>^!~@=:?]`, Operator, nil},
 | 
				
			||||||
			{`(r#)?[a-zA-Z_]\w*`, Name, nil},
 | 
								{`(r#)?[a-zA-Z_]\w*`, Name, nil},
 | 
				
			||||||
 | 
								{`r#[a-zA-Z_]\w*`, Name, nil},
 | 
				
			||||||
			{`#!?\[`, CommentPreproc, Push("attribute[")},
 | 
								{`#!?\[`, CommentPreproc, Push("attribute[")},
 | 
				
			||||||
			{`([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\s*)(\{)`, ByGroups(CommentPreproc, Punctuation, TextWhitespace, Name, TextWhitespace, Punctuation), Push("macro{")},
 | 
								{`#`, Text, nil},
 | 
				
			||||||
			{`([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\()`, ByGroups(CommentPreproc, Punctuation, TextWhitespace, Name, Punctuation), Push("macro(")},
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"comment": {
 | 
							"comment": {
 | 
				
			||||||
			{`[^*/]+`, CommentMultiline, nil},
 | 
								{`[^*/]+`, CommentMultiline, nil},
 | 
				
			||||||
| 
						 | 
					@ -92,11 +94,17 @@ func rustRules() Rules {
 | 
				
			||||||
		"typename": {
 | 
							"typename": {
 | 
				
			||||||
			{`\s+`, Text, nil},
 | 
								{`\s+`, Text, nil},
 | 
				
			||||||
			{`&`, KeywordPseudo, nil},
 | 
								{`&`, KeywordPseudo, nil},
 | 
				
			||||||
			{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
 | 
								{`'`, Operator, Push("lifetime")},
 | 
				
			||||||
			{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil},
 | 
								{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Unpin`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `drop`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
 | 
				
			||||||
 | 
								{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`, `usize`, `isize`, `f32`, `f64`, `char`, `str`, `bool`), KeywordType, nil},
 | 
				
			||||||
			{`[a-zA-Z_]\w*`, NameClass, Pop(1)},
 | 
								{`[a-zA-Z_]\w*`, NameClass, Pop(1)},
 | 
				
			||||||
			Default(Pop(1)),
 | 
								Default(Pop(1)),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							"lifetime": {
 | 
				
			||||||
 | 
								{`(static|_)`, NameBuiltin, nil},
 | 
				
			||||||
 | 
								{`[a-zA-Z_]+\w*`, NameAttribute, nil},
 | 
				
			||||||
 | 
								Default(Pop(1)),
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		"number_lit": {
 | 
							"number_lit": {
 | 
				
			||||||
			{`[ui](8|16|32|64|size)`, Keyword, Pop(1)},
 | 
								{`[ui](8|16|32|64|size)`, Keyword, Pop(1)},
 | 
				
			||||||
			{`f(32|64)`, Keyword, Pop(1)},
 | 
								{`f(32|64)`, Keyword, Pop(1)},
 | 
				
			||||||
| 
						 | 
					@ -112,28 +120,14 @@ func rustRules() Rules {
 | 
				
			||||||
			{`\\x[89a-fA-F][0-9a-fA-F]`, LiteralStringEscape, nil},
 | 
								{`\\x[89a-fA-F][0-9a-fA-F]`, LiteralStringEscape, nil},
 | 
				
			||||||
			Include("string"),
 | 
								Include("string"),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"macro{": {
 | 
					 | 
				
			||||||
			{`\{`, Operator, Push()},
 | 
					 | 
				
			||||||
			{`\}`, Operator, Pop(1)},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"macro(": {
 | 
					 | 
				
			||||||
			{`\(`, Operator, Push()},
 | 
					 | 
				
			||||||
			{`\)`, Operator, Pop(1)},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"attribute_common": {
 | 
							"attribute_common": {
 | 
				
			||||||
			{`"`, LiteralString, Push("string")},
 | 
								{`"`, LiteralString, Push("string")},
 | 
				
			||||||
			{`\[`, CommentPreproc, Push("attribute[")},
 | 
								{`\[`, CommentPreproc, Push("attribute[")},
 | 
				
			||||||
			{`\(`, CommentPreproc, Push("attribute(")},
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"attribute[": {
 | 
							"attribute[": {
 | 
				
			||||||
			Include("attribute_common"),
 | 
								Include("attribute_common"),
 | 
				
			||||||
			{`\];?`, CommentPreproc, Pop(1)},
 | 
								{`\]`, CommentPreproc, Pop(1)},
 | 
				
			||||||
			{`[^"\]]+`, CommentPreproc, nil},
 | 
								{`[^"\]\[]+`, CommentPreproc, nil},
 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"attribute(": {
 | 
					 | 
				
			||||||
			Include("attribute_common"),
 | 
					 | 
				
			||||||
			{`\);?`, CommentPreproc, Pop(1)},
 | 
					 | 
				
			||||||
			{`[^")]+`, CommentPreproc, nil},
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,8 +22,8 @@ var Scala = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
func scalaRules() Rules {
 | 
					func scalaRules() Rules {
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		scalaOp     = "[-~\\^\\*!%&\\\\<>\\|+=:/?@\xa6-\xa7\xa9\xac\xae\xb0-\xb1\xb6\xd7\xf7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+"
 | 
							scalaOp     = "[-~\\^\\*!%&\\\\<>\\|+=:/?@\xa6-\xa7\xa9\xac\xae\xb0-\xb1\xb6\xd7\xf7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+"
 | 
				
			||||||
		scalaUpper  = "[A-Z\\$_\xc0-\xd6\xd8-\xde\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]"
 | 
							scalaUpper  = `[\\$_\p{Lu}]`
 | 
				
			||||||
		scalaLetter = `[a-zA-Z\\$_ªµºÀ-ÖØ-öø-ʯͰ-ͳͶ-ͷͻ-ͽΆΈ-ϵϷ-ҁҊ-Ֆա-ևא-ײء-ؿف-يٮ-ٯٱ-ۓەۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪऄ-हऽॐक़-ॡॲ-ॿঅ-হঽৎড়-ৡৰ-ৱਅ-ਹਖ਼-ਫ਼ੲ-ੴઅ-હઽૐ-ૡଅ-ହଽଡ଼-ୡୱஃ-ஹௐఅ-ఽౘ-ౡಅ-ಹಽೞ-ೡഅ-ഽൠ-ൡൺ-ൿඅ-ෆก-ะา-ำเ-ๅກ-ະາ-ຳຽ-ໄໜ-ༀཀ-ཬྈ-ྋက-ဪဿၐ-ၕၚ-ၝၡၥ-ၦၮ-ၰၵ-ႁႎႠ-ჺᄀ-ፚᎀ-ᎏᎠ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᛮ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝰក-ឳៜᠠ-ᡂᡄ-ᢨᢪ-ᤜᥐ-ᦩᧁ-ᧇᨀ-ᨖᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮ-ᮯᰀ-ᰣᱍ-ᱏᱚ-ᱷᴀ-ᴫᵢ-ᵷᵹ-ᶚḀ-ᾼιῂ-ῌῐ-Ίῠ-Ῥῲ-ῼⁱⁿℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⱼⲀ-ⳤⴀ-ⵥⶀ-ⷞ〆-〇〡-〩〸-〺〼ぁ-ゖゟァ-ヺヿ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-ꀔꀖ-ꒌꔀ-ꘋꘐ-ꘟꘪ-ꙮꚀ-ꚗꜢ-ꝯꝱ-ꞇꞋ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꤊ-ꤥꤰ-ꥆꨀ-ꨨꩀ-ꩂꩄ-ꩋ가-힣豈-יִײַ-ﬨשׁ-ﴽﵐ-ﷻﹰ-ﻼA-Za-zヲ-ッア-ンᅠ-ᅵ]`
 | 
							scalaLetter = `[\\$_\p{L}]`
 | 
				
			||||||
		scalaIDRest = fmt.Sprintf(`%s(?:%s|[0-9])*(?:(?<=_)%s)?`, scalaLetter, scalaLetter, scalaOp)
 | 
							scalaIDRest = fmt.Sprintf(`%s(?:%s|[0-9])*(?:(?<=_)%s)?`, scalaLetter, scalaLetter, scalaOp)
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					package s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						. "github.com/alecthomas/chroma" // nolint
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma/lexers/internal"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Sieve lexer.
 | 
				
			||||||
 | 
					var Sieve = internal.Register(MustNewLazyLexer(
 | 
				
			||||||
 | 
						&Config{
 | 
				
			||||||
 | 
							Name:      "Sieve",
 | 
				
			||||||
 | 
							Aliases:   []string{"sieve"},
 | 
				
			||||||
 | 
							Filenames: []string{"*.siv", "*.sieve"},
 | 
				
			||||||
 | 
							MimeTypes: []string{},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						func() Rules {
 | 
				
			||||||
 | 
							return Rules{
 | 
				
			||||||
 | 
								"root": {
 | 
				
			||||||
 | 
									{`\s+`, Text, nil},
 | 
				
			||||||
 | 
									{`[();,{}\[\]]`, Punctuation, nil},
 | 
				
			||||||
 | 
									{`(?i)require`, KeywordNamespace, nil},
 | 
				
			||||||
 | 
									{`(?i)(:)(addresses|all|contains|content|create|copy|comparator|count|days|detail|domain|fcc|flags|from|handle|importance|is|localpart|length|lowerfirst|lower|matches|message|mime|options|over|percent|quotewildcard|raw|regex|specialuse|subject|text|under|upperfirst|upper|value)`, ByGroups(NameTag, NameTag), nil},
 | 
				
			||||||
 | 
									{`(?i)(address|addflag|allof|anyof|body|discard|elsif|else|envelope|ereject|exists|false|fileinto|if|hasflag|header|keep|notify_method_capability|notify|not|redirect|reject|removeflag|setflag|size|spamtest|stop|string|true|vacation|virustest)`, NameBuiltin, nil},
 | 
				
			||||||
 | 
									{`(?i)set`, KeywordDeclaration, nil},
 | 
				
			||||||
 | 
									{`([0-9.]+)([kmgKMG])?`, ByGroups(LiteralNumber, LiteralNumber), nil},
 | 
				
			||||||
 | 
									{`#.*$`, CommentSingle, nil},
 | 
				
			||||||
 | 
									{`/\*.*\*/`, CommentMultiline, nil},
 | 
				
			||||||
 | 
									{`"[^"]*?"`, LiteralString, nil},
 | 
				
			||||||
 | 
									{`text:`, NameTag, Push("text")},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								"text": {
 | 
				
			||||||
 | 
									{`[^.].*?\n`, LiteralString, nil},
 | 
				
			||||||
 | 
									{`^\.`, Punctuation, Pop(1)},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					))
 | 
				
			||||||
| 
						 | 
					@ -23,9 +23,9 @@ func sparqlRules() Rules {
 | 
				
			||||||
			{`((?i)select|construct|describe|ask|where|filter|group\s+by|minus|distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|offset|bindings|load|clear|drop|create|add|move|copy|insert\s+data|delete\s+data|delete\s+where|delete|insert|using\s+named|using|graph|default|named|all|optional|service|silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b`, Keyword, nil},
 | 
								{`((?i)select|construct|describe|ask|where|filter|group\s+by|minus|distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|offset|bindings|load|clear|drop|create|add|move|copy|insert\s+data|delete\s+data|delete\s+where|delete|insert|using\s+named|using|graph|default|named|all|optional|service|silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b`, Keyword, nil},
 | 
				
			||||||
			{`(a)\b`, Keyword, nil},
 | 
								{`(a)\b`, Keyword, nil},
 | 
				
			||||||
			{"(<(?:[^<>\"{}|^`\\\\\\x00-\\x20])*>)", NameLabel, nil},
 | 
								{"(<(?:[^<>\"{}|^`\\\\\\x00-\\x20])*>)", NameLabel, nil},
 | 
				
			||||||
			{`(_:[0-9a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_](?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀.]*[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀])?)`, NameLabel, nil},
 | 
								{`(_:[_\p{L}\p{N}](?:[-_.\p{L}\p{N}]*[-_\p{L}\p{N}])?)`, NameLabel, nil},
 | 
				
			||||||
			{`[?$][0-9a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_][a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_0-9·̀-ͯ‿-⁀]*`, NameVariable, nil},
 | 
								{`[?$][_\p{L}\p{N}]+`, NameVariable, nil},
 | 
				
			||||||
			{`([a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>](?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀.]*[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀])?)?(\:)((?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_:0-9]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))(?:(?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀.:]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))*(?:[a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-<2D>_\-0-9·̀-ͯ‿-⁀:]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%])))?)?`, ByGroups(NameNamespace, Punctuation, NameTag), nil},
 | 
								{`([\p{L}][-_.\p{L}\p{N}]*)?(\:)((?:[_:\p{L}\p{N}]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))(?:(?:[-_:.\p{L}\p{N}]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%]))*(?:[-_:\p{L}\p{N}]|(?:%[0-9A-Fa-f][0-9A-Fa-f])|(?:\\[ _~.\-!$&"()*+,;=/?#@%])))?)?`, ByGroups(NameNamespace, Punctuation, NameTag), nil},
 | 
				
			||||||
			{`((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|contains|strstarts|strends|strbefore|strafter|year|month|day|hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|count|sum|min|max|avg|sample|group_concat|separator)\b`, NameFunction, nil},
 | 
								{`((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|contains|strstarts|strends|strbefore|strafter|year|month|day|hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|count|sum|min|max|avg|sample|group_concat|separator)\b`, NameFunction, nil},
 | 
				
			||||||
			{`(true|false)`, KeywordConstant, nil},
 | 
								{`(true|false)`, KeywordConstant, nil},
 | 
				
			||||||
			{`[+\-]?(\d+\.\d*[eE][+-]?\d+|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil},
 | 
								{`[+\-]?(\d+\.\d*[eE][+-]?\d+|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -3,6 +3,7 @@ package chroma
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
| 
						 | 
					@ -238,6 +239,12 @@ func NewLazyLexer(config *Config, rulesFunc func() Rules) (*RegexLexer, error) {
 | 
				
			||||||
	if config == nil {
 | 
						if config == nil {
 | 
				
			||||||
		config = &Config{}
 | 
							config = &Config{}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						for _, glob := range append(config.Filenames, config.AliasFilenames...) {
 | 
				
			||||||
 | 
							_, err := filepath.Match(glob, "")
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, fmt.Errorf("%s: %q is not a valid glob: %w", config.Name, glob, err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return &RegexLexer{
 | 
						return &RegexLexer{
 | 
				
			||||||
		config:       config,
 | 
							config:       config,
 | 
				
			||||||
		compilerFunc: rulesFunc,
 | 
							compilerFunc: rulesFunc,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					package styles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"github.com/alecthomas/chroma"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 1S:Designer color palette
 | 
				
			||||||
 | 
					var OnesEnterprise = Register(chroma.MustNewStyle("onesenterprise", chroma.StyleEntries{
 | 
				
			||||||
 | 
						chroma.Text:           "#000000",
 | 
				
			||||||
 | 
						chroma.Comment:        "#008000",
 | 
				
			||||||
 | 
						chroma.CommentPreproc: "#963200",
 | 
				
			||||||
 | 
						chroma.Operator:       "#FF0000",
 | 
				
			||||||
 | 
						chroma.Keyword:        "#FF0000",
 | 
				
			||||||
 | 
						chroma.Punctuation:    "#FF0000",
 | 
				
			||||||
 | 
						chroma.LiteralString:  "#000000",
 | 
				
			||||||
 | 
						chroma.Name:           "#0000FF",
 | 
				
			||||||
 | 
					}))
 | 
				
			||||||
| 
						 | 
					@ -1,24 +0,0 @@
 | 
				
			||||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
 | 
					 | 
				
			||||||
*.o
 | 
					 | 
				
			||||||
*.a
 | 
					 | 
				
			||||||
*.so
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Folders
 | 
					 | 
				
			||||||
_obj
 | 
					 | 
				
			||||||
_test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Architecture specific extensions/prefixes
 | 
					 | 
				
			||||||
*.[568vq]
 | 
					 | 
				
			||||||
[568vq].out
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*.cgo1.go
 | 
					 | 
				
			||||||
*.cgo2.c
 | 
					 | 
				
			||||||
_cgo_defun.c
 | 
					 | 
				
			||||||
_cgo_gotypes.go
 | 
					 | 
				
			||||||
_cgo_export.*
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
_testmain.go
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
*.exe
 | 
					 | 
				
			||||||
*.test
 | 
					 | 
				
			||||||
*.prof
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,23 +0,0 @@
 | 
				
			||||||
Copyright (c) 2016, Daniel Wakefield
 | 
					 | 
				
			||||||
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.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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 HOLDER 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.
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,4 +0,0 @@
 | 
				
			||||||
# fnmatch
 | 
					 | 
				
			||||||
Updated clone of kballards golang fnmatch gist (https://gist.github.com/kballard/272720)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,219 +0,0 @@
 | 
				
			||||||
// Provide string-matching based on fnmatch.3
 | 
					 | 
				
			||||||
package fnmatch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// There are a few issues that I believe to be bugs, but this implementation is
 | 
					 | 
				
			||||||
// based as closely as possible on BSD fnmatch. These bugs are present in the
 | 
					 | 
				
			||||||
// source of BSD fnmatch, and so are replicated here. The issues are as follows:
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// * FNM_PERIOD is no longer observed after the first * in a pattern
 | 
					 | 
				
			||||||
//   This only applies to matches done with FNM_PATHNAME as well
 | 
					 | 
				
			||||||
// * FNM_PERIOD doesn't apply to ranges. According to the documentation,
 | 
					 | 
				
			||||||
//   a period must be matched explicitly, but a range will match it too
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"unicode"
 | 
					 | 
				
			||||||
	"unicode/utf8"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const (
 | 
					 | 
				
			||||||
	FNM_NOESCAPE = (1 << iota)
 | 
					 | 
				
			||||||
	FNM_PATHNAME
 | 
					 | 
				
			||||||
	FNM_PERIOD
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FNM_LEADING_DIR
 | 
					 | 
				
			||||||
	FNM_CASEFOLD
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FNM_IGNORECASE = FNM_CASEFOLD
 | 
					 | 
				
			||||||
	FNM_FILE_NAME  = FNM_PATHNAME
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func unpackRune(str *string) rune {
 | 
					 | 
				
			||||||
	rune, size := utf8.DecodeRuneInString(*str)
 | 
					 | 
				
			||||||
	*str = (*str)[size:]
 | 
					 | 
				
			||||||
	return rune
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Matches the pattern against the string, with the given flags,
 | 
					 | 
				
			||||||
// and returns true if the match is successful.
 | 
					 | 
				
			||||||
// This function should match fnmatch.3 as closely as possible.
 | 
					 | 
				
			||||||
func Match(pattern, s string, flags int) bool {
 | 
					 | 
				
			||||||
	// The implementation for this function was patterned after the BSD fnmatch.c
 | 
					 | 
				
			||||||
	// source found at http://src.gnu-darwin.org/src/contrib/csup/fnmatch.c.html
 | 
					 | 
				
			||||||
	noescape := (flags&FNM_NOESCAPE != 0)
 | 
					 | 
				
			||||||
	pathname := (flags&FNM_PATHNAME != 0)
 | 
					 | 
				
			||||||
	period := (flags&FNM_PERIOD != 0)
 | 
					 | 
				
			||||||
	leadingdir := (flags&FNM_LEADING_DIR != 0)
 | 
					 | 
				
			||||||
	casefold := (flags&FNM_CASEFOLD != 0)
 | 
					 | 
				
			||||||
	// the following is some bookkeeping that the original fnmatch.c implementation did not do
 | 
					 | 
				
			||||||
	// We are forced to do this because we're not keeping indexes into C strings but rather
 | 
					 | 
				
			||||||
	// processing utf8-encoded strings. Use a custom unpacker to maintain our state for us
 | 
					 | 
				
			||||||
	sAtStart := true
 | 
					 | 
				
			||||||
	sLastAtStart := true
 | 
					 | 
				
			||||||
	sLastSlash := false
 | 
					 | 
				
			||||||
	sLastUnpacked := rune(0)
 | 
					 | 
				
			||||||
	unpackS := func() rune {
 | 
					 | 
				
			||||||
		sLastSlash = (sLastUnpacked == '/')
 | 
					 | 
				
			||||||
		sLastUnpacked = unpackRune(&s)
 | 
					 | 
				
			||||||
		sLastAtStart = sAtStart
 | 
					 | 
				
			||||||
		sAtStart = false
 | 
					 | 
				
			||||||
		return sLastUnpacked
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for len(pattern) > 0 {
 | 
					 | 
				
			||||||
		c := unpackRune(&pattern)
 | 
					 | 
				
			||||||
		switch c {
 | 
					 | 
				
			||||||
		case '?':
 | 
					 | 
				
			||||||
			if len(s) == 0 {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			sc := unpackS()
 | 
					 | 
				
			||||||
			if pathname && sc == '/' {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if period && sc == '.' && (sLastAtStart || (pathname && sLastSlash)) {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		case '*':
 | 
					 | 
				
			||||||
			// collapse multiple *'s
 | 
					 | 
				
			||||||
			// don't use unpackRune here, the only char we care to detect is ASCII
 | 
					 | 
				
			||||||
			for len(pattern) > 0 && pattern[0] == '*' {
 | 
					 | 
				
			||||||
				pattern = pattern[1:]
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if period && s[0] == '.' && (sAtStart || (pathname && sLastUnpacked == '/')) {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// optimize for patterns with * at end or before /
 | 
					 | 
				
			||||||
			if len(pattern) == 0 {
 | 
					 | 
				
			||||||
				if pathname {
 | 
					 | 
				
			||||||
					return leadingdir || (strchr(s, '/') == -1)
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					return true
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				return !(pathname && strchr(s, '/') >= 0)
 | 
					 | 
				
			||||||
			} else if pathname && pattern[0] == '/' {
 | 
					 | 
				
			||||||
				offset := strchr(s, '/')
 | 
					 | 
				
			||||||
				if offset == -1 {
 | 
					 | 
				
			||||||
					return false
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					// we already know our pattern and string have a /, skip past it
 | 
					 | 
				
			||||||
					s = s[offset:] // use unpackS here to maintain our bookkeeping state
 | 
					 | 
				
			||||||
					unpackS()
 | 
					 | 
				
			||||||
					pattern = pattern[1:] // we know / is one byte long
 | 
					 | 
				
			||||||
					break
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// general case, recurse
 | 
					 | 
				
			||||||
			for test := s; len(test) > 0; unpackRune(&test) {
 | 
					 | 
				
			||||||
				// I believe the (flags &^ FNM_PERIOD) is a bug when FNM_PATHNAME is specified
 | 
					 | 
				
			||||||
				// but this follows exactly from how fnmatch.c implements it
 | 
					 | 
				
			||||||
				if Match(pattern, test, (flags &^ FNM_PERIOD)) {
 | 
					 | 
				
			||||||
					return true
 | 
					 | 
				
			||||||
				} else if pathname && test[0] == '/' {
 | 
					 | 
				
			||||||
					break
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return false
 | 
					 | 
				
			||||||
		case '[':
 | 
					 | 
				
			||||||
			if len(s) == 0 {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if pathname && s[0] == '/' {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			sc := unpackS()
 | 
					 | 
				
			||||||
			if !rangematch(&pattern, sc, flags) {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		case '\\':
 | 
					 | 
				
			||||||
			if !noescape {
 | 
					 | 
				
			||||||
				if len(pattern) > 0 {
 | 
					 | 
				
			||||||
					c = unpackRune(&pattern)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			fallthrough
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			if len(s) == 0 {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			sc := unpackS()
 | 
					 | 
				
			||||||
			switch {
 | 
					 | 
				
			||||||
			case sc == c:
 | 
					 | 
				
			||||||
			case casefold && unicode.ToLower(sc) == unicode.ToLower(c):
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return len(s) == 0 || (leadingdir && s[0] == '/')
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func rangematch(pattern *string, test rune, flags int) bool {
 | 
					 | 
				
			||||||
	if len(*pattern) == 0 {
 | 
					 | 
				
			||||||
		return false
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	casefold := (flags&FNM_CASEFOLD != 0)
 | 
					 | 
				
			||||||
	noescape := (flags&FNM_NOESCAPE != 0)
 | 
					 | 
				
			||||||
	if casefold {
 | 
					 | 
				
			||||||
		test = unicode.ToLower(test)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	var negate, matched bool
 | 
					 | 
				
			||||||
	if (*pattern)[0] == '^' || (*pattern)[0] == '!' {
 | 
					 | 
				
			||||||
		negate = true
 | 
					 | 
				
			||||||
		(*pattern) = (*pattern)[1:]
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for !matched && len(*pattern) > 1 && (*pattern)[0] != ']' {
 | 
					 | 
				
			||||||
		c := unpackRune(pattern)
 | 
					 | 
				
			||||||
		if !noescape && c == '\\' {
 | 
					 | 
				
			||||||
			if len(*pattern) > 1 {
 | 
					 | 
				
			||||||
				c = unpackRune(pattern)
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				return false
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if casefold {
 | 
					 | 
				
			||||||
			c = unicode.ToLower(c)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (*pattern)[0] == '-' && len(*pattern) > 1 && (*pattern)[1] != ']' {
 | 
					 | 
				
			||||||
			unpackRune(pattern) // skip the -
 | 
					 | 
				
			||||||
			c2 := unpackRune(pattern)
 | 
					 | 
				
			||||||
			if !noescape && c2 == '\\' {
 | 
					 | 
				
			||||||
				if len(*pattern) > 0 {
 | 
					 | 
				
			||||||
					c2 = unpackRune(pattern)
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					return false
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if casefold {
 | 
					 | 
				
			||||||
				c2 = unicode.ToLower(c2)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// this really should be more intelligent, but it looks like
 | 
					 | 
				
			||||||
			// fnmatch.c does simple int comparisons, therefore we will as well
 | 
					 | 
				
			||||||
			if c <= test && test <= c2 {
 | 
					 | 
				
			||||||
				matched = true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else if c == test {
 | 
					 | 
				
			||||||
			matched = true
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// skip past the rest of the pattern
 | 
					 | 
				
			||||||
	ok := false
 | 
					 | 
				
			||||||
	for !ok && len(*pattern) > 0 {
 | 
					 | 
				
			||||||
		c := unpackRune(pattern)
 | 
					 | 
				
			||||||
		if c == '\\' && len(*pattern) > 0 {
 | 
					 | 
				
			||||||
			unpackRune(pattern)
 | 
					 | 
				
			||||||
		} else if c == ']' {
 | 
					 | 
				
			||||||
			ok = true
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return ok && matched != negate
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// define strchr because strings.Index() seems a bit overkill
 | 
					 | 
				
			||||||
// returns the index of c in s, or -1 if there is no match
 | 
					 | 
				
			||||||
func strchr(s string, c rune) int {
 | 
					 | 
				
			||||||
	for i, sc := range s {
 | 
					 | 
				
			||||||
		if sc == c {
 | 
					 | 
				
			||||||
			return i
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return -1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the
 | 
				
			||||||
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
 | 
					ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
 | 
				
			||||||
let it know that a system call is running.
 | 
					let it know that a system call is running.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When porting Go to an new architecture/OS, this file must be implemented for
 | 
					When porting Go to a new architecture/OS, this file must be implemented for
 | 
				
			||||||
each GOOS/GOARCH pair.
 | 
					each GOOS/GOARCH pair.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### mksysnum
 | 
					### mksysnum
 | 
				
			||||||
| 
						 | 
					@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not.
 | 
				
			||||||
Adding a new syscall often just requires adding a new `//sys` function prototype
 | 
					Adding a new syscall often just requires adding a new `//sys` function prototype
 | 
				
			||||||
with the desired arguments and a capitalized name so it is exported. However, if
 | 
					with the desired arguments and a capitalized name so it is exported. However, if
 | 
				
			||||||
you want the interface to the syscall to be different, often one will make an
 | 
					you want the interface to the syscall to be different, often one will make an
 | 
				
			||||||
unexported `//sys` prototype, an then write a custom wrapper in
 | 
					unexported `//sys` prototype, and then write a custom wrapper in
 | 
				
			||||||
`syscall_${GOOS}.go`.
 | 
					`syscall_${GOOS}.go`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### types files
 | 
					### types files
 | 
				
			||||||
| 
						 | 
					@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This script is used to generate the system's various constants. This doesn't
 | 
					This script is used to generate the system's various constants. This doesn't
 | 
				
			||||||
just include the error numbers and error strings, but also the signal numbers
 | 
					just include the error numbers and error strings, but also the signal numbers
 | 
				
			||||||
an a wide variety of miscellaneous constants. The constants come from the list
 | 
					and a wide variety of miscellaneous constants. The constants come from the list
 | 
				
			||||||
of include files in the `includes_${uname}` variable. A regex then picks out
 | 
					of include files in the `includes_${uname}` variable. A regex then picks out
 | 
				
			||||||
the desired `#define` statements, and generates the corresponding Go constants.
 | 
					the desired `#define` statements, and generates the corresponding Go constants.
 | 
				
			||||||
The error numbers and strings are generated from `#include <errno.h>`, and the
 | 
					The error numbers and strings are generated from `#include <errno.h>`, and the
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable.
 | 
				
			||||||
Then, edit the regex (if necessary) to match the desired constant. Avoid making
 | 
					Then, edit the regex (if necessary) to match the desired constant. Avoid making
 | 
				
			||||||
the regex too broad to avoid matching unintended constants.
 | 
					the regex too broad to avoid matching unintended constants.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### mkmerge.go
 | 
					### internal/mkmerge
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This program is used to extract duplicate const, func, and type declarations
 | 
					This program is used to extract duplicate const, func, and type declarations
 | 
				
			||||||
from the generated architecture-specific files listed below, and merge these
 | 
					from the generated architecture-specific files listed below, and merge these
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
 | 
				
			||||||
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
				
			||||||
// +build go1.9
 | 
					// +build go1.9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					// Copyright 2021 The Go Authors. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build (freebsd || netbsd || openbsd) && gc
 | 
				
			||||||
 | 
					// +build freebsd netbsd openbsd
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					// System call support for 386 BSD
 | 
				
			||||||
// System call support for 386, Darwin
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					// Just jump to package syscall's implementation for all these functions.
 | 
				
			||||||
// The runtime may know about them.
 | 
					// The runtime may know about them.
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
						JMP	syscall·Syscall9(SB)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
 | 
					TEXT	·RawSyscall(SB),NOSPLIT,$0-28
 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
						JMP	syscall·RawSyscall(SB)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					// Copyright 2021 The Go Authors. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
 | 
				
			||||||
 | 
					// +build darwin dragonfly freebsd netbsd openbsd
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					// System call support for AMD64 BSD
 | 
				
			||||||
// System call support for AMD64, OpenBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					// Just jump to package syscall's implementation for all these functions.
 | 
				
			||||||
// The runtime may know about them.
 | 
					// The runtime may know about them.
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
// Copyright 2013 The Go Authors. All rights reserved.
 | 
					// Copyright 2021 The Go Authors. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build (freebsd || netbsd || openbsd) && gc
 | 
				
			||||||
 | 
					// +build freebsd netbsd openbsd
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					// System call support for ARM BSD
 | 
				
			||||||
// System call support for ARM, NetBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					// Just jump to package syscall's implementation for all these functions.
 | 
				
			||||||
// The runtime may know about them.
 | 
					// The runtime may know about them.
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					// Copyright 2021 The Go Authors. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build (darwin || freebsd || netbsd || openbsd) && gc
 | 
				
			||||||
 | 
					// +build darwin freebsd netbsd openbsd
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					// System call support for ARM64 BSD
 | 
				
			||||||
// System call support for AMD64, NetBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					// Just jump to package syscall's implementation for all these functions.
 | 
				
			||||||
// The runtime may know about them.
 | 
					// The runtime may know about them.
 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for AMD64, Darwin
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,30 +0,0 @@
 | 
				
			||||||
// Copyright 2015 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 !gccgo
 | 
					 | 
				
			||||||
// +build arm,darwin
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for ARM, Darwin
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	B	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,30 +0,0 @@
 | 
				
			||||||
// Copyright 2015 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 !gccgo
 | 
					 | 
				
			||||||
// +build arm64,darwin
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for AMD64, Darwin
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	B	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	B	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	B	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for AMD64, DragonFly
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for 386, FreeBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for AMD64, FreeBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// 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.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for ARM, FreeBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	B	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2018 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 !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for ARM64, FreeBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,10 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build linux && arm64 && gc
 | 
				
			||||||
// +build linux
 | 
					// +build linux
 | 
				
			||||||
// +build arm64
 | 
					// +build arm64
 | 
				
			||||||
// +build !gccgo
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,10 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build linux && (mips64 || mips64le) && gc
 | 
				
			||||||
// +build linux
 | 
					// +build linux
 | 
				
			||||||
// +build mips64 mips64le
 | 
					// +build mips64 mips64le
 | 
				
			||||||
// +build !gccgo
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,10 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build linux && (mips || mipsle) && gc
 | 
				
			||||||
// +build linux
 | 
					// +build linux
 | 
				
			||||||
// +build mips mipsle
 | 
					// +build mips mipsle
 | 
				
			||||||
// +build !gccgo
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,10 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build linux && (ppc64 || ppc64le) && gc
 | 
				
			||||||
// +build linux
 | 
					// +build linux
 | 
				
			||||||
// +build ppc64 ppc64le
 | 
					// +build ppc64 ppc64le
 | 
				
			||||||
// +build !gccgo
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,9 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build riscv64,!gccgo
 | 
					//go:build riscv64 && gc
 | 
				
			||||||
 | 
					// +build riscv64
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,10 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build s390x
 | 
					//go:build linux && s390x && gc
 | 
				
			||||||
// +build linux
 | 
					// +build linux
 | 
				
			||||||
// +build !gccgo
 | 
					// +build s390x
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for 386, NetBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2019 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 !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for ARM64, NetBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	B	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	B	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-104
 | 
					 | 
				
			||||||
	B	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-56
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// Copyright 2009 The Go Authors. All rights reserved.
 | 
					 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// +build !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for 386, OpenBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	JMP	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	JMP	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,29 +0,0 @@
 | 
				
			||||||
// 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 !gccgo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "textflag.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// System call support for ARM, OpenBSD
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					 | 
				
			||||||
// The runtime may know about them.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·Syscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·Syscall6(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·Syscall9(SB),NOSPLIT,$0-52
 | 
					 | 
				
			||||||
	B	syscall·Syscall9(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall(SB),NOSPLIT,$0-28
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall(SB)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
 | 
					 | 
				
			||||||
	B	syscall·RawSyscall6(SB)
 | 
					 | 
				
			||||||
| 
						 | 
					@ -2,12 +2,13 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// System call support for arm64, OpenBSD
 | 
					// System call support for mips64, OpenBSD
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Just jump to package syscall's implementation for all these functions.
 | 
					// Just jump to package syscall's implementation for all these functions.
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build !gccgo
 | 
					//go:build gc
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "textflag.h"
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,426 @@
 | 
				
			||||||
 | 
					// Copyright 2020 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:build zos && s390x && gc
 | 
				
			||||||
 | 
					// +build zos
 | 
				
			||||||
 | 
					// +build s390x
 | 
				
			||||||
 | 
					// +build gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "textflag.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PSALAA            1208(R0)
 | 
				
			||||||
 | 
					#define GTAB64(x)           80(x)
 | 
				
			||||||
 | 
					#define LCA64(x)            88(x)
 | 
				
			||||||
 | 
					#define CAA(x)               8(x)
 | 
				
			||||||
 | 
					#define EDCHPXV(x)        1016(x)       // in the CAA
 | 
				
			||||||
 | 
					#define SAVSTACK_ASYNC(x)  336(x)       // in the LCA
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SS_*, where x=SAVSTACK_ASYNC
 | 
				
			||||||
 | 
					#define SS_LE(x)             0(x)
 | 
				
			||||||
 | 
					#define SS_GO(x)             8(x)
 | 
				
			||||||
 | 
					#define SS_ERRNO(x)         16(x)
 | 
				
			||||||
 | 
					#define SS_ERRNOJR(x)       20(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·clearErrno(SB),NOSPLIT,$0-0
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVD	$0, 0(R3)
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Returns the address of errno in R3.
 | 
				
			||||||
 | 
					TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get __errno FuncDesc.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						ADD	$(0x156*16), R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Switch to saved LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call __errno function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Switch back to Go stack.
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_syscall(SB),NOSPLIT,$0-56
 | 
				
			||||||
 | 
						BL	runtime·entersyscall(SB)
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+32(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+40(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+48(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+48(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						BL	runtime·exitsyscall(SB)
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+32(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+40(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+48(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+48(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80
 | 
				
			||||||
 | 
						BL	runtime·entersyscall(SB)
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Fill in parameter list.
 | 
				
			||||||
 | 
						MOVD	a4+32(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+24)(R4)
 | 
				
			||||||
 | 
						MOVD	a5+40(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+32)(R4)
 | 
				
			||||||
 | 
						MOVD	a6+48(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+40)(R4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+56(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+64(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+72(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+72(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						BL	runtime·exitsyscall(SB)
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Fill in parameter list.
 | 
				
			||||||
 | 
						MOVD	a4+32(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+24)(R4)
 | 
				
			||||||
 | 
						MOVD	a5+40(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+32)(R4)
 | 
				
			||||||
 | 
						MOVD	a6+48(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+40)(R4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+56(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+64(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+72(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	·rrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+72(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_syscall9(SB),NOSPLIT,$0
 | 
				
			||||||
 | 
						BL	runtime·entersyscall(SB)
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Fill in parameter list.
 | 
				
			||||||
 | 
						MOVD	a4+32(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+24)(R4)
 | 
				
			||||||
 | 
						MOVD	a5+40(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+32)(R4)
 | 
				
			||||||
 | 
						MOVD	a6+48(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+40)(R4)
 | 
				
			||||||
 | 
						MOVD	a7+56(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+48)(R4)
 | 
				
			||||||
 | 
						MOVD	a8+64(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+56)(R4)
 | 
				
			||||||
 | 
						MOVD	a9+72(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+64)(R4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+80(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+88(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+96(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+96(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
					        BL	runtime·exitsyscall(SB)
 | 
				
			||||||
 | 
					        RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0
 | 
				
			||||||
 | 
						MOVD	a1+8(FP), R1
 | 
				
			||||||
 | 
						MOVD	a2+16(FP), R2
 | 
				
			||||||
 | 
						MOVD	a3+24(FP), R3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get function.
 | 
				
			||||||
 | 
						MOVD	CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD	EDCHPXV(R9), R9
 | 
				
			||||||
 | 
						MOVD	trap+0(FP), R5
 | 
				
			||||||
 | 
						SLD	$4, R5
 | 
				
			||||||
 | 
						ADD	R5, R9
 | 
				
			||||||
 | 
						LMG	0(R9), R5, R6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Restore LE stack.
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R4
 | 
				
			||||||
 | 
						MOVD	$0, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Fill in parameter list.
 | 
				
			||||||
 | 
						MOVD	a4+32(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+24)(R4)
 | 
				
			||||||
 | 
						MOVD	a5+40(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+32)(R4)
 | 
				
			||||||
 | 
						MOVD	a6+48(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+40)(R4)
 | 
				
			||||||
 | 
						MOVD	a7+56(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+48)(R4)
 | 
				
			||||||
 | 
						MOVD	a8+64(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+56)(R4)
 | 
				
			||||||
 | 
						MOVD	a9+72(FP), R12
 | 
				
			||||||
 | 
						MOVD	R12, (2176+64)(R4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Call function.
 | 
				
			||||||
 | 
						LE_CALL
 | 
				
			||||||
 | 
						NOPH
 | 
				
			||||||
 | 
						XOR	R0, R0      // Restore R0 to $0.
 | 
				
			||||||
 | 
						MOVD	R4, 0(R9)   // Save stack pointer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R3, r1+80(FP)
 | 
				
			||||||
 | 
						MOVD	R0, r2+88(FP)
 | 
				
			||||||
 | 
						MOVD	R0, err+96(FP)
 | 
				
			||||||
 | 
						MOVW	R3, R4
 | 
				
			||||||
 | 
						CMP	R4, $-1
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
						BL	addrerrno<>(SB)
 | 
				
			||||||
 | 
						MOVWZ	0(R3), R3
 | 
				
			||||||
 | 
						MOVD	R3, err+96(FP)
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
 | 
				
			||||||
 | 
					TEXT ·svcCall(SB),NOSPLIT,$0
 | 
				
			||||||
 | 
						BL	runtime·save_g(SB)   // Save g and stack pointer
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	R15, 0(R9)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	argv+8(FP), R1       // Move function arguments into registers
 | 
				
			||||||
 | 
						MOVD	dsa+16(FP), g
 | 
				
			||||||
 | 
						MOVD	fnptr+0(FP), R15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BYTE	$0x0D                // Branch to function
 | 
				
			||||||
 | 
						BYTE	$0xEF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BL	runtime·load_g(SB)   // Restore g and stack pointer
 | 
				
			||||||
 | 
						MOVW	PSALAA, R8
 | 
				
			||||||
 | 
						MOVD	LCA64(R8), R8
 | 
				
			||||||
 | 
						MOVD	SAVSTACK_ASYNC(R8), R9
 | 
				
			||||||
 | 
						MOVD	0(R9), R15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// func svcLoad(name *byte) unsafe.Pointer
 | 
				
			||||||
 | 
					TEXT ·svcLoad(SB),NOSPLIT,$0
 | 
				
			||||||
 | 
						MOVD	R15, R2          // Save go stack pointer
 | 
				
			||||||
 | 
						MOVD	name+0(FP), R0   // Move SVC args into registers
 | 
				
			||||||
 | 
						MOVD	$0x80000000, R1
 | 
				
			||||||
 | 
						MOVD	$0, R15
 | 
				
			||||||
 | 
						BYTE	$0x0A            // SVC 08 LOAD
 | 
				
			||||||
 | 
						BYTE	$0x08
 | 
				
			||||||
 | 
						MOVW	R15, R3          // Save return code from SVC
 | 
				
			||||||
 | 
						MOVD	R2, R15          // Restore go stack pointer
 | 
				
			||||||
 | 
						CMP	R3, $0           // Check SVC return code
 | 
				
			||||||
 | 
						BNE	error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	$-2, R3          // Reset last bit of entry point to zero
 | 
				
			||||||
 | 
						AND	R0, R3
 | 
				
			||||||
 | 
						MOVD	R3, addr+8(FP)   // Return entry point returned by SVC
 | 
				
			||||||
 | 
						CMP	R0, R3           // Check if last bit of entry point was set
 | 
				
			||||||
 | 
						BNE	done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						MOVD	R15, R2          // Save go stack pointer
 | 
				
			||||||
 | 
						MOVD	$0, R15          // Move SVC args into registers (entry point still in r0 from SVC 08)
 | 
				
			||||||
 | 
						BYTE	$0x0A            // SVC 09 DELETE
 | 
				
			||||||
 | 
						BYTE	$0x09
 | 
				
			||||||
 | 
						MOVD	R2, R15          // Restore go stack pointer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					error:
 | 
				
			||||||
 | 
						MOVD	$0, addr+8(FP)   // Return 0 on failure
 | 
				
			||||||
 | 
					done:
 | 
				
			||||||
 | 
						XOR	R0, R0           // Reset r0 to 0
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// func svcUnload(name *byte, fnptr unsafe.Pointer) int64
 | 
				
			||||||
 | 
					TEXT ·svcUnload(SB),NOSPLIT,$0
 | 
				
			||||||
 | 
						MOVD	R15, R2          // Save go stack pointer
 | 
				
			||||||
 | 
						MOVD	name+0(FP), R0   // Move SVC args into registers
 | 
				
			||||||
 | 
						MOVD	addr+8(FP), R15
 | 
				
			||||||
 | 
						BYTE	$0x0A            // SVC 09
 | 
				
			||||||
 | 
						BYTE	$0x09
 | 
				
			||||||
 | 
						XOR	R0, R0           // Reset r0 to 0
 | 
				
			||||||
 | 
						MOVD	R15, R1          // Save SVC return code
 | 
				
			||||||
 | 
						MOVD	R2, R15          // Restore go stack pointer
 | 
				
			||||||
 | 
						MOVD	R1, rc+0(FP)     // Return SVC return code
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// func gettid() uint64
 | 
				
			||||||
 | 
					TEXT ·gettid(SB), NOSPLIT, $0
 | 
				
			||||||
 | 
						// Get library control area (LCA).
 | 
				
			||||||
 | 
						MOVW PSALAA, R8
 | 
				
			||||||
 | 
						MOVD LCA64(R8), R8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get CEECAATHDID
 | 
				
			||||||
 | 
						MOVD CAA(R8), R9
 | 
				
			||||||
 | 
						MOVD 0x3D0(R9), R9
 | 
				
			||||||
 | 
						MOVD R9, ret+0(FP)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RET
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build freebsd
 | 
				
			||||||
// +build freebsd
 | 
					// +build freebsd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
				
			||||||
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix
 | 
					//go:build aix && ppc
 | 
				
			||||||
// +build ppc
 | 
					// +build aix,ppc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Functions to access/create device major and minor numbers matching the
 | 
					// Functions to access/create device major and minor numbers matching the
 | 
				
			||||||
// encoding used by AIX.
 | 
					// encoding used by AIX.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix
 | 
					//go:build aix && ppc64
 | 
				
			||||||
// +build ppc64
 | 
					// +build aix,ppc64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Functions to access/create device major and minor numbers matching the
 | 
					// Functions to access/create device major and minor numbers matching the
 | 
				
			||||||
// encoding used AIX.
 | 
					// encoding used AIX.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,29 @@
 | 
				
			||||||
 | 
					// Copyright 2020 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:build zos && s390x
 | 
				
			||||||
 | 
					// +build zos,s390x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Functions to access/create device major and minor numbers matching the
 | 
				
			||||||
 | 
					// encoding used by z/OS.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The information below is extracted and adapted from <sys/stat.h> macros.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Major returns the major component of a z/OS device number.
 | 
				
			||||||
 | 
					func Major(dev uint64) uint32 {
 | 
				
			||||||
 | 
						return uint32((dev >> 16) & 0x0000FFFF)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Minor returns the minor component of a z/OS device number.
 | 
				
			||||||
 | 
					func Minor(dev uint64) uint32 {
 | 
				
			||||||
 | 
						return uint32(dev & 0x0000FFFF)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Mkdev returns a z/OS device number generated from the given major and minor
 | 
				
			||||||
 | 
					// components.
 | 
				
			||||||
 | 
					func Mkdev(major, minor uint32) uint64 {
 | 
				
			||||||
 | 
						return (uint64(major) << 16) | uint64(minor)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// +build ppc64 s390x mips mips64
 | 
					//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
 | 
				
			||||||
 | 
					// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64
 | 
					//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
 | 
				
			||||||
 | 
					// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
				
			||||||
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Unix environment variables.
 | 
					// Unix environment variables.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,221 @@
 | 
				
			||||||
 | 
					// Copyright 2020 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:build zos && s390x
 | 
				
			||||||
 | 
					// +build zos,s390x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"sync"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// This file simulates epoll on z/OS using poll.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Analogous to epoll_event on Linux.
 | 
				
			||||||
 | 
					// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove?
 | 
				
			||||||
 | 
					type EpollEvent struct {
 | 
				
			||||||
 | 
						Events uint32
 | 
				
			||||||
 | 
						Fd     int32
 | 
				
			||||||
 | 
						Pad    int32
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						EPOLLERR      = 0x8
 | 
				
			||||||
 | 
						EPOLLHUP      = 0x10
 | 
				
			||||||
 | 
						EPOLLIN       = 0x1
 | 
				
			||||||
 | 
						EPOLLMSG      = 0x400
 | 
				
			||||||
 | 
						EPOLLOUT      = 0x4
 | 
				
			||||||
 | 
						EPOLLPRI      = 0x2
 | 
				
			||||||
 | 
						EPOLLRDBAND   = 0x80
 | 
				
			||||||
 | 
						EPOLLRDNORM   = 0x40
 | 
				
			||||||
 | 
						EPOLLWRBAND   = 0x200
 | 
				
			||||||
 | 
						EPOLLWRNORM   = 0x100
 | 
				
			||||||
 | 
						EPOLL_CTL_ADD = 0x1
 | 
				
			||||||
 | 
						EPOLL_CTL_DEL = 0x2
 | 
				
			||||||
 | 
						EPOLL_CTL_MOD = 0x3
 | 
				
			||||||
 | 
						// The following constants are part of the epoll API, but represent
 | 
				
			||||||
 | 
						// currently unsupported functionality on z/OS.
 | 
				
			||||||
 | 
						// EPOLL_CLOEXEC  = 0x80000
 | 
				
			||||||
 | 
						// EPOLLET        = 0x80000000
 | 
				
			||||||
 | 
						// EPOLLONESHOT   = 0x40000000
 | 
				
			||||||
 | 
						// EPOLLRDHUP     = 0x2000     // Typically used with edge-triggered notis
 | 
				
			||||||
 | 
						// EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode
 | 
				
			||||||
 | 
						// EPOLLWAKEUP    = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL
 | 
				
			||||||
 | 
					// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// epToPollEvt converts epoll event field to poll equivalent.
 | 
				
			||||||
 | 
					// In epoll, Events is a 32-bit field, while poll uses 16 bits.
 | 
				
			||||||
 | 
					func epToPollEvt(events uint32) int16 {
 | 
				
			||||||
 | 
						var ep2p = map[uint32]int16{
 | 
				
			||||||
 | 
							EPOLLIN:  POLLIN,
 | 
				
			||||||
 | 
							EPOLLOUT: POLLOUT,
 | 
				
			||||||
 | 
							EPOLLHUP: POLLHUP,
 | 
				
			||||||
 | 
							EPOLLPRI: POLLPRI,
 | 
				
			||||||
 | 
							EPOLLERR: POLLERR,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var pollEvts int16 = 0
 | 
				
			||||||
 | 
						for epEvt, pEvt := range ep2p {
 | 
				
			||||||
 | 
							if (events & epEvt) != 0 {
 | 
				
			||||||
 | 
								pollEvts |= pEvt
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return pollEvts
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields.
 | 
				
			||||||
 | 
					func pToEpollEvt(revents int16) uint32 {
 | 
				
			||||||
 | 
						var p2ep = map[int16]uint32{
 | 
				
			||||||
 | 
							POLLIN:  EPOLLIN,
 | 
				
			||||||
 | 
							POLLOUT: EPOLLOUT,
 | 
				
			||||||
 | 
							POLLHUP: EPOLLHUP,
 | 
				
			||||||
 | 
							POLLPRI: EPOLLPRI,
 | 
				
			||||||
 | 
							POLLERR: EPOLLERR,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var epollEvts uint32 = 0
 | 
				
			||||||
 | 
						for pEvt, epEvt := range p2ep {
 | 
				
			||||||
 | 
							if (revents & pEvt) != 0 {
 | 
				
			||||||
 | 
								epollEvts |= epEvt
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return epollEvts
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Per-process epoll implementation.
 | 
				
			||||||
 | 
					type epollImpl struct {
 | 
				
			||||||
 | 
						mu       sync.Mutex
 | 
				
			||||||
 | 
						epfd2ep  map[int]*eventPoll
 | 
				
			||||||
 | 
						nextEpfd int
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances.
 | 
				
			||||||
 | 
					// On Linux, this is an in-kernel data structure accessed through a fd.
 | 
				
			||||||
 | 
					type eventPoll struct {
 | 
				
			||||||
 | 
						mu  sync.Mutex
 | 
				
			||||||
 | 
						fds map[int]*EpollEvent
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// epoll impl for this process.
 | 
				
			||||||
 | 
					var impl epollImpl = epollImpl{
 | 
				
			||||||
 | 
						epfd2ep:  make(map[int]*eventPoll),
 | 
				
			||||||
 | 
						nextEpfd: 0,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *epollImpl) epollcreate(size int) (epfd int, err error) {
 | 
				
			||||||
 | 
						e.mu.Lock()
 | 
				
			||||||
 | 
						defer e.mu.Unlock()
 | 
				
			||||||
 | 
						epfd = e.nextEpfd
 | 
				
			||||||
 | 
						e.nextEpfd++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						e.epfd2ep[epfd] = &eventPoll{
 | 
				
			||||||
 | 
							fds: make(map[int]*EpollEvent),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return epfd, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *epollImpl) epollcreate1(flag int) (fd int, err error) {
 | 
				
			||||||
 | 
						return e.epollcreate(4)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) {
 | 
				
			||||||
 | 
						e.mu.Lock()
 | 
				
			||||||
 | 
						defer e.mu.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ep, ok := e.epfd2ep[epfd]
 | 
				
			||||||
 | 
						if !ok {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return EBADF
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch op {
 | 
				
			||||||
 | 
						case EPOLL_CTL_ADD:
 | 
				
			||||||
 | 
							// TODO(neeilan): When we make epfds and fds disjoint, detect epoll
 | 
				
			||||||
 | 
							// loops here (instances watching each other) and return ELOOP.
 | 
				
			||||||
 | 
							if _, ok := ep.fds[fd]; ok {
 | 
				
			||||||
 | 
								return EEXIST
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ep.fds[fd] = event
 | 
				
			||||||
 | 
						case EPOLL_CTL_MOD:
 | 
				
			||||||
 | 
							if _, ok := ep.fds[fd]; !ok {
 | 
				
			||||||
 | 
								return ENOENT
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							ep.fds[fd] = event
 | 
				
			||||||
 | 
						case EPOLL_CTL_DEL:
 | 
				
			||||||
 | 
							if _, ok := ep.fds[fd]; !ok {
 | 
				
			||||||
 | 
								return ENOENT
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							delete(ep.fds, fd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Must be called while holding ep.mu
 | 
				
			||||||
 | 
					func (ep *eventPoll) getFds() []int {
 | 
				
			||||||
 | 
						fds := make([]int, len(ep.fds))
 | 
				
			||||||
 | 
						for fd := range ep.fds {
 | 
				
			||||||
 | 
							fds = append(fds, fd)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return fds
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) {
 | 
				
			||||||
 | 
						e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait
 | 
				
			||||||
 | 
						ep, ok := e.epfd2ep[epfd]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !ok {
 | 
				
			||||||
 | 
							e.mu.Unlock()
 | 
				
			||||||
 | 
							return 0, EBADF
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pollfds := make([]PollFd, 4)
 | 
				
			||||||
 | 
						for fd, epollevt := range ep.fds {
 | 
				
			||||||
 | 
							pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						e.mu.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						n, err = Poll(pollfds, msec)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return n, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						i := 0
 | 
				
			||||||
 | 
						for _, pFd := range pollfds {
 | 
				
			||||||
 | 
							if pFd.Revents != 0 {
 | 
				
			||||||
 | 
								events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)}
 | 
				
			||||||
 | 
								i++
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if i == n {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return n, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func EpollCreate(size int) (fd int, err error) {
 | 
				
			||||||
 | 
						return impl.epollcreate(size)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func EpollCreate1(flag int) (fd int, err error) {
 | 
				
			||||||
 | 
						return impl.epollcreate1(flag)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
 | 
				
			||||||
 | 
						return impl.epollctl(epfd, op, fd, event)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Because EpollWait mutates events, the caller is expected to coordinate
 | 
				
			||||||
 | 
					// concurrent access if calling with the same epfd from multiple goroutines.
 | 
				
			||||||
 | 
					func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
 | 
				
			||||||
 | 
						return impl.epollwait(epfd, events, msec)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build dragonfly || freebsd || linux || netbsd || openbsd
 | 
				
			||||||
// +build dragonfly freebsd linux netbsd openbsd
 | 
					// +build dragonfly freebsd linux netbsd openbsd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,3 +16,9 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
 | 
				
			||||||
	_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
 | 
						_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
 | 
				
			||||||
	return err
 | 
						return err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command.
 | 
				
			||||||
 | 
					func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error {
 | 
				
			||||||
 | 
						_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore))))
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,10 @@
 | 
				
			||||||
// +build linux,386 linux,arm linux,mips linux,mipsle
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Copyright 2014 The Go Authors. All rights reserved.
 | 
					// Copyright 2014 The Go Authors. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
 | 
				
			||||||
 | 
					// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
				
			||||||
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,164 @@
 | 
				
			||||||
 | 
					// Copyright 2020 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:build zos && s390x
 | 
				
			||||||
 | 
					// +build zos,s390x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"unsafe"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func Fstatfs(fd int, stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var stat_v Statvfs_t
 | 
				
			||||||
 | 
						err = Fstatvfs(fd, &stat_v)
 | 
				
			||||||
 | 
						if err == nil {
 | 
				
			||||||
 | 
							// populate stat
 | 
				
			||||||
 | 
							stat.Type = 0
 | 
				
			||||||
 | 
							stat.Bsize = stat_v.Bsize
 | 
				
			||||||
 | 
							stat.Blocks = stat_v.Blocks
 | 
				
			||||||
 | 
							stat.Bfree = stat_v.Bfree
 | 
				
			||||||
 | 
							stat.Bavail = stat_v.Bavail
 | 
				
			||||||
 | 
							stat.Files = stat_v.Files
 | 
				
			||||||
 | 
							stat.Ffree = stat_v.Ffree
 | 
				
			||||||
 | 
							stat.Fsid = stat_v.Fsid
 | 
				
			||||||
 | 
							stat.Namelen = stat_v.Namemax
 | 
				
			||||||
 | 
							stat.Frsize = stat_v.Frsize
 | 
				
			||||||
 | 
							stat.Flags = stat_v.Flag
 | 
				
			||||||
 | 
							for passn := 0; passn < 5; passn++ {
 | 
				
			||||||
 | 
								switch passn {
 | 
				
			||||||
 | 
								case 0:
 | 
				
			||||||
 | 
									err = tryGetmntent64(stat)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								case 1:
 | 
				
			||||||
 | 
									err = tryGetmntent128(stat)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								case 2:
 | 
				
			||||||
 | 
									err = tryGetmntent256(stat)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								case 3:
 | 
				
			||||||
 | 
									err = tryGetmntent512(stat)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								case 4:
 | 
				
			||||||
 | 
									err = tryGetmntent1024(stat)
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								default:
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								//proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred)
 | 
				
			||||||
 | 
								if err == nil || err != nil && err != ERANGE {
 | 
				
			||||||
 | 
									break
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func tryGetmntent64(stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var mnt_ent_buffer struct {
 | 
				
			||||||
 | 
							header       W_Mnth
 | 
				
			||||||
 | 
							filesys_info [64]W_Mntent
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
 | 
				
			||||||
 | 
						fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = ERANGE //return ERANGE if no match is found in this batch
 | 
				
			||||||
 | 
						for i := 0; i < fs_count; i++ {
 | 
				
			||||||
 | 
							if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
 | 
				
			||||||
 | 
								stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
 | 
				
			||||||
 | 
								err = nil
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func tryGetmntent128(stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var mnt_ent_buffer struct {
 | 
				
			||||||
 | 
							header       W_Mnth
 | 
				
			||||||
 | 
							filesys_info [128]W_Mntent
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
 | 
				
			||||||
 | 
						fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = ERANGE //return ERANGE if no match is found in this batch
 | 
				
			||||||
 | 
						for i := 0; i < fs_count; i++ {
 | 
				
			||||||
 | 
							if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
 | 
				
			||||||
 | 
								stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
 | 
				
			||||||
 | 
								err = nil
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func tryGetmntent256(stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var mnt_ent_buffer struct {
 | 
				
			||||||
 | 
							header       W_Mnth
 | 
				
			||||||
 | 
							filesys_info [256]W_Mntent
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
 | 
				
			||||||
 | 
						fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = ERANGE //return ERANGE if no match is found in this batch
 | 
				
			||||||
 | 
						for i := 0; i < fs_count; i++ {
 | 
				
			||||||
 | 
							if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
 | 
				
			||||||
 | 
								stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
 | 
				
			||||||
 | 
								err = nil
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func tryGetmntent512(stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var mnt_ent_buffer struct {
 | 
				
			||||||
 | 
							header       W_Mnth
 | 
				
			||||||
 | 
							filesys_info [512]W_Mntent
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
 | 
				
			||||||
 | 
						fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = ERANGE //return ERANGE if no match is found in this batch
 | 
				
			||||||
 | 
						for i := 0; i < fs_count; i++ {
 | 
				
			||||||
 | 
							if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
 | 
				
			||||||
 | 
								stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
 | 
				
			||||||
 | 
								err = nil
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func tryGetmntent1024(stat *Statfs_t) (err error) {
 | 
				
			||||||
 | 
						var mnt_ent_buffer struct {
 | 
				
			||||||
 | 
							header       W_Mnth
 | 
				
			||||||
 | 
							filesys_info [1024]W_Mntent
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
 | 
				
			||||||
 | 
						fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = ERANGE //return ERANGE if no match is found in this batch
 | 
				
			||||||
 | 
						for i := 0; i < fs_count; i++ {
 | 
				
			||||||
 | 
							if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
 | 
				
			||||||
 | 
								stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
 | 
				
			||||||
 | 
								err = nil
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build gccgo
 | 
					//go:build gccgo && !aix
 | 
				
			||||||
// +build !aix
 | 
					// +build gccgo,!aix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,10 +12,8 @@ import "syscall"
 | 
				
			||||||
// We can't use the gc-syntax .s files for gccgo. On the plus side
 | 
					// We can't use the gc-syntax .s files for gccgo. On the plus side
 | 
				
			||||||
// much of the functionality can be written directly in Go.
 | 
					// much of the functionality can be written directly in Go.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//extern gccgoRealSyscallNoError
 | 
					 | 
				
			||||||
func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
 | 
					func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//extern gccgoRealSyscall
 | 
					 | 
				
			||||||
func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
 | 
					func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
 | 
					func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,9 @@ struct ret {
 | 
				
			||||||
	uintptr_t err;
 | 
						uintptr_t err;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
				
			||||||
 | 
					  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct ret
 | 
					struct ret
 | 
				
			||||||
gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
					gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -32,6 +35,9 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
				
			||||||
 | 
					  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uintptr_t
 | 
					uintptr_t
 | 
				
			||||||
gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
					gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build gccgo && linux && amd64
 | 
				
			||||||
// +build gccgo,linux,amd64
 | 
					// +build gccgo,linux,amd64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,149 @@
 | 
				
			||||||
 | 
					// Copyright 2021 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:build linux
 | 
				
			||||||
 | 
					// +build linux
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
 | 
						"unsafe"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Helpers for dealing with ifreq since it contains a union and thus requires a
 | 
				
			||||||
 | 
					// lot of unsafe.Pointer casts to use properly.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq
 | 
				
			||||||
 | 
					// contains an interface name and a union of arbitrary data which can be
 | 
				
			||||||
 | 
					// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq
 | 
				
			||||||
 | 
					// function.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Use the Name method to access the stored interface name. The union data
 | 
				
			||||||
 | 
					// fields can be get and set using the following methods:
 | 
				
			||||||
 | 
					//   - Uint16/SetUint16: flags
 | 
				
			||||||
 | 
					//   - Uint32/SetUint32: ifindex, metric, mtu
 | 
				
			||||||
 | 
					type Ifreq struct{ raw ifreq }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NewIfreq creates an Ifreq with the input network interface name after
 | 
				
			||||||
 | 
					// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required)
 | 
				
			||||||
 | 
					// bytes.
 | 
				
			||||||
 | 
					func NewIfreq(name string) (*Ifreq, error) {
 | 
				
			||||||
 | 
						// Leave room for terminating NULL byte.
 | 
				
			||||||
 | 
						if len(name) >= IFNAMSIZ {
 | 
				
			||||||
 | 
							return nil, EINVAL
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var ifr ifreq
 | 
				
			||||||
 | 
						copy(ifr.Ifrn[:], name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return &Ifreq{raw: ifr}, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Name returns the interface name associated with the Ifreq.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) Name() string {
 | 
				
			||||||
 | 
						// BytePtrToString requires a NULL terminator or the program may crash. If
 | 
				
			||||||
 | 
						// one is not present, just return the empty string.
 | 
				
			||||||
 | 
						if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) {
 | 
				
			||||||
 | 
							return ""
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return BytePtrToString(&ifr.raw.Ifrn[0])
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// According to netdevice(7), only AF_INET addresses are returned for numerous
 | 
				
			||||||
 | 
					// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port
 | 
				
			||||||
 | 
					// field and other data is always empty.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C
 | 
				
			||||||
 | 
					// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not
 | 
				
			||||||
 | 
					// AF_INET, an error is returned.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) Inet4Addr() ([]byte, error) {
 | 
				
			||||||
 | 
						raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]))
 | 
				
			||||||
 | 
						if raw.Family != AF_INET {
 | 
				
			||||||
 | 
							// Cannot safely interpret raw.Addr bytes as an IPv4 address.
 | 
				
			||||||
 | 
							return nil, EINVAL
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return raw.Addr[:], nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an
 | 
				
			||||||
 | 
					// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length
 | 
				
			||||||
 | 
					// or an error will be returned.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) SetInet4Addr(v []byte) error {
 | 
				
			||||||
 | 
						if len(v) != 4 {
 | 
				
			||||||
 | 
							return EINVAL
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var addr [4]byte
 | 
				
			||||||
 | 
						copy(addr[:], v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ifr.clear()
 | 
				
			||||||
 | 
						*(*RawSockaddrInet4)(
 | 
				
			||||||
 | 
							unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]),
 | 
				
			||||||
 | 
						) = RawSockaddrInet4{
 | 
				
			||||||
 | 
							// Always set IP family as ioctls would require it anyway.
 | 
				
			||||||
 | 
							Family: AF_INET,
 | 
				
			||||||
 | 
							Addr:   addr,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Uint16 returns the Ifreq union data as a C short/Go uint16 value.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) Uint16() uint16 {
 | 
				
			||||||
 | 
						return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0]))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) SetUint16(v uint16) {
 | 
				
			||||||
 | 
						ifr.clear()
 | 
				
			||||||
 | 
						*(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Uint32 returns the Ifreq union data as a C int/Go uint32 value.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) Uint32() uint32 {
 | 
				
			||||||
 | 
						return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0]))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) SetUint32(v uint32) {
 | 
				
			||||||
 | 
						ifr.clear()
 | 
				
			||||||
 | 
						*(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// clear zeroes the ifreq's union field to prevent trailing garbage data from
 | 
				
			||||||
 | 
					// being sent to the kernel if an ifreq is reused.
 | 
				
			||||||
 | 
					func (ifr *Ifreq) clear() {
 | 
				
			||||||
 | 
						for i := range ifr.raw.Ifru {
 | 
				
			||||||
 | 
							ifr.raw.Ifru[i] = 0
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as
 | 
				
			||||||
 | 
					// IoctlGetEthtoolDrvinfo which use these APIs under the hood.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData,
 | 
				
			||||||
 | 
					// use the Ifreq.withData method.
 | 
				
			||||||
 | 
					type ifreqData struct {
 | 
				
			||||||
 | 
						name [IFNAMSIZ]byte
 | 
				
			||||||
 | 
						// A type separate from ifreq is required in order to comply with the
 | 
				
			||||||
 | 
						// unsafe.Pointer rules since the "pointer-ness" of data would not be
 | 
				
			||||||
 | 
						// preserved if it were cast into the byte array of a raw ifreq.
 | 
				
			||||||
 | 
						data unsafe.Pointer
 | 
				
			||||||
 | 
						// Pad to the same size as ifreq.
 | 
				
			||||||
 | 
						_ [len(ifreq{}.Ifru) - SizeofPtr]byte
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// withData produces an ifreqData with the pointer p set for ioctls which require
 | 
				
			||||||
 | 
					// arbitrary pointer data.
 | 
				
			||||||
 | 
					func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData {
 | 
				
			||||||
 | 
						return ifreqData{
 | 
				
			||||||
 | 
							name: ifr.raw.Ifrn,
 | 
				
			||||||
 | 
							data: p,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
 | 
				
			||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
					// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					@ -20,6 +21,15 @@ func IoctlSetInt(fd int, req uint, value int) error {
 | 
				
			||||||
	return ioctl(fd, req, uintptr(value))
 | 
						return ioctl(fd, req, uintptr(value))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlSetPointerInt performs an ioctl operation which sets an
 | 
				
			||||||
 | 
					// integer value on fd, using the specified request number. The ioctl
 | 
				
			||||||
 | 
					// argument is called with a pointer to the integer value, rather than
 | 
				
			||||||
 | 
					// passing the integer value directly.
 | 
				
			||||||
 | 
					func IoctlSetPointerInt(fd int, req uint, value int) error {
 | 
				
			||||||
 | 
						v := int32(value)
 | 
				
			||||||
 | 
						return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
 | 
					// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// To change fd's window size, the req argument should be TIOCSWINSZ.
 | 
					// To change fd's window size, the req argument should be TIOCSWINSZ.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,196 @@
 | 
				
			||||||
 | 
					// Copyright 2021 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 unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"unsafe"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlRetInt performs an ioctl operation specified by req on a device
 | 
				
			||||||
 | 
					// associated with opened file descriptor fd, and returns a non-negative
 | 
				
			||||||
 | 
					// integer that is returned by the ioctl syscall.
 | 
				
			||||||
 | 
					func IoctlRetInt(fd int, req uint) (int, error) {
 | 
				
			||||||
 | 
						ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
 | 
				
			||||||
 | 
						if err != 0 {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return int(ret), nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlGetUint32(fd int, req uint) (uint32, error) {
 | 
				
			||||||
 | 
						var value uint32
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
				
			||||||
 | 
						return value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlGetRTCTime(fd int) (*RTCTime, error) {
 | 
				
			||||||
 | 
						var value RTCTime
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value))
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlSetRTCTime(fd int, value *RTCTime) error {
 | 
				
			||||||
 | 
						return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
 | 
				
			||||||
 | 
						var value RTCWkAlrm
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value))
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
 | 
				
			||||||
 | 
						return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network
 | 
				
			||||||
 | 
					// device specified by ifname.
 | 
				
			||||||
 | 
					func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
 | 
				
			||||||
 | 
						ifr, err := NewIfreq(ifname)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO}
 | 
				
			||||||
 | 
						ifrd := ifr.withData(unsafe.Pointer(&value))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlGetWatchdogInfo fetches information about a watchdog device from the
 | 
				
			||||||
 | 
					// Linux watchdog API. For more information, see:
 | 
				
			||||||
 | 
					// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
 | 
				
			||||||
 | 
					func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
 | 
				
			||||||
 | 
						var value WatchdogInfo
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value))
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
 | 
				
			||||||
 | 
					// more information, see:
 | 
				
			||||||
 | 
					// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
 | 
				
			||||||
 | 
					func IoctlWatchdogKeepalive(fd int) error {
 | 
				
			||||||
 | 
						// arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr.
 | 
				
			||||||
 | 
						return ioctl(fd, WDIOC_KEEPALIVE, 0)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
 | 
				
			||||||
 | 
					// range of data conveyed in value to the file associated with the file
 | 
				
			||||||
 | 
					// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
 | 
				
			||||||
 | 
					func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
 | 
				
			||||||
 | 
						return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
 | 
				
			||||||
 | 
					// associated with the file description srcFd to the file associated with the
 | 
				
			||||||
 | 
					// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
 | 
				
			||||||
 | 
					func IoctlFileClone(destFd, srcFd int) error {
 | 
				
			||||||
 | 
						return ioctl(destFd, FICLONE, uintptr(srcFd))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type FileDedupeRange struct {
 | 
				
			||||||
 | 
						Src_offset uint64
 | 
				
			||||||
 | 
						Src_length uint64
 | 
				
			||||||
 | 
						Reserved1  uint16
 | 
				
			||||||
 | 
						Reserved2  uint32
 | 
				
			||||||
 | 
						Info       []FileDedupeRangeInfo
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type FileDedupeRangeInfo struct {
 | 
				
			||||||
 | 
						Dest_fd       int64
 | 
				
			||||||
 | 
						Dest_offset   uint64
 | 
				
			||||||
 | 
						Bytes_deduped uint64
 | 
				
			||||||
 | 
						Status        int32
 | 
				
			||||||
 | 
						Reserved      uint32
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
 | 
				
			||||||
 | 
					// range of data conveyed in value from the file associated with the file
 | 
				
			||||||
 | 
					// descriptor srcFd to the value.Info destinations. See the
 | 
				
			||||||
 | 
					// ioctl_fideduperange(2) man page for details.
 | 
				
			||||||
 | 
					func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
 | 
				
			||||||
 | 
						buf := make([]byte, SizeofRawFileDedupeRange+
 | 
				
			||||||
 | 
							len(value.Info)*SizeofRawFileDedupeRangeInfo)
 | 
				
			||||||
 | 
						rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0]))
 | 
				
			||||||
 | 
						rawrange.Src_offset = value.Src_offset
 | 
				
			||||||
 | 
						rawrange.Src_length = value.Src_length
 | 
				
			||||||
 | 
						rawrange.Dest_count = uint16(len(value.Info))
 | 
				
			||||||
 | 
						rawrange.Reserved1 = value.Reserved1
 | 
				
			||||||
 | 
						rawrange.Reserved2 = value.Reserved2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for i := range value.Info {
 | 
				
			||||||
 | 
							rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
 | 
				
			||||||
 | 
								uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
 | 
				
			||||||
 | 
									uintptr(i*SizeofRawFileDedupeRangeInfo)))
 | 
				
			||||||
 | 
							rawinfo.Dest_fd = value.Info[i].Dest_fd
 | 
				
			||||||
 | 
							rawinfo.Dest_offset = value.Info[i].Dest_offset
 | 
				
			||||||
 | 
							rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped
 | 
				
			||||||
 | 
							rawinfo.Status = value.Info[i].Status
 | 
				
			||||||
 | 
							rawinfo.Reserved = value.Info[i].Reserved
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Output
 | 
				
			||||||
 | 
						for i := range value.Info {
 | 
				
			||||||
 | 
							rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
 | 
				
			||||||
 | 
								uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
 | 
				
			||||||
 | 
									uintptr(i*SizeofRawFileDedupeRangeInfo)))
 | 
				
			||||||
 | 
							value.Info[i].Dest_fd = rawinfo.Dest_fd
 | 
				
			||||||
 | 
							value.Info[i].Dest_offset = rawinfo.Dest_offset
 | 
				
			||||||
 | 
							value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped
 | 
				
			||||||
 | 
							value.Info[i].Status = rawinfo.Status
 | 
				
			||||||
 | 
							value.Info[i].Reserved = rawinfo.Reserved
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
 | 
				
			||||||
 | 
						return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
 | 
				
			||||||
 | 
						var value HIDRawDevInfo
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value))
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlHIDGetRawName(fd int) (string, error) {
 | 
				
			||||||
 | 
						var value [_HIDIOCGRAWNAME_LEN]byte
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0]))
 | 
				
			||||||
 | 
						return ByteSliceToString(value[:]), err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlHIDGetRawPhys(fd int) (string, error) {
 | 
				
			||||||
 | 
						var value [_HIDIOCGRAWPHYS_LEN]byte
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0]))
 | 
				
			||||||
 | 
						return ByteSliceToString(value[:]), err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlHIDGetRawUniq(fd int) (string, error) {
 | 
				
			||||||
 | 
						var value [_HIDIOCGRAWUNIQ_LEN]byte
 | 
				
			||||||
 | 
						err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0]))
 | 
				
			||||||
 | 
						return ByteSliceToString(value[:]), err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or
 | 
				
			||||||
 | 
					// output. See the netdevice(7) man page for details.
 | 
				
			||||||
 | 
					func IoctlIfreq(fd int, req uint, value *Ifreq) error {
 | 
				
			||||||
 | 
						// It is possible we will add more fields to *Ifreq itself later to prevent
 | 
				
			||||||
 | 
						// misuse, so pass the raw *ifreq directly.
 | 
				
			||||||
 | 
						return ioctlPtr(fd, req, unsafe.Pointer(&value.raw))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO(mdlayher): export if and when IfreqData is exported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ioctlIfreqData performs an ioctl using an ifreqData structure for input
 | 
				
			||||||
 | 
					// and/or output. See the netdevice(7) man page for details.
 | 
				
			||||||
 | 
					func ioctlIfreqData(fd int, req uint, value *ifreqData) error {
 | 
				
			||||||
 | 
						// The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are
 | 
				
			||||||
 | 
						// identical so pass *IfreqData directly.
 | 
				
			||||||
 | 
						return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,74 @@
 | 
				
			||||||
 | 
					// Copyright 2020 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:build zos && s390x
 | 
				
			||||||
 | 
					// +build zos,s390x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"runtime"
 | 
				
			||||||
 | 
						"unsafe"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ioctl itself should not be exposed directly, but additional get/set
 | 
				
			||||||
 | 
					// functions for specific types are permissible.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlSetInt performs an ioctl operation which sets an integer value
 | 
				
			||||||
 | 
					// on fd, using the specified request number.
 | 
				
			||||||
 | 
					func IoctlSetInt(fd int, req uint, value int) error {
 | 
				
			||||||
 | 
						return ioctl(fd, req, uintptr(value))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// To change fd's window size, the req argument should be TIOCSWINSZ.
 | 
				
			||||||
 | 
					func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
 | 
				
			||||||
 | 
						// TODO: if we get the chance, remove the req parameter and
 | 
				
			||||||
 | 
						// hardcode TIOCSWINSZ.
 | 
				
			||||||
 | 
						err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
 | 
				
			||||||
 | 
						runtime.KeepAlive(value)
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlSetTermios performs an ioctl on fd with a *Termios.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
 | 
				
			||||||
 | 
					func IoctlSetTermios(fd int, req uint, value *Termios) error {
 | 
				
			||||||
 | 
						if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
 | 
				
			||||||
 | 
							return ENOSYS
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err := Tcsetattr(fd, int(req), value)
 | 
				
			||||||
 | 
						runtime.KeepAlive(value)
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlGetInt performs an ioctl operation which gets an integer value
 | 
				
			||||||
 | 
					// from fd, using the specified request number.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// A few ioctl requests use the return value as an output parameter;
 | 
				
			||||||
 | 
					// for those, IoctlRetInt should be used instead of this function.
 | 
				
			||||||
 | 
					func IoctlGetInt(fd int, req uint) (int, error) {
 | 
				
			||||||
 | 
						var value int
 | 
				
			||||||
 | 
						err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
				
			||||||
 | 
						return value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
 | 
				
			||||||
 | 
						var value Winsize
 | 
				
			||||||
 | 
						err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IoctlGetTermios performs an ioctl on fd with a *Termios.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// The req value is expected to be TCGETS
 | 
				
			||||||
 | 
					func IoctlGetTermios(fd int, req uint) (*Termios, error) {
 | 
				
			||||||
 | 
						var value Termios
 | 
				
			||||||
 | 
						if req != TCGETS {
 | 
				
			||||||
 | 
							return &value, ENOSYS
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err := Tcgetattr(fd, &value)
 | 
				
			||||||
 | 
						return &value, err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
 | 
				
			||||||
	# Use the Docker-based build system
 | 
						# Use the Docker-based build system
 | 
				
			||||||
	# Files generated through docker (use $cmd so you can Ctl-C the build or run)
 | 
						# Files generated through docker (use $cmd so you can Ctl-C the build or run)
 | 
				
			||||||
	$cmd docker build --tag generate:$GOOS $GOOS
 | 
						$cmd docker build --tag generate:$GOOS $GOOS
 | 
				
			||||||
	$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS
 | 
						$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
 | 
				
			||||||
	exit
 | 
						exit
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,29 +70,13 @@ aix_ppc64)
 | 
				
			||||||
	mksyscall="go run mksyscall_aix_ppc64.go -aix"
 | 
						mksyscall="go run mksyscall_aix_ppc64.go -aix"
 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
darwin_386)
 | 
					 | 
				
			||||||
	mkerrors="$mkerrors -m32"
 | 
					 | 
				
			||||||
	mksyscall="go run mksyscall.go -l32"
 | 
					 | 
				
			||||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
 | 
					 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
					 | 
				
			||||||
	mkasm="go run mkasm_darwin.go"
 | 
					 | 
				
			||||||
	;;
 | 
					 | 
				
			||||||
darwin_amd64)
 | 
					darwin_amd64)
 | 
				
			||||||
	mkerrors="$mkerrors -m64"
 | 
						mkerrors="$mkerrors -m64"
 | 
				
			||||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
 | 
					 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
					 | 
				
			||||||
	mkasm="go run mkasm_darwin.go"
 | 
					 | 
				
			||||||
	;;
 | 
					 | 
				
			||||||
darwin_arm)
 | 
					 | 
				
			||||||
	mkerrors="$mkerrors"
 | 
					 | 
				
			||||||
	mksyscall="go run mksyscall.go -l32"
 | 
					 | 
				
			||||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
 | 
					 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
				
			||||||
	mkasm="go run mkasm_darwin.go"
 | 
						mkasm="go run mkasm_darwin.go"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
darwin_arm64)
 | 
					darwin_arm64)
 | 
				
			||||||
	mkerrors="$mkerrors -m64"
 | 
						mkerrors="$mkerrors -m64"
 | 
				
			||||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
 | 
					 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
				
			||||||
	mkasm="go run mkasm_darwin.go"
 | 
						mkasm="go run mkasm_darwin.go"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
| 
						 | 
					@ -184,6 +168,15 @@ openbsd_arm64)
 | 
				
			||||||
	# API consistent across platforms.
 | 
						# API consistent across platforms.
 | 
				
			||||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					openbsd_mips64)
 | 
				
			||||||
 | 
						mkerrors="$mkerrors -m64"
 | 
				
			||||||
 | 
						mksyscall="go run mksyscall.go -openbsd"
 | 
				
			||||||
 | 
						mksysctl="go run mksysctl_openbsd.go"
 | 
				
			||||||
 | 
						mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
 | 
				
			||||||
 | 
						# Let the type of C char be signed for making the bare syscall
 | 
				
			||||||
 | 
						# API consistent across platforms.
 | 
				
			||||||
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
solaris_amd64)
 | 
					solaris_amd64)
 | 
				
			||||||
	mksyscall="go run mksyscall_solaris.go"
 | 
						mksyscall="go run mksyscall_solaris.go"
 | 
				
			||||||
	mkerrors="$mkerrors -m64"
 | 
						mkerrors="$mkerrors -m64"
 | 
				
			||||||
| 
						 | 
					@ -194,7 +187,7 @@ illumos_amd64)
 | 
				
			||||||
        mksyscall="go run mksyscall_solaris.go"
 | 
					        mksyscall="go run mksyscall_solaris.go"
 | 
				
			||||||
	mkerrors=
 | 
						mkerrors=
 | 
				
			||||||
	mksysnum=
 | 
						mksysnum=
 | 
				
			||||||
	mktypes=
 | 
						mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
*)
 | 
					*)
 | 
				
			||||||
	echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
 | 
						echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
 | 
				
			||||||
| 
						 | 
					@ -217,8 +210,6 @@ esac
 | 
				
			||||||
				# aix/ppc64 script generates files instead of writing to stdin.
 | 
									# aix/ppc64 script generates files instead of writing to stdin.
 | 
				
			||||||
				echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
 | 
									echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
 | 
				
			||||||
			elif [ "$GOOS" == "darwin" ]; then
 | 
								elif [ "$GOOS" == "darwin" ]; then
 | 
				
			||||||
			        # pre-1.12, direct syscalls
 | 
					 | 
				
			||||||
			        echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
 | 
					 | 
				
			||||||
			        # 1.12 and later, syscalls via libSystem
 | 
								        # 1.12 and later, syscalls via libSystem
 | 
				
			||||||
				echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
 | 
									echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
 | 
				
			||||||
				# 1.13 and later, syscalls via libSystem (including syscallPtr)
 | 
									# 1.13 and later, syscalls via libSystem (including syscallPtr)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
 | 
					// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
 | 
				
			||||||
| 
						 | 
					@ -14,10 +15,13 @@ import (
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"sort"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func writeASMFile(in string, fileName string, buildTags string) {
 | 
					const ptrsize = 8 // Pointer size. All supported platforms are 64-bit.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func writeASMFile(in string, fileName string, buildTags string) map[string]bool {
 | 
				
			||||||
	trampolines := map[string]bool{}
 | 
						trampolines := map[string]bool{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var out bytes.Buffer
 | 
						var out bytes.Buffer
 | 
				
			||||||
| 
						 | 
					@ -25,24 +29,71 @@ func writeASMFile(in string, fileName string, buildTags string) {
 | 
				
			||||||
	fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
 | 
						fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
 | 
				
			||||||
	fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
 | 
						fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
 | 
				
			||||||
	fmt.Fprintf(&out, "\n")
 | 
						fmt.Fprintf(&out, "\n")
 | 
				
			||||||
 | 
						fmt.Fprintf(&out, "//go:build %s\n", buildTags)
 | 
				
			||||||
	fmt.Fprintf(&out, "// +build %s\n", buildTags)
 | 
						fmt.Fprintf(&out, "// +build %s\n", buildTags)
 | 
				
			||||||
	fmt.Fprintf(&out, "\n")
 | 
						fmt.Fprintf(&out, "\n")
 | 
				
			||||||
	fmt.Fprintf(&out, "#include \"textflag.h\"\n")
 | 
						fmt.Fprintf(&out, "#include \"textflag.h\"\n")
 | 
				
			||||||
	for _, line := range strings.Split(in, "\n") {
 | 
						for _, line := range strings.Split(in, "\n") {
 | 
				
			||||||
		if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
 | 
							const prefix = "var "
 | 
				
			||||||
 | 
							const suffix = "_trampoline_addr uintptr"
 | 
				
			||||||
 | 
							if !strings.HasPrefix(line, prefix) || !strings.HasSuffix(line, suffix) {
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		fn := line[5 : len(line)-13]
 | 
							fn := strings.TrimSuffix(strings.TrimPrefix(line, prefix), suffix)
 | 
				
			||||||
		if !trampolines[fn] {
 | 
							if !trampolines[fn] {
 | 
				
			||||||
			trampolines[fn] = true
 | 
								trampolines[fn] = true
 | 
				
			||||||
			fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
 | 
								fmt.Fprintf(&out, "\nTEXT %s_trampoline<>(SB),NOSPLIT,$0-0\n", fn)
 | 
				
			||||||
			fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
 | 
								fmt.Fprintf(&out, "\tJMP\t%s(SB)\n\n", fn)
 | 
				
			||||||
 | 
								fmt.Fprintf(&out, "GLOBL\t·%s_trampoline_addr(SB), RODATA, $%d\n", fn, ptrsize)
 | 
				
			||||||
 | 
								fmt.Fprintf(&out, "DATA\t·%s_trampoline_addr(SB)/%d, $%s_trampoline<>(SB)\n", fn, ptrsize, fn)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err := ioutil.WriteFile(fileName, out.Bytes(), 0644)
 | 
						err := ioutil.WriteFile(fileName, out.Bytes(), 0644)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		log.Fatalf("can't write %s: %s", fileName, err)
 | 
							log.Fatalf("can't write %s: %s", fileName, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return trampolines
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const darwinTestTemplate = `// go run mkasm_darwin.go %s
 | 
				
			||||||
 | 
					// Code generated by the command above; DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build darwin && go1.12
 | 
				
			||||||
 | 
					// +build darwin,go1.12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package unix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// All the _trampoline functions in zsyscall_darwin_%s.s.
 | 
				
			||||||
 | 
					var darwinTests = [...]darwinTest{
 | 
				
			||||||
 | 
					%s}
 | 
				
			||||||
 | 
					`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func writeDarwinTest(trampolines map[string]bool, fileName, arch string) {
 | 
				
			||||||
 | 
						// sort trampolines
 | 
				
			||||||
 | 
						sorted := make([]string, len(trampolines))
 | 
				
			||||||
 | 
						i := 0
 | 
				
			||||||
 | 
						for trampoline := range trampolines {
 | 
				
			||||||
 | 
							sorted[i] = trampoline
 | 
				
			||||||
 | 
							i++
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						sort.Slice(sorted, func(i, j int) bool { return sorted[i] < sorted[j] })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var out bytes.Buffer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const prefix = "libc_"
 | 
				
			||||||
 | 
						for _, trampoline := range sorted {
 | 
				
			||||||
 | 
							fmt.Fprintf(&out, fmt.Sprintf("\t{%q, %s_trampoline_addr},\n", strings.TrimPrefix(trampoline, prefix), trampoline))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						lines := out.String()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						out.Reset()
 | 
				
			||||||
 | 
						fmt.Fprintf(&out, darwinTestTemplate, strings.Join(os.Args[1:], " "), arch, lines)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err := ioutil.WriteFile(fileName, out.Bytes(), 0644)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Fatalf("can't write %s: %s", fileName, err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
| 
						 | 
					@ -61,7 +112,7 @@ func main() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	in := string(in1) + string(in2) + string(in3)
 | 
						in := string(in1) + string(in2) + string(in3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.s", arch), "go1.12")
 | 
						trampolines := writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.s", arch), "go1.12")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in1, err = ioutil.ReadFile("syscall_darwin.1_13.go")
 | 
						in1, err = ioutil.ReadFile("syscall_darwin.1_13.go")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					@ -74,5 +125,12 @@ func main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in = string(in1) + string(in2)
 | 
						in = string(in1) + string(in2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.1_13.s", arch), "go1.13")
 | 
						trampolines2 := writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.1_13.s", arch), "go1.13")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// merge trampolines
 | 
				
			||||||
 | 
						for trampoline := range trampolines2 {
 | 
				
			||||||
 | 
							trampolines[trampoline] = true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						writeDarwinTest(trampolines, fmt.Sprintf("darwin_%s_test.go", arch), arch)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,22 +54,28 @@ includes_AIX='
 | 
				
			||||||
 | 
					
 | 
				
			||||||
includes_Darwin='
 | 
					includes_Darwin='
 | 
				
			||||||
#define _DARWIN_C_SOURCE
 | 
					#define _DARWIN_C_SOURCE
 | 
				
			||||||
#define KERNEL
 | 
					#define KERNEL 1
 | 
				
			||||||
#define _DARWIN_USE_64_BIT_INODE
 | 
					#define _DARWIN_USE_64_BIT_INODE
 | 
				
			||||||
 | 
					#define __APPLE_USE_RFC_3542
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <sys/attr.h>
 | 
					#include <sys/attr.h>
 | 
				
			||||||
 | 
					#include <sys/clonefile.h>
 | 
				
			||||||
 | 
					#include <sys/kern_control.h>
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <sys/event.h>
 | 
					#include <sys/event.h>
 | 
				
			||||||
#include <sys/ptrace.h>
 | 
					#include <sys/ptrace.h>
 | 
				
			||||||
#include <sys/select.h>
 | 
					#include <sys/select.h>
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
 | 
					#include <sys/un.h>
 | 
				
			||||||
#include <sys/sockio.h>
 | 
					#include <sys/sockio.h>
 | 
				
			||||||
 | 
					#include <sys/sys_domain.h>
 | 
				
			||||||
#include <sys/sysctl.h>
 | 
					#include <sys/sysctl.h>
 | 
				
			||||||
#include <sys/mman.h>
 | 
					#include <sys/mman.h>
 | 
				
			||||||
#include <sys/mount.h>
 | 
					#include <sys/mount.h>
 | 
				
			||||||
#include <sys/utsname.h>
 | 
					#include <sys/utsname.h>
 | 
				
			||||||
#include <sys/wait.h>
 | 
					#include <sys/wait.h>
 | 
				
			||||||
#include <sys/xattr.h>
 | 
					#include <sys/xattr.h>
 | 
				
			||||||
 | 
					#include <sys/vsock.h>
 | 
				
			||||||
#include <net/bpf.h>
 | 
					#include <net/bpf.h>
 | 
				
			||||||
#include <net/if.h>
 | 
					#include <net/if.h>
 | 
				
			||||||
#include <net/if_types.h>
 | 
					#include <net/if_types.h>
 | 
				
			||||||
| 
						 | 
					@ -77,6 +83,9 @@ includes_Darwin='
 | 
				
			||||||
#include <netinet/in.h>
 | 
					#include <netinet/in.h>
 | 
				
			||||||
#include <netinet/ip.h>
 | 
					#include <netinet/ip.h>
 | 
				
			||||||
#include <termios.h>
 | 
					#include <termios.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk.
 | 
				
			||||||
 | 
					#define TIOCREMOTE 0x80047469
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
includes_DragonFly='
 | 
					includes_DragonFly='
 | 
				
			||||||
| 
						 | 
					@ -93,6 +102,7 @@ includes_DragonFly='
 | 
				
			||||||
#include <sys/ioctl.h>
 | 
					#include <sys/ioctl.h>
 | 
				
			||||||
#include <net/bpf.h>
 | 
					#include <net/bpf.h>
 | 
				
			||||||
#include <net/if.h>
 | 
					#include <net/if.h>
 | 
				
			||||||
 | 
					#include <net/if_clone.h>
 | 
				
			||||||
#include <net/if_types.h>
 | 
					#include <net/if_types.h>
 | 
				
			||||||
#include <net/route.h>
 | 
					#include <net/route.h>
 | 
				
			||||||
#include <netinet/in.h>
 | 
					#include <netinet/in.h>
 | 
				
			||||||
| 
						 | 
					@ -107,8 +117,10 @@ includes_FreeBSD='
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <sys/disk.h>
 | 
					#include <sys/disk.h>
 | 
				
			||||||
#include <sys/event.h>
 | 
					#include <sys/event.h>
 | 
				
			||||||
 | 
					#include <sys/sched.h>
 | 
				
			||||||
#include <sys/select.h>
 | 
					#include <sys/select.h>
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
 | 
					#include <sys/un.h>
 | 
				
			||||||
#include <sys/sockio.h>
 | 
					#include <sys/sockio.h>
 | 
				
			||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
#include <sys/sysctl.h>
 | 
					#include <sys/sysctl.h>
 | 
				
			||||||
| 
						 | 
					@ -192,10 +204,14 @@ struct ltchars {
 | 
				
			||||||
#include <sys/xattr.h>
 | 
					#include <sys/xattr.h>
 | 
				
			||||||
#include <linux/bpf.h>
 | 
					#include <linux/bpf.h>
 | 
				
			||||||
#include <linux/can.h>
 | 
					#include <linux/can.h>
 | 
				
			||||||
 | 
					#include <linux/can/error.h>
 | 
				
			||||||
 | 
					#include <linux/can/raw.h>
 | 
				
			||||||
#include <linux/capability.h>
 | 
					#include <linux/capability.h>
 | 
				
			||||||
#include <linux/cryptouser.h>
 | 
					#include <linux/cryptouser.h>
 | 
				
			||||||
#include <linux/devlink.h>
 | 
					#include <linux/devlink.h>
 | 
				
			||||||
 | 
					#include <linux/dm-ioctl.h>
 | 
				
			||||||
#include <linux/errqueue.h>
 | 
					#include <linux/errqueue.h>
 | 
				
			||||||
 | 
					#include <linux/ethtool_netlink.h>
 | 
				
			||||||
#include <linux/falloc.h>
 | 
					#include <linux/falloc.h>
 | 
				
			||||||
#include <linux/fanotify.h>
 | 
					#include <linux/fanotify.h>
 | 
				
			||||||
#include <linux/filter.h>
 | 
					#include <linux/filter.h>
 | 
				
			||||||
| 
						 | 
					@ -204,7 +220,7 @@ struct ltchars {
 | 
				
			||||||
#include <linux/fsverity.h>
 | 
					#include <linux/fsverity.h>
 | 
				
			||||||
#include <linux/genetlink.h>
 | 
					#include <linux/genetlink.h>
 | 
				
			||||||
#include <linux/hdreg.h>
 | 
					#include <linux/hdreg.h>
 | 
				
			||||||
#include <linux/icmpv6.h>
 | 
					#include <linux/hidraw.h>
 | 
				
			||||||
#include <linux/if.h>
 | 
					#include <linux/if.h>
 | 
				
			||||||
#include <linux/if_addr.h>
 | 
					#include <linux/if_addr.h>
 | 
				
			||||||
#include <linux/if_alg.h>
 | 
					#include <linux/if_alg.h>
 | 
				
			||||||
| 
						 | 
					@ -214,17 +230,23 @@ struct ltchars {
 | 
				
			||||||
#include <linux/if_tun.h>
 | 
					#include <linux/if_tun.h>
 | 
				
			||||||
#include <linux/if_packet.h>
 | 
					#include <linux/if_packet.h>
 | 
				
			||||||
#include <linux/if_xdp.h>
 | 
					#include <linux/if_xdp.h>
 | 
				
			||||||
 | 
					#include <linux/input.h>
 | 
				
			||||||
#include <linux/kexec.h>
 | 
					#include <linux/kexec.h>
 | 
				
			||||||
#include <linux/keyctl.h>
 | 
					#include <linux/keyctl.h>
 | 
				
			||||||
 | 
					#include <linux/landlock.h>
 | 
				
			||||||
#include <linux/loop.h>
 | 
					#include <linux/loop.h>
 | 
				
			||||||
 | 
					#include <linux/lwtunnel.h>
 | 
				
			||||||
#include <linux/magic.h>
 | 
					#include <linux/magic.h>
 | 
				
			||||||
#include <linux/memfd.h>
 | 
					#include <linux/memfd.h>
 | 
				
			||||||
#include <linux/module.h>
 | 
					#include <linux/module.h>
 | 
				
			||||||
 | 
					#include <linux/mount.h>
 | 
				
			||||||
#include <linux/netfilter/nfnetlink.h>
 | 
					#include <linux/netfilter/nfnetlink.h>
 | 
				
			||||||
#include <linux/netlink.h>
 | 
					#include <linux/netlink.h>
 | 
				
			||||||
#include <linux/net_namespace.h>
 | 
					#include <linux/net_namespace.h>
 | 
				
			||||||
 | 
					#include <linux/nfc.h>
 | 
				
			||||||
#include <linux/nsfs.h>
 | 
					#include <linux/nsfs.h>
 | 
				
			||||||
#include <linux/perf_event.h>
 | 
					#include <linux/perf_event.h>
 | 
				
			||||||
 | 
					#include <linux/pps.h>
 | 
				
			||||||
#include <linux/ptrace.h>
 | 
					#include <linux/ptrace.h>
 | 
				
			||||||
#include <linux/random.h>
 | 
					#include <linux/random.h>
 | 
				
			||||||
#include <linux/reboot.h>
 | 
					#include <linux/reboot.h>
 | 
				
			||||||
| 
						 | 
					@ -239,8 +261,10 @@ struct ltchars {
 | 
				
			||||||
#include <linux/vm_sockets.h>
 | 
					#include <linux/vm_sockets.h>
 | 
				
			||||||
#include <linux/wait.h>
 | 
					#include <linux/wait.h>
 | 
				
			||||||
#include <linux/watchdog.h>
 | 
					#include <linux/watchdog.h>
 | 
				
			||||||
 | 
					#include <linux/wireguard.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <mtd/ubi-user.h>
 | 
					#include <mtd/ubi-user.h>
 | 
				
			||||||
 | 
					#include <mtd/mtd-user.h>
 | 
				
			||||||
#include <net/route.h>
 | 
					#include <net/route.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__sparc__)
 | 
					#if defined(__sparc__)
 | 
				
			||||||
| 
						 | 
					@ -288,6 +312,17 @@ struct ltchars {
 | 
				
			||||||
// Including linux/l2tp.h here causes conflicts between linux/in.h
 | 
					// Including linux/l2tp.h here causes conflicts between linux/in.h
 | 
				
			||||||
// and netinet/in.h included via net/route.h above.
 | 
					// and netinet/in.h included via net/route.h above.
 | 
				
			||||||
#define IPPROTO_L2TP		115
 | 
					#define IPPROTO_L2TP		115
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Copied from linux/hid.h.
 | 
				
			||||||
 | 
					// Keep in sync with the size of the referenced fields.
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWNAME_LEN	128 // sizeof_field(struct hid_device, name)
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWPHYS_LEN	64  // sizeof_field(struct hid_device, phys)
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWUNIQ_LEN	64  // sizeof_field(struct hid_device, uniq)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWNAME		HIDIOCGRAWNAME(_HIDIOCGRAWNAME_LEN)
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWPHYS		HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN)
 | 
				
			||||||
 | 
					#define _HIDIOCGRAWUNIQ		HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
includes_NetBSD='
 | 
					includes_NetBSD='
 | 
				
			||||||
| 
						 | 
					@ -297,6 +332,7 @@ includes_NetBSD='
 | 
				
			||||||
#include <sys/extattr.h>
 | 
					#include <sys/extattr.h>
 | 
				
			||||||
#include <sys/mman.h>
 | 
					#include <sys/mman.h>
 | 
				
			||||||
#include <sys/mount.h>
 | 
					#include <sys/mount.h>
 | 
				
			||||||
 | 
					#include <sys/sched.h>
 | 
				
			||||||
#include <sys/select.h>
 | 
					#include <sys/select.h>
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
#include <sys/sockio.h>
 | 
					#include <sys/sockio.h>
 | 
				
			||||||
| 
						 | 
					@ -325,6 +361,7 @@ includes_OpenBSD='
 | 
				
			||||||
#include <sys/mman.h>
 | 
					#include <sys/mman.h>
 | 
				
			||||||
#include <sys/mount.h>
 | 
					#include <sys/mount.h>
 | 
				
			||||||
#include <sys/select.h>
 | 
					#include <sys/select.h>
 | 
				
			||||||
 | 
					#include <sys/sched.h>
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
#include <sys/sockio.h>
 | 
					#include <sys/sockio.h>
 | 
				
			||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
| 
						 | 
					@ -365,6 +402,7 @@ includes_SunOS='
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
#include <sys/sockio.h>
 | 
					#include <sys/sockio.h>
 | 
				
			||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
 | 
					#include <sys/stream.h>
 | 
				
			||||||
#include <sys/mman.h>
 | 
					#include <sys/mman.h>
 | 
				
			||||||
#include <sys/wait.h>
 | 
					#include <sys/wait.h>
 | 
				
			||||||
#include <sys/ioctl.h>
 | 
					#include <sys/ioctl.h>
 | 
				
			||||||
| 
						 | 
					@ -374,10 +412,11 @@ includes_SunOS='
 | 
				
			||||||
#include <net/if_arp.h>
 | 
					#include <net/if_arp.h>
 | 
				
			||||||
#include <net/if_types.h>
 | 
					#include <net/if_types.h>
 | 
				
			||||||
#include <net/route.h>
 | 
					#include <net/route.h>
 | 
				
			||||||
 | 
					#include <netinet/icmp6.h>
 | 
				
			||||||
#include <netinet/in.h>
 | 
					#include <netinet/in.h>
 | 
				
			||||||
#include <termios.h>
 | 
					 | 
				
			||||||
#include <netinet/ip.h>
 | 
					#include <netinet/ip.h>
 | 
				
			||||||
#include <netinet/ip_mroute.h>
 | 
					#include <netinet/ip_mroute.h>
 | 
				
			||||||
 | 
					#include <termios.h>
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -432,6 +471,7 @@ ccflags="$@"
 | 
				
			||||||
		$2 !~ /^EPROC_/ &&
 | 
							$2 !~ /^EPROC_/ &&
 | 
				
			||||||
		$2 !~ /^EQUIV_/ &&
 | 
							$2 !~ /^EQUIV_/ &&
 | 
				
			||||||
		$2 !~ /^EXPR_/ &&
 | 
							$2 !~ /^EXPR_/ &&
 | 
				
			||||||
 | 
							$2 !~ /^EVIOC/ &&
 | 
				
			||||||
		$2 ~ /^E[A-Z0-9_]+$/ ||
 | 
							$2 ~ /^E[A-Z0-9_]+$/ ||
 | 
				
			||||||
		$2 ~ /^B[0-9_]+$/ ||
 | 
							$2 ~ /^B[0-9_]+$/ ||
 | 
				
			||||||
		$2 ~ /^(OLD|NEW)DEV$/ ||
 | 
							$2 ~ /^(OLD|NEW)DEV$/ ||
 | 
				
			||||||
| 
						 | 
					@ -463,13 +503,17 @@ ccflags="$@"
 | 
				
			||||||
		$2 ~ /^O?XTABS$/ ||
 | 
							$2 ~ /^O?XTABS$/ ||
 | 
				
			||||||
		$2 ~ /^TC[IO](ON|OFF)$/ ||
 | 
							$2 ~ /^TC[IO](ON|OFF)$/ ||
 | 
				
			||||||
		$2 ~ /^IN_/ ||
 | 
							$2 ~ /^IN_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^LANDLOCK_/ ||
 | 
				
			||||||
		$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
 | 
							$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
 | 
				
			||||||
		$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
 | 
							$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
 | 
				
			||||||
		$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
 | 
							$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
 | 
				
			||||||
		$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
 | 
							$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
 | 
				
			||||||
 | 
							$2 ~ /^RAW_PAYLOAD_/ ||
 | 
				
			||||||
		$2 ~ /^TP_STATUS_/ ||
 | 
							$2 ~ /^TP_STATUS_/ ||
 | 
				
			||||||
		$2 ~ /^FALLOC_/ ||
 | 
							$2 ~ /^FALLOC_/ ||
 | 
				
			||||||
		$2 == "ICMPV6_FILTER" ||
 | 
							$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
 | 
				
			||||||
		$2 == "SOMAXCONN" ||
 | 
							$2 == "SOMAXCONN" ||
 | 
				
			||||||
		$2 == "NAME_MAX" ||
 | 
							$2 == "NAME_MAX" ||
 | 
				
			||||||
		$2 == "IFNAMSIZ" ||
 | 
							$2 == "IFNAMSIZ" ||
 | 
				
			||||||
| 
						 | 
					@ -478,7 +522,7 @@ ccflags="$@"
 | 
				
			||||||
		$2 ~ /^HW_MACHINE$/ ||
 | 
							$2 ~ /^HW_MACHINE$/ ||
 | 
				
			||||||
		$2 ~ /^SYSCTL_VERS/ ||
 | 
							$2 ~ /^SYSCTL_VERS/ ||
 | 
				
			||||||
		$2 !~ "MNT_BITS" &&
 | 
							$2 !~ "MNT_BITS" &&
 | 
				
			||||||
		$2 ~ /^(MS|MNT|UMOUNT)_/ ||
 | 
							$2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ ||
 | 
				
			||||||
		$2 ~ /^NS_GET_/ ||
 | 
							$2 ~ /^NS_GET_/ ||
 | 
				
			||||||
		$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
 | 
							$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
 | 
				
			||||||
		$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
 | 
							$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
 | 
				
			||||||
| 
						 | 
					@ -489,6 +533,7 @@ ccflags="$@"
 | 
				
			||||||
		$2 !~ "NLA_TYPE_MASK" &&
 | 
							$2 !~ "NLA_TYPE_MASK" &&
 | 
				
			||||||
		$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
 | 
							$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
 | 
				
			||||||
		$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
 | 
							$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^FIORDCHK$/ ||
 | 
				
			||||||
		$2 ~ /^SIOC/ ||
 | 
							$2 ~ /^SIOC/ ||
 | 
				
			||||||
		$2 ~ /^TIOC/ ||
 | 
							$2 ~ /^TIOC/ ||
 | 
				
			||||||
		$2 ~ /^TCGET/ ||
 | 
							$2 ~ /^TCGET/ ||
 | 
				
			||||||
| 
						 | 
					@ -507,17 +552,23 @@ ccflags="$@"
 | 
				
			||||||
		$2 ~ /^(CLOCK|TIMER)_/ ||
 | 
							$2 ~ /^(CLOCK|TIMER)_/ ||
 | 
				
			||||||
		$2 ~ /^CAN_/ ||
 | 
							$2 ~ /^CAN_/ ||
 | 
				
			||||||
		$2 ~ /^CAP_/ ||
 | 
							$2 ~ /^CAP_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^CP_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^CPUSTATES$/ ||
 | 
				
			||||||
 | 
							$2 ~ /^CTLIOCGINFO$/ ||
 | 
				
			||||||
		$2 ~ /^ALG_/ ||
 | 
							$2 ~ /^ALG_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^FI(CLONE|DEDUPERANGE)/ ||
 | 
				
			||||||
		$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ ||
 | 
							$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ ||
 | 
				
			||||||
		$2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|GETFLAGS)/ ||
 | 
							$2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|[GS]ETFLAGS)/ ||
 | 
				
			||||||
		$2 ~ /^FS_VERITY_/ ||
 | 
							$2 ~ /^FS_VERITY_/ ||
 | 
				
			||||||
		$2 ~ /^FSCRYPT_/ ||
 | 
							$2 ~ /^FSCRYPT_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^DM_/ ||
 | 
				
			||||||
		$2 ~ /^GRND_/ ||
 | 
							$2 ~ /^GRND_/ ||
 | 
				
			||||||
		$2 ~ /^RND/ ||
 | 
							$2 ~ /^RND/ ||
 | 
				
			||||||
		$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
 | 
							$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
 | 
				
			||||||
		$2 ~ /^KEYCTL_/ ||
 | 
							$2 ~ /^KEYCTL_/ ||
 | 
				
			||||||
		$2 ~ /^PERF_EVENT_IOC_/ ||
 | 
							$2 ~ /^PERF_/ ||
 | 
				
			||||||
		$2 ~ /^SECCOMP_MODE_/ ||
 | 
							$2 ~ /^SECCOMP_MODE_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^SEEK_/ ||
 | 
				
			||||||
		$2 ~ /^SPLICE_/ ||
 | 
							$2 ~ /^SPLICE_/ ||
 | 
				
			||||||
		$2 ~ /^SYNC_FILE_RANGE_/ ||
 | 
							$2 ~ /^SYNC_FILE_RANGE_/ ||
 | 
				
			||||||
		$2 !~ /^AUDIT_RECORD_MAGIC/ &&
 | 
							$2 !~ /^AUDIT_RECORD_MAGIC/ &&
 | 
				
			||||||
| 
						 | 
					@ -535,18 +586,28 @@ ccflags="$@"
 | 
				
			||||||
		$2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
 | 
							$2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
 | 
				
			||||||
		$2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
 | 
							$2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
 | 
				
			||||||
		$2 ~ /^FSOPT_/ ||
 | 
							$2 ~ /^FSOPT_/ ||
 | 
				
			||||||
		$2 ~ /^WDIOC_/ ||
 | 
							$2 ~ /^WDIO[CFS]_/ ||
 | 
				
			||||||
		$2 ~ /^NFN/ ||
 | 
							$2 ~ /^NFN/ ||
 | 
				
			||||||
		$2 ~ /^XDP_/ ||
 | 
							$2 ~ /^XDP_/ ||
 | 
				
			||||||
		$2 ~ /^RWF_/ ||
 | 
							$2 ~ /^RWF_/ ||
 | 
				
			||||||
		$2 ~ /^(HDIO|WIN|SMART)_/ ||
 | 
							$2 ~ /^(HDIO|WIN|SMART)_/ ||
 | 
				
			||||||
		$2 ~ /^CRYPTO_/ ||
 | 
							$2 ~ /^CRYPTO_/ ||
 | 
				
			||||||
		$2 ~ /^TIPC_/ ||
 | 
							$2 ~ /^TIPC_/ ||
 | 
				
			||||||
 | 
							$2 !~  "DEVLINK_RELOAD_LIMITS_VALID_MASK" &&
 | 
				
			||||||
		$2 ~ /^DEVLINK_/ ||
 | 
							$2 ~ /^DEVLINK_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^ETHTOOL_/ ||
 | 
				
			||||||
 | 
							$2 ~ /^LWTUNNEL_IP/ ||
 | 
				
			||||||
		$2 !~ "WMESGLEN" &&
 | 
							$2 !~ "WMESGLEN" &&
 | 
				
			||||||
		$2 ~ /^W[A-Z0-9]+$/ ||
 | 
							$2 ~ /^W[A-Z0-9]+$/ ||
 | 
				
			||||||
		$2 ~/^PPPIOC/ ||
 | 
							$2 ~/^PPPIOC/ ||
 | 
				
			||||||
		$2 ~ /^FAN_|FANOTIFY_/ ||
 | 
							$2 ~ /^FAN_|FANOTIFY_/ ||
 | 
				
			||||||
 | 
							$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
 | 
				
			||||||
 | 
							$2 ~ /^_?HIDIOC/ ||
 | 
				
			||||||
 | 
							$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
 | 
				
			||||||
 | 
							$2 ~ /^MTD/ ||
 | 
				
			||||||
 | 
							$2 ~ /^OTP/ ||
 | 
				
			||||||
 | 
							$2 ~ /^MEM/ ||
 | 
				
			||||||
 | 
							$2 ~ /^WG/ ||
 | 
				
			||||||
		$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
 | 
							$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
 | 
				
			||||||
		$2 ~ /^__WCOREFLAG$/ {next}
 | 
							$2 ~ /^__WCOREFLAG$/ {next}
 | 
				
			||||||
		$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
 | 
							$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
 | 
				
			||||||
| 
						 | 
					@ -584,6 +645,7 @@ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
 | 
				
			||||||
echo '// mkerrors.sh' "$@"
 | 
					echo '// mkerrors.sh' "$@"
 | 
				
			||||||
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
 | 
					echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
 | 
					echo "//go:build ${GOARCH} && ${GOOS}"
 | 
				
			||||||
echo "// +build ${GOARCH},${GOOS}"
 | 
					echo "// +build ${GOARCH},${GOOS}"
 | 
				
			||||||
echo
 | 
					echo
 | 
				
			||||||
go tool cgo -godefs -- "$@" _const.go >_error.out
 | 
					go tool cgo -godefs -- "$@" _const.go >_error.out
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,521 +0,0 @@
 | 
				
			||||||
// Copyright 2020 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 ignore
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// mkmerge.go parses generated source files and merges common
 | 
					 | 
				
			||||||
// consts, funcs, and types into a common source file, per GOOS.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Usage:
 | 
					 | 
				
			||||||
//     $ go run mkmerge.go -out MERGED FILE [FILE ...]
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Example:
 | 
					 | 
				
			||||||
//     # Remove all common consts, funcs, and types from zerrors_linux_*.go
 | 
					 | 
				
			||||||
//     # and write the common code into zerrors_linux.go
 | 
					 | 
				
			||||||
//     $ go run mkmerge.go -out zerrors_linux.go zerrors_linux_*.go
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// mkmerge.go performs the merge in the following steps:
 | 
					 | 
				
			||||||
// 1. Construct the set of common code that is idential in all
 | 
					 | 
				
			||||||
//    architecture-specific files.
 | 
					 | 
				
			||||||
// 2. Write this common code to the merged file.
 | 
					 | 
				
			||||||
// 3. Remove the common code from all architecture-specific files.
 | 
					 | 
				
			||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"bufio"
 | 
					 | 
				
			||||||
	"bytes"
 | 
					 | 
				
			||||||
	"flag"
 | 
					 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"go/ast"
 | 
					 | 
				
			||||||
	"go/format"
 | 
					 | 
				
			||||||
	"go/parser"
 | 
					 | 
				
			||||||
	"go/token"
 | 
					 | 
				
			||||||
	"io"
 | 
					 | 
				
			||||||
	"io/ioutil"
 | 
					 | 
				
			||||||
	"log"
 | 
					 | 
				
			||||||
	"os"
 | 
					 | 
				
			||||||
	"path"
 | 
					 | 
				
			||||||
	"path/filepath"
 | 
					 | 
				
			||||||
	"regexp"
 | 
					 | 
				
			||||||
	"strconv"
 | 
					 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const validGOOS = "aix|darwin|dragonfly|freebsd|linux|netbsd|openbsd|solaris"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// getValidGOOS returns GOOS, true if filename ends with a valid "_GOOS.go"
 | 
					 | 
				
			||||||
func getValidGOOS(filename string) (string, bool) {
 | 
					 | 
				
			||||||
	matches := regexp.MustCompile(`_(` + validGOOS + `)\.go$`).FindStringSubmatch(filename)
 | 
					 | 
				
			||||||
	if len(matches) != 2 {
 | 
					 | 
				
			||||||
		return "", false
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return matches[1], true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// codeElem represents an ast.Decl in a comparable way.
 | 
					 | 
				
			||||||
type codeElem struct {
 | 
					 | 
				
			||||||
	tok token.Token // e.g. token.CONST, token.TYPE, or token.FUNC
 | 
					 | 
				
			||||||
	src string      // the declaration formatted as source code
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// newCodeElem returns a codeElem based on tok and node, or an error is returned.
 | 
					 | 
				
			||||||
func newCodeElem(tok token.Token, node ast.Node) (codeElem, error) {
 | 
					 | 
				
			||||||
	var b strings.Builder
 | 
					 | 
				
			||||||
	err := format.Node(&b, token.NewFileSet(), node)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return codeElem{}, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return codeElem{tok, b.String()}, nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// codeSet is a set of codeElems
 | 
					 | 
				
			||||||
type codeSet struct {
 | 
					 | 
				
			||||||
	set map[codeElem]bool // true for all codeElems in the set
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// newCodeSet returns a new codeSet
 | 
					 | 
				
			||||||
func newCodeSet() *codeSet { return &codeSet{make(map[codeElem]bool)} }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// add adds elem to c
 | 
					 | 
				
			||||||
func (c *codeSet) add(elem codeElem) { c.set[elem] = true }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// has returns true if elem is in c
 | 
					 | 
				
			||||||
func (c *codeSet) has(elem codeElem) bool { return c.set[elem] }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// isEmpty returns true if the set is empty
 | 
					 | 
				
			||||||
func (c *codeSet) isEmpty() bool { return len(c.set) == 0 }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// intersection returns a new set which is the intersection of c and a
 | 
					 | 
				
			||||||
func (c *codeSet) intersection(a *codeSet) *codeSet {
 | 
					 | 
				
			||||||
	res := newCodeSet()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for elem := range c.set {
 | 
					 | 
				
			||||||
		if a.has(elem) {
 | 
					 | 
				
			||||||
			res.add(elem)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return res
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// keepCommon is a filterFn for filtering the merged file with common declarations.
 | 
					 | 
				
			||||||
func (c *codeSet) keepCommon(elem codeElem) bool {
 | 
					 | 
				
			||||||
	switch elem.tok {
 | 
					 | 
				
			||||||
	case token.VAR:
 | 
					 | 
				
			||||||
		// Remove all vars from the merged file
 | 
					 | 
				
			||||||
		return false
 | 
					 | 
				
			||||||
	case token.CONST, token.TYPE, token.FUNC, token.COMMENT:
 | 
					 | 
				
			||||||
		// Remove arch-specific consts, types, functions, and file-level comments from the merged file
 | 
					 | 
				
			||||||
		return c.has(elem)
 | 
					 | 
				
			||||||
	case token.IMPORT:
 | 
					 | 
				
			||||||
		// Keep imports, they are handled by filterImports
 | 
					 | 
				
			||||||
		return true
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	log.Fatalf("keepCommon: invalid elem %v", elem)
 | 
					 | 
				
			||||||
	return true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// keepArchSpecific is a filterFn for filtering the GOARC-specific files.
 | 
					 | 
				
			||||||
func (c *codeSet) keepArchSpecific(elem codeElem) bool {
 | 
					 | 
				
			||||||
	switch elem.tok {
 | 
					 | 
				
			||||||
	case token.CONST, token.TYPE, token.FUNC:
 | 
					 | 
				
			||||||
		// Remove common consts, types, or functions from the arch-specific file
 | 
					 | 
				
			||||||
		return !c.has(elem)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// srcFile represents a source file
 | 
					 | 
				
			||||||
type srcFile struct {
 | 
					 | 
				
			||||||
	name string
 | 
					 | 
				
			||||||
	src  []byte
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// filterFn is a helper for filter
 | 
					 | 
				
			||||||
type filterFn func(codeElem) bool
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// filter parses and filters Go source code from src, removing top
 | 
					 | 
				
			||||||
// level declarations using keep as predicate.
 | 
					 | 
				
			||||||
// For src parameter, please see docs for parser.ParseFile.
 | 
					 | 
				
			||||||
func filter(src interface{}, keep filterFn) ([]byte, error) {
 | 
					 | 
				
			||||||
	// Parse the src into an ast
 | 
					 | 
				
			||||||
	fset := token.NewFileSet()
 | 
					 | 
				
			||||||
	f, err := parser.ParseFile(fset, "", src, parser.ParseComments)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	cmap := ast.NewCommentMap(fset, f, f.Comments)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Group const/type specs on adjacent lines
 | 
					 | 
				
			||||||
	var groups specGroups = make(map[string]int)
 | 
					 | 
				
			||||||
	var groupID int
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	decls := f.Decls
 | 
					 | 
				
			||||||
	f.Decls = f.Decls[:0]
 | 
					 | 
				
			||||||
	for _, decl := range decls {
 | 
					 | 
				
			||||||
		switch decl := decl.(type) {
 | 
					 | 
				
			||||||
		case *ast.GenDecl:
 | 
					 | 
				
			||||||
			// Filter imports, consts, types, vars
 | 
					 | 
				
			||||||
			specs := decl.Specs
 | 
					 | 
				
			||||||
			decl.Specs = decl.Specs[:0]
 | 
					 | 
				
			||||||
			for i, spec := range specs {
 | 
					 | 
				
			||||||
				elem, err := newCodeElem(decl.Tok, spec)
 | 
					 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return nil, err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// Create new group if there are empty lines between this and the previous spec
 | 
					 | 
				
			||||||
				if i > 0 && fset.Position(specs[i-1].End()).Line < fset.Position(spec.Pos()).Line-1 {
 | 
					 | 
				
			||||||
					groupID++
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// Check if we should keep this spec
 | 
					 | 
				
			||||||
				if keep(elem) {
 | 
					 | 
				
			||||||
					decl.Specs = append(decl.Specs, spec)
 | 
					 | 
				
			||||||
					groups.add(elem.src, groupID)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// Check if we should keep this decl
 | 
					 | 
				
			||||||
			if len(decl.Specs) > 0 {
 | 
					 | 
				
			||||||
				f.Decls = append(f.Decls, decl)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		case *ast.FuncDecl:
 | 
					 | 
				
			||||||
			// Filter funcs
 | 
					 | 
				
			||||||
			elem, err := newCodeElem(token.FUNC, decl)
 | 
					 | 
				
			||||||
			if err != nil {
 | 
					 | 
				
			||||||
				return nil, err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if keep(elem) {
 | 
					 | 
				
			||||||
				f.Decls = append(f.Decls, decl)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Filter file level comments
 | 
					 | 
				
			||||||
	if cmap[f] != nil {
 | 
					 | 
				
			||||||
		commentGroups := cmap[f]
 | 
					 | 
				
			||||||
		cmap[f] = cmap[f][:0]
 | 
					 | 
				
			||||||
		for _, cGrp := range commentGroups {
 | 
					 | 
				
			||||||
			if keep(codeElem{token.COMMENT, cGrp.Text()}) {
 | 
					 | 
				
			||||||
				cmap[f] = append(cmap[f], cGrp)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	f.Comments = cmap.Filter(f).Comments()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Generate code for the filtered ast
 | 
					 | 
				
			||||||
	var buf bytes.Buffer
 | 
					 | 
				
			||||||
	if err = format.Node(&buf, fset, f); err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	groupedSrc, err := groups.filterEmptyLines(&buf)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return filterImports(groupedSrc)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// getCommonSet returns the set of consts, types, and funcs that are present in every file.
 | 
					 | 
				
			||||||
func getCommonSet(files []srcFile) (*codeSet, error) {
 | 
					 | 
				
			||||||
	if len(files) == 0 {
 | 
					 | 
				
			||||||
		return nil, fmt.Errorf("no files provided")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// Use the first architecture file as the baseline
 | 
					 | 
				
			||||||
	baseSet, err := getCodeSet(files[0].src)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Compare baseline set with other architecture files: discard any element,
 | 
					 | 
				
			||||||
	// that doesn't exist in other architecture files.
 | 
					 | 
				
			||||||
	for _, f := range files[1:] {
 | 
					 | 
				
			||||||
		set, err := getCodeSet(f.src)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return nil, err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		baseSet = baseSet.intersection(set)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return baseSet, nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// getCodeSet returns the set of all top-level consts, types, and funcs from src.
 | 
					 | 
				
			||||||
// src must be string, []byte, or io.Reader (see go/parser.ParseFile docs)
 | 
					 | 
				
			||||||
func getCodeSet(src interface{}) (*codeSet, error) {
 | 
					 | 
				
			||||||
	set := newCodeSet()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fset := token.NewFileSet()
 | 
					 | 
				
			||||||
	f, err := parser.ParseFile(fset, "", src, parser.ParseComments)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for _, decl := range f.Decls {
 | 
					 | 
				
			||||||
		switch decl := decl.(type) {
 | 
					 | 
				
			||||||
		case *ast.GenDecl:
 | 
					 | 
				
			||||||
			// Add const, and type declarations
 | 
					 | 
				
			||||||
			if !(decl.Tok == token.CONST || decl.Tok == token.TYPE) {
 | 
					 | 
				
			||||||
				break
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			for _, spec := range decl.Specs {
 | 
					 | 
				
			||||||
				elem, err := newCodeElem(decl.Tok, spec)
 | 
					 | 
				
			||||||
				if err != nil {
 | 
					 | 
				
			||||||
					return nil, err
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				set.add(elem)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		case *ast.FuncDecl:
 | 
					 | 
				
			||||||
			// Add func declarations
 | 
					 | 
				
			||||||
			elem, err := newCodeElem(token.FUNC, decl)
 | 
					 | 
				
			||||||
			if err != nil {
 | 
					 | 
				
			||||||
				return nil, err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			set.add(elem)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Add file level comments
 | 
					 | 
				
			||||||
	cmap := ast.NewCommentMap(fset, f, f.Comments)
 | 
					 | 
				
			||||||
	for _, cGrp := range cmap[f] {
 | 
					 | 
				
			||||||
		set.add(codeElem{token.COMMENT, cGrp.Text()})
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return set, nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// importName returns the identifier (PackageName) for an imported package
 | 
					 | 
				
			||||||
func importName(iSpec *ast.ImportSpec) (string, error) {
 | 
					 | 
				
			||||||
	if iSpec.Name == nil {
 | 
					 | 
				
			||||||
		name, err := strconv.Unquote(iSpec.Path.Value)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return "", err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return path.Base(name), nil
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return iSpec.Name.Name, nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// specGroups tracks grouped const/type specs with a map of line: groupID pairs
 | 
					 | 
				
			||||||
type specGroups map[string]int
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// add spec source to group
 | 
					 | 
				
			||||||
func (s specGroups) add(src string, groupID int) error {
 | 
					 | 
				
			||||||
	srcBytes, err := format.Source(bytes.TrimSpace([]byte(src)))
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	s[string(srcBytes)] = groupID
 | 
					 | 
				
			||||||
	return nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// filterEmptyLines removes empty lines within groups of const/type specs.
 | 
					 | 
				
			||||||
// Returns the filtered source.
 | 
					 | 
				
			||||||
func (s specGroups) filterEmptyLines(src io.Reader) ([]byte, error) {
 | 
					 | 
				
			||||||
	scanner := bufio.NewScanner(src)
 | 
					 | 
				
			||||||
	var out bytes.Buffer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	var emptyLines bytes.Buffer
 | 
					 | 
				
			||||||
	prevGroupID := -1 // Initialize to invalid group
 | 
					 | 
				
			||||||
	for scanner.Scan() {
 | 
					 | 
				
			||||||
		line := bytes.TrimSpace(scanner.Bytes())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if len(line) == 0 {
 | 
					 | 
				
			||||||
			fmt.Fprintf(&emptyLines, "%s\n", scanner.Bytes())
 | 
					 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Discard emptyLines if previous non-empty line belonged to the same
 | 
					 | 
				
			||||||
		// group as this line
 | 
					 | 
				
			||||||
		if src, err := format.Source(line); err == nil {
 | 
					 | 
				
			||||||
			groupID, ok := s[string(src)]
 | 
					 | 
				
			||||||
			if ok && groupID == prevGroupID {
 | 
					 | 
				
			||||||
				emptyLines.Reset()
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			prevGroupID = groupID
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		emptyLines.WriteTo(&out)
 | 
					 | 
				
			||||||
		fmt.Fprintf(&out, "%s\n", scanner.Bytes())
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if err := scanner.Err(); err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return out.Bytes(), nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// filterImports removes unused imports from fileSrc, and returns a formatted src.
 | 
					 | 
				
			||||||
func filterImports(fileSrc []byte) ([]byte, error) {
 | 
					 | 
				
			||||||
	fset := token.NewFileSet()
 | 
					 | 
				
			||||||
	file, err := parser.ParseFile(fset, "", fileSrc, parser.ParseComments)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	cmap := ast.NewCommentMap(fset, file, file.Comments)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// create set of references to imported identifiers
 | 
					 | 
				
			||||||
	keepImport := make(map[string]bool)
 | 
					 | 
				
			||||||
	for _, u := range file.Unresolved {
 | 
					 | 
				
			||||||
		keepImport[u.Name] = true
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// filter import declarations
 | 
					 | 
				
			||||||
	decls := file.Decls
 | 
					 | 
				
			||||||
	file.Decls = file.Decls[:0]
 | 
					 | 
				
			||||||
	for _, decl := range decls {
 | 
					 | 
				
			||||||
		importDecl, ok := decl.(*ast.GenDecl)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Keep non-import declarations
 | 
					 | 
				
			||||||
		if !ok || importDecl.Tok != token.IMPORT {
 | 
					 | 
				
			||||||
			file.Decls = append(file.Decls, decl)
 | 
					 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Filter the import specs
 | 
					 | 
				
			||||||
		specs := importDecl.Specs
 | 
					 | 
				
			||||||
		importDecl.Specs = importDecl.Specs[:0]
 | 
					 | 
				
			||||||
		for _, spec := range specs {
 | 
					 | 
				
			||||||
			iSpec := spec.(*ast.ImportSpec)
 | 
					 | 
				
			||||||
			name, err := importName(iSpec)
 | 
					 | 
				
			||||||
			if err != nil {
 | 
					 | 
				
			||||||
				return nil, err
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if keepImport[name] {
 | 
					 | 
				
			||||||
				importDecl.Specs = append(importDecl.Specs, iSpec)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if len(importDecl.Specs) > 0 {
 | 
					 | 
				
			||||||
			file.Decls = append(file.Decls, importDecl)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// filter file.Imports
 | 
					 | 
				
			||||||
	imports := file.Imports
 | 
					 | 
				
			||||||
	file.Imports = file.Imports[:0]
 | 
					 | 
				
			||||||
	for _, spec := range imports {
 | 
					 | 
				
			||||||
		name, err := importName(spec)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return nil, err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if keepImport[name] {
 | 
					 | 
				
			||||||
			file.Imports = append(file.Imports, spec)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	file.Comments = cmap.Filter(file).Comments()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	var buf bytes.Buffer
 | 
					 | 
				
			||||||
	err = format.Node(&buf, fset, file)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return buf.Bytes(), nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// merge extracts duplicate code from archFiles and merges it to mergeFile.
 | 
					 | 
				
			||||||
// 1. Construct commonSet: the set of code that is idential in all archFiles.
 | 
					 | 
				
			||||||
// 2. Write the code in commonSet to mergedFile.
 | 
					 | 
				
			||||||
// 3. Remove the commonSet code from all archFiles.
 | 
					 | 
				
			||||||
func merge(mergedFile string, archFiles ...string) error {
 | 
					 | 
				
			||||||
	// extract and validate the GOOS part of the merged filename
 | 
					 | 
				
			||||||
	goos, ok := getValidGOOS(mergedFile)
 | 
					 | 
				
			||||||
	if !ok {
 | 
					 | 
				
			||||||
		return fmt.Errorf("invalid GOOS in merged file name %s", mergedFile)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Read architecture files
 | 
					 | 
				
			||||||
	var inSrc []srcFile
 | 
					 | 
				
			||||||
	for _, file := range archFiles {
 | 
					 | 
				
			||||||
		src, err := ioutil.ReadFile(file)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return fmt.Errorf("cannot read archfile %s: %w", file, err)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		inSrc = append(inSrc, srcFile{file, src})
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// 1. Construct the set of top-level declarations common for all files
 | 
					 | 
				
			||||||
	commonSet, err := getCommonSet(inSrc)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if commonSet.isEmpty() {
 | 
					 | 
				
			||||||
		// No common code => do not modify any files
 | 
					 | 
				
			||||||
		return nil
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// 2. Write the merged file
 | 
					 | 
				
			||||||
	mergedSrc, err := filter(inSrc[0].src, commonSet.keepCommon)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	f, err := os.Create(mergedFile)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	buf := bufio.NewWriter(f)
 | 
					 | 
				
			||||||
	fmt.Fprintln(buf, "// Code generated by mkmerge.go; DO NOT EDIT.")
 | 
					 | 
				
			||||||
	fmt.Fprintln(buf)
 | 
					 | 
				
			||||||
	fmt.Fprintf(buf, "// +build %s\n", goos)
 | 
					 | 
				
			||||||
	fmt.Fprintln(buf)
 | 
					 | 
				
			||||||
	buf.Write(mergedSrc)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	err = buf.Flush()
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	err = f.Close()
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// 3. Remove duplicate declarations from the architecture files
 | 
					 | 
				
			||||||
	for _, inFile := range inSrc {
 | 
					 | 
				
			||||||
		src, err := filter(inFile.src, commonSet.keepArchSpecific)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		err = ioutil.WriteFile(inFile.name, src, 0644)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			return err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func main() {
 | 
					 | 
				
			||||||
	var mergedFile string
 | 
					 | 
				
			||||||
	flag.StringVar(&mergedFile, "out", "", "Write merged code to `FILE`")
 | 
					 | 
				
			||||||
	flag.Parse()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Expand wildcards
 | 
					 | 
				
			||||||
	var filenames []string
 | 
					 | 
				
			||||||
	for _, arg := range flag.Args() {
 | 
					 | 
				
			||||||
		matches, err := filepath.Glob(arg)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			fmt.Fprintf(os.Stderr, "Invalid command line argument %q: %v\n", arg, err)
 | 
					 | 
				
			||||||
			os.Exit(1)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		filenames = append(filenames, matches...)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if len(filenames) < 2 {
 | 
					 | 
				
			||||||
		// No need to merge
 | 
					 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	err := merge(mergedFile, filenames...)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		fmt.Fprintf(os.Stderr, "Merge failed with error: %v\n", err)
 | 
					 | 
				
			||||||
		os.Exit(1)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// mkpost processes the output of cgo -godefs to
 | 
					// mkpost processes the output of cgo -godefs to
 | 
				
			||||||
| 
						 | 
					@ -49,6 +50,26 @@ func main() {
 | 
				
			||||||
		b = sttimespec.ReplaceAll(b, []byte("Timespec"))
 | 
							b = sttimespec.ReplaceAll(b, []byte("Timespec"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if goos == "darwin" {
 | 
				
			||||||
 | 
							// KinfoProc contains various pointers to objects stored
 | 
				
			||||||
 | 
							// in kernel space. Replace these by uintptr to prevent
 | 
				
			||||||
 | 
							// accidental dereferencing.
 | 
				
			||||||
 | 
							kinfoProcPointerRegex := regexp.MustCompile(`\*_Ctype_struct_(pgrp|proc|session|sigacts|ucred|user|vnode)`)
 | 
				
			||||||
 | 
							b = kinfoProcPointerRegex.ReplaceAll(b, []byte("uintptr"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// ExternProc contains a p_un member that in kernel
 | 
				
			||||||
 | 
							// space stores a pair of pointers and in user space
 | 
				
			||||||
 | 
							// stores the process creation time. We only care about
 | 
				
			||||||
 | 
							// the process creation time.
 | 
				
			||||||
 | 
							externProcStarttimeRegex := regexp.MustCompile(`P_un\s*\[\d+\]byte`)
 | 
				
			||||||
 | 
							b = externProcStarttimeRegex.ReplaceAll(b, []byte("P_starttime Timeval"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Convert [n]int8 to [n]byte in Eproc and ExternProc members to
 | 
				
			||||||
 | 
							// simplify conversion to string.
 | 
				
			||||||
 | 
							convertEprocRegex := regexp.MustCompile(`(P_comm|Wmesg|Login)(\s+)\[(\d+)\]int8`)
 | 
				
			||||||
 | 
							b = convertEprocRegex.ReplaceAll(b, []byte("$1$2[$3]byte"))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Intentionally export __val fields in Fsid and Sigset_t
 | 
						// Intentionally export __val fields in Fsid and Sigset_t
 | 
				
			||||||
	valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`)
 | 
						valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`)
 | 
				
			||||||
	b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}"))
 | 
						b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}"))
 | 
				
			||||||
| 
						 | 
					@ -57,6 +78,10 @@ func main() {
 | 
				
			||||||
	fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
 | 
						fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
 | 
				
			||||||
	b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
 | 
						b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Intentionally export __icmp6_filt field in icmpv6_filter
 | 
				
			||||||
 | 
						icmpV6Regex := regexp.MustCompile(`type (ICMPv6Filter) struct {(\s+)X__icmp6_filt(\s+\S+\s+)}`)
 | 
				
			||||||
 | 
						b = icmpV6Regex.ReplaceAll(b, []byte("type $1 struct {${2}Filt$3}"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// If we have empty Ptrace structs, we should delete them. Only s390x emits
 | 
						// If we have empty Ptrace structs, we should delete them. Only s390x emits
 | 
				
			||||||
	// nonempty Ptrace structs.
 | 
						// nonempty Ptrace structs.
 | 
				
			||||||
	ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
 | 
						ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
 | 
				
			||||||
| 
						 | 
					@ -81,6 +106,33 @@ func main() {
 | 
				
			||||||
	convertStatvfsRegex := regexp.MustCompile(`((Fstype|Mnton|Mntfrom)name)(\s+)\[(\d+)\]int8`)
 | 
						convertStatvfsRegex := regexp.MustCompile(`((Fstype|Mnton|Mntfrom)name)(\s+)\[(\d+)\]int8`)
 | 
				
			||||||
	b = convertStatvfsRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
 | 
						b = convertStatvfsRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Convert []int8 to []byte in device mapper ioctl interface
 | 
				
			||||||
 | 
						convertDmIoctlNames := regexp.MustCompile(`(Name|Uuid|Target_type|Data)(\s+)\[(\d+)\]u?int8`)
 | 
				
			||||||
 | 
						dmIoctlTypes := regexp.MustCompile(`type Dm(\S+) struct {[^}]*}`)
 | 
				
			||||||
 | 
						dmStructs := dmIoctlTypes.FindAll(b, -1)
 | 
				
			||||||
 | 
						for _, s := range dmStructs {
 | 
				
			||||||
 | 
							newNames := convertDmIoctlNames.ReplaceAll(s, []byte("$1$2[$3]byte"))
 | 
				
			||||||
 | 
							b = bytes.Replace(b, s, newNames, 1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Convert []int8 to []byte in EthtoolDrvinfo
 | 
				
			||||||
 | 
						convertEthtoolDrvinfoNames := regexp.MustCompile(`(Driver|Version|Fw_version|Bus_info|Erom_version|Reserved2)(\s+)\[(\d+)\]u?int8`)
 | 
				
			||||||
 | 
						ethtoolDrvinfoTypes := regexp.MustCompile(`type EthtoolDrvinfo struct {[^}]*}`)
 | 
				
			||||||
 | 
						ethtoolDrvinfoStructs := ethtoolDrvinfoTypes.FindAll(b, -1)
 | 
				
			||||||
 | 
						for _, s := range ethtoolDrvinfoStructs {
 | 
				
			||||||
 | 
							newNames := convertEthtoolDrvinfoNames.ReplaceAll(s, []byte("$1$2[$3]byte"))
 | 
				
			||||||
 | 
							b = bytes.Replace(b, s, newNames, 1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Convert []int8 to []byte in ctl_info ioctl interface
 | 
				
			||||||
 | 
						convertCtlInfoName := regexp.MustCompile(`(Name)(\s+)\[(\d+)\]int8`)
 | 
				
			||||||
 | 
						ctlInfoType := regexp.MustCompile(`type CtlInfo struct {[^}]*}`)
 | 
				
			||||||
 | 
						ctlInfoStructs := ctlInfoType.FindAll(b, -1)
 | 
				
			||||||
 | 
						for _, s := range ctlInfoStructs {
 | 
				
			||||||
 | 
							newNames := convertCtlInfoName.ReplaceAll(s, []byte("$1$2[$3]byte"))
 | 
				
			||||||
 | 
							b = bytes.Replace(b, s, newNames, 1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Convert [1024]int8 to [1024]byte in Ptmget members
 | 
						// Convert [1024]int8 to [1024]byte in Ptmget members
 | 
				
			||||||
	convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`)
 | 
						convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`)
 | 
				
			||||||
	b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte"))
 | 
						b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte"))
 | 
				
			||||||
| 
						 | 
					@ -104,7 +156,8 @@ func main() {
 | 
				
			||||||
	replacement := fmt.Sprintf(`$1 | go run mkpost.go
 | 
						replacement := fmt.Sprintf(`$1 | go run mkpost.go
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build %s,%s`, goarch, goos)
 | 
					//go:build %s && %s
 | 
				
			||||||
 | 
					// +build %s,%s`, goarch, goos, goarch, goos)
 | 
				
			||||||
	cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
 | 
						cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
 | 
				
			||||||
	b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
 | 
						b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -49,8 +50,13 @@ func cmdLine() string {
 | 
				
			||||||
	return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
 | 
						return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// buildTags returns build tags
 | 
					// goBuildTags returns build tags in the go:build format.
 | 
				
			||||||
func buildTags() string {
 | 
					func goBuildTags() string {
 | 
				
			||||||
 | 
						return strings.ReplaceAll(*tags, ",", " && ")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// plusBuildTags returns build tags in the +build format.
 | 
				
			||||||
 | 
					func plusBuildTags() string {
 | 
				
			||||||
	return *tags
 | 
						return *tags
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,16 +92,14 @@ func parseParam(p string) Param {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	// Get the OS and architecture (using GOARCH_TARGET if it exists)
 | 
						goos := os.Getenv("GOOS_TARGET")
 | 
				
			||||||
	goos := os.Getenv("GOOS")
 | 
						if goos == "" {
 | 
				
			||||||
 | 
							goos = os.Getenv("GOOS")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if goos == "" {
 | 
						if goos == "" {
 | 
				
			||||||
		fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
 | 
							fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
 | 
				
			||||||
		os.Exit(1)
 | 
							os.Exit(1)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	goarch := os.Getenv("GOARCH_TARGET")
 | 
					 | 
				
			||||||
	if goarch == "" {
 | 
					 | 
				
			||||||
		goarch = os.Getenv("GOARCH")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Check that we are using the Docker-based build system if we should
 | 
						// Check that we are using the Docker-based build system if we should
 | 
				
			||||||
	if goos == "linux" {
 | 
						if goos == "linux" {
 | 
				
			||||||
| 
						 | 
					@ -121,7 +125,7 @@ func main() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	libc := false
 | 
						libc := false
 | 
				
			||||||
	if goos == "darwin" && (strings.Contains(buildTags(), ",go1.12") || strings.Contains(buildTags(), ",go1.13")) {
 | 
						if goos == "darwin" {
 | 
				
			||||||
		libc = true
 | 
							libc = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	trampolines := map[string]bool{}
 | 
						trampolines := map[string]bool{}
 | 
				
			||||||
| 
						 | 
					@ -136,28 +140,21 @@ func main() {
 | 
				
			||||||
		s := bufio.NewScanner(file)
 | 
							s := bufio.NewScanner(file)
 | 
				
			||||||
		for s.Scan() {
 | 
							for s.Scan() {
 | 
				
			||||||
			t := s.Text()
 | 
								t := s.Text()
 | 
				
			||||||
			t = strings.TrimSpace(t)
 | 
								nonblock := regexp.MustCompile(`^\/\/sysnb\t`).FindStringSubmatch(t)
 | 
				
			||||||
			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
 | 
								if regexp.MustCompile(`^\/\/sys\t`).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
				
			||||||
			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
 | 
					 | 
				
			||||||
			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
					 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Line must be of the form
 | 
								// Line must be of the form
 | 
				
			||||||
			//	func Open(path string, mode int, perm int) (fd int, errno error)
 | 
								//	func Open(path string, mode int, perm int) (fd int, errno error)
 | 
				
			||||||
			// Split into name, in params, out params.
 | 
								// Split into name, in params, out params.
 | 
				
			||||||
			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
 | 
								f := regexp.MustCompile(`^\/\/sys(nb)?\t(\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
 | 
				
			||||||
			if f == nil {
 | 
								if f == nil {
 | 
				
			||||||
				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
									fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
				
			||||||
				os.Exit(1)
 | 
									os.Exit(1)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
 | 
								funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
 | 
					 | 
				
			||||||
			if goos == "darwin" && !libc && funct == "ClockGettime" {
 | 
					 | 
				
			||||||
				continue
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			// Split argument lists on comma.
 | 
								// Split argument lists on comma.
 | 
				
			||||||
			in := parseParamList(inps)
 | 
								in := parseParamList(inps)
 | 
				
			||||||
			out := parseParamList(outps)
 | 
								out := parseParamList(outps)
 | 
				
			||||||
| 
						 | 
					@ -293,7 +290,7 @@ func main() {
 | 
				
			||||||
				sysname = strings.TrimPrefix(sysname, "SYS_")         // remove SYS_
 | 
									sysname = strings.TrimPrefix(sysname, "SYS_")         // remove SYS_
 | 
				
			||||||
				sysname = strings.ToLower(sysname)                    // lowercase
 | 
									sysname = strings.ToLower(sysname)                    // lowercase
 | 
				
			||||||
				libcFn = sysname
 | 
									libcFn = sysname
 | 
				
			||||||
				sysname = "funcPC(libc_" + sysname + "_trampoline)"
 | 
									sysname = "libc_" + sysname + "_trampoline_addr"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Actual call.
 | 
								// Actual call.
 | 
				
			||||||
| 
						 | 
					@ -366,11 +363,10 @@ func main() {
 | 
				
			||||||
			if libc && !trampolines[libcFn] {
 | 
								if libc && !trampolines[libcFn] {
 | 
				
			||||||
				// some system calls share a trampoline, like read and readlen.
 | 
									// some system calls share a trampoline, like read and readlen.
 | 
				
			||||||
				trampolines[libcFn] = true
 | 
									trampolines[libcFn] = true
 | 
				
			||||||
				// Declare assembly trampoline.
 | 
									// Declare assembly trampoline address.
 | 
				
			||||||
				text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
 | 
									text += fmt.Sprintf("var libc_%s_trampoline_addr uintptr\n\n", libcFn)
 | 
				
			||||||
				// Assembly trampoline calls the libc_* function, which this magic
 | 
									// Assembly trampoline calls the libc_* function, which this magic
 | 
				
			||||||
				// redirects to use the function from libSystem.
 | 
									// redirects to use the function from libSystem.
 | 
				
			||||||
				text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
 | 
					 | 
				
			||||||
				text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
 | 
									text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
 | 
				
			||||||
				text += "\n"
 | 
									text += "\n"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -381,12 +377,13 @@ func main() {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		file.Close()
 | 
							file.Close()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
 | 
						fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), text)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const srcTemplate = `// %s
 | 
					const srcTemplate = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build %s
 | 
				
			||||||
// +build %s
 | 
					// +build %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -17,7 +18,7 @@ and read like func declarations if //sys is replaced by func, but:
 | 
				
			||||||
	* If go func name needs to be different than its libc name,
 | 
						* If go func name needs to be different than its libc name,
 | 
				
			||||||
	* or the function is not in libc, name could be specified
 | 
						* or the function is not in libc, name could be specified
 | 
				
			||||||
	* at the end, after "=" sign, like
 | 
						* at the end, after "=" sign, like
 | 
				
			||||||
	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
						  //sys	getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,8 +43,13 @@ func cmdLine() string {
 | 
				
			||||||
	return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
 | 
						return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// buildTags returns build tags
 | 
					// goBuildTags returns build tags in the go:build format.
 | 
				
			||||||
func buildTags() string {
 | 
					func goBuildTags() string {
 | 
				
			||||||
 | 
						return strings.ReplaceAll(*tags, ",", " && ")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// plusBuildTags returns build tags in the +build format.
 | 
				
			||||||
 | 
					func plusBuildTags() string {
 | 
				
			||||||
	return *tags
 | 
						return *tags
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,20 +111,18 @@ func main() {
 | 
				
			||||||
		s := bufio.NewScanner(file)
 | 
							s := bufio.NewScanner(file)
 | 
				
			||||||
		for s.Scan() {
 | 
							for s.Scan() {
 | 
				
			||||||
			t := s.Text()
 | 
								t := s.Text()
 | 
				
			||||||
			t = strings.TrimSpace(t)
 | 
					 | 
				
			||||||
			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
 | 
					 | 
				
			||||||
			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
								if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
				
			||||||
				pack = p[1]
 | 
									pack = p[1]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
 | 
								nonblock := regexp.MustCompile(`^\/\/sysnb\t`).FindStringSubmatch(t)
 | 
				
			||||||
			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
								if regexp.MustCompile(`^\/\/sys\t`).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Line must be of the form
 | 
								// Line must be of the form
 | 
				
			||||||
			//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
								//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
				
			||||||
			// Split into name, in params, out params.
 | 
								// Split into name, in params, out params.
 | 
				
			||||||
			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
								f := regexp.MustCompile(`^\/\/sys(nb)?\t(\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
				
			||||||
			if f == nil {
 | 
								if f == nil {
 | 
				
			||||||
				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
									fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
				
			||||||
				os.Exit(1)
 | 
									os.Exit(1)
 | 
				
			||||||
| 
						 | 
					@ -390,12 +394,13 @@ func main() {
 | 
				
			||||||
		imp = "import \"golang.org/x/sys/unix\"\n"
 | 
							imp = "import \"golang.org/x/sys/unix\"\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
 | 
						fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), pack, cExtern, imp, text)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const srcTemplate = `// %s
 | 
					const srcTemplate = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build %s
 | 
				
			||||||
// +build %s
 | 
					// +build %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package %s
 | 
					package %s
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -17,7 +18,7 @@ and read like func declarations if //sys is replaced by func, but:
 | 
				
			||||||
	* If go func name needs to be different than its libc name,
 | 
						* If go func name needs to be different than its libc name,
 | 
				
			||||||
	* or the function is not in libc, name could be specified
 | 
						* or the function is not in libc, name could be specified
 | 
				
			||||||
	* at the end, after "=" sign, like
 | 
						* at the end, after "=" sign, like
 | 
				
			||||||
	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
						  //sys	getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This program will generate three files and handle both gc and gccgo implementation:
 | 
					This program will generate three files and handle both gc and gccgo implementation:
 | 
				
			||||||
| 
						 | 
					@ -83,8 +84,13 @@ func cmdLine() string {
 | 
				
			||||||
	return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
 | 
						return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// buildTags returns build tags
 | 
					// goBuildTags returns build tags in the go:build format.
 | 
				
			||||||
func buildTags() string {
 | 
					func goBuildTags() string {
 | 
				
			||||||
 | 
						return strings.ReplaceAll(*tags, ",", " && ")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// plusBuildTags returns build tags in the +build format.
 | 
				
			||||||
 | 
					func plusBuildTags() string {
 | 
				
			||||||
	return *tags
 | 
						return *tags
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,20 +160,18 @@ func main() {
 | 
				
			||||||
		s := bufio.NewScanner(file)
 | 
							s := bufio.NewScanner(file)
 | 
				
			||||||
		for s.Scan() {
 | 
							for s.Scan() {
 | 
				
			||||||
			t := s.Text()
 | 
								t := s.Text()
 | 
				
			||||||
			t = strings.TrimSpace(t)
 | 
					 | 
				
			||||||
			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
 | 
					 | 
				
			||||||
			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
								if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
				
			||||||
				pack = p[1]
 | 
									pack = p[1]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
 | 
								nonblock := regexp.MustCompile(`^\/\/sysnb\t`).FindStringSubmatch(t)
 | 
				
			||||||
			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
								if regexp.MustCompile(`^\/\/sys\t`).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Line must be of the form
 | 
								// Line must be of the form
 | 
				
			||||||
			//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
								//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
				
			||||||
			// Split into name, in params, out params.
 | 
								// Split into name, in params, out params.
 | 
				
			||||||
			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
								f := regexp.MustCompile(`^\/\/sys(nb)?\t(\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
				
			||||||
			if f == nil {
 | 
								if f == nil {
 | 
				
			||||||
				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
									fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
				
			||||||
				os.Exit(1)
 | 
									os.Exit(1)
 | 
				
			||||||
| 
						 | 
					@ -522,7 +526,7 @@ func main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Print zsyscall_aix_ppc64.go
 | 
						// Print zsyscall_aix_ppc64.go
 | 
				
			||||||
	err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
 | 
						err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
 | 
				
			||||||
		[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
 | 
							[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), goBuildTags(), plusBuildTags(), pack, imp, textcommon)),
 | 
				
			||||||
		0644)
 | 
							0644)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		fmt.Fprintf(os.Stderr, err.Error())
 | 
							fmt.Fprintf(os.Stderr, err.Error())
 | 
				
			||||||
| 
						 | 
					@ -533,7 +537,7 @@ func main() {
 | 
				
			||||||
	vardecls := "\t" + strings.Join(vars, ",\n\t")
 | 
						vardecls := "\t" + strings.Join(vars, ",\n\t")
 | 
				
			||||||
	vardecls += " syscallFunc"
 | 
						vardecls += " syscallFunc"
 | 
				
			||||||
	err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
 | 
						err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
 | 
				
			||||||
		[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
 | 
							[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), goBuildTags(), plusBuildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
 | 
				
			||||||
		0644)
 | 
							0644)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		fmt.Fprintf(os.Stderr, err.Error())
 | 
							fmt.Fprintf(os.Stderr, err.Error())
 | 
				
			||||||
| 
						 | 
					@ -542,7 +546,7 @@ func main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Print zsyscall_aix_ppc64_gccgo.go
 | 
						// Print zsyscall_aix_ppc64_gccgo.go
 | 
				
			||||||
	err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
 | 
						err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
 | 
				
			||||||
		[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
 | 
							[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), goBuildTags(), plusBuildTags(), pack, cExtern, imp, textgccgo)),
 | 
				
			||||||
		0644)
 | 
							0644)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		fmt.Fprintf(os.Stderr, err.Error())
 | 
							fmt.Fprintf(os.Stderr, err.Error())
 | 
				
			||||||
| 
						 | 
					@ -553,6 +557,7 @@ func main() {
 | 
				
			||||||
const srcTemplate1 = `// %s
 | 
					const srcTemplate1 = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build %s
 | 
				
			||||||
// +build %s
 | 
					// +build %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package %s
 | 
					package %s
 | 
				
			||||||
| 
						 | 
					@ -569,8 +574,8 @@ import (
 | 
				
			||||||
const srcTemplate2 = `// %s
 | 
					const srcTemplate2 = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build %s
 | 
					//go:build %s && gc
 | 
				
			||||||
// +build !gccgo
 | 
					// +build %s,gc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package %s
 | 
					package %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -595,8 +600,8 @@ func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err
 | 
				
			||||||
const srcTemplate3 = `// %s
 | 
					const srcTemplate3 = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +build %s
 | 
					//go:build %s && gccgo
 | 
				
			||||||
// +build gccgo
 | 
					// +build %s,gccgo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package %s
 | 
					package %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -17,7 +18,7 @@
 | 
				
			||||||
	* If go func name needs to be different than its libc name,
 | 
						* If go func name needs to be different than its libc name,
 | 
				
			||||||
	* or the function is not in libc, name could be specified
 | 
						* or the function is not in libc, name could be specified
 | 
				
			||||||
	* at the end, after "=" sign, like
 | 
						* at the end, after "=" sign, like
 | 
				
			||||||
	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
						  //sys	getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package main
 | 
					package main
 | 
				
			||||||
| 
						 | 
					@ -43,8 +44,13 @@ func cmdLine() string {
 | 
				
			||||||
	return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
 | 
						return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// buildTags returns build tags
 | 
					// goBuildTags returns build tags in the go:build format.
 | 
				
			||||||
func buildTags() string {
 | 
					func goBuildTags() string {
 | 
				
			||||||
 | 
						return strings.ReplaceAll(*tags, ",", " && ")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// plusBuildTags returns build tags in the +build format.
 | 
				
			||||||
 | 
					func plusBuildTags() string {
 | 
				
			||||||
	return *tags
 | 
						return *tags
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,20 +114,18 @@ func main() {
 | 
				
			||||||
		s := bufio.NewScanner(file)
 | 
							s := bufio.NewScanner(file)
 | 
				
			||||||
		for s.Scan() {
 | 
							for s.Scan() {
 | 
				
			||||||
			t := s.Text()
 | 
								t := s.Text()
 | 
				
			||||||
			t = strings.TrimSpace(t)
 | 
					 | 
				
			||||||
			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
 | 
					 | 
				
			||||||
			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
								if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
 | 
				
			||||||
				pack = p[1]
 | 
									pack = p[1]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
 | 
								nonblock := regexp.MustCompile(`^\/\/sysnb\t`).FindStringSubmatch(t)
 | 
				
			||||||
			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
								if regexp.MustCompile(`^\/\/sys\t`).FindStringSubmatch(t) == nil && nonblock == nil {
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Line must be of the form
 | 
								// Line must be of the form
 | 
				
			||||||
			//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
								//	func Open(path string, mode int, perm int) (fd int, err error)
 | 
				
			||||||
			// Split into name, in params, out params.
 | 
								// Split into name, in params, out params.
 | 
				
			||||||
			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
								f := regexp.MustCompile(`^\/\/sys(nb)?\t(\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
 | 
				
			||||||
			if f == nil {
 | 
								if f == nil {
 | 
				
			||||||
				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
									fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
 | 
				
			||||||
				os.Exit(1)
 | 
									os.Exit(1)
 | 
				
			||||||
| 
						 | 
					@ -316,12 +320,13 @@ func main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vardecls := "\t" + strings.Join(vars, ",\n\t")
 | 
						vardecls := "\t" + strings.Join(vars, ",\n\t")
 | 
				
			||||||
	vardecls += " syscallFunc"
 | 
						vardecls += " syscallFunc"
 | 
				
			||||||
	fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, syscallimp, imp, dynimports, linknames, vardecls, text)
 | 
						fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), pack, syscallimp, imp, dynimports, linknames, vardecls, text)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const srcTemplate = `// %s
 | 
					const srcTemplate = `// %s
 | 
				
			||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
					// Code generated by the command above; see README.md. DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build %s
 | 
				
			||||||
// +build %s
 | 
					// +build %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package %s
 | 
					package %s
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
// Use of this source code is governed by a BSD-style
 | 
					// Use of this source code is governed by a BSD-style
 | 
				
			||||||
// license that can be found in the LICENSE file.
 | 
					// license that can be found in the LICENSE file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build ignore
 | 
				
			||||||
// +build ignore
 | 
					// +build ignore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
 | 
					// Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
 | 
				
			||||||
| 
						 | 
					@ -31,8 +32,13 @@ func cmdLine() string {
 | 
				
			||||||
	return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ")
 | 
						return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// buildTags returns build tags.
 | 
					// goBuildTags returns build tags in the go:build format.
 | 
				
			||||||
func buildTags() string {
 | 
					func goBuildTags() string {
 | 
				
			||||||
 | 
						return fmt.Sprintf("%s && %s", goarch, goos)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// plusBuildTags returns build tags in the +build format.
 | 
				
			||||||
 | 
					func plusBuildTags() string {
 | 
				
			||||||
	return fmt.Sprintf("%s,%s", goarch, goos)
 | 
						return fmt.Sprintf("%s,%s", goarch, goos)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -163,12 +169,10 @@ func main() {
 | 
				
			||||||
		`netinet/ip_gre.h`,
 | 
							`netinet/ip_gre.h`,
 | 
				
			||||||
		`netinet/ip_ipcomp.h`,
 | 
							`netinet/ip_ipcomp.h`,
 | 
				
			||||||
		`netinet/ip_ipip.h`,
 | 
							`netinet/ip_ipip.h`,
 | 
				
			||||||
		`netinet/pim_var.h`,
 | 
					 | 
				
			||||||
		`netinet/tcp_var.h`,
 | 
							`netinet/tcp_var.h`,
 | 
				
			||||||
		`netinet/udp_var.h`,
 | 
							`netinet/udp_var.h`,
 | 
				
			||||||
		`netinet6/in6.h`,
 | 
							`netinet6/in6.h`,
 | 
				
			||||||
		`netinet6/ip6_divert.h`,
 | 
							`netinet6/ip6_divert.h`,
 | 
				
			||||||
		`netinet6/pim6_var.h`,
 | 
					 | 
				
			||||||
		`netinet/icmp6.h`,
 | 
							`netinet/icmp6.h`,
 | 
				
			||||||
		`netmpls/mpls.h`,
 | 
							`netmpls/mpls.h`,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -211,14 +215,12 @@ func main() {
 | 
				
			||||||
		`net.inet.ipip`,
 | 
							`net.inet.ipip`,
 | 
				
			||||||
		`net.inet.mobileip`,
 | 
							`net.inet.mobileip`,
 | 
				
			||||||
		`net.inet.pfsync`,
 | 
							`net.inet.pfsync`,
 | 
				
			||||||
		`net.inet.pim`,
 | 
					 | 
				
			||||||
		`net.inet.tcp`,
 | 
							`net.inet.tcp`,
 | 
				
			||||||
		`net.inet.udp`,
 | 
							`net.inet.udp`,
 | 
				
			||||||
		`net.inet6`,
 | 
							`net.inet6`,
 | 
				
			||||||
		`net.inet6.divert`,
 | 
							`net.inet6.divert`,
 | 
				
			||||||
		`net.inet6.ip6`,
 | 
							`net.inet6.ip6`,
 | 
				
			||||||
		`net.inet6.icmp6`,
 | 
							`net.inet6.icmp6`,
 | 
				
			||||||
		`net.inet6.pim6`,
 | 
					 | 
				
			||||||
		`net.inet6.tcp6`,
 | 
							`net.inet6.tcp6`,
 | 
				
			||||||
		`net.inet6.udp6`,
 | 
							`net.inet6.udp6`,
 | 
				
			||||||
		`net.mpls`,
 | 
							`net.mpls`,
 | 
				
			||||||
| 
						 | 
					@ -334,12 +336,13 @@ func main() {
 | 
				
			||||||
	sort.Strings(sysCtl)
 | 
						sort.Strings(sysCtl)
 | 
				
			||||||
	text := strings.Join(sysCtl, "")
 | 
						text := strings.Join(sysCtl, "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
 | 
						fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), text)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const srcTemplate = `// %s
 | 
					const srcTemplate = `// %s
 | 
				
			||||||
// Code generated by the command above; DO NOT EDIT.
 | 
					// Code generated by the command above; DO NOT EDIT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//go:build %s
 | 
				
			||||||
// +build %s
 | 
					// +build %s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package unix
 | 
					package unix
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue