mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-07-29 13:02:27 +00:00
Merge branch 'master' into cake
This commit is contained in:
@@ -85,6 +85,9 @@
|
||||
[submodule "vendor/grammars/language-shellscript"]
|
||||
path = vendor/grammars/language-shellscript
|
||||
url = https://github.com/atom/language-shellscript
|
||||
[submodule "vendor/grammars/language-supercollider"]
|
||||
path = vendor/grammars/language-supercollider
|
||||
url = https://github.com/supercollider/language-supercollider
|
||||
[submodule "vendor/grammars/language-yaml"]
|
||||
path = vendor/grammars/language-yaml
|
||||
url = https://github.com/atom/language-yaml
|
||||
@@ -671,6 +674,9 @@
|
||||
[submodule "vendor/grammars/sublime-typescript"]
|
||||
path = vendor/grammars/sublime-typescript
|
||||
url = https://github.com/Microsoft/TypeScript-Sublime-Plugin
|
||||
[submodule "vendor/grammars/sublime-pony"]
|
||||
path = vendor/grammars/sublime-pony
|
||||
url = https://github.com/CausalityLtd/sublime-pony
|
||||
[submodule "vendor/grammars/X10"]
|
||||
path = vendor/grammars/X10
|
||||
url = git@github.com:x10-lang/x10-highlighting.git
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
language: ruby
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libicu-dev
|
||||
- libicu48
|
||||
before_install: script/travis/before_install
|
||||
rvm:
|
||||
- 2.0.0
|
||||
|
||||
@@ -33,9 +33,9 @@ $ cat .gitattributes
|
||||
*.rb linguist-language=Java
|
||||
```
|
||||
|
||||
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository. Vendored files are also hidden by default in diffs on github.com.
|
||||
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository.
|
||||
|
||||
Use the `linguist-vendored` attribute to vendor or un-vendor paths. Please note, overriding the vendored (or un-vendored) status of a file only affects the language statistics for the repository and not the behavior in diffs on github.com.
|
||||
Use the `linguist-vendored` attribute to vendor or un-vendor paths.
|
||||
|
||||
```
|
||||
$ cat .gitattributes
|
||||
|
||||
@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
|
||||
s.add_development_dependency 'rake'
|
||||
s.add_development_dependency 'yajl-ruby'
|
||||
s.add_development_dependency 'color-proximity', '~> 0.2.1'
|
||||
s.add_development_dependency 'licensee', '~> 4.7.4'
|
||||
s.add_development_dependency 'licensee', '6.0.0b1'
|
||||
|
||||
end
|
||||
|
||||
+6
-1
@@ -181,6 +181,7 @@ vendor/grammars/assembly.tmbundle:
|
||||
vendor/grammars/atom-fsharp/:
|
||||
- source.fsharp
|
||||
- source.fsharp.fsi
|
||||
- source.fsharp.fsl
|
||||
- source.fsharp.fsx
|
||||
vendor/grammars/atom-language-purescript/:
|
||||
- source.purescript
|
||||
@@ -301,8 +302,8 @@ vendor/grammars/io.tmbundle:
|
||||
vendor/grammars/ioke-outdated:
|
||||
- source.ioke
|
||||
vendor/grammars/jade-tmbundle:
|
||||
- source.jade
|
||||
- source.pyjade
|
||||
- text.jade
|
||||
vendor/grammars/jasmin-sublime:
|
||||
- source.jasmin
|
||||
vendor/grammars/java.tmbundle:
|
||||
@@ -354,6 +355,8 @@ vendor/grammars/language-python:
|
||||
vendor/grammars/language-shellscript:
|
||||
- source.shell
|
||||
- text.shell-session
|
||||
vendor/grammars/language-supercollider:
|
||||
- source.supercollider
|
||||
vendor/grammars/language-xbase:
|
||||
- source.harbour
|
||||
vendor/grammars/language-yaml:
|
||||
@@ -514,6 +517,8 @@ vendor/grammars/sublime-nix:
|
||||
vendor/grammars/sublime-opal/:
|
||||
- source.opal
|
||||
- source.opalsysdefs
|
||||
vendor/grammars/sublime-pony:
|
||||
- source.pony
|
||||
vendor/grammars/sublime-robot-plugin:
|
||||
- text.robot
|
||||
vendor/grammars/sublime-rust:
|
||||
|
||||
@@ -131,7 +131,7 @@ module Linguist
|
||||
disambiguate ".for", ".f" do |data|
|
||||
if /^: /.match(data)
|
||||
Language["Forth"]
|
||||
elsif /^([c*][^a-z]| (subroutine|program)\s|\s*!)/i.match(data)
|
||||
elsif /^([c*][^abd-z]| (subroutine|program|end)\s|\s*!)/i.match(data)
|
||||
Language["FORTRAN"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1013,6 +1013,7 @@ Formatted:
|
||||
type: data
|
||||
extensions:
|
||||
- .for
|
||||
- .eam.fs
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
@@ -1612,7 +1613,7 @@ Jade:
|
||||
type: markup
|
||||
extensions:
|
||||
- .jade
|
||||
tm_scope: source.jade
|
||||
tm_scope: text.jade
|
||||
ace_mode: jade
|
||||
|
||||
Jasmin:
|
||||
@@ -1657,6 +1658,7 @@ JavaScript:
|
||||
- .gs
|
||||
- .jake
|
||||
- .jsb
|
||||
- .jscad
|
||||
- .jsfl
|
||||
- .jsm
|
||||
- .jss
|
||||
@@ -2606,6 +2608,13 @@ Perl6:
|
||||
tm_scope: source.perl.6
|
||||
ace_mode: perl
|
||||
|
||||
Pickle:
|
||||
type: data
|
||||
extensions:
|
||||
- .pkl
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
PicoLisp:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -2650,6 +2659,13 @@ PogoScript:
|
||||
tm_scope: source.pogoscript
|
||||
ace_mode: text
|
||||
|
||||
Pony:
|
||||
type: programming
|
||||
extensions:
|
||||
- .pony
|
||||
tm_scope: source.pony
|
||||
ace_mode: text
|
||||
|
||||
PostScript:
|
||||
type: markup
|
||||
extensions:
|
||||
@@ -3141,7 +3157,7 @@ Sass:
|
||||
Scala:
|
||||
type: programming
|
||||
ace_mode: scala
|
||||
color: "#7dd3b0"
|
||||
color: "#DC322F"
|
||||
extensions:
|
||||
- .scala
|
||||
- .sbt
|
||||
@@ -3330,9 +3346,12 @@ SuperCollider:
|
||||
type: programming
|
||||
color: "#46390b"
|
||||
extensions:
|
||||
- .scd
|
||||
- .sc
|
||||
tm_scope: none
|
||||
- .scd
|
||||
interpreters:
|
||||
- sclang
|
||||
- scsynth
|
||||
tm_scope: source.supercollider
|
||||
ace_mode: text
|
||||
|
||||
Swift:
|
||||
@@ -3646,6 +3665,7 @@ XML:
|
||||
- .ccxml
|
||||
- .clixml
|
||||
- .cproject
|
||||
- .csl
|
||||
- .csproj
|
||||
- .ct
|
||||
- .dita
|
||||
|
||||
@@ -86,13 +86,13 @@ module Linguist
|
||||
if s.peek(1) == "\""
|
||||
s.getch
|
||||
else
|
||||
s.skip_until(/[^\\]"/)
|
||||
s.skip_until(/(?<!\\)"/)
|
||||
end
|
||||
elsif s.scan(/'/)
|
||||
if s.peek(1) == "'"
|
||||
s.getch
|
||||
else
|
||||
s.skip_until(/[^\\]'/)
|
||||
s.skip_until(/(?<!\\)'/)
|
||||
end
|
||||
|
||||
# Skip number literals
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "4.7.0"
|
||||
VERSION = "4.7.1"
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
// title : OpenJSCAD.org Logo
|
||||
// author : Rene K. Mueller
|
||||
// license : MIT License
|
||||
// revision : 0.003
|
||||
// tags : Logo,Intersection,Sphere,Cube
|
||||
// file : logo.jscad
|
||||
|
||||
function main() {
|
||||
return union(
|
||||
difference(
|
||||
cube({size: 3, center: true}),
|
||||
sphere({r:2, center: true})
|
||||
),
|
||||
intersection(
|
||||
sphere({r: 1.3, center: true}),
|
||||
cube({size: 2.1, center: true})
|
||||
)
|
||||
).translate([0,0,1.5]).scale(10);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
(dp0
|
||||
S'a'
|
||||
p1
|
||||
(lp2
|
||||
I1
|
||||
aF2.0
|
||||
aI3
|
||||
ac__builtin__
|
||||
complex
|
||||
p3
|
||||
(F4.0
|
||||
F6.0
|
||||
tp4
|
||||
Rp5
|
||||
asS'c'
|
||||
p6
|
||||
NsS'b'
|
||||
p7
|
||||
(S'string'
|
||||
p8
|
||||
VUnicode string
|
||||
p9
|
||||
tp10
|
||||
s.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,36 @@
|
||||
cnumpy.core.multiarray
|
||||
_reconstruct
|
||||
p0
|
||||
(cnumpy
|
||||
ndarray
|
||||
p1
|
||||
(I0
|
||||
tp2
|
||||
S'b'
|
||||
p3
|
||||
tp4
|
||||
Rp5
|
||||
(I1
|
||||
(I100
|
||||
tp6
|
||||
cnumpy
|
||||
dtype
|
||||
p7
|
||||
(S'f8'
|
||||
p8
|
||||
I0
|
||||
I1
|
||||
tp9
|
||||
Rp10
|
||||
(I3
|
||||
S'<'
|
||||
p11
|
||||
NNNI-1
|
||||
I-1
|
||||
I0
|
||||
tp12
|
||||
bI00
|
||||
S'\x1cc~\xc3\xa7r\xed?\xe5${\xec\xd6\xcd\xed?\x809-\x02%\xa9\xa2?F\x0f\x1d\xe8\xef\xa3\xdb?\xfe\xd1\x0c\xb7\x83\x13\xef?\xe0<o\xa1\xa9^\xdf?CE\x96\x88/o\xe2?<\xd8\xa1\x96\xa2T\xce?\x152\x8e\xe5\xa8\x7f\xe8?\xe4\xb7\x9a\xe0$\x0f\xdc?\x90\xe4\xe2\xd4=\xce\xc3?Ix\xe3P\xc4C\xe1?\x16\xd17\xc1Y\xfc\xed?5\xd7\xae@4\xfa\xe8?\x0f\x87\x8d>\xfcO\xe5?Y\x97\xcb"\xa7%\xe7?\x9b\x8d\x16\xda\x97\xe1\xeb?T\x14\xbd\xfe|\xf4\xd0?\x18\xdfH\xc56A\xba?\x90\xc5\xfb\xc63:\xe5?\xbf%\xad\xe5.\x86\xe9?\xc6\x0c\xa9\x8c\xd7\xd5\xe9?\xf8\xafc:\x84g\xd7?\xf8\x98\x879\x9a\x16\xee?\xba\xdf\x88\x8az\x06\xe2?~g-\xeb\xc8\xed\xee?\x08A\xcc\x8c\xe7>\xef?\xceD\xc4ar\n\xdc?\x92w\xbb\xa34\xb1\xd9?\x88\xb9\xc0{u\xa3\xdc?d\x1a\xad\xe8\xf3\x14\xdd?\x9c\x95\x13\x96o?\xe5?\x9cT[\xb8r\xa9\xe5?0\xf1\x01+(\x0f\xdf?W\xbdjqD&\xed?c\xcf1-W\xe6\xe1?\xce\xbc\xe1{zW\xd9?"d\xcf\xd7\x13\x93\xde?\xf2P\xf6\xc3\xd6\x87\xd5?\xc2\x0e\x92q\x89\xda\xd5?\xc0:B\x1bb\x00\x9e?Y\xafHmr\x80\xe3?\x1co\xa7\xba\xa5/\xe4?\xa2\xbc \x9c\xddB\xd0?\xd2L\x935\x17\'\xee?|\x8cM\xeb\x97=\xe8?\x0f0xN*V\xea?\x81p\xe3,!\xf2\xee?\xf5w\xed\x10\x9eu\xe0?\xc5\x16\\LR\xb5\xe1?\xbeh\x04\xa4g\xe5\xd6?\xea\xc0\xb9\xf0\xb2\xd8\xd9?\xac\x9c\xeep\x1a\xa9\xd8?@W9hp\x16\xb1?\xc4\xedS\xd6V\xa1\xed?\x93,!\xdc\xa1\x8b\xe9?\x80)\xb1\xa6[T\xc9?\xac\xbc\x8a\xd21\xdd\xc5?\x80\x9c.g\xf1\xf2\xc6?\tLu\xc3\xf7U\xe9?n\'\x9f?\xbe\xf9\xe9?\xa3\xe7K\x1c\xb3\xa9\xea?X\x98\x1a\xcb\xa0\xcd\xd3? \xb6O\x9c\x1bQ\xc2?"\x89[\xad1\x8e\xea?\xdd\x8f\xa0P\xc7\x0e\xe2?c\xa4j\xa3\r\xac\xef?\xba\xb6\x0f\x8emo\xef?\xe0\xed\xa0\xc5R9\xab?U\xf1\xcd\xcf\xbf\xcb\xea?\x89*#\x06\xb0|\xe8?d\xa3\xad\xcd\xe0]\xcc?\xb5\xe78\xa7w\x13\xe3?\xce\x99\x98\xefS%\xd7?\xb1\xf8\xd8\x8eI\x13\xef?\x91`]\x93\xd4 \xec?\xc0\rPz\xee\xbd\xe7?7\x92\xd4\x0fP\x8f\xe1?L\x0f\xaf\xa9\xc3\x19\xdd?\\}\x15X\x870\xc7? ~ t\xcat\xb1?@?\xec\x97u\x05\xe9?F\x8d:\xac4D\xdb?qY\xe1Qk|\xe2? \xaf\xeaj\xa5\x04\xab?J[\x1al;\x00\xd5?\x00^{n\xc2\xf1S?\xb0\x82dN\xda\xb5\xc7?\xe0 \x07\xe1?R\x92?\xc4\r\x08+\x99J\xe1?I|&U\x19\xc4\xe1?|*\xf9\xebq\x7f\xed?\xbc*\x93\x89k\xab\xe9?oiL\x90;\xe0\xef?\x96\xcd\x9b\xff\x18g\xdc?pt\xb4\xa5\x9c\xa2\xbc?Nu]w*\xb7\xd2?\x88k\xac\xd0\xfd\xbf\xd5?Q\x02$b\xfeH\xea?5\xf6\t\xb6K\x1a\xee?'
|
||||
p13
|
||||
tp14
|
||||
b.
|
||||
@@ -0,0 +1,10 @@
|
||||
(dp0
|
||||
S'lion'
|
||||
p1
|
||||
S'yellow'
|
||||
p2
|
||||
sS'kitty'
|
||||
p3
|
||||
S'red'
|
||||
p4
|
||||
s.
|
||||
@@ -0,0 +1,30 @@
|
||||
use "collections"
|
||||
|
||||
class Circle
|
||||
var _radius: F32
|
||||
|
||||
new create(radius': F32) =>
|
||||
_radius = radius'
|
||||
|
||||
fun ref get_radius(): F32 =>
|
||||
_radius
|
||||
|
||||
fun ref get_area(): F32 =>
|
||||
F32.pi() * _radius.pow(2)
|
||||
|
||||
fun ref get_circumference(): F32 =>
|
||||
2 * _radius * F32.pi()
|
||||
|
||||
actor Main
|
||||
new create(env: Env) =>
|
||||
|
||||
for i in Range[F32](1.0, 101.0) do
|
||||
let c = Circle(i)
|
||||
|
||||
var str =
|
||||
"Radius: " + c.get_radius().string() + "\n" +
|
||||
"Circumference: " + c.get_circumference().string() + "\n" +
|
||||
"Area: " + c.get_area().string() + "\n"
|
||||
|
||||
env.out.print(str)
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
use "collections"
|
||||
|
||||
actor Counter
|
||||
var _count: U32
|
||||
|
||||
new create() =>
|
||||
_count = 0
|
||||
|
||||
be increment() =>
|
||||
_count = _count + 1
|
||||
|
||||
be get_and_reset(main: Main) =>
|
||||
main.display(_count)
|
||||
_count = 0
|
||||
|
||||
actor Main
|
||||
var _env: Env
|
||||
|
||||
new create(env: Env) =>
|
||||
_env = env
|
||||
|
||||
var count: U32 = try env.args(1).u32() else 10 end
|
||||
var counter = Counter
|
||||
|
||||
for i in Range[U32](0, count) do
|
||||
counter.increment()
|
||||
end
|
||||
|
||||
counter.get_and_reset(this)
|
||||
|
||||
be display(result: U32) =>
|
||||
_env.out.print(result.string())
|
||||
@@ -0,0 +1,261 @@
|
||||
use "options"
|
||||
use "time"
|
||||
use "collections"
|
||||
|
||||
class Config
|
||||
var logtable: U64 = 20
|
||||
var iterate: U64 = 10000
|
||||
var logchunk: U64 = 10
|
||||
var logactors: U64 = 2
|
||||
|
||||
fun ref apply(env: Env): Bool =>
|
||||
var options = Options(env)
|
||||
|
||||
options
|
||||
.add("logtable", "l", I64Argument)
|
||||
.add("iterate", "i", I64Argument)
|
||||
.add("chunk", "c", I64Argument)
|
||||
.add("actors", "a", I64Argument)
|
||||
|
||||
for option in options do
|
||||
match option
|
||||
| ("table", var arg: I64) => logtable = arg.u64()
|
||||
| ("iterate", var arg: I64) => iterate = arg.u64()
|
||||
| ("chunk", var arg: I64) => logchunk = arg.u64()
|
||||
| ("actors", var arg: I64) => logactors = arg.u64()
|
||||
| let err: ParseError =>
|
||||
err.report(env.out)
|
||||
env.out.print(
|
||||
"""
|
||||
gups_opt [OPTIONS]
|
||||
--table N log2 of the total table size. Defaults to 20.
|
||||
--iterate N number of iterations. Defaults to 10000.
|
||||
--chunk N log2 of the chunk size. Defaults to 10.
|
||||
--actors N log2 of the actor count. Defaults to 2.
|
||||
"""
|
||||
)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
env.out.print(
|
||||
"logtable: " + logtable.string() +
|
||||
"\niterate: " + iterate.string() +
|
||||
"\nlogchunk: " + logchunk.string() +
|
||||
"\nlogactors: " + logactors.string()
|
||||
)
|
||||
true
|
||||
|
||||
actor Main
|
||||
let _env: Env
|
||||
let _config: Config = Config
|
||||
|
||||
var _updates: U64 = 0
|
||||
var _confirm: U64 = 0
|
||||
let _start: U64
|
||||
var _actors: Array[Updater] val
|
||||
|
||||
new create(env: Env) =>
|
||||
_env = env
|
||||
|
||||
if _config(env) then
|
||||
let actor_count = 1 << _config.logactors
|
||||
let loglocal = _config.logtable - _config.logactors
|
||||
let chunk_size = 1 << _config.logchunk
|
||||
let chunk_iterate = chunk_size * _config.iterate
|
||||
|
||||
_updates = chunk_iterate * actor_count
|
||||
_confirm = actor_count
|
||||
|
||||
var updaters = recover Array[Updater](actor_count) end
|
||||
|
||||
for i in Range[U64](0, actor_count) do
|
||||
updaters.push(Updater(this, actor_count, i, loglocal, chunk_size,
|
||||
chunk_iterate * i))
|
||||
end
|
||||
|
||||
_actors = consume updaters
|
||||
_start = Time.nanos()
|
||||
|
||||
for a in _actors.values() do
|
||||
a.start(_actors, _config.iterate)
|
||||
end
|
||||
else
|
||||
_start = 0
|
||||
_actors = recover Array[Updater] end
|
||||
end
|
||||
|
||||
be done() =>
|
||||
if (_confirm = _confirm - 1) == 1 then
|
||||
for a in _actors.values() do
|
||||
a.done()
|
||||
end
|
||||
end
|
||||
|
||||
be confirm() =>
|
||||
_confirm = _confirm + 1
|
||||
|
||||
if _confirm == _actors.size() then
|
||||
let elapsed = (Time.nanos() - _start).f64()
|
||||
let gups = _updates.f64() / elapsed
|
||||
|
||||
_env.out.print(
|
||||
"Time: " + (elapsed / 1e9).string() +
|
||||
"\nGUPS: " + gups.string()
|
||||
)
|
||||
end
|
||||
|
||||
actor Updater
|
||||
let _main: Main
|
||||
let _index: U64
|
||||
let _updaters: U64
|
||||
let _chunk: U64
|
||||
let _mask: U64
|
||||
let _loglocal: U64
|
||||
|
||||
let _output: Array[Array[U64] iso]
|
||||
let _reuse: List[Array[U64] iso] = List[Array[U64] iso]
|
||||
var _others: (Array[Updater] val | None) = None
|
||||
var _table: Array[U64]
|
||||
var _rand: U64
|
||||
|
||||
new create(main:Main, updaters: U64, index: U64, loglocal: U64, chunk: U64,
|
||||
seed: U64)
|
||||
=>
|
||||
_main = main
|
||||
_index = index
|
||||
_updaters = updaters
|
||||
_chunk = chunk
|
||||
_mask = updaters - 1
|
||||
_loglocal = loglocal
|
||||
|
||||
_rand = PolyRand.seed(seed)
|
||||
_output = _output.create(updaters)
|
||||
|
||||
let size = 1 << loglocal
|
||||
_table = Array[U64].undefined(size)
|
||||
|
||||
var offset = index * size
|
||||
|
||||
try
|
||||
for i in Range[U64](0, size) do
|
||||
_table(i) = i + offset
|
||||
end
|
||||
end
|
||||
|
||||
be start(others: Array[Updater] val, iterate: U64) =>
|
||||
_others = others
|
||||
iteration(iterate)
|
||||
|
||||
be apply(iterate: U64) =>
|
||||
iteration(iterate)
|
||||
|
||||
fun ref iteration(iterate: U64) =>
|
||||
let chk = _chunk
|
||||
|
||||
for i in Range(0, _updaters) do
|
||||
_output.push(
|
||||
try
|
||||
_reuse.pop()
|
||||
else
|
||||
recover Array[U64](chk) end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
for i in Range(0, _chunk) do
|
||||
var datum = _rand = PolyRand(_rand)
|
||||
var updater = (datum >> _loglocal) and _mask
|
||||
|
||||
try
|
||||
if updater == _index then
|
||||
_table(i) = _table(i) xor datum
|
||||
else
|
||||
_output(updater).push(datum)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
try
|
||||
let to = _others as Array[Updater] val
|
||||
|
||||
repeat
|
||||
let data = _output.pop()
|
||||
|
||||
if data.size() > 0 then
|
||||
to(_output.size()).receive(consume data)
|
||||
else
|
||||
_reuse.push(consume data)
|
||||
end
|
||||
until _output.size() == 0 end
|
||||
end
|
||||
|
||||
if iterate > 1 then
|
||||
apply(iterate - 1)
|
||||
else
|
||||
_main.done()
|
||||
end
|
||||
|
||||
be receive(data: Array[U64] iso) =>
|
||||
try
|
||||
for i in Range(0, data.size()) do
|
||||
let datum = data(i)
|
||||
var j = (datum >> _loglocal) and _mask
|
||||
_table(j) = _table(j) xor datum
|
||||
end
|
||||
|
||||
data.clear()
|
||||
_reuse.push(consume data)
|
||||
end
|
||||
|
||||
be done() =>
|
||||
_main.confirm()
|
||||
|
||||
primitive PolyRand
|
||||
fun apply(prev: U64): U64 =>
|
||||
(prev << 1) xor if prev.i64() < 0 then _poly() else 0 end
|
||||
|
||||
fun seed(from: U64): U64 =>
|
||||
var n = from % _period()
|
||||
|
||||
if n == 0 then
|
||||
return 1
|
||||
end
|
||||
|
||||
var m2 = Array[U64].undefined(64)
|
||||
var temp = U64(1)
|
||||
|
||||
try
|
||||
for i in Range(0, 64) do
|
||||
m2(i) = temp
|
||||
temp = this(temp)
|
||||
temp = this(temp)
|
||||
end
|
||||
end
|
||||
|
||||
var i: U64 = 64 - n.clz()
|
||||
var r = U64(2)
|
||||
|
||||
try
|
||||
while i > 0 do
|
||||
temp = 0
|
||||
|
||||
for j in Range(0, 64) do
|
||||
if ((r >> j) and 1) != 0 then
|
||||
temp = temp xor m2(j)
|
||||
end
|
||||
end
|
||||
|
||||
r = temp
|
||||
i = i - 1
|
||||
|
||||
if ((n >> i) and 1) != 0 then
|
||||
r = this(r)
|
||||
end
|
||||
end
|
||||
end
|
||||
r
|
||||
|
||||
fun _poly(): U64 => 7
|
||||
|
||||
fun _period(): U64 => 1317624576693539401
|
||||
@@ -0,0 +1,3 @@
|
||||
actor Main
|
||||
new create(env: Env) =>
|
||||
env.out.print("Hello, world.")
|
||||
@@ -0,0 +1,188 @@
|
||||
use "files"
|
||||
use "options"
|
||||
use "collections"
|
||||
|
||||
actor Worker
|
||||
new mandelbrot(main: Main, x: U64, y: U64, width: U64, iterations: U64,
|
||||
limit: F32, real: Array[F32] val, imaginary: Array[F32] val)
|
||||
=>
|
||||
var view: Array[U8] iso =
|
||||
recover
|
||||
Array[U8]((y - x) * (width >> 3))
|
||||
end
|
||||
|
||||
let group_r = Array[F32].undefined(8)
|
||||
let group_i = Array[F32].undefined(8)
|
||||
|
||||
var row = x
|
||||
|
||||
try
|
||||
while row < y do
|
||||
let prefetch_i = imaginary(row)
|
||||
|
||||
var col: U64 = 0
|
||||
|
||||
while col < width do
|
||||
var j: U64 = 0
|
||||
|
||||
while j < 8 do
|
||||
group_r.update(j, real(col + j))
|
||||
group_i.update(j, prefetch_i)
|
||||
j = j + 1
|
||||
end
|
||||
|
||||
var bitmap: U8 = 0xFF
|
||||
var n = iterations
|
||||
|
||||
repeat
|
||||
var mask: U8 = 0x80
|
||||
var k: U64 = 0
|
||||
|
||||
while k < 8 do
|
||||
let r = group_r(k)
|
||||
let i = group_i(k)
|
||||
|
||||
group_r.update(k, ((r * r) - (i * i)) + real(col + k))
|
||||
group_i.update(k, (2.0 * r * i) + prefetch_i)
|
||||
|
||||
if ((r * r) + (i * i)) > limit then
|
||||
bitmap = bitmap and not mask
|
||||
end
|
||||
|
||||
mask = mask >> 1
|
||||
k = k + 1
|
||||
end
|
||||
until (bitmap == 0) or ((n = n - 1) == 1) end
|
||||
|
||||
view.push(bitmap)
|
||||
|
||||
col = col + 8
|
||||
end
|
||||
row = row + 1
|
||||
end
|
||||
|
||||
main.draw(x * (width >> 3), consume view)
|
||||
end
|
||||
|
||||
actor Main
|
||||
var iterations: U64 = 50
|
||||
var limit: F32 = 4.0
|
||||
var chunks: U64 = 16
|
||||
var width: U64 = 16000
|
||||
var actors: U64 = 0
|
||||
var header: U64 = 0
|
||||
var real: Array[F32] val = recover Array[F32] end
|
||||
var imaginary: Array[F32] val = recover Array[F32] end
|
||||
var outfile: (File | None) = None
|
||||
|
||||
new create(env: Env) =>
|
||||
try
|
||||
arguments(env)
|
||||
|
||||
let length = width
|
||||
let recip_width = 2.0 / width.f32()
|
||||
|
||||
var r = recover Array[F32](length) end
|
||||
var i = recover Array[F32](length) end
|
||||
|
||||
for j in Range(0, width) do
|
||||
r.push((recip_width * j.f32()) - 1.5)
|
||||
i.push((recip_width * j.f32()) - 1.0)
|
||||
end
|
||||
|
||||
real = consume r
|
||||
imaginary = consume i
|
||||
|
||||
spawn_actors()
|
||||
create_outfile()
|
||||
end
|
||||
|
||||
be draw(offset: U64, pixels: Array[U8] val) =>
|
||||
match outfile
|
||||
| var out: File =>
|
||||
out.seek_start(header + offset)
|
||||
out.write(pixels)
|
||||
if (actors = actors - 1) == 1 then
|
||||
out.dispose()
|
||||
end
|
||||
end
|
||||
|
||||
fun ref create_outfile() =>
|
||||
match outfile
|
||||
| var f: File =>
|
||||
f.print("P4\n " + width.string() + " " + width.string() + "\n")
|
||||
header = f.size()
|
||||
f.set_length((width * (width >> 3)) + header)
|
||||
end
|
||||
|
||||
fun ref spawn_actors() =>
|
||||
actors = ((width + (chunks - 1)) / chunks)
|
||||
|
||||
var rest = width % chunks
|
||||
|
||||
if rest == 0 then rest = chunks end
|
||||
|
||||
var x: U64 = 0
|
||||
var y: U64 = 0
|
||||
|
||||
for i in Range(0, actors - 1) do
|
||||
x = i * chunks
|
||||
y = x + chunks
|
||||
Worker.mandelbrot(this, x, y, width, iterations, limit, real, imaginary)
|
||||
end
|
||||
|
||||
Worker.mandelbrot(this, y, y + rest, width, iterations, limit, real,
|
||||
imaginary)
|
||||
|
||||
fun ref arguments(env: Env) ? =>
|
||||
let options = Options(env)
|
||||
|
||||
options
|
||||
.add("iterations", "i", I64Argument)
|
||||
.add("limit", "l", F64Argument)
|
||||
.add("chunks", "c", I64Argument)
|
||||
.add("width", "w", I64Argument)
|
||||
.add("output", "o", StringArgument)
|
||||
|
||||
for option in options do
|
||||
match option
|
||||
| ("iterations", var arg: I64) => iterations = arg.u64()
|
||||
| ("limit", var arg: F64) => limit = arg.f32()
|
||||
| ("chunks", var arg: I64) => chunks = arg.u64()
|
||||
| ("width", var arg: I64) => width = arg.u64()
|
||||
| ("output", var arg: String) =>
|
||||
outfile = try File(FilePath(env.root, arg)) end
|
||||
| let err: ParseError => err.report(env.out) ; usage(env) ; error
|
||||
end
|
||||
end
|
||||
|
||||
fun tag usage(env: Env) =>
|
||||
env.out.print(
|
||||
"""
|
||||
mandelbrot [OPTIONS]
|
||||
|
||||
The binary output can be converted to a BMP with the following command
|
||||
(ImageMagick Tools required):
|
||||
|
||||
convert <output> JPEG:<output>.jpg
|
||||
|
||||
Available options:
|
||||
|
||||
--iterations, -i Maximum amount of iterations to be done for each pixel.
|
||||
Defaults to 50.
|
||||
|
||||
--limit, -l Square of the limit that pixels need to exceed in order
|
||||
to escape from the Mandelbrot set.
|
||||
Defaults to 4.0.
|
||||
|
||||
--chunks, -c Maximum line count of chunks the image should be
|
||||
divided into for divide & conquer processing.
|
||||
Defaults to 16.
|
||||
|
||||
--width, -w Lateral length of the resulting mandelbrot image.
|
||||
Defaults to 16000.
|
||||
|
||||
--output, -o File to write the output to.
|
||||
|
||||
"""
|
||||
)
|
||||
@@ -0,0 +1,130 @@
|
||||
use "collections"
|
||||
|
||||
actor Worker
|
||||
var _env: Env
|
||||
|
||||
new create(env: Env) =>
|
||||
_env = env
|
||||
|
||||
var a: U64 = 86028157
|
||||
var b: U64 = 329545133
|
||||
|
||||
var result = factorize(a*b)
|
||||
|
||||
var correct =
|
||||
try
|
||||
(result.size() == 2) and
|
||||
(result(0) == 86028157) and
|
||||
(result(1) == 329545133)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
||||
fun ref factorize(bigint: U64) : Array[U64] =>
|
||||
var factors = Array[U64](2)
|
||||
|
||||
if bigint <= 3 then
|
||||
factors.push(bigint)
|
||||
else
|
||||
var d: U64 = 2
|
||||
var i: U64 = 0
|
||||
var n = bigint
|
||||
|
||||
while d < n do
|
||||
if (n % d) == 0 then
|
||||
i = i + 1
|
||||
factors.push(d)
|
||||
n = n / d
|
||||
else
|
||||
d = if d == 2 then 3 else (d + 2) end
|
||||
end
|
||||
end
|
||||
|
||||
factors.push(d)
|
||||
end
|
||||
|
||||
factors
|
||||
|
||||
actor Ring
|
||||
var _env: Env
|
||||
var _size: U32
|
||||
var _pass: U32
|
||||
var _repetitions: U32
|
||||
var _next: Ring
|
||||
|
||||
new create(env: Env, size: U32, pass: U32, repetitions: U32) =>
|
||||
_env = env
|
||||
_size = size
|
||||
_pass = pass
|
||||
_repetitions = repetitions
|
||||
_next = spawn_ring(_env, _size, _pass)
|
||||
run()
|
||||
|
||||
new neighbor(env: Env, next: Ring) =>
|
||||
_env = env
|
||||
_next = next
|
||||
_size = 0
|
||||
_pass = 0
|
||||
_repetitions = 0
|
||||
|
||||
be apply(i: U32) =>
|
||||
if i > 0 then
|
||||
_next(i - 1)
|
||||
else
|
||||
run()
|
||||
end
|
||||
|
||||
fun ref run() =>
|
||||
if _repetitions > 0 then
|
||||
_repetitions = _repetitions - 1
|
||||
_next(_pass * _size)
|
||||
Worker(_env)
|
||||
end
|
||||
|
||||
fun tag spawn_ring(env: Env, size: U32, pass': U32) : Ring =>
|
||||
var next: Ring = this
|
||||
|
||||
for i in Range[U32](0, size) do
|
||||
next = Ring.neighbor(env, next)
|
||||
end
|
||||
|
||||
next
|
||||
|
||||
actor Main
|
||||
var _size: U32 = 50
|
||||
var _count: U32 = 20
|
||||
var _pass: U32 = 10000
|
||||
var _repetitions: U32 = 5
|
||||
var _env: Env
|
||||
|
||||
new create(env: Env) =>
|
||||
_env = env
|
||||
|
||||
try
|
||||
arguments()
|
||||
start_benchmark()
|
||||
else
|
||||
usage()
|
||||
end
|
||||
|
||||
fun ref arguments() ? =>
|
||||
_count = _env.args(1).u32()
|
||||
_size = _env.args(2).u32()
|
||||
_pass = _env.args(3).u32()
|
||||
_repetitions = _env.args(4).u32()
|
||||
|
||||
fun ref start_benchmark() =>
|
||||
for i in Range[U32](0, _count) do
|
||||
Ring(_env, _size, _pass, _repetitions)
|
||||
end
|
||||
|
||||
fun ref usage() =>
|
||||
_env.out.print(
|
||||
"""
|
||||
mixed OPTIONS
|
||||
N number of actors in each ring"
|
||||
N number of rings"
|
||||
N number of messages to pass around each ring"
|
||||
N number of times to repeat"
|
||||
"""
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,18 +5,6 @@ set -ex
|
||||
# Fetch all commits/refs needed to run our tests.
|
||||
git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
script/vendor-deb libicu48 libicu-dev
|
||||
if ruby -e 'exit RUBY_VERSION >= "2.0" && RUBY_VERSION < "2.1"'; then
|
||||
# Workaround for https://bugs.ruby-lang.org/issues/8074. We can't use this
|
||||
# solution on all versions of Ruby due to
|
||||
# https://github.com/bundler/bundler/pull/3338.
|
||||
bundle config build.charlock_holmes --with-icu-include=$(pwd)/vendor/debs/include --with-icu-lib=$(pwd)/vendor/debs/lib
|
||||
else
|
||||
bundle config build.charlock_holmes --with-icu-dir=$(pwd)/vendor/debs
|
||||
fi
|
||||
|
||||
# Replace SSH links to submodules by HTTPS links.
|
||||
sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mkdir -p vendor/apt vendor/debs
|
||||
|
||||
(cd vendor/apt && apt-get --assume-yes download "$@")
|
||||
|
||||
for deb in vendor/apt/*.deb; do
|
||||
ar p $deb data.tar.gz | tar -vzxC vendor/debs --strip-components=2
|
||||
done
|
||||
@@ -9,7 +9,6 @@ class TestGrammars < Minitest::Test
|
||||
|
||||
# This grammar has a nonstandard but acceptable license.
|
||||
"vendor/grammars/gap-tmbundle",
|
||||
"vendor/grammars/factor",
|
||||
|
||||
# These grammars have no license but have been grandfathered in. New grammars
|
||||
# must have a license that allows redistribution.
|
||||
@@ -81,7 +80,7 @@ class TestGrammars < Minitest::Test
|
||||
end
|
||||
|
||||
def test_submodules_have_recognized_licenses
|
||||
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::Project.new(k).license_file }
|
||||
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::FSProject.new(k).license_file }
|
||||
unrecognized.reject! { |k,v| PROJECT_WHITELIST.include?(k) }
|
||||
message = "The following submodules have unrecognized licenses:\n* #{unrecognized.keys.join("\n* ")}\n"
|
||||
message << "Please ensure that the project's LICENSE file contains the full text of the license."
|
||||
@@ -132,7 +131,7 @@ class TestGrammars < Minitest::Test
|
||||
# Given the path to a submodule, return its SPDX-compliant license key
|
||||
def submodule_license(submodule)
|
||||
# Prefer Licensee to detect a submodule's license
|
||||
project = Licensee::Project.new(submodule)
|
||||
project = Licensee::FSProject.new(submodule)
|
||||
return project.license.key if project.license
|
||||
|
||||
# We know a license file exists, but Licensee wasn't able to detect the license,
|
||||
|
||||
@@ -57,6 +57,7 @@ class TestLanguage < Minitest::Test
|
||||
assert_equal Language['Shell'], Language.find_by_alias('sh')
|
||||
assert_equal Language['Shell'], Language.find_by_alias('shell')
|
||||
assert_equal Language['Shell'], Language.find_by_alias('zsh')
|
||||
assert_equal Language['SuperCollider'], Language.find_by_alias('supercollider')
|
||||
assert_equal Language['TeX'], Language.find_by_alias('tex')
|
||||
assert_equal Language['TypeScript'], Language.find_by_alias('ts')
|
||||
assert_equal Language['VimL'], Language.find_by_alias('vim')
|
||||
@@ -119,6 +120,7 @@ class TestLanguage < Minitest::Test
|
||||
assert_equal 'vim', Language['VimL'].search_term
|
||||
assert_equal 'jsp', Language['Java Server Pages'].search_term
|
||||
assert_equal 'rst', Language['reStructuredText'].search_term
|
||||
assert_equal 'supercollider', Language['SuperCollider'].search_term
|
||||
end
|
||||
|
||||
def test_popular
|
||||
@@ -138,6 +140,7 @@ class TestLanguage < Minitest::Test
|
||||
assert_equal :programming, Language['Ruby'].type
|
||||
assert_equal :programming, Language['TypeScript'].type
|
||||
assert_equal :programming, Language['Makefile'].type
|
||||
assert_equal :programming, Language['SuperCollider'].type
|
||||
end
|
||||
|
||||
def test_markup
|
||||
@@ -227,7 +230,8 @@ class TestLanguage < Minitest::Test
|
||||
"python" => "Python",
|
||||
"python2" => "Python",
|
||||
"python3" => "Python",
|
||||
"sbcl" => "Common Lisp"
|
||||
"sbcl" => "Common Lisp",
|
||||
"sclang" => "SuperCollider"
|
||||
}.each do |interpreter, language|
|
||||
assert_equal [Language[language]], Language.find_by_interpreter(interpreter)
|
||||
end
|
||||
@@ -339,6 +343,7 @@ class TestLanguage < Minitest::Test
|
||||
assert Language['Perl'].extensions.include?('.pl')
|
||||
assert Language['Python'].extensions.include?('.py')
|
||||
assert Language['Ruby'].extensions.include?('.rb')
|
||||
assert Language['SuperCollider'].extensions.include?('.scd')
|
||||
end
|
||||
|
||||
def test_primary_extension
|
||||
@@ -349,6 +354,7 @@ class TestLanguage < Minitest::Test
|
||||
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
|
||||
assert_equal '.t', Language['Turing'].primary_extension
|
||||
assert_equal '.ts', Language['TypeScript'].primary_extension
|
||||
assert_equal '.sc', Language['SuperCollider'].primary_extension
|
||||
end
|
||||
|
||||
def test_eql
|
||||
|
||||
Vendored
+1
-1
Submodule vendor/grammars/Docker.tmbundle updated: 6bb36d8262...08585643c0
Vendored
+1
-1
Submodule vendor/grammars/FreeMarker.tmbundle updated: 6b7b880c53...7259485a01
Vendored
+1
-1
Submodule vendor/grammars/InnoSetup updated: a7f79fd1a5...2853a397c7
Vendored
+1
-1
Submodule vendor/grammars/NSIS updated: ea6104445d...68a4534dde
Vendored
+1
-1
Submodule vendor/grammars/NimLime updated: 5111833868...7aea8846e1
Vendored
+1
-1
Submodule vendor/grammars/Stata.tmbundle updated: bc1e36344d...50685c2735
+1
-1
Submodule vendor/grammars/Sublime-Text-2-OpenEdge-ABL updated: dd14b342cb...c830631431
Vendored
+1
-1
Submodule vendor/grammars/atom-fsharp updated: 7051d65d63...eb5553c3b9
Vendored
+1
-1
Submodule vendor/grammars/elixir-tmbundle updated: 46514e8f9f...25bf933246
Vendored
+1
-1
Submodule vendor/grammars/factor updated: 9b5cb445ee...a97f840daa
Vendored
+1
-1
Submodule vendor/grammars/jade-tmbundle updated: fea35b58dc...6cde1da688
Vendored
+1
-1
Submodule vendor/grammars/language-babel updated: 44ff68da9e...b555180508
+1
-1
Submodule vendor/grammars/language-coffee-script updated: 0eeace014b...cea48a62ab
Vendored
+1
-1
Submodule vendor/grammars/language-javascript updated: 9d69b86e30...9167541232
Vendored
+1
-1
Submodule vendor/grammars/language-shellscript updated: 0bbc7eee5a...331dbfea1f
+1
Submodule vendor/grammars/language-supercollider added at 2b1da230e3
Vendored
+1
-1
Submodule vendor/grammars/latex.tmbundle updated: d40245e130...0774651f87
Vendored
+1
-1
Submodule vendor/grammars/processing.tmbundle updated: 4070e43b09...214b3420f1
Vendored
+1
-1
Submodule vendor/grammars/sas.tmbundle updated: 43a05b10fc...30fa23fc34
+1
Submodule vendor/grammars/sublime-pony added at 2b69dd3e47
Vendored
+1
-1
Submodule vendor/grammars/sublime-typescript updated: a4c4b9fc79...51341e0ae7
Vendored
+1
-1
Submodule vendor/grammars/vue-syntax-highlight updated: 7d35a53e7e...3b5c4183bf
Reference in New Issue
Block a user