Compare commits

..

98 Commits

Author SHA1 Message Date
Arfon Smith
e78e9e4747 Merge pull request #3071 from github/cut-release-4.8.7
Cut release 4.8.7
2016-06-21 10:30:45 -06:00
Arfon Smith
81f9079f43 Bumping version to v4.8.7 2016-06-21 09:57:23 -06:00
Arfon Smith
16eaa533b6 Updating gitsubmodules 2016-06-21 09:34:05 -06:00
Arfon Smith
2e521a6c74 Grammars update 2016-06-21 09:28:33 -06:00
Sahil Dua
56a65d0975 Add ace-builds to vendored files (#3061) 2016-06-21 06:45:37 -06:00
Paul Chaignon
e4c6c1d245 Remove pragma keyword from PLSQL heuristic rule (#3066)
The pragma keyword is not specific to PLSQL and can be found in other SQL languages
2016-06-21 06:45:05 -06:00
Lars Brinkhoff
a9f366aed2 Merge pull request #3054 from Alhadis/srt
Add support for SubRip Text files and SRecode Templates
2016-06-20 07:35:31 +02:00
Arfon Smith
96bd08e391 Adding some words about maintainers (#3051)
* Update CONTRIBUTING.md

* Move maintainers to bottom

* 📝
2016-06-18 08:28:53 -06:00
Alhadis
02fe28eb25 Crank luminosity of SRecode Template language's colour 2016-06-16 19:50:39 +10:00
Alhadis
e77530b390 Classify SRecode Templates as a separate language 2016-06-16 19:34:26 +10:00
Alhadis
d0370a3b4c Add a heuristic to disambiguate SubRip text files 2016-06-15 21:17:35 +10:00
Alhadis
ebce4890b2 Add grammar to supply syntax highlighting for SubRip files 2016-06-15 21:09:19 +10:00
Alhadis
1bc87aadb3 Define SubRip Text language and add sample 2016-06-15 21:06:45 +10:00
Alhadis
53a532dc76 Add .srt to Emacs Lisp extensions 2016-06-15 16:51:36 +10:00
John Gardner
0669a83e40 Define TextMate grammar scope for Turing (#3053) 2016-06-14 19:54:25 -06:00
John Gardner
c4ab3b276f Add syntax highlighting for Turing (#3052)
* Change Turing's colour to red

* Add a grammar for Turing
2016-06-14 13:16:26 -06:00
John Gardner
920f825496 Add heuristic for Perl6 and Turing (#3049) 2016-06-13 13:11:56 -06:00
Arfon Smith
f28573420e Set encoding when writing out samples (#3046) 2016-06-13 13:11:04 -06:00
Charlie Briggs
c471990aa3 Add npm-shrinkwrap.json to generated files (#3048)
This file is generated by the `npm shrinkwrap` command. It's large,
generated, and has a noisey diff. One similar file, php composer lock
files, is already ignored.

Closes https://github.com/github/linguist/issues/3045
2016-06-13 13:10:13 -06:00
Horatiu Lazu
baf56666d4 Improve Turing sample (#3040)
* Improve Turing sample

* Move more complex sample to different file

* Undo changes to original file
2016-06-07 06:13:12 -06:00
Arfon Smith
cbbc05f7b8 Merge pull request #3007 from russelldavis/russell-fix-docs
Fix incorrect docs on vendored files & restore docs on generated files
2016-06-07 06:06:18 -06:00
Arfon Smith
051906727b Merge pull request #3038 from Alhadis/rst-switch
Switch grammar used for reStructuredText highlighting
2016-06-05 10:22:03 -06:00
Alhadis
cfd5cbaba0 Remove "orphaned" grammar module 2016-06-05 20:28:24 +10:00
Alhadis
caaad886c3 Kick Travis 2016-06-05 20:11:22 +10:00
Alhadis
2305f9051c Add new grammar 2016-06-05 07:27:32 +10:00
Alhadis
392ab2960f Remove existing reStructuredText grammar 2016-06-05 07:23:10 +10:00
Arfon Smith
1e134b5754 Merge pull request #3037 from Alhadis/clean-grammar
Add syntax highlighting for the Clean language
2016-06-03 14:03:10 -06:00
Alhadis
d356ea28af Add syntax highlighting for the Clean language 2016-06-04 03:57:08 +10:00
Arfon Smith
a015138dcd Merge pull request #3035 from github/cut-release-v4.8.6
Cut release v4.8.6
2016-06-02 19:11:46 -06:00
Arfon Smith
ff99d1bac8 Removing grammar that is breaking the build. 2016-06-02 18:30:51 -06:00
Arfon Smith
f4af4727a1 Bumping to v4.8.6 2016-06-02 11:35:29 -06:00
Arfon Smith
2c3069db77 Grammar updates 2016-06-02 11:33:17 -06:00
Arfon Smith
8845cd9c58 Merge pull request #3034 from github/3020-local
Add support for Wavefront OBJ/MTL files: part deux
2016-06-02 11:00:04 -06:00
Arfon Smith
090f765c7e Merge pull request #3001 from snh/lock-not-json
Remove .lock from JSON extentions
2016-06-02 10:59:06 -06:00
Arfon Smith
b58c0e8f3e Merge branch 'master' into 3020-local 2016-06-02 10:55:46 -06:00
Arfon Smith
b4ff170603 Merge pull request #3033 from github/change-elm-grammar
Change Elm grammar to community version
2016-06-02 10:35:08 -06:00
Arfon Smith
3bc540a283 Removing un-used grammar reference 2016-06-02 10:29:57 -06:00
Arfon Smith
25b761b506 Moving to Elm community grammar 2016-06-02 10:20:33 -06:00
Arfon Smith
1e502808c9 Removing old Elm grammar 2016-06-02 10:17:12 -06:00
John Gardner
27e0c8f78a Fix a misspelt Cpp-ObjDump alias (#3028) 2016-06-01 12:06:54 -06:00
John Gardner
897218678e Add interpreters for APL and J (#3029)
* Add APL interpreters

* Add J interpreter

* Add test fixtures for APL/J interpreters
2016-06-01 10:41:22 -06:00
John Gardner
4eb33fe3be Use a dedicated grammar for highlighting Nu syntax (#3030) 2016-06-01 10:40:31 -06:00
Alhadis
0614055efd Merge remote-tracking branch 'upstream/master' into wavefront
Resolves conflicts:
	.gitmodules
2016-05-29 15:54:46 +10:00
Nate Whetsell
e70f3f595a Add Csound languages (#3005)
* Add Csound languages

* Remove Csound Document alias

* Remove Csound Score alias

* Replace sample files

* Update language-csound grammar

* Update language-csound

* Update language-csound

* Add Makefile.sco to Makefile filenames

* Add makefile.sco sample

* Fix case of filename makefile.sco
2016-05-28 20:43:59 -05:00
Vasily Korytov
28af996bf9 allow .pug to be threated as jade (#3019)
see https://github.com/pugjs/pug/issues/2184 for more details
2016-05-28 20:40:04 -05:00
Alhadis
8bd8f0960c Add sample OBJ/MTL files 2016-05-27 21:05:43 +10:00
Alhadis
255db77f1f Add support for Wavefront OBJ/MTL files 2016-05-27 21:02:39 +10:00
John Gardner
8b0b14c9a6 Add support for the COLLADA file format (#3009) 2016-05-23 09:49:15 -05:00
John Gardner
95e83311b6 Add "README.1ST" to recognised text-file names (#3010)
* Add "README.1ST" as a recognised readme name

* Add a fixture for ".1st" readme files
2016-05-22 09:03:21 -05:00
Russell Davis
6c07476c45 Fix incorrect docs on vendored files & restore docs on generated files 2016-05-17 23:48:01 -07:00
Steven Honson
1968f8193c Remove .lock from JSON extentions 2016-05-11 16:38:24 +10:00
Arfon Smith
5155ad89e8 Adding back Creole grammar (#2999) 2016-05-09 20:55:49 -06:00
Arfon Smith
c2505e8b7b Update CONTRIBUTING.md 2016-05-09 20:41:43 -06:00
Arfon Smith
b38f4b786b Update languages.yml (#2998) 2016-05-09 08:57:33 -07:00
Kepler Sticka-Jones
1a04c79738 Add ECR (Embedded Crystal) (#2996)
* Add ECR entry from language-crystal

* Add HTML+ECR to Languages.

* Create greeting.erb sample

From the ECR documentation: http://crystal-lang.org/api/ECR.html

* Rename greeting.erb to greeting.ecr

* Rename samples/HTML-ERB/greeting.ecr to samples/HTML-ECR/greeting.ecr

* Update Crystal submodule.

This contains the ECR highlighting.

* Proper named HTML+ECR folder.

The GitHub website just wouldn't do the folder right.

* Add .ecr file extension to ECR
2016-05-09 08:42:09 -07:00
Arfon Smith
a464c234b8 Update languages.yml (#2995) 2016-05-06 18:01:59 -06:00
Arfon Smith
aa2319a052 Cut release v4.8.5 (#2994)
* Grammar update

* Bumping to v4.8.5
2016-05-06 17:14:25 -06:00
Arfon Smith
f22181f47d EJS support (#2993)
* Added EJS Language Support

* Added the submodule reference for ejs-tmbundle

* Adding EJS license
2016-05-06 15:58:53 -06:00
Arfon Smith
3191ff498d 2945 local (#2992)
* Added Django environment folder in exclusion

Django projects have env/ folder in which dependencies of the project like Django, Pillow, and other libraries are installed from the requirements.txt file. It would be best if this folder of dependencies is ignored from the language statistics.

* Corrected Errors

Corrected the misplaced code and put removed the start character as the environment folder may not always be in the root.

* Adding test for env folder
2016-05-06 15:36:07 -06:00
Paul Chaignon
91ea482ea6 Add grammar for CLIPS back (#2991) 2016-05-06 15:33:05 -06:00
Jan Olaf Krems
905d87a112 Detect .js files with source maps as generated (#2984)
* Fix .min.js test

* Detect .js files with source maps as generated
2016-05-06 15:20:42 -06:00
Jakub Jirutka
8eae4e56ef Add support for Alpine Abuild (APKBUILD) (#2934)
APKBUILD is a file containing "recipes" on how something should be
built/compiled. It's used by APK, the Alpine Linux package manager.
2016-05-06 14:55:33 -06:00
Jakub Jirutka
5466fcfd2f Add support for OpenRC runscripts (#2935) 2016-05-06 14:39:42 -06:00
Arfon Smith
176a0e9926 TLA revisited (#2990)
* Add the TLA+ language

This patch adds support for the TLA+ specification language.

https://github.com/search?utf8=%E2%9C%93&q=MODULE+extension%3Atla&type=Code&ref=searchresults

* Update TLA grammar license

Attribution is given in the license since the grammar is based off of the TLA+ language developed by Microsoft and HP.

* Sort languages.yml alphabetically

* Removing duplicate entry
2016-05-06 13:19:44 -06:00
John Gardner
aa049b4677 Add support for BSDmakefile, .arcconfig, and .JSON-tmLanguage files (#2986)
* Add support for .arcconfig files

* Add .JSON-tmLanguage to recognised JSON extensions

* Add BSDmakefile to recognised Makefile filenames

* Silence Travis
2016-05-06 12:49:58 -06:00
Paul Chaignon
5c19f1f546 Limit scope of modeline search (#2967)
Only matches the first and last 5 lines against the modeline regular expressions
2016-05-05 09:33:40 -06:00
John Gardner
9ae19a1f94 Add support for World of Warcraft .toc files
* Add language rule and heuristic for WoW Addon data

* Add test fixtures for the .toc extension

* Add grammar for syntax highlighting

* Define colour of WoW .toc files

* Refine heuristic to include a commonly-used keyword

* Check whitespace in WoW-token heuristic

* Include additional TeX keywords in .toc heuristic

* Update grammar submodules

* Cache license for WoW-toc grammar

* Reverting sourcepawn update
2016-05-04 15:07:01 -06:00
Paul Chaignon
8cf3b7ad51 Heuristic for .inc PHP files (#2980) 2016-05-03 21:15:20 -06:00
Paul Chaignon
03d16835aa Remove Terra from Lua group (#2976)
Terra and Lua are two separate languages, although closely related
2016-05-02 19:33:38 -06:00
Arfon Smith
7174130e46 Bumping to v4.8.4 (#2973) 2016-04-29 14:26:54 -06:00
Arfon Smith
59f64c47b1 grammar update 2016-04-29 13:14:40 -06:00
Stephen Whipple
f3655e8a1e Add .app.src as Erlang extension. (#2964)
* Add .app.src as Erlang extension.

* Add .app.src sample.
2016-04-29 12:45:43 -06:00
Paul Chaignon
f97d796f90 Add new step required when adding a grammar (#2966)
Grammar licenses are now cached locally
Therefore, it is required to update the local cache when adding a new grammar
2016-04-29 12:43:55 -06:00
Peter Jas
d342aa4841 Classify builds, pkgproj, resx and sfproj as XML (#2954)
* Classify builds, pkgproj, resx and sfproj as XML

* Disambiguate .builds for XML and Text
2016-04-27 11:11:07 -06:00
Paul Chaignon
5c655e3b20 Grammar for AutoIt from Sublime Text package (#2961) 2016-04-27 11:09:36 -06:00
Paul Chaignon
9a0ac4a477 Makefile.frag as a Makefile filename (#2969) 2016-04-26 08:39:53 -06:00
Brandon Keepers
8ea9632ccf Merge pull request #2955 from github/verify-licenses
Verify licenses on CI
2016-04-16 10:46:23 -04:00
Brandon Keepers
03ef4f30e8 Remove licenses from removed grammars 2016-04-16 10:35:57 -04:00
Brandon Keepers
12228fb525 Proper exit status for script/licensed 2016-04-16 10:25:34 -04:00
Brandon Keepers
92897046ed Remove licenses from Rubygems licenses
We are still solidifying patterns around how licenses should be managed, but given the Gemfile.lock file is ignored, I don't think it makes sense for linguist to track licenses for Ruby dependencies. A consumer of this gem could end up with a different version of a dependency that has a different license.

In general, I think libraries should only track licenses for code that they vendor. Since linguist vendors the grammars, it makes sense for it to track the licenses for them.
2016-04-16 10:21:50 -04:00
Brandon Keepers
91aa843a4e Verify licenses with travis 2016-04-16 10:12:45 -04:00
Kepler Sticka-Jones
c3145d3c08 Add Forge Mod Loader Mod Info file as JSON (#2941)
* Add Forge Mod Loader Mod Info file as JSON

* Add Forge Mod Loader Mod Info File

* Rename samples/JSON/mcmod.info to samples/JSON/filenames/mcmod.info
2016-04-15 11:16:50 -07:00
Michael Zhou
1ad2123896 Add gradlew and a few other filenames to Shell (#2910) 2016-04-15 11:14:57 -07:00
Bruce
9b9a256c60 Added GLSL extensions .vsh & .fsh (#2951) 2016-04-15 08:06:11 -07:00
Arfon Smith
0f3644d23a Bumping Linguist to v4.8.3 (#2950) 2016-04-14 19:55:23 -07:00
Arfon Smith
04d3023f76 Grammar update 2016-04-14 18:51:15 -07:00
Arfon Smith
5c7aa5406a Adding license text for graphql 2016-04-13 21:08:47 -07:00
Garen Torikian
bce676e902 Add support for GraphQL (#2947)
* Add GraphQL to languages.yml

* Add graphql submodule

* Add graphql to grammars.yml

* Add GraphQL samples

* Updating licensed information
2016-04-13 21:03:02 -07:00
Arfon Smith
7c9fd59a99 Updating licensed information for APL 2016-04-13 20:59:36 -07:00
John Gardner
b89d1a2e77 Add "mkfile" as a recognised Makefile name (#2938)
* Add ".mkfile" as a recognised Makefile extension

* Add a test-fixture for the "mkfile" extension

* Replace mkfile fixture with rewritten source
2016-04-08 20:51:41 -06:00
John Gardner
f8c5015b20 Switch grammar used for APL highlighting (#2937)
* Swap language repository used for APL highlighting

* Remove previous repository from submodule list
2016-04-08 14:15:21 -06:00
Arfon Smith
f28cdc8a15 Merge pull request #2936 from github/idris
Idris
2016-04-03 07:55:26 -06:00
Arfon Smith
0e147f1f66 Merge branch 'master' into idris 2016-04-03 07:51:05 -06:00
Arfon Smith
a91705724d Adding atomic dreams license 2016-04-03 07:48:59 -06:00
PJB3005
5e3e8133fb Adds proper grammar for the DM language. 2016-04-03 07:46:21 -06:00
Arfon Smith
5a3758f1c7 Linguist license docs bump 2016-04-03 07:41:24 -06:00
Arfon Smith
57237106f3 Adding back Idris grammar 2016-04-03 07:41:10 -06:00
John Gardner
99ad2368b0 Add ISC to license whitelist
Add ISC to license whitelist
2016-03-31 09:19:30 -07:00
167 changed files with 6105 additions and 285 deletions

67
.gitmodules vendored
View File

@@ -364,9 +364,6 @@
[submodule "vendor/grammars/r.tmbundle"]
path = vendor/grammars/r.tmbundle
url = https://github.com/textmate/r.tmbundle
[submodule "vendor/grammars/restructuredtext.tmbundle"]
path = vendor/grammars/restructuredtext.tmbundle
url = https://github.com/textmate/restructuredtext.tmbundle
[submodule "vendor/grammars/ruby-haml.tmbundle"]
path = vendor/grammars/ruby-haml.tmbundle
url = https://github.com/textmate/ruby-haml.tmbundle
@@ -446,9 +443,6 @@
[submodule "vendor/grammars/Scalate.tmbundle"]
path = vendor/grammars/Scalate.tmbundle
url = https://github.com/scalate/Scalate.tmbundle
[submodule "vendor/grammars/Elm.tmLanguage"]
path = vendor/grammars/Elm.tmLanguage
url = https://github.com/deadfoxygrandpa/Elm.tmLanguage
[submodule "vendor/grammars/sublime-bsv"]
path = vendor/grammars/sublime-bsv
url = https://github.com/thotypous/sublime-bsv
@@ -479,9 +473,6 @@
[submodule "vendor/grammars/Modelica"]
path = vendor/grammars/Modelica
url = https://github.com/BorisChumichev/modelicaSublimeTextPackage
[submodule "vendor/grammars/sublime-apl"]
path = vendor/grammars/sublime-apl
url = https://github.com/StoneCypher/sublime-apl
[submodule "vendor/grammars/sublime-golo"]
path = vendor/grammars/sublime-golo
url = https://github.com/TypeUnsafe/sublime-golo
@@ -684,8 +675,8 @@
path = vendor/grammars/pig-latin
url = https://github.com/goblindegook/sublime-text-pig-latin
[submodule "vendor/grammars/sourcepawn"]
path = vendor/grammars/sourcepawn
url = https://github.com/austinwagner/sublime-sourcepawn
path = vendor/grammars/sourcepawn
url = https://github.com/austinwagner/sublime-sourcepawn
[submodule "vendor/grammars/gdscript"]
path = vendor/grammars/gdscript
url = https://github.com/beefsack/GDScript-sublime
@@ -698,6 +689,60 @@
[submodule "vendor/grammars/grace"]
path = vendor/grammars/grace
url = https://github.com/zmthy/grace-tmbundle
[submodule "vendor/grammars/ejs-tmbundle"]
path = vendor/grammars/ejs-tmbundle
url = https://github.com/gregory-m/ejs-tmbundle
[submodule "vendor/grammars/nix"]
path = vendor/grammars/nix
url = https://github.com/wmertens/sublime-nix
[submodule "vendor/grammars/idris"]
path = vendor/grammars/idris
url = https://github.com/idris-hackers/idris-sublime.git
[submodule "vendor/grammars/atomic-dreams"]
path = vendor/grammars/atomic-dreams
url = https://github.com/PJB3005/atomic-dreams
[submodule "vendor/grammars/language-apl"]
path = vendor/grammars/language-apl
url = https://github.com/Alhadis/language-apl.git
[submodule "vendor/grammars/language-graphql"]
path = vendor/grammars/language-graphql
url = https://github.com/rmosolgo/language-graphql
[submodule "vendor/grammars/language-toc-wow"]
path = vendor/grammars/language-toc-wow
url = https://github.com/nebularg/language-toc-wow
[submodule "vendor/grammars/sublime-autoit"]
path = vendor/grammars/sublime-autoit
url = https://github.com/AutoIt/SublimeAutoItScript
[submodule "vendor/grammars/TLA"]
path = vendor/grammars/TLA
url = https://github.com/agentultra/TLAGrammar
[submodule "vendor/grammars/sublime-clips"]
path = vendor/grammars/sublime-clips
url = https://github.com/psicomante/CLIPS-sublime
[submodule "vendor/grammars/creole"]
path = vendor/grammars/creole
url = https://github.com/Siddley/Creole
[submodule "vendor/grammars/language-csound"]
path = vendor/grammars/language-csound
url = https://github.com/nwhetsell/language-csound
[submodule "vendor/grammars/language-wavefront"]
path = vendor/grammars/language-wavefront
url = https://github.com/Alhadis/language-wavefront
[submodule "vendor/grammars/nu.tmbundle"]
path = vendor/grammars/nu.tmbundle
url = https://github.com/jsallis/nu.tmbundle
[submodule "vendor/grammars/Elm"]
path = vendor/grammars/Elm
url = https://github.com/elm-community/Elm.tmLanguage
[submodule "vendor/grammars/language-restructuredtext"]
path = vendor/grammars/language-restructuredtext
url = https://github.com/Lukasa/language-restructuredtext
[submodule "vendor/grammars/atom-language-clean"]
path = vendor/grammars/atom-language-clean
url = https://github.com/timjs/atom-language-clean.git
[submodule "vendor/grammars/language-turing"]
path = vendor/grammars/language-turing
url = https://github.com/Alhadis/language-turing
[submodule "vendor/grammars/atom-language-srt"]
path = vendor/grammars/atom-language-srt
url = https://github.com/314eter/atom-language-srt

View File

@@ -6,6 +6,9 @@ addons:
- libicu-dev
- libicu48
before_install: script/travis/before_install
script:
- bundle exec rake
- script/licensed verify
rvm:
- 2.0.0
- 2.1

View File

@@ -1,8 +1,6 @@
# Contributing
[code-of-conduct]: http://todogroup.org/opencodeofconduct/#Linguist/opensource@github.com
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this code.
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. This project adheres to the [Contributor Covenant Code of Conduct](http://contributor-covenant.org/). By participating, you are expected to uphold this code.
The majority of contributions won't need to touch any Ruby code at all.
@@ -33,6 +31,7 @@ To add support for a new language:
0. Add a grammar for your language. Please only add grammars that have a license that permits redistribution.
0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`.
0. Add your grammar to [`grammars.yml`][grammars] by running `script/convert-grammars --add vendor/grammars/MyGrammar`.
0. Download the license for the grammar: `script/licensed`. Be careful to only commit the file for the new grammar, as this script may update licenses for other grammars as well.
0. Add samples for your language to the [samples directory][samples] in the correct subdirectory.
0. Open a pull request, linking to a [GitHub search result](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.
@@ -78,8 +77,20 @@ Sometimes getting the tests running can be too much work, especially if you don'
Here's our current build status: [![Build Status](https://api.travis-ci.org/github/linguist.svg?branch=master)](https://travis-ci.org/github/linguist)
## Maintainers
## Releasing
Linguist is maintained with :heart: by:
- @arfon (GitHub Staff)
- @larsbrinkhoff
- @pchaigno
As Linguist is a production dependency for GitHub we have a couple of workflow restrictions:
- Anyone with commit rights can merge Pull Requests provided that there is a :+1: from a GitHub member of staff
- Releases are performed by GitHub staff so we can ensure GitHub.com always stays up to date with the latest release of Linguist and there are no regressions in production.
### Releasing
If you are the current maintainer of this gem:

View File

@@ -43,7 +43,7 @@ special-vendored-path/* linguist-vendored
jquery.js linguist-vendored=false
```
Similar to vendored files, Linguist excludes documentation files from your project's language stats. (Unlike vendored files, documentation files are displayed in diffs on github.com.) [lib/linguist/documentation.yml](lib/linguist/documentation.yml) lists common documentation paths and excludes them from the language statistics for your repository.
Just like vendored files, Linguist excludes documentation files from your project's language stats. [lib/linguist/documentation.yml](lib/linguist/documentation.yml) lists common documentation paths and excludes them from the language statistics for your repository.
Use the `linguist-documentation` attribute to mark or unmark paths as documentation.
@@ -53,6 +53,16 @@ project-docs/* linguist-documentation
docs/formatter.rb linguist-documentation=false
```
#### Generated file detection
Not all plain text files are true source files. Generated files like minified js and compiled CoffeeScript can be detected and excluded from language stats. As an added bonus, unlike vendored and documentation files, these files are suppressed in diffs.
```ruby
Linguist::FileBlob.new("underscore.min.js").generated? # => true
```
See [Linguist::Generated#generated?](https://github.com/github/linguist/blob/master/lib/linguist/generated.rb).
### Using Emacs or Vim modelines
Alternatively, you can use Vim or Emacs style modelines to set the language for a single file. Modelines can be placed anywhere within a file and are respected when determining how to syntax-highlight a file on GitHub.com

View File

@@ -18,8 +18,6 @@ http://svn.textmate.org/trunk/Review/Bundles/XQuery.tmbundle:
https://bitbucket.org/Clams/sublimesystemverilog/get/default.tar.gz:
- source.systemverilog
- source.ucfconstraints
https://fan.googlecode.com/hg-history/Build%201.0.55/adm/tools/textmate/Fan.tmbundle/Syntaxes/Fan.tmLanguage:
- source.fan
vendor/grammars/Agda.tmbundle:
- source.agda
vendor/grammars/Alloy.tmbundle:
@@ -36,7 +34,7 @@ vendor/grammars/ColdFusion:
- text.html.cfm
vendor/grammars/Docker.tmbundle:
- source.dockerfile
vendor/grammars/Elm.tmLanguage:
vendor/grammars/Elm/:
- source.elm
vendor/grammars/FreeMarker.tmbundle:
- text.html.ftl
@@ -129,6 +127,8 @@ vendor/grammars/SublimePuppet/:
- source.puppet
vendor/grammars/SublimeXtend:
- source.xtend
vendor/grammars/TLA:
- source.tla
vendor/grammars/TXL/:
- source.txl
vendor/grammars/Textmate-Gosu-Bundle:
@@ -176,13 +176,20 @@ vendor/grammars/atom-fsharp/:
- source.fsharp.fsi
- source.fsharp.fsl
- source.fsharp.fsx
vendor/grammars/atom-language-clean:
- source.clean
vendor/grammars/atom-language-purescript/:
- source.purescript
vendor/grammars/atom-language-srt:
- text.srt
vendor/grammars/atom-language-stan/:
- source.stan
vendor/grammars/atom-salt:
- source.python.salt
- source.yaml.salt
vendor/grammars/atomic-dreams/:
- source.dm
- source.dmf
vendor/grammars/ats:
- source.ats
vendor/grammars/awk-sublime:
@@ -214,6 +221,8 @@ vendor/grammars/cool-tmbundle:
vendor/grammars/cpp-qt.tmbundle:
- source.c++.qt
- source.qmake
vendor/grammars/creole/:
- text.html.creole
vendor/grammars/css.tmbundle:
- source.css
vendor/grammars/cucumber-tmbundle:
@@ -240,6 +249,8 @@ vendor/grammars/ec.tmbundle/:
- source.c.ec
vendor/grammars/eiffel.tmbundle:
- source.eiffel
vendor/grammars/ejs-tmbundle:
- text.html.js
vendor/grammars/elixir-tmbundle:
- source.elixir
- text.elixir
@@ -290,6 +301,8 @@ vendor/grammars/idl.tmbundle:
- source.idl
- source.idl-dlm
- text.idl-idldoc
vendor/grammars/idris/:
- source.idris
vendor/grammars/ini.tmbundle:
- source.ini
vendor/grammars/io.tmbundle:
@@ -314,6 +327,8 @@ vendor/grammars/json.tmbundle:
- source.json
vendor/grammars/kotlin-sublime-package:
- source.Kotlin
vendor/grammars/language-apl:
- source.apl
vendor/grammars/language-babel/:
- source.js.jsx
- source.regexp.babel
@@ -326,13 +341,20 @@ vendor/grammars/language-coffee-script:
- source.litcoffee
vendor/grammars/language-crystal:
- source.crystal
- text.html.ecr
vendor/grammars/language-csharp:
- source.cake
- source.cs
- source.csx
- source.nant-build
vendor/grammars/language-csound:
- source.csound
- source.csound-document
- source.csound-score
vendor/grammars/language-gfm:
- source.gfm
vendor/grammars/language-graphql:
- source.graphql
vendor/grammars/language-hy:
- source.hy
vendor/grammars/language-inform7:
@@ -357,11 +379,20 @@ vendor/grammars/language-python:
- text.python.traceback
vendor/grammars/language-renpy:
- source.renpy
vendor/grammars/language-restructuredtext:
- text.restructuredtext
vendor/grammars/language-shellscript:
- source.shell
- text.shell-session
vendor/grammars/language-supercollider:
- source.supercollider
vendor/grammars/language-toc-wow:
- source.toc
vendor/grammars/language-turing:
- source.turing
vendor/grammars/language-wavefront:
- source.wavefront.mtl
- source.wavefront.obj
vendor/grammars/language-xbase:
- source.harbour
vendor/grammars/language-yaml:
@@ -416,6 +447,8 @@ vendor/grammars/ninja.tmbundle:
- source.ninja
vendor/grammars/nix:
- source.nix
vendor/grammars/nu.tmbundle:
- source.nu
vendor/grammars/objective-c.tmbundle:
- source.objc
- source.objc++
@@ -465,8 +498,6 @@ vendor/grammars/python-django.tmbundle:
vendor/grammars/r.tmbundle:
- source.r
- text.tex.latex.rd
vendor/grammars/restructuredtext.tmbundle:
- text.restructuredtext
vendor/grammars/ruby-haml.tmbundle:
- text.haml
vendor/grammars/ruby-slim.tmbundle:
@@ -475,8 +506,8 @@ vendor/grammars/ruby.tmbundle:
- source.ruby
- text.html.erb
vendor/grammars/sas.tmbundle:
- source.SASLog
- source.sas
- source.sas_log
vendor/grammars/sass-textmate-bundle:
- source.sass
vendor/grammars/scala.tmbundle:
@@ -501,16 +532,18 @@ vendor/grammars/standard-ml.tmbundle:
- source.ml
vendor/grammars/sublime-MuPAD:
- source.mupad
vendor/grammars/sublime-apl/:
- source.apl
vendor/grammars/sublime-aspectj/:
- source.aspectj
vendor/grammars/sublime-autoit/:
- source.autoit
vendor/grammars/sublime-befunge:
- source.befunge
vendor/grammars/sublime-bsv:
- source.bsv
vendor/grammars/sublime-cirru:
- source.cirru
vendor/grammars/sublime-clips/:
- source.clips
vendor/grammars/sublime-glsl:
- source.essl
- source.glsl

View File

@@ -56,9 +56,11 @@ module Linguist
generated_net_specflow_feature_file? ||
composer_lock? ||
node_modules? ||
npm_shrinkwrap? ||
godeps? ||
generated_by_zephir? ||
minified_files? ||
has_source_map? ||
source_map? ||
compiled_coffeescript? ||
generated_parser? ||
@@ -104,6 +106,21 @@ module Linguist
end
end
# Internal: Does the blob contain a source map reference?
#
# We assume that if one of the last 2 lines starts with a source map
# reference, then the current file was generated from other files.
#
# We use the last 2 lines because the last line might be empty.
#
# We only handle JavaScript, no CSS support yet.
#
# Returns true or false.
def has_source_map?
return false unless extname.downcase == '.js'
lines.last(2).any? { |line| line.start_with?('//# sourceMappingURL') }
end
# Internal: Is the blob a generated source map?
#
# Source Maps usually have .css.map or .js.map extensions. In case they
@@ -287,6 +304,13 @@ module Linguist
!!name.match(/node_modules\//)
end
# Internal: Is the blob a generated npm shrinkwrap file.
#
# Returns true or false.
def npm_shrinkwrap?
!!name.match(/npm-shrinkwrap\.json/)
end
# Internal: Is the blob part of Godeps/,
# which are not meant for humans in pull requests.
#
@@ -339,14 +363,14 @@ module Linguist
# on the first line.
#
# GFortran module files contain:
# GFORTRAN module version 'x' created from
# GFORTRAN module version 'x' created from
# on the first line.
#
# Return true of false
def generated_module?
return false unless extname == '.mod'
return false unless lines.count > 1
return lines[0].include?("PCBNEW-LibModule-V") ||
return lines[0].include?("PCBNEW-LibModule-V") ||
lines[0].include?("GFORTRAN module version '")
end

View File

@@ -86,6 +86,14 @@ module Linguist
end
end
disambiguate ".builds" do |data|
if /^(\s*)(<Project|<Import|<Property|<?xml|xmlns)/i.match(data)
Language["XML"]
else
Language["Text"]
end
end
disambiguate ".ch" do |data|
if /^\s*#\s*(if|ifdef|ifndef|define|command|xcommand|translate|xtranslate|include|pragma|undef)\b/i.match(data)
Language["xBase"]
@@ -179,6 +187,12 @@ module Linguist
end
end
disambiguate ".inc" do |data|
if /^<\?(?:php)?/.match(data)
Language["PHP"]
end
end
disambiguate ".l" do |data|
if /\(def(un|macro)\s/.match(data)
Language["Common Lisp"]
@@ -368,7 +382,7 @@ module Linguist
elsif /(alter module)|(language sql)|(begin( NOT)+ atomic)/i.match(data) || /signal SQLSTATE '[0-9]+'/i.match(data)
#IBM db2
Language["SQLPL"]
elsif /pragma|\$\$PLSQL_|XMLTYPE|sysdate|systimestamp|\.nextval|connect by|AUTHID (DEFINER|CURRENT_USER)/i.match(data) || /constructor\W+function/i.match(data)
elsif /\$\$PLSQL_|XMLTYPE|sysdate|systimestamp|\.nextval|connect by|AUTHID (DEFINER|CURRENT_USER)/i.match(data) || /constructor\W+function/i.match(data)
#Oracle
Language["PLSQL"]
elsif ! /begin|boolean|package|exception/i.match(data)
@@ -376,6 +390,28 @@ module Linguist
Language["SQL"]
end
end
disambiguate ".srt" do |data|
if /^(\d{2}:\d{2}:\d{2},\d{3})\s*(-->)\s*(\d{2}:\d{2}:\d{2},\d{3})$/.match(data)
Language["SubRip Text"]
end
end
disambiguate ".t" do |data|
if /^\s*%|^\s*var\s+\w+\s*:\s*\w+/.match(data)
Language["Turing"]
elsif /^\s*use\s+v6\s*;/.match(data)
Language["Perl6"]
end
end
disambiguate ".toc" do |data|
if /^## |@no-lib-strip@/.match(data)
Language["World of Warcraft Addon Data"]
elsif /^\\(contentsline|defcounter|beamer|boolfalse)/.match(data)
Language["TeX"]
end
end
disambiguate ".ts" do |data|
if data.include?("<TS ")

View File

@@ -75,6 +75,10 @@ APL:
extensions:
- .apl
- .dyalog
interpreters:
- apl
- aplx
- dyalog
tm_scope: source.apl
ace_mode: text
@@ -147,6 +151,17 @@ Alloy:
- .als
ace_mode: text
Alpine Abuild:
type: programming
group: Shell
aliases:
- abuild
- apkbuild
filenames:
- APKBUILD
tm_scope: source.shell
ace_mode: sh
Ant Build System:
type: data
tm_scope: text.xml.ant
@@ -260,7 +275,7 @@ AutoIt:
- AutoItScript
extensions:
- .au3
tm_scope: none
tm_scope: source.autoit
ace_mode: autohotkey
Awk:
@@ -446,7 +461,7 @@ CLIPS:
type: programming
extensions:
- .clp
tm_scope: none
tm_scope: source.clips
ace_mode: text
CMake:
@@ -468,6 +483,13 @@ COBOL:
- .cpy
ace_mode: cobol
COLLADA:
type: data
extensions:
- .dae
tm_scope: text.xml
ace_mode: xml
CSS:
type: markup
tm_scope: source.css
@@ -549,7 +571,7 @@ Clean:
extensions:
- .icl
- .dcl
tm_scope: none
tm_scope: source.clean
ace_mode: text
Click:
@@ -683,7 +705,7 @@ Cpp-ObjDump:
- .cxx-objdump
tm_scope: objdump.x86asm
aliases:
- c++-objdumb
- c++-objdump
ace_mode: assembly_x86
Creole:
@@ -691,7 +713,7 @@ Creole:
wrap: true
extensions:
- .creole
tm_scope: none
tm_scope: text.html.creole
ace_mode: text
Crystal:
@@ -704,6 +726,34 @@ Crystal:
interpreters:
- crystal
Csound:
type: programming
aliases:
- csound-orc
extensions:
- .orc
- .udo
tm_scope: source.csound
ace_mode: text
Csound Document:
type: programming
aliases:
- csound-csd
extensions:
- .csd
tm_scope: source.csound-document
ace_mode: text
Csound Score:
type: programming
aliases:
- csound-sco
extensions:
- .sco
tm_scope: source.csound-score
ace_mode: text
Cucumber:
type: programming
extensions:
@@ -772,7 +822,7 @@ DM:
- .dm
aliases:
- byond
tm_scope: source.c++
tm_scope: source.dm
ace_mode: c_cpp
DNS Zone:
@@ -874,6 +924,15 @@ ECLiPSe:
tm_scope: source.prolog.eclipse
ace_mode: prolog
EJS:
type: markup
color: "#a91e50"
group: HTML
extensions:
- .ejs
tm_scope: text.html.js
ace_mode: ejs
Eagle:
type: markup
color: "#814C05"
@@ -948,6 +1007,7 @@ Erlang:
color: "#B83998"
extensions:
- .erl
- .app.src
- .es
- .escript
- .hrl
@@ -1023,7 +1083,7 @@ Fantom:
color: "#dbded5"
extensions:
- .fan
tm_scope: source.fan
tm_scope: none
ace_mode: text
Filterscript:
@@ -1107,7 +1167,7 @@ GAS:
extensions:
- .s
- .ms
tm_scope: none
tm_scope: source.assembly
ace_mode: assembly_x86
GDScript:
@@ -1125,6 +1185,7 @@ GLSL:
- .frag
- .frg
- .fs
- .fsh
- .fshader
- .geo
- .geom
@@ -1133,6 +1194,7 @@ GLSL:
- .shader
- .vert
- .vrx
- .vsh
- .vshader
ace_mode: glsl
@@ -1262,6 +1324,14 @@ Graph Modeling Language:
tm_scope: none
ace_mode: text
GraphQL:
type: data
extensions:
- .graphql
color: "#E535AB"
tm_scope: source.graphql
ace_mode: text
Graphviz (DOT):
type: data
tm_scope: source.dot
@@ -1374,6 +1444,16 @@ HTML+Django:
- htmldjango
ace_mode: django
HTML+ECR:
type: markup
tm_scope: text.html.ecr
group: HTML
aliases:
- ecr
extensions:
- .ecr
ace_mode: text
HTML+EEX:
type: markup
tm_scope: text.html.elixir
@@ -1532,7 +1612,7 @@ Idris:
- .idr
- .lidr
ace_mode: text
tm_scope: none
tm_scope: source.idris
Inform 7:
type: programming
@@ -1590,6 +1670,8 @@ J:
color: "#9EEDFF"
extensions:
- .ijs
interpreters:
- jconsole
tm_scope: source.j
ace_mode: text
@@ -1612,11 +1694,13 @@ JSON:
extensions:
- .json
- .geojson
- .lock
- .JSON-tmLanguage
- .topojson
filenames:
- .arcconfig
- .jshintrc
- composer.lock
- mcmod.info
JSON5:
type: data
@@ -1654,6 +1738,7 @@ Jade:
type: markup
extensions:
- .jade
- .pug
tm_scope: text.jade
ace_mode: jade
@@ -2068,14 +2153,19 @@ Makefile:
- .mak
- .d
- .mk
- .mkfile
filenames:
- BSDmakefile
- GNUmakefile
- Kbuild
- Makefile
- Makefile.am
- Makefile.frag
- Makefile.in
- Makefile.inc
- makefile
- makefile.sco
- mkfile
interpreters:
- make
ace_mode: makefile
@@ -2386,7 +2476,7 @@ Nu:
- .nu
filenames:
- Nukefile
tm_scope: source.scheme
tm_scope: source.nu
ace_mode: scheme
interpreters:
- nush
@@ -2507,6 +2597,16 @@ OpenEdge ABL:
tm_scope: source.abl
ace_mode: text
OpenRC runscript:
type: programming
group: Shell
aliases:
- openrc
interpreters:
- openrc-run
tm_scope: source.shell
ace_mode: sh
OpenSCAD:
type: programming
extensions:
@@ -3236,6 +3336,14 @@ SQLPL:
- .sql
- .db2
SRecode Template:
type: markup
color: "#348a34"
tm_scope: source.lisp
ace_mode: lisp
extensions:
- .srt
STON:
type: data
group: Smalltalk
@@ -3351,6 +3459,13 @@ Shell:
- .tmux
- .tool
- .zsh
filenames:
- .bash_history
- .bash_logout
- .bash_profile
- .bashrc
- PKGBUILD
- gradlew
interpreters:
- bash
- rc
@@ -3478,6 +3593,13 @@ Stylus:
tm_scope: source.stylus
ace_mode: stylus
SubRip Text:
type: data
extensions:
- .srt
ace_mode: text
tm_scope: text.srt
SuperCollider:
type: programming
color: "#46390b"
@@ -3506,6 +3628,13 @@ SystemVerilog:
- .vh
ace_mode: verilog
TLA:
type: programming
extensions:
- .tla
tm_scope: source.tla
ace_mode: text
TOML:
type: data
extensions:
@@ -3578,7 +3707,6 @@ Terra:
- .t
color: "#00004c"
ace_mode: lua
group: Lua
interpreters:
- lua
@@ -3598,6 +3726,7 @@ Text:
- INSTALL
- LICENSE
- NEWS
- README.1ST
- README.me
- click.me
- delete.me
@@ -3624,11 +3753,11 @@ Thrift:
Turing:
type: programming
color: "#45f715"
color: "#cf142b"
extensions:
- .t
- .tu
tm_scope: none
tm_scope: source.turing
ace_mode: text
Turtle:
@@ -3794,6 +3923,20 @@ Vue:
tm_scope: text.html.vue
ace_mode: html
Wavefront Material:
type: data
extensions:
- .mtl
tm_scope: source.wavefront.mtl
ace_mode: text
Wavefront Object:
type: data
extensions:
- .obj
tm_scope: source.wavefront.obj
ace_mode: text
Web Ontology Language:
type: markup
color: "#9cc9dd"
@@ -3809,6 +3952,14 @@ WebIDL:
tm_scope: source.webidl
ace_mode: text
World of Warcraft Addon Data:
type: data
color: "#e0b330"
extensions:
- .toc
tm_scope: source.toc
ace_mode: text
X10:
type: programming
aliases:
@@ -3838,6 +3989,7 @@ XML:
- .xml
- .ant
- .axml
- .builds
- .ccxml
- .clixml
- .cproject
@@ -3869,6 +4021,7 @@ XML:
- .nuspec
- .odd
- .osm
- .pkgproj
- .plist
- .pluginspec
- .props
@@ -3876,8 +4029,10 @@ XML:
- .psc1
- .pt
- .rdf
- .resx
- .rss
- .scxml
- .sfproj
- .srdf
- .storyboard
- .stTheme
@@ -4069,6 +4224,8 @@ edn:
fish:
type: programming
group: Shell
interpreters:
- fish
extensions:
- .fish
tm_scope: source.fish

View File

@@ -21,7 +21,7 @@ module Linguist
def self.cache
@cache ||= begin
serializer = defined?(Yajl) ? Yajl : YAML
serializer.load(File.read(PATH))
serializer.load(File.read(PATH, encoding: 'utf-8'))
end
end

View File

@@ -15,6 +15,10 @@ module Linguist
MODELINES = [EMACS_MODELINE, VIM_MODELINE_1, VIM_MODELINE_2]
# Scope of the search for modelines
# Number of lines to check at the beginning and at the end of the file
SEARCH_SCOPE = 5
# Public: Detects language based on Vim and Emacs modelines
#
# blob - An object that quacks like a blob.
@@ -26,7 +30,9 @@ module Linguist
# Returns an Array with one Language if the blob has a Vim or Emacs modeline
# that matches a Language name or alias. Returns an empty array if no match.
def self.call(blob, _ = nil)
Array(Language.find_by_alias(modeline(blob.data)))
header = blob.lines.first(SEARCH_SCOPE).join("\n")
footer = blob.lines.last(SEARCH_SCOPE).join("\n")
Array(Language.find_by_alias(modeline(header + footer)))
end
# Public: Get the modeline from the first n-lines of the file

View File

@@ -153,6 +153,9 @@
- (^|/)tiny_mce([^.]*)\.js$
- (^|/)tiny_mce/(langs|plugins|themes|utils)
# Ace Editor
- (^|/)ace-builds/
# MathJax
- (^|/)MathJax/
@@ -190,6 +193,7 @@
# django
- (^|/)admin_media/
- (^|/)env/
# Fabric
- ^fabfile\.py$

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "4.8.2"
VERSION = "4.8.7"
end

7
samples/APL/hashbang Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/local/bin/apl --script
NEWLINE ← ⎕UCS 10
HEADERS ← 'Content-Type: text/plain', NEWLINE
HEADERS
⍝ ⎕←HEADERS
⍝ ⍕⎕TS
)OFF

View File

@@ -0,0 +1,70 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=abuild
pkgver=2.27.0
_ver=${pkgver%_git*}
pkgrel=0
pkgdesc="Script to build Alpine Packages"
url="http://git.alpinelinux.org/cgit/abuild/"
arch="all"
license="GPL2"
depends="fakeroot sudo pax-utils openssl apk-tools>=2.0.7-r1 libc-utils
attr tar pkgconf patch"
if [ "$CBUILD" = "$CHOST" ]; then
depends="$depends curl"
fi
makedepends_build="pkgconfig"
makedepends_host="openssl-dev"
makedepends="$makedepends_host $makedepends_build"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="apkbuild-cpan:cpan apkbuild-gem-resolver:gems"
options="suid"
pkggroups="abuild"
source="http://dev.alpinelinux.org/archive/abuild/abuild-$_ver.tar.xz
"
_builddir="$srcdir/$pkgname-$_ver"
prepare() {
cd "$_builddir"
for i in $source; do
case $i in
*.patch)
msg "Applying $i"
patch -p1 -i "$srcdir"/$i || return 1
;;
esac
done
sed -i -e "/^CHOST=/s/=.*/=$CHOST/" abuild.conf
}
build() {
cd "$_builddir"
make || return 1
}
package() {
cd "$_builddir"
make install DESTDIR="$pkgdir" || return 1
install -m 644 abuild.conf "$pkgdir"/etc/abuild.conf || return 1
install -d -m 775 -g abuild "$pkgdir"/var/cache/distfiles || return 1
}
cpan() {
pkgdesc="Script to generate perl APKBUILD from CPAN"
depends="perl perl-libwww perl-json"
arch="noarch"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/apkbuild-cpan "$subpkgdir"/usr/bin/
}
gems() {
pkgdesc="APKBUILD dependency resolver for RubyGems"
depends="ruby ruby-augeas"
arch="noarch"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/apkbuild-gem-resolver "$subpkgdir"/usr/bin/
}
md5sums="c67e4c971c54b4d550e16db3ba331f96 abuild-2.27.0.tar.xz"
sha256sums="c8db017e3dd168edb20ceeb91971535cf66b8c95f29d3288f88ac755bffc60e5 abuild-2.27.0.tar.xz"
sha512sums="98e1da4e47f3ab68700b3bc992c83e103f770f3196e433788ee74145f57cd33e5239c87f0a7a15f7266840d5bad893fc8c0d4c826d663df53deaee2678c56984 abuild-2.27.0.tar.xz"

397
samples/C/main.c Normal file
View File

@@ -0,0 +1,397 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/runtime/runtime-utils.h"
#include "src/arguments.h"
#include "src/compiler.h"
#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/full-codegen/full-codegen.h"
#include "src/isolate-inl.h"
#include "src/messages.h"
#include "src/v8threads.h"
#include "src/vm-state-inl.h"
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_CompileLazy) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
#ifdef DEBUG
if (FLAG_trace_lazy && !function->shared()->is_compiled()) {
PrintF("[unoptimized: ");
function->PrintName();
PrintF("]\n");
}
#endif
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) {
return isolate->heap()->exception();
}
DCHECK(function->is_compiled());
return function->code();
}
RUNTIME_FUNCTION(Runtime_CompileBaseline) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (!Compiler::CompileBaseline(function)) {
return isolate->heap()->exception();
}
DCHECK(function->is_compiled());
return function->code();
}
RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (!Compiler::CompileOptimized(function, Compiler::CONCURRENT)) {
return isolate->heap()->exception();
}
DCHECK(function->is_compiled());
return function->code();
}
RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (!Compiler::CompileOptimized(function, Compiler::NOT_CONCURRENT)) {
return isolate->heap()->exception();
}
DCHECK(function->is_compiled());
return function->code();
}
RUNTIME_FUNCTION(Runtime_NotifyStubFailure) {
HandleScope scope(isolate);
DCHECK(args.length() == 0);
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
DCHECK(AllowHeapAllocation::IsAllowed());
delete deoptimizer;
return isolate->heap()->undefined_value();
}
class ActivationsFinder : public ThreadVisitor {
public:
Code* code_;
bool has_code_activations_;
explicit ActivationsFinder(Code* code)
: code_(code), has_code_activations_(false) {}
void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
JavaScriptFrameIterator it(isolate, top);
VisitFrames(&it);
}
void VisitFrames(JavaScriptFrameIterator* it) {
for (; !it->done(); it->Advance()) {
JavaScriptFrame* frame = it->frame();
if (code_->contains(frame->pc())) has_code_activations_ = true;
}
}
};
RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_SMI_ARG_CHECKED(type_arg, 0);
Deoptimizer::BailoutType type =
static_cast<Deoptimizer::BailoutType>(type_arg);
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
DCHECK(AllowHeapAllocation::IsAllowed());
TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
TRACE_EVENT0("v8", "V8.DeoptimizeCode");
Handle<JSFunction> function = deoptimizer->function();
Handle<Code> optimized_code = deoptimizer->compiled_code();
DCHECK(optimized_code->kind() == Code::OPTIMIZED_FUNCTION);
DCHECK(type == deoptimizer->bailout_type());
// Make sure to materialize objects before causing any allocation.
JavaScriptFrameIterator it(isolate);
deoptimizer->MaterializeHeapObjects(&it);
delete deoptimizer;
// Ensure the context register is updated for materialized objects.
JavaScriptFrameIterator top_it(isolate);
JavaScriptFrame* top_frame = top_it.frame();
isolate->set_context(Context::cast(top_frame->context()));
if (type == Deoptimizer::LAZY) {
return isolate->heap()->undefined_value();
}
// Search for other activations of the same optimized code.
// At this point {it} is at the topmost frame of all the frames materialized
// by the deoptimizer. Note that this frame does not necessarily represent
// an activation of {function} because of potential inlined tail-calls.
ActivationsFinder activations_finder(*optimized_code);
activations_finder.VisitFrames(&it);
isolate->thread_manager()->IterateArchivedThreads(&activations_finder);
if (!activations_finder.has_code_activations_) {
if (function->code() == *optimized_code) {
if (FLAG_trace_deopt) {
PrintF("[removing optimized code for: ");
function->PrintName();
PrintF("]\n");
}
function->ReplaceCode(function->shared()->code());
}
// Evict optimized code for this function from the cache so that it
// doesn't get used for new closures.
function->shared()->EvictFromOptimizedCodeMap(*optimized_code, "notify deoptimized");
} else {
// TODO(titzer): we should probably do DeoptimizeCodeList(code)
// unconditionally if the code is not already marked for deoptimization.
// If there is an index by shared function info, all the better.
Deoptimizer::DeoptimizeFunction(*function);
}
return isolate->heap()->undefined_value();
}
static bool IsSuitableForOnStackReplacement(
Isolate* isolate,
Handle<JSFunction> function
) {
// Keep track of whether we've succeeded in optimizing.
if (function->shared()->optimization_disabled()) return false;
// If we are trying to do OSR when there are already optimized
// activations of the function, it means (a) the function is directly or
// indirectly recursive and (b) an optimized invocation has been
// deoptimized so that we are currently in an unoptimized activation.
// Check for optimized activations of this function.
for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
JavaScriptFrame* frame = it.frame();
if (frame->is_optimized() && frame->function() == *function) return false;
}
return true;
}
RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
Handle<Code> caller_code(function->shared()->code());
// We're not prepared to handle a function with arguments object.
DCHECK(!function->shared()->uses_arguments());
RUNTIME_ASSERT(FLAG_use_osr);
// Passing the PC in the javascript frame from the caller directly is
// not GC safe, so we walk the stack to get it.
JavaScriptFrameIterator it(isolate);
JavaScriptFrame* frame = it.frame();
if (!caller_code->contains(frame->pc())) {
// Code on the stack may not be the code object referenced by the shared
// function info. It may have been replaced to include deoptimization data.
caller_code = Handle<Code>(frame->LookupCode());
}
uint32_t pc_offset =
static_cast<uint32_t>(frame->pc() - caller_code->instruction_start());
#ifdef DEBUG
DCHECK_EQ(frame->function(), *function);
DCHECK_EQ(frame->LookupCode(), *caller_code);
DCHECK(caller_code->contains(frame->pc()));
#endif // DEBUG
BailoutId ast_id = caller_code->TranslatePcOffsetToAstId(pc_offset);
DCHECK(!ast_id.IsNone());
MaybeHandle<Code> maybe_result;
if (IsSuitableForOnStackReplacement(isolate, function)) {
if (FLAG_trace_osr) {
PrintF("[OSR - Compiling: ");
function->PrintName();
PrintF(" at -*- scheme -*- %d]\n", ast_id.ToInt());
}
maybe_result = Compiler::GetOptimizedCodeForOSR(function, ast_id, frame);
}
// Revert the patched back edge table, regardless of whether OSR succeeds.
BackEdgeTable::Revert(isolate, *caller_code);
// Check whether we ended up with usable optimized code.
Handle<Code> result;
if (maybe_result.ToHandle(&result)
&& result->kind() == Code::OPTIMIZED_FUNCTION) {
DeoptimizationInputData* data =
DeoptimizationInputData::cast(result->deoptimization_data());
if (data->OsrPcOffset()->value() >= 0) {
DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id);
if (FLAG_trace_osr) {
PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n",
ast_id.ToInt(), data->OsrPcOffset()->value());
}
// TODO(titzer): this is a massive hack to make the deopt counts
// match. Fix heuristics for reenabling optimizations!
function->shared()->increment_deopt_count();
if (result->is_turbofanned()) {
// TurboFanned OSR code cannot be installed into the function.
// But the function is obviously hot, so optimize it next time.
function->ReplaceCode(
isolate->builtins()->builtin(Builtins::kCompileOptimized));
} else {
// Crankshafted OSR code can be installed into the function.
function->ReplaceCode(*result);
}
return *result;
}
}
// Failed.
if (FLAG_trace_osr) {
PrintF("[OSR - Failed: ");
function->PrintName();
PrintF(" at AST id %d]\n", ast_id.ToInt());
}
if (!function->IsOptimized()) {
function->ReplaceCode(function->shared()->code());
}
return NULL;
}
RUNTIME_FUNCTION(Runtime_TryInstallOptimizedCode) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
// First check if this is a real stack overflow.
StackLimitCheck check(isolate);
if (check.JsHasOverflowed()) {
SealHandleScope shs(isolate);
return isolate->StackOverflow();
}
isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions();
return (function->IsOptimized())
? function->code()
: function->shared()->code();
}
bool CodeGenerationFromStringsAllowed(
Isolate* isolate,
Handle<Context> context
){
DCHECK(context->allow_code_gen_from_strings()->IsFalse());
// Check with callback if set.
AllowCodeGenerationFromStringsCallback callback =
isolate->allow_code_gen_callback();
if (callback == NULL) {
// No callback set and code generation disallowed.
return false;
} else {
// Callback set. Let it decide if code generation is allowed.
VMState<EXTERNAL> state(isolate);
return callback(v8::Utils::ToLocal(context));
}
}
static Object* CompileGlobalEval(
Isolate* isolate,
Handle<String> source,
Handle<SharedFunctionInfo> outer_info,
LanguageMode language_mode,
int eval_scope_position,
int eval_position
){
Handle<Context> context = Handle<Context>(isolate->context());
Handle<Context> native_context = Handle<Context>(context->native_context());
// Check if native context allows code generation from
// strings. Throw an exception if it doesn't.
if (native_context->allow_code_gen_from_strings()->IsFalse() &&
!CodeGenerationFromStringsAllowed(isolate, native_context)) {
Handle<Object> error_message =
native_context->ErrorMessageForCodeGenerationFromStrings();
Handle<Object> error;
MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError(
MessageTemplate::kCodeGenFromStrings, error_message);
if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
return isolate->heap()->exception();
}
// Deal with a normal eval call with a string argument. Compile it
// and return the compiled function bound in the local context.
static const ParseRestriction restriction = NO_PARSE_RESTRICTION;
Handle<JSFunction> compiled;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, compiled,
Compiler::GetFunctionFromEval(
source, outer_info, context, language_mode,
restriction, eval_scope_position, eval_position
),
isolate->heap()->exception()
);
return *compiled;
}
RUNTIME_FUNCTION(Runtime_ResolvePossiblyDirectEval) {
HandleScope scope(isolate);
DCHECK(args.length() == 6);
Handle<Object> callee = args.at<Object>(0);
// If "eval" didn't refer to the original GlobalEval, it's not a
// direct call to eval.
// (And even if it is, but the first argument isn't a string, just let
// execution default to an indirect call to eval, which will also return
// the first argument without doing anything).
if (*callee != isolate->native_context()->global_eval_fun() || !args[1]->IsString()) {
return *callee;
}
DCHECK(args[3]->IsSmi());
DCHECK(is_valid_language_mode(args.smi_at(3)));
LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
DCHECK(args[4]->IsSmi());
Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), isolate);
return CompileGlobalEval(
isolate,
args.at<String>(1),
outer_info,
language_mode,
args.smi_at(4),
args.smi_at(5)
);
}
} // namespace internal
} // namespace v8
/* vim: set shiftwidth=4 softtabstop=0 cindent cinoptions={1s: */

View File

@@ -0,0 +1,21 @@
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 44100
ksmps = 1
nchnls = 2
; pvanal -n 512 -w 8 allglass1-L.wav allglass1-L.pvc
; pvanal -n 512 -w 8 allglass1-R.wav allglass1-R.pvc
instr 1
ktime line 0, p3, 17.5018
arL pvoc ktime, 1, "allglass1-L.pvc"
arR pvoc ktime, 1, "allglass1-R.pvc"
out arL, arR
endin
</CsInstruments>
<CsScore>
i 1 0 70.0073
e
</CsScore>
</CsoundSynthesizer>

View File

@@ -0,0 +1,34 @@
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 44100
ksmps = 1
nchnls = 2
; pvanal -n 1024 -w 2 partA-L.wav partA-L.pvc
; pvanal -n 1024 -w 2 partA-R.wav partA-R.pvc
; pvanal -n 1024 -w 2 partB.wav partB.pvc
instr 1
iscale = 1
ktimpnt1 line 0, iscale*(82196/44100), 82196/44100
ktimpnt2 linseg 0, iscale*1.25, 0, iscale*(103518/44100), 103518/44100
kfreqscale linseg 1, iscale*0.5, 1, iscale*1.6, 0.8
kfreqinterpL linseg 0, iscale*0.25, 0, iscale*1.6, 1
kampinterpL linseg 0, iscale*0.25, 0, iscale*1.6, 1
kfreqinterpR linseg 0, iscale*0.5, 0, iscale*1.2, 1
kampinterpR linseg 0, iscale*0.5, 0, iscale*1.2, 1
pvbufread ktimpnt1, "partB.pvc"
apvcL pvinterp ktimpnt2, 1, "partA-L.pvc", kfreqscale, 1, 1, 1, 1-kfreqinterpL, 1-kampinterpL
pvbufread ktimpnt1, "partB.pvc"
apvcR pvinterp ktimpnt2, 1, "partA-R.pvc", kfreqscale, 1, 1, 1, 1-kfreqinterpR, 1-kampinterpR
outs apvcL*0.8, apvcR*0.8
endin
</CsInstruments>
<CsScore>
i 1 0 7
e
</CsScore>
</CsoundSynthesizer>

View File

@@ -0,0 +1,253 @@
<CsoundSynthesizer>
<CsInstruments>
// Csound single-line comments can be preceded by a pair of forward slashes...
; ...or a semicolon.
/* Block comments begin with /* and end with */
// Orchestras begin with a header of audio parameters.
nchnls = 1
nchnls_i = 1
sr = 44100
0dbfs = 1
ksmps = 10
// The control rate kr = sr / ksmps can be omitted when the number of audio
// samples in a control period (ksmps) is set, but kr may appear in older
// orchestras.
kr = 4410
// Orchestras contain instruments. These begin with the keyword instr followed
// by a comma-separated list of numbers or names of the instrument. Instruments
// end at the endin keyword and cannot be nested.
instr 1, N_a_M_e_, +Name
// Instruments contain statements. Here is a typical statement:
aSignal oscil 0dbfs, 440, 1
// Statements are terminated with a newline (possibly preceded by a comment).
// To write a statement on several lines, precede the newline with a
// backslash.
prints \
"hello, world\n";comment
// Csound 6 introduced function syntax for opcodes with one or zero outputs.
// The oscil statement above is the same as
aSignal = oscil(0dbfs, 440, 1)
// Instruments can contain control structures.
kNote = p3
if (kNote == 0) then
kFrequency = 220
elseif kNote == 1 then // Parentheses around binary expressions are optional.
kFrequency = 440
endif
// Csound 6 introduced looping structures.
iIndex = 0
while iIndex < 5 do
print iIndex
iIndex += 1
od
iIndex = 0
until iIndex >= 5 do
print iIndex
iIndex += 1
enduntil
// Both kinds of loops can be terminated by either od or enduntil.
// Single-line strings are enclosed in double-quotes.
prints "string\\\r\n\t\""
// Multi-line strings are enclosed in pairs of curly braces.
prints {{
hello,
world
}}
// Instruments often end with a statement containing an output opcode.
outc aSignal
endin
// Orchestras can also contain user-defined opcodes (UDOs). Here is an
// oscillator with one audio-rate output and two control-rate inputs:
opcode anOscillator, a, kk
kAmplitude, kFrequency xin
aSignal vco2 kAmplitude, kFrequency
xout aSignal
endop
instr TestOscillator
outc(anOscillator(0dbfs, 110))
endin
// Python can be executed in Csound
// <https://csound.github.io/docs/manual/pyrun.html>. So can Lua
// <https://csound.github.io/docs/manual/lua.html>.
pyruni {{
import random
pool = [(1 + i / 10.0) ** 1.2 for i in range(100)]
def get_number_from_pool(n, p):
if random.random() < p:
i = int(random.random() * len(pool))
pool[i] = n;
return random.choice(pool)
}}
// The Csound preprocessor supports conditional compilation and including files.
#ifdef DEBUG
#undef DEBUG
#include "filename.orc"
#endif
// The preprocessor also supports object- and function-like macros. This is an
// object-like macro that defines a number:
#define A_HZ #440#
// This is a function-like macro:
#define OSCIL_MACRO(VOLUME'FREQUENCY'TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
// Bodies of macros are enclosed in # and can contain newlines. The arguments of
// function-like macros are separated by single-quotes. Uses of macros are
// prefixed with a dollar sign.
instr TestMacro
aSignal $OSCIL_MACRO(1'$A_HZ'1)
// Not unlike PHP, macros expand in double-quoted strings.
prints "The frequency of the oscillator is $A_HZ Hz.\n"
out aSignal
endin
// Here are other things to note about Csound.
// There are two bitwise NOT operators, ~ and ¬ (U+00AC). The latter is common
// on keyboards in the United Kingdom
// <https://en.wikipedia.org/wiki/British_and_American_keyboards>.
instr TestBitwiseNOT
print ~42
print ¬42
endin
// Csound uses # for bitwise XOR, which the Csound manual calls bitwise
// non-equivalence <https://csound.github.io/docs/manual/opnonequiv.html>.
instr TestBitwiseXOR
print 0 # 0
print 0 # 1
print 1 # 0
print 1 # 1
endin
// Loops and if-then statements are relatively recent additions to Csound. There
// are many flow-control opcodes that involve goto and labels.
instr TestGoto
// This...
if p3 > 0 goto if_label
goto else_label
if_label:
prints "if branch\n"
goto endif_label
else_label:
prints "else branch\n"
endif_label:
// ...is the same as this.
if p3 > 0 then
prints "if branch\n"
else
prints "else branch\n"
endif
// This...
iIndex = 0
loop_label:
print iIndex
iIndex += 1
if iIndex < 10 goto loop_label
// ...is the same as this...
iIndex = 0
loop_lt_label:
print iIndex
loop_lt iIndex, 1, 10, loop_lt_label
// ...and this.
iIndex = 0
while iIndex < 10 do
print iIndex
iIndex += 1
od
endin
// The prints and printks opcodes
// <https://github.com/csound/csound/blob/develop/OOps/ugrw1.c#L831>, arguably
// the primary methods of logging output, treat certain sequences of characters
// different from printf in C.
instr TestPrints
// ^ prints an ESCAPE character (U+001B), not a CIRCUMFLEX ACCENT character
// (U+005E). ^^ prints a CIRCUMFLEX ACCENT.
prints "^^\n"
// ~ prints an ESCAPE character (U+001B) followed by a [, not a TILDE
// character (U+007E). ~~ prints a TILDE.
prints "~~\n"
// \A, \B, \N, \R, and \T correspond to the escaped lowercase characters (that
// is, BELL (U+0007), BACKSPACE (U+0008), new line (U+000A), CARRIAGE RETURN
// (U+000D), and tab (U+0009)).
prints "\T\R\N"
// %n, %r, and %t are the same as \n, \r, and \t, as are %N, %R, and %T.
prints "%t%r%n"
// %! prints a semicolon. This is a hold-over from old versions of Csound that
// allowed comments to begin in strings.
prints "; %!\n"
endin
// The arguments of function-like macros can be separated by # instead of '.
// These two lines define the same macro.
#define OSCIL_MACRO(VOLUME'FREQUENCY'TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
#define OSCIL_MACRO(VOLUME#FREQUENCY#TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
// Uses of macros can optionally be suffixed with a period.
instr TestMacroPeriodSuffix
aSignal $OSCIL_MACRO.(1'$A_HZ'1)
prints "The frequency of the oscillator is $A_HZ.Hz.\n"
out aSignal
endin
// Csound has @ and @@ operator-like macros that, when followed by a literal
// non-negative integer, expand to the next power of 2 and the next power of 2
// plus 1:
// @x = 2^(ceil(log2(x + 1))), x >= 0
// @@0 = 2
// @@x = 2^(ceil(log2(x))) + 1, x > 0
instr TestAt
prints "%d %2d %2d\n", 0, @0, @@0
prints "%d %2d %2d\n", 1, @1, @@1
prints "%d %2d %2d\n", 2, @2, @@2
prints "%d %2d %2d\n", 3, @3, @@3
prints "%d %2d %2d\n", 4, @4, @@4
prints "%d %2d %2d\n", 5, @5, @@5
prints "%d %2d %2d\n", 6, @6, @@6
prints "%d %2d %2d\n", 7, @7, @@7
prints "%d %2d %2d\n", 8, @8, @@8
prints "%d %2d %2d\n", 9, @9, @@9
endin
// Including newlines in macros can lead to confusing code.
instr MacroAbuse
if 1 == 1 then
prints "on\n"
#define FOO#
BAR
#endif // This ends the if block. It is not a preprocessor directive.
endin
</CsInstruments>
<CsScore>
f 1 0 16384 10 1
i "N_a_M_e_" 0 2
i "TestOscillator" 2 2
i "TestBitwiseNOT" 0 1
i "TestBitwiseXOR" 0 1
i "TestGoto" 0 1
i "TestMacroPeriodSuffix" 4 1
i "TestAt" 0 1
i "MacroAbuse" 0 1
e
</CsScore>
</CsoundSynthesizer>

View File

@@ -0,0 +1,2 @@
i 1 0 70.0073
e

View File

@@ -0,0 +1,2 @@
i 1 0 7
e

View File

@@ -0,0 +1,10 @@
f 1 0 16384 10 1
i "N_a_M_e_" 0 2
i "TestOscillator" 2 2
i "TestBitwiseNOT" 0 1
i "TestBitwiseXOR" 0 1
i "TestGoto" 0 1
i "TestMacroPeriodSuffix" 4 1
i "TestAt" 0 1
i "MacroAbuse" 0 1
e

13
samples/Csound/allglass.orc Executable file
View File

@@ -0,0 +1,13 @@
sr = 44100
kr = 44100
ksmps = 1
nchnls = 2
; pvanal -n 512 -w 8 allglass1-L.wav allglass1-L.pvc
; pvanal -n 512 -w 8 allglass1-R.wav allglass1-R.pvc
instr 1
ktime line 0, p3, 17.5018
arL pvoc ktime, 1, "allglass1-L.pvc"
arR pvoc ktime, 1, "allglass1-R.pvc"
out arL, arR
endin

26
samples/Csound/interp.orc Executable file
View File

@@ -0,0 +1,26 @@
sr = 44100
kr = 44100
ksmps = 1
nchnls = 2
; pvanal -n 1024 -w 2 partA-L.wav partA-L.pvc
; pvanal -n 1024 -w 2 partA-R.wav partA-R.pvc
; pvanal -n 1024 -w 2 partB.wav partB.pvc
instr 1
iscale = 1
ktimpnt1 line 0, iscale*(82196/44100), 82196/44100
ktimpnt2 linseg 0, iscale*1.25, 0, iscale*(103518/44100), 103518/44100
kfreqscale linseg 1, iscale*0.5, 1, iscale*1.6, 0.8
kfreqinterpL linseg 0, iscale*0.25, 0, iscale*1.6, 1
kampinterpL linseg 0, iscale*0.25, 0, iscale*1.6, 1
kfreqinterpR linseg 0, iscale*0.5, 0, iscale*1.2, 1
kampinterpR linseg 0, iscale*0.5, 0, iscale*1.2, 1
pvbufread ktimpnt1, "partB.pvc"
apvcL pvinterp ktimpnt2, 1, "partA-L.pvc", kfreqscale, 1, 1, 1, 1-kfreqinterpL, 1-kampinterpL
pvbufread ktimpnt1, "partB.pvc"
apvcR pvinterp ktimpnt2, 1, "partA-R.pvc", kfreqscale, 1, 1, 1, 1-kfreqinterpR, 1-kampinterpR
outs apvcL*0.8, apvcR*0.8
endin

250
samples/Csound/test.orc Normal file
View File

@@ -0,0 +1,250 @@
// Csound single-line comments can be preceded by a pair of forward slashes...
; ...or a semicolon.
/* Block comments begin with /* and end with */
// Orchestras begin with a header of audio parameters.
nchnls = 1
nchnls_i = 1
sr = 44100
0dbfs = 1
ksmps = 10
// The control rate kr = sr / ksmps can be omitted when the number of audio
// samples in a control period (ksmps) is set, but kr may appear in older
// orchestras.
kr = 4410
// Orchestras contain instruments. These begin with the keyword instr followed
// by a comma-separated list of numbers or names of the instrument. Instruments
// end at the endin keyword and cannot be nested.
instr 1, N_a_M_e_, +Name
// Instruments contain statements. Here is a typical statement:
aSignal oscil 0dbfs, 440, 1
// Statements are terminated with a newline (possibly preceded by a comment).
// To write a statement on several lines, precede the newline with a
// backslash.
prints \
"hello, world\n";comment
// Csound 6 introduced function syntax for opcodes with one or zero outputs.
// The oscil statement above is the same as
aSignal = oscil(0dbfs, 440, 1)
// Instruments can contain control structures.
kNote = p3
if (kNote == 0) then
kFrequency = 220
elseif kNote == 1 then // Parentheses around binary expressions are optional.
kFrequency = 440
endif
// Csound 6 introduced looping structures.
iIndex = 0
while iIndex < 5 do
print iIndex
iIndex += 1
od
iIndex = 0
until iIndex >= 5 do
print iIndex
iIndex += 1
enduntil
// Both kinds of loops can be terminated by either od or enduntil.
// Single-line strings are enclosed in double-quotes.
prints "string\\\r\n\t\""
// Multi-line strings are enclosed in pairs of curly braces.
prints {{
hello,
world
}}
// Instruments often end with a statement containing an output opcode.
outc aSignal
endin
// Orchestras can also contain user-defined opcodes (UDOs). Here is an
// oscillator with one audio-rate output and two control-rate inputs:
opcode anOscillator, a, kk
kAmplitude, kFrequency xin
aSignal vco2 kAmplitude, kFrequency
xout aSignal
endop
instr TestOscillator
outc(anOscillator(0dbfs, 110))
endin
// Python can be executed in Csound
// <https://csound.github.io/docs/manual/pyrun.html>. So can Lua
// <https://csound.github.io/docs/manual/lua.html>.
pyruni {{
import random
pool = [(1 + i / 10.0) ** 1.2 for i in range(100)]
def get_number_from_pool(n, p):
if random.random() < p:
i = int(random.random() * len(pool))
pool[i] = n;
return random.choice(pool)
}}
// The Csound preprocessor supports conditional compilation and including files.
#ifdef DEBUG
#undef DEBUG
#include "filename.orc"
#endif
// The preprocessor also supports object- and function-like macros. This is an
// object-like macro that defines a number:
#define A_HZ #440#
// This is a function-like macro:
#define OSCIL_MACRO(VOLUME'FREQUENCY'TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
// Bodies of macros are enclosed in # and can contain newlines. The arguments of
// function-like macros are separated by single-quotes. Uses of macros are
// prefixed with a dollar sign.
instr TestMacro
aSignal $OSCIL_MACRO(1'$A_HZ'1)
// Not unlike PHP, macros expand in double-quoted strings.
prints "The frequency of the oscillator is $A_HZ Hz.\n"
out aSignal
endin
// Here are other things to note about Csound.
// There are two bitwise NOT operators, ~ and ¬ (U+00AC). The latter is common
// on keyboards in the United Kingdom
// <https://en.wikipedia.org/wiki/British_and_American_keyboards>.
instr TestBitwiseNOT
print ~42
print ¬42
endin
// Csound uses # for bitwise XOR, which the Csound manual calls bitwise
// non-equivalence <https://csound.github.io/docs/manual/opnonequiv.html>.
instr TestBitwiseXOR
print 0 # 0
print 0 # 1
print 1 # 0
print 1 # 1
endin
// Loops and if-then statements are relatively recent additions to Csound. There
// are many flow-control opcodes that involve goto and labels.
instr TestGoto
// This...
if p3 > 0 goto if_label
goto else_label
if_label:
prints "if branch\n"
goto endif_label
else_label:
prints "else branch\n"
endif_label:
// ...is the same as this.
if p3 > 0 then
prints "if branch\n"
else
prints "else branch\n"
endif
// This...
iIndex = 0
loop_label:
print iIndex
iIndex += 1
if iIndex < 10 goto loop_label
// ...is the same as this...
iIndex = 0
loop_lt_label:
print iIndex
loop_lt iIndex, 1, 10, loop_lt_label
// ...and this.
iIndex = 0
while iIndex < 10 do
print iIndex
iIndex += 1
od
endin
// The prints and printks opcodes
// <https://github.com/csound/csound/blob/develop/OOps/ugrw1.c#L831>, arguably
// the primary methods of logging output, treat certain sequences of characters
// different from printf in C.
instr TestPrints
// ^ prints an ESCAPE character (U+001B), not a CIRCUMFLEX ACCENT character
// (U+005E). ^^ prints a CIRCUMFLEX ACCENT.
prints "^^\n"
// ~ prints an ESCAPE character (U+001B) followed by a [, not a TILDE
// character (U+007E). ~~ prints a TILDE.
prints "~~\n"
// \A, \B, \N, \R, and \T correspond to the escaped lowercase characters (that
// is, BELL (U+0007), BACKSPACE (U+0008), new line (U+000A), CARRIAGE RETURN
// (U+000D), and tab (U+0009)).
prints "\T\R\N"
// %n, %r, and %t are the same as \n, \r, and \t, as are %N, %R, and %T.
prints "%t%r%n"
// %! prints a semicolon. This is a hold-over from old versions of Csound that
// allowed comments to begin in strings.
prints "; %!\n"
endin
// The arguments of function-like macros can be separated by # instead of '.
// These two lines define the same macro.
#define OSCIL_MACRO(VOLUME'FREQUENCY'TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
#define OSCIL_MACRO(VOLUME#FREQUENCY#TABLE) #oscil $VOLUME, $FREQUENCY, $TABLE#
// Uses of macros can optionally be suffixed with a period.
instr TestMacroPeriodSuffix
aSignal $OSCIL_MACRO.(1'$A_HZ'1)
prints "The frequency of the oscillator is $A_HZ.Hz.\n"
out aSignal
endin
// Csound has @ and @@ operator-like macros that, when followed by a literal
// non-negative integer, expand to the next power of 2 and the next power of 2
// plus 1:
// @x = 2^(ceil(log2(x + 1))), x >= 0
// @@0 = 2
// @@x = 2^(ceil(log2(x))) + 1, x > 0
instr TestAt
prints "%d %2d %2d\n", 0, @0, @@0
prints "%d %2d %2d\n", 1, @1, @@1
prints "%d %2d %2d\n", 2, @2, @@2
prints "%d %2d %2d\n", 3, @3, @@3
prints "%d %2d %2d\n", 4, @4, @@4
prints "%d %2d %2d\n", 5, @5, @@5
prints "%d %2d %2d\n", 6, @6, @@6
prints "%d %2d %2d\n", 7, @7, @@7
prints "%d %2d %2d\n", 8, @8, @@8
prints "%d %2d %2d\n", 9, @9, @@9
endin
// Including newlines in macros can lead to confusing code.
instr MacroAbuse
if 1 == 1 then
prints "on\n"
#define FOO#
BAR
#endif // This ends the if block. It is not a preprocessor directive.
endin
scoreline_i {{
f 1 0 16384 10 1
i "N_a_M_e_" 0 2
i "TestOscillator" 2 2
i "TestBitwiseNOT" 0 1
i "TestBitwiseXOR" 0 1
i "TestGoto" 0 1
i "TestMacroPeriodSuffix" 4 1
i "TestAt" 0 1
i "MacroAbuse" 0 1
e
}}

13
samples/EJS/dash.ejs Normal file
View File

@@ -0,0 +1,13 @@
<% include parts/depend %>
<div class="row">
<% if (user.primaryAccount == "teacher") { %>
<% include teacher/sidebar %>
<% include teacher/dashboard %>
<% } else if (user.primaryAccount == "student") { %>
<% include student/sidebar %>
<% include student/dashboard %>
<% } else { %>
<center><h2>There seems to be a problem</h2></center>
<% } %>
</div>

102
samples/EJS/page.ejs Normal file
View File

@@ -0,0 +1,102 @@
<% include ../parts/depend %>
<div class="row">
<% include sidebar %>
<div class="col-lg-offset-3 col-lg-9 main-content">
<div class="page-title">
<h1>Pieces</h1>
<% if (pieces.length == 1) { %>
<p>You have
<strong>1</strong>
piece to practice</p>
<% } else { %>
<p>You have
<strong><%= pieces.length %></strong>
pieces to practice</p>
<% } %>
</div>
<div class="row">
<% if (pieces == undefined || pieces.length == 0) { %>
<div class="error-main">
<h1>No Pieces</h1>
<p>You have no
<strong>Pieces</strong>
assigned.</p>
</div>
<% } else { %>
<div class="col-lg-12 section-title">
<div style="margin-top: 10px; margin-bottom: 10px;" class="btn-group" role="group">
<button id="inProgressButton" type="button" class="btn btn-md btn-super-round btn-focus-off btn-primary btn-primary-active">In Progress</button>
<button id="completedButton" type="button" class="btn btn-md btn-super-round btn-focus-off btn-purple">Completed</button>
</div>
</div>
<div id="inProgressPieces">
<% if (inProgressPieces == undefined || inProgressPieces.length == 0) { %>
<center>
<h2>No Pieces in Progress</h2>
</center>
<% } else { %>
<% for (var i = 0; i < inProgressPieces.length; i++) { %>
<div class="col-lg-6">
<div class="box">
<div class="title">
<h1>
<a href="/pieces/practice/<%= inProgressPieces[i].id %>"><%= inProgressPieces[i].title %></a>
</h1>
<p>By
<strong><%= inProgressPieces[i].author %></strong>
</p>
<p>
Teacher:
<strong><%= inProgressPieces[i].teacherName %></strong>
</p>
<p>Average Practice Time:
<strong><%= inProgressPieces[i].averagePracticeTime %>
mins</strong>
</p>
<a href="/pieces/practice/<%= inProgressPieces[i].id %>" class="btn btn-success btn-block">Practice
<%= inProgressPieces[i].title %></a>
</div>
</div>
</div>
<% } %>
<% } %>
</div>
<div id="completedPieces" style="display: none;">
<% if (completedPieces == undefined || completedPieces.length == 0) { %>
<center>
<h2>No Completed Pieces</h2>
</center>
<% } else { %>
<% for (var i = 0; i < completedPieces.length; i++) { %>
<div class="col-lg-6">
<div class="box">
<div class="title">
<h1>
<a href="/pieces/practice/<%= completedPieces[i].id %>"><%= completedPieces[i].title %></a>
</h1>
<p>By
<strong><%= completedPieces[i].author %></strong>
</p>
<p>
Teacher:
<strong><%= completedPieces[i].teacherName %></strong>
</p>
<p>Average Practice Time:
<strong><%= completedPieces[i].averagePracticeTime %>
mins</strong>
</p>
<a href="/pieces/practice/<%= completedPieces[i].id %>" class="btn btn-success btn-block">Practice
<%= completedPieces[i].title %></a>
</div>
</div>
</div>
<% } %>
<% } %>
</div>
<% } %>
</div>
</div>
</div>

View File

@@ -0,0 +1,8 @@
{application, sample,
[{description, "sample app"},
{vsn, "1.0.0"},
{registered, []},
{mod, {sample_app, []}},
{applications, [kernel, stdlib]},
{env, []},
{modules, []}]}.

View File

@@ -0,0 +1,20 @@
#version 120
uniform sampler2D texture;
varying vec3 color;
varying vec2 texcoord;
vec4 GetDiffuse() {
vec4 diffuse = vec4(color.rgb, 1.0);
diffuse *= texture2D(texture, texcoord);
return diffuse;
}
void main() {
vec4 diffuse = GetDiffuse();
gl_FragData[0] = diffuse;
}

View File

@@ -0,0 +1,11 @@
#version 120
varying vec3 color;
varying vec2 texcoord;
void main() {
color = gl_Color.rgb;
texcoord = gl_MultiTexCoord0.st;
gl_Position = ftransform();
}

View File

@@ -0,0 +1,57 @@
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
query queryName($foo: ComplexType, $site: Site = MOBILE) {
whoever123is: node(id: [123, 456]) {
id ,
... on User @defer {
field2 {
id ,
alias: field1(first:10, after:$foo,) @include(if: $foo) {
id,
...frag
}
}
}
... @skip(unless: $foo) {
id
}
... {
id
}
}
}
mutation likeStory {
like(story: 123) @defer {
story {
id
}
}
}
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
storyLikeSubscribe(input: $input) {
story {
likers {
count
}
likeSentence {
text
}
}
}
}
fragment frag on Friend {
foo(size: $size, bar: $b, obj: {key: "value"})
}
{
unnamed(truthy: true, falsey: false),
query
}

View File

@@ -0,0 +1,50 @@
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
schema {
query: QueryType
mutation: MutationType
}
type Foo implements Bar {
one: Type
two(argument: InputType!): Type
three(argument: InputType, other: String): Int
four(argument: String = "string"): String
five(argument: [String] = ["string", "string"]): String
six(argument: InputType = {key: "value"}): Type
}
interface Bar {
one: Type
four(argument: String = "string"): String
}
union Feed = Story | Article | Advert
scalar CustomScalar
enum Site {
DESKTOP
MOBILE
}
input InputType {
key: String!
answer: Int = 42
}
extend type Foo {
seven(argument: [String]): Type
}
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @include(if: Boolean!)
on FIELD
| FRAGMENT_SPREAD
| INLINE_FRAGMENT

View File

@@ -0,0 +1,5 @@
<% if @name %>
Greeting, <%= @name %>!
<% else %>
Greeting!
<% end %>

3
samples/J/hashbang Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/jconsole
echo 'Hello, GitHub!'
exit ''

View File

@@ -0,0 +1,123 @@
{
"name": "Git Commit Message",
"scopeName": "text.git-commit",
"fileTypes": [
"COMMIT_EDITMSG"
],
"patterns": [
{
"name": "comment.line.number-sign.git-commit-message",
"begin": "^#",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.git-commit-message"
}
},
"end": "$",
"patterns": [
{
"name": "comment.line.on-branch.git-commit-message",
"match": "(?:On branch )([^ ]+)",
"captures": {
"1": {
"name": "support.function.branch.git-commit-message"
}
}
},
{
"name": "comment.line.on-branch.git-commit-message",
"match": "Your branch .* '([^ ']+)'",
"captures": {
"1": {
"name": "support.function.branch.git-commit-message"
}
}
},
{
"name": "comment.line.untracked.git-commit-message",
"begin": " Untracked files:",
"beginCaptures": {
"0": {
"name": "entity.definition.untracked.git-commit-message"
}
},
"end": "^#$",
"patterns": [
{
"name": "comment.line.untracked-file.git-commit-message",
"match": "\t(.*)$",
"captures": {
"1": {
"name": "support.function.file-status.git-commit-message"
},
"2": {
"name": "constant.character.branch.git-commit-message"
}
}
}
]
},
{
"name": "comment.line.discarded.git-commit-message",
"begin": " Change(?:s not staged for commit|d but not updated):",
"beginCaptures": {
"0": {
"name": "entity.definition.discarded.git-commit-message"
}
},
"end": "^#$",
"patterns": [
{
"name": "comment.line.discarded.git-commit-message",
"match": "\t([^:]+):(.*)$",
"captures": {
"1": {
"name": "support.function.file-status.git-commit-message"
},
"2": {
"name": "constant.character.branch.git-commit-message"
}
}
}
]
},
{
"name": "comment.line.selected.git-commit-message",
"begin": " Changes to be committed:",
"beginCaptures": {
"0": {
"name": "entity.definition.selected.git-commit-message"
}
},
"end": "^#$",
"patterns": [
{
"name": "comment.line.selected.git-commit-message",
"match": "\t([^:]+):(.*)$",
"captures": {
"1": {
"name": "support.function.file-status.git-commit-message"
},
"2": {
"name": "constant.character.branch.git-commit-message"
}
}
}
]
}
]
},
{
"name": "meta.diff.git-commit",
"comment": "diff at the end of the commit message when using commit -v, or viewing a log. End pattern is just something to be never matched so that the meta continues untill the end of the file.",
"begin": "diff\\ \\-\\-git",
"end": "(?=xxxxxx)123457",
"patterns": [
{
"include": "source.diff"
}
]
}
],
"uuid": "de3fb2fc-e564-4a31-9813-5ee26967c5c8"
}

View File

@@ -0,0 +1,8 @@
{
"project_id": "example",
"conduit_uri": "https://ex.am.pl/",
"copyright_holder": "Apache Software Foundation",
"arcanist_configuration": "ArcJIRAConfiguration",
"phabricator.uri": "https://phabricator.example.com/",
"load": ["libs/src"]
}

View File

@@ -0,0 +1,16 @@
[
{
"modid": "examplemod",
"name": "Example Mod",
"description": "Example placeholder mod.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authorList": ["ExampleDude"],
"credits": "The Forge and FML guys, for making this example",
"logoFile": "",
"screenshots": [],
"dependencies": []
}
]

9
samples/Jade/hello.pug Normal file
View File

@@ -0,0 +1,9 @@
doctype html
html
head
meta(charset='utf-8')
link(rel='stylesheet', type='text/css', href='main.css')
title Hello Pug
body
#text
include page

View File

@@ -0,0 +1,11 @@
# pmake might add -J (private)
FLAGS=${.MAKEFLAGS:C/\-J ([0-9]+,?)+//W}
all: .DEFAULT
.DEFAULT:
@which gmake > /dev/null 2>&1 ||\
(echo "GMake is required for node.js to build.\
Install and try again" && exit 1)
@gmake ${.FLAGS} ${.TARGETS}
.PHONY: test

View File

@@ -0,0 +1,77 @@
all: link-php-objects index-php-objects $(all_targets)
@echo
@echo "Build complete."
@echo "Don't forget to run 'make test'."
@echo
generate-php-objects:
@echo "Generating PHP objects in $(PHP_DIR)"
@for f in `ls $(PHP_DIR)/*.php`; do \
objcopy --input binary --output elf64-x86-64 --binary-architecture i386 $$f $$f.o; \
done;
link-php-objects: generate-php-objects
@echo "Linking PHP objects in $(PHP_DIR)"
@for f in `ls $(PHP_DIR)/*.php`; do \
ar rcs $(PHP_DIR)/lib$(PHP_LIB).a $$f.o; \
done;
index-php-objects: link-php-objects
@echo "Indexing PHP objects in $(PHP_DIR)"
@echo "#ifndef HAVE_PHP_$(PHP_LIB)_H" > $(PHP_DIR)/$(PHP_LIB).h
@echo "#define HAVE_PHP_$(PHP_LIB)_H" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "/* I AM GENERATED | DO NOT EDIT | I AM GENERATED */" >> $(PHP_DIR)/$(PHP_LIB).h
@for f in `ls $(PHP_DIR)/*.php`; do \
name=`echo $$f | sed 's/[^a-z]/_/g'`; \
echo "extern char _binary_"$$name"_start;" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "static inline char* php_index_$(PHP_LIB)_"$$name"() {" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo " return (char*) &_binary_"$$name"_start;" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "}" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "extern char _binary_"$$name"_end;" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "static inline char* php_index_$(PHP_LIB)_"$$name"_end() {" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo " return (char*) &_binary_"$$name"_end;" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "}" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "static inline size_t php_index_$(PHP_LIB)_"$$name"_size() {" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo " return (size_t) (php_index_$(PHP_LIB)_"$$name"_end() - php_index_$(PHP_LIB)_"$$name"());" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo "}" >> $(PHP_DIR)/$(PHP_LIB).h; \
done;
@echo "static inline php_$(PHP_LIB)_init(HashTable *index, HashTable *includes) {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zval val;" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_hash_init(index, 8, NULL, ZVAL_PTR_DTOR, 0);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_hash_init(includes, 8, NULL, NULL, 0);" >> $(PHP_DIR)/$(PHP_LIB).h
@for f in `ls $(PHP_DIR)/*.php`; do \
name=`echo $$f | sed 's/[^a-z]/_/g'`; \
echo " ZVAL_NEW_STR(&val, zend_string_init(\
php_index_$(PHP_LIB)_"$$name"(), \
php_index_$(PHP_LIB)_"$$name"_size(), 0));" >> $(PHP_DIR)/$(PHP_LIB).h; \
echo " zend_hash_str_add(index, \""$$f"\", sizeof(\""$$f"\")-1, &val);" >> $(PHP_DIR)/$(PHP_LIB).h; \
done;
@echo "}" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "static inline void php_$(PHP_LIB)_include(HashTable *index, HashTable *includes, \
char *path, size_t len, zval *retval) {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_string *key = zend_string_init(path, len, 0);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zval *code = zend_hash_find(index, key);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " if (code && !zend_hash_exists(includes, key)) {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_string *prepared = zend_string_alloc(Z_STRLEN_P(code) + (sizeof(\";\")-1), 0);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo >> $(PHP_DIR)/$(PHP_LIB).h
@echo " memcpy(&ZSTR_VAL(prepared)[0], \";\", sizeof(\";\")-1);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " if (Z_STRLEN_P(code) > (sizeof(\"<?php\") -1) && " >> $(PHP_DIR)/$(PHP_LIB).h
@echo " memcmp(Z_STRVAL_P(code), \"<?php\", sizeof(\"<?php\")-1) == SUCCESS) {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " memcpy(&ZSTR_VAL(prepared)[1], &Z_STRVAL_P(code)[5], \
Z_STRLEN_P(code) - (sizeof(\"<?php\") - 1));" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " ZSTR_LEN(prepared) -= (sizeof(\"<?php\") - 1);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " ZSTR_VAL(prepared)[ZSTR_LEN(prepared)] = 0;" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " } else {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " memcpy(&ZSTR_VAL(prepared)[1], Z_STRVAL_P(code), Z_STRLEN_P(code));" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " }" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_eval_stringl(ZSTR_VAL(prepared), ZSTR_LEN(prepared), retval, path);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_hash_add_empty_element(includes, key);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_string_release(prepared);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " }" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_string_release(key);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "}" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "static inline void php_$(PHP_LIB)_shutdown(HashTable *index, HashTable *includes) {" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_hash_destroy(index);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo " zend_hash_destroy(includes);" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "}" >> $(PHP_DIR)/$(PHP_LIB).h
@echo "#endif" >> $(PHP_DIR)/$(PHP_LIB).h

View File

@@ -0,0 +1,226 @@
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name:
LIBNAME = libpng16
PNGMAJ = 16
# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOREL=$(LIBSOMAJ).$(RELEASE)
OLDSO=libpng.so
# Utilities:
CC=cc
AR_RC=ar rc
MKDIR_P=mkdir
LN_SF=ln -f -s
RANLIB=echo
CP=cp
RM_F=/bin/rm -f
# where make install puts libpng.a, $(OLDSO)*, and png.h
prefix=/usr/local
exec_prefix=$(prefix)
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
CPPFLAGS=-I$(ZLIBINC)
CFLAGS= -dy -belf -O3
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(exec_prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
.c.pic.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-belf\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBSO): $(LIBSOMAJ)
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
$(LIBSOMAJ): $(OBJSDLL)
$(CC) -G -Wl,-h,$(LIBSOMAJ) -o $(LIBSOMAJ) \
$(OBJSDLL)
pngtest: pngtest.o $(LIBSO)
LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest
./pngtest
install-headers: png.h pngconf.h pnglibconf.h
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
-@$(RM_F) $(DI)/png.h
-@$(RM_F) $(DI)/pngconf.h
-@$(RM_F) $(DI)/pnglibconf.h
cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
-@$(RM_F) $(DI)/libpng
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
install-static: install-headers libpng.a
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(DL)/$(LIBNAME).a
-@$(RM_F) $(DL)/libpng.a
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBSOMAJ) libpng.pc
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
-@$(RM_F) $(DL)/$(LIBSO)
-@$(RM_F) $(DL)/$(LIBSOREL)
-@$(RM_F) $(DL)/$(OLDSO)
cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
chmod 755 $(DL)/$(LIBSOREL)
(cd $(DL); \
$(LN_SF) $(LIBSOREL) $(LIBSO); \
$(LN_SF) $(LIBSO) $(OLDSO))
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
-@$(RM_F) $(DM)/man3/libpng.3
-@$(RM_F) $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
-@$(RM_F) $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
-@$(RM_F) $(DB)/libpng-config
-@$(RM_F) $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location. Use test-dd to test it
# before then.
test-dd:
echo
echo Testing installed dynamic shared library in $(DL).
$(CC) -I$(DI) $(CPPFLAGS) \
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-L$(DL) -L$(ZLIBLIB) \
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
./pngtestd pngtest.png
test-installed:
$(CC) $(CPPFLAGS) $(CFLAGS) \
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
./pngtesti pngtest.png
clean:
$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
$(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
pnglibconf.h libpng.pc
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -0,0 +1,9 @@
GREETINGS=hello gday bonjour hola ola kaixo tag hoi konnichiwa nihao dobredan namaste salaam
all:V:
mk greet.^($GREETINGS)
for(i in $GREETINGS)
mk $i
greet.%: text-folder
/n/$printer $stem >[2=1]

View File

@@ -0,0 +1,19 @@
#!/sbin/openrc-run
description="Daemon for Advanced Configuration and Power Interface"
extra_started_commands="reload"
command="/usr/sbin/acpid"
command_args="$ACPID_ARGS"
start_stop_daemon_args="--quiet"
depend() {
need localmount
use logger
}
reload() {
ebegin "Reloading acpid configuration"
start-stop-daemon --exec $command --signal HUP
eend $?
}

View File

@@ -0,0 +1,45 @@
;;; linguist.srt --- Template for linguist-example-mode
;; Not copyrighted whatsoever.
;;
;; GPL can bite my shiny metal ass.
;;
;; GitHub: 1
;; Stallman: 0
set mode "default"
set comment_start ";"
set LICENSE "It's public domain, baby. This was written for the sole
purpose of the format's inclusion and recognition by GitHub Linguist.
This block of multiline text was added because every other .srt file
I could find was GPL-licensed and had long-winded copyright blobs in
the file's header. Also, check out my sick line-wrapping abilities."
set DOLLAR "$"
context file
template license
----
{{LICENSE:srecode-comment-prefix}}
----
template filecomment :file :user :time
----
{{comment_start}} {{FILENAME}} --- {{^}}
{{comment_prefix}} YUO WAN GPL?
{{comment_prefix}}
{{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}}
{{comment_prefix}}
{{comment_prefix}} TUO BAD
{{comment_prefix}} WE EXPAT PEOPLE
{{comment_prefix}} {{EXPLETIVE}} YOU!
{{>:copyright}}
{{comment_end}}
----
;; end

161
samples/Shell/filenames/gradlew vendored Normal file
View File

@@ -0,0 +1,161 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@@ -0,0 +1,240 @@
1
00:00:01,250 --> 00:00:03,740
Adding NCL language.
2
00:00:04,600 --> 00:00:08,730
Thanks for the pull request! Do you know if these files are NCL too?
3
00:00:09,800 --> 00:00:13,700
Those are poorly-named documentation files for NCL functions.
4
00:00:14,560 --> 00:00:17,200
- What's better?
- This is better.
5
00:00:18,500 --> 00:00:23,000
- Would it be correct to recognise these files as text?
- Yes.
6
00:00:23,890 --> 00:00:30,000
In that case, could you add "NCL" to the text entry in languages.yml too?
7
00:00:30,540 --> 00:00:35,250
I added the example to "Text" and updated the license in the grammar submodule.
8
00:00:38,500 --> 00:00:42,360
Cloning the submodule fails for me in local with this URL.
9
00:00:42,360 --> 00:00:45,250
Could you use Git or HTTPS...?
10
00:00:46,810 --> 00:00:50,000
I updated the grammar submodule link to HTTPS.
11
00:00:51,100 --> 00:00:57,000
It's still failing locally. I don't think you can just update the .gitmodules file.
12
00:00:57,750 --> 00:01:03,000
You'll probably have to remove the submodule and add it again to be sure.
13
00:01:04,336 --> 00:01:11,800
- I'll see first if it's not an issue on my side...
- I removed the submodule and added it back with HTTPS.
14
00:01:13,670 --> 00:01:18,000
I tested the detection of NCL files with 2000 samples.
15
00:01:18,000 --> 00:01:25,000
The Bayesian classifier doesn't seem to be very good at distinguishing text from NCL.
16
00:01:25,000 --> 00:01:30,740
We could try to improve it by adding more samples, or we can define a new heuristic rule.
17
00:01:31,300 --> 00:01:36,200
- Do you want me to send you the sample files?
- Yes, please do.
18
00:01:37,500 --> 00:01:39,500
In your inbox.
19
00:01:41,285 --> 00:01:48,216
- So if I manually go through these and sort out the errors, would that help?
- Not really.
20
00:01:48,540 --> 00:01:55,145
It's a matter of keywords so there's not much to do there except for adding new samples.
21
00:01:55,447 --> 00:02:02,000
If adding a few more samples doesn't improve things, we'll see how to define a new heuristic rule.
22
00:02:04,740 --> 00:02:09,600
- I added quite a few NCL samples.
- That's a bit over the top, isn't it?
23
00:02:10,250 --> 00:02:16,000
We currently can't add too many samples because of #2117.
24
00:02:18,000 --> 00:02:20,830
(sigh) I decreased the number of added samples.
25
00:02:21,630 --> 00:02:25,300
Could you test the detection results in local with the samples I gave you?
26
00:02:26,000 --> 00:02:28,670
- What is the command to run that test?
- Here...
27
00:02:28,716 --> 00:02:38,650
[Coding intensifies]
28
00:02:38,650 --> 00:02:43,330
It is getting hung up on a false detection of Frege in one of the Text samples.
29
00:02:43,540 --> 00:02:46,115
Do you have any suggestions for implementing a heuristic?
30
00:02:47,640 --> 00:02:55,200
#2441 should fix this. In the meantime, you can change this in "test_heuristics.rb"
31
00:02:55,165 --> 00:02:57,240
Why did you have to change this?
32
00:02:57,777 --> 00:03:04,480
- It doesn't work for me unless I do that.
- Hum, same for me. Arfon, does it work for you?
33
00:03:04,920 --> 00:03:08,830
Requiring linguist/language doesn't work for me either.
34
00:03:09,300 --> 00:03:13,885
We restructured some of the requires a while ago and I think this is just out-of-date code.
35
00:03:14,065 --> 00:03:20,950
From a large sample of known NCL files taken from Github, it's now predicting with about 98% accuracy.
36
00:03:21,183 --> 00:03:28,000
For a large sample of other files with the NCL extension, it is around 92%.
37
00:03:27,880 --> 00:03:30,950
From those, nearly all of the errors come from one GitHub repository,
38
00:03:30,950 --> 00:03:34,160
and they all contain the text strings, "The URL" and "The Title".
39
00:03:35,660 --> 00:03:43,260
- Do you mean 92% files correctly identified as text?
- Yes, it correctly identifies 92% as text.
40
00:03:44,000 --> 00:03:46,150
I'd really like to see this dramatically reduced.
41
00:03:46,150 --> 00:03:51,150
What happens if we reduce to around 5 NCL sample files?
42
00:03:51,150 --> 00:03:52,600
Does Linguist still do a reasonable job?
43
00:03:53,470 --> 00:03:58,190
I reduced it to 16 NCL samples and 8 text samples.
44
00:03:58,190 --> 00:04:01,720
It correctly classifies my whole set of known NCL files.
45
00:04:01,870 --> 00:04:05,730
I tried with 5 samples but could not get the same level of accuracy.
46
00:04:06,670 --> 00:04:10,400
It incorrectly classifies all of the NCL files in this GitHub repository.
47
00:04:11,130 --> 00:04:14,660
All of these files contain the text strings, "THE_URL:" and "THE_TITLE:".
48
00:04:14,660 --> 00:04:19,500
It did not misclassify any other text-files with the extension NCL.
49
00:04:19,970 --> 00:04:25,188
With 100% accuracy? Does that mean it that the results are better with less samples??
50
00:04:25,610 --> 00:04:31,190
I also removed a sample text-file which should have been classified as an NCL file.
51
00:04:31,000 --> 00:04:35,895
I think that probably made most of the difference, although I didn't test it atomically.
52
00:04:35,895 --> 00:04:38,370
Okay, that makes more sense.
53
00:04:39,515 --> 00:04:43,450
I don't get the same results for the text files. Full results here.
54
00:04:44,650 --> 00:04:50,000
They all look correctly classified to me, except for the ones in Fanghuan's repository.
55
00:04:50,000 --> 00:04:55,920
I manually went through all of the ones where I didn't already know based on the filename or the repository owner.
56
00:04:56,526 --> 00:05:00,000
[Presses button] It now correctly classifies all of my test files.
57
00:05:00,000 --> 00:05:05,970
R. Pavlick, thanks for this. These changes will be live in the next release of Linguist. In the next couple of weeks.
58
00:05:05,970 --> 00:05:07,450
Great! Thanks.

View File

@@ -0,0 +1,26 @@
--------------------------- MODULE AsyncInterface ---------------------------
EXTENDS Naturals
CONSTANT Data
VARIABLE chan
Values == <<"foo", "bar", "baz">>
TypeInvariant == chan \in [val: Data, rdy: {0,1}, ack: {0,1}]
Init == /\ TypeInvariant
/\ chan.ack = chan.rdy
Send(d) == /\ chan.rdy = chan.ack
/\ chan' = [chan EXCEPT !.val = d, !.rdy = 1 - @]
Rcv == /\ chan.rdy # chan.ack
/\ chan' = [chan EXCEPT !.ack = 1 - @]
Next == (\E d \in Data : Send(d)) \/ Rcv
Spec == Init /\ [][Next]_chan
THEOREM Spec => []TypeInvariant
=============================================================================

47
samples/TLA/fifo.tla Normal file
View File

@@ -0,0 +1,47 @@
-------------------------------- MODULE fifo --------------------------------
EXTENDS Naturals, Sequences
CONSTANT Message
VARIABLES in, out, q
InChan == INSTANCE AsyncInterface WITH Data <- Message, chan <- in
OutChan == INSTANCE AsyncInterface WITH Data <- Message, chan <- out
-----------------------------------------------------------------------------
Init == /\ InChan!Init
/\ OutChan!Init
/\ q = <<>>
TypeInvariant == /\ InChan!TypeInvariant
/\ OutChan!TypeInvariant
/\ q \in Seq(Message)
/\ Len(q) <= 10
SSend(msg) == /\ InChan!Send(msg) \* Send msg on channel in
/\ UNCHANGED <<out, q>>
BufRcv == /\ InChan!Rcv
/\ Len(q) < 10
/\ q' = Append(q, in.val)
/\ UNCHANGED out
BufSend == /\ q # <<>>
/\ OutChan!Send(Head(q))
/\ q' = Tail(q)
/\ UNCHANGED in
RRcv == /\ OutChan!Rcv
/\ UNCHANGED <<in, q>>
Next == \/ \E msg \in Message : SSend(msg)
\/ BufRcv
\/ BufSend
\/ RRcv
Spec == Init /\ [][Next]_<<in, out, q>>
-----------------------------------------------------------------------------
THEOREM Spec => []TypeInvariant
=============================================================================

9
samples/TeX/beispiel.toc Normal file
View File

@@ -0,0 +1,9 @@
\beamer@endinputifotherversion {3.07pt}
\select@language {german}
\beamer@sectionintoc {1}{Geschichte}{3}{0}{1}
\beamer@sectionintoc {2}{Merkmale}{4}{0}{2}
\beamer@sectionintoc {3}{Kritikpunkte}{5}{0}{3}
\beamer@sectionintoc {4}{Perl-Kultur und Spa{\ss}}{6}{0}{4}
\beamer@sectionintoc {5}{Siehe auch}{7}{0}{5}
\beamer@sectionintoc {6}{Einzelnachweise}{8}{0}{6}
\beamer@sectionintoc {7}{Bedingte Ausf\"{u}hrung}{12}{0}{7}

19
samples/TeX/perl.toc Normal file
View File

@@ -0,0 +1,19 @@
\contentsline {section}{\numberline {1}History}{3}
\contentsline {subsection}{\numberline {1.1}Early versions}{3}
\contentsline {subsection}{\numberline {1.2}Early Perl 5}{3}
\contentsline {subsection}{\numberline {1.3}2000-present}{3}
\contentsline {subsection}{\numberline {1.4}Name}{3}
\contentsline {subsection}{\numberline {1.5}Camel symbol}{3}
\contentsline {subsection}{\numberline {1.6}Onion symbol}{3}
\contentsline {section}{\numberline {2}Overview}{3}
\contentsline {subsection}{\numberline {2.1}Features}{3}
\contentsline {subsection}{\numberline {2.2}Design}{3}
\contentsline {subsection}{\numberline {2.3}Applications}{3}
\contentsline {subsection}{\numberline {2.4}Implementation}{3}
\contentsline {section}{\numberline {3}Database interfaces}{3}
\contentsline {section}{\numberline {4}Distribution}{4}
\contentsline {subsection}{\numberline {4.1}Availability}{4}
\contentsline {subsubsection}{\numberline {4.3.1}Windows}{5}
\contentsline {subsubsection}{\numberline {4.3.2}Mac OS X}{6}
\contentsline {subsubsection}{\numberline {4.3.3}OpenBSD}{6}
\contentsline {subsubsection}{\numberline {4.3.4}FreeBSD}{6}

View File

@@ -0,0 +1,42 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt
volutpat metus, non accumsan tortor convallis id. Headline un oreiller.
Il est recommandé que la boîte en carton. Micro-ondes et sollicitudin bien.
---------------------------------------------
Pellentesque sodales lectus ac lorem tempus, non placerat blandit de nisi.
Phasellus Cursus, eros, et parfois, il est arcu diam mollis felis, ac tempor
nisl elit quis felis. Morbi nca nisi vel ligula interdum pas l'auteur de, ni
peur. Mécène voix améliorée. Besoin de tirer gratuitement. Suspendisse
fermentum convallis metus non blandit. Ac turpis quis de molestie de Mécène.
Gluten. Donec urna leo, aliquet quis urna et, congue est plein. Pellentesque
ut pretium erat, rutrum neque tincidunt. Donec hendrerit massa sed sapien
dapibus ultrices.
==============================================
Et le porche des Mécène, le prix de la société n'a pas, lacinia justo.
Pellentesque habitant morbi tristique senectus et Netus et Malesuada fames
egestas ac turpis. Ut leo mi, feugiat sagittis un ac id Mauris, posuere
lobortis neque. Non, il n'y avait pas de varius tincidunt pretium.
En effet, nca pur hendrerit pellentesque sapien enim sagittis ipsum, aliquam
tempor est récolté dans le jeu. Ut sempre egestas ultrices lorem à risus.
Même arcu dolor, ipsum, ma vie, il a été dit fringilla odio.
- Lorem ipsum eu commodo imperdiet sem
- ligula arcu placerat turpis, une
- importante lorem nisi eget urna.
Curabitur aliquam accumsan nulla blandit mollis. Celtics à la succession!
Id ou pas d'alcool. A iaculis Duis consectetur vitae enim. Et magnis dis
parturiente montes Cras iaculis justo eu libero. Thermal non sapien quis
nisi Pellentesque placerat. Praesent fringilla diam nisl, nca dignissim
sem lobortis feugiat. Vivre beaucoup de pauvreté.
Morbi non justo eleifend!
Lacinia lacus fringilla, il fut un temps. Sed dans nunc à une chanson des
Beatles ou pour décorer. Aeneas de basket-ball de diamètre. Fusce felis à
partir, pas de pellentesque eget, le stress thermique pulvinar. Etiam
porta odio sed nibh accumsan tristique. Mécène tincidunt quis justo eget
porttitor. Jusqu'à ce que l'élément de temps ciblé.

662
samples/Turing/simplegame.t Normal file
View File

@@ -0,0 +1,662 @@
%This is a comment
var x : array 0 .. 100 of int
var rangeX, rangeY, loopFor : int := 0
setscreen ("graphics:696;400,nobuttonbar")
setscreen ("nocursor")
setscreen ("noecho")
var colourP : string := "Yellow"
var title : int := Font.New ("Algerian:60")
var subtitle : int := Font.New ("Algerian:20")
var xValue, yValue, font1, font2, instructionsTitle : int
var scoreR, scoreY, button : int := 0
var scoreRS, scoreYS, PreventFor : string
var win : string := "N"
var full, samePlayer : boolean := false
font1 := Font.New ("Algerian:20")
font2 := Font.New ("TimesNewRoman:15")
instructionsTitle := Font.New ("Algerian:35")
var shouldPlay : boolean := true
forward proc game
for i : 0 .. 100
x (i) := 0
end for
proc pauseProgram
var reply : string (1)
getch (reply)
end pauseProgram
process backgroundMusic
loop
exit when shouldPlay = false
Music.PlayFile ("music.MP3")
end loop
end backgroundMusic
proc winner
cls
win := "N"
for i : 1 .. 100
x (i) := 0
end for
drawfillbox (0, 0, 696, 400, black)
scoreRS := "Red Wins: " + intstr (scoreR)
scoreYS := "Yellow Wins: " + intstr (scoreY)
Font.Draw ("", 190, 320, title, 48)
Font.Draw (scoreRS, 0, 250, font1, 52)
Font.Draw (scoreYS, 0, 220, font1, 52)
Font.Draw ("Press any Key to continue.", 180, 100, subtitle, 12)
pauseProgram
game
end winner
body proc game
for i : 1 .. 100
x (i) := 0
end for
cls
drawfillbox (0, 0, 700, 400, black)%Grid
Draw.ThickLine (0, 400, 0, 0, 5, 48)
Draw.ThickLine (696, 400, 696, 0, 5, 48)
Draw.ThickLine (3, 0, 696, 0, 5, 48)
Draw.ThickLine (696, 0, 696, 70, 5, 48)
Draw.ThickLine (610, 70, 87, 70, 5, 48)
Draw.ThickLine (87, 70, 87, 400, 5, 48)
Draw.ThickLine (87, 400, 0, 400, 5, 48)
Draw.ThickLine (173, 70, 173, 400, 5, 48)
Draw.ThickLine (260, 70, 260, 400, 5, 48)
Draw.ThickLine (347, 70, 347, 400, 5, 48)
Draw.ThickLine (435, 70, 435, 400, 5, 48)
Draw.ThickLine (521, 70, 521, 400, 5, 48)
Draw.ThickLine (609, 70, 609, 400, 5, 48)
Draw.ThickLine (0, 70, 87, 70, 2, 11) %NEW!
Draw.ThickLine (0, 120, 87, 120, 2, 11)
Draw.ThickLine (0, 170, 87, 170, 2, 11)
Draw.ThickLine (0, 220, 87, 220, 2, 11)
Draw.ThickLine (0, 270, 87, 270, 2, 11)
Draw.ThickLine (0, 320, 87, 320, 2, 11)
Draw.ThickLine (0, 370, 87, 370, 2, 11)
Draw.ThickLine (609, 70, 696, 70, 2, 11) %Part 2
Draw.ThickLine (609, 120, 696, 120, 2, 11)
Draw.ThickLine (609, 170, 696, 170, 2, 11)
Draw.ThickLine (609, 220, 696, 220, 2, 11)
Draw.ThickLine (609, 270, 696, 270, 2, 11)
Draw.ThickLine (609, 320, 696, 320, 2, 11)
Draw.ThickLine (609, 370, 696, 370, 2, 11)
loop
if colourP = "Yellow" then
if button = 1 then
if (rangeX >= 87 and rangeX <= 173) then
%Drop on right corner (now verifies height)
if x (1) = 0 then
x (1) := 1
loopFor := 300
elsif x (2) = 0 then
x (2) := 1
loopFor := 250
elsif x (3) = 0 then
x (3) := 1
loopFor := 200
elsif x (4) = 0 then
x (4) := 1
loopFor := 150
elsif x (5) = 0 then
x (5) := 1
loopFor := 100
elsif x (6) = 0 then
x (6) := 1
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (135, 401 - i, 25, 25, black)
drawfilloval (135, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
elsif (rangeX >= 174 and rangeX <= 260) then
if x (7) = 0 then %Drop on right corner (now verifies height)
x (7) := 1
loopFor := 300
elsif x (8) = 0 then
x (8) := 1
loopFor := 250
elsif x (9) = 0 then
x (9) := 1
loopFor := 200
elsif x (10) = 0 then
x (10) := 1
loopFor := 150
elsif x (11) = 0 then
x (11) := 1
loopFor := 100
elsif x (12) = 0 then
x (12) := 1
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (222, 401 - i, 25, 25, black)
drawfilloval (222, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
elsif (rangeX >= 261 and rangeX <= 347) then
if x (13) = 0 then%Drop on right corner (now verifies height)
x (13) := 1
loopFor := 300
elsif x (14) = 0 then
x (14) := 1
loopFor := 250
elsif x (15) = 0 then
x (15) := 1
loopFor := 200
elsif x (16) = 0 then
x (16) := 1
loopFor := 150
elsif x (17) = 0 then
x (17) := 1
loopFor := 100
elsif x (18) = 0 then
x (18) := 1
loopFor := 50
else
full := true
end if
if full = true then
full := false
samePlayer := true
else
for i : 1 .. loopFor
drawfilloval (309, 401 - i, 25, 25, black)
drawfilloval (309, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
elsif (rangeX >= 348 and rangeX <= 434) then
if x (19) = 0 then %Drop on right corner (now verifies height)
x (19) := 1
loopFor := 300
elsif x (20) = 0 then
x (20) := 1
loopFor := 250
elsif x (21) = 0 then
x (21) := 1
loopFor := 200
elsif x (22) = 0 then
x (22) := 1
loopFor := 150
elsif x (23) = 0 then
x (23) := 1
loopFor := 100
elsif x (24) = 0 then
x (24) := 1
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (396, 401 - i, 25, 25, black)
drawfilloval (396, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
elsif (rangeX >= 435 and rangeX <= 521) then
if x (25) = 0 then %Drop on right corner (now verifies height)
x (25) := 1
loopFor := 300
elsif x (26) = 0 then
x (26) := 1
loopFor := 250
elsif x (27) = 0 then
x (27) := 1
loopFor := 200
elsif x (28) = 0 then
x (28) := 1
loopFor := 150
elsif x (29) = 0 then
x (29) := 1
loopFor := 100
elsif x (30) = 0 then
x (30) := 1
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (483, 401 - i, 25, 25, black)
drawfilloval (483, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
elsif (rangeX >= 522 and rangeX <= 609) then
if x (31) = 0 then %Drop on right corner (now verifies height)
x (31) := 1
loopFor := 300
elsif x (32) = 0 then
x (32) := 1
loopFor := 250
elsif x (33) = 0 then
x (33) := 1
loopFor := 200
elsif x (34) = 0 then
x (34) := 1
loopFor := 150
elsif x (35) = 0 then
x (35) := 1
loopFor := 100
elsif x (36) = 0 then
x (36) := 1
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (570, 401 - i, 25, 25, black)
drawfilloval (570, 400 - i, 25, 25, yellow)
delay (1)
end for
end if
end if
if samePlayer = true then
samePlayer := false
else
colourP := "Red"
end if
end if
else
if button = 1 then
if (rangeX >= 87 and rangeX <= 173) then
if x (1) = 0 then %Drop on right corner (now verifies height)
x (1) := 2
loopFor := 300
elsif x (2) = 0 then
x (2) := 2
loopFor := 250
elsif x (3) = 0 then
x (3) := 2
loopFor := 200
elsif x (4) = 0 then
x (4) := 2
loopFor := 150
elsif x (5) = 0 then
x (5) := 2
loopFor := 100
elsif x (6) = 0 then
x (6) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (135, 401 - i, 25, 25, black)
drawfilloval (135, 400 - i, 25, 25, 12)
delay (1)
end for
end if
elsif (rangeX >= 174 and rangeX <= 260) then
if x (7) = 0 then %Drop on right corner (now verifies height)
x (7) := 2
loopFor := 300
elsif x (8) = 0 then
x (8) := 2
loopFor := 250
elsif x (9) = 0 then
x (9) := 2
loopFor := 200
elsif x (10) = 0 then
x (10) := 2
loopFor := 150
elsif x (11) = 0 then
x (11) := 2
loopFor := 100
elsif x (12) = 0 then
x (12) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (222, 401 - i, 25, 25, black)
drawfilloval (222, 400 - i, 25, 25, 12)
delay (1)
end for
end if
elsif (rangeX >= 261 and rangeX <= 347) then
if x (13) = 0 then %Drop on right corner (now verifies height)
x (13) := 2
loopFor := 300
elsif x (14) = 0 then
x (14) := 2
loopFor := 250
elsif x (15) = 0 then
x (15) := 2
loopFor := 200
elsif x (16) = 0 then
x (16) := 2
loopFor := 150
elsif x (17) = 0 then
x (17) := 2
loopFor := 100
elsif x (18) = 0 then
x (18) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
samePlayer := true
else
for i : 1 .. loopFor
drawfilloval (309, 401 - i, 25, 25, black)
drawfilloval (309, 400 - i, 25, 25, 12)
delay (1)
end for
end if
elsif (rangeX >= 348 and rangeX <= 434) then
%Drop on right corner (now verifies height)
if x (19) = 0 then
x (19) := 2
loopFor := 300
elsif x (20) = 0 then
x (20) := 2
loopFor := 250
elsif x (21) = 0 then
x (21) := 2
loopFor := 200
elsif x (22) = 0 then
x (22) := 2
loopFor := 150
elsif x (23) = 0 then
x (23) := 2
loopFor := 100
elsif x (24) = 0 then
x (24) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (396, 401 - i, 25, 25, black)
drawfilloval (396, 400 - i, 25, 25, 12)
delay (1)
end for
end if
elsif (rangeX >= 435 and rangeX <= 521) then
%Drop on right corner (now verifies height)
if x (25) = 0 then
x (25) := 2
loopFor := 300
elsif x (26) = 0 then
x (26) := 2
loopFor := 250
elsif x (27) = 0 then
x (27) := 2
loopFor := 200
elsif x (28) = 0 then
x (28) := 2
loopFor := 150
elsif x (29) = 0 then
x (29) := 2
loopFor := 100
elsif x (30) = 0 then
x (30) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (483, 401 - i, 25, 25, black)
drawfilloval (483, 400 - i, 25, 25, 12)
delay (1)
end for
end if
elsif (rangeX >= 522 and rangeX <= 609) then
%Drop on right corner (now verifies height)
if x (31) = 0 then
x (31) := 2
loopFor := 300
elsif x (32) = 0 then
x (32) := 2
loopFor := 250
elsif x (33) = 0 then
x (33) := 2
loopFor := 200
elsif x (34) = 0 then
x (34) := 2
loopFor := 150
elsif x (35) = 0 then
x (35) := 2
loopFor := 100
elsif x (36) = 0 then
x (36) := 2
loopFor := 50
else
full := true
samePlayer := true
end if
if full = true then
full := false
else
for i : 1 .. loopFor
drawfilloval (570, 401 - i, 25, 25, black)
drawfilloval (570, 400 - i, 25, 25, 12)
delay (1)
end for
end if
end if
if samePlayer then
samePlayer := false
else
colourP := "Yellow"
end if
end if
end if
mousewhere (rangeX, rangeY, button)
%Detect Winner - Horizontal Verification
for i : 1 .. 18
if (x (i) = x (i + 6) and x (i) = x (i + 12) and x (i) = x (i + 18) and x (i) = 1) then
scoreY := scoreY + 1
win := "Y" %Red
elsif x (i) = x (i + 6) and x (i) = x (i + 12) and x (i) = x (i + 18) and x (i) = 2 then
scoreR := scoreR + 1
win := "Y"
if i > 6 then
if x (i - 6) = x (i) and x (i) = x (i + 6) and x (i) = x (i + 12) and x (i) = 2 then
scoreR := scoreR + 1 %Yellow
win := "Y"
elsif x (i - 6) = x (i) and x (i) = x (i + 6) and x (i) = x (i + 12) and x (i) = 1 then
scoreY := scoreY + 1 %Yellow
win := "Y"
end if
end if
end if
end for
%Verticle Detection
for i : 1 .. 36 by 6
if (x (i) = x (i + 1) and x (i) = x (i + 2) and x (i) = x (i + 3) and x (i) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i) = x (i + 1) and x (i) = x (i + 2) and x (i) = x (i + 3) and x (i) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 1) = x (i + 2) and x (i + 1) = x (i + 3) and x (i + 1) = x (i + 4) and x (i + 1) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 1) = x (i + 2) and x (i + 1) = x (i + 3) and x (i + 1) = x (i + 4) and x (i + 1) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 2) = x (i + 3) and x (i + 2) = x (i + 4) and x (i + 2) = x (i + 5) and x (i + 2) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 2) = x (i + 3) and x (i + 2) = x (i + 4) and x (i + 2) = x (i + 5) and x (i + 2) = 2) then
scoreR := scoreR + 1
win := "Y"
end if
end for
for i : 1 .. 36 %Positive Slope
if (x (i) = x (i + 7) and x (i) = x (i + 14) and x (i) = x (i + 21) and x (i) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i) = x (i + 7) and x (i) = x (i + 14) and x (i) = x (i + 21) and x (i) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 1) = x (i + 8) and x (i + 1) = x (i + 15) and x (i + 1) = x (i + 22) and x (i + 1) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 1) = x (i + 8) and x (i + 1) = x (i + 15) and x (i + 1) = x (i + 22) and x (i + 1) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 2) = x (i + 9) and x (i + 2) = x (i + 16) and x (i + 2) = x (i + 23) and x (i + 2) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 2) = x (i + 9) and x (i + 2) = x (i + 16) and x (i + 2) = x (i + 23) and x (i + 2) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (1) = x (7) and x (1) = x (13) and x (1) = x (19) and x (1) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (1) = x (7) and x (1) = x (13) and x (1) = x (19) and x (1) = 2) then
scoreR := scoreR + 1
win := "Y"
end if
end for
for i : 1 .. 70 %Negative Slope
if i > 24 then
if (x (i) = x (i - 5) and x (i) = x (i - 10) and x (i) = x (i - 15) and x (i) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i) = x (i - 5) and x (i) = x (i - 10) and x (i) = x (i - 15) and x (i) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 1) = x (i - 6) and x (i - 1) = x (i - 11) and x (i - 1) = x (i - 16) and x (i + 1) = 2) then
scoreR := scoreR + 1
win := "Y"
elsif (x (i + 1) = x (i - 6) and x (i - 1) = x (i - 11) and x (i - 1) = x (i - 16) and x (i + 1) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 2) = x (i - 7) and x (i - 2) = x (i - 12) and x (i - 2) = x (i - 17) and x (i + 2) = 1) then
scoreY := scoreY + 1
win := "Y"
elsif (x (i + 2) = x (i - 7) and x (i + 2) = x (i - 12) and x (i - 2) = x (i - 17) and x (i + 2) = 2) then
scoreR := scoreR + 1
win := "Y"
end if
end if
end for
exit when win = "Y"
end loop
winner
end game
proc mainMenu
drawfillbox (0, 0, 696, 400, black)
Font.Draw ("", 295, 220, font1, 48)
Font.Draw ("", 251, 150, font1, 48)
Font.Draw ("", 305, 79, font1, 48)
loop
Font.Draw ("Connect4", 155, 290, title, 52)
Mouse.Where (xValue, yValue, button)
if xValue >= 215 and xValue <= 455 then
if yValue >= 200 and yValue <= 250 then
if button = 1 then
delay (1000)
game
exit
end if
drawbox (215, 200, 455, 250, 48)
else
drawbox (215, 200, 455, 250, black)
end if
if yValue >= 130 and yValue <= 180 then
if button = 1 then
drawfillbox (0, 0, 696, 400, black)
Font.Draw ("", 70, 350, instructionsTitle, 48)
Font.Draw ("", 0, 320, font2, 52)
Font.Draw ("", 0, 280, font2, 52)
Font.Draw ("", 0, 240, font2, 52)
Font.Draw ("", 0, 200, font2, 52)
Font.Draw ("", 245, 75, font2, 14)
pauseProgram
mainMenu
end if
drawbox (215, 130, 455, 180, 48)
else
drawbox (215, 130, 455, 180, black)
end if
if yValue >= 60 and yValue <= 110 then
if button = 1 then
shouldPlay := false
exit
end if
drawbox (215, 60, 455, 110, 48)
else
drawbox (215, 60, 455, 110, black)
end if
end if
exit when button = 1
end loop
end mainMenu
proc intro
drawfillbox (0, 0, 696, 400, black)
for i : 1 .. 400
drawfillbox (0, 0, 696, 400, black)
Font.Draw ("", 560 - i, 250, title, 48)
Font.Draw ("", -255 + i, 220, subtitle, 52)
delay (4)
end for
for i : 1 .. 390
drawfilloval (40, 401 - i, 20, 20, black)
drawfilloval (656, 401 - i, 20, 20, black)
drawfilloval (656, 400 - i, 20, 20, 12)
drawfilloval (40, 400 - i, 20, 20, yellow)
delay (3)
end for
loop
drawfillbox (0, 0, 696, 100, black)
Font.Draw ("Press any Key to Continue.", 169, 20, subtitle, 12)
delay (300)
drawfillbox (0, 0, 696, 100, black)
Font.Draw ("Press any Key to Continue.", 169, 20, subtitle, 14)
delay (300)
exit when hasch
end loop
mainMenu
end intro
%fork backgroundMusic
intro

View File

@@ -1,19 +1,19 @@
% Accepts a number and calculates its factorial
function factorial (n: int) : real
if n = 0 then
result 1
else
result n * factorial (n - 1)
if n = 0 then
result 1
else
result n * factorial (n - 1)
end if
end factorial
var n: int
loop
put "Please input an integer: " ..
get n
exit when n >= 0
put "Input must be a non-negative integer."
put "Please input an integer: " ..
get n
exit when n >= 0
put "Input must be a non-negative integer."
end loop
put "The factorial of ", n, " is ", factorial (n)
put "The factorial of ", n, " is ", factorial (n)

View File

@@ -0,0 +1,18 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 18:10:49
newmtl Dice
Ns 9.99999905
Ni 1.50000000
d 1.00000000
Tr 0.00000000
Tf 1.00000000 1.00000000 1.00000000
illum 2
Ka 0.58823532 0.58823532 0.58823532
Kd 0.58823532 0.58823532 0.58823532
Ks 0.44999999 0.44999999 0.44999999
Ke 0.00000000 0.00000000 0.00000000
map_Ka C:\Users\johng\Desktop\dice.png
map_Kd C:\Users\johng\Desktop\dice.png
map_bump C:\Users\johng\Desktop\dice.png
bump C:\Users\johng\Desktop\dice.png

View File

@@ -0,0 +1,12 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 16:25:06
newmtl wire_061135006
Ns 32
d 1
Tr 0
Tf 1 1 1
illum 2
Ka 0.23921570 0.52941179 0.02352941
Kd 0.23921570 0.52941179 0.02352941
Ks 0.34999999 0.34999999 0.34999999

View File

@@ -0,0 +1,38 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 16:20:17
newmtl Material__41
Ns 10.00000000
Ni 1.50000000
d 1.00000000
Tr 0.00000000
Tf 1.00000000 1.00000000 1.00000000
illum 2
Ka 0.58800000 0.58800000 0.58800000
Kd 1.00000000 0.00000000 0.00000000
Ks 0.00000000 0.00000000 0.00000000
Ke 0.00000000 0.00000000 0.00000000
newmtl Material__42
Ns 10.00000000
Ni 1.50000000
d 1.00000000
Tr 0.00000000
Tf 1.00000000 1.00000000 1.00000000
illum 2
Ka 0.00000000 0.00000000 1.00000000
Kd 0.00000000 0.00000000 1.00000000
Ks 0.00000000 0.00000000 0.00000000
Ke 0.00000000 0.00000000 0.00000000
newmtl Material__43
Ns 10.00000000
Ni 1.50000000
d 1.00000000
Tr 0.00000000
Tf 1.00000000 1.00000000 1.00000000
illum 2
Ka 0.35294119 0.35294119 0.35294119
Kd 0.50196081 0.50588238 0.23529413
Ks 0.00000000 0.00000000 0.00000000
Ke 0.00000000 0.00000000 0.00000000

View File

@@ -0,0 +1,12 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 16:27:25
newmtl wire_088177027
Ns 32
d 1
Tr 0
Tf 1 1 1
illum 2
Ka 0.34509805 0.69411767 0.10588236
Kd 0.34509805 0.69411767 0.10588236
Ks 0.34999999 0.34999999 0.34999999

View File

@@ -0,0 +1,68 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 18:10:49
mtllib dice.mtl
#
# object Dice
#
v -30.00000000 0.00000000 30.00000000
v -30.00000000 0.00000000 -30.00000000
v 30.00000000 0.00000000 -30.00000000
v 30.00000000 0.00000000 30.00000000
v -30.00000000 60.00000000 30.00000000
v 30.00000000 60.00000000 30.00000000
v 30.00000000 60.00000000 -30.00000000
v -30.00000000 60.00000000 -30.00000000
# 8 vertices
vn 0.00000000 -1.00000000 -0.00000000
vn 0.00000000 1.00000000 -0.00000000
vn 0.00000000 0.00000000 1.00000000
vn 1.00000000 0.00000000 -0.00000000
vn 0.00000000 0.00000000 -1.00000000
vn -1.00000000 0.00000000 -0.00000000
# 6 vertex normals
vt 1.00183499 -0.01224804 60.49999619
vt 1.00183487 0.48775199 60.49999619
vt 0.66850162 0.48775196 60.50000381
vt 0.66850162 -0.01224804 60.50000381
vt -0.00046772 0.49891680 0.50000000
vt 0.33286563 0.49891669 0.50000000
vt 0.33286572 0.99891669 0.50000000
vt -0.00046766 0.99891680 0.50000000
vt -0.00046772 0.00000006 0.62999344
vt 0.33286560 0.00000003 0.63000107
vt 0.33286566 0.50000000 0.62999916
vt -0.00046772 0.50000012 0.62999153
vt 0.66447806 0.49891663 -29.58417892
vt 0.66447806 0.99891663 -29.58417130
vt 0.33114472 0.99891663 -29.58417320
vt 0.33114466 0.49891669 -29.58418083
vt 0.99669039 1.00000000 60.36999512
vt 0.66335702 1.00000000 60.37000275
vt 0.66335702 0.50000000 60.36999893
vt 0.99669039 0.49999994 60.36999130
vt 0.33280861 0.00000006 90.58419037
vt 0.66614199 0.00000006 90.58418274
vt 0.66614199 0.50000000 90.58417511
vt 0.33280861 0.50000000 90.58419037
# 24 texture coords
g Dice
usemtl Dice
s 2
f 1/1/1 2/2/1 3/3/1 4/4/1
s 4
f 5/5/2 6/6/2 7/7/2 8/8/2
s 8
f 1/9/3 4/10/3 6/11/3 5/12/3
s 16
f 4/13/4 3/14/4 7/15/4 6/16/4
s 32
f 3/17/5 2/18/5 8/19/5 7/20/5
s 64
f 2/21/6 1/22/6 5/23/6 8/24/6
# 6 polygons

View File

@@ -0,0 +1,63 @@
cstype bmatrix
deg 3 3
step 3 3
bmat u 1 -3 3 -1 \
0 3 -6 3 \
0 0 3 -3 \
0 0 0 1
bmat v 1 -3 -3 2 \
2 2 2 3 \
0 0 0 -2 \
0 0 0 2
# Special point and space curve data
vp 0.500
vp 0.700
vp 1.100
vp 0.200 0.950
v 0.300 1.500 0.100
v 0.000 0.000 0.000
v 1.000 1.000 0.000
v 2.000 1.000 0.000
v 3.000 0.000 0.000
cstype bezier
deg 3
curv 0.2 0.9 -4 -3 -2 -1
sp 1
parm u 0.00 1.00
end
# Trimming curve
vp -0.675 1.850 3.000
vp 0.915 1.930
vp 2.485 0.470 2.000
vp 2.485 -1.030
vp 1.605 -1.890 10.700
vp -0.745 -0.654 0.500
cstype rat bezier
curv2 -6 -5 -4 -3 -2 -1 -6
parm u 0.00 1.00 2.00
sp 2 3
end
# Surface
v -1.350 -1.030 0.000
v 0.130 -1.030 0.432 7.600
v 1.480 -1.030 0.000 2.300
v -1.460 0.060 0.201
v 0.120 0.060 0.915 0.500
v 1.380 0.060 0.454 1.500
v -1.480 1.030 0.000 2.300
v 0.120 1.030 0.394 6.100
v 1.170 1.030 0.000 3.300
cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 2.00 2.00 2.00
trim 0.0 2.0 1 2.2 2.2 3
sp 4
con 1 2.0 2.0 1 2 4.0 3.0 1
end

View File

@@ -0,0 +1,211 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 16:25:06
mtllib ripple.mtl
#
# object Plane001
#
v -50.94465637 46.62910461 25.64281845
v -37.48844147 24.20991898 16.95789337
v -50.94465637 41.79552460 16.95789337
v -37.48844147 27.38044548 25.64281845
v -37.48844147 20.64456940 8.27297115
v -50.94465637 36.20748138 8.27297115
v -24.03222656 14.00123024 8.27297115
v -24.03222656 17.55510902 25.64281845
v -37.48844147 16.93638992 -0.41195297
v -50.94465637 30.29615402 -0.41195297
v -37.48844147 13.33736229 -9.09687710
v -50.94465637 24.49272728 -9.09687710
v -24.03222656 12.37120342 -0.41195297
v -24.03222656 10.91310787 -9.09687710
v -10.57601166 13.59048653 8.27297115
v -10.57601166 14.55468178 25.64281845
v 2.88020325 16.72536278 8.27297115
v 2.88020325 15.78074646 25.64281845
v -10.57601166 13.76694107 -0.41195297
v -10.57601166 14.20676041 -9.09687710
v 2.88020325 20.20512009 -9.09687710
v -37.48844147 10.09947586 -17.78180122
v -50.94465637 19.22837830 -17.78180122
v -37.48844147 7.47471571 -26.46672440
v -50.94465637 14.93428612 -26.46672440
v -24.03222656 9.68243504 -17.78180122
v -24.03222656 8.73467827 -26.46672440
v -50.94465637 12.04163361 -35.15164948
v -37.48844147 5.07252359 -43.83657455
v -50.94465637 10.98159790 -43.83657455
v -24.03222656 7.90988255 -43.83657455
v -10.57601166 14.77819061 -17.78180122
v -10.57601166 15.34947777 -26.46672440
v 2.88020325 23.95441628 -26.46672440
v -10.57601166 15.96461296 -43.83657455
v 2.88020325 25.70764923 -43.83657455
v 16.33641815 20.71888542 8.27297115
v 16.33641815 18.63488770 25.64281845
v 29.79263306 22.88408279 8.27297115
v 29.79263306 20.51868629 25.64281845
v 16.33641815 25.89498520 -9.09687710
v 29.79263306 28.26315308 -9.09687710
v 43.24884796 20.53397751 8.27297115
v 43.24884796 18.83372879 25.64281845
v 56.70506287 10.98159790 8.27297115
v 56.70506287 10.98159790 25.64281845
v 43.24884796 24.29642487 -9.09687710
v 56.70506287 10.98159790 -9.09687710
v 16.33641815 31.18479538 -26.46672440
v 29.79263306 33.67591858 -26.46672440
v 16.33641815 33.60993195 -43.83657455
v 29.79263306 36.14238739 -43.83657455
v 43.24884796 28.06308365 -26.46672440
v 56.70506287 10.98159790 -26.46672440
v 43.24884796 29.77596664 -43.83657455
v 56.70506287 10.98159790 -43.83657455
# 56 vertices
vn 0.76763725 0.57240576 -0.28824410
vn 0.65690964 0.70898795 -0.25652644
vn 0.74131417 0.58485949 -0.32923040
vn 0.71128774 0.66027904 -0.24104214
vn 0.57668960 0.75674146 -0.30784976
vn 0.68667018 0.61596304 -0.38610050
vn 0.23177305 0.95558769 -0.18202589
vn 0.35748628 0.91861695 -0.16836406
vn 0.49003005 0.80710864 -0.32931164
vn 0.62462389 0.65700555 -0.42212400
vn 0.39033067 0.86003071 -0.32861704
vn 0.55869663 0.70821345 -0.43161529
vn 0.10668588 0.97925276 -0.17228496
vn -0.02931032 0.98739797 -0.15551880
vn -0.07901792 0.99610978 -0.03900582
vn 0.03497402 0.99911118 -0.02352911
vn -0.26840743 0.95793903 0.10153976
vn -0.16543458 0.98361683 0.07161918
vn -0.19281031 0.98029876 0.04287769
vn -0.30288765 0.95234644 0.03599080
vn -0.40211844 0.89890224 0.17399880
vn 0.28773862 0.90962982 -0.29963326
vn 0.49455851 0.76858509 -0.40581867
vn 0.17960025 0.95868921 -0.22058737
vn 0.45494452 0.82066798 -0.34573048
vn -0.15761316 0.97898537 -0.12940517
vn -0.26093873 0.96179539 -0.08282847
vn 0.42190838 0.88920695 -0.17693035
vn 0.09655062 0.98630100 -0.13374706
vn 0.39958632 0.90994275 -0.11106271
vn -0.33997789 0.93774927 -0.07100248
vn -0.39676505 0.91563439 0.06473898
vn -0.48332906 0.87461358 0.03800077
vn -0.49581528 0.85854882 0.13061842
vn -0.53545648 0.84449571 0.01064764
vn -0.53323698 0.84293228 0.07157855
vn -0.21215707 0.95821202 0.19188292
vn -0.17650788 0.97674274 0.12173164
vn 0.02109022 0.97897238 0.20289963
vn 0.00300862 0.99226630 0.12409085
vn -0.26396522 0.92647272 0.26827350
vn 0.06819490 0.95697868 0.28203061
vn 0.40214399 0.90704513 0.12469723
vn 0.34466815 0.93620455 0.06873771
vn 0.56171304 0.82705635 0.02136020
vn 0.50399899 0.86370426 -0.00000000
vn 0.50896263 0.84233069 0.17730212
vn 0.67437875 0.73730576 0.03991853
vn -0.31544915 0.92877936 0.19457826
vn 0.10895393 0.97185022 0.20889288
vn -0.33574972 0.93407321 0.12157062
vn 0.12362437 0.98257226 0.13881217
vn 0.59271014 0.79456633 0.13175353
vn 0.76462281 0.64369327 0.03179539
vn 0.62271041 0.77744496 0.08838002
vn 0.79732174 0.60305154 0.02463558
# 56 vertex normals
g Plane001
usemtl wire_061135006
s 1
f 1//1 2//2 3//3
f 1//1 4//4 2//2
f 3//3 5//5 6//6
f 3//3 2//2 5//5
f 2//2 7//7 5//5
f 2//2 8//8 7//7
f 2//2 4//4 8//8
f 6//6 9//9 10//10
f 6//6 5//5 9//9
f 10//10 11//11 12//12
f 10//10 9//9 11//11
f 5//5 13//13 9//9
f 5//5 7//7 13//13
f 9//9 14//14 11//11
f 9//9 13//13 14//14
f 8//8 15//15 7//7
f 8//8 16//16 15//15
f 16//16 17//17 15//15
f 16//16 18//18 17//17
f 7//7 19//19 13//13
f 7//7 15//15 19//19
f 13//13 20//20 14//14
f 13//13 19//19 20//20
f 19//19 21//21 20//20
f 19//19 17//17 21//21
f 19//19 15//15 17//17
f 22//22 12//12 11//11
f 23//23 12//12 22//22
f 24//24 23//23 22//22
f 25//25 23//23 24//24
f 11//11 26//26 22//22
f 11//11 14//14 26//26
f 22//22 27//27 24//24
f 22//22 26//26 27//27
f 28//28 29//29 30//30
f 28//28 24//24 29//29
f 28//28 25//25 24//24
f 24//24 31//31 29//29
f 24//24 27//27 31//31
f 14//14 32//32 26//26
f 14//14 20//20 32//32
f 26//26 33//33 27//27
f 26//26 32//32 33//33
f 32//32 34//34 33//33
f 32//32 21//21 34//34
f 32//32 20//20 21//21
f 27//27 35//35 31//31
f 27//27 33//33 35//35
f 33//33 36//36 35//35
f 33//33 34//34 36//36
f 18//18 37//37 17//17
f 18//18 38//38 37//37
f 38//38 39//39 37//37
f 38//38 40//40 39//39
f 17//17 41//41 21//21
f 17//17 37//37 41//41
f 37//37 42//42 41//41
f 37//37 39//39 42//42
f 40//40 43//43 39//39
f 40//40 44//44 43//43
f 44//44 45//45 43//43
f 44//44 46//46 45//45
f 39//39 47//47 42//42
f 39//39 43//43 47//47
f 43//43 48//48 47//47
f 43//43 45//45 48//48
f 21//21 49//49 34//34
f 21//21 41//41 49//49
f 41//41 50//50 49//49
f 41//41 42//42 50//50
f 34//34 51//51 36//36
f 34//34 49//49 51//51
f 49//49 52//52 51//51
f 49//49 50//50 52//52
f 42//42 53//53 50//50
f 42//42 47//47 53//53
f 47//47 54//54 53//53
f 47//47 48//48 54//54
f 50//50 55//55 52//52
f 50//50 53//53 55//55
f 53//53 56//56 55//55
f 53//53 54//54 56//56
# 0 polygons - 82 triangles

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 27.05.2016 16:27:25
mtllib spline.mtl
#
# shape Line001
#
v 71.96043396 50.40676880 7.76218033
v 68.00450134 49.56087112 9.62696075
v 58.35432816 47.37934113 12.77519226
v 45.49077225 44.39643097 15.20822144
v 31.89469528 41.14640045 14.92743301
v 20.04695511 38.16349030 9.93418884
v 12.42840576 35.98196030 -1.77015114
v 11.51990128 35.13606262 -22.18419647
v 11.96961975 32.52806473 -45.35875702
v 7.61955643 26.33384705 -63.90428543
v -0.25867081 18.99807358 -77.65885162
v -10.39344025 12.96540833 -86.46051788
v -21.51314926 10.68051147 -90.14735413
v -32.34618759 14.58804321 -88.55743408
v -41.62093735 27.13267326 -81.52883148
v -45.51561356 42.52115250 -66.96699524
v -43.02957153 53.76282501 -45.02964783
v -37.12292480 61.50623322 -18.93314743
v -30.75580597 66.39993286 8.10605431
v -26.88832855 69.09246826 32.87157822
v -28.48061752 70.23239136 52.14703751
v -38.49278641 70.46823883 62.71599197
v -53.13377380 68.93627167 62.32793045
v -66.29364777 64.98539734 52.53622818
v -77.45420837 59.58318329 35.83026123
v -86.09729004 53.69718933 14.69950485
v -91.70471191 48.29497528 -8.36663914
v -93.75828552 44.34410095 -30.87874222
v -91.73982239 42.81213379 -50.34735489
v -89.87214661 43.91723251 -66.58690643
v -92.01886749 46.76722717 -80.05120850
v -97.12301636 50.66415787 -89.21000671
v -104.12763977 54.91006470 -92.53303528
v -111.97578430 58.80699158 -88.49005127
v -119.61050415 61.65698624 -75.55078125
v -125.97479248 62.76208496 -52.18497467
# 36 vertices
g Line001
usemtl wire_088177027
l 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

View File

@@ -0,0 +1,6 @@
## Interface: 60200
## Title: Vahevian Lotus Vane
## Notes: "Critical Threat Range"
## Version: 4.2
Vahevia.xml
Lotus_Vane.lua

View File

@@ -0,0 +1,11 @@
# Internationalisation example
## Title: Test
## Title-esES: Pruebas
## Title-huHU: Próba
## Notes: "Testing this shit"
## Notes-esES: "Probando la mierda esta"
## Notes-huHU: "Kipróbálom ezt a szart"
Tests.xml
Elk.lua

View File

@@ -0,0 +1,24 @@
# Addon manifest file
## Interface: 60200
## Title: Linguist
## Notes: "Language savant"
## RequiredDeps: charlockHolmes, escapeUtils, mimeTypes, rugged
## LoadOnDemand: 1
## Version: 4.9
# This is a comment
## SavedVariables: foo, bar
## SavedVariablesPerCharacter: fewburt
Languages.xml
Heuristics.xml
h-counter.lua
ruby-isnt.lua
#
# It is possible for addons to query values of any tags with a "X-" prefix.
# Some possibilities include:
#
## X-Date: "2016-04-28"
## X-Website: "https://github.com/"

23
samples/XML/Demo.sfproj Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>93d81507-bccc-43d6-8667-2d42473f0c32</ProjectGuid>
<ProjectVersion>1.0</ProjectVersion>
</PropertyGroup>
<ItemGroup>
<None Include="Scripts\Deploy-FabricApplication.ps1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChaosTest.ChaosService\ChaosTest.ChaosService.csproj" />
<ProjectReference Include="..\ChaosTest.WebService\ChaosTest.WebService.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="ApplicationPackageRoot\ApplicationManifest.xml" />
<Content Include="ApplicationParameters\Cloud.xml" />
<Content Include="ApplicationParameters\Local.xml" />
<Content Include="PublishProfiles\Cloud.xml" />
<Content Include="PublishProfiles\Local.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.targets" />
</Project>

104
samples/XML/Strings.resx Normal file
View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Argument_InvalidPathChars" xml:space="preserve">
<value>Illegal characters in path.</value>
</data>
</root>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\src\System.Buffers.builds">
<SupportedFramework>net45;netcore45;netstandardapp1.5;wpa81</SupportedFramework>
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

8
samples/XML/src.builds Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="*\src\*.builds" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -36,8 +36,11 @@ source = Licensed::Source::Filesystem.new("vendor/grammars/*/", type: "grammar")
config = Licensed::Configuration.new
config.sources << source
if ARGV[0] == "verify"
Licensed::Command::Verify.new(config).run
command = if ARGV[0] == "verify"
Licensed::Command::Verify.new(config)
else
Licensed::Command::Cache.new(config).run(force: true)
Licensed::Command::Cache.new(config)
end
command.run
exit command.success?

View File

@@ -166,7 +166,7 @@ class TestBlob < Minitest::Test
assert sample_blob_memory("JavaScript/jquery-1.4.2.min.js").generated?
# Composer generated composer.lock file
assert sample_blob_memory("JSON/composer.lock").generated?
assert sample_blob_memory("JSON/filenames/composer.lock").generated?
# PEG.js-generated parsers
assert sample_blob_memory("JavaScript/parser.js").generated?

View File

@@ -19,7 +19,7 @@ class TestFileBlob < Minitest::Test
blob.instance_variable_set(:@name, 'script')
blob
end
def test_extensions
assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions
assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions
@@ -312,11 +312,13 @@ class TestFileBlob < Minitest::Test
# Debian packaging
assert sample_blob("debian/cron.d").vendored?
# Django env
assert sample_blob("env/foo.py").vendored?
# Erlang
assert sample_blob("rebar").vendored?
# git config files
assert_predicate fixture_blob("some/path/.gitattributes"), :vendored?
assert_predicate fixture_blob(".gitignore"), :vendored?
assert_predicate fixture_blob("special/path/.gitmodules"), :vendored?
@@ -409,6 +411,10 @@ class TestFileBlob < Minitest::Test
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
# Ace Editor
assert sample_blob("ace-builds/src/ace.js").vendored?
assert sample_blob("static/project/ace-builds/src/ace.js").vendored?
# AngularJS
assert sample_blob("public/javascripts/angular.js").vendored?
assert sample_blob("public/javascripts/angular.min.js").vendored?

View File

@@ -17,6 +17,7 @@ class TestGenerated < Minitest::Test
assert_raises(DataLoadedError, "Data wasn't loaded when calling generated? on #{blob}") do
Generated.generated?(blob, lambda { raise DataLoadedError.new })
end
assert Generated.generated?(blob, lambda { IO.read(blob) }), "#{blob} was not recognized as a generated file"
end
def generated_fixture_without_loading_data(name)
@@ -50,6 +51,9 @@ class TestGenerated < Minitest::Test
# Node modules
generated_sample_without_loading_data("Dummy/node_modules/foo.js")
# npm shrinkwrap file
generated_sample_without_loading_data("Dummy/npm-shrinkwrap.json")
# Godep saved dependencies
generated_sample_without_loading_data("Godeps/Godeps.json")
generated_sample_without_loading_data("Godeps/_workspace/src/github.com/kr/s3/sign.go")
@@ -62,6 +66,9 @@ class TestGenerated < Minitest::Test
# Minified files
generated_sample_loading_data("JavaScript/jquery-1.6.1.min.js")
# JS files with source map reference
generated_sample_loading_data("JavaScript/namespace.js")
# Source Map
generated_fixture_without_loading_data("Data/bootstrap.css.map")
generated_fixture_loading_data("Data/sourcemap.v3.map")

View File

@@ -15,6 +15,7 @@ class TestGrammars < Minitest::Test
apache-2.0
bsd-2-clause
bsd-3-clause
isc
mit
mpl-2.0
public

View File

@@ -122,6 +122,12 @@ class TestHeuristcs < Minitest::Test
})
end
def test_inc_by_heuristics
assert_heuristics({
"PHP" => all_fixtures("PHP", "*.inc")
})
end
def test_ls_by_heuristics
assert_heuristics({
"LiveScript" => all_fixtures("LiveScript", "*.ls"),

View File

@@ -31,6 +31,7 @@ class TestModelines < Minitest::Test
assert_modeline Language["Prolog"], fixture_blob("Data/Modelines/not_perl.pl")
assert_modeline Language["Smalltalk"], fixture_blob("Data/Modelines/example_smalltalk.md")
assert_modeline Language["PHP"], fixture_blob("Data/Modelines/iamphp.inc")
assert_modeline nil, sample_blob("C/main.c")
end
def test_modeline_languages

1
vendor/grammars/Elm vendored Submodule

Submodule vendor/grammars/Elm added at 8e8af4a712

1
vendor/grammars/TLA vendored Submodule

Submodule vendor/grammars/TLA added at 7e351a9cdf

1
vendor/grammars/creole vendored Submodule

Submodule vendor/grammars/creole added at cdc8adc306

1
vendor/grammars/ejs-tmbundle vendored Submodule

1
vendor/grammars/idris vendored Submodule

Submodule vendor/grammars/idris added at 1089032af6

Some files were not shown because too many files have changed in this diff Show More