mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf471af677 | ||
|
|
79a428ab8d | ||
|
|
9f8c15ed6c | ||
|
|
b94eda18ab | ||
|
|
849eb28b01 | ||
|
|
b0073d461c | ||
|
|
21e97cc65c | ||
|
|
06c1033952 | ||
|
|
8c54f68040 | ||
|
|
4c1f5c490f | ||
|
|
117735ffb9 | ||
|
|
f98e6bdac7 | ||
|
|
19d76306d3 | ||
|
|
a63a609ce1 | ||
|
|
95fce2024d | ||
|
|
f3b65015f4 | ||
|
|
5431298b0d | ||
|
|
8f651bca03 | ||
|
|
6c45e5ec19 | ||
|
|
95d394642c | ||
|
|
6a185a3d3a | ||
|
|
6ae353706d | ||
|
|
77bc72be14 | ||
|
|
0585c880de | ||
|
|
da5189e7fb | ||
|
|
5f456d8b22 | ||
|
|
a351cdd486 | ||
|
|
6e71663fd6 | ||
|
|
0b2e43cdee | ||
|
|
9cbd280f79 | ||
|
|
947be9db0f | ||
|
|
dd55f929d4 | ||
|
|
8b5399d568 | ||
|
|
1b8b0c6229 | ||
|
|
ee3081fb4c | ||
|
|
119770a038 | ||
|
|
9d61487403 | ||
|
|
56dec47561 | ||
|
|
3e793ab5b7 | ||
|
|
f6b50a67f9 | ||
|
|
cd47798d13 | ||
|
|
3b54df2cde | ||
|
|
8845b266de | ||
|
|
4757da73f0 | ||
|
|
468fd425fc | ||
|
|
5604d658b2 | ||
|
|
37222d5622 | ||
|
|
ec38b54023 | ||
|
|
260e90401d | ||
|
|
8c66f0a5da | ||
|
|
78efc2d0de | ||
|
|
656c1e6ba6 | ||
|
|
65e932016b | ||
|
|
fc602b1d42 | ||
|
|
0e882900d7 | ||
|
|
28103ee25b | ||
|
|
0a0d2ddb1a | ||
|
|
3bf4cb721e | ||
|
|
ba1ab64b56 | ||
|
|
786d1e4cfc | ||
|
|
eb82e022ba | ||
|
|
753bfd1dc5 | ||
|
|
6b11655db8 | ||
|
|
d1ae098c08 | ||
|
|
e1a8b5db1d | ||
|
|
302cfea295 | ||
|
|
0946fecd82 | ||
|
|
9afdcddfc9 | ||
|
|
4d162f88bd | ||
|
|
2806987f2f | ||
|
|
f380aa2e5e | ||
|
|
a2ce1972ec | ||
|
|
aa8cf7e6bb | ||
|
|
ec61a6974f | ||
|
|
21e249bd2c | ||
|
|
8e550f7093 | ||
|
|
53e53880bd | ||
|
|
671b5788ed | ||
|
|
76d10cd85c | ||
|
|
42c155d667 | ||
|
|
d17222ec91 | ||
|
|
a1ea55d006 | ||
|
|
f32b7bb978 | ||
|
|
38aa7bae3f | ||
|
|
0021b9532b | ||
|
|
788fac7c43 | ||
|
|
71934152e4 | ||
|
|
e20d6fc04a | ||
|
|
a1e8fc4f97 | ||
|
|
9dc8a10e2a | ||
|
|
43a2da46f9 | ||
|
|
f95ca13073 | ||
|
|
b92b3af602 | ||
|
|
83b76cde34 | ||
|
|
5ff0d488d2 | ||
|
|
f89adf6e53 | ||
|
|
efd34d8cb0 | ||
|
|
3defb60fd7 | ||
|
|
869c9d2fdd | ||
|
|
912e465193 | ||
|
|
e7c1419390 | ||
|
|
b19cd037b7 | ||
|
|
42f7bc2160 | ||
|
|
542a0d79fd | ||
|
|
4b9b09f7bf | ||
|
|
57429f3194 | ||
|
|
9bdf890fd8 | ||
|
|
9240f30f28 | ||
|
|
ed23c6ef75 | ||
|
|
90b59876d0 | ||
|
|
6d2aa601cd | ||
|
|
1811465abb | ||
|
|
0c2aeae00d | ||
|
|
a4f187efd2 | ||
|
|
b6ee02f313 | ||
|
|
fc1f8083ad | ||
|
|
af5e799a45 | ||
|
|
e073e91d62 | ||
|
|
da9bda0e27 | ||
|
|
0e996e4bb7 | ||
|
|
63fbbd6e0a | ||
|
|
17f75e64ba | ||
|
|
0157b9eb37 | ||
|
|
730be65514 | ||
|
|
f18ae4f99f |
21
.gitmodules
vendored
21
.gitmodules
vendored
@@ -133,9 +133,6 @@
|
||||
[submodule "vendor/grammars/fancy-tmbundle"]
|
||||
path = vendor/grammars/fancy-tmbundle
|
||||
url = https://github.com/fancy-lang/fancy-tmbundle
|
||||
[submodule "vendor/grammars/fsharpbinding"]
|
||||
path = vendor/grammars/fsharpbinding
|
||||
url = https://github.com/fsharp/fsharpbinding
|
||||
[submodule "vendor/grammars/monkey.tmbundle"]
|
||||
path = vendor/grammars/monkey.tmbundle
|
||||
url = https://github.com/gingerbeardman/monkey.tmbundle
|
||||
@@ -632,9 +629,27 @@
|
||||
[submodule "vendor/grammars/jflex.tmbundle"]
|
||||
path = vendor/grammars/jflex.tmbundle
|
||||
url = https://github.com/jflex-de/jflex.tmbundle.git
|
||||
[submodule "vendor/grammars/Sublime-Modula-2"]
|
||||
path = vendor/grammars/Sublime-Modula-2
|
||||
url = https://github.com/harogaston/Sublime-Modula-2
|
||||
[submodule "vendor/grammars/ada.tmbundle"]
|
||||
path = vendor/grammars/ada.tmbundle
|
||||
url = https://github.com/textmate/ada.tmbundle
|
||||
[submodule "vendor/grammars/api-blueprint-sublime-plugin"]
|
||||
path = vendor/grammars/api-blueprint-sublime-plugin
|
||||
url = https://github.com/apiaryio/api-blueprint-sublime-plugin
|
||||
[submodule "vendor/grammars/Handlebars"]
|
||||
path = vendor/grammars/Handlebars
|
||||
url = https://github.com/daaain/Handlebars
|
||||
[submodule "vendor/grammars/smali-sublime"]
|
||||
path = vendor/grammars/smali-sublime
|
||||
url = https://github.com/ShaneWilton/sublime-smali
|
||||
[submodule "vendor/grammars/language-jsoniq"]
|
||||
path = vendor/grammars/language-jsoniq
|
||||
url = http://github.com/wcandillon/language-jsoniq
|
||||
[submodule "vendor/grammars/atom-fsharp"]
|
||||
path = vendor/grammars/atom-fsharp
|
||||
url = https://github.com/fsprojects/atom-fsharp
|
||||
[submodule "vendor/grammars/SMT.tmbundle"]
|
||||
path = vendor/grammars/SMT.tmbundle
|
||||
url = https://github.com/SRI-CSL/SMT.tmbundle.git
|
||||
|
||||
@@ -2,9 +2,27 @@
|
||||
|
||||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. The majority of contributions won't need to touch any Ruby code at all.
|
||||
|
||||
|
||||
## Adding an extension to a language
|
||||
|
||||
We try only to add new extensions once they have some usage on GitHub. In most cases we prefer that extensions be in use in hundreds of repositories before supporting them in Linguist.
|
||||
|
||||
To add support for a new extension:
|
||||
|
||||
0. Add your extension to the language entry in [`languages.yml`][languages].
|
||||
0. Add at least one sample for your extension 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.
|
||||
|
||||
In addition, if this extension is already listed in [`languages.yml`][languages] then sometimes a few more steps will need to be taken:
|
||||
|
||||
0. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`.
|
||||
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping @arfon or @bkeepers to help with this) to ensure we're not misclassifying files.
|
||||
0. If the Bayesian classifier does a bad job with the sample `.yourextension` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
|
||||
|
||||
|
||||
## Adding a language
|
||||
|
||||
We try only to add languages once they have some usage on GitHub. In most cases we prefer that languages be in use in hundreds of repositories before supporting them in Linguist.
|
||||
We try only to add languages once they have some usage on GitHub. In most cases we prefer that each new file extension be in use in hundreds of repositories before supporting them in Linguist.
|
||||
|
||||
To add support for a new language:
|
||||
|
||||
@@ -23,12 +41,14 @@ In addition, if your new language defines an extension that's already listed in
|
||||
|
||||
Remember, the goal here is to try and avoid false positives!
|
||||
|
||||
|
||||
## Fixing a misclassified language
|
||||
|
||||
Most languages are detected by their file extension defined in [languages.yml][languages]. For disambiguating between files with common extensions, linguist applies some [heuristics](/lib/linguist/heuristics.rb) and a [statistical classifier](lib/linguist/classifier.rb). This process can help differentiate between, for example, `.h` files which could be either C, C++, or Obj-C.
|
||||
|
||||
Misclassifications can often be solved by either adding a new filename or extension for the language or adding more [samples][samples] to make the classifier smarter.
|
||||
|
||||
|
||||
## Fixing syntax highlighting
|
||||
|
||||
Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in [languages.yml][languages] is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting.
|
||||
@@ -55,6 +75,7 @@ Sometimes getting the tests running can be too much work, especially if you don'
|
||||
|
||||
Here's our current build status: [](http://travis-ci.org/github/linguist)
|
||||
|
||||
|
||||
## Releasing
|
||||
|
||||
If you are the current maintainer of this gem:
|
||||
|
||||
@@ -26,7 +26,7 @@ Linguist supports a number of different custom overrides strategies for language
|
||||
|
||||
### Using gitattributes
|
||||
|
||||
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override to set `linguist-documentation`, `linguist-language`, and `linguist-vendored`. `.gitattributes` will be used to determine language statistics, but will not be used to syntax highlight files. To manually set syntax highlighting, use [Vim or Emacs modelines](#using-emacs-and-vim-modelines).
|
||||
Add a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override to set `linguist-documentation`, `linguist-language`, and `linguist-vendored`. `.gitattributes` will be used to determine language statistics, but will not be used to syntax highlight files. To manually set syntax highlighting, use [Vim or Emacs modelines](#using-emacs-or-vim-modelines).
|
||||
|
||||
```
|
||||
$ cat .gitattributes
|
||||
|
||||
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'charlock_holmes', '~> 0.7.3'
|
||||
s.add_dependency 'escape_utils', '~> 1.1.0'
|
||||
s.add_dependency 'mime-types', '>= 1.19'
|
||||
s.add_dependency 'rugged', '~> 0.23.0b1'
|
||||
s.add_dependency 'rugged', '>= 0.23.0b'
|
||||
|
||||
s.add_development_dependency 'minitest', '>= 5.0'
|
||||
s.add_development_dependency 'mocha'
|
||||
|
||||
16
grammars.yml
16
grammars.yml
@@ -50,6 +50,8 @@ vendor/grammars/G-Code/:
|
||||
- source.gcode
|
||||
vendor/grammars/GDScript-sublime/:
|
||||
- source.gdscript
|
||||
vendor/grammars/Handlebars:
|
||||
- text.html.handlebars
|
||||
vendor/grammars/IDL-Syntax:
|
||||
- source.webidl
|
||||
vendor/grammars/InnoSetup/:
|
||||
@@ -83,6 +85,8 @@ vendor/grammars/Racket:
|
||||
- source.racket
|
||||
vendor/grammars/SCSS.tmbundle:
|
||||
- source.scss
|
||||
vendor/grammars/SMT.tmbundle:
|
||||
- source.smt
|
||||
vendor/grammars/Scalate.tmbundle:
|
||||
- source.scaml
|
||||
- text.html.ssp
|
||||
@@ -105,6 +109,8 @@ vendor/grammars/Sublime-Logos:
|
||||
- source.logos
|
||||
vendor/grammars/Sublime-Loom:
|
||||
- source.loomscript
|
||||
vendor/grammars/Sublime-Modula-2/:
|
||||
- source.modula2
|
||||
vendor/grammars/Sublime-Nit:
|
||||
- source.nit
|
||||
vendor/grammars/Sublime-QML:
|
||||
@@ -167,6 +173,8 @@ vendor/grammars/asp.tmbundle:
|
||||
vendor/grammars/assembly.tmbundle:
|
||||
- objdump.x86asm
|
||||
- source.x86asm
|
||||
vendor/grammars/atom-fsharp/:
|
||||
- source.fsharp
|
||||
vendor/grammars/atom-salt:
|
||||
- source.python.salt
|
||||
- source.yaml.salt
|
||||
@@ -213,6 +221,7 @@ vendor/grammars/d.tmbundle:
|
||||
vendor/grammars/dart-sublime-bundle:
|
||||
- source.dart
|
||||
- source.pubspec
|
||||
- text.dart-analysis-output
|
||||
- text.dart-doccomments
|
||||
vendor/grammars/desktop.tmbundle:
|
||||
- source.desktop
|
||||
@@ -245,8 +254,6 @@ vendor/grammars/fish-tmbundle:
|
||||
vendor/grammars/fortran.tmbundle:
|
||||
- source.fortran
|
||||
- source.fortran.modern
|
||||
vendor/grammars/fsharpbinding:
|
||||
- source.fsharp
|
||||
vendor/grammars/gap-tmbundle/:
|
||||
- source.gap
|
||||
vendor/grammars/gettext.tmbundle:
|
||||
@@ -318,6 +325,9 @@ vendor/grammars/language-hy:
|
||||
vendor/grammars/language-javascript:
|
||||
- source.js
|
||||
- source.js.regexp
|
||||
vendor/grammars/language-jsoniq/:
|
||||
- source.jq
|
||||
- source.xq
|
||||
vendor/grammars/language-python:
|
||||
- source.python
|
||||
- source.regexp.python
|
||||
@@ -444,6 +454,8 @@ vendor/grammars/scheme.tmbundle:
|
||||
- source.scheme
|
||||
vendor/grammars/scilab.tmbundle:
|
||||
- source.scilab
|
||||
vendor/grammars/smali-sublime/smali.tmLanguage:
|
||||
- source.smali
|
||||
vendor/grammars/smalltalk-tmbundle:
|
||||
- source.smalltalk
|
||||
vendor/grammars/sql.tmbundle:
|
||||
|
||||
@@ -65,11 +65,13 @@ module Linguist
|
||||
generated_net_docfile? ||
|
||||
generated_postscript? ||
|
||||
compiled_cython_file? ||
|
||||
generated_protocol_buffer_go? ||
|
||||
generated_go? ||
|
||||
generated_protocol_buffer? ||
|
||||
generated_apache_thrift? ||
|
||||
generated_jni_header? ||
|
||||
generated_unity3d_meta? ||
|
||||
vcr_cassette?
|
||||
vcr_cassette? ||
|
||||
generated_module? ||
|
||||
generated_unity3d_meta?
|
||||
end
|
||||
|
||||
# Internal: Is the blob an Xcode file?
|
||||
@@ -180,11 +182,11 @@ module Linguist
|
||||
def generated_net_designer_file?
|
||||
name.downcase =~ /\.designer\.cs$/
|
||||
end
|
||||
|
||||
|
||||
# Internal: Is this a codegen file for Specflow feature file?
|
||||
#
|
||||
# Visual Studio's SpecFlow extension generates *.feature.cs files
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# Let's hide them.
|
||||
#
|
||||
# Returns true or false
|
||||
@@ -232,11 +234,11 @@ module Linguist
|
||||
creator.include?("ImageMagick")
|
||||
end
|
||||
|
||||
def generated_protocol_buffer_go?
|
||||
def generated_go?
|
||||
return false unless extname == '.go'
|
||||
return false unless lines.count > 1
|
||||
|
||||
return lines[0].include?("Code generated by protoc-gen-go")
|
||||
return lines[0].include?("Code generated by")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a C++, Java or Python source file generated by the
|
||||
@@ -250,6 +252,16 @@ module Linguist
|
||||
return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
|
||||
end
|
||||
|
||||
# Internal: Is the blob generated by Apache Thrift compiler?
|
||||
#
|
||||
# Returns true or false
|
||||
def generated_apache_thrift?
|
||||
return false unless ['.rb', '.py', '.go', '.js', '.m', '.java', '.h', '.cc', '.cpp'].include?(extname)
|
||||
return false unless lines.count > 1
|
||||
|
||||
return lines[0].include?("Autogenerated by Thrift Compiler") || lines[1].include?("Autogenerated by Thrift Compiler")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a C/C++ header generated by the Java JNI tool javah?
|
||||
#
|
||||
# Returns true of false.
|
||||
@@ -313,6 +325,24 @@ module Linguist
|
||||
return lines[0].include?("Generated by Cython")
|
||||
end
|
||||
|
||||
# Internal: Is it a KiCAD or GFortran module file?
|
||||
#
|
||||
# KiCAD module files contain:
|
||||
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
|
||||
# on the first line.
|
||||
#
|
||||
# GFortran module files contain:
|
||||
# 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") ||
|
||||
lines[0].include?("GFORTRAN module version '")
|
||||
end
|
||||
|
||||
# Internal: Is this a metadata file from Unity3D?
|
||||
#
|
||||
# Unity3D Meta files start with:
|
||||
|
||||
@@ -274,6 +274,16 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "XML", "Modula-2", "Linux Kernel Module", "AMPL" do |data|
|
||||
if data.include?('<!ENTITY ')
|
||||
Language["XML"]
|
||||
elsif /MODULE\s\w+\s*;/i.match(data) || /^\s*END \w+;$/i.match(data)
|
||||
Language["Modula-2"]
|
||||
else
|
||||
[Language["Linux Kernel Module"], Language["AMPL"]]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "NL", "NewLisp" do |data|
|
||||
if /^(b|g)[0-9]+ /.match(data)
|
||||
Language["NL"]
|
||||
@@ -283,11 +293,39 @@ module Linguist
|
||||
end
|
||||
|
||||
disambiguate "Rust", "RenderScript" do |data|
|
||||
if data.include?("^(use |fn |mod |pub |macro_rules|impl|#!?\[)")
|
||||
if /^(use |fn |mod |pub |macro_rules|impl|#!?\[)/.match(data)
|
||||
Language["Rust"]
|
||||
elsif /#include|#pragma\s+(rs|version)|__attribute__/.match(data)
|
||||
Language["RenderScript"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "Common Lisp", "Lex", "Groff", "PicoLisp" do |data|
|
||||
if /\(def(un|macro)\s/.match(data)
|
||||
Language["Common Lisp"]
|
||||
elsif /^(%[%{}]xs|<.*>)/.match(data)
|
||||
Language["Lex"]
|
||||
elsif /^\.[a-z][a-z](\s|$)/i.match(data)
|
||||
Language["Groff"]
|
||||
elsif /^\((de|class|rel|code|data|must)\s/.match(data)
|
||||
Language["PicoLisp"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "Groff", "Nemerle" do |data|
|
||||
if /^[.']/.match(data)
|
||||
Language["Groff"]
|
||||
elsif /^(module|namespace|using)\s/.match(data)
|
||||
Language["Nemerle"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "GAS", "Groff" do |data|
|
||||
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
||||
Language["Groff"]
|
||||
elsif /((^|\s)move?[. ])|\.(include|globa?l)\s/.match(data)
|
||||
Language["GAS"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,6 +49,7 @@ AMPL:
|
||||
color: "#E6EFBB"
|
||||
extensions:
|
||||
- .ampl
|
||||
- .mod
|
||||
tm_scope: source.ampl
|
||||
ace_mode: text
|
||||
|
||||
@@ -160,6 +161,7 @@ ApacheConf:
|
||||
- apache
|
||||
extensions:
|
||||
- .apacheconf
|
||||
- .vhost
|
||||
tm_scope: source.apache-config
|
||||
ace_mode: apache_conf
|
||||
|
||||
@@ -224,6 +226,7 @@ Assembly:
|
||||
extensions:
|
||||
- .asm
|
||||
- .a51
|
||||
- .inc
|
||||
- .nasm
|
||||
tm_scope: source.asm.x86
|
||||
ace_mode: assembly_x86
|
||||
@@ -295,9 +298,10 @@ Befunge:
|
||||
|
||||
Bison:
|
||||
type: programming
|
||||
group: Yacc
|
||||
tm_scope: source.bison
|
||||
extensions:
|
||||
- .y
|
||||
- .bison
|
||||
ace_mode: text
|
||||
|
||||
BitBake:
|
||||
@@ -409,6 +413,7 @@ C++:
|
||||
- .hh
|
||||
- .hpp
|
||||
- .hxx
|
||||
- .inc
|
||||
- .inl
|
||||
- .ipp
|
||||
- .tcc
|
||||
@@ -600,6 +605,7 @@ Common Lisp:
|
||||
- .lisp
|
||||
- .asd
|
||||
- .cl
|
||||
- .l
|
||||
- .lsp
|
||||
- .ny
|
||||
- .podsl
|
||||
@@ -1038,6 +1044,7 @@ GAS:
|
||||
group: Assembly
|
||||
extensions:
|
||||
- .s
|
||||
- .ms
|
||||
tm_scope: source.asm.x86
|
||||
ace_mode: assembly_x86
|
||||
|
||||
@@ -1206,12 +1213,26 @@ Groff:
|
||||
extensions:
|
||||
- .man
|
||||
- '.1'
|
||||
- .1in
|
||||
- .1m
|
||||
- .1x
|
||||
- '.2'
|
||||
- '.3'
|
||||
- .3in
|
||||
- .3m
|
||||
- .3qt
|
||||
- .3x
|
||||
- '.4'
|
||||
- '.5'
|
||||
- '.6'
|
||||
- '.7'
|
||||
- '.8'
|
||||
- '.9'
|
||||
- .l
|
||||
- .ms
|
||||
- .n
|
||||
- .rno
|
||||
- .roff
|
||||
tm_scope: text.groff
|
||||
aliases:
|
||||
- nroff
|
||||
@@ -1251,6 +1272,7 @@ HTML:
|
||||
- .html
|
||||
- .htm
|
||||
- .html.hl
|
||||
- .inc
|
||||
- .st
|
||||
- .xht
|
||||
- .xhtml
|
||||
@@ -1319,7 +1341,7 @@ Handlebars:
|
||||
extensions:
|
||||
- .handlebars
|
||||
- .hbs
|
||||
tm_scope: none
|
||||
tm_scope: text.html.handlebars
|
||||
ace_mode: handlebars
|
||||
|
||||
Harbour:
|
||||
@@ -1341,7 +1363,7 @@ Haskell:
|
||||
Haxe:
|
||||
type: programming
|
||||
ace_mode: haxe
|
||||
color: "#f7941e"
|
||||
color: "#df7900"
|
||||
extensions:
|
||||
- .hx
|
||||
- .hxsl
|
||||
@@ -1457,6 +1479,14 @@ Isabelle:
|
||||
tm_scope: source.isabelle.theory
|
||||
ace_mode: text
|
||||
|
||||
Isabelle ROOT:
|
||||
type: programming
|
||||
group: Isabelle
|
||||
filenames:
|
||||
- ROOT
|
||||
tm_scope: source.isabelle.root
|
||||
ace_mode: text
|
||||
|
||||
J:
|
||||
type: programming
|
||||
color: "#9EEDFF"
|
||||
@@ -1468,6 +1498,7 @@ J:
|
||||
JFlex:
|
||||
type: programming
|
||||
color: "#DBCA00"
|
||||
group: Lex
|
||||
extensions:
|
||||
- .flex
|
||||
- .jflex
|
||||
@@ -1503,11 +1534,12 @@ JSONLD:
|
||||
tm_scope: source.js
|
||||
|
||||
JSONiq:
|
||||
color: "#40d47e"
|
||||
type: programming
|
||||
ace_mode: jsoniq
|
||||
extensions:
|
||||
- .jq
|
||||
tm_scope: source.xquery
|
||||
tm_scope: source.jq
|
||||
|
||||
Jade:
|
||||
group: HTML
|
||||
@@ -1618,7 +1650,7 @@ Kit:
|
||||
|
||||
Kotlin:
|
||||
type: programming
|
||||
color: "#EA4DFA"
|
||||
color: "#F18E33"
|
||||
extensions:
|
||||
- .kt
|
||||
- .ktm
|
||||
@@ -1703,6 +1735,17 @@ Less:
|
||||
tm_scope: source.css.less
|
||||
ace_mode: less
|
||||
|
||||
Lex:
|
||||
type: programming
|
||||
color: "#DBCA00"
|
||||
aliases:
|
||||
- flex
|
||||
extensions:
|
||||
- .l
|
||||
- .lex
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
LilyPond:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -1728,6 +1771,13 @@ Linker Script:
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
Linux Kernel Module:
|
||||
type: data
|
||||
extensions:
|
||||
- .mod
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
Liquid:
|
||||
type: markup
|
||||
extensions:
|
||||
@@ -1865,6 +1915,7 @@ Makefile:
|
||||
- .mk
|
||||
filenames:
|
||||
- GNUmakefile
|
||||
- Kbuild
|
||||
- Makefile
|
||||
- makefile
|
||||
interpreters:
|
||||
@@ -1993,6 +2044,13 @@ Modelica:
|
||||
tm_scope: source.modelica
|
||||
ace_mode: text
|
||||
|
||||
Modula-2:
|
||||
type: programming
|
||||
extensions:
|
||||
- .mod
|
||||
tm_scope: source.modula2
|
||||
ace_mode: text
|
||||
|
||||
Module Management System:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -2096,6 +2154,9 @@ Nginx:
|
||||
type: markup
|
||||
extensions:
|
||||
- .nginxconf
|
||||
- .vhost
|
||||
filenames:
|
||||
- nginx.conf
|
||||
tm_scope: source.nginx
|
||||
aliases:
|
||||
- nginx configuration file
|
||||
@@ -2322,6 +2383,7 @@ PHP:
|
||||
- .aw
|
||||
- .ctp
|
||||
- .fcgi
|
||||
- .inc
|
||||
- .php3
|
||||
- .php4
|
||||
- .php5
|
||||
@@ -2409,6 +2471,7 @@ Pascal:
|
||||
- .pas
|
||||
- .dfm
|
||||
- .dpr
|
||||
- .inc
|
||||
- .lpr
|
||||
- .pp
|
||||
ace_mode: pascal
|
||||
@@ -2420,6 +2483,7 @@ Perl:
|
||||
color: "#0298c3"
|
||||
extensions:
|
||||
- .pl
|
||||
- .al
|
||||
- .cgi
|
||||
- .fcgi
|
||||
- .perl
|
||||
@@ -2454,6 +2518,16 @@ Perl6:
|
||||
tm_scope: source.perl.6
|
||||
ace_mode: perl
|
||||
|
||||
PicoLisp:
|
||||
type: programming
|
||||
extensions:
|
||||
- .l
|
||||
interpreters:
|
||||
- picolisp
|
||||
- pil
|
||||
tm_scope: source.lisp
|
||||
ace_mode: lisp
|
||||
|
||||
PigLatin:
|
||||
type: programming
|
||||
color: "#fcd7de"
|
||||
@@ -2631,6 +2705,7 @@ QML:
|
||||
color: "#44a51c"
|
||||
extensions:
|
||||
- .qml
|
||||
- .qbs
|
||||
tm_scope: source.qml
|
||||
ace_mode: text
|
||||
|
||||
@@ -2721,7 +2796,7 @@ Racket:
|
||||
|
||||
Ragel in Ruby Host:
|
||||
type: programming
|
||||
color: "#e17600"
|
||||
color: "#9d5200"
|
||||
extensions:
|
||||
- .rl
|
||||
aliases:
|
||||
@@ -2828,6 +2903,8 @@ Ruby:
|
||||
- ruby
|
||||
- macruby
|
||||
- rake
|
||||
- jruby
|
||||
- rbx
|
||||
filenames:
|
||||
- .pryrc
|
||||
- Appraisals
|
||||
@@ -2870,6 +2947,25 @@ SCSS:
|
||||
extensions:
|
||||
- .scss
|
||||
|
||||
SMT:
|
||||
type: programming
|
||||
extensions:
|
||||
- .smt2
|
||||
- .smt
|
||||
interpreters:
|
||||
- boolector
|
||||
- cvc4
|
||||
- mathsat5
|
||||
- opensmt
|
||||
- smtinterpol
|
||||
- smt-rat
|
||||
- stp
|
||||
- verit
|
||||
- yices2
|
||||
- z3
|
||||
tm_scope: source.smt
|
||||
ace_mode: text
|
||||
|
||||
SPARQL:
|
||||
type: data
|
||||
tm_scope: source.sparql
|
||||
@@ -2895,6 +2991,7 @@ SQL:
|
||||
- .sql
|
||||
- .cql
|
||||
- .ddl
|
||||
- .inc
|
||||
- .prc
|
||||
- .tab
|
||||
- .udf
|
||||
@@ -3062,6 +3159,13 @@ Slim:
|
||||
- .slim
|
||||
ace_mode: text
|
||||
|
||||
Smali:
|
||||
type: programming
|
||||
extensions:
|
||||
- .smali
|
||||
ace_mode: text
|
||||
tm_scope: source.smali
|
||||
|
||||
Smalltalk:
|
||||
type: programming
|
||||
color: "#596706"
|
||||
@@ -3086,6 +3190,7 @@ SourcePawn:
|
||||
- sourcemod
|
||||
extensions:
|
||||
- .sp
|
||||
- .inc
|
||||
- .sma
|
||||
tm_scope: source.sp
|
||||
ace_mode: text
|
||||
@@ -3443,11 +3548,14 @@ XML:
|
||||
- .glade
|
||||
- .gml
|
||||
- .grxml
|
||||
- .iml
|
||||
- .ivy
|
||||
- .jelly
|
||||
- .kml
|
||||
- .launch
|
||||
- .mdpolicy
|
||||
- .mm
|
||||
- .mod
|
||||
- .mxml
|
||||
- .nproj
|
||||
- .nuspec
|
||||
@@ -3521,6 +3629,7 @@ XQuery:
|
||||
- .xqm
|
||||
- .xqy
|
||||
ace_mode: xquery
|
||||
tm_scope: source.xq
|
||||
|
||||
XS:
|
||||
type: programming
|
||||
@@ -3569,6 +3678,15 @@ YAML:
|
||||
- .yaml
|
||||
ace_mode: yaml
|
||||
|
||||
Yacc:
|
||||
type: programming
|
||||
extensions:
|
||||
- .y
|
||||
- .yacc
|
||||
- .yy
|
||||
tm_scope: source.bison
|
||||
ace_mode: text
|
||||
|
||||
Zephir:
|
||||
type: programming
|
||||
color: "#118f9e"
|
||||
|
||||
@@ -150,9 +150,10 @@ module Linguist
|
||||
next if delta.binary
|
||||
|
||||
if [:added, :modified].include? delta.status
|
||||
# Skip submodules
|
||||
# Skip submodules and symlinks
|
||||
mode = delta.new_file[:mode]
|
||||
next if (mode & 040000) != 0
|
||||
mode_format = (mode & 0170000)
|
||||
next if mode_format == 0120000 || mode_format == 040000 || mode_format == 0160000
|
||||
|
||||
blob = Linguist::LazyBlob.new(repository, delta.new_file[:oid], new, mode.to_s(8))
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
- 3rd[-_]?party/
|
||||
- vendors?/
|
||||
- extern(al)?/
|
||||
- (^|/)[Vv]+endor/
|
||||
|
||||
# Debian packaging
|
||||
- ^debian/
|
||||
@@ -163,12 +164,22 @@
|
||||
|
||||
## Obj-C ##
|
||||
|
||||
# Carthage
|
||||
- ^Carthage/
|
||||
|
||||
# Cocoapods
|
||||
- ^Pods/
|
||||
|
||||
# Sparkle
|
||||
- (^|/)Sparkle/
|
||||
|
||||
# Crashlytics
|
||||
- Crashlytics.framework/
|
||||
|
||||
# Fabric
|
||||
- Fabric.framework/
|
||||
|
||||
|
||||
## Groovy ##
|
||||
|
||||
# Gradle
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "4.5.5"
|
||||
VERSION = "4.5.8"
|
||||
end
|
||||
|
||||
58
samples/AMPL/CT2.mod
Normal file
58
samples/AMPL/CT2.mod
Normal file
@@ -0,0 +1,58 @@
|
||||
param num_beams; # number of beams
|
||||
|
||||
param num_rows >= 1, integer; # number of rows
|
||||
param num_cols >= 1, integer; # number of columns
|
||||
|
||||
set BEAMS := 1 .. num_beams; # set of beams
|
||||
|
||||
set ROWS := 1 .. num_rows; # set of rows
|
||||
set COLUMNS := 1 .. num_cols; # set of columns
|
||||
|
||||
# values for entries of each beam
|
||||
param beam_values {BEAMS, ROWS, COLUMNS} >= 0;
|
||||
|
||||
# values of tumor
|
||||
param tumor_values {ROWS, COLUMNS} >= 0;
|
||||
|
||||
# values of critical area
|
||||
param critical_values {ROWS, COLUMNS} >= 0;
|
||||
|
||||
# critical maximum dosage requirement
|
||||
param critical_max;
|
||||
|
||||
# tumor minimum dosage requirement
|
||||
param tumor_min;
|
||||
|
||||
# dosage scalar of each beam
|
||||
var X {i in BEAMS} >= 0;
|
||||
|
||||
|
||||
# define the tumor area which includes the locations where tumor exists
|
||||
set tumor_area := {k in ROWS, h in COLUMNS: tumor_values[k,h] > 0};
|
||||
|
||||
# define critical area
|
||||
set critical_area := {k in ROWS, h in COLUMNS: critical_values[k,h] > 0};
|
||||
|
||||
var S {(k,h) in tumor_area} >= 0;
|
||||
var T {(k,h) in critical_area} >= 0;
|
||||
|
||||
# maximize total dosage in tumor area
|
||||
maximize total_tumor_dosage: sum {i in BEAMS} sum {(k,h) in tumor_area} X[i] * beam_values[i,k,h];
|
||||
|
||||
# minimize total dosage in critical area
|
||||
minimize total_critical_dosage: sum {i in BEAMS} sum {(k,h) in critical_area} X[i] * beam_values[i,k,h];
|
||||
|
||||
# minimize total tumor slack
|
||||
minimize total_tumor_slack: sum {(k,h) in tumor_area} S[k,h];
|
||||
|
||||
# minimize total critical area slack
|
||||
minimize total_critical_slack: sum {(k,h) in critical_area} T[k,h];
|
||||
|
||||
# total dosage at each tumor location [k,h] should be >= min tumor dosage with slack variable
|
||||
subject to tumor_limit {(k,h) in tumor_area} : sum {i in BEAMS} X[i] * beam_values[i,k,h] == tumor_min - S[k,h];
|
||||
|
||||
# total dosage at each critical location [k,h] should be = max critical dosage with slack variable
|
||||
subject to critical_limit {(k,h) in critical_area} : sum {i in BEAMS} X[i] * beam_values[i,k,h] == critical_max + T[k,h];
|
||||
|
||||
|
||||
|
||||
17
samples/ApacheConf/apache.vhost
Normal file
17
samples/ApacheConf/apache.vhost
Normal file
@@ -0,0 +1,17 @@
|
||||
#######################
|
||||
# HOSTNAME
|
||||
######################
|
||||
|
||||
<VirtualHost 127.0.0.1:PORT>
|
||||
ServerAdmin patrick@heysparkbox.com
|
||||
DocumentRoot "/var/www/HOSTNAME"
|
||||
ServerName HOSTNAME
|
||||
|
||||
<Directory "/var/www/HOSTNAME">
|
||||
Options Indexes MultiViews FollowSymLinks
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
DirectoryIndex index.php
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
245
samples/Assembly/fp_sqr32_160_comba.inc
Normal file
245
samples/Assembly/fp_sqr32_160_comba.inc
Normal file
@@ -0,0 +1,245 @@
|
||||
|
||||
push r2
|
||||
dint
|
||||
nop
|
||||
bis #MPYDLYWRTEN,&MPY32CTL0
|
||||
bic #MPYDLY32,&MPY32CTL0
|
||||
mov #SUMEXT,r13
|
||||
clr r12
|
||||
|
||||
mov @r15+,r4
|
||||
mov @r15+,r5
|
||||
|
||||
mov @r15+,r6
|
||||
mov @r15+,r7
|
||||
|
||||
mov @r15+,r8
|
||||
mov @r15+,r9
|
||||
|
||||
mov @r15+,r10
|
||||
mov @r15+,r11
|
||||
|
||||
sub #2*8,r15
|
||||
|
||||
/* SELF_STEP_FIRST */
|
||||
mov r4,&MPY32L
|
||||
mov r5,&MPY32H
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*0(r14)
|
||||
mov &RES1,2*(0+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
|
||||
/* STEP_1 */
|
||||
mov r4,&MAC32L
|
||||
mov r5,&MAC32H
|
||||
mov r6,&OP2L
|
||||
mov r7,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r6,&OP2L
|
||||
mov r7,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*2(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(2+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* STEP_1 */
|
||||
mov r4,&MAC32L
|
||||
mov r5,&MAC32H
|
||||
mov r8,&OP2L
|
||||
mov r9,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r8,&OP2L
|
||||
mov r9,&OP2H
|
||||
|
||||
/* SELF_STEP */
|
||||
mov r6,&MAC32L
|
||||
mov r7,&MAC32H
|
||||
add @r13,r12
|
||||
mov r6,&OP2L
|
||||
mov r7,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*4(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(4+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* STEP_1 */
|
||||
mov r4,&MAC32L
|
||||
mov r5,&MAC32H
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
|
||||
/* STEP_2MORE */
|
||||
mov r6,&MAC32L
|
||||
mov r7,&MAC32H
|
||||
add @r13,r12
|
||||
mov r8,&OP2L
|
||||
mov r9,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r8,&OP2L
|
||||
mov r9,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*6(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(6+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* STEP_1 */
|
||||
mov r4,&MAC32L
|
||||
mov r5,&MAC32H
|
||||
mov 2*8(r15),&OP2L
|
||||
mov 2*9(r15),&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov 2*8(r15),&OP2L
|
||||
mov 2*9(r15),&OP2H
|
||||
|
||||
/* STEP_2MORE */
|
||||
mov r6,&MAC32L
|
||||
mov r7,&MAC32H
|
||||
add @r13,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
|
||||
/* SELF_STEP */
|
||||
mov r8,&MAC32L
|
||||
mov r9,&MAC32H
|
||||
add @r13,r12
|
||||
mov r8,&OP2L
|
||||
mov r9,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*8(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(8+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
mov 2*8(r15),r4
|
||||
mov 2*(8+1)(r15),r5
|
||||
|
||||
/* STEP_1 */
|
||||
mov r6,&MAC32L
|
||||
mov r7,&MAC32H
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
|
||||
/* STEP_2MORE */
|
||||
mov r8,&MAC32L
|
||||
mov r9,&MAC32H
|
||||
add @r13,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*10(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(10+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* STEP_1 */
|
||||
mov r8,&MAC32L
|
||||
mov r9,&MAC32H
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
|
||||
/* SELF_STEP */
|
||||
mov r10,&MAC32L
|
||||
mov r11,&MAC32H
|
||||
add @r13,r12
|
||||
mov r10,&OP2L
|
||||
mov r11,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*12(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(12+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* STEP_1 */
|
||||
mov r10,&MAC32L
|
||||
mov r11,&MAC32H
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
add &SUMEXT,r12
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*14(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(14+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* SELF_STEP_1 */
|
||||
mov r4,&MAC32L
|
||||
mov r5,&MAC32H
|
||||
mov r4,&OP2L
|
||||
mov r5,&OP2H
|
||||
|
||||
/* COLUMN_END */
|
||||
mov &RES0,2*16(r14)
|
||||
add @r13,r12
|
||||
mov &RES1,2*(16+1)(r14)
|
||||
mov &RES2,&RES0
|
||||
mov &RES3,&RES1
|
||||
mov r12,&RES2
|
||||
clr &RES3
|
||||
clr r12
|
||||
|
||||
/* END */
|
||||
mov &RES0,2*18(r14)
|
||||
mov &RES1,2*(18+1)(r14)
|
||||
pop r2
|
||||
eint
|
||||
170
samples/Assembly/lib.inc
Normal file
170
samples/Assembly/lib.inc
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; 显示 AL 中的数字
|
||||
; ------------------------------------------------------------------------
|
||||
DispAL:
|
||||
push ecx
|
||||
push edx
|
||||
push edi
|
||||
|
||||
mov edi, [dwDispPos]
|
||||
|
||||
mov ah, 0Fh ; 0000b: 黑底 1111b: 白字
|
||||
mov dl, al
|
||||
shr al, 4
|
||||
mov ecx, 2
|
||||
.begin:
|
||||
and al, 01111b
|
||||
cmp al, 9
|
||||
ja .1
|
||||
add al, '0'
|
||||
jmp .2
|
||||
.1:
|
||||
sub al, 0Ah
|
||||
add al, 'A'
|
||||
.2:
|
||||
mov [gs:edi], ax
|
||||
add edi, 2
|
||||
|
||||
mov al, dl
|
||||
loop .begin
|
||||
;add edi, 2
|
||||
|
||||
mov [dwDispPos], edi
|
||||
|
||||
pop edi
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
ret
|
||||
; DispAL 结束-------------------------------------------------------------
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; 显示一个整形数
|
||||
; ------------------------------------------------------------------------
|
||||
DispInt:
|
||||
mov eax, [esp + 4]
|
||||
shr eax, 24
|
||||
call DispAL
|
||||
|
||||
mov eax, [esp + 4]
|
||||
shr eax, 16
|
||||
call DispAL
|
||||
|
||||
mov eax, [esp + 4]
|
||||
shr eax, 8
|
||||
call DispAL
|
||||
|
||||
mov eax, [esp + 4]
|
||||
call DispAL
|
||||
|
||||
mov ah, 07h ; 0000b: 黑底 0111b: 灰字
|
||||
mov al, 'h'
|
||||
push edi
|
||||
mov edi, [dwDispPos]
|
||||
mov [gs:edi], ax
|
||||
add edi, 4
|
||||
mov [dwDispPos], edi
|
||||
pop edi
|
||||
|
||||
ret
|
||||
; DispInt 结束------------------------------------------------------------
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; 显示一个字符串
|
||||
; ------------------------------------------------------------------------
|
||||
DispStr:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov esi, [ebp + 8] ; pszInfo
|
||||
mov edi, [dwDispPos]
|
||||
mov ah, 0Fh
|
||||
.1:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .2
|
||||
cmp al, 0Ah ; 是回车吗?
|
||||
jnz .3
|
||||
push eax
|
||||
mov eax, edi
|
||||
mov bl, 160
|
||||
div bl
|
||||
and eax, 0FFh
|
||||
inc eax
|
||||
mov bl, 160
|
||||
mul bl
|
||||
mov edi, eax
|
||||
pop eax
|
||||
jmp .1
|
||||
.3:
|
||||
mov [gs:edi], ax
|
||||
add edi, 2
|
||||
jmp .1
|
||||
|
||||
.2:
|
||||
mov [dwDispPos], edi
|
||||
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
ret
|
||||
; DispStr 结束------------------------------------------------------------
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; 换行
|
||||
; ------------------------------------------------------------------------
|
||||
DispReturn:
|
||||
push szReturn
|
||||
call DispStr ;printf("\n");
|
||||
add esp, 4
|
||||
|
||||
ret
|
||||
; DispReturn 结束---------------------------------------------------------
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; 内存拷贝,仿 memcpy
|
||||
; ------------------------------------------------------------------------
|
||||
; void* MemCpy(void* es:pDest, void* ds:pSrc, int iSize);
|
||||
; ------------------------------------------------------------------------
|
||||
MemCpy:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push esi
|
||||
push edi
|
||||
push ecx
|
||||
|
||||
mov edi, [ebp + 8] ; Destination
|
||||
mov esi, [ebp + 12] ; Source
|
||||
mov ecx, [ebp + 16] ; Counter
|
||||
.1:
|
||||
cmp ecx, 0 ; 判断计数器
|
||||
jz .2 ; 计数器为零时跳出
|
||||
|
||||
mov al, [ds:esi] ; ┓
|
||||
inc esi ; ┃
|
||||
; ┣ 逐字节移动
|
||||
mov byte [es:edi], al ; ┃
|
||||
inc edi ; ┛
|
||||
|
||||
dec ecx ; 计数器减一
|
||||
jmp .1 ; 循环
|
||||
.2:
|
||||
mov eax, [ebp + 8] ; 返回值
|
||||
|
||||
pop ecx
|
||||
pop edi
|
||||
pop esi
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
|
||||
ret ; 函数结束,返回
|
||||
; MemCpy 结束-------------------------------------------------------------
|
||||
|
||||
321
samples/Assembly/macros.inc
Normal file
321
samples/Assembly/macros.inc
Normal file
@@ -0,0 +1,321 @@
|
||||
BLARGG_MACROS_INCLUDED = 1
|
||||
|
||||
; Allows extra error checking with modified version
|
||||
; of ca65. Otherwise acts like a constant of 0.
|
||||
ADDR = 0
|
||||
|
||||
; Switches to Segment and places Line there.
|
||||
; Line can be an .align directive, .res, .byte, etc.
|
||||
; Examples:
|
||||
; seg_data BSS, .align 256
|
||||
; seg_data RODATA, {message: .byte "Test",0}
|
||||
.macro seg_data Segment, Line
|
||||
.pushseg
|
||||
.segment .string(Segment)
|
||||
Line
|
||||
.popseg
|
||||
.endmacro
|
||||
|
||||
; Reserves Size bytes in Segment for Name.
|
||||
; If Size is omitted, reserves one byte.
|
||||
.macro seg_res Segment, Name, Size
|
||||
.ifblank Size
|
||||
seg_data Segment, Name: .res 1
|
||||
.else
|
||||
seg_data Segment, Name: .res Size
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
; Shortcuts for zeropage, bss, and stack
|
||||
.define zp_res seg_res ZEROPAGE,
|
||||
.define nv_res seg_res NVRAM,
|
||||
.define bss_res seg_res BSS,
|
||||
.define sp_res seg_res STACK,
|
||||
.define zp_byte zp_res
|
||||
|
||||
; Copies byte from Src to Addr. If Src begins with #,
|
||||
; it sets Addr to the immediate value.
|
||||
; Out: A = byte copied
|
||||
; Preserved: X, Y
|
||||
.macro mov Addr, Src
|
||||
lda Src
|
||||
sta Addr
|
||||
.endmacro
|
||||
|
||||
; Copies word from Src to Addr. If Src begins with #,
|
||||
; it sets Addr the immediate value.
|
||||
; Out: A = high byte of word
|
||||
; Preserved: X, Y
|
||||
.macro movw Addr, Src
|
||||
.if .match( .left( 1, {Src} ), # )
|
||||
lda #<(.right( .tcount( {Src} )-1, {Src} ))
|
||||
sta Addr
|
||||
lda #>(.right( .tcount( {Src} )-1, {Src} ))
|
||||
sta 1+(Addr)
|
||||
.else
|
||||
lda Src
|
||||
sta Addr
|
||||
lda 1+(Src)
|
||||
sta 1+(Addr)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
; Increments 16-bit value at Addr.
|
||||
; Out: EQ/NE based on resulting 16-bit value
|
||||
; Preserved: A, X, Y
|
||||
.macro incw Addr
|
||||
.local @Skip
|
||||
inc Addr
|
||||
bne @Skip
|
||||
inc 1+(Addr)
|
||||
@Skip:
|
||||
.endmacro
|
||||
|
||||
; Adds Src to word at Addr.
|
||||
; Out: A = high byte of result, carry set appropriately
|
||||
; Preserved: X, Y
|
||||
.macro addw Addr, Src
|
||||
.if .match( .left( 1, {Src} ), # )
|
||||
addw_ Addr,(.right( .tcount( {Src} )-1, {Src} ))
|
||||
.else
|
||||
lda Addr
|
||||
clc
|
||||
adc Src
|
||||
sta Addr
|
||||
|
||||
lda 1+(Addr)
|
||||
adc 1+(Src)
|
||||
sta 1+(Addr)
|
||||
.endif
|
||||
.endmacro
|
||||
.macro addw_ Addr, Imm
|
||||
lda Addr
|
||||
clc
|
||||
adc #<Imm
|
||||
sta Addr
|
||||
|
||||
;.if (Imm >> 8) <> 0
|
||||
lda 1+(Addr)
|
||||
adc #>Imm
|
||||
sta 1+(Addr)
|
||||
;.else
|
||||
; .local @Skip
|
||||
; bcc @Skip
|
||||
; inc 1+(Addr)
|
||||
;@Skip:
|
||||
;.endif
|
||||
.endmacro
|
||||
|
||||
; Splits list of words into tables of low and high bytes
|
||||
; Example: split_words foo, {$1234, $5678}
|
||||
; expands to:
|
||||
; foo_l: $34, $78
|
||||
; foo_h: $12, $56
|
||||
; foo_count = 2
|
||||
.macro split_words Label, Words
|
||||
.ident (.concat (.string(Label), "_l")): .lobytes Words
|
||||
.ident (.concat (.string(Label), "_h")): .hibytes Words
|
||||
.ident (.concat (.string(Label), "_count")) = * - .ident (.concat (.string(Label), "_h"))
|
||||
.endmacro
|
||||
|
||||
.macro SELECT Bool, True, False, Extra
|
||||
.ifndef Bool
|
||||
False Extra
|
||||
.elseif Bool <> 0
|
||||
True Extra
|
||||
.else
|
||||
False Extra
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
.macro DEFAULT Name, Value
|
||||
.ifndef Name
|
||||
Name = Value
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
.ifp02
|
||||
; 6502 doesn't define these alternate names
|
||||
.define blt bcc
|
||||
.define bge bcs
|
||||
.endif
|
||||
.define jlt jcc
|
||||
.define jge jcs
|
||||
|
||||
; Jxx Target = Bxx Target, except it can go farther than
|
||||
; 128 bytes. Implemented via branch around a JMP.
|
||||
|
||||
; Don't use ca65's longbranch, because they fail for @labels
|
||||
;.macpack longbranch
|
||||
|
||||
.macro jeq Target
|
||||
bne *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jne Target
|
||||
beq *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jmi Target
|
||||
bpl *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jpl Target
|
||||
bmi *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jcs Target
|
||||
bcc *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jcc Target
|
||||
bcs *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jvs Target
|
||||
bvc *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
.macro jvc Target
|
||||
bvs *+5
|
||||
jmp Target
|
||||
.endmacro
|
||||
|
||||
|
||||
; Passes constant data to routine in addr
|
||||
; Preserved: A, X, Y
|
||||
.macro jsr_with_addr routine,data
|
||||
.local Addr
|
||||
pha
|
||||
lda #<Addr
|
||||
sta addr
|
||||
lda #>Addr
|
||||
sta addr+1
|
||||
pla
|
||||
jsr routine
|
||||
seg_data RODATA,{Addr: data}
|
||||
.endmacro
|
||||
|
||||
; Calls routine multiple times, with A having the
|
||||
; value 'start' the first time, 'start+step' the
|
||||
; second time, up to 'end' for the last time.
|
||||
.macro for_loop routine,start,end,step
|
||||
.local @for_loop
|
||||
lda #start
|
||||
@for_loop:
|
||||
pha
|
||||
jsr routine
|
||||
pla
|
||||
clc
|
||||
adc #step
|
||||
cmp #<((end)+(step))
|
||||
bne @for_loop
|
||||
.endmacro
|
||||
|
||||
; Calls routine n times. The value of A in the routine
|
||||
; counts from 0 to n-1.
|
||||
.macro loop_n_times routine,n
|
||||
for_loop routine,0,n-1,+1
|
||||
.endmacro
|
||||
|
||||
; Same as for_loop, except uses 16-bit value in YX.
|
||||
; -256 <= step <= 255
|
||||
.macro for_loop16 routine,start,end,step
|
||||
.if (step) < -256 || (step) > 255
|
||||
.error "Step must be within -256 to 255"
|
||||
.endif
|
||||
.local @for_loop_skip
|
||||
.local @for_loop
|
||||
ldy #>(start)
|
||||
lda #<(start)
|
||||
@for_loop:
|
||||
tax
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
jsr routine
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
clc
|
||||
adc #step
|
||||
.if (step) > 0
|
||||
bcc @for_loop_skip
|
||||
iny
|
||||
.else
|
||||
bcs @for_loop_skip
|
||||
dey
|
||||
.endif
|
||||
@for_loop_skip:
|
||||
cmp #<((end)+(step))
|
||||
bne @for_loop
|
||||
cpy #>((end)+(step))
|
||||
bne @for_loop
|
||||
.endmacro
|
||||
|
||||
; Stores byte at addr
|
||||
; Preserved: X, Y
|
||||
.macro setb addr, byte
|
||||
lda #byte
|
||||
sta addr
|
||||
.endmacro
|
||||
|
||||
; Stores word at addr
|
||||
; Preserved: X, Y
|
||||
.macro setw addr, word
|
||||
lda #<(word)
|
||||
sta addr
|
||||
lda #>(word)
|
||||
sta addr+1
|
||||
.endmacro
|
||||
|
||||
; Loads XY with 16-bit immediate or value at address
|
||||
.macro ldxy Arg
|
||||
.if .match( .left( 1, {Arg} ), # )
|
||||
ldy #<(.right( .tcount( {Arg} )-1, {Arg} ))
|
||||
ldx #>(.right( .tcount( {Arg} )-1, {Arg} ))
|
||||
.else
|
||||
ldy (Arg)
|
||||
ldx (Arg)+1
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
; Increments XY as 16-bit register, in CONSTANT time.
|
||||
; Z flag set based on entire result.
|
||||
; Preserved: A
|
||||
; Time: 7 clocks
|
||||
.macro inxy
|
||||
iny ; 2
|
||||
beq *+4 ; 3
|
||||
; -1
|
||||
bne *+3 ; 3
|
||||
; -1
|
||||
inx ; 2
|
||||
.endmacro
|
||||
|
||||
; Negates A and adds it to operand
|
||||
.macro subaf Operand
|
||||
eor #$FF
|
||||
sec
|
||||
adc Operand
|
||||
.endmacro
|
||||
|
||||
; Initializes CPU registers to reasonable values
|
||||
; Preserved: A, Y
|
||||
.macro init_cpu_regs
|
||||
sei
|
||||
cld ; unnecessary on NES, but might help on clone
|
||||
ldx #$FF
|
||||
txs
|
||||
.ifndef BUILD_NSF
|
||||
inx
|
||||
stx PPUCTRL
|
||||
.endif
|
||||
.endmacro
|
||||
57
samples/C++/ClasspathVMSystemProperties.inc
Normal file
57
samples/C++/ClasspathVMSystemProperties.inc
Normal file
@@ -0,0 +1,57 @@
|
||||
//===- ClasspathVMSystem/Properties.cpp -----------------------------------===//
|
||||
//===--------------------- GNU classpath gnu/classpath/VMSystemProperties -===//
|
||||
//
|
||||
// The VMKit project
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "Classpath.h"
|
||||
#include "JavaArray.h"
|
||||
#include "JavaClass.h"
|
||||
#include "JavaObject.h"
|
||||
#include "JavaThread.h"
|
||||
#include "JavaUpcalls.h"
|
||||
#include "Jnjvm.h"
|
||||
|
||||
#include "SetProperties.inc"
|
||||
|
||||
using namespace j3;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_classpath_VMSystemProperties_preInit(
|
||||
#ifdef NATIVE_JNI
|
||||
JNIEnv *env,
|
||||
jclass clazz,
|
||||
#endif
|
||||
JavaObject* prop) {
|
||||
|
||||
llvm_gcroot(prop, 0);
|
||||
|
||||
BEGIN_NATIVE_EXCEPTION(0)
|
||||
|
||||
setProperties(prop);
|
||||
|
||||
END_NATIVE_EXCEPTION
|
||||
}
|
||||
|
||||
extern "C" void Java_gnu_classpath_VMSystemProperties_postInit__Ljava_util_Properties_2(JavaObject* prop) {
|
||||
|
||||
llvm_gcroot(prop, 0);
|
||||
|
||||
BEGIN_NATIVE_EXCEPTION(0)
|
||||
|
||||
setCommandLineProperties(prop);
|
||||
|
||||
END_NATIVE_EXCEPTION
|
||||
}
|
||||
|
||||
}
|
||||
2764
samples/C++/initClasses.inc
Normal file
2764
samples/C++/initClasses.inc
Normal file
File diff suppressed because it is too large
Load Diff
34
samples/C++/instances.inc
Normal file
34
samples/C++/instances.inc
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "QPBO.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4661)
|
||||
#endif
|
||||
|
||||
// Instantiations
|
||||
|
||||
template class QPBO<int>;
|
||||
template class QPBO<float>;
|
||||
template class QPBO<double>;
|
||||
|
||||
template <>
|
||||
inline void QPBO<int>::get_type_information(char*& type_name, char*& type_format)
|
||||
{
|
||||
type_name = "int";
|
||||
type_format = "d";
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void QPBO<float>::get_type_information(char*& type_name, char*& type_format)
|
||||
{
|
||||
type_name = "float";
|
||||
type_format = "f";
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void QPBO<double>::get_type_information(char*& type_name, char*& type_format)
|
||||
{
|
||||
type_name = "double";
|
||||
type_format = "Lf";
|
||||
}
|
||||
|
||||
|
||||
164
samples/Common Lisp/array.l
Normal file
164
samples/Common Lisp/array.l
Normal file
@@ -0,0 +1,164 @@
|
||||
;;; -*- Mode: Lisp; Package: LISP -*-
|
||||
;;;
|
||||
;;; This file is part of xyzzy.
|
||||
;;;
|
||||
|
||||
(provide "array")
|
||||
|
||||
(in-package "lisp")
|
||||
|
||||
(export '(make-vector make-array vector array-dimensions array-in-bounds-p
|
||||
upgraded-array-element-type adjust-array))
|
||||
|
||||
(defun upgraded-array-element-type (type)
|
||||
(cond ((or (eq type 't)
|
||||
(null type))
|
||||
't)
|
||||
((member type '(character base-character standard-char
|
||||
extended-character) :test #'eq)
|
||||
'character)
|
||||
(t
|
||||
(setq type (car (si:canonicalize-type type)))
|
||||
(cond ((or (eq type 't)
|
||||
(null type))
|
||||
't)
|
||||
((member type '(character base-character standard-char
|
||||
extended-character) :test #'eq)
|
||||
'character)
|
||||
(t 't)))))
|
||||
|
||||
(defun check-array-initialize-option (ies-p ics-p displaced-to)
|
||||
(let ((x 0))
|
||||
(and ies-p (incf x))
|
||||
(and ics-p (incf x))
|
||||
(and displaced-to (incf x))
|
||||
(when (> x 1)
|
||||
(error ":initial-element, :initial-contents, :displaced-to"))))
|
||||
|
||||
(defun make-vector (length &key
|
||||
(element-type t)
|
||||
(initial-element nil ies-p)
|
||||
(initial-contents nil ics-p)
|
||||
fill-pointer
|
||||
adjustable
|
||||
displaced-to
|
||||
(displaced-index-offset 0))
|
||||
(setq element-type (upgraded-array-element-type element-type))
|
||||
(check-array-initialize-option ies-p ics-p displaced-to)
|
||||
(let ((vector (si:*make-vector length element-type initial-element adjustable
|
||||
fill-pointer displaced-to displaced-index-offset)))
|
||||
(when ics-p
|
||||
(si:*copy-into-seq vector initial-contents))
|
||||
vector))
|
||||
|
||||
(defun make-array (dimensions &rest rest
|
||||
&key
|
||||
(element-type t)
|
||||
(initial-element nil ies-p)
|
||||
(initial-contents nil ics-p)
|
||||
fill-pointer
|
||||
adjustable
|
||||
displaced-to
|
||||
(displaced-index-offset 0))
|
||||
(cond ((integerp dimensions)
|
||||
(apply #'make-vector dimensions rest))
|
||||
((= (length dimensions) 1)
|
||||
(apply #'make-vector (car dimensions) rest))
|
||||
(t
|
||||
(setq element-type (upgraded-array-element-type element-type))
|
||||
(check-array-initialize-option ies-p ics-p displaced-to)
|
||||
(when fill-pointer
|
||||
(error ":fill-pointer"))
|
||||
(let ((array (si:*make-array dimensions element-type
|
||||
initial-element adjustable
|
||||
displaced-to displaced-index-offset)))
|
||||
(when ics-p
|
||||
(let ((dims (make-list (array-rank array)
|
||||
:initial-element 0))
|
||||
(stack (list initial-contents))
|
||||
(rank (1- (array-rank array))))
|
||||
(dolist (x dims)
|
||||
(push (elt (car stack) 0) stack))
|
||||
(dotimes (i (array-total-size array))
|
||||
(setf (row-major-aref array i) (car stack))
|
||||
(do ((x dims (cdr x))
|
||||
(j rank (1- j)))
|
||||
((null x))
|
||||
(pop stack)
|
||||
(incf (car x))
|
||||
(when (< (car x) (array-dimension array j))
|
||||
(do ((r (- rank j) (1- r)))
|
||||
((< r 0))
|
||||
(push (elt (car stack) (nth r dims)) stack))
|
||||
(return))
|
||||
(setf (car x) 0)))))
|
||||
array))))
|
||||
|
||||
(defun vector (&rest list)
|
||||
(make-vector (length list) :element-type t :initial-contents list))
|
||||
|
||||
(defun array-dimensions (array)
|
||||
(do ((i (1- (array-rank array)) (1- i))
|
||||
(dims '()))
|
||||
((minusp i) dims)
|
||||
(push (array-dimension array i) dims)))
|
||||
|
||||
(defun array-in-bounds-p (array &rest subscripts)
|
||||
(let ((r (array-rank array)))
|
||||
(when (/= r (length subscripts))
|
||||
(error "subscripts: ~S" subscripts))
|
||||
(do ((i 0 (1+ i))
|
||||
(s subscripts (cdr s)))
|
||||
((= i r) t)
|
||||
(unless (<= 0 (car s) (1- (array-dimension array i)))
|
||||
(return nil)))))
|
||||
|
||||
(defun adjust-array (old-array
|
||||
dimensions
|
||||
&rest rest
|
||||
&key
|
||||
(element-type nil ets-p)
|
||||
initial-element
|
||||
(initial-contents nil ics-p)
|
||||
(fill-pointer nil fps-p)
|
||||
displaced-to
|
||||
displaced-index-offset)
|
||||
(when (/= (length dimensions) (array-rank old-array))
|
||||
(error "?"))
|
||||
(unless ets-p
|
||||
(push (array-element-type old-array) rest)
|
||||
(push :element-type rest))
|
||||
(when (adjustable-array-p old-array)
|
||||
(push t rest)
|
||||
(push :adjustable rest))
|
||||
(cond (fps-p
|
||||
(unless (array-has-fill-pointer-p old-array)
|
||||
(error "?")))
|
||||
(t
|
||||
(when (array-has-fill-pointer-p old-array)
|
||||
(push (fill-pointer old-array) rest)
|
||||
(push :fill-pointer rest))))
|
||||
(when (eq old-array displaced-to)
|
||||
(error "?"))
|
||||
(let ((new-array (apply #'make-array dimensions rest)))
|
||||
(or ics-p displaced-to
|
||||
(copy-array-partially old-array new-array))
|
||||
(cond ((adjustable-array-p old-array)
|
||||
(si:*replace-array old-array new-array)
|
||||
old-array)
|
||||
(t
|
||||
new-array))))
|
||||
|
||||
(defun copy-array-partially (src dst)
|
||||
(let* ((dims (mapcar #'min (array-dimensions src) (array-dimensions dst)))
|
||||
(r (array-rank src))
|
||||
(s (make-list r :initial-element 0)))
|
||||
(setq r (1- r))
|
||||
(dotimes (x (apply #'* dims))
|
||||
(setf (apply #'aref dst s) (apply #'aref src s))
|
||||
(do ((i r (1- i)))
|
||||
((minusp i))
|
||||
(incf (nth i s))
|
||||
(when (< (nth i s) (nth i dims))
|
||||
(return))
|
||||
(setf (nth i s) 0)))))
|
||||
1201
samples/Common Lisp/common.l
Normal file
1201
samples/Common Lisp/common.l
Normal file
File diff suppressed because it is too large
Load Diff
25912
samples/G-code/lm.g
25912
samples/G-code/lm.g
File diff suppressed because it is too large
Load Diff
29735
samples/G-code/rm.g
29735
samples/G-code/rm.g
File diff suppressed because it is too large
Load Diff
91
samples/GAS/hello.ms
Normal file
91
samples/GAS/hello.ms
Normal file
@@ -0,0 +1,91 @@
|
||||
# output(): Hello, world.\n
|
||||
# mach(): all
|
||||
|
||||
# Emit hello world while switching back and forth between arm/thumb.
|
||||
# ??? Unfinished
|
||||
|
||||
.macro invalid
|
||||
# This is "undefined" but it's not properly decoded yet.
|
||||
.word 0x07ffffff
|
||||
# This is stc which isn't recognized yet.
|
||||
stc 0,cr0,[r0]
|
||||
.endm
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
# Run some simple insns to confirm the engine is at least working.
|
||||
nop
|
||||
|
||||
# Skip over output text.
|
||||
|
||||
bl skip_output
|
||||
|
||||
hello_text:
|
||||
.asciz "Hello, world.\n"
|
||||
|
||||
.p2align 2
|
||||
skip_output:
|
||||
|
||||
# Prime loop.
|
||||
|
||||
mov r4, r14
|
||||
|
||||
output_next:
|
||||
|
||||
# Switch arm->thumb to output next chacter.
|
||||
# At this point r4 must point to the next character to output.
|
||||
|
||||
adr r0, into_thumb + 1
|
||||
bx r0
|
||||
|
||||
into_thumb:
|
||||
.thumb
|
||||
|
||||
# Output a character.
|
||||
|
||||
mov r0,#3 @ writec angel call
|
||||
mov r1,r4
|
||||
swi 0xab @ ??? Confirm number.
|
||||
|
||||
# Switch thumb->arm.
|
||||
|
||||
adr r5, back_to_arm
|
||||
bx r5
|
||||
|
||||
.p2align 2
|
||||
back_to_arm:
|
||||
.arm
|
||||
|
||||
# Load next character, see if done.
|
||||
|
||||
add r4,r4,#1
|
||||
sub r3,r3,r3
|
||||
ldrb r5,[r4,r3]
|
||||
teq r5,#0
|
||||
beq done
|
||||
|
||||
# Output a character (in arm mode).
|
||||
|
||||
mov r0,#3
|
||||
mov r1,r4
|
||||
swi #0x123456
|
||||
|
||||
# Load next character, see if done.
|
||||
|
||||
add r4,r4,#1
|
||||
sub r3,r3,r3
|
||||
ldrb r5,[r4,r3]
|
||||
teq r5,#0
|
||||
bne output_next
|
||||
|
||||
done:
|
||||
mov r0,#0x18
|
||||
ldr r1,exit_code
|
||||
swi #0x123456
|
||||
|
||||
# If that fails, try to die with an invalid insn.
|
||||
|
||||
invalid
|
||||
|
||||
exit_code:
|
||||
.word 0x20026
|
||||
852
samples/Go/embedded.go
Normal file
852
samples/Go/embedded.go
Normal file
File diff suppressed because one or more lines are too long
18
samples/Go/gen-go-linguist-thrift.go
Normal file
18
samples/Go/gen-go-linguist-thrift.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package linguist
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = bytes.Equal
|
||||
|
||||
func init() {
|
||||
}
|
||||
275
samples/Groff/Tcl.n
Normal file
275
samples/Groff/Tcl.n
Normal file
@@ -0,0 +1,275 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
||||
'\"
|
||||
'\" See the file "license.terms" for information on usage and redistribution
|
||||
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
'\"
|
||||
.TH Tcl n "8.6" Tcl "Tcl Built-In Commands"
|
||||
.so man.macros
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl \- Tool Command Language
|
||||
.SH SYNOPSIS
|
||||
Summary of Tcl language syntax.
|
||||
.BE
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The following rules define the syntax and semantics of the Tcl language:
|
||||
.IP "[1] \fBCommands.\fR"
|
||||
A Tcl script is a string containing one or more commands.
|
||||
Semi-colons and newlines are command separators unless quoted as
|
||||
described below.
|
||||
Close brackets are command terminators during command substitution
|
||||
(see below) unless quoted.
|
||||
.IP "[2] \fBEvaluation.\fR"
|
||||
A command is evaluated in two steps.
|
||||
First, the Tcl interpreter breaks the command into \fIwords\fR
|
||||
and performs substitutions as described below.
|
||||
These substitutions are performed in the same way for all
|
||||
commands.
|
||||
Secondly, the first word is used to locate a command procedure to
|
||||
carry out the command, then all of the words of the command are
|
||||
passed to the command procedure.
|
||||
The command procedure is free to interpret each of its words
|
||||
in any way it likes, such as an integer, variable name, list,
|
||||
or Tcl script.
|
||||
Different commands interpret their words differently.
|
||||
.IP "[3] \fBWords.\fR"
|
||||
Words of a command are separated by white space (except for
|
||||
newlines, which are command separators).
|
||||
.IP "[4] \fBDouble quotes.\fR"
|
||||
If the first character of a word is double-quote
|
||||
.PQ \N'34'
|
||||
then the word is terminated by the next double-quote character.
|
||||
If semi-colons, close brackets, or white space characters
|
||||
(including newlines) appear between the quotes then they are treated
|
||||
as ordinary characters and included in the word.
|
||||
Command substitution, variable substitution, and backslash substitution
|
||||
are performed on the characters between the quotes as described below.
|
||||
The double-quotes are not retained as part of the word.
|
||||
.IP "[5] \fBArgument expansion.\fR"
|
||||
If a word starts with the string
|
||||
.QW {*}
|
||||
followed by a non-whitespace character, then the leading
|
||||
.QW {*}
|
||||
is removed and the rest of the word is parsed and substituted as any other
|
||||
word. After substitution, the word is parsed as a list (without command or
|
||||
variable substitutions; backslash substitutions are performed as is normal for
|
||||
a list and individual internal words may be surrounded by either braces or
|
||||
double-quote characters), and its words are added to the command being
|
||||
substituted. For instance,
|
||||
.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}"
|
||||
is equivalent to
|
||||
.QW "cmd a b {[c]} d {$e} f {g h}" .
|
||||
.IP "[6] \fBBraces.\fR"
|
||||
If the first character of a word is an open brace
|
||||
.PQ {
|
||||
and rule [5] does not apply, then
|
||||
the word is terminated by the matching close brace
|
||||
.PQ } "" .
|
||||
Braces nest within the word: for each additional open
|
||||
brace there must be an additional close brace (however,
|
||||
if an open brace or close brace within the word is
|
||||
quoted with a backslash then it is not counted in locating the
|
||||
matching close brace).
|
||||
No substitutions are performed on the characters between the
|
||||
braces except for backslash-newline substitutions described
|
||||
below, nor do semi-colons, newlines, close brackets,
|
||||
or white space receive any special interpretation.
|
||||
The word will consist of exactly the characters between the
|
||||
outer braces, not including the braces themselves.
|
||||
.IP "[7] \fBCommand substitution.\fR"
|
||||
If a word contains an open bracket
|
||||
.PQ [
|
||||
then Tcl performs \fIcommand substitution\fR.
|
||||
To do this it invokes the Tcl interpreter recursively to process
|
||||
the characters following the open bracket as a Tcl script.
|
||||
The script may contain any number of commands and must be terminated
|
||||
by a close bracket
|
||||
.PQ ] "" .
|
||||
The result of the script (i.e. the result of its last command) is
|
||||
substituted into the word in place of the brackets and all of the
|
||||
characters between them.
|
||||
There may be any number of command substitutions in a single word.
|
||||
Command substitution is not performed on words enclosed in braces.
|
||||
.IP "[8] \fBVariable substitution.\fR"
|
||||
If a word contains a dollar-sign
|
||||
.PQ $
|
||||
followed by one of the forms
|
||||
described below, then Tcl performs \fIvariable
|
||||
substitution\fR: the dollar-sign and the following characters are
|
||||
replaced in the word by the value of a variable.
|
||||
Variable substitution may take any of the following forms:
|
||||
.RS
|
||||
.TP 15
|
||||
\fB$\fIname\fR
|
||||
.
|
||||
\fIName\fR is the name of a scalar variable; the name is a sequence
|
||||
of one or more characters that are a letter, digit, underscore,
|
||||
or namespace separators (two or more colons).
|
||||
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
|
||||
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
|
||||
.TP 15
|
||||
\fB$\fIname\fB(\fIindex\fB)\fR
|
||||
.
|
||||
\fIName\fR gives the name of an array variable and \fIindex\fR gives
|
||||
the name of an element within that array.
|
||||
\fIName\fR must contain only letters, digits, underscores, and
|
||||
namespace separators, and may be an empty string.
|
||||
Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR,
|
||||
\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR).
|
||||
Command substitutions, variable substitutions, and backslash
|
||||
substitutions are performed on the characters of \fIindex\fR.
|
||||
.TP 15
|
||||
\fB${\fIname\fB}\fR
|
||||
.
|
||||
\fIName\fR is the name of a scalar variable or array element. It may contain
|
||||
any characters whatsoever except for close braces. It indicates an array
|
||||
element if \fIname\fR is in the form
|
||||
.QW \fIarrayName\fB(\fIindex\fB)\fR
|
||||
where \fIarrayName\fR does not contain any open parenthesis characters,
|
||||
.QW \fB(\fR ,
|
||||
or close brace characters,
|
||||
.QW \fB}\fR ,
|
||||
and \fIindex\fR can be any sequence of characters except for close brace
|
||||
characters. No further
|
||||
substitutions are performed during the parsing of \fIname\fR.
|
||||
.PP
|
||||
There may be any number of variable substitutions in a single word.
|
||||
Variable substitution is not performed on words enclosed in braces.
|
||||
.PP
|
||||
Note that variables may contain character sequences other than those listed
|
||||
above, but in that case other mechanisms must be used to access them (e.g.,
|
||||
via the \fBset\fR command's single-argument form).
|
||||
.RE
|
||||
.IP "[9] \fBBackslash substitution.\fR"
|
||||
If a backslash
|
||||
.PQ \e
|
||||
appears within a word then \fIbackslash substitution\fR occurs.
|
||||
In all cases but those described below the backslash is dropped and
|
||||
the following character is treated as an ordinary
|
||||
character and included in the word.
|
||||
This allows characters such as double quotes, close brackets,
|
||||
and dollar signs to be included in words without triggering
|
||||
special processing.
|
||||
The following table lists the backslash sequences that are
|
||||
handled specially, along with the value that replaces each sequence.
|
||||
.RS
|
||||
.TP 7
|
||||
\e\fBa\fR
|
||||
Audible alert (bell) (Unicode U+000007).
|
||||
.TP 7
|
||||
\e\fBb\fR
|
||||
Backspace (Unicode U+000008).
|
||||
.TP 7
|
||||
\e\fBf\fR
|
||||
Form feed (Unicode U+00000C).
|
||||
.TP 7
|
||||
\e\fBn\fR
|
||||
Newline (Unicode U+00000A).
|
||||
.TP 7
|
||||
\e\fBr\fR
|
||||
Carriage-return (Unicode U+00000D).
|
||||
.TP 7
|
||||
\e\fBt\fR
|
||||
Tab (Unicode U+000009).
|
||||
.TP 7
|
||||
\e\fBv\fR
|
||||
Vertical tab (Unicode U+00000B).
|
||||
.TP 7
|
||||
\e\fB<newline>\fIwhiteSpace\fR
|
||||
.
|
||||
A single space character replaces the backslash, newline, and all spaces
|
||||
and tabs after the newline. This backslash sequence is unique in that it
|
||||
is replaced in a separate pre-pass before the command is actually parsed.
|
||||
This means that it will be replaced even when it occurs between braces,
|
||||
and the resulting space will be treated as a word separator if it is not
|
||||
in braces or quotes.
|
||||
.TP 7
|
||||
\e\e
|
||||
Backslash
|
||||
.PQ \e "" .
|
||||
.TP 7
|
||||
\e\fIooo\fR
|
||||
.
|
||||
The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal
|
||||
value for the Unicode character that will be inserted, in the range
|
||||
\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF).
|
||||
The parser will stop just before this range overflows, or when
|
||||
the maximum of three digits is reached. The upper bits of the Unicode
|
||||
character will be 0.
|
||||
.TP 7
|
||||
\e\fBx\fIhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit
|
||||
hexadecimal value for the Unicode character that will be inserted. The upper
|
||||
bits of the Unicode character will be 0 (i.e., the character will be in the
|
||||
range U+000000\(enU+0000FF).
|
||||
.TP 7
|
||||
\e\fBu\fIhhhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a
|
||||
sixteen-bit hexadecimal value for the Unicode character that will be
|
||||
inserted. The upper bits of the Unicode character will be 0 (i.e., the
|
||||
character will be in the range U+000000\(enU+00FFFF).
|
||||
.TP 7
|
||||
\e\fBU\fIhhhhhhhh\fR
|
||||
.
|
||||
The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a
|
||||
twenty-one-bit hexadecimal value for the Unicode character that will be
|
||||
inserted, in the range U+000000\(enU+10FFFF. The parser will stop just
|
||||
before this range overflows, or when the maximum of eight digits
|
||||
is reached. The upper bits of the Unicode character will be 0.
|
||||
.RS
|
||||
.PP
|
||||
The range U+010000\(enU+10FFFD is reserved for the future.
|
||||
.RE
|
||||
.PP
|
||||
Backslash substitution is not performed on words enclosed in braces,
|
||||
except for backslash-newline as described above.
|
||||
.RE
|
||||
.IP "[10] \fBComments.\fR"
|
||||
If a hash character
|
||||
.PQ #
|
||||
appears at a point where Tcl is
|
||||
expecting the first character of the first word of a command,
|
||||
then the hash character and the characters that follow it, up
|
||||
through the next newline, are treated as a comment and ignored.
|
||||
The comment character only has significance when it appears
|
||||
at the beginning of a command.
|
||||
.IP "[11] \fBOrder of substitution.\fR"
|
||||
Each character is processed exactly once by the Tcl interpreter
|
||||
as part of creating the words of a command.
|
||||
For example, if variable substitution occurs then no further
|
||||
substitutions are performed on the value of the variable; the
|
||||
value is inserted into the word verbatim.
|
||||
If command substitution occurs then the nested command is
|
||||
processed entirely by the recursive call to the Tcl interpreter;
|
||||
no substitutions are performed before making the recursive
|
||||
call and no additional substitutions are performed on the result
|
||||
of the nested script.
|
||||
.RS
|
||||
.PP
|
||||
Substitutions take place from left to right, and each substitution is
|
||||
evaluated completely before attempting to evaluate the next. Thus, a
|
||||
sequence like
|
||||
.PP
|
||||
.CS
|
||||
set y [set x 0][incr x][incr x]
|
||||
.CE
|
||||
.PP
|
||||
will always set the variable \fIy\fR to the value, \fI012\fR.
|
||||
.RE
|
||||
.IP "[12] \fBSubstitution and word boundaries.\fR"
|
||||
Substitutions do not affect the word boundaries of a command,
|
||||
except for argument expansion as specified in rule [5].
|
||||
For example, during variable substitution the entire value of
|
||||
the variable becomes part of a single word, even if the variable's
|
||||
value contains spaces.
|
||||
.SH KEYWORDS
|
||||
backslash, command, comment, script, substitution, variable
|
||||
'\" Local Variables:
|
||||
'\" mode: nroff
|
||||
'\" fill-column: 78
|
||||
'\" End:
|
||||
135
samples/Groff/create_view.l
Normal file
135
samples/Groff/create_view.l
Normal file
@@ -0,0 +1,135 @@
|
||||
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $
|
||||
.TH "CREATE VIEW" "" "2005-11-05" "SQL - Language Statements" "SQL Commands"
|
||||
.SH NAME
|
||||
CREATE VIEW \- define a new view
|
||||
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
.nf
|
||||
CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW \fIname\fR [ ( \fIcolumn_name\fR [, ...] ) ]
|
||||
AS \fIquery\fR
|
||||
.sp
|
||||
.fi
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
\fBCREATE VIEW\fR defines a view of a query. The view
|
||||
is not physically materialized. Instead, the query is run every time
|
||||
the view is referenced in a query.
|
||||
.PP
|
||||
\fBCREATE OR REPLACE VIEW\fR is similar, but if a view
|
||||
of the same name already exists, it is replaced. You can only replace
|
||||
a view with a new query that generates the identical set of columns
|
||||
(i.e., same column names and data types).
|
||||
.PP
|
||||
If a schema name is given (for example, CREATE VIEW
|
||||
myschema.myview ...) then the view is created in the specified
|
||||
schema. Otherwise it is created in the current schema. Temporary
|
||||
views exist in a special schema, so a schema name may not be given
|
||||
when creating a temporary view. The name of the view must be
|
||||
distinct from the name of any other view, table, sequence, or index
|
||||
in the same schema.
|
||||
.SH "PARAMETERS"
|
||||
.TP
|
||||
\fBTEMPORARY or TEMP\fR
|
||||
If specified, the view is created as a temporary view.
|
||||
Temporary views are automatically dropped at the end of the
|
||||
current session. Existing
|
||||
permanent relations with the same name are not visible to the
|
||||
current session while the temporary view exists, unless they are
|
||||
referenced with schema-qualified names.
|
||||
|
||||
If any of the tables referenced by the view are temporary,
|
||||
the view is created as a temporary view (whether
|
||||
TEMPORARY is specified or not).
|
||||
.TP
|
||||
\fB\fIname\fB\fR
|
||||
The name (optionally schema-qualified) of a view to be created.
|
||||
.TP
|
||||
\fB\fIcolumn_name\fB\fR
|
||||
An optional list of names to be used for columns of the view.
|
||||
If not given, the column names are deduced from the query.
|
||||
.TP
|
||||
\fB\fIquery\fB\fR
|
||||
A query (that is, a \fBSELECT\fR statement) which will
|
||||
provide the columns and rows of the view.
|
||||
|
||||
Refer to SELECT [\fBselect\fR(l)]
|
||||
for more information about valid queries.
|
||||
.SH "NOTES"
|
||||
.PP
|
||||
Currently, views are read only: the system will not allow an insert,
|
||||
update, or delete on a view. You can get the effect of an updatable
|
||||
view by creating rules that rewrite inserts, etc. on the view into
|
||||
appropriate actions on other tables. For more information see
|
||||
CREATE RULE [\fBcreate_rule\fR(l)].
|
||||
.PP
|
||||
Use the DROP VIEW [\fBdrop_view\fR(l)]
|
||||
statement to drop views.
|
||||
.PP
|
||||
Be careful that the names and types of the view's columns will be
|
||||
assigned the way you want. For example,
|
||||
.sp
|
||||
.nf
|
||||
CREATE VIEW vista AS SELECT 'Hello World';
|
||||
.sp
|
||||
.fi
|
||||
is bad form in two ways: the column name defaults to ?column?,
|
||||
and the column data type defaults to \fBunknown\fR. If you want a
|
||||
string literal in a view's result, use something like
|
||||
.sp
|
||||
.nf
|
||||
CREATE VIEW vista AS SELECT text 'Hello World' AS hello;
|
||||
.sp
|
||||
.fi
|
||||
.PP
|
||||
Access to tables referenced in the view is determined by permissions of
|
||||
the view owner. However, functions called in the view are treated the
|
||||
same as if they had been called directly from the query using the view.
|
||||
Therefore the user of a view must have permissions to call all functions
|
||||
used by the view.
|
||||
.SH "EXAMPLES"
|
||||
.PP
|
||||
Create a view consisting of all comedy films:
|
||||
.sp
|
||||
.nf
|
||||
CREATE VIEW comedies AS
|
||||
SELECT *
|
||||
FROM films
|
||||
WHERE kind = 'Comedy';
|
||||
.sp
|
||||
.fi
|
||||
.SH "COMPATIBILITY"
|
||||
.PP
|
||||
The SQL standard specifies some additional capabilities for the
|
||||
\fBCREATE VIEW\fR statement:
|
||||
.sp
|
||||
.nf
|
||||
CREATE VIEW \fIname\fR [ ( \fIcolumn_name\fR [, ...] ) ]
|
||||
AS \fIquery\fR
|
||||
[ WITH [ CASCADED | LOCAL ] CHECK OPTION ]
|
||||
.sp
|
||||
.fi
|
||||
.PP
|
||||
The optional clauses for the full SQL command are:
|
||||
.TP
|
||||
\fBCHECK OPTION\fR
|
||||
This option has to do with updatable views. All
|
||||
\fBINSERT\fR and \fBUPDATE\fR commands on the view
|
||||
will be checked to ensure data satisfy the view-defining
|
||||
condition (that is, the new data would be visible through the
|
||||
view). If they do not, the update will be rejected.
|
||||
.TP
|
||||
\fBLOCAL\fR
|
||||
Check for integrity on this view.
|
||||
.TP
|
||||
\fBCASCADED\fR
|
||||
Check for integrity on this view and on any dependent
|
||||
view. CASCADED is assumed if neither
|
||||
CASCADED nor LOCAL is specified.
|
||||
.PP
|
||||
.PP
|
||||
\fBCREATE OR REPLACE VIEW\fR is a
|
||||
PostgreSQL language extension.
|
||||
So is the concept of a temporary view.
|
||||
.SH "SEE ALSO"
|
||||
DROP VIEW [\fBdrop_view\fR(l)]
|
||||
1174
samples/Groff/fsinterface.ms
Normal file
1174
samples/Groff/fsinterface.ms
Normal file
File diff suppressed because it is too large
Load Diff
31
samples/HTML/rpanel.inc
Normal file
31
samples/HTML/rpanel.inc
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" charset="UTF-8" type="text/css" href="main.css">
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="panel_header_main_form">
|
||||
<p id="panel_header_main_form_title">Поддержка:</p>
|
||||
</div>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Москва:</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>+7-902-7-800-807</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Регионы:</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>+7-902-7-800-807</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
5
samples/HTML/tailDel.inc
Normal file
5
samples/HTML/tailDel.inc
Normal file
@@ -0,0 +1,5 @@
|
||||
</UL>
|
||||
<P><A HREF="devices.html">Supported Targets</A></P>
|
||||
</BODY>
|
||||
</HEAD>
|
||||
|
||||
1104
samples/Isabelle ROOT/filenames/ROOT
Normal file
1104
samples/Isabelle ROOT/filenames/ROOT
Normal file
File diff suppressed because it is too large
Load Diff
396
samples/Java/gen-java-linguist-thrift.java
Normal file
396
samples/Java/gen-java-linguist-thrift.java
Normal file
@@ -0,0 +1,396 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
import org.apache.thrift.scheme.IScheme;
|
||||
import org.apache.thrift.scheme.SchemeFactory;
|
||||
import org.apache.thrift.scheme.StandardScheme;
|
||||
|
||||
import org.apache.thrift.scheme.TupleScheme;
|
||||
import org.apache.thrift.protocol.TTupleProtocol;
|
||||
import org.apache.thrift.protocol.TProtocolException;
|
||||
import org.apache.thrift.EncodingUtils;
|
||||
import org.apache.thrift.TException;
|
||||
import org.apache.thrift.async.AsyncMethodCallback;
|
||||
import org.apache.thrift.server.AbstractNonblockingServer.*;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Collections;
|
||||
import java.util.BitSet;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import javax.annotation.Generated;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2015-5-12")
|
||||
public class PullRequest implements org.apache.thrift.TBase<PullRequest, PullRequest._Fields>, java.io.Serializable, Cloneable, Comparable<PullRequest> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PullRequest");
|
||||
|
||||
private static final org.apache.thrift.protocol.TField TITLE_FIELD_DESC = new org.apache.thrift.protocol.TField("title", org.apache.thrift.protocol.TType.STRING, (short)1);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
schemes.put(StandardScheme.class, new PullRequestStandardSchemeFactory());
|
||||
schemes.put(TupleScheme.class, new PullRequestTupleSchemeFactory());
|
||||
}
|
||||
|
||||
public String title; // required
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
TITLE((short)1, "title");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
static {
|
||||
for (_Fields field : EnumSet.allOf(_Fields.class)) {
|
||||
byName.put(field.getFieldName(), field);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByThriftId(int fieldId) {
|
||||
switch(fieldId) {
|
||||
case 1: // TITLE
|
||||
return TITLE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches fieldId, throwing an exception
|
||||
* if it is not found.
|
||||
*/
|
||||
public static _Fields findByThriftIdOrThrow(int fieldId) {
|
||||
_Fields fields = findByThriftId(fieldId);
|
||||
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the _Fields constant that matches name, or null if its not found.
|
||||
*/
|
||||
public static _Fields findByName(String name) {
|
||||
return byName.get(name);
|
||||
}
|
||||
|
||||
private final short _thriftId;
|
||||
private final String _fieldName;
|
||||
|
||||
_Fields(short thriftId, String fieldName) {
|
||||
_thriftId = thriftId;
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public short getThriftFieldId() {
|
||||
return _thriftId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return _fieldName;
|
||||
}
|
||||
}
|
||||
|
||||
// isset id assignments
|
||||
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
||||
static {
|
||||
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
||||
tmpMap.put(_Fields.TITLE, new org.apache.thrift.meta_data.FieldMetaData("title", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PullRequest.class, metaDataMap);
|
||||
}
|
||||
|
||||
public PullRequest() {
|
||||
}
|
||||
|
||||
public PullRequest(
|
||||
String title)
|
||||
{
|
||||
this();
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep copy on <i>other</i>.
|
||||
*/
|
||||
public PullRequest(PullRequest other) {
|
||||
if (other.isSetTitle()) {
|
||||
this.title = other.title;
|
||||
}
|
||||
}
|
||||
|
||||
public PullRequest deepCopy() {
|
||||
return new PullRequest(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.title = null;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public PullRequest setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetTitle() {
|
||||
this.title = null;
|
||||
}
|
||||
|
||||
/** Returns true if field title is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetTitle() {
|
||||
return this.title != null;
|
||||
}
|
||||
|
||||
public void setTitleIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.title = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case TITLE:
|
||||
if (value == null) {
|
||||
unsetTitle();
|
||||
} else {
|
||||
setTitle((String)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Object getFieldValue(_Fields field) {
|
||||
switch (field) {
|
||||
case TITLE:
|
||||
return getTitle();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSet(_Fields field) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
switch (field) {
|
||||
case TITLE:
|
||||
return isSetTitle();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (that instanceof PullRequest)
|
||||
return this.equals((PullRequest)that);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(PullRequest that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
|
||||
boolean this_present_title = true && this.isSetTitle();
|
||||
boolean that_present_title = true && that.isSetTitle();
|
||||
if (this_present_title || that_present_title) {
|
||||
if (!(this_present_title && that_present_title))
|
||||
return false;
|
||||
if (!this.title.equals(that.title))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
|
||||
boolean present_title = true && (isSetTitle());
|
||||
list.add(present_title);
|
||||
if (present_title)
|
||||
list.add(title);
|
||||
|
||||
return list.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PullRequest other) {
|
||||
if (!getClass().equals(other.getClass())) {
|
||||
return getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
int lastComparison = 0;
|
||||
|
||||
lastComparison = Boolean.valueOf(isSetTitle()).compareTo(other.isSetTitle());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetTitle()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.title, other.title);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public _Fields fieldForId(int fieldId) {
|
||||
return _Fields.findByThriftId(fieldId);
|
||||
}
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
|
||||
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
|
||||
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("PullRequest(");
|
||||
boolean first = true;
|
||||
|
||||
sb.append("title:");
|
||||
if (this.title == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.title);
|
||||
}
|
||||
first = false;
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void validate() throws org.apache.thrift.TException {
|
||||
// check for required fields
|
||||
// check for sub-struct validity
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
try {
|
||||
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
|
||||
try {
|
||||
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
|
||||
} catch (org.apache.thrift.TException te) {
|
||||
throw new java.io.IOException(te);
|
||||
}
|
||||
}
|
||||
|
||||
private static class PullRequestStandardSchemeFactory implements SchemeFactory {
|
||||
public PullRequestStandardScheme getScheme() {
|
||||
return new PullRequestStandardScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class PullRequestStandardScheme extends StandardScheme<PullRequest> {
|
||||
|
||||
public void read(org.apache.thrift.protocol.TProtocol iprot, PullRequest struct) throws org.apache.thrift.TException {
|
||||
org.apache.thrift.protocol.TField schemeField;
|
||||
iprot.readStructBegin();
|
||||
while (true)
|
||||
{
|
||||
schemeField = iprot.readFieldBegin();
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
|
||||
break;
|
||||
}
|
||||
switch (schemeField.id) {
|
||||
case 1: // TITLE
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
||||
struct.title = iprot.readString();
|
||||
struct.setTitleIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
iprot.readFieldEnd();
|
||||
}
|
||||
iprot.readStructEnd();
|
||||
|
||||
// check for required fields of primitive type, which can't be checked in the validate method
|
||||
struct.validate();
|
||||
}
|
||||
|
||||
public void write(org.apache.thrift.protocol.TProtocol oprot, PullRequest struct) throws org.apache.thrift.TException {
|
||||
struct.validate();
|
||||
|
||||
oprot.writeStructBegin(STRUCT_DESC);
|
||||
if (struct.title != null) {
|
||||
oprot.writeFieldBegin(TITLE_FIELD_DESC);
|
||||
oprot.writeString(struct.title);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class PullRequestTupleSchemeFactory implements SchemeFactory {
|
||||
public PullRequestTupleScheme getScheme() {
|
||||
return new PullRequestTupleScheme();
|
||||
}
|
||||
}
|
||||
|
||||
private static class PullRequestTupleScheme extends TupleScheme<PullRequest> {
|
||||
|
||||
@Override
|
||||
public void write(org.apache.thrift.protocol.TProtocol prot, PullRequest struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol oprot = (TTupleProtocol) prot;
|
||||
BitSet optionals = new BitSet();
|
||||
if (struct.isSetTitle()) {
|
||||
optionals.set(0);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 1);
|
||||
if (struct.isSetTitle()) {
|
||||
oprot.writeString(struct.title);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, PullRequest struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(1);
|
||||
if (incoming.get(0)) {
|
||||
struct.title = iprot.readString();
|
||||
struct.setTitleIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
samples/JavaScript/gen-js-linguist-thrift.js
Normal file
60
samples/JavaScript/gen-js-linguist-thrift.js
Normal file
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
//
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
|
||||
|
||||
PullRequest = function(args) {
|
||||
this.title = null;
|
||||
if (args) {
|
||||
if (args.title !== undefined) {
|
||||
this.title = args.title;
|
||||
}
|
||||
}
|
||||
};
|
||||
PullRequest.prototype = {};
|
||||
PullRequest.prototype.read = function(input) {
|
||||
input.readStructBegin();
|
||||
while (true)
|
||||
{
|
||||
var ret = input.readFieldBegin();
|
||||
var fname = ret.fname;
|
||||
var ftype = ret.ftype;
|
||||
var fid = ret.fid;
|
||||
if (ftype == Thrift.Type.STOP) {
|
||||
break;
|
||||
}
|
||||
switch (fid)
|
||||
{
|
||||
case 1:
|
||||
if (ftype == Thrift.Type.STRING) {
|
||||
this.title = input.readString().value;
|
||||
} else {
|
||||
input.skip(ftype);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
input.skip(ftype);
|
||||
break;
|
||||
default:
|
||||
input.skip(ftype);
|
||||
}
|
||||
input.readFieldEnd();
|
||||
}
|
||||
input.readStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
PullRequest.prototype.write = function(output) {
|
||||
output.writeStructBegin('PullRequest');
|
||||
if (this.title !== null && this.title !== undefined) {
|
||||
output.writeFieldBegin('title', Thrift.Type.STRING, 1);
|
||||
output.writeString(this.title);
|
||||
output.writeFieldEnd();
|
||||
}
|
||||
output.writeFieldStop();
|
||||
output.writeStructEnd();
|
||||
return;
|
||||
};
|
||||
|
||||
601
samples/Lex/zend_ini_scanner.l
Normal file
601
samples/Lex/zend_ini_scanner.l
Normal file
@@ -0,0 +1,601 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.zend.com/license/2_00.txt. |
|
||||
| If you did not receive a copy of the Zend license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@zend.com so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Zeev Suraski <zeev@zend.com> |
|
||||
| Jani Taskinen <jani@php.net> |
|
||||
| Marcus Boerger <helly@php.net> |
|
||||
| Nuno Lopes <nlopess@php.net> |
|
||||
| Scott MacVicar <scottmac@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <errno.h>
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
#include <zend_ini_parser.h>
|
||||
#include "zend_ini_scanner.h"
|
||||
|
||||
#if 0
|
||||
# define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c)
|
||||
#else
|
||||
# define YYDEBUG(s, c)
|
||||
#endif
|
||||
|
||||
#include "zend_ini_scanner_defs.h"
|
||||
|
||||
#define YYCTYPE unsigned char
|
||||
/* allow the scanner to read one null byte after the end of the string (from ZEND_MMAP_AHEAD)
|
||||
* so that if will be able to terminate to match the current token (e.g. non-enclosed string) */
|
||||
#define YYFILL(n) { if (YYCURSOR > YYLIMIT) return 0; }
|
||||
#define YYCURSOR SCNG(yy_cursor)
|
||||
#define YYLIMIT SCNG(yy_limit)
|
||||
#define YYMARKER SCNG(yy_marker)
|
||||
|
||||
#define YYGETCONDITION() SCNG(yy_state)
|
||||
#define YYSETCONDITION(s) SCNG(yy_state) = s
|
||||
|
||||
#define STATE(name) yyc##name
|
||||
|
||||
/* emulate flex constructs */
|
||||
#define BEGIN(state) YYSETCONDITION(STATE(state))
|
||||
#define YYSTATE YYGETCONDITION()
|
||||
#define yytext ((char*)SCNG(yy_text))
|
||||
#define yyleng SCNG(yy_leng)
|
||||
#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \
|
||||
yyleng = (unsigned int)x; } while(0)
|
||||
|
||||
/* #define yymore() goto yymore_restart */
|
||||
|
||||
/* perform sanity check. If this message is triggered you should
|
||||
increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */
|
||||
/*!max:re2c */
|
||||
#if ZEND_MMAP_AHEAD < (YYMAXFILL + 1)
|
||||
# error ZEND_MMAP_AHEAD should be greater than YYMAXFILL
|
||||
#endif
|
||||
|
||||
|
||||
/* How it works (for the core ini directives):
|
||||
* ===========================================
|
||||
*
|
||||
* 1. Scanner scans file for tokens and passes them to parser.
|
||||
* 2. Parser parses the tokens and passes the name/value pairs to the callback
|
||||
* function which stores them in the configuration hash table.
|
||||
* 3. Later REGISTER_INI_ENTRIES() is called which triggers the actual
|
||||
* registering of ini entries and uses zend_get_configuration_directive()
|
||||
* to fetch the previously stored name/value pair from configuration hash table
|
||||
* and registers the static ini entries which match the name to the value
|
||||
* into EG(ini_directives) hash table.
|
||||
* 4. PATH section entries are used per-request from down to top, each overriding
|
||||
* previous if one exists. zend_alter_ini_entry() is called for each entry.
|
||||
* Settings in PATH section are ZEND_INI_SYSTEM accessible and thus mimics the
|
||||
* php_admin_* directives used within Apache httpd.conf when PHP is compiled as
|
||||
* module for Apache.
|
||||
* 5. User defined ini files (like .htaccess for apache) are parsed for each request and
|
||||
* stored in separate hash defined by SAPI.
|
||||
*/
|
||||
|
||||
/* TODO: (ordered by importance :-)
|
||||
* ===============================================================================
|
||||
*
|
||||
* - Separate constant lookup totally from plain strings (using CONSTANT pattern)
|
||||
* - Add #if .. #else .. #endif and ==, !=, <, > , <=, >= operators
|
||||
* - Add #include "some.ini"
|
||||
* - Allow variables to refer to options also when using parse_ini_file()
|
||||
*
|
||||
*/
|
||||
|
||||
/* Globals Macros */
|
||||
#define SCNG INI_SCNG
|
||||
#ifdef ZTS
|
||||
ZEND_API ts_rsrc_id ini_scanner_globals_id;
|
||||
#else
|
||||
ZEND_API zend_ini_scanner_globals ini_scanner_globals;
|
||||
#endif
|
||||
|
||||
/* Eat leading whitespace */
|
||||
#define EAT_LEADING_WHITESPACE() \
|
||||
while (yytext[0]) { \
|
||||
if (yytext[0] == ' ' || yytext[0] == '\t') { \
|
||||
SCNG(yy_text)++; \
|
||||
yyleng--; \
|
||||
} else { \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Eat trailing whitespace + extra char */
|
||||
#define EAT_TRAILING_WHITESPACE_EX(ch) \
|
||||
while (yyleng > 0 && ( \
|
||||
(ch != 'X' && yytext[yyleng - 1] == ch) || \
|
||||
yytext[yyleng - 1] == '\n' || \
|
||||
yytext[yyleng - 1] == '\r' || \
|
||||
yytext[yyleng - 1] == '\t' || \
|
||||
yytext[yyleng - 1] == ' ') \
|
||||
) { \
|
||||
yyleng--; \
|
||||
}
|
||||
|
||||
/* Eat trailing whitespace */
|
||||
#define EAT_TRAILING_WHITESPACE() EAT_TRAILING_WHITESPACE_EX('X')
|
||||
|
||||
#define zend_ini_copy_value(retval, str, len) { \
|
||||
Z_STRVAL_P(retval) = zend_strndup(str, len); \
|
||||
Z_STRLEN_P(retval) = len; \
|
||||
Z_TYPE_P(retval) = IS_STRING; \
|
||||
}
|
||||
|
||||
#define RETURN_TOKEN(type, str, len) { \
|
||||
zend_ini_copy_value(ini_lval, str, len); \
|
||||
return type; \
|
||||
}
|
||||
|
||||
static void _yy_push_state(int new_state TSRMLS_DC)
|
||||
{
|
||||
zend_stack_push(&SCNG(state_stack), (void *) &YYGETCONDITION(), sizeof(int));
|
||||
YYSETCONDITION(new_state);
|
||||
}
|
||||
|
||||
#define yy_push_state(state_and_tsrm) _yy_push_state(yyc##state_and_tsrm)
|
||||
|
||||
static void yy_pop_state(TSRMLS_D)
|
||||
{
|
||||
int *stack_state;
|
||||
zend_stack_top(&SCNG(state_stack), (void **) &stack_state);
|
||||
YYSETCONDITION(*stack_state);
|
||||
zend_stack_del_top(&SCNG(state_stack));
|
||||
}
|
||||
|
||||
static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
|
||||
{
|
||||
YYCURSOR = (YYCTYPE*)str;
|
||||
SCNG(yy_start) = YYCURSOR;
|
||||
YYLIMIT = YYCURSOR + len;
|
||||
}
|
||||
|
||||
#define ini_filename SCNG(filename)
|
||||
|
||||
/* {{{ init_ini_scanner()
|
||||
*/
|
||||
static int init_ini_scanner(int scanner_mode, zend_file_handle *fh TSRMLS_DC)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (scanner_mode != ZEND_INI_SCANNER_NORMAL && scanner_mode != ZEND_INI_SCANNER_RAW) {
|
||||
zend_error(E_WARNING, "Invalid scanner mode");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
SCNG(lineno) = 1;
|
||||
SCNG(scanner_mode) = scanner_mode;
|
||||
SCNG(yy_in) = fh;
|
||||
|
||||
if (fh != NULL) {
|
||||
ini_filename = zend_strndup(fh->filename, strlen(fh->filename));
|
||||
} else {
|
||||
ini_filename = NULL;
|
||||
}
|
||||
|
||||
zend_stack_init(&SCNG(state_stack));
|
||||
BEGIN(INITIAL);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ shutdown_ini_scanner()
|
||||
*/
|
||||
void shutdown_ini_scanner(TSRMLS_D)
|
||||
{
|
||||
zend_stack_destroy(&SCNG(state_stack));
|
||||
if (ini_filename) {
|
||||
free(ini_filename);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_ini_scanner_get_lineno()
|
||||
*/
|
||||
int zend_ini_scanner_get_lineno(TSRMLS_D)
|
||||
{
|
||||
return SCNG(lineno);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_ini_scanner_get_filename()
|
||||
*/
|
||||
char *zend_ini_scanner_get_filename(TSRMLS_D)
|
||||
{
|
||||
return ini_filename ? ini_filename : "Unknown";
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_ini_open_file_for_scanning()
|
||||
*/
|
||||
int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRMLS_DC)
|
||||
{
|
||||
char *buf;
|
||||
size_t size;
|
||||
|
||||
if (zend_stream_fixup(fh, &buf, &size TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (init_ini_scanner(scanner_mode, fh TSRMLS_CC) == FAILURE) {
|
||||
zend_file_handle_dtor(fh TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
yy_scan_buffer(buf, size TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_ini_prepare_string_for_scanning()
|
||||
*/
|
||||
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
||||
{
|
||||
int len = strlen(str);
|
||||
|
||||
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
yy_scan_buffer(str, len TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ zend_ini_escape_string()
|
||||
*/
|
||||
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC)
|
||||
{
|
||||
register char *s, *t;
|
||||
char *end;
|
||||
|
||||
zend_ini_copy_value(lval, str, len);
|
||||
|
||||
/* convert escape sequences */
|
||||
s = t = Z_STRVAL_P(lval);
|
||||
end = s + Z_STRLEN_P(lval);
|
||||
|
||||
while (s < end) {
|
||||
if (*s == '\\') {
|
||||
s++;
|
||||
if (s >= end) {
|
||||
*t++ = '\\';
|
||||
continue;
|
||||
}
|
||||
switch (*s) {
|
||||
case '"':
|
||||
if (*s != quote_type) {
|
||||
*t++ = '\\';
|
||||
*t++ = *s;
|
||||
break;
|
||||
}
|
||||
case '\\':
|
||||
case '$':
|
||||
*t++ = *s;
|
||||
Z_STRLEN_P(lval)--;
|
||||
break;
|
||||
default:
|
||||
*t++ = '\\';
|
||||
*t++ = *s;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
*t++ = *s;
|
||||
}
|
||||
if (*s == '\n' || (*s == '\r' && (*(s+1) != '\n'))) {
|
||||
SCNG(lineno)++;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*t = 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
int ini_lex(zval *ini_lval TSRMLS_DC)
|
||||
{
|
||||
restart:
|
||||
SCNG(yy_text) = YYCURSOR;
|
||||
|
||||
/* yymore_restart: */
|
||||
/* detect EOF */
|
||||
if (YYCURSOR >= YYLIMIT) {
|
||||
if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
|
||||
BEGIN(INITIAL);
|
||||
return END_OF_LINE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Eat any UTF-8 BOM we find in the first 3 bytes */
|
||||
if (YYCURSOR == SCNG(yy_start) && YYCURSOR + 3 < YYLIMIT) {
|
||||
if (memcmp(YYCURSOR, "\xef\xbb\xbf", 3) == 0) {
|
||||
YYCURSOR += 3;
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
/*!re2c
|
||||
re2c:yyfill:check = 0;
|
||||
LNUM [0-9]+
|
||||
DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
|
||||
NUMBER [-]?{LNUM}|{DNUM}
|
||||
ANY_CHAR (.|[\n\t])
|
||||
NEWLINE ("\r"|"\n"|"\r\n")
|
||||
TABS_AND_SPACES [ \t]
|
||||
WHITESPACE [ \t]+
|
||||
CONSTANT [a-zA-Z_][a-zA-Z0-9_]*
|
||||
LABEL [^=\n\r\t;|&$~(){}!"\[]+
|
||||
TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}]
|
||||
OPERATORS [&|~()!]
|
||||
DOLLAR_CURLY "${"
|
||||
|
||||
SECTION_RAW_CHARS [^\]\n\r]
|
||||
SINGLE_QUOTED_CHARS [^']
|
||||
RAW_VALUE_CHARS [^"\n\r;\000]
|
||||
|
||||
LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
|
||||
VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})
|
||||
SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
|
||||
<!*> := yyleng = YYCURSOR - SCNG(yy_text);
|
||||
|
||||
<INITIAL>"[" { /* Section start */
|
||||
/* Enter section data lookup state */
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
|
||||
yy_push_state(ST_SECTION_RAW TSRMLS_CC);
|
||||
} else {
|
||||
yy_push_state(ST_SECTION_VALUE TSRMLS_CC);
|
||||
}
|
||||
return TC_SECTION;
|
||||
}
|
||||
|
||||
<ST_VALUE,ST_SECTION_VALUE,ST_OFFSET>"'"{SINGLE_QUOTED_CHARS}+"'" { /* Raw string */
|
||||
/* Eat leading and trailing single quotes */
|
||||
if (yytext[0] == '\'' && yytext[yyleng - 1] == '\'') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
}
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_SECTION_RAW,ST_SECTION_VALUE>"]"{TABS_AND_SPACES}*{NEWLINE}? { /* End of section */
|
||||
BEGIN(INITIAL);
|
||||
SCNG(lineno)++;
|
||||
return ']';
|
||||
}
|
||||
|
||||
<INITIAL>{LABEL}"["{TABS_AND_SPACES}* { /* Start of option with offset */
|
||||
/* Eat leading whitespace */
|
||||
EAT_LEADING_WHITESPACE();
|
||||
|
||||
/* Eat trailing whitespace and [ */
|
||||
EAT_TRAILING_WHITESPACE_EX('[');
|
||||
|
||||
/* Enter offset lookup state */
|
||||
yy_push_state(ST_OFFSET TSRMLS_CC);
|
||||
|
||||
RETURN_TOKEN(TC_OFFSET, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_OFFSET>{TABS_AND_SPACES}*"]" { /* End of section or an option offset */
|
||||
BEGIN(INITIAL);
|
||||
return ']';
|
||||
}
|
||||
|
||||
<ST_DOUBLE_QUOTES,ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{DOLLAR_CURLY} { /* Variable start */
|
||||
yy_push_state(ST_VARNAME TSRMLS_CC);
|
||||
return TC_DOLLAR_CURLY;
|
||||
}
|
||||
|
||||
<ST_VARNAME>{LABEL} { /* Variable name */
|
||||
/* Eat leading whitespace */
|
||||
EAT_LEADING_WHITESPACE();
|
||||
|
||||
/* Eat trailing whitespace */
|
||||
EAT_TRAILING_WHITESPACE();
|
||||
|
||||
RETURN_TOKEN(TC_VARNAME, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_VARNAME>"}" { /* Variable end */
|
||||
yy_pop_state(TSRMLS_C);
|
||||
return '}';
|
||||
}
|
||||
|
||||
<INITIAL,ST_VALUE>("true"|"on"|"yes"){TABS_AND_SPACES}* { /* TRUE value (when used outside option value/offset this causes parse error!) */
|
||||
RETURN_TOKEN(BOOL_TRUE, "1", 1);
|
||||
}
|
||||
|
||||
<INITIAL,ST_VALUE>("false"|"off"|"no"|"none"|"null"){TABS_AND_SPACES}* { /* FALSE value (when used outside option value/offset this causes parse error!)*/
|
||||
RETURN_TOKEN(BOOL_FALSE, "", 0);
|
||||
}
|
||||
|
||||
<INITIAL>{LABEL} { /* Get option name */
|
||||
/* Eat leading whitespace */
|
||||
EAT_LEADING_WHITESPACE();
|
||||
|
||||
/* Eat trailing whitespace */
|
||||
EAT_TRAILING_WHITESPACE();
|
||||
|
||||
RETURN_TOKEN(TC_LABEL, yytext, yyleng);
|
||||
}
|
||||
|
||||
<INITIAL>{TABS_AND_SPACES}*[=]{TABS_AND_SPACES}* { /* Start option value */
|
||||
if (SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW) {
|
||||
yy_push_state(ST_RAW TSRMLS_CC);
|
||||
} else {
|
||||
yy_push_state(ST_VALUE TSRMLS_CC);
|
||||
}
|
||||
return '=';
|
||||
}
|
||||
|
||||
<ST_RAW>["] {
|
||||
while (YYCURSOR < YYLIMIT) {
|
||||
switch (*YYCURSOR++) {
|
||||
case '\n':
|
||||
SCNG(lineno)++;
|
||||
break;
|
||||
case '\r':
|
||||
if (*YYCURSOR != '\n') {
|
||||
SCNG(lineno)++;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
yyleng = YYCURSOR - SCNG(yy_text) - 2;
|
||||
SCNG(yy_text)++;
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
case '\\':
|
||||
if (YYCURSOR < YYLIMIT) {
|
||||
YYCURSOR++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
yyleng = YYCURSOR - SCNG(yy_text);
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_SECTION_RAW>{SECTION_RAW_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_VALUE,ST_RAW>{TABS_AND_SPACES}*{NEWLINE} { /* End of option value */
|
||||
BEGIN(INITIAL);
|
||||
SCNG(lineno)++;
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{CONSTANT} { /* Get constant option value */
|
||||
RETURN_TOKEN(TC_CONSTANT, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{NUMBER} { /* Get number option value as string */
|
||||
RETURN_TOKEN(TC_NUMBER, yytext, yyleng);
|
||||
}
|
||||
|
||||
<INITIAL>{TOKENS} { /* Disallow these chars outside option values */
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
<ST_VALUE>{OPERATORS}{TABS_AND_SPACES}* { /* Boolean operators */
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
<ST_VALUE>[=] { /* Make = used in option value to trigger error */
|
||||
yyless(0);
|
||||
BEGIN(INITIAL);
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<ST_VALUE>{VALUE_CHARS}+ { /* Get everything else as option/offset value */
|
||||
RETURN_TOKEN(TC_STRING, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_SECTION_VALUE,ST_OFFSET>{SECTION_VALUE_CHARS}+ { /* Get rest as section/offset value */
|
||||
RETURN_TOKEN(TC_STRING, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{TABS_AND_SPACES}*["] { /* Double quoted '"' string start */
|
||||
yy_push_state(ST_DOUBLE_QUOTES TSRMLS_CC);
|
||||
return '"';
|
||||
}
|
||||
|
||||
<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */
|
||||
yy_pop_state(TSRMLS_C);
|
||||
return '"';
|
||||
}
|
||||
|
||||
<ST_DOUBLE_QUOTES>[^] { /* Escape double quoted string contents */
|
||||
if (YYCURSOR > YYLIMIT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (YYCURSOR < YYLIMIT) {
|
||||
switch (*YYCURSOR++) {
|
||||
case '"':
|
||||
if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '$':
|
||||
if (*YYCURSOR == '{') {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case '\\':
|
||||
if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') {
|
||||
YYCURSOR++;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
YYCURSOR--;
|
||||
break;
|
||||
}
|
||||
|
||||
yyleng = YYCURSOR - SCNG(yy_text);
|
||||
|
||||
zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC);
|
||||
return TC_QUOTED_STRING;
|
||||
}
|
||||
|
||||
<ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{WHITESPACE} {
|
||||
RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng);
|
||||
}
|
||||
|
||||
<INITIAL,ST_RAW>{TABS_AND_SPACES}+ {
|
||||
/* eat whitespace */
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<INITIAL>{TABS_AND_SPACES}*{NEWLINE} {
|
||||
SCNG(lineno)++;
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<INITIAL,ST_VALUE,ST_RAW>{TABS_AND_SPACES}*[;][^\r\n]*{NEWLINE} { /* Comment */
|
||||
BEGIN(INITIAL);
|
||||
SCNG(lineno)++;
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<INITIAL>{TABS_AND_SPACES}*[#][^\r\n]*{NEWLINE} { /* #Comment */
|
||||
zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));
|
||||
BEGIN(INITIAL);
|
||||
SCNG(lineno)++;
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<ST_VALUE,ST_RAW>[^] { /* End of option value (if EOF is reached before EOL */
|
||||
BEGIN(INITIAL);
|
||||
return END_OF_LINE;
|
||||
}
|
||||
|
||||
<*>[^] {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
2
samples/Linux Kernel Module/bcm4334x.mod
Normal file
2
samples/Linux Kernel Module/bcm4334x.mod
Normal file
@@ -0,0 +1,2 @@
|
||||
/data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcm4334x.ko
|
||||
/data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_pno.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_common.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_ip.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_custom_gpio.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_linux.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_linux_sched.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_cfg80211.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_linux_wq.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/aiutils.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmevent.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmutils.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmwifi_channels.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/hndpmu.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/linux_osl.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/sbutils.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/siutils.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wl_android.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wl_cfg80211.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wl_cfgp2p.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wl_cfg_btcoex.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wldev_common.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/wl_linux_mon.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_linux_platdev.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmsdh.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmsdh_linux.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmsdh_sdmmc.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/bcmsdh_sdmmc_linux.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_cdc.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_wlfc.o /data/israel/edison/poky/meta-edison/recipes-kernel/bcm43340/driver_bcm43x/dhd_sdio.o
|
||||
2
samples/Linux Kernel Module/mbcache.mod
Normal file
2
samples/Linux Kernel Module/mbcache.mod
Normal file
@@ -0,0 +1,2 @@
|
||||
fs/mbcache.ko
|
||||
fs/mbcache.o
|
||||
2
samples/Linux Kernel Module/md5.mod
Normal file
2
samples/Linux Kernel Module/md5.mod
Normal file
@@ -0,0 +1,2 @@
|
||||
crypto/md5.ko
|
||||
crypto/md5.o
|
||||
23
samples/Makefile/filenames/Kbuild
Normal file
23
samples/Makefile/filenames/Kbuild
Normal file
@@ -0,0 +1,23 @@
|
||||
# Fail on warnings - also for files referenced in subdirs
|
||||
# -Werror can be disabled for specific files using:
|
||||
# CFLAGS_<file.o> := -Wno-error
|
||||
subdir-ccflags-y := -Werror
|
||||
|
||||
# platform specific definitions
|
||||
include arch/mips/Kbuild.platforms
|
||||
obj-y := $(platform-y)
|
||||
|
||||
# make clean traverses $(obj-) without having included .config, so
|
||||
# everything ends up here
|
||||
obj- := $(platform-)
|
||||
|
||||
# mips object files
|
||||
# The object files are linked as core-y files would be linked
|
||||
|
||||
obj-y += kernel/
|
||||
obj-y += mm/
|
||||
obj-y += net/
|
||||
|
||||
ifdef CONFIG_KVM
|
||||
obj-y += kvm/
|
||||
endif
|
||||
329
samples/Modula-2/HuffChan.mod
Normal file
329
samples/Modula-2/HuffChan.mod
Normal file
@@ -0,0 +1,329 @@
|
||||
IMPLEMENTATION MODULE HuffChan;
|
||||
|
||||
(*
|
||||
This module shows how to redefine standard IO file functions. It provides
|
||||
functions for reading and writing packed files opened in Raw mode.
|
||||
*)
|
||||
|
||||
IMPORT IOChan, IOLink, ChanConsts, IOConsts, SYSTEM, Strings;
|
||||
FROM Storage IMPORT ALLOCATE, DEALLOCATE;
|
||||
|
||||
CONST
|
||||
rbldFrq = 512; (* means: every 512 bytes rebuild table *)
|
||||
|
||||
TYPE
|
||||
charTap = POINTER TO ARRAY [0..MAX(INTEGER)-1] OF CHAR;
|
||||
smbTp = POINTER TO smbT;
|
||||
|
||||
smbT = RECORD (* Huffman's tree *)
|
||||
ch : CHAR;
|
||||
n : CARDINAL; (* frequncy of char ch *)
|
||||
left,right,next : smbTp;
|
||||
END;
|
||||
|
||||
tblT = RECORD (* bit sequence for code *)
|
||||
vl : CARDINAL; (* bit sequence *)
|
||||
cnt : INTEGER; (* it length *)
|
||||
END;
|
||||
|
||||
lclDataT = RECORD (* channel's local data *)
|
||||
tRoot : smbTp;
|
||||
htbl : ARRAY [0..255] OF tblT; (* code -> bit sequence table *)
|
||||
ftbl : ARRAY [0..255] OF CARDINAL; (* frequncey table *)
|
||||
wBf,rb1,rb2 : CARDINAL;
|
||||
wbc,rbc,smc : INTEGER;
|
||||
chid : IOChan.ChanId;
|
||||
END;
|
||||
lclDataTp = POINTER TO lclDataT;
|
||||
charp = POINTER TO CHAR;
|
||||
|
||||
VAR
|
||||
did : IOLink.DeviceId;
|
||||
ldt : lclDataTp;
|
||||
|
||||
|
||||
PROCEDURE Shf(a:CARDINAL; b : INTEGER) : CARDINAL; (* shl a,b (or shr) *)
|
||||
BEGIN
|
||||
RETURN SYSTEM.CAST(CARDINAL,SYSTEM.SHIFT(SYSTEM.CAST(BITSET,a),b));
|
||||
END Shf;
|
||||
|
||||
PROCEDURE wrDword(a:CARDINAL); (* write 4 bytes to file *)
|
||||
BEGIN
|
||||
IOChan.RawWrite(ldt^.chid,SYSTEM.ADR(a),4);
|
||||
END wrDword;
|
||||
|
||||
PROCEDURE rdDword() : CARDINAL; (* read 4 bytes from file *)
|
||||
VAR
|
||||
a,z : CARDINAL;
|
||||
BEGIN
|
||||
a:=0;
|
||||
IOChan.RawRead(ldt^.chid,SYSTEM.ADR(a),4,z);
|
||||
RETURN a;
|
||||
END rdDword;
|
||||
|
||||
PROCEDURE wrSmb(ch : CHAR); (* write bit sequence for code ch *)
|
||||
VAR
|
||||
v,h : CARDINAL;
|
||||
b,c : INTEGER;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
v:=htbl[ORD(ch)].vl;
|
||||
c:=htbl[ORD(ch)].cnt;
|
||||
IF c+wbc<=32 THEN
|
||||
wBf:=Shf(wBf,c);
|
||||
wBf:=wBf+v;
|
||||
wbc:=wbc+c;
|
||||
IF wbc=32 THEN
|
||||
wrDword(wBf);
|
||||
wBf:=0; wbc:=0;
|
||||
END;
|
||||
RETURN;
|
||||
END;
|
||||
b:=c+wbc-32;
|
||||
h:=Shf(v,-b);
|
||||
wBf:=Shf(wBf,32-wbc)+h;
|
||||
wrDword(wBf);
|
||||
wBf:=v-Shf(h,b);
|
||||
wbc:=b;
|
||||
END;
|
||||
END wrSmb;
|
||||
|
||||
PROCEDURE flush(); (* write data in buffer *)
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
wBf:=Shf(wBf,32-wbc);
|
||||
wrDword(wBf);
|
||||
END;
|
||||
END flush;
|
||||
|
||||
PROCEDURE getSym() : CHAR; (* find code for first bit sequence in buffer *)
|
||||
VAR
|
||||
t,i : CARDINAL;
|
||||
b : INTEGER;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
IF rbc<=32 THEN
|
||||
rb2:=rdDword();
|
||||
t:=Shf(rb2,-rbc);
|
||||
IF rbc=32 THEN t:=0; END;
|
||||
rb1:=rb1+t;
|
||||
rb2:=Shf(rb2,32-rbc);
|
||||
IF rbc=0 THEN rb2:=0; END;
|
||||
rbc:=rbc+32;
|
||||
END;
|
||||
FOR i:=0 TO 255 DO
|
||||
t:=Shf(rb1,htbl[i].cnt-32);
|
||||
IF t=htbl[i].vl THEN
|
||||
rb1:=Shf(rb1,htbl[i].cnt);
|
||||
b:=32-htbl[i].cnt;
|
||||
t:=Shf(rb2,-b);
|
||||
rb1:=rb1+t;
|
||||
rb2:=Shf(rb2,32-b);
|
||||
rbc:=rbc+b-32;
|
||||
RETURN CHR(i);
|
||||
END;
|
||||
END;
|
||||
END;
|
||||
END getSym;
|
||||
|
||||
PROCEDURE Insert(s : smbTp); (* insert new character in Huffman's tree *)
|
||||
VAR
|
||||
cr : smbTp;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
IF tRoot=NIL THEN
|
||||
cr:=tRoot;
|
||||
tRoot:=s;
|
||||
s^.next:=cr;
|
||||
RETURN;
|
||||
ELSIF tRoot^.n<=s^.n THEN
|
||||
cr:=tRoot;
|
||||
tRoot:=s;
|
||||
s^.next:=cr;
|
||||
RETURN;
|
||||
END;
|
||||
cr:=tRoot;
|
||||
WHILE (cr^.next<>NIL) & (cr^.next^.n>s^.n) DO
|
||||
cr:=cr^.next;
|
||||
END;
|
||||
s^.next:=cr^.next;
|
||||
cr^.next:=s;
|
||||
END;
|
||||
END Insert;
|
||||
|
||||
PROCEDURE BuildTree(); (* build Huffman's tree *)
|
||||
VAR
|
||||
cr,ocr,ncr : smbTp;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
LOOP
|
||||
ocr:=NIL; cr:=tRoot;
|
||||
WHILE cr^.next^.next<>NIL DO
|
||||
ocr:=cr; cr:=cr^.next;
|
||||
END;
|
||||
NEW(ncr);
|
||||
ncr^.n:=cr^.n+cr^.next^.n;
|
||||
ncr^.left:=cr;
|
||||
ncr^.right:=cr^.next;
|
||||
IF ocr<>NIL THEN
|
||||
ocr^.next:=NIL;
|
||||
Insert(ncr);
|
||||
ELSE
|
||||
tRoot:=NIL;
|
||||
Insert(ncr);
|
||||
EXIT;
|
||||
END;
|
||||
END;
|
||||
END;
|
||||
END BuildTree;
|
||||
|
||||
PROCEDURE BuildTable(cr: smbTp; vl,n: CARDINAL); (* build table: code -> bit sequence *)
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
IF cr^.left=NIL THEN
|
||||
htbl[ORD(cr^.ch)].vl:=vl;
|
||||
htbl[ORD(cr^.ch)].cnt:=n;
|
||||
DISPOSE(cr);
|
||||
RETURN;
|
||||
END;
|
||||
vl:=vl*2;
|
||||
BuildTable(cr^.left,vl,n+1);
|
||||
BuildTable(cr^.right,vl+1,n+1);
|
||||
DISPOSE(cr);
|
||||
END;
|
||||
END BuildTable;
|
||||
|
||||
PROCEDURE clcTab(); (* build code/bitseq. table from frequency table *)
|
||||
VAR
|
||||
i : CARDINAL;
|
||||
s : smbTp;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
tRoot:=NIL;
|
||||
FOR i:=0 TO 255 DO
|
||||
NEW(s);
|
||||
s^.ch:=CHR(i);
|
||||
s^.n:=ftbl[i];
|
||||
s^.left:=NIL; s^.right:=NIL; s^.next:=NIL;
|
||||
Insert(s);
|
||||
END;
|
||||
BuildTree();
|
||||
BuildTable(tRoot,0,0);
|
||||
END;
|
||||
END clcTab;
|
||||
|
||||
PROCEDURE iniHuf();
|
||||
VAR
|
||||
i : CARDINAL;
|
||||
BEGIN
|
||||
WITH ldt^ DO
|
||||
FOR i:=0 TO 255 DO
|
||||
ftbl[i]:=1;
|
||||
END;
|
||||
wBf:=0; wbc:=0; rb1:=0; rb2:=0; rbc:=0;
|
||||
smc:=0;
|
||||
clcTab();
|
||||
END;
|
||||
END iniHuf;
|
||||
|
||||
|
||||
PROCEDURE RawWrite(x: IOLink.DeviceTablePtr; buf: SYSTEM.ADDRESS;
|
||||
len: CARDINAL);
|
||||
VAR
|
||||
i : CARDINAL;
|
||||
ch : CHAR;
|
||||
cht : charTap;
|
||||
BEGIN
|
||||
IF len = 0 THEN RETURN; END;
|
||||
ldt:=SYSTEM.CAST(lclDataTp,x^.cd);
|
||||
cht:=SYSTEM.CAST(charTap,buf);
|
||||
WITH ldt^ DO
|
||||
FOR i:=0 TO len-1 DO
|
||||
ch:=cht^[i];
|
||||
wrSmb(ch);
|
||||
IF ch = 377C THEN wrSmb(ch); END;
|
||||
ftbl[ORD(ch)]:=ftbl[ORD(ch)]+1; smc:=smc+1;
|
||||
IF smc=rbldFrq THEN
|
||||
clcTab();
|
||||
smc:=0;
|
||||
END;
|
||||
END;
|
||||
END;
|
||||
x^.result:=IOChan.ReadResult(ldt^.chid);
|
||||
END RawWrite;
|
||||
|
||||
PROCEDURE RawRead(x: IOLink.DeviceTablePtr; buf: SYSTEM.ADDRESS;
|
||||
blen: CARDINAL; VAR len: CARDINAL);
|
||||
VAR
|
||||
i : CARDINAL;
|
||||
cht : charTap;
|
||||
ch : CHAR;
|
||||
BEGIN
|
||||
ldt:=SYSTEM.CAST(lclDataTp,x^.cd);
|
||||
cht:=SYSTEM.CAST(charTap,buf);
|
||||
IF (blen=0) OR (x^.result<>IOConsts.allRight) THEN len:=0; RETURN; END;
|
||||
WITH ldt^ DO
|
||||
FOR i:=0 TO blen-1 DO
|
||||
ch:=getSym();
|
||||
IF ch = 377C THEN
|
||||
ch:=getSym();
|
||||
IF ch = 0C THEN
|
||||
x^.result:=IOConsts.endOfInput;
|
||||
len:=i; cht^[i]:=0C;
|
||||
RETURN;
|
||||
END;
|
||||
END;
|
||||
cht^[i]:=ch;
|
||||
ftbl[ORD(ch)]:=ftbl[ORD(ch)]+1; smc:=smc+1;
|
||||
IF smc=rbldFrq THEN
|
||||
clcTab();
|
||||
smc:=0;
|
||||
END;
|
||||
END;
|
||||
len:=blen;
|
||||
END;
|
||||
END RawRead;
|
||||
|
||||
PROCEDURE CreateAlias(VAR cid: ChanId; io: ChanId; VAR res: OpenResults);
|
||||
VAR
|
||||
x : IOLink.DeviceTablePtr;
|
||||
BEGIN
|
||||
IOLink.MakeChan(did,cid);
|
||||
IF cid = IOChan.InvalidChan() THEN
|
||||
res:=ChanConsts.outOfChans
|
||||
ELSE
|
||||
NEW(ldt);
|
||||
IF ldt=NIL THEN
|
||||
IOLink.UnMakeChan(did,cid);
|
||||
res:=ChanConsts.outOfChans;
|
||||
RETURN;
|
||||
END;
|
||||
x:=IOLink.DeviceTablePtrValue(cid,did,IOChan.notAvailable,"");
|
||||
ldt^.chid:=io;
|
||||
x^.cd:=ldt;
|
||||
x^.doRawWrite:=RawWrite;
|
||||
x^.doRawRead:=RawRead;
|
||||
res:=ChanConsts.opened;
|
||||
iniHuf();
|
||||
x^.result:=IOConsts.allRight;
|
||||
END;
|
||||
END CreateAlias;
|
||||
|
||||
PROCEDURE DeleteAlias(VAR cid: ChanId);
|
||||
VAR
|
||||
x : IOLink.DeviceTablePtr;
|
||||
BEGIN
|
||||
x:=IOLink.DeviceTablePtrValue(cid,did,IOChan.notAvailable,"");
|
||||
ldt:=x^.cd;
|
||||
IF ldt^.rbc=0 THEN
|
||||
wrSmb(377C);
|
||||
wrSmb(0C);
|
||||
flush();
|
||||
END;
|
||||
DISPOSE(ldt);
|
||||
IOLink.UnMakeChan(did,cid);
|
||||
END DeleteAlias;
|
||||
|
||||
BEGIN
|
||||
IOLink.AllocateDeviceId(did);
|
||||
END HuffChan.
|
||||
242
samples/Nginx/example.com.vhost
Normal file
242
samples/Nginx/example.com.vhost
Normal file
@@ -0,0 +1,242 @@
|
||||
# Move the www people to no-www
|
||||
server {
|
||||
listen 80;
|
||||
server_name www.example.com;
|
||||
return 301 $scheme://example.com$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl;
|
||||
server_name example.com;
|
||||
|
||||
# Certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
|
||||
ssl_certificate /srv/www/example.com/ssl/example.com.crt;
|
||||
ssl_certificate_key /srv/www/example.com/ssl/example.com.key;
|
||||
|
||||
# Allow multiple connections to use the same key data
|
||||
ssl_session_timeout 5m;
|
||||
ssl_session_cache shared:SSL:50m;
|
||||
|
||||
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
|
||||
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
||||
|
||||
# Intermediate configuration. tweak to your needs
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
include snippets/ssl_ciphers_intermediate.conf;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
|
||||
#add_header Strict-Transport-Security max-age=15768000;
|
||||
|
||||
# OCSP Stapling - fetch OCSP records from URL in ssl_certificate and cache them
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
|
||||
# Verify chain of trust of OCSP response using Root CA and Intermediate certs
|
||||
ssl_trusted_certificate /srv/www/example.com/ssl/unified-ssl.crt;
|
||||
resolver 8.8.8.8 8.8.4.4;
|
||||
resolver_timeout 10s;
|
||||
|
||||
root /srv/www/example.com/htdocs;
|
||||
index index.php index.html index.htm;
|
||||
charset UTF-8;
|
||||
autoindex off;
|
||||
|
||||
# Deny access based on HTTP method (set in HTTP level)
|
||||
if ($bad_method = 1) {
|
||||
return 444;
|
||||
}
|
||||
|
||||
# Show "Not Found" 404 errors in place of "Forbidden" 403 errors, because
|
||||
# forbidden errors allow attackers potential insight into your server's
|
||||
# layout and contents
|
||||
error_page 403 = 404;
|
||||
|
||||
# It's always good to set logs, note however you cannot turn off the error log
|
||||
# setting error_log off; will simply create a file called 'off'.
|
||||
access_log /var/log/nginx/example.com.access.log;
|
||||
error_log /var/log/nginx/example.com.error.log;
|
||||
|
||||
# Add trailing slash to */wp-admin requests.
|
||||
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
||||
|
||||
location / {
|
||||
# This try_files directive is used to enable pretty, SEO-friendly URLs
|
||||
# and permalinks for Wordpress. Leave it *off* to start with, and then
|
||||
# turn it on once you've gotten Wordpress configured!
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
# Option to create password protected directory
|
||||
# http://www.howtoforge.com/basic-http-authentication-with-nginx
|
||||
# location /admin {
|
||||
# auth_basic "Administrator Login";
|
||||
# auth_basic_user_file /var/www/domain.com/admin/.htpasswd;
|
||||
# }
|
||||
|
||||
# Do not log access to these to keep the logs cleaner
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location = /apple-touch-icon.png {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location = /apple-touch-icon-precomposed.png {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# This block will catch static file requests, such as images, css, js
|
||||
# The ?: prefix is a 'non-capturing' mark, meaning we do not require
|
||||
# the pattern to be captured into $1 which should help improve performance
|
||||
location ~* \.(?:3gp|gif|jpg|jpe?g|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff)$ {
|
||||
# Some basic cache-control for static files to be sent to the browser
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
}
|
||||
|
||||
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
|
||||
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
|
||||
location ~ /\. {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ~$ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Common deny or internal locations, to help prevent access to areas of
|
||||
# the site that should not be public
|
||||
location ~* wp-admin/includes {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* wp-includes/theme-compat/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* wp-includes/js/tinymce/langs/.*\.php {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /wp-content/ {
|
||||
internal;
|
||||
}
|
||||
|
||||
# Deny access to any files with a .php extension in the uploads directory
|
||||
# Works in sub-directory installs and also in multisite network
|
||||
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
|
||||
location ~* /(?:uploads|files)/.*\.php$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Make sure these get through, esp with dynamic WP sitmap plugin
|
||||
location = /robots.txt {
|
||||
try_files $uri /index.php;
|
||||
}
|
||||
|
||||
location = /sitemap.xml {
|
||||
try_files $uri /index.php;
|
||||
}
|
||||
|
||||
location = /sitemap.xml.gz {
|
||||
try_files $uri /index.php;
|
||||
}
|
||||
|
||||
# Fix for Firefox issue with cross site font icons
|
||||
location ~* \.(eot|otf|ttf|woff)$ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
|
||||
# Redirect server error pages to the static page /50x.html
|
||||
# Make sure 50x.html exists at that location
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# Cache everything by default
|
||||
set $skip_cache 0;
|
||||
|
||||
# POST requests and urls with a query string should always go to PHP
|
||||
if ($request_method = POST) {
|
||||
set $skip_cache 1;
|
||||
}
|
||||
if ($query_string != "") {
|
||||
set $skip_cache 1;
|
||||
}
|
||||
|
||||
# Don't cache uris containing the following segments
|
||||
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
|
||||
set $skip_cache 1;
|
||||
}
|
||||
|
||||
# Don't use the cache for logged in users or recent commenters
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
|
||||
set $skip_cache 1;
|
||||
}
|
||||
|
||||
# Pass all .php files onto a php-fpm/php-fcgi server.
|
||||
location ~ [^/]\.php(/|$) {
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: http://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
|
||||
fastcgi_pass unix:/var/run/example.com.sock;
|
||||
fastcgi_index index.php;
|
||||
# Uncomment if site is HTTPS
|
||||
#fastcgi_param HTTPS on;
|
||||
include fastcgi.conf;
|
||||
|
||||
fastcgi_cache_bypass $skip_cache;
|
||||
fastcgi_no_cache $skip_cache;
|
||||
|
||||
fastcgi_cache WORDPRESS;
|
||||
fastcgi_cache_valid 60m;
|
||||
}
|
||||
|
||||
location ~ /purge(/.*) {
|
||||
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
|
||||
}
|
||||
|
||||
# Use this block if PHPMyAdmin is enabled for this domain
|
||||
location /phpmyadmin {
|
||||
root /usr/share/;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location ~ ^/phpmyadmin/(.+\.php)$ {
|
||||
try_files $uri =404;
|
||||
root /usr/share/;
|
||||
fastcgi_pass unix:/var/run/example.com.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
|
||||
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
|
||||
root /usr/share/;
|
||||
}
|
||||
}
|
||||
|
||||
location /phpMyAdmin {
|
||||
rewrite ^/* /phpmyadmin last;
|
||||
}
|
||||
# End PHPMyAdmin block
|
||||
|
||||
} # End of server block.
|
||||
176
samples/Objective-C/gen-cocoa-linguist-thrift.m
Normal file
176
samples/Objective-C/gen-cocoa-linguist-thrift.m
Normal file
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "TProtocol.h"
|
||||
#import "TApplicationException.h"
|
||||
#import "TProtocolException.h"
|
||||
#import "TProtocolUtil.h"
|
||||
#import "TProcessor.h"
|
||||
#import "TObjective-C.h"
|
||||
#import "TBase.h"
|
||||
|
||||
|
||||
#import "linguist.h"
|
||||
|
||||
@implementation PullRequest
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
#if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
#endif
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithTitle: (NSString *) title
|
||||
{
|
||||
self = [super init];
|
||||
__title = [title retain_stub];
|
||||
__title_isset = YES;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *) decoder
|
||||
{
|
||||
self = [super init];
|
||||
if ([decoder containsValueForKey: @"title"])
|
||||
{
|
||||
__title = [[decoder decodeObjectForKey: @"title"] retain_stub];
|
||||
__title_isset = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *) encoder
|
||||
{
|
||||
if (__title_isset)
|
||||
{
|
||||
[encoder encodeObject: __title forKey: @"title"];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger) hash
|
||||
{
|
||||
NSUInteger hash = 17;
|
||||
hash = (hash * 31) ^ __title_isset ? 2654435761 : 0;
|
||||
if (__title_isset)
|
||||
{
|
||||
hash = (hash * 31) ^ [__title hash];
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id) anObject
|
||||
{
|
||||
if (self == anObject) {
|
||||
return YES;
|
||||
}
|
||||
if (![anObject isKindOfClass:[PullRequest class]]) {
|
||||
return NO;
|
||||
}
|
||||
PullRequest *other = (PullRequest *)anObject;
|
||||
if ((__title_isset != other->__title_isset) ||
|
||||
(__title_isset && ((__title || other->__title) && ![__title isEqual:other->__title]))) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[__title release_stub];
|
||||
[super dealloc_stub];
|
||||
}
|
||||
|
||||
- (NSString *) title {
|
||||
return [[__title retain_stub] autorelease_stub];
|
||||
}
|
||||
|
||||
- (void) setTitle: (NSString *) title {
|
||||
[title retain_stub];
|
||||
[__title release_stub];
|
||||
__title = title;
|
||||
__title_isset = YES;
|
||||
}
|
||||
|
||||
- (BOOL) titleIsSet {
|
||||
return __title_isset;
|
||||
}
|
||||
|
||||
- (void) unsetTitle {
|
||||
[__title release_stub];
|
||||
__title = nil;
|
||||
__title_isset = NO;
|
||||
}
|
||||
|
||||
- (void) read: (id <TProtocol>) inProtocol
|
||||
{
|
||||
NSString * fieldName;
|
||||
int fieldType;
|
||||
int fieldID;
|
||||
|
||||
[inProtocol readStructBeginReturningName: NULL];
|
||||
while (true)
|
||||
{
|
||||
[inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID];
|
||||
if (fieldType == TType_STOP) {
|
||||
break;
|
||||
}
|
||||
switch (fieldID)
|
||||
{
|
||||
case 1:
|
||||
if (fieldType == TType_STRING) {
|
||||
NSString * fieldValue = [inProtocol readString];
|
||||
[self setTitle: fieldValue];
|
||||
} else {
|
||||
[TProtocolUtil skipType: fieldType onProtocol: inProtocol];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
[TProtocolUtil skipType: fieldType onProtocol: inProtocol];
|
||||
break;
|
||||
}
|
||||
[inProtocol readFieldEnd];
|
||||
}
|
||||
[inProtocol readStructEnd];
|
||||
}
|
||||
|
||||
- (void) write: (id <TProtocol>) outProtocol {
|
||||
[outProtocol writeStructBeginWithName: @"PullRequest"];
|
||||
if (__title_isset) {
|
||||
if (__title != nil) {
|
||||
[outProtocol writeFieldBeginWithName: @"title" type: TType_STRING fieldID: 1];
|
||||
[outProtocol writeString: __title];
|
||||
[outProtocol writeFieldEnd];
|
||||
}
|
||||
}
|
||||
[outProtocol writeFieldStop];
|
||||
[outProtocol writeStructEnd];
|
||||
}
|
||||
|
||||
- (void) validate {
|
||||
// check for required fields
|
||||
}
|
||||
|
||||
- (NSString *) description {
|
||||
NSMutableString * ms = [NSMutableString stringWithString: @"PullRequest("];
|
||||
[ms appendString: @"title:"];
|
||||
[ms appendFormat: @"\"%@\"", __title];
|
||||
[ms appendString: @")"];
|
||||
return [NSString stringWithString: ms];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation linguistConstants
|
||||
+ (void) initialize {
|
||||
}
|
||||
@end
|
||||
|
||||
142
samples/PHP/file_display.inc
Normal file
142
samples/PHP/file_display.inc
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'title' => t('File display'),
|
||||
'description' => t('Displays the file with a configurable style.'),
|
||||
'required context' => new ctools_context_required(t('File'), 'entity:file'),
|
||||
'category' => t('File'),
|
||||
'defaults' => array(
|
||||
'displays' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the node content.
|
||||
*/
|
||||
function file_entity_file_display_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (!empty($context) && empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
$file = isset($context->data) ? clone($context->data) : NULL;
|
||||
$block = new stdClass();
|
||||
$block->module = 'file_entity';
|
||||
$block->delta = $file->fid;
|
||||
|
||||
if (empty($file)) {
|
||||
$block->delta = 'placeholder';
|
||||
$block->title = t('File display');
|
||||
$block->content = t('File display goes here.');
|
||||
}
|
||||
else {
|
||||
if (!empty($conf['identifier'])) {
|
||||
$file->ctools_template_identifier = $conf['identifier'];
|
||||
}
|
||||
|
||||
$block->title = $file->filename;
|
||||
$block->content = file_view_file($file, $conf['displays']);
|
||||
}
|
||||
|
||||
if (!empty($conf['link']) && $file) {
|
||||
$block->title_link = entity_uri('file', $file);
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit form for this plugin.
|
||||
*/
|
||||
function file_entity_file_display_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
$form['#tree'] = TRUE;
|
||||
$form['#attached']['js'][] = drupal_get_path('module', 'file_entity') . '/file_entity.admin.js';
|
||||
|
||||
// Retrieve available formatters for this file. We can load all file types
|
||||
// since we don't know which type the file is at this point.
|
||||
$formatters = file_info_formatter_types();
|
||||
|
||||
// Formatter status.
|
||||
$form['displays']['status'] = array(
|
||||
'#type' => 'item',
|
||||
'#title' => t('Enabled displays'),
|
||||
'#prefix' => '<div id="file-displays-status-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
$i=0;
|
||||
foreach ($formatters as $name => $formatter) {
|
||||
$form['displays']['status'][$name] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => check_plain($formatter['label']),
|
||||
'#default_value' => !empty($conf['displays'][$name]['status']),
|
||||
'#description' => isset($formatter['description']) ? filter_xss($formatter['description']) : NULL,
|
||||
'#parents' => array('displays', $name, 'status'),
|
||||
'#weight' => (isset($formatter['weight']) ? $formatter['weight'] : 0) + ($i / 1000),
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
// Formatter order (tabledrag).
|
||||
$form['displays']['order'] = array(
|
||||
'#type' => 'item',
|
||||
'#title' => t('Display precedence order'),
|
||||
'#theme' => 'file_entity_file_display_order',
|
||||
);
|
||||
foreach ($formatters as $name => $formatter) {
|
||||
$form['displays']['order'][$name]['label'] = array(
|
||||
'#markup' => check_plain($formatter['label']),
|
||||
);
|
||||
$form['displays']['order'][$name]['weight'] = array(
|
||||
'#type' => 'weight',
|
||||
'#title' => t('Weight for @title', array('@title' => $formatter['label'])),
|
||||
'#title_display' => 'invisible',
|
||||
'#delta' => 50,
|
||||
'#default_value' => isset($conf['displays'][$name]['weight']) ? $conf['displays'][$name]['weight'] : 0,
|
||||
'#parents' => array('displays', $name, 'weight'),
|
||||
);
|
||||
$form['displays']['order'][$name]['#weight'] = $form['displays']['order'][$name]['weight']['#default_value'];
|
||||
}
|
||||
|
||||
// Formatter settings.
|
||||
$form['display_settings_title'] = array(
|
||||
'#type' => 'item',
|
||||
'#title' => t('Display settings'),
|
||||
);
|
||||
$form['display_settings'] = array(
|
||||
'#type' => 'vertical_tabs',
|
||||
);
|
||||
$i=0;
|
||||
foreach ($formatters as $name => $formatter) {
|
||||
if (isset($formatter['settings callback']) && ($function = $formatter['settings callback']) && function_exists($function)) {
|
||||
$defaults = !empty($formatter['default settings']) ? $formatter['default settings'] : array();
|
||||
$settings = !empty($conf['displays'][$name]['settings']) ? $conf['displays'][$name]['settings'] : array();
|
||||
$settings += $defaults;
|
||||
$settings_form = $function($form, $form_state, $settings, $name, $file_type, $view_mode);
|
||||
if (!empty($settings_form)) {
|
||||
$form['displays']['settings'][$name] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => check_plain($formatter['label']),
|
||||
'#parents' => array('displays', $name, 'settings'),
|
||||
'#group' => 'display_settings',
|
||||
'#weight' => (isset($formatter['weight']) ? $formatter['weight'] : 0) + ($i / 1000),
|
||||
) + $settings_form;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
function file_entity_file_display_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
function file_entity_file_display_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" content', array('@s' => $context->identifier));
|
||||
}
|
||||
6
samples/PHP/root.php
Normal file
6
samples/PHP/root.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
////////////////////////////////////
|
||||
// I am not Isabelle ROOT //
|
||||
////////////////////////////////////
|
||||
|
||||
?>
|
||||
37
samples/Pascal/image_url.inc
Normal file
37
samples/Pascal/image_url.inc
Normal file
@@ -0,0 +1,37 @@
|
||||
function GetUnixMangaImageURL: Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
l: TStringList;
|
||||
s: String;
|
||||
begin
|
||||
l := TStringList.Create;
|
||||
s := manager.container.PageContainerLinks[workCounter];
|
||||
Result := GetPage(TObject(l), s , manager.container.Manager.retryConnect);
|
||||
|
||||
if Self.Terminated then
|
||||
begin
|
||||
l.Free;
|
||||
parse.Free;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
parse := TStringList.Create;
|
||||
Parser := THTMLParser.Create(PChar(l.Text));
|
||||
Parser.OnFoundTag := OnTag;
|
||||
Parser.OnFoundText := OnText;
|
||||
Parser.Exec;
|
||||
Parser.Free;
|
||||
l.Free;
|
||||
if parse.Count > 0 then
|
||||
begin
|
||||
for i := 0 to parse.Count - 1 do
|
||||
begin
|
||||
if (Pos('STYLE="border', parse[i]) > 0) and (Pos('<IMG', parse[i]) > 0) then
|
||||
begin
|
||||
manager.container.PageLinks[workCounter] := Trim(GetVal(parse[i], 'SRC'));
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
parse.Free;
|
||||
end;
|
||||
56
samples/Pascal/libc.inc
Normal file
56
samples/Pascal/libc.inc
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
This file is part of the Free Component Library (FCL)
|
||||
Copyright (c) 1999-2002 by the Free Pascal development team
|
||||
|
||||
BIOS functions unit for Nintendo DS
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************}
|
||||
|
||||
function __errno: plongint; cdecl; export;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
function S_ISBLK(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFBLK;
|
||||
end;
|
||||
|
||||
function S_ISCHR(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFCHR;
|
||||
end;
|
||||
|
||||
function S_ISDIR(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFDIR;
|
||||
end;
|
||||
|
||||
function S_ISFIFO(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFIFO;
|
||||
end;
|
||||
|
||||
function S_ISREG(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFREG;
|
||||
end;
|
||||
|
||||
function S_ISLNK(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFLNK;
|
||||
end;
|
||||
|
||||
function S_ISSOCK(m: longint): boolean; inline;
|
||||
begin
|
||||
result := (m and _IFMT) = _IFSOCK;
|
||||
end;
|
||||
502
samples/Pascal/vmops_impl.inc
Normal file
502
samples/Pascal/vmops_impl.inc
Normal file
@@ -0,0 +1,502 @@
|
||||
operator+(a, b: TVector)res: TVector;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, rn);
|
||||
for i := 0 to rn - 1 do res[i] := a[i mod an] + b[i mod bn];
|
||||
end;
|
||||
|
||||
operator+(a: TVector; b: Double)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] + b;
|
||||
end;
|
||||
|
||||
operator+(a: Double; b: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a + b[i];
|
||||
end;
|
||||
|
||||
operator-(a: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := -a[i];
|
||||
end;
|
||||
|
||||
operator-(a, b: TVector)res: TVector;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, rn);
|
||||
for i := 0 to rn - 1 do res[i] := a[i mod an] - b[i mod bn];
|
||||
end;
|
||||
|
||||
operator-(a: TVector; b: Double)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] - b;
|
||||
end;
|
||||
|
||||
operator-(a: Double; b: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a - b[i];
|
||||
end;
|
||||
|
||||
operator*(a, b: TVector)res: TVector;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, rn);
|
||||
for i := 0 to rn - 1 do res[i] := a[i mod an] * b[i mod bn];
|
||||
end;
|
||||
|
||||
operator*(a: TVector; b: Double)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] * b;
|
||||
end;
|
||||
|
||||
operator*(a: Double; b: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a * b[i];
|
||||
end;
|
||||
|
||||
operator/(a, b: TVector)res: TVector;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, rn);
|
||||
for i := 0 to rn - 1 do res[i] := a[i mod an] / b[i mod bn];
|
||||
end;
|
||||
|
||||
operator/(a: TVector; b: Double)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] / b;
|
||||
end;
|
||||
|
||||
operator/(a: Double; b: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a / b[i];
|
||||
end;
|
||||
|
||||
operator**(a, b: Double)res: Double;
|
||||
begin
|
||||
if IsNan(a) or IsNan(b) then res := NaN
|
||||
else if b = Infinity then begin
|
||||
if a = NegInfinity then res := NaN
|
||||
else case sign(a) of
|
||||
1: res := Infinity;
|
||||
0: res := 0;
|
||||
-1: res := NegInfinity;
|
||||
end;
|
||||
end else if b = NegInfinity then begin
|
||||
if a = NegInfinity then res := NaN
|
||||
else case sign(a) of
|
||||
1: res := 0;
|
||||
0: res := Infinity;
|
||||
-1: res := 0;
|
||||
end;
|
||||
end else res := power(a, b);
|
||||
end;
|
||||
|
||||
operator**(a, b: TVector)res: TVector;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, rn);
|
||||
for i := 0 to rn - 1 do res[i] := a[i mod an] ** b[i mod bn];
|
||||
end;
|
||||
|
||||
operator**(a: TVector; b: Double)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] ** b;
|
||||
end;
|
||||
|
||||
operator**(a: Double; b: TVector)res: TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a ** b[i];
|
||||
end;
|
||||
|
||||
operator><(a: TVector; b: TVector)res: TMatrix;
|
||||
var
|
||||
i, an, bn, rn: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
bn := Length(b);
|
||||
if an * bn = 0 then Exit(nil);
|
||||
rn := math.max(an, bn);
|
||||
SetLength(res, 1);
|
||||
SetLength(res[0], 1);
|
||||
res[0][0] := 0;
|
||||
for i := 0 to rn - 1 do res[0][0] := res[0][0] + a[i mod an] * b[i mod bn];
|
||||
end;
|
||||
|
||||
operator+(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, an: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
SetLength(res, an);
|
||||
for i := 0 to an - 1 do res[i] := a[i] + b[i];
|
||||
end;
|
||||
|
||||
operator+(a: TMatrix; b: Double)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] + b;
|
||||
end;
|
||||
|
||||
operator+(a: Double; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a + b[i];
|
||||
end;
|
||||
|
||||
operator+(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a + matrix(b, Length(a), Length(a[0]));
|
||||
end;
|
||||
|
||||
operator+(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := b + matrix(a, Length(b), Length(b[0]));
|
||||
end;
|
||||
|
||||
operator-(a: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := -a[i];
|
||||
end;
|
||||
|
||||
operator-(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, an: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
SetLength(res, an);
|
||||
for i := 0 to an - 1 do res[i] := a[i] - b[i];
|
||||
end;
|
||||
|
||||
operator-(a: TMatrix; b: Double)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] - b;
|
||||
end;
|
||||
|
||||
operator-(a: Double; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a - b[i];
|
||||
end;
|
||||
|
||||
operator-(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a - matrix(b, Length(a), Length(a[0]));
|
||||
end;
|
||||
|
||||
operator-(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := b - matrix(a, Length(b), Length(b[0]));
|
||||
end;
|
||||
|
||||
operator*(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, an: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
SetLength(res, an);
|
||||
for i := 0 to an - 1 do res[i] := a[i] * b[i];
|
||||
end;
|
||||
|
||||
operator*(a: TMatrix; b: Double)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] * b;
|
||||
end;
|
||||
|
||||
operator*(a: Double; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a * b[i];
|
||||
end;
|
||||
|
||||
operator*(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a * matrix(b, Length(a), Length(a[0]));
|
||||
end;
|
||||
|
||||
operator*(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := b * matrix(a, Length(b), Length(b[0]));
|
||||
end;
|
||||
|
||||
operator/(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, an: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
SetLength(res, an);
|
||||
for i := 0 to an - 1 do res[i] := a[i] / b[i];
|
||||
end;
|
||||
|
||||
operator/(a: TMatrix; b: Double)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] / b;
|
||||
end;
|
||||
|
||||
operator/(a: Double; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a / b[i];
|
||||
end;
|
||||
|
||||
operator/(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a / matrix(b, Length(a), Length(a[0]));
|
||||
end;
|
||||
|
||||
operator/(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := b / matrix(a, Length(b), Length(b[0]));
|
||||
end;
|
||||
|
||||
operator**(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, an: Integer;
|
||||
begin
|
||||
an := Length(a);
|
||||
SetLength(res, an);
|
||||
for i := 0 to an - 1 do res[i] := a[i] ** b[i];
|
||||
end;
|
||||
|
||||
operator**(a: TMatrix; b: Double)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a[i] ** b;
|
||||
end;
|
||||
|
||||
operator**(a: Double; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(b);
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do res[i] := a ** b[i];
|
||||
end;
|
||||
|
||||
operator**(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a ** matrix(b, Length(a), Length(a[0]));
|
||||
end;
|
||||
|
||||
operator**(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := b ** matrix(a, Length(b), Length(b[0]));
|
||||
end;
|
||||
|
||||
operator><(a: TMatrix; b: TMatrix)res: TMatrix;
|
||||
var
|
||||
i, j, n, m: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
m := Length(b);
|
||||
if (n = 1) and (m = 1) then Exit(vector(a) >< vector(b));
|
||||
SetLength(res, n);
|
||||
for i := 0 to n - 1 do begin
|
||||
j := 0;
|
||||
res[i] := a[i][j] * b[j];
|
||||
for j := 1 to m - 1 do res[i] := res[i] + a[i][j] * b[j];
|
||||
end;
|
||||
end;
|
||||
|
||||
operator><(a: TMatrix; b: TVector)res: TMatrix;
|
||||
begin
|
||||
res := a >< matrix(b, 1, Length(b));
|
||||
end;
|
||||
|
||||
operator><(a: TVector; b: TMatrix)res: TMatrix;
|
||||
begin
|
||||
res := matrix(a, 1, Length(a)) >< b;
|
||||
end;
|
||||
|
||||
function vector(a: array of const): TVector;
|
||||
var
|
||||
i, n: Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
SetLength(Result, n);
|
||||
for i := 0 to n - 1 do case a[i].VType of
|
||||
vtInteger: Result[i] := a[i].VInteger;
|
||||
vtExtended: Result[i] := a[i].VExtended^;
|
||||
vtCurrency: Result[i] := a[i].VCurrency^;
|
||||
vtInt64: Result[i] := a[i].VInt64^;
|
||||
end;
|
||||
end;
|
||||
|
||||
function vector(a: TMatrix): TVector; inline;
|
||||
var
|
||||
i, j, n, m : Integer;
|
||||
begin
|
||||
n := Length(a);
|
||||
if n = 0 then Exit(nil);
|
||||
m := Length(a[0]);
|
||||
if m = 0 then Exit(nil);
|
||||
SetLength(Result, m * n);
|
||||
for i := 0 to m - 1 do
|
||||
for j := 0 to n - 1 do
|
||||
Result[i * n + j] := a[j][i];
|
||||
end;
|
||||
|
||||
function matrix(data: TVector; nrow, ncol: Integer; byrow: Boolean): TMatrix;
|
||||
var
|
||||
i, j, n, c: Integer;
|
||||
begin
|
||||
n := Length(data);
|
||||
if n = 0 then Exit(nil);
|
||||
if (nrow = 0) and (ncol = 0) then ncol := 1;
|
||||
if nrow = 0 then nrow := (n div ncol) + sign(n mod ncol);
|
||||
if ncol = 0 then ncol := (n div nrow) + sign(n mod nrow);
|
||||
SetLength(Result, nrow);
|
||||
for i := 0 to nrow - 1 do begin
|
||||
SetLength(Result[i], ncol);
|
||||
for j := 0 to ncol - 1 do begin
|
||||
if byrow then c := i * ncol + j else c := j * nrow + i;
|
||||
Result[i][j] := data[c mod n];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function matrix(data: TMatrix; nrow, ncol: Integer; byrow: Boolean): TMatrix;
|
||||
begin
|
||||
Result := matrix(vector(data), nrow, ncol, byrow);
|
||||
end;
|
||||
|
||||
function rep(data: TVector; times: TVector): TVector;
|
||||
var
|
||||
i, j, n, m, s, c: Integer;
|
||||
begin
|
||||
Result := nil;
|
||||
n := Length(data);
|
||||
m := Length(times);
|
||||
if n * m = 0 then Exit;
|
||||
s := 0;
|
||||
for i := 0 to n - 1 do begin
|
||||
c := trunc(times[i mod m]);
|
||||
if c > 0 then s += c;
|
||||
end;
|
||||
SetLength(Result, s);
|
||||
c := 0;
|
||||
for i := 0 to n - 1 do begin
|
||||
s := trunc(times[i mod m]);
|
||||
for j := 1 to s do begin
|
||||
Result[c] := data[i];
|
||||
Inc(c);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function rep(data: TVector; len: Integer): TVector;
|
||||
var
|
||||
i, j, n: Integer;
|
||||
begin
|
||||
n := Length(data);
|
||||
SetLength(Result, n * len);
|
||||
if n = 0 then Exit;
|
||||
for i := 0 to len - 1 do
|
||||
for j := 0 to n - 1 do
|
||||
Result[i * n + j] := data[j];
|
||||
end;
|
||||
|
||||
function rep(data: Double; len: Integer): TVector;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
SetLength(Result, len);
|
||||
for i := 0 to len - 1 do Result[i] := data;
|
||||
end;
|
||||
13
samples/Perl/getchar.al
Normal file
13
samples/Perl/getchar.al
Normal file
@@ -0,0 +1,13 @@
|
||||
# NOTE: Derived from ../../lib/POSIX.pm.
|
||||
# Changes made here will be lost when autosplit is run again.
|
||||
# See AutoSplit.pm.
|
||||
package POSIX;
|
||||
|
||||
#line 318 "../../lib/POSIX.pm (autosplit into ../../lib/auto/POSIX/getchar.al)"
|
||||
sub getchar {
|
||||
usage "getchar()" if @_ != 0;
|
||||
CORE::getc(STDIN);
|
||||
}
|
||||
|
||||
# end of POSIX::getchar
|
||||
1;
|
||||
@@ -1,4 +1,5 @@
|
||||
use Test::Base;
|
||||
use Test::More;
|
||||
|
||||
__DATA__
|
||||
=== Strict Test
|
||||
|
||||
@@ -73,26 +73,6 @@ Here's some POD! Wooo
|
||||
|
||||
say('this is not!');
|
||||
|
||||
=table
|
||||
Of role things
|
||||
|
||||
say('not in your table');
|
||||
#= A single line declarator "block" (with a keyword like role)
|
||||
#| Another single line declarator "block" (with a keyword like role)
|
||||
#={
|
||||
A declarator block (with a keyword like role)
|
||||
}
|
||||
#|{
|
||||
Another declarator block (with a keyword like role)
|
||||
}
|
||||
#= { A single line declarator "block" with a brace (with a keyword like role)
|
||||
#=«
|
||||
More declarator blocks! (with a keyword like role)
|
||||
»
|
||||
#|«
|
||||
More declarator blocks! (with a keyword like role)
|
||||
»
|
||||
|
||||
say 'Moar code!';
|
||||
|
||||
my $don't = 16;
|
||||
|
||||
165
samples/PicoLisp/simul.l
Normal file
165
samples/PicoLisp/simul.l
Normal file
@@ -0,0 +1,165 @@
|
||||
# 11dec13abu
|
||||
# (c) Software Lab. Alexander Burger
|
||||
|
||||
(de permute (Lst)
|
||||
(ifn (cdr Lst)
|
||||
(cons Lst)
|
||||
(mapcan
|
||||
'((X)
|
||||
(mapcar
|
||||
'((Y) (cons X Y))
|
||||
(permute (delete X Lst)) ) )
|
||||
Lst ) ) )
|
||||
|
||||
(de subsets (N Lst)
|
||||
(cond
|
||||
((=0 N) '(NIL))
|
||||
((not Lst))
|
||||
(T
|
||||
(conc
|
||||
(mapcar
|
||||
'((X) (cons (car Lst) X))
|
||||
(subsets (dec N) (cdr Lst)) )
|
||||
(subsets N (cdr Lst)) ) ) ) )
|
||||
|
||||
(de shuffle (Lst)
|
||||
(by '(NIL (rand)) sort Lst) )
|
||||
|
||||
(de samples (Cnt Lst)
|
||||
(make
|
||||
(until (=0 Cnt)
|
||||
(when (>= Cnt (rand 1 (length Lst)))
|
||||
(link (car Lst))
|
||||
(dec 'Cnt) )
|
||||
(pop 'Lst) ) ) )
|
||||
|
||||
|
||||
# Genetic Algorithm
|
||||
(de gen ("Pop" "Cond" "Re" "Mu" "Se")
|
||||
(until ("Cond" "Pop")
|
||||
(for ("P" "Pop" "P" (cdr "P"))
|
||||
(set "P"
|
||||
(maxi "Se" # Selection
|
||||
(make
|
||||
(for ("P" "Pop" "P")
|
||||
(rot "P" (rand 1 (length "P")))
|
||||
(link # Recombination + Mutation
|
||||
("Mu" ("Re" (pop '"P") (pop '"P"))) ) ) ) ) ) ) )
|
||||
(maxi "Se" "Pop") )
|
||||
|
||||
|
||||
# Alpha-Beta tree search
|
||||
(de game ("Flg" "Cnt" "Moves" "Move" "Cost")
|
||||
(let ("Alpha" '(1000000) "Beta" -1000000)
|
||||
(recur ("Flg" "Cnt" "Alpha" "Beta")
|
||||
(let? "Lst" ("Moves" "Flg")
|
||||
(if (=0 (dec '"Cnt"))
|
||||
(loop
|
||||
("Move" (caar "Lst"))
|
||||
(setq "*Val" (list ("Cost" "Flg") (car "Lst")))
|
||||
("Move" (cdar "Lst"))
|
||||
(T (>= "Beta" (car "*Val"))
|
||||
(cons "Beta" (car "Lst") (cdr "Alpha")) )
|
||||
(when (> (car "Alpha") (car "*Val"))
|
||||
(setq "Alpha" "*Val") )
|
||||
(NIL (setq "Lst" (cdr "Lst")) "Alpha") )
|
||||
(setq "Lst"
|
||||
(sort
|
||||
(mapcar
|
||||
'(("Mov")
|
||||
(prog2
|
||||
("Move" (car "Mov"))
|
||||
(cons ("Cost" "Flg") "Mov")
|
||||
("Move" (cdr "Mov")) ) )
|
||||
"Lst" ) ) )
|
||||
(loop
|
||||
("Move" (cadar "Lst"))
|
||||
(setq "*Val"
|
||||
(if (recurse (not "Flg") "Cnt" (cons (- "Beta")) (- (car "Alpha")))
|
||||
(cons (- (car @)) (cdar "Lst") (cdr @))
|
||||
(list (caar "Lst") (cdar "Lst")) ) )
|
||||
("Move" (cddar "Lst"))
|
||||
(T (>= "Beta" (car "*Val"))
|
||||
(cons "Beta" (cdar "Lst") (cdr "Alpha")) )
|
||||
(when (> (car "Alpha") (car "*Val"))
|
||||
(setq "Alpha" "*Val") )
|
||||
(NIL (setq "Lst" (cdr "Lst")) "Alpha") ) ) ) ) ) )
|
||||
|
||||
|
||||
### Grids ###
|
||||
(de grid (DX DY FX FY)
|
||||
(let Grid
|
||||
(make
|
||||
(for X DX
|
||||
(link
|
||||
(make
|
||||
(for Y DY
|
||||
(set
|
||||
(link
|
||||
(if (> DX 26)
|
||||
(box)
|
||||
(intern (pack (char (+ X 96)) Y)) ) )
|
||||
(cons (cons) (cons)) ) ) ) ) ) )
|
||||
(let West (and FX (last Grid))
|
||||
(for (Lst Grid Lst)
|
||||
(let
|
||||
(Col (pop 'Lst)
|
||||
East (or (car Lst) (and FX (car Grid)))
|
||||
South (and FY (last Col)) )
|
||||
(for (L Col L)
|
||||
(with (pop 'L)
|
||||
(set (: 0 1) (pop 'West)) # west
|
||||
(con (: 0 1) (pop 'East)) # east
|
||||
(set (: 0 -1) South) # south
|
||||
(con (: 0 -1) # north
|
||||
(or (car L) (and FY (car Col))) )
|
||||
(setq South This) ) )
|
||||
(setq West Col) ) ) )
|
||||
Grid ) )
|
||||
|
||||
(de west (This)
|
||||
(: 0 1 1) )
|
||||
|
||||
(de east (This)
|
||||
(: 0 1 -1) )
|
||||
|
||||
(de south (This)
|
||||
(: 0 -1 1) )
|
||||
|
||||
(de north (This)
|
||||
(: 0 -1 -1) )
|
||||
|
||||
(de disp ("Grid" "How" "Fun" "X" "Y" "DX" "DY")
|
||||
(setq "Grid"
|
||||
(if "X"
|
||||
(mapcar
|
||||
'((L) (flip (head "DY" (nth L "Y"))))
|
||||
(head "DX" (nth "Grid" "X")) )
|
||||
(mapcar reverse "Grid") ) )
|
||||
(let (N (+ (length (cdar "Grid")) (or "Y" 1)) Sp (length N))
|
||||
("border" north)
|
||||
(while (caar "Grid")
|
||||
(prin " " (align Sp N) " "
|
||||
(and "How" (if (and (nT "How") (west (caar "Grid"))) " " '|)) )
|
||||
(for L "Grid"
|
||||
(prin
|
||||
("Fun" (car L))
|
||||
(and "How" (if (and (nT "How") (east (car L))) " " '|)) ) )
|
||||
(prinl)
|
||||
("border" south)
|
||||
(map pop "Grid")
|
||||
(dec 'N) )
|
||||
(unless (> (default "X" 1) 26)
|
||||
(space (inc Sp))
|
||||
(for @ "Grid"
|
||||
(prin " " (and "How" " ") (char (+ 96 "X")))
|
||||
(T (> (inc '"X") 26)) )
|
||||
(prinl) ) ) )
|
||||
|
||||
(de "border" (Dir)
|
||||
(when "How"
|
||||
(space Sp)
|
||||
(prin " +")
|
||||
(for L "Grid"
|
||||
(prin (if (and (nT "How") (Dir (car L))) " +" "---+")) )
|
||||
(prinl) ) )
|
||||
83
samples/Python/gen-py-linguist-thrift.py
Normal file
83
samples/Python/gen-py-linguist-thrift.py
Normal file
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
#
|
||||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
#
|
||||
# options string: py
|
||||
#
|
||||
|
||||
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
|
||||
|
||||
from thrift.transport import TTransport
|
||||
from thrift.protocol import TBinaryProtocol, TProtocol
|
||||
try:
|
||||
from thrift.protocol import fastbinary
|
||||
except:
|
||||
fastbinary = None
|
||||
|
||||
|
||||
|
||||
class PullRequest:
|
||||
"""
|
||||
Attributes:
|
||||
- title
|
||||
"""
|
||||
|
||||
thrift_spec = (
|
||||
None, # 0
|
||||
(1, TType.STRING, 'title', None, None, ), # 1
|
||||
)
|
||||
|
||||
def __init__(self, title=None,):
|
||||
self.title = title
|
||||
|
||||
def read(self, iprot):
|
||||
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
|
||||
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
|
||||
return
|
||||
iprot.readStructBegin()
|
||||
while True:
|
||||
(fname, ftype, fid) = iprot.readFieldBegin()
|
||||
if ftype == TType.STOP:
|
||||
break
|
||||
if fid == 1:
|
||||
if ftype == TType.STRING:
|
||||
self.title = iprot.readString()
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
else:
|
||||
iprot.skip(ftype)
|
||||
iprot.readFieldEnd()
|
||||
iprot.readStructEnd()
|
||||
|
||||
def write(self, oprot):
|
||||
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
|
||||
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
|
||||
return
|
||||
oprot.writeStructBegin('PullRequest')
|
||||
if self.title is not None:
|
||||
oprot.writeFieldBegin('title', TType.STRING, 1)
|
||||
oprot.writeString(self.title)
|
||||
oprot.writeFieldEnd()
|
||||
oprot.writeFieldStop()
|
||||
oprot.writeStructEnd()
|
||||
|
||||
def validate(self):
|
||||
return
|
||||
|
||||
|
||||
def __hash__(self):
|
||||
value = 17
|
||||
value = (value * 31) ^ hash(self.title)
|
||||
return value
|
||||
|
||||
def __repr__(self):
|
||||
L = ['%s=%r' % (key, value)
|
||||
for key, value in self.__dict__.iteritems()]
|
||||
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
155
samples/QML/common.qbs
Normal file
155
samples/QML/common.qbs
Normal file
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of the Qt Build Suite.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import qbs 1.0
|
||||
import qbs.FileInfo
|
||||
import qbs.ModUtils
|
||||
|
||||
Module {
|
||||
property string buildVariant: "debug"
|
||||
property bool enableDebugCode: buildVariant == "debug"
|
||||
property bool debugInformation: (buildVariant == "debug")
|
||||
property string optimization: (buildVariant == "debug" ? "none" : "fast")
|
||||
readonly property stringList hostOS: undefined // set internally
|
||||
property string hostOSVersion: {
|
||||
if (hostOS && hostOS.contains("osx")) {
|
||||
return getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductVersion") ||
|
||||
getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductVersion");
|
||||
} else if (hostOS && hostOS.contains("windows")) {
|
||||
var version = getNativeSetting("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion", "CurrentVersion");
|
||||
return version + "." + hostOSBuildVersion;
|
||||
}
|
||||
}
|
||||
|
||||
property string hostOSBuildVersion: {
|
||||
if (hostOS.contains("osx")) {
|
||||
return getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductBuildVersion") ||
|
||||
getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductBuildVersion");
|
||||
} else if (hostOS.contains("windows")) {
|
||||
return getNativeSetting("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion", "CurrentBuildNumber");
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var hostOSVersionParts: hostOSVersion ? hostOSVersion.split('.').map(function(item) { return parseInt(item, 10); }) : []
|
||||
readonly property int hostOSVersionMajor: hostOSVersionParts[0] || 0
|
||||
readonly property int hostOSVersionMinor: hostOSVersionParts[1] || 0
|
||||
readonly property int hostOSVersionPatch: hostOSVersionParts[2] || 0
|
||||
|
||||
property stringList targetOS: hostOS
|
||||
property string pathListSeparator: hostOS.contains("windows") ? ";" : ":"
|
||||
property string pathSeparator: hostOS.contains("windows") ? "\\" : "/"
|
||||
property string profile
|
||||
property stringList toolchain
|
||||
property string architecture
|
||||
property bool install: false
|
||||
property string installSourceBase
|
||||
readonly property string installRoot: undefined
|
||||
property string installDir
|
||||
property string installPrefix: ""
|
||||
property path sysroot
|
||||
|
||||
PropertyOptions {
|
||||
name: "buildVariant"
|
||||
allowedValues: ['debug', 'release']
|
||||
description: "name of the build variant"
|
||||
}
|
||||
|
||||
PropertyOptions {
|
||||
name: "optimization"
|
||||
allowedValues: ['none', 'fast', 'small']
|
||||
description: "optimization level"
|
||||
}
|
||||
|
||||
validate: {
|
||||
var validator = new ModUtils.PropertyValidator("qbs");
|
||||
validator.setRequiredProperty("architecture", architecture,
|
||||
"you might want to re-run 'qbs-setup-toolchains'");
|
||||
validator.setRequiredProperty("hostOS", hostOS);
|
||||
validator.setRequiredProperty("targetOS", targetOS);
|
||||
if (hostOS && (hostOS.contains("windows") || hostOS.contains("osx"))) {
|
||||
validator.setRequiredProperty("hostOSVersion", hostOSVersion,
|
||||
"could not detect host operating system version; " +
|
||||
"verify that system files and registry keys have not " +
|
||||
"been modified.");
|
||||
if (hostOSVersion)
|
||||
validator.addVersionValidator("hostOSVersion", hostOSVersion, 2, 4);
|
||||
|
||||
validator.setRequiredProperty("hostOSBuildVersion", hostOSBuildVersion,
|
||||
"could not detect host operating system build version; " +
|
||||
"verify that system files or registry have not been " +
|
||||
"tampered with.");
|
||||
}
|
||||
|
||||
validator.addCustomValidator("architecture", architecture, function (value) {
|
||||
return architecture === canonicalArchitecture(architecture);
|
||||
}, "'" + architecture + "' is invalid. You must use the canonical name '" +
|
||||
canonicalArchitecture(architecture) + "'");
|
||||
|
||||
validator.validate();
|
||||
}
|
||||
|
||||
// private properties
|
||||
property var commonRunEnvironment: {
|
||||
var env = {};
|
||||
if (targetOS.contains("windows")) {
|
||||
env["PATH"] = [
|
||||
FileInfo.joinPaths(installRoot, installPrefix)
|
||||
];
|
||||
} else if (hostOS.contains("darwin") && targetOS.contains("darwin")) {
|
||||
env["DYLD_FRAMEWORK_PATH"] = [
|
||||
FileInfo.joinPaths(installRoot, installPrefix, "Library", "Frameworks"),
|
||||
FileInfo.joinPaths(installRoot, installPrefix, "lib"),
|
||||
FileInfo.joinPaths(installRoot, installPrefix)
|
||||
].join(pathListSeparator);
|
||||
|
||||
env["DYLD_LIBRARY_PATH"] = [
|
||||
FileInfo.joinPaths(installRoot, installPrefix, "lib"),
|
||||
FileInfo.joinPaths(installRoot, installPrefix, "Library", "Frameworks"),
|
||||
FileInfo.joinPaths(installRoot, installPrefix)
|
||||
].join(pathListSeparator);
|
||||
|
||||
if (targetOS.contains("ios-simulator") && sysroot) {
|
||||
env["DYLD_ROOT_PATH"] = [sysroot];
|
||||
}
|
||||
} else if (hostOS.contains("unix") && targetOS.contains("unix")) {
|
||||
env["LD_LIBRARY_PATH"] = [
|
||||
FileInfo.joinPaths(installRoot, installPrefix, "lib")
|
||||
];
|
||||
}
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
// internal properties
|
||||
readonly property string version: [versionMajor, versionMinor, versionPatch].join(".")
|
||||
readonly property int versionMajor: undefined // set internally
|
||||
readonly property int versionMinor: undefined // set internally
|
||||
readonly property int versionPatch: undefined // set internally
|
||||
}
|
||||
9
samples/Ruby/gen-rb-linguist-thrift.rb
Normal file
9
samples/Ruby/gen-rb-linguist-thrift.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
#
|
||||
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
#
|
||||
|
||||
require 'thrift'
|
||||
require 'linguist_types'
|
||||
|
||||
4
samples/Ruby/rexpl
Executable file
4
samples/Ruby/rexpl
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env rbx
|
||||
$: << 'lib'
|
||||
require 'rexpl'
|
||||
Rexpl::Environment.run
|
||||
11
samples/Ruby/shoes-swt
Executable file
11
samples/Ruby/shoes-swt
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env jruby
|
||||
lib_directory = File.expand_path('../../lib', __FILE__)
|
||||
$LOAD_PATH << lib_directory
|
||||
|
||||
if File.exist?("Gemfile")
|
||||
require "bundler/setup"
|
||||
Bundler.require
|
||||
end
|
||||
|
||||
require 'shoes/ui/cli'
|
||||
Shoes::CLI.new("swt").run ARGV
|
||||
20
samples/SMT/bignum_lia1.smt2
Normal file
20
samples/SMT/bignum_lia1.smt2
Normal file
@@ -0,0 +1,20 @@
|
||||
(set-logic QF_LIA)
|
||||
(set-info :source | SMT-COMP'06 organizers |)
|
||||
(set-info :smt-lib-version 2.0)
|
||||
(set-info :category "check")
|
||||
(set-info :status unsat)
|
||||
(set-info :notes |This benchmark is designed to check if the DP supports bignumbers.|)
|
||||
(declare-fun x1 () Int)
|
||||
(declare-fun x2 () Int)
|
||||
(declare-fun x3 () Int)
|
||||
(declare-fun x4 () Int)
|
||||
(declare-fun x5 () Int)
|
||||
(declare-fun x6 () Int)
|
||||
(assert (and (or (>= x1 1000) (>= x1 1002))
|
||||
(or (>= x2 (* 1230 x1)) (>= x2 (* 1003 x1)))
|
||||
(or (>= x3 (* 1310 x2)) (>= x3 (* 1999 x2)))
|
||||
(or (>= x4 (* 4000 x3)) (>= x4 (* 8000 x3)))
|
||||
(or (<= x5 (* (- 4000) x4)) (<= x5 (* (- 8000) x4)))
|
||||
(or (>= x6 (* (- 3) x5)) (>= x6 (* (- 2) x5))) (< x6 0)))
|
||||
(check-sat)
|
||||
(exit)
|
||||
20
samples/SMT/list4.smt2
Normal file
20
samples/SMT/list4.smt2
Normal file
@@ -0,0 +1,20 @@
|
||||
(set-logic AUFLIRA)
|
||||
(set-info :source | Buggy list theorem |)
|
||||
(set-info :smt-lib-version 2.0)
|
||||
(set-info :category "crafted")
|
||||
(set-info :status sat)
|
||||
(declare-sort List 0)
|
||||
(declare-fun cons (Real List) List)
|
||||
(declare-fun nil () List)
|
||||
(declare-fun car (List) Real)
|
||||
(declare-fun cdr (List) List)
|
||||
(declare-fun len (List) Int)
|
||||
(assert (forall ((?x Real) (?y List)) (= (car (cons ?x ?y)) ?x)))
|
||||
(assert (forall ((?x Real) (?y List)) (= (cdr (cons ?x ?y)) ?y)))
|
||||
(assert (= (len nil) 0))
|
||||
(assert (forall ((?x Real) (?y List)) (= (len (cons ?x ?y)) (+ (len ?y) 1))))
|
||||
(declare-fun append (List List) List)
|
||||
(assert (forall ((?x Real) (?y1 List) (?y2 List)) (= (append (cons ?x ?y1) ?y2) (cons ?x (append ?y1 ?y2)))))
|
||||
(assert (not (forall ((?x Real) (?y List)) (= (append (cons ?x nil) ?y) (cons ?x ?y)))))
|
||||
(check-sat)
|
||||
(exit)
|
||||
123
samples/SMT/queen10-1.smt2
Normal file
123
samples/SMT/queen10-1.smt2
Normal file
@@ -0,0 +1,123 @@
|
||||
(set-logic QF_IDL)
|
||||
(set-info :source |
|
||||
Queens benchmarks generated by Hyondeuk Kim in SMT-LIB format.
|
||||
|)
|
||||
(set-info :smt-lib-version 2.0)
|
||||
(set-info :category "crafted")
|
||||
(set-info :status sat)
|
||||
(declare-fun x0 () Int)
|
||||
(declare-fun x1 () Int)
|
||||
(declare-fun x2 () Int)
|
||||
(declare-fun x3 () Int)
|
||||
(declare-fun x4 () Int)
|
||||
(declare-fun x5 () Int)
|
||||
(declare-fun x6 () Int)
|
||||
(declare-fun x7 () Int)
|
||||
(declare-fun x8 () Int)
|
||||
(declare-fun x9 () Int)
|
||||
(declare-fun x10 () Int)
|
||||
(assert
|
||||
(let
|
||||
((?v_0 (- x0 x10))
|
||||
(?v_1 (- x1 x10))
|
||||
(?v_2 (- x2 x10))
|
||||
(?v_3 (- x3 x10))
|
||||
(?v_4 (- x4 x10))
|
||||
(?v_5 (- x5 x10))
|
||||
(?v_6 (- x6 x10))
|
||||
(?v_7 (- x7 x10))
|
||||
(?v_8 (- x8 x10))
|
||||
(?v_9 (- x9 x10))
|
||||
(?v_10 (- x0 x1))
|
||||
(?v_11 (- x0 x2))
|
||||
(?v_12 (- x0 x3))
|
||||
(?v_13 (- x0 x4))
|
||||
(?v_14 (- x0 x5))
|
||||
(?v_15 (- x0 x6))
|
||||
(?v_16 (- x0 x7))
|
||||
(?v_17 (- x0 x8))
|
||||
(?v_18 (- x0 x9))
|
||||
(?v_19 (- x1 x2))
|
||||
(?v_20 (- x1 x3))
|
||||
(?v_21 (- x1 x4))
|
||||
(?v_22 (- x1 x5))
|
||||
(?v_23 (- x1 x6))
|
||||
(?v_24 (- x1 x7))
|
||||
(?v_25 (- x1 x8))
|
||||
(?v_26 (- x1 x9))
|
||||
(?v_27 (- x2 x3))
|
||||
(?v_28 (- x2 x4))
|
||||
(?v_29 (- x2 x5))
|
||||
(?v_30 (- x2 x6))
|
||||
(?v_31 (- x2 x7))
|
||||
(?v_32 (- x2 x8))
|
||||
(?v_33 (- x2 x9))
|
||||
(?v_34 (- x3 x4))
|
||||
(?v_35 (- x3 x5))
|
||||
(?v_36 (- x3 x6))
|
||||
(?v_37 (- x3 x7))
|
||||
(?v_38 (- x3 x8))
|
||||
(?v_39 (- x3 x9))
|
||||
(?v_40 (- x4 x5))
|
||||
(?v_41 (- x4 x6))
|
||||
(?v_42 (- x4 x7))
|
||||
(?v_43 (- x4 x8))
|
||||
(?v_44 (- x4 x9))
|
||||
(?v_45 (- x5 x6))
|
||||
(?v_46 (- x5 x7))
|
||||
(?v_47 (- x5 x8))
|
||||
(?v_48 (- x5 x9))
|
||||
(?v_49 (- x6 x7))
|
||||
(?v_50 (- x6 x8))
|
||||
(?v_51 (- x6 x9))
|
||||
(?v_52 (- x7 x8))
|
||||
(?v_53 (- x7 x9))
|
||||
(?v_54 (- x8 x9)))
|
||||
(and (<= ?v_0 9) (>= ?v_0 0) (<= ?v_1 9) (>= ?v_1 0) (<= ?v_2 9) (>= ?v_2 0)
|
||||
(<= ?v_3 9) (>= ?v_3 0) (<= ?v_4 9) (>= ?v_4 0) (<= ?v_5 9) (>= ?v_5 0)
|
||||
(<= ?v_6 9) (>= ?v_6 0) (<= ?v_7 9) (>= ?v_7 0) (<= ?v_8 9) (>= ?v_8 0)
|
||||
(<= ?v_9 9) (>= ?v_9 0)
|
||||
(not (= x0 x1)) (not (= x0 x2)) (not (= x0 x3)) (not (= x0 x4))
|
||||
(not (= x0 x5)) (not (= x0 x6)) (not (= x0 x7)) (not (= x0 x8))
|
||||
(not (= x0 x9)) (not (= x1 x2)) (not (= x1 x3)) (not (= x1 x4))
|
||||
(not (= x1 x5)) (not (= x1 x6)) (not (= x1 x7)) (not (= x1 x8))
|
||||
(not (= x1 x9)) (not (= x2 x3)) (not (= x2 x4)) (not (= x2 x5))
|
||||
(not (= x2 x6)) (not (= x2 x7)) (not (= x2 x8)) (not (= x2 x9))
|
||||
(not (= x3 x4)) (not (= x3 x5)) (not (= x3 x6)) (not (= x3 x7))
|
||||
(not (= x3 x8)) (not (= x3 x9)) (not (= x4 x5)) (not (= x4 x6))
|
||||
(not (= x4 x7)) (not (= x4 x8)) (not (= x4 x9)) (not (= x5 x6))
|
||||
(not (= x5 x7)) (not (= x5 x8)) (not (= x5 x9)) (not (= x6 x7))
|
||||
(not (= x6 x8)) (not (= x6 x9)) (not (= x7 x8)) (not (= x7 x9))
|
||||
(not (= x8 x9))
|
||||
(not (= ?v_10 1)) (not (= ?v_10 (- 1))) (not (= ?v_11 2))
|
||||
(not (= ?v_11 (- 2))) (not (= ?v_12 3)) (not (= ?v_12 (- 3)))
|
||||
(not (= ?v_13 4)) (not (= ?v_13 (- 4))) (not (= ?v_14 5))
|
||||
(not (= ?v_14 (- 5))) (not (= ?v_15 6)) (not (= ?v_15 (- 6)))
|
||||
(not (= ?v_16 7)) (not (= ?v_16 (- 7))) (not (= ?v_17 8))
|
||||
(not (= ?v_17 (- 8))) (not (= ?v_18 9)) (not (= ?v_18 (- 9)))
|
||||
(not (= ?v_19 1)) (not (= ?v_19 (- 1))) (not (= ?v_20 2))
|
||||
(not (= ?v_20 (- 2))) (not (= ?v_21 3)) (not (= ?v_21 (- 3)))
|
||||
(not (= ?v_22 4)) (not (= ?v_22 (- 4))) (not (= ?v_23 5))
|
||||
(not (= ?v_23 (- 5))) (not (= ?v_24 6)) (not (= ?v_24 (- 6)))
|
||||
(not (= ?v_25 7)) (not (= ?v_25 (- 7))) (not (= ?v_26 8))
|
||||
(not (= ?v_26 (- 8))) (not (= ?v_27 1)) (not (= ?v_27 (- 1)))
|
||||
(not (= ?v_28 2)) (not (= ?v_28 (- 2))) (not (= ?v_29 3))
|
||||
(not (= ?v_29 (- 3))) (not (= ?v_30 4)) (not (= ?v_30 (- 4)))
|
||||
(not (= ?v_31 5)) (not (= ?v_31 (- 5))) (not (= ?v_32 6))
|
||||
(not (= ?v_32 (- 6))) (not (= ?v_33 7)) (not (= ?v_33 (- 7)))
|
||||
(not (= ?v_34 1)) (not (= ?v_34 (- 1))) (not (= ?v_35 2))
|
||||
(not (= ?v_35 (- 2))) (not (= ?v_36 3)) (not (= ?v_36 (- 3)))
|
||||
(not (= ?v_37 4)) (not (= ?v_37 (- 4))) (not (= ?v_38 5))
|
||||
(not (= ?v_38 (- 5))) (not (= ?v_39 6)) (not (= ?v_39 (- 6)))
|
||||
(not (= ?v_40 1)) (not (= ?v_40 (- 1))) (not (= ?v_41 2))
|
||||
(not (= ?v_41 (- 2))) (not (= ?v_42 3)) (not (= ?v_42 (- 3)))
|
||||
(not (= ?v_43 4)) (not (= ?v_43 (- 4))) (not (= ?v_44 5))
|
||||
(not (= ?v_44 (- 5))) (not (= ?v_45 1)) (not (= ?v_45 (- 1)))
|
||||
(not (= ?v_46 2)) (not (= ?v_46 (- 2))) (not (= ?v_47 3))
|
||||
(not (= ?v_47 (- 3))) (not (= ?v_48 4)) (not (= ?v_48 (- 4)))
|
||||
(not (= ?v_49 1)) (not (= ?v_49 (- 1))) (not (= ?v_50 2))
|
||||
(not (= ?v_50 (- 2))) (not (= ?v_51 3)) (not (= ?v_51 (- 3)))
|
||||
(not (= ?v_52 1)) (not (= ?v_52 (- 1))) (not (= ?v_53 2))
|
||||
(not (= ?v_53 (- 2))) (not (= ?v_54 1)) (not (= ?v_54 (- 1))))))
|
||||
(check-sat)
|
||||
(exit)
|
||||
2104
samples/SMT/shufflevector.smt
Normal file
2104
samples/SMT/shufflevector.smt
Normal file
File diff suppressed because it is too large
Load Diff
23
samples/SQL/hostcache_set_state.inc
Normal file
23
samples/SQL/hostcache_set_state.inc
Normal file
@@ -0,0 +1,23 @@
|
||||
# Helper for hostcache_*.test
|
||||
|
||||
# Set a known initial state for the test
|
||||
|
||||
flush status;
|
||||
flush hosts;
|
||||
flush user_resources;
|
||||
flush privileges;
|
||||
|
||||
# Print critical setup
|
||||
|
||||
select @@global.debug;
|
||||
select @@global.max_connect_errors;
|
||||
select @@global.max_user_connections;
|
||||
select @@global.max_connections;
|
||||
|
||||
# Make sure there are no remaining records that can change the test outcome
|
||||
|
||||
select `User`, `Host` from mysql.`user` where `host` like '%\\%%';
|
||||
select `User`, `Host` from mysql.`user` where `user` like '192.%';
|
||||
select `User`, `Host` from mysql.`user` where `user` like '2001:%';
|
||||
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';
|
||||
|
||||
551
samples/Smali/ActionBarDrawerToggle.smali
Normal file
551
samples/Smali/ActionBarDrawerToggle.smali
Normal file
@@ -0,0 +1,551 @@
|
||||
.class public Landroid/support/v4/app/ActionBarDrawerToggle;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ActionBarDrawerToggle.java"
|
||||
|
||||
# interfaces
|
||||
.implements Landroid/support/v4/widget/DrawerLayout$DrawerListener;
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/MemberClasses;
|
||||
value = {
|
||||
Landroid/support/v4/app/ActionBarDrawerToggle$1;,
|
||||
Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;,
|
||||
Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplHC;,
|
||||
Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplBase;,
|
||||
Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
}
|
||||
.end annotation
|
||||
|
||||
|
||||
# static fields
|
||||
.field private static final ID_HOME:I = 0x102002c
|
||||
|
||||
.field private static final IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
|
||||
# instance fields
|
||||
.field private final mActivity:Landroid/app/Activity;
|
||||
|
||||
.field private final mCloseDrawerContentDescRes:I
|
||||
|
||||
.field private mDrawerImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
.field private final mDrawerImageResource:I
|
||||
|
||||
.field private mDrawerIndicatorEnabled:Z
|
||||
|
||||
.field private final mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
.field private final mOpenDrawerContentDescRes:I
|
||||
|
||||
.field private mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
.field private mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
.field private mThemeImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.registers 3
|
||||
|
||||
.prologue
|
||||
const/4 v2, 0x0
|
||||
|
||||
.line 108
|
||||
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||||
|
||||
.line 109
|
||||
.local v0, "version":I
|
||||
const/16 v1, 0xb
|
||||
|
||||
if-lt v0, v1, :cond_f
|
||||
|
||||
.line 110
|
||||
new-instance v1, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplHC;
|
||||
|
||||
invoke-direct {v1, v2}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplHC;-><init>(Landroid/support/v4/app/ActionBarDrawerToggle$1;)V
|
||||
|
||||
sput-object v1, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
.line 114
|
||||
:goto_e
|
||||
return-void
|
||||
|
||||
.line 112
|
||||
:cond_f
|
||||
new-instance v1, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplBase;
|
||||
|
||||
invoke-direct {v1, v2}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplBase;-><init>(Landroid/support/v4/app/ActionBarDrawerToggle$1;)V
|
||||
|
||||
sput-object v1, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
goto :goto_e
|
||||
.end method
|
||||
|
||||
.method public constructor <init>(Landroid/app/Activity;Landroid/support/v4/widget/DrawerLayout;III)V
|
||||
.registers 8
|
||||
.param p1, "activity" # Landroid/app/Activity;
|
||||
.param p2, "drawerLayout" # Landroid/support/v4/widget/DrawerLayout;
|
||||
.param p3, "drawerImageRes" # I
|
||||
.param p4, "openDrawerContentDescRes" # I
|
||||
.param p5, "closeDrawerContentDescRes" # I
|
||||
|
||||
.prologue
|
||||
.line 152
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
.line 121
|
||||
const/4 v0, 0x1
|
||||
|
||||
iput-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
.line 153
|
||||
iput-object p1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
.line 154
|
||||
iput-object p2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
.line 155
|
||||
iput p3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerImageResource:I
|
||||
|
||||
.line 156
|
||||
iput p4, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mOpenDrawerContentDescRes:I
|
||||
|
||||
.line 157
|
||||
iput p5, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mCloseDrawerContentDescRes:I
|
||||
|
||||
.line 159
|
||||
sget-object v0, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
invoke-interface {v0, p1}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->getThemeUpIndicator(Landroid/app/Activity;)Landroid/graphics/drawable/Drawable;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mThemeImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
.line 160
|
||||
invoke-virtual {p1}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0, p3}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
.line 161
|
||||
new-instance v0, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
invoke-direct {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;-><init>(Landroid/graphics/drawable/Drawable;)V
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
.line 162
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
const v1, 0x3eaaaaab
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffsetBy(F)V
|
||||
|
||||
.line 163
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public isDrawerIndicatorEnabled()Z
|
||||
.registers 2
|
||||
|
||||
.prologue
|
||||
.line 217
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
return v0
|
||||
.end method
|
||||
|
||||
.method public onConfigurationChanged(Landroid/content/res/Configuration;)V
|
||||
.registers 4
|
||||
.param p1, "newConfig" # Landroid/content/res/Configuration;
|
||||
|
||||
.prologue
|
||||
.line 229
|
||||
sget-object v0, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
invoke-interface {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->getThemeUpIndicator(Landroid/app/Activity;)Landroid/graphics/drawable/Drawable;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mThemeImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
.line 230
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
invoke-virtual {v0}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iget v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerImageResource:I
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
.line 231
|
||||
invoke-virtual {p0}, Landroid/support/v4/app/ActionBarDrawerToggle;->syncState()V
|
||||
|
||||
.line 232
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public onDrawerClosed(Landroid/view/View;)V
|
||||
.registers 6
|
||||
.param p1, "drawerView" # Landroid/view/View;
|
||||
|
||||
.prologue
|
||||
.line 298
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffset(F)V
|
||||
|
||||
.line 299
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
if-eqz v0, :cond_18
|
||||
|
||||
.line 300
|
||||
sget-object v0, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
iget-object v2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
iget v3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mCloseDrawerContentDescRes:I
|
||||
|
||||
invoke-interface {v0, v1, v2, v3}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->setActionBarDescription(Ljava/lang/Object;Landroid/app/Activity;I)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
.line 303
|
||||
:cond_18
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public onDrawerOpened(Landroid/view/View;)V
|
||||
.registers 6
|
||||
.param p1, "drawerView" # Landroid/view/View;
|
||||
|
||||
.prologue
|
||||
.line 282
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
const/high16 v1, 0x3f800000
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffset(F)V
|
||||
|
||||
.line 283
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
if-eqz v0, :cond_19
|
||||
|
||||
.line 284
|
||||
sget-object v0, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
iget-object v2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
iget v3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mOpenDrawerContentDescRes:I
|
||||
|
||||
invoke-interface {v0, v1, v2, v3}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->setActionBarDescription(Ljava/lang/Object;Landroid/app/Activity;I)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
.line 287
|
||||
:cond_19
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public onDrawerSlide(Landroid/view/View;F)V
|
||||
.registers 7
|
||||
.param p1, "drawerView" # Landroid/view/View;
|
||||
.param p2, "slideOffset" # F
|
||||
|
||||
.prologue
|
||||
const/high16 v3, 0x40000000
|
||||
|
||||
const/high16 v2, 0x3f000000
|
||||
|
||||
.line 264
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
invoke-virtual {v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->getOffset()F
|
||||
|
||||
move-result v0
|
||||
|
||||
.line 265
|
||||
.local v0, "glyphOffset":F
|
||||
cmpl-float v1, p2, v2
|
||||
|
||||
if-lez v1, :cond_20
|
||||
|
||||
.line 266
|
||||
const/4 v1, 0x0
|
||||
|
||||
sub-float v2, p2, v2
|
||||
|
||||
invoke-static {v1, v2}, Ljava/lang/Math;->max(FF)F
|
||||
|
||||
move-result v1
|
||||
|
||||
mul-float/2addr v1, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/Math;->max(FF)F
|
||||
|
||||
move-result v0
|
||||
|
||||
.line 270
|
||||
:goto_1a
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
invoke-virtual {v1, v0}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffset(F)V
|
||||
|
||||
.line 271
|
||||
return-void
|
||||
|
||||
.line 268
|
||||
:cond_20
|
||||
mul-float v1, p2, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/Math;->min(FF)F
|
||||
|
||||
move-result v0
|
||||
|
||||
goto :goto_1a
|
||||
.end method
|
||||
|
||||
.method public onDrawerStateChanged(I)V
|
||||
.registers 2
|
||||
.param p1, "newState" # I
|
||||
|
||||
.prologue
|
||||
.line 314
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
|
||||
.registers 5
|
||||
.param p1, "item" # Landroid/view/MenuItem;
|
||||
|
||||
.prologue
|
||||
const v2, 0x800003
|
||||
|
||||
.line 244
|
||||
if-eqz p1, :cond_1f
|
||||
|
||||
invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I
|
||||
|
||||
move-result v0
|
||||
|
||||
const v1, 0x102002c
|
||||
|
||||
if-ne v0, v1, :cond_1f
|
||||
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
if-eqz v0, :cond_1f
|
||||
|
||||
.line 245
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
invoke-virtual {v0, v2}, Landroid/support/v4/widget/DrawerLayout;->isDrawerVisible(I)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_21
|
||||
|
||||
.line 246
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
invoke-virtual {v0, v2}, Landroid/support/v4/widget/DrawerLayout;->closeDrawer(I)V
|
||||
|
||||
.line 251
|
||||
:cond_1f
|
||||
:goto_1f
|
||||
const/4 v0, 0x0
|
||||
|
||||
return v0
|
||||
|
||||
.line 248
|
||||
:cond_21
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
invoke-virtual {v0, v2}, Landroid/support/v4/widget/DrawerLayout;->openDrawer(I)V
|
||||
|
||||
goto :goto_1f
|
||||
.end method
|
||||
|
||||
.method public setDrawerIndicatorEnabled(Z)V
|
||||
.registers 8
|
||||
.param p1, "enable" # Z
|
||||
|
||||
.prologue
|
||||
.line 199
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
if-eq p1, v0, :cond_23
|
||||
|
||||
.line 200
|
||||
if-eqz p1, :cond_27
|
||||
|
||||
.line 201
|
||||
sget-object v1, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
iget-object v3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
iget-object v4, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
const v5, 0x800003
|
||||
|
||||
invoke-virtual {v0, v5}, Landroid/support/v4/widget/DrawerLayout;->isDrawerOpen(I)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_24
|
||||
|
||||
iget v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mOpenDrawerContentDescRes:I
|
||||
|
||||
:goto_1b
|
||||
invoke-interface {v1, v2, v3, v4, v0}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->setActionBarUpIndicator(Ljava/lang/Object;Landroid/app/Activity;Landroid/graphics/drawable/Drawable;I)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
.line 208
|
||||
:goto_21
|
||||
iput-boolean p1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
.line 210
|
||||
:cond_23
|
||||
return-void
|
||||
|
||||
.line 201
|
||||
:cond_24
|
||||
iget v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mCloseDrawerContentDescRes:I
|
||||
|
||||
goto :goto_1b
|
||||
|
||||
.line 205
|
||||
:cond_27
|
||||
sget-object v0, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
iget-object v2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
iget-object v3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mThemeImage:Landroid/graphics/drawable/Drawable;
|
||||
|
||||
const/4 v4, 0x0
|
||||
|
||||
invoke-interface {v0, v1, v2, v3, v4}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->setActionBarUpIndicator(Ljava/lang/Object;Landroid/app/Activity;Landroid/graphics/drawable/Drawable;I)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
goto :goto_21
|
||||
.end method
|
||||
|
||||
.method public syncState()V
|
||||
.registers 7
|
||||
|
||||
.prologue
|
||||
const v5, 0x800003
|
||||
|
||||
.line 175
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
invoke-virtual {v0, v5}, Landroid/support/v4/widget/DrawerLayout;->isDrawerOpen(I)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_2f
|
||||
|
||||
.line 176
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
const/high16 v1, 0x3f800000
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffset(F)V
|
||||
|
||||
.line 181
|
||||
:goto_12
|
||||
iget-boolean v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerIndicatorEnabled:Z
|
||||
|
||||
if-eqz v0, :cond_2e
|
||||
|
||||
.line 182
|
||||
sget-object v1, Landroid/support/v4/app/ActionBarDrawerToggle;->IMPL:Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;
|
||||
|
||||
iget-object v2, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
iget-object v3, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mActivity:Landroid/app/Activity;
|
||||
|
||||
iget-object v4, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mDrawerLayout:Landroid/support/v4/widget/DrawerLayout;
|
||||
|
||||
invoke-virtual {v0, v5}, Landroid/support/v4/widget/DrawerLayout;->isDrawerOpen(I)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_36
|
||||
|
||||
iget v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mOpenDrawerContentDescRes:I
|
||||
|
||||
:goto_28
|
||||
invoke-interface {v1, v2, v3, v4, v0}, Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl;->setActionBarUpIndicator(Ljava/lang/Object;Landroid/app/Activity;Landroid/graphics/drawable/Drawable;I)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSetIndicatorInfo:Ljava/lang/Object;
|
||||
|
||||
.line 186
|
||||
:cond_2e
|
||||
return-void
|
||||
|
||||
.line 178
|
||||
:cond_2f
|
||||
iget-object v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mSlider:Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/support/v4/app/ActionBarDrawerToggle$SlideDrawable;->setOffset(F)V
|
||||
|
||||
goto :goto_12
|
||||
|
||||
.line 182
|
||||
:cond_36
|
||||
iget v0, p0, Landroid/support/v4/app/ActionBarDrawerToggle;->mCloseDrawerContentDescRes:I
|
||||
|
||||
goto :goto_28
|
||||
.end method
|
||||
4235
samples/Smali/DoodleMobileAnaylise.smali
Normal file
4235
samples/Smali/DoodleMobileAnaylise.smali
Normal file
File diff suppressed because it is too large
Load Diff
700
samples/Smali/ModernAsyncTask.smali
Normal file
700
samples/Smali/ModernAsyncTask.smali
Normal file
@@ -0,0 +1,700 @@
|
||||
.class abstract Landroid/support/v4/content/ModernAsyncTask;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ModernAsyncTask.java"
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/MemberClasses;
|
||||
value = {
|
||||
Landroid/support/v4/content/ModernAsyncTask$4;,
|
||||
Landroid/support/v4/content/ModernAsyncTask$AsyncTaskResult;,
|
||||
Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;,
|
||||
Landroid/support/v4/content/ModernAsyncTask$InternalHandler;,
|
||||
Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"<Params:",
|
||||
"Ljava/lang/Object;",
|
||||
"Progress:",
|
||||
"Ljava/lang/Object;",
|
||||
"Result:",
|
||||
"Ljava/lang/Object;",
|
||||
">",
|
||||
"Ljava/lang/Object;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
|
||||
# static fields
|
||||
.field private static final CORE_POOL_SIZE:I = 0x5
|
||||
|
||||
.field private static final KEEP_ALIVE:I = 0x1
|
||||
|
||||
.field private static final LOG_TAG:Ljava/lang/String; = "AsyncTask"
|
||||
|
||||
.field private static final MAXIMUM_POOL_SIZE:I = 0x80
|
||||
|
||||
.field private static final MESSAGE_POST_PROGRESS:I = 0x2
|
||||
|
||||
.field private static final MESSAGE_POST_RESULT:I = 0x1
|
||||
|
||||
.field public static final THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
|
||||
|
||||
.field private static volatile sDefaultExecutor:Ljava/util/concurrent/Executor;
|
||||
|
||||
.field private static final sHandler:Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
.field private static final sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"Ljava/util/concurrent/BlockingQueue",
|
||||
"<",
|
||||
"Ljava/lang/Runnable;",
|
||||
">;"
|
||||
}
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
.field private static final sThreadFactory:Ljava/util/concurrent/ThreadFactory;
|
||||
|
||||
|
||||
# instance fields
|
||||
.field private final mFuture:Ljava/util/concurrent/FutureTask;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"Ljava/util/concurrent/FutureTask",
|
||||
"<TResult;>;"
|
||||
}
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
.field private volatile mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
.field private final mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
|
||||
.field private final mWorker:Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable",
|
||||
"<TParams;TResult;>;"
|
||||
}
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.registers 8
|
||||
|
||||
.prologue
|
||||
.line 54
|
||||
new-instance v0, Landroid/support/v4/content/ModernAsyncTask$1;
|
||||
|
||||
invoke-direct {v0}, Landroid/support/v4/content/ModernAsyncTask$1;-><init>()V
|
||||
|
||||
sput-object v0, Landroid/support/v4/content/ModernAsyncTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;
|
||||
|
||||
.line 62
|
||||
new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;
|
||||
|
||||
const/16 v1, 0xa
|
||||
|
||||
invoke-direct {v0, v1}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>(I)V
|
||||
|
||||
sput-object v0, Landroid/support/v4/content/ModernAsyncTask;->sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
|
||||
|
||||
.line 68
|
||||
new-instance v0, Ljava/util/concurrent/ThreadPoolExecutor;
|
||||
|
||||
const/4 v1, 0x5
|
||||
|
||||
const/16 v2, 0x80
|
||||
|
||||
const-wide/16 v3, 0x1
|
||||
|
||||
sget-object v5, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
|
||||
|
||||
sget-object v6, Landroid/support/v4/content/ModernAsyncTask;->sPoolWorkQueue:Ljava/util/concurrent/BlockingQueue;
|
||||
|
||||
sget-object v7, Landroid/support/v4/content/ModernAsyncTask;->sThreadFactory:Ljava/util/concurrent/ThreadFactory;
|
||||
|
||||
invoke-direct/range {v0 .. v7}, Ljava/util/concurrent/ThreadPoolExecutor;-><init>(IIJLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/BlockingQueue;Ljava/util/concurrent/ThreadFactory;)V
|
||||
|
||||
sput-object v0, Landroid/support/v4/content/ModernAsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
|
||||
|
||||
.line 75
|
||||
new-instance v0, Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
invoke-direct {v0, v1}, Landroid/support/v4/content/ModernAsyncTask$InternalHandler;-><init>(Landroid/support/v4/content/ModernAsyncTask$1;)V
|
||||
|
||||
sput-object v0, Landroid/support/v4/content/ModernAsyncTask;->sHandler:Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
.line 77
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask;->THREAD_POOL_EXECUTOR:Ljava/util/concurrent/Executor;
|
||||
|
||||
sput-object v0, Landroid/support/v4/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public constructor <init>()V
|
||||
.registers 3
|
||||
|
||||
.prologue
|
||||
.line 117
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
.line 81
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask$Status;->PENDING:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
.line 83
|
||||
new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
|
||||
invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>()V
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
|
||||
.line 118
|
||||
new-instance v0, Landroid/support/v4/content/ModernAsyncTask$2;
|
||||
|
||||
invoke-direct {v0, p0}, Landroid/support/v4/content/ModernAsyncTask$2;-><init>(Landroid/support/v4/content/ModernAsyncTask;)V
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mWorker:Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;
|
||||
|
||||
.line 127
|
||||
new-instance v0, Landroid/support/v4/content/ModernAsyncTask$3;
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/content/ModernAsyncTask;->mWorker:Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;
|
||||
|
||||
invoke-direct {v0, p0, v1}, Landroid/support/v4/content/ModernAsyncTask$3;-><init>(Landroid/support/v4/content/ModernAsyncTask;Ljava/util/concurrent/Callable;)V
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
.line 147
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method static synthetic access$200(Landroid/support/v4/content/ModernAsyncTask;)Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
.registers 2
|
||||
.param p0, "x0" # Landroid/support/v4/content/ModernAsyncTask;
|
||||
|
||||
.prologue
|
||||
.line 47
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method static synthetic access$300(Landroid/support/v4/content/ModernAsyncTask;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
.registers 3
|
||||
.param p0, "x0" # Landroid/support/v4/content/ModernAsyncTask;
|
||||
.param p1, "x1" # Ljava/lang/Object;
|
||||
|
||||
.prologue
|
||||
.line 47
|
||||
invoke-direct {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->postResult(Ljava/lang/Object;)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method static synthetic access$400(Landroid/support/v4/content/ModernAsyncTask;Ljava/lang/Object;)V
|
||||
.registers 2
|
||||
.param p0, "x0" # Landroid/support/v4/content/ModernAsyncTask;
|
||||
.param p1, "x1" # Ljava/lang/Object;
|
||||
|
||||
.prologue
|
||||
.line 47
|
||||
invoke-direct {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->postResultIfNotInvoked(Ljava/lang/Object;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method static synthetic access$500(Landroid/support/v4/content/ModernAsyncTask;Ljava/lang/Object;)V
|
||||
.registers 2
|
||||
.param p0, "x0" # Landroid/support/v4/content/ModernAsyncTask;
|
||||
.param p1, "x1" # Ljava/lang/Object;
|
||||
|
||||
.prologue
|
||||
.line 47
|
||||
invoke-direct {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->finish(Ljava/lang/Object;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static execute(Ljava/lang/Runnable;)V
|
||||
.registers 2
|
||||
.param p0, "runnable" # Ljava/lang/Runnable;
|
||||
|
||||
.prologue
|
||||
.line 433
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
|
||||
|
||||
invoke-interface {v0, p0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
|
||||
|
||||
.line 434
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private finish(Ljava/lang/Object;)V
|
||||
.registers 3
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(TResult;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 458
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "result":Ljava/lang/Object;, "TResult;"
|
||||
invoke-virtual {p0}, Landroid/support/v4/content/ModernAsyncTask;->isCancelled()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-eqz v0, :cond_e
|
||||
|
||||
.line 459
|
||||
invoke-virtual {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->onCancelled(Ljava/lang/Object;)V
|
||||
|
||||
.line 463
|
||||
:goto_9
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask$Status;->FINISHED:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
.line 464
|
||||
return-void
|
||||
|
||||
.line 461
|
||||
:cond_e
|
||||
invoke-virtual {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->onPostExecute(Ljava/lang/Object;)V
|
||||
|
||||
goto :goto_9
|
||||
.end method
|
||||
|
||||
.method public static init()V
|
||||
.registers 1
|
||||
|
||||
.prologue
|
||||
.line 106
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask;->sHandler:Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
invoke-virtual {v0}, Landroid/support/v4/content/ModernAsyncTask$InternalHandler;->getLooper()Landroid/os/Looper;
|
||||
|
||||
.line 107
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private postResult(Ljava/lang/Object;)Ljava/lang/Object;
|
||||
.registers 8
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(TResult;)TResult;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "result":Ljava/lang/Object;, "TResult;"
|
||||
const/4 v5, 0x1
|
||||
|
||||
.line 157
|
||||
sget-object v1, Landroid/support/v4/content/ModernAsyncTask;->sHandler:Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
new-instance v2, Landroid/support/v4/content/ModernAsyncTask$AsyncTaskResult;
|
||||
|
||||
new-array v3, v5, [Ljava/lang/Object;
|
||||
|
||||
const/4 v4, 0x0
|
||||
|
||||
aput-object p1, v3, v4
|
||||
|
||||
invoke-direct {v2, p0, v3}, Landroid/support/v4/content/ModernAsyncTask$AsyncTaskResult;-><init>(Landroid/support/v4/content/ModernAsyncTask;[Ljava/lang/Object;)V
|
||||
|
||||
invoke-virtual {v1, v5, v2}, Landroid/support/v4/content/ModernAsyncTask$InternalHandler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 159
|
||||
.local v0, "message":Landroid/os/Message;
|
||||
invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V
|
||||
|
||||
.line 160
|
||||
return-object p1
|
||||
.end method
|
||||
|
||||
.method private postResultIfNotInvoked(Ljava/lang/Object;)V
|
||||
.registers 4
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(TResult;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 150
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "result":Ljava/lang/Object;, "TResult;"
|
||||
iget-object v1, p0, Landroid/support/v4/content/ModernAsyncTask;->mTaskInvoked:Ljava/util/concurrent/atomic/AtomicBoolean;
|
||||
|
||||
invoke-virtual {v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->get()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
.line 151
|
||||
.local v0, "wasTaskInvoked":Z
|
||||
if-nez v0, :cond_b
|
||||
|
||||
.line 152
|
||||
invoke-direct {p0, p1}, Landroid/support/v4/content/ModernAsyncTask;->postResult(Ljava/lang/Object;)Ljava/lang/Object;
|
||||
|
||||
.line 154
|
||||
:cond_b
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static setDefaultExecutor(Ljava/util/concurrent/Executor;)V
|
||||
.registers 1
|
||||
.param p0, "exec" # Ljava/util/concurrent/Executor;
|
||||
|
||||
.prologue
|
||||
.line 111
|
||||
sput-object p0, Landroid/support/v4/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
|
||||
|
||||
.line 112
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public final cancel(Z)Z
|
||||
.registers 3
|
||||
.param p1, "mayInterruptIfRunning" # Z
|
||||
|
||||
.prologue
|
||||
.line 306
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
invoke-virtual {v0, p1}, Ljava/util/concurrent/FutureTask;->cancel(Z)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
return v0
|
||||
.end method
|
||||
|
||||
.method protected varargs abstract doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"([TParams;)TResult;"
|
||||
}
|
||||
.end annotation
|
||||
.end method
|
||||
|
||||
.method public final varargs execute([Ljava/lang/Object;)Landroid/support/v4/content/ModernAsyncTask;
|
||||
.registers 3
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"([TParams;)",
|
||||
"Landroid/support/v4/content/ModernAsyncTask",
|
||||
"<TParams;TProgress;TResult;>;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 371
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "params":[Ljava/lang/Object;, "[TParams;"
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
|
||||
|
||||
invoke-virtual {p0, v0, p1}, Landroid/support/v4/content/ModernAsyncTask;->executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroid/support/v4/content/ModernAsyncTask;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public final varargs executeOnExecutor(Ljava/util/concurrent/Executor;[Ljava/lang/Object;)Landroid/support/v4/content/ModernAsyncTask;
|
||||
.registers 5
|
||||
.param p1, "exec" # Ljava/util/concurrent/Executor;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(",
|
||||
"Ljava/util/concurrent/Executor;",
|
||||
"[TParams;)",
|
||||
"Landroid/support/v4/content/ModernAsyncTask",
|
||||
"<TParams;TProgress;TResult;>;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 406
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p2, "params":[Ljava/lang/Object;, "[TParams;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
sget-object v1, Landroid/support/v4/content/ModernAsyncTask$Status;->PENDING:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
if-eq v0, v1, :cond_13
|
||||
|
||||
.line 407
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask$4;->$SwitchMap$android$support$v4$content$ModernAsyncTask$Status:[I
|
||||
|
||||
iget-object v1, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
invoke-virtual {v1}, Landroid/support/v4/content/ModernAsyncTask$Status;->ordinal()I
|
||||
|
||||
move-result v1
|
||||
|
||||
aget v0, v0, v1
|
||||
|
||||
packed-switch v0, :pswitch_data_34
|
||||
|
||||
.line 418
|
||||
:cond_13
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask$Status;->RUNNING:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
iput-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
.line 420
|
||||
invoke-virtual {p0}, Landroid/support/v4/content/ModernAsyncTask;->onPreExecute()V
|
||||
|
||||
.line 422
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mWorker:Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;
|
||||
|
||||
iput-object p2, v0, Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;->mParams:[Ljava/lang/Object;
|
||||
|
||||
.line 423
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
invoke-interface {p1, v0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
|
||||
|
||||
.line 425
|
||||
return-object p0
|
||||
|
||||
.line 409
|
||||
:pswitch_24
|
||||
new-instance v0, Ljava/lang/IllegalStateException;
|
||||
|
||||
const-string v1, "Cannot execute task: the task is already running."
|
||||
|
||||
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
||||
|
||||
throw v0
|
||||
|
||||
.line 412
|
||||
:pswitch_2c
|
||||
new-instance v0, Ljava/lang/IllegalStateException;
|
||||
|
||||
const-string v1, "Cannot execute task: the task has already been executed (a task can be executed only once)"
|
||||
|
||||
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
||||
|
||||
throw v0
|
||||
|
||||
.line 407
|
||||
:pswitch_data_34
|
||||
.packed-switch 0x1
|
||||
:pswitch_24
|
||||
:pswitch_2c
|
||||
.end packed-switch
|
||||
.end method
|
||||
|
||||
.method public final get()Ljava/lang/Object;
|
||||
.registers 2
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"()TResult;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/Throws;
|
||||
value = {
|
||||
Ljava/lang/InterruptedException;,
|
||||
Ljava/util/concurrent/ExecutionException;
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 321
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
invoke-virtual {v0}, Ljava/util/concurrent/FutureTask;->get()Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public final get(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
|
||||
.registers 5
|
||||
.param p1, "timeout" # J
|
||||
.param p3, "unit" # Ljava/util/concurrent/TimeUnit;
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(J",
|
||||
"Ljava/util/concurrent/TimeUnit;",
|
||||
")TResult;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/Throws;
|
||||
value = {
|
||||
Ljava/lang/InterruptedException;,
|
||||
Ljava/util/concurrent/ExecutionException;,
|
||||
Ljava/util/concurrent/TimeoutException;
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 341
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
invoke-virtual {v0, p1, p2, p3}, Ljava/util/concurrent/FutureTask;->get(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public final getStatus()Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
.registers 2
|
||||
|
||||
.prologue
|
||||
.line 169
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mStatus:Landroid/support/v4/content/ModernAsyncTask$Status;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public final isCancelled()Z
|
||||
.registers 2
|
||||
|
||||
.prologue
|
||||
.line 273
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
iget-object v0, p0, Landroid/support/v4/content/ModernAsyncTask;->mFuture:Ljava/util/concurrent/FutureTask;
|
||||
|
||||
invoke-virtual {v0}, Ljava/util/concurrent/FutureTask;->isCancelled()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
return v0
|
||||
.end method
|
||||
|
||||
.method protected onCancelled()V
|
||||
.registers 1
|
||||
|
||||
.prologue
|
||||
.line 260
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onCancelled(Ljava/lang/Object;)V
|
||||
.registers 2
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(TResult;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 244
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "result":Ljava/lang/Object;, "TResult;"
|
||||
invoke-virtual {p0}, Landroid/support/v4/content/ModernAsyncTask;->onCancelled()V
|
||||
|
||||
.line 245
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onPostExecute(Ljava/lang/Object;)V
|
||||
.registers 2
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"(TResult;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 213
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "result":Ljava/lang/Object;, "TResult;"
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onPreExecute()V
|
||||
.registers 1
|
||||
|
||||
.prologue
|
||||
.line 197
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected varargs onProgressUpdate([Ljava/lang/Object;)V
|
||||
.registers 2
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"([TProgress;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 226
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "values":[Ljava/lang/Object;, "[TProgress;"
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected final varargs publishProgress([Ljava/lang/Object;)V
|
||||
.registers 5
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"([TProgress;)V"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.prologue
|
||||
.line 451
|
||||
.local p0, "this":Landroid/support/v4/content/ModernAsyncTask;, "Landroid/support/v4/content/ModernAsyncTask<TParams;TProgress;TResult;>;"
|
||||
.local p1, "values":[Ljava/lang/Object;, "[TProgress;"
|
||||
invoke-virtual {p0}, Landroid/support/v4/content/ModernAsyncTask;->isCancelled()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-nez v0, :cond_15
|
||||
|
||||
.line 452
|
||||
sget-object v0, Landroid/support/v4/content/ModernAsyncTask;->sHandler:Landroid/support/v4/content/ModernAsyncTask$InternalHandler;
|
||||
|
||||
const/4 v1, 0x2
|
||||
|
||||
new-instance v2, Landroid/support/v4/content/ModernAsyncTask$AsyncTaskResult;
|
||||
|
||||
invoke-direct {v2, p0, p1}, Landroid/support/v4/content/ModernAsyncTask$AsyncTaskResult;-><init>(Landroid/support/v4/content/ModernAsyncTask;[Ljava/lang/Object;)V
|
||||
|
||||
invoke-virtual {v0, v1, v2}, Landroid/support/v4/content/ModernAsyncTask$InternalHandler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V
|
||||
|
||||
.line 455
|
||||
:cond_15
|
||||
return-void
|
||||
.end method
|
||||
781
samples/Smali/PenguinSprite.smali
Normal file
781
samples/Smali/PenguinSprite.smali
Normal file
@@ -0,0 +1,781 @@
|
||||
.class public Lcom/tdq/game/shootbubble/sprite/PenguinSprite;
|
||||
.super Lcom/tdq/game/shootbubble/sprite/Sprite;
|
||||
.source "PenguinSprite.java"
|
||||
|
||||
|
||||
# static fields
|
||||
.field public static final LOST_SEQUENCE:[[I
|
||||
|
||||
.field public static final STATE_FIRE:I = 0x2
|
||||
|
||||
.field public static final STATE_GAME_LOST:I = 0x5
|
||||
|
||||
.field public static final STATE_GAME_WON:I = 0x4
|
||||
|
||||
.field public static final STATE_TURN_LEFT:I = 0x0
|
||||
|
||||
.field public static final STATE_TURN_RIGHT:I = 0x1
|
||||
|
||||
.field public static final STATE_VOID:I = 0x3
|
||||
|
||||
.field public static final WON_SEQUENCE:[[I
|
||||
|
||||
|
||||
# instance fields
|
||||
.field private count:I
|
||||
|
||||
.field private currentPenguin:I
|
||||
|
||||
.field private finalState:I
|
||||
|
||||
.field private nextPosition:I
|
||||
|
||||
.field private rand:Ljava/util/Random;
|
||||
|
||||
.field private spritesImage:Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.locals 8
|
||||
|
||||
.prologue
|
||||
const/4 v7, 0x4
|
||||
|
||||
const/4 v6, 0x3
|
||||
|
||||
const/4 v5, 0x1
|
||||
|
||||
const/4 v4, 0x0
|
||||
|
||||
const/4 v3, 0x2
|
||||
|
||||
.line 67
|
||||
const/16 v0, 0x8
|
||||
|
||||
new-array v0, v0, [[I
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_0
|
||||
|
||||
aput-object v1, v0, v4
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_1
|
||||
|
||||
aput-object v1, v0, v5
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_2
|
||||
|
||||
aput-object v1, v0, v3
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_3
|
||||
|
||||
aput-object v1, v0, v6
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_4
|
||||
|
||||
aput-object v1, v0, v7
|
||||
|
||||
const/4 v1, 0x5
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_5
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
const/4 v1, 0x6
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_6
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
const/4 v1, 0x7
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_7
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
sput-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->LOST_SEQUENCE:[[I
|
||||
|
||||
.line 69
|
||||
const/16 v0, 0x8
|
||||
|
||||
new-array v0, v0, [[I
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_8
|
||||
|
||||
aput-object v1, v0, v4
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_9
|
||||
|
||||
aput-object v1, v0, v5
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_a
|
||||
|
||||
aput-object v1, v0, v3
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_b
|
||||
|
||||
aput-object v1, v0, v6
|
||||
|
||||
new-array v1, v3, [I
|
||||
|
||||
fill-array-data v1, :array_c
|
||||
|
||||
aput-object v1, v0, v7
|
||||
|
||||
const/4 v1, 0x5
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_d
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
const/4 v1, 0x6
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_e
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
const/4 v1, 0x7
|
||||
|
||||
new-array v2, v3, [I
|
||||
|
||||
fill-array-data v2, :array_f
|
||||
|
||||
aput-object v2, v0, v1
|
||||
|
||||
sput-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->WON_SEQUENCE:[[I
|
||||
|
||||
return-void
|
||||
|
||||
.line 67
|
||||
:array_0
|
||||
.array-data 4
|
||||
0x1
|
||||
0x0
|
||||
.end array-data
|
||||
|
||||
:array_1
|
||||
.array-data 4
|
||||
0x2
|
||||
0x8
|
||||
.end array-data
|
||||
|
||||
:array_2
|
||||
.array-data 4
|
||||
0x3
|
||||
0x9
|
||||
.end array-data
|
||||
|
||||
:array_3
|
||||
.array-data 4
|
||||
0x4
|
||||
0xa
|
||||
.end array-data
|
||||
|
||||
:array_4
|
||||
.array-data 4
|
||||
0x5
|
||||
0xb
|
||||
.end array-data
|
||||
|
||||
:array_5
|
||||
.array-data 4
|
||||
0x6
|
||||
0xc
|
||||
.end array-data
|
||||
|
||||
:array_6
|
||||
.array-data 4
|
||||
0x7
|
||||
0xd
|
||||
.end array-data
|
||||
|
||||
:array_7
|
||||
.array-data 4
|
||||
0x5
|
||||
0xe
|
||||
.end array-data
|
||||
|
||||
.line 69
|
||||
:array_8
|
||||
.array-data 4
|
||||
0x1
|
||||
0x0
|
||||
.end array-data
|
||||
|
||||
:array_9
|
||||
.array-data 4
|
||||
0x2
|
||||
0x7
|
||||
.end array-data
|
||||
|
||||
:array_a
|
||||
.array-data 4
|
||||
0x3
|
||||
0x6
|
||||
.end array-data
|
||||
|
||||
:array_b
|
||||
.array-data 4
|
||||
0x4
|
||||
0xf
|
||||
.end array-data
|
||||
|
||||
:array_c
|
||||
.array-data 4
|
||||
0x5
|
||||
0x10
|
||||
.end array-data
|
||||
|
||||
:array_d
|
||||
.array-data 4
|
||||
0x6
|
||||
0x11
|
||||
.end array-data
|
||||
|
||||
:array_e
|
||||
.array-data 4
|
||||
0x7
|
||||
0x12
|
||||
.end array-data
|
||||
|
||||
:array_f
|
||||
.array-data 4
|
||||
0x4
|
||||
0x13
|
||||
.end array-data
|
||||
.end method
|
||||
|
||||
.method public constructor <init>(Lcom/tdq/game/shootbubble/sprite/BmpWrap;Ljava/util/Random;)V
|
||||
.locals 6
|
||||
.param p1, "sprites" # Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
.param p2, "rand" # Ljava/util/Random;
|
||||
|
||||
.prologue
|
||||
const/4 v5, 0x0
|
||||
|
||||
.line 85
|
||||
new-instance v0, Landroid/graphics/Rect;
|
||||
|
||||
const/16 v1, 0x169
|
||||
|
||||
const/16 v2, 0x1b4
|
||||
|
||||
const/16 v3, 0x1a0
|
||||
|
||||
const/16 v4, 0x1df
|
||||
|
||||
invoke-direct {v0, v1, v2, v3, v4}, Landroid/graphics/Rect;-><init>(IIII)V
|
||||
|
||||
invoke-direct {p0, v0}, Lcom/tdq/game/shootbubble/sprite/Sprite;-><init>(Landroid/graphics/Rect;)V
|
||||
|
||||
.line 87
|
||||
iput-object p1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->spritesImage:Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
|
||||
.line 88
|
||||
iput-object p2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->rand:Ljava/util/Random;
|
||||
|
||||
.line 90
|
||||
iput v5, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
.line 92
|
||||
const/4 v0, 0x3
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
.line 93
|
||||
iput v5, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
.line 94
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public constructor <init>(Lcom/tdq/game/shootbubble/sprite/BmpWrap;Ljava/util/Random;IIII)V
|
||||
.locals 5
|
||||
.param p1, "sprites" # Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
.param p2, "rand" # Ljava/util/Random;
|
||||
.param p3, "currentPenguin" # I
|
||||
.param p4, "count" # I
|
||||
.param p5, "finalState" # I
|
||||
.param p6, "nextPosition" # I
|
||||
|
||||
.prologue
|
||||
.line 100
|
||||
new-instance v0, Landroid/graphics/Rect;
|
||||
|
||||
const/16 v1, 0x169
|
||||
|
||||
const/16 v2, 0x1b4
|
||||
|
||||
const/16 v3, 0x1a0
|
||||
|
||||
const/16 v4, 0x1df
|
||||
|
||||
invoke-direct {v0, v1, v2, v3, v4}, Landroid/graphics/Rect;-><init>(IIII)V
|
||||
|
||||
invoke-direct {p0, v0}, Lcom/tdq/game/shootbubble/sprite/Sprite;-><init>(Landroid/graphics/Rect;)V
|
||||
|
||||
.line 102
|
||||
iput-object p1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->spritesImage:Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
|
||||
.line 103
|
||||
iput-object p2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->rand:Ljava/util/Random;
|
||||
|
||||
.line 104
|
||||
iput p3, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
.line 105
|
||||
iput p4, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 106
|
||||
iput p5, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
.line 107
|
||||
iput p6, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
.line 108
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public getTypeId()I
|
||||
.locals 1
|
||||
|
||||
.prologue
|
||||
.line 124
|
||||
sget v0, Lcom/tdq/game/shootbubble/sprite/Sprite;->TYPE_PENGUIN:I
|
||||
|
||||
return v0
|
||||
.end method
|
||||
|
||||
.method public paint(Landroid/graphics/Canvas;DII)V
|
||||
.locals 9
|
||||
.param p1, "c" # Landroid/graphics/Canvas;
|
||||
.param p2, "scale" # D
|
||||
.param p4, "dx" # I
|
||||
.param p5, "dy" # I
|
||||
|
||||
.prologue
|
||||
.line 183
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSpriteArea()Landroid/graphics/Rect;
|
||||
|
||||
move-result-object v3
|
||||
|
||||
.line 184
|
||||
.local v3, "r":Landroid/graphics/Rect;
|
||||
iget-object v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->spritesImage:Lcom/tdq/game/shootbubble/sprite/BmpWrap;
|
||||
|
||||
const/16 v1, 0x168
|
||||
|
||||
iget v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
rem-int/lit8 v2, v2, 0x4
|
||||
|
||||
mul-int/lit8 v2, v2, 0x39
|
||||
|
||||
sub-int/2addr v1, v2
|
||||
|
||||
const/16 v2, 0x1b3
|
||||
|
||||
iget v4, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
div-int/lit8 v4, v4, 0x4
|
||||
|
||||
mul-int/lit8 v4, v4, 0x2d
|
||||
|
||||
sub-int/2addr v2, v4
|
||||
|
||||
move-object v4, p1
|
||||
|
||||
move-wide v5, p2
|
||||
|
||||
move v7, p4
|
||||
|
||||
move v8, p5
|
||||
|
||||
invoke-static/range {v0 .. v8}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->drawImageClipped(Lcom/tdq/game/shootbubble/sprite/BmpWrap;IILandroid/graphics/Rect;Landroid/graphics/Canvas;DII)V
|
||||
|
||||
.line 188
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public saveState(Landroid/os/Bundle;Ljava/util/Vector;)V
|
||||
.locals 5
|
||||
.param p1, "map" # Landroid/os/Bundle;
|
||||
.param p2, "saved_sprites" # Ljava/util/Vector;
|
||||
|
||||
.prologue
|
||||
const/4 v4, 0x1
|
||||
|
||||
const/4 v3, 0x0
|
||||
|
||||
.line 111
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSavedId()I
|
||||
|
||||
move-result v0
|
||||
|
||||
const/4 v1, -0x1
|
||||
|
||||
if-eq v0, v1, :cond_0
|
||||
|
||||
.line 120
|
||||
:goto_0
|
||||
return-void
|
||||
|
||||
.line 114
|
||||
:cond_0
|
||||
invoke-super {p0, p1, p2}, Lcom/tdq/game/shootbubble/sprite/Sprite;->saveState(Landroid/os/Bundle;Ljava/util/Vector;)V
|
||||
|
||||
.line 115
|
||||
const-string v0, "%d-currentPenguin"
|
||||
|
||||
new-array v1, v4, [Ljava/lang/Object;
|
||||
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSavedId()I
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
aput-object v2, v1, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
|
||||
|
||||
.line 117
|
||||
const-string v0, "%d-count"
|
||||
|
||||
new-array v1, v4, [Ljava/lang/Object;
|
||||
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSavedId()I
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
aput-object v2, v1, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
|
||||
|
||||
.line 118
|
||||
const-string v0, "%d-finalState"
|
||||
|
||||
new-array v1, v4, [Ljava/lang/Object;
|
||||
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSavedId()I
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
aput-object v2, v1, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
|
||||
|
||||
.line 119
|
||||
const-string v0, "%d-nextPosition"
|
||||
|
||||
new-array v1, v4, [Ljava/lang/Object;
|
||||
|
||||
invoke-virtual {p0}, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->getSavedId()I
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
aput-object v2, v1, v3
|
||||
|
||||
invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
|
||||
|
||||
goto :goto_0
|
||||
.end method
|
||||
|
||||
.method public updateState(I)V
|
||||
.locals 6
|
||||
.param p1, "state" # I
|
||||
|
||||
.prologue
|
||||
const/4 v5, 0x7
|
||||
|
||||
const/4 v1, 0x3
|
||||
|
||||
const/4 v4, 0x4
|
||||
|
||||
const/4 v3, 0x1
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
.line 129
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
if-eq v0, v1, :cond_2
|
||||
|
||||
.line 130
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
add-int/lit8 v0, v0, 0x1
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 132
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
rem-int/lit8 v0, v0, 0x6
|
||||
|
||||
if-nez v0, :cond_0
|
||||
|
||||
.line 133
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
const/4 v1, 0x5
|
||||
|
||||
if-ne v0, v1, :cond_1
|
||||
|
||||
.line 134
|
||||
sget-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->LOST_SEQUENCE:[[I
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
aget-object v0, v0, v1
|
||||
|
||||
aget v0, v0, v3
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
.line 135
|
||||
sget-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->LOST_SEQUENCE:[[I
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
aget-object v0, v0, v1
|
||||
|
||||
aget v0, v0, v2
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
.line 179
|
||||
:cond_0
|
||||
:goto_0
|
||||
return-void
|
||||
|
||||
.line 136
|
||||
:cond_1
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
if-ne v0, v4, :cond_0
|
||||
|
||||
.line 137
|
||||
sget-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->WON_SEQUENCE:[[I
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
aget-object v0, v0, v1
|
||||
|
||||
aget v0, v0, v3
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
.line 138
|
||||
sget-object v0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->WON_SEQUENCE:[[I
|
||||
|
||||
iget v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
aget-object v0, v0, v1
|
||||
|
||||
aget v0, v0, v2
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->nextPosition:I
|
||||
|
||||
goto :goto_0
|
||||
|
||||
.line 142
|
||||
:cond_2
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
add-int/lit8 v0, v0, 0x1
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 144
|
||||
packed-switch p1, :pswitch_data_0
|
||||
|
||||
.line 170
|
||||
:cond_3
|
||||
:goto_1
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
const/16 v1, 0x64
|
||||
|
||||
if-le v0, v1, :cond_5
|
||||
|
||||
.line 171
|
||||
iput v5, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_0
|
||||
|
||||
.line 146
|
||||
:pswitch_0
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 147
|
||||
iput v1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_1
|
||||
|
||||
.line 150
|
||||
:pswitch_1
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 151
|
||||
const/4 v0, 0x2
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_1
|
||||
|
||||
.line 154
|
||||
:pswitch_2
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 155
|
||||
iput v3, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_1
|
||||
|
||||
.line 158
|
||||
:pswitch_3
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
if-lt v0, v4, :cond_4
|
||||
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
if-le v0, v5, :cond_3
|
||||
|
||||
.line 159
|
||||
:cond_4
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_1
|
||||
|
||||
.line 164
|
||||
:pswitch_4
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
.line 165
|
||||
iput p1, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->finalState:I
|
||||
|
||||
.line 166
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_0
|
||||
|
||||
.line 172
|
||||
:cond_5
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
rem-int/lit8 v0, v0, 0xf
|
||||
|
||||
if-nez v0, :cond_0
|
||||
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->count:I
|
||||
|
||||
const/16 v1, 0x19
|
||||
|
||||
if-le v0, v1, :cond_0
|
||||
|
||||
.line 173
|
||||
iget-object v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->rand:Ljava/util/Random;
|
||||
|
||||
invoke-virtual {v0}, Ljava/util/Random;->nextInt()I
|
||||
|
||||
move-result v0
|
||||
|
||||
rem-int/lit8 v0, v0, 0x3
|
||||
|
||||
add-int/lit8 v0, v0, 0x4
|
||||
|
||||
iput v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
.line 174
|
||||
iget v0, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
if-ge v0, v4, :cond_0
|
||||
|
||||
.line 175
|
||||
iput v2, p0, Lcom/tdq/game/shootbubble/sprite/PenguinSprite;->currentPenguin:I
|
||||
|
||||
goto :goto_0
|
||||
|
||||
.line 144
|
||||
nop
|
||||
|
||||
:pswitch_data_0
|
||||
.packed-switch 0x0
|
||||
:pswitch_0
|
||||
:pswitch_1
|
||||
:pswitch_2
|
||||
:pswitch_3
|
||||
:pswitch_4
|
||||
:pswitch_4
|
||||
.end packed-switch
|
||||
.end method
|
||||
1179
samples/Smali/Subject.smali
Normal file
1179
samples/Smali/Subject.smali
Normal file
File diff suppressed because it is too large
Load Diff
4382
samples/Smali/ViewDragHelper.smali
Normal file
4382
samples/Smali/ViewDragHelper.smali
Normal file
File diff suppressed because it is too large
Load Diff
1863
samples/Smali/WbxmlSerializer.smali
Normal file
1863
samples/Smali/WbxmlSerializer.smali
Normal file
File diff suppressed because it is too large
Load Diff
246
samples/SourcePawn/Check.inc
Normal file
246
samples/SourcePawn/Check.inc
Normal file
@@ -0,0 +1,246 @@
|
||||
// Checkpoint Manager
|
||||
// (c) João Pedro Lopes, All right's reserved
|
||||
//
|
||||
// Feel free to change any line above, as long as you post the 'fix' / 'patch' at the forum
|
||||
// and send a copy to jplopes@live.com.pt
|
||||
|
||||
/* natives
|
||||
native CreateCheckpoint(ownerid, chpid, Float:posX, Float:posY, Float:posZ, Float:size); // Creates a checkpoint
|
||||
native SetCheckpointInterior(chpid, interiorid); // Changes the checkpoint interior
|
||||
native SetCheckpointVirtualWorld(chpid, VirtualWorldID); // Changes the Checkpoint vWorld
|
||||
native ToggleCheckpointActive(chpid, bool:active); // Deactivates / Activates the checkpoint
|
||||
native ChangeCheckpointOwner(chpid, owner); // Change the checkpoint owner
|
||||
native RemoveCheckpoint(chpid); // Removes the specified checkpoint
|
||||
native StartCheckpointSeeking(); // Starts seeking for each individual
|
||||
native StopCheckpointSeeking(); // Stops the system
|
||||
native VerifyCheckpoint(playerid); // Place this at OnPlayerEnterCheckpoint
|
||||
*/
|
||||
|
||||
// Function Forwards
|
||||
forward public OnCheckpointEnter(playerid, checkpointid);
|
||||
|
||||
#if defined _CHECKPOINT_MANAGER_INCLUDED
|
||||
#endinput
|
||||
#endif
|
||||
|
||||
#define _CHECKPOINT_MANAGER_INCLUDED
|
||||
#pragma library CheckpointManager
|
||||
|
||||
#include <a_samp>
|
||||
|
||||
#define MAX_CHECKPOINTS 200
|
||||
#define CHECKPOINT_SEEKER_DELAY 300
|
||||
|
||||
#define GLOBAL_OWNER_ID -1
|
||||
|
||||
|
||||
// CHECKPOINT ENUMERATION
|
||||
enum _checkpointEnum{
|
||||
_chp_populated, // Is this slot of the memory populated?
|
||||
|
||||
_chp_id, // The ID of the checkpoint
|
||||
_chp_owner, // The ID of the player who this checkpoint is visible too
|
||||
|
||||
Float:_chp_posX, // The X position of this checkpoint
|
||||
Float:_chp_posY, // The Y position of this checkpoint
|
||||
Float:_chp_posZ, // The Z position of this checkpoint
|
||||
Float:_chp_size, // The checkpoint size
|
||||
Float:_chp_viewDistance, // The checkpoint view distance
|
||||
|
||||
bool:_chp_active, // Is this checkpoint active?
|
||||
|
||||
_chp_interior_id, // The interior id of this checkpoint
|
||||
_chp_world_id // The world id of this checkpoint
|
||||
};
|
||||
|
||||
// DATA ARRAYS
|
||||
new _checkpoints[MAX_CHECKPOINTS][_checkpointEnum];
|
||||
new _p_VisibleCheckpoint[MAX_PLAYERS];
|
||||
new _chp_manager_timer_id;
|
||||
|
||||
// DATA VARIABLES
|
||||
new _totalCheckpoints;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// Creates a new checkpoint with some initial data
|
||||
stock CreateCheckpoint(__ownerid, __chpid, Float:__posX, Float:__posY, Float:__posZ, Float:__size){
|
||||
// Max checkpoint reached?
|
||||
if(_totalCheckpoints == MAX_CHECKPOINTS) return 0;
|
||||
|
||||
// First checkpoint? Setting everything to unpopulated
|
||||
if(!_totalCheckpoints){
|
||||
for(new i; i < MAX_PLAYERS; i++) _p_VisibleCheckpoint[i] = -1;
|
||||
for(new i; i < MAX_CHECKPOINTS; i++){
|
||||
_checkpoints[i][_chp_populated] = false;
|
||||
}
|
||||
|
||||
// Sending the Initialization Info
|
||||
printf("[Checkpoint Manager : Version 0.1.1b] System Initialized...", __chpid);
|
||||
}
|
||||
|
||||
// Getting the first open slot
|
||||
new _slot;
|
||||
for(new i = 0; i < MAX_CHECKPOINTS; i++){
|
||||
if(!_checkpoints[i][_chp_populated]){
|
||||
_slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Adding the new checkpoint
|
||||
_checkpoints[_slot][_chp_populated] = true;
|
||||
_checkpoints[_slot][_chp_id] = __chpid;
|
||||
_checkpoints[_slot][_chp_owner] = __ownerid;
|
||||
_checkpoints[_slot][_chp_posX] = __posX;
|
||||
_checkpoints[_slot][_chp_posY] = __posY;
|
||||
_checkpoints[_slot][_chp_posZ] = __posZ;
|
||||
_checkpoints[_slot][_chp_size] = __size;
|
||||
_checkpoints[_slot][_chp_viewDistance] = 50.0;
|
||||
_checkpoints[_slot][_chp_active] = true;
|
||||
_checkpoints[_slot][_chp_interior_id] = 0;
|
||||
_checkpoints[_slot][_chp_world_id] = 0;
|
||||
|
||||
printf("[Checkpoint Manager] Checkpoint created (%d) at slot %d", __chpid, _slot);
|
||||
printf("Checkpoint Position: { %f, %f, %f }", _checkpoints[_slot][_chp_posX], _checkpoints[_slot][_chp_posY], _checkpoints[_slot][_chp_posZ]);
|
||||
|
||||
_totalCheckpoints++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
stock SetCheckpointInterior(__chpid, __interiorid){
|
||||
new _slot = __ChpSlotByID(__chpid);
|
||||
if(_slot > -1){
|
||||
// Valid slot?
|
||||
_checkpoints[_slot][_chp_interior_id] = __interiorid;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
stock SetCheckpointVirtualWorld(__chpid, __virtual_world_id){
|
||||
new _slot = __ChpSlotByID(__chpid);
|
||||
if(_slot > -1){
|
||||
_checkpoints[_slot][_chp_world_id] = __virtual_world_id;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock ToggleCheckpointActive(__chpid, bool:__active){
|
||||
new _slot = __ChpSlotByID(__chpid);
|
||||
if(_slot > -1){
|
||||
_checkpoints[_slot][_chp_active] = __active;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock ChangeCheckpointOwner(__chpid, __owner){
|
||||
new _slot = __ChpSlotByID(__chpid);
|
||||
if(_slot > -1){
|
||||
_checkpoints[_slot][_chp_owner] = __owner;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock RemoveCheckpoint(__chpid){
|
||||
new _slot = __ChpSlotByID(__chpid);
|
||||
if(_slot > -1){
|
||||
// Deleting the checkpoint
|
||||
_checkpoints[_slot][_chp_populated] = false;
|
||||
_checkpoints[_slot][_chp_id] = -1;
|
||||
_checkpoints[_slot][_chp_owner] = 255;
|
||||
_checkpoints[_slot][_chp_posX] = -1;
|
||||
_checkpoints[_slot][_chp_posY] = -1;
|
||||
_checkpoints[_slot][_chp_posZ] = -1;
|
||||
_checkpoints[_slot][_chp_size] = -1;
|
||||
_checkpoints[_slot][_chp_viewDistance] = -1;
|
||||
_checkpoints[_slot][_chp_active] = false;
|
||||
_checkpoints[_slot][_chp_interior_id] = -1;
|
||||
_checkpoints[_slot][_chp_world_id] = -1;
|
||||
_totalCheckpoints--;
|
||||
printf("\n[Checkpoint Manager] Checkpoint removed (ID: %d)", __chpid);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// Gets the checkpoint slot by id
|
||||
stock __ChpSlotByID(__chpid){
|
||||
for(new i; i < MAX_CHECKPOINTS; i++){
|
||||
if(_checkpoints[i][_chp_id] == __chpid) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
forward CheckpointSeeker();
|
||||
stock StartCheckpointSeeking(){
|
||||
_chp_manager_timer_id = SetTimer("CheckpointSeeker", CHECKPOINT_SEEKER_DELAY, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock StopCheckpointSeeking(){
|
||||
KillTimer(_chp_manager_timer_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public CheckpointSeeker(){
|
||||
new Float:__posX, Float:__posY, Float:__posZ;
|
||||
new __interior;
|
||||
new __virtualWorld;
|
||||
for(new i; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
if(!IsPlayerConnected(i)) continue;
|
||||
|
||||
GetPlayerPos(i, Float:__posX, Float:__posY, Float:__posZ);
|
||||
// Is the player near a checkpoint?
|
||||
if(_p_VisibleCheckpoint[i] > -1)
|
||||
{
|
||||
// If the player is no longer near that point
|
||||
if(__posX < (_checkpoints[_p_VisibleCheckpoint[i]][_chp_posX] - _checkpoints[_p_VisibleCheckpoint[i]][_chp_viewDistance])
|
||||
|| __posX > (_checkpoints[_p_VisibleCheckpoint[i]][_chp_posX] + _checkpoints[_p_VisibleCheckpoint[i]][_chp_viewDistance])
|
||||
|| __posY < (_checkpoints[_p_VisibleCheckpoint[i]][_chp_posY] - _checkpoints[_p_VisibleCheckpoint[i]][_chp_viewDistance])
|
||||
|| __posY > (_checkpoints[_p_VisibleCheckpoint[i]][_chp_posY] + _checkpoints[_p_VisibleCheckpoint[i]][_chp_viewDistance])){
|
||||
DisablePlayerCheckpoint(i);
|
||||
_p_VisibleCheckpoint[i] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Getting the player Interior and virtual world
|
||||
__interior = GetPlayerInterior(i);
|
||||
__virtualWorld = GetPlayerVirtualWorld(i);
|
||||
|
||||
// Looking for a new checkpoint
|
||||
for(new j = 0; j < MAX_CHECKPOINTS; j++){
|
||||
if(!_checkpoints[j][_chp_populated]) continue;
|
||||
if((_checkpoints[j][_chp_owner] != i) && (_checkpoints[j][_chp_owner] != -1)) continue;
|
||||
if(_checkpoints[j][_chp_interior_id] != __interior) continue;
|
||||
if(_checkpoints[j][_chp_world_id] != __virtualWorld) continue;
|
||||
|
||||
if(__posX > (_checkpoints[j][_chp_posX] - _checkpoints[j][_chp_viewDistance])
|
||||
&& __posX < (_checkpoints[j][_chp_posX] + _checkpoints[j][_chp_viewDistance])
|
||||
&& __posY > (_checkpoints[j][_chp_posY] - _checkpoints[j][_chp_viewDistance])
|
||||
&& __posY < (_checkpoints[j][_chp_posY] + _checkpoints[j][_chp_viewDistance])){
|
||||
SetPlayerCheckpoint(i, _checkpoints[j][_chp_posX], _checkpoints[j][_chp_posY], _checkpoints[j][_chp_posZ], _checkpoints[j][_chp_size]);
|
||||
_p_VisibleCheckpoint[i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock VerifyCheckpoint(__playerid){
|
||||
if(_p_VisibleCheckpoint[__playerid] >= 0){
|
||||
OnCheckpointEnter(__playerid, _checkpoints[_p_VisibleCheckpoint[__playerid]][_chp_id]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
91
samples/SourcePawn/fixed.inc
Normal file
91
samples/SourcePawn/fixed.inc
Normal file
@@ -0,0 +1,91 @@
|
||||
/* Fixed point arithmetic
|
||||
*
|
||||
* (c) Copyright 1998-2011, ITB CompuPhase
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
#pragma library Fixed
|
||||
|
||||
const fround_method: {
|
||||
fround_round = 0,
|
||||
fround_floor,
|
||||
fround_ceil,
|
||||
fround_tozero,
|
||||
fround_unbiased
|
||||
}
|
||||
|
||||
native Fixed:fixed(value);
|
||||
native Fixed:strfixed(const string[]);
|
||||
native Fixed:fmul(Fixed:oper1, Fixed:oper2);
|
||||
native Fixed:fdiv(Fixed:dividend, Fixed:divisor);
|
||||
native Fixed:ffract(Fixed:value);
|
||||
native fround(Fixed:value, fround_method:method=fround_round);
|
||||
native Fixed:fpower(Fixed:value, exponent);
|
||||
native Fixed:fsqroot(Fixed:value);
|
||||
native Fixed:fabs(Fixed:value);
|
||||
|
||||
#pragma rational Fixed(3)
|
||||
|
||||
/* user defined operators */
|
||||
native Fixed:operator*(Fixed:oper1, Fixed:oper2) = fmul;
|
||||
native Fixed:operator/(Fixed:oper1, Fixed:oper2) = fdiv;
|
||||
native Fixed:operator=(oper) = fixed;
|
||||
|
||||
stock Fixed:operator++(Fixed:oper)
|
||||
return oper + fixed(1);
|
||||
|
||||
stock Fixed:operator--(Fixed:oper)
|
||||
return oper - fixed(1);
|
||||
|
||||
stock Fixed:operator*(Fixed:oper1, oper2)
|
||||
return Fixed: (_:oper1 * oper2); /* "*" is commutative */
|
||||
|
||||
stock Fixed:operator/(Fixed:oper1, oper2)
|
||||
return oper1 / fixed(oper2);
|
||||
|
||||
stock Fixed:operator/(oper1, Fixed:oper2)
|
||||
return fdiv(fixed(oper1), oper2);
|
||||
|
||||
stock Fixed:operator+(Fixed:oper1, oper2)
|
||||
return oper1 + fixed(oper2); /* "+" is commutative */
|
||||
|
||||
stock Fixed:operator-(Fixed:oper1, oper2)
|
||||
return oper1 - fixed(oper2);
|
||||
|
||||
stock Fixed:operator-(oper1, Fixed:oper2)
|
||||
return fixed(oper1) - oper2;
|
||||
|
||||
stock bool:operator>(Fixed:oper1, oper2)
|
||||
return oper1 > fixed(oper2);
|
||||
|
||||
stock bool:operator>(oper1, Fixed:oper2)
|
||||
return fixed(oper1) > oper2;
|
||||
|
||||
stock bool:operator>=(Fixed:oper1, oper2)
|
||||
return oper1 >= fixed(oper2);
|
||||
|
||||
stock bool:operator>=(oper1, Fixed:oper2)
|
||||
return fixed(oper1) >= oper2;
|
||||
|
||||
stock bool:operator<(Fixed:oper1, oper2)
|
||||
return oper1 < fixed(oper2);
|
||||
|
||||
stock bool:operator<(oper1, Fixed:oper2)
|
||||
return fixed(oper1) < oper2;
|
||||
|
||||
stock bool:operator<=(Fixed:oper1, oper2)
|
||||
return oper1 <= fixed(oper2);
|
||||
|
||||
stock bool:operator<=(oper1, Fixed:oper2)
|
||||
return fixed(oper1) <= oper2;
|
||||
|
||||
stock bool:operator==(Fixed:oper1, oper2) /* "==" is commutative */
|
||||
return oper1 == fixed(oper2);
|
||||
|
||||
stock bool:operator!=(Fixed:oper1, oper2) /* "!=" is commutative */
|
||||
return oper1 != fixed(oper2);
|
||||
|
||||
/* forbidden operations */
|
||||
forward operator%(Fixed:oper1, Fixed:oper2);
|
||||
forward operator%(Fixed:oper1, oper2);
|
||||
forward operator%(oper1, Fixed:oper2);
|
||||
|
||||
289
samples/SourcePawn/mfile.inc
Normal file
289
samples/SourcePawn/mfile.inc
Normal file
@@ -0,0 +1,289 @@
|
||||
/* mFile 1.1 by Minokon
|
||||
*
|
||||
* (c) Copyright by Minokon 2010
|
||||
* (c) y_files Copyright by Y_Less 2010
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined _mfile_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _mfile_included
|
||||
|
||||
//Defines
|
||||
#define MAX_LINE_SIZE 80 //Max lenght of one line in file
|
||||
#define MAX_KEY_SIZE 50 //Max lenght of key in line (to =)
|
||||
#define MAX_VALUE_SIZE 50 //Max lenght of value in line (past =)
|
||||
#define TMP_FILE "tmpfile.txt"
|
||||
|
||||
//Natives
|
||||
/*
|
||||
native mCreateFile(const file[]);
|
||||
native mRemoveFile(const file[]);
|
||||
native mClearFile(const file[]);
|
||||
native bool:mFileExist(const file[]);
|
||||
native mRenameFile(const file[], const newname[]);
|
||||
native mFindFile(const name[], dest[], &index, sizename=sizeof dest);
|
||||
native mCreateDir(const name[]);
|
||||
native mRenameDir(const dir[], const newname[]);
|
||||
native mFindDir(const name[], dest[], &index, sizename=sizeof dest);
|
||||
native mHowLines(const file[]);
|
||||
native mRemoveNewLine(string[]); //removes "\n" from string
|
||||
native mGetString(const file[], const key[], bool:ignorecase=false);
|
||||
native mGetInt(const file[], const key[], bool:ignorecase=false);
|
||||
native mGetFloat(const file[], const key[], &Float:value);
|
||||
native mSetString(const file[], const key[], const new_value[]);
|
||||
native mSetInt(const file[], const key[], new_value);
|
||||
native mSetFloat(const file[], const key[], Float:new_value);
|
||||
native mIsSet(const file[], const key[], bool:ignorecase=false);
|
||||
native mUnSet(const file[], const key[]);
|
||||
native mIsFileEmpty(const file[]);
|
||||
native y_files
|
||||
*/
|
||||
//y_files by Y_Less Functions
|
||||
native ffind(const pattern[], filename[], len, &idx);
|
||||
native frename(const oldname[], const newname[]);
|
||||
native dfind(const pattern[], filename[], len, &idx);
|
||||
native dcreate(const name[]);
|
||||
native drename(const oldname[], const newname[]);
|
||||
|
||||
//Forwards
|
||||
forward OnFileCreated(file[]);
|
||||
forward OnFileRemoved(file[]);
|
||||
forward OnFileCleared(file[]);
|
||||
forward OnFileRenamed(oldname[], newname[]);
|
||||
forward OnDirCreated(dir[]);
|
||||
forward OnDirRenamed(oldname[], newname[]);
|
||||
|
||||
stock mCreateFile(const file[])
|
||||
{
|
||||
if(fexist(file)) fremove(file);
|
||||
new File:mfile = fopen(file, io_write);
|
||||
fclose(mfile);
|
||||
CallLocalFunction("OnFileCreated", "s", file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock mRemoveFile(const file[])
|
||||
{
|
||||
CallLocalFunction("OnFileRemoved", "s", file);
|
||||
return fremove(file);
|
||||
}
|
||||
|
||||
stock mClearFile(const file[])
|
||||
{
|
||||
if(!fremove(file)) return 0;
|
||||
new File:mfile = fopen(file, io_write);
|
||||
fclose(mfile);
|
||||
CallLocalFunction("OnFileCleared", "s", file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock bool:mFileExist(const file[])
|
||||
if(fexist(file)) return true; //dla ciekawych: fexist nie zwraca booleanu
|
||||
else return false;
|
||||
|
||||
stock mRenameFile(const file[], const newname[])
|
||||
{
|
||||
CallLocalFunction("OnFileRenamed", "ss", file, newname);
|
||||
return frename(file, newname);
|
||||
}
|
||||
|
||||
stock mFindFile(const name[], dest[], &index, sizename=sizeof dest)
|
||||
return ffind(name, dest, sizename, index);
|
||||
|
||||
stock mCreateDir(const name[])
|
||||
{
|
||||
CallLocalFunction("OnDirCreated", "s", name);
|
||||
return dcreate(name);
|
||||
}
|
||||
|
||||
stock mRenameDir(const dir[], const newname[])
|
||||
{
|
||||
CallLocalFunction("OnDirRenamed", "ss", dir, newname);
|
||||
return drename(dir, newname);
|
||||
}
|
||||
|
||||
stock mFindDir(const name[], dest[], &index, sizename=sizeof dest)
|
||||
return dfind(name, dest, sizename, index);
|
||||
|
||||
stock mHowLines(const file[])
|
||||
{
|
||||
new lines, str[MAX_LINE_SIZE];
|
||||
new File:mfile = fopen(file, io_read);
|
||||
while(fread(mfile, str)) lines++;
|
||||
fclose(mfile);
|
||||
return lines;
|
||||
}
|
||||
|
||||
stock mRemoveNewLine(string[])
|
||||
{
|
||||
new pos = strfind(string, "\n");
|
||||
if(pos != -1)
|
||||
{
|
||||
strdel(string, pos, pos+2);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
stock mGetString(const file[], const key[], bool:ignorecase=false)
|
||||
{
|
||||
//Create file if not exists
|
||||
if(!fexist(file))
|
||||
{
|
||||
new File:created = fopen(file, io_write);
|
||||
fclose(created);
|
||||
}
|
||||
new //Variables
|
||||
File:mfile = fopen(file, io_read), //Open file
|
||||
str[MAX_LINE_SIZE],
|
||||
str2[MAX_KEY_SIZE],
|
||||
str3[MAX_VALUE_SIZE],
|
||||
pos;
|
||||
//Find key in file
|
||||
while(fread(mfile, str))
|
||||
{
|
||||
pos = strfind(str, "=", ignorecase);
|
||||
strmid(str2, str, 0, pos);
|
||||
if(!strcmp(str2, key, ignorecase, strlen(key)+1))
|
||||
{
|
||||
strmid(str3, str, pos+1, strlen(str));
|
||||
mRemoveNewLine(str3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(mfile);
|
||||
return str3;
|
||||
}
|
||||
|
||||
stock mGetInt(const file[], const key[], bool:ignorecase=false)
|
||||
return strval(mGetString(file, key, ignorecase));
|
||||
|
||||
stock mGetFloat(const file[], const key[], &Float:value, bool:ignorecase=false)
|
||||
value = floatstr(mGetString(file, key, ignorecase));
|
||||
|
||||
stock mSetString(const file[], const key[], const new_value[])
|
||||
{
|
||||
//Create file if not exists
|
||||
if(!fexist(file))
|
||||
{
|
||||
new File:created = fopen(file, io_write);
|
||||
fclose(created);
|
||||
}
|
||||
new //Variables
|
||||
str[MAX_LINE_SIZE],
|
||||
str2[MAX_KEY_SIZE],
|
||||
str3[MAX_LINE_SIZE],
|
||||
bool:lFinded = false;
|
||||
//Open file
|
||||
new File:mfile = fopen(file, io_read);
|
||||
//Create cache file
|
||||
new File:tmpfile = fopen(TMP_FILE, io_write);
|
||||
fclose(tmpfile);
|
||||
//Open cache file
|
||||
tmpfile = fopen(TMP_FILE, io_append);
|
||||
format(str3, sizeof str3, "%s=%s\n", key, new_value);
|
||||
while(fread(mfile, str))
|
||||
{
|
||||
strmid(str2, str, 0, strfind(str, "="));
|
||||
if(!strcmp(str2, key))
|
||||
{
|
||||
fwrite(tmpfile, str3);
|
||||
lFinded = true;
|
||||
}
|
||||
else
|
||||
fwrite(tmpfile, str);
|
||||
}
|
||||
if(!lFinded) //if line not found
|
||||
fwrite(tmpfile, str3);
|
||||
//Close and remove old file
|
||||
fclose(mfile);
|
||||
fremove(file);
|
||||
//Close cache file and rename it
|
||||
fclose(tmpfile);
|
||||
frename(TMP_FILE, file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock mSetInt(const file[], const key[], new_value)
|
||||
{
|
||||
new str[MAX_VALUE_SIZE];
|
||||
valstr(str, new_value);
|
||||
mSetString(file, key, str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock mSetFloat(const file[], const key[], Float:new_value)
|
||||
{
|
||||
new str[MAX_VALUE_SIZE];
|
||||
format(str, sizeof str, "%f", new_value);
|
||||
return mSetString(file, key, str);
|
||||
}
|
||||
|
||||
stock bool:mIsSet(const file[], const key[], bool:ignorecase=false)
|
||||
{
|
||||
//If fexists return false
|
||||
if(!fexist(file)) return false;
|
||||
new //Variables
|
||||
File:mfile = fopen(file, io_read), //Open file
|
||||
str[MAX_LINE_SIZE],
|
||||
str2[MAX_KEY_SIZE],
|
||||
bool:finded = false;
|
||||
//Find key in file
|
||||
while(fread(mfile, str))
|
||||
{
|
||||
strmid(str2, str, 0, strfind(str, "="));
|
||||
if(!strcmp(str2, key, ignorecase, strlen(key)+1))
|
||||
{
|
||||
finded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(mfile);
|
||||
return finded;
|
||||
}
|
||||
|
||||
stock mUnSet(const file[], const key[])
|
||||
{
|
||||
if(!fexist(file)) return 0;
|
||||
new //Variables
|
||||
str[MAX_LINE_SIZE],
|
||||
str2[MAX_KEY_SIZE];
|
||||
//Open file
|
||||
new File:mfile = fopen(file, io_read);
|
||||
//Create cache file
|
||||
new File:tmpfile = fopen(TMP_FILE, io_write);
|
||||
fclose(tmpfile);
|
||||
//Open cache file
|
||||
tmpfile = fopen(TMP_FILE, io_append);
|
||||
while(fread(mfile, str))
|
||||
{
|
||||
strmid(str2, str, 0, strfind(str, "="));
|
||||
if(strcmp(str2, key) != 0)
|
||||
fwrite(tmpfile, str);
|
||||
}
|
||||
//Close and remove old file
|
||||
fclose(mfile);
|
||||
fremove(file);
|
||||
//Close cache file and rename it
|
||||
fclose(tmpfile);
|
||||
frename(TMP_FILE, file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
stock bool:mIsFileEmpty(const file[])
|
||||
{
|
||||
if(!fexist(file)) return true;
|
||||
new File:mfile = fopen(file, io_read);
|
||||
if(flength(mfile) <= 1)
|
||||
{
|
||||
fclose(mfile);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(mfile);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
633
samples/SourcePawn/y_testing.inc
Normal file
633
samples/SourcePawn/y_testing.inc
Normal file
@@ -0,0 +1,633 @@
|
||||
/**--------------------------------------------------------------------------**\
|
||||
====================================
|
||||
y_testing - Run unit tests easilly
|
||||
====================================
|
||||
Description:
|
||||
Runs any functions named as tests when the Testing_Run function is called.
|
||||
Legal:
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is the YSI testing include.
|
||||
|
||||
The Initial Developer of the Original Code is Alex "Y_Less" Cole.
|
||||
Portions created by the Initial Developer are Copyright (C) 2011
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributors:
|
||||
ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
|
||||
|
||||
Thanks:
|
||||
JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
|
||||
ZeeX - Very productive conversations.
|
||||
koolk - IsPlayerinAreaEx code.
|
||||
TheAlpha - Danish translation.
|
||||
breadfish - German translation.
|
||||
Fireburn - Dutch translation.
|
||||
yom - French translation.
|
||||
50p - Polish translation.
|
||||
Zamaroht - Spanish translation.
|
||||
Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
|
||||
for me to strive to better.
|
||||
Pixels^ - Running XScripters where the idea was born.
|
||||
Matite - Pestering me to release it and using it.
|
||||
|
||||
Very special thanks to:
|
||||
Thiadmer - PAWN, whose limits continue to amaze me!
|
||||
Kye/Kalcor - SA:MP.
|
||||
SA:MP Team past, present and future - SA:MP.
|
||||
|
||||
Version:
|
||||
1.0
|
||||
Changelog:
|
||||
16/02/12:
|
||||
Added better error reporting (less verbose passes).
|
||||
Removed "Tests:".
|
||||
Added player requiring tests.
|
||||
25/10/10:
|
||||
Integrated in to YSI.
|
||||
06/08/10:
|
||||
First version
|
||||
</remarks>
|
||||
\**--------------------------------------------------------------------------**/
|
||||
|
||||
/*#if defined _inc_a_samp || defined _samp_included || defined _inc_y_version
|
||||
#error y_testing must be the VERY FIRST include in your mode if being used.
|
||||
#endif
|
||||
|
||||
// Now we redefined "native" to do something clever!
|
||||
// "IsPlayerAttachedObjectSlotUsed" is an issue for us...
|
||||
|
||||
// "y_renative" allows native functions to be declared without constantly trying
|
||||
// to redefine it.
|
||||
#include "internal\y_renative"
|
||||
|
||||
#define native%0(%1); _YSI_NO_TAG_NATIVE:_YSI_RE_NATIVE<%0@|||%1|||%0>_YSI_RE_STOCK<%0|||%1|||_:%0@>
|
||||
|
||||
//stock%0(%1){printf(_:_YSI_NO_SQUARE:"native "#%0" called");return _:%0@(%1);}
|
||||
|
||||
#define _YSI_RE_STOCK<%0|||%1|||%2> stock%0(%1){print(_:_YSI_NO_SQUARE:"native "#%0" called");return %2(%1);}
|
||||
|
||||
#define _YSI_NO_SQUARE:%0);%1(%2[%3]%4);} _YSI_NO_SQUARE:%0);%1(%2%4);}
|
||||
|
||||
//#define _YSI_NO_TAG_NATIVE:_YSI_RE_NATIVE<%0:%1|||%2|||%3:%4>%5{%6;%7:%8:%9} _YSI_RE_NATIVE<%1|||%2|||%4>%5{%6;return%8:%9}
|
||||
#define _YSI_NO_TAG_NATIVE:_YSI_RE_NATIVE<%0:%1|||%2|||%3:%4>_YSI_RE_STOCK<%5:%6|||%7|||_:%8:%9> _YSI_RE_NATIVE<%1|||%2|||%4>_YSI_RE_STOCK<%5:%6|||%7|||%8:%9>*/
|
||||
|
||||
#include <a_samp>
|
||||
|
||||
#if defined YSI_TESTS
|
||||
#if defined INCLUDE_TESTS
|
||||
#error Incompatible testing options (YSI_TESTS + INCLUDE_TESTS)
|
||||
#endif
|
||||
#if !defined RUN_TESTS
|
||||
#define RUN_TESTS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined INCLUDE_TESTS
|
||||
#define RUN_TESTS
|
||||
#define Debug_PrintT va_printf
|
||||
#elseif defined RUN_TESTS
|
||||
#define _AUTO_RUN_TESTS
|
||||
#define Debug_PrintT va_printf
|
||||
#else
|
||||
#if _DEBUG > 0 || defined _YSI_SPECIAL_DEBUG
|
||||
#define RUN_TESTS
|
||||
#define _AUTO_RUN_TESTS
|
||||
//#if defined _YSI_SPECIAL_DEBUG
|
||||
// #define TP printf
|
||||
// //#define TC(%0); %0
|
||||
#define Debug_PrintT va_printf
|
||||
//#else
|
||||
// //#define TP P:0
|
||||
// //#define TC C:0
|
||||
//#endif
|
||||
#else
|
||||
#define Debug_PrintT(%0);
|
||||
// #define Tests:%1() stock bool:Tests_@%1()
|
||||
// #define Test:%1() stock bool:Test_@%1()
|
||||
// #define TestInit:%1() stock Init_@%1()
|
||||
// #define TestClose:%1() stock Shut_@%1()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Y_TESTING_DIALOG_ID (0x7974) // "yt"
|
||||
|
||||
#define TEST_TRUE(%0) Testing_Test(!!%0)
|
||||
#define TEST_FALSE(%0) Testing_Test(!%0)
|
||||
#define TEST_NULL(%0) Testing_Test(0 == %0)
|
||||
#define TEST_NOT_NULL(%0) Testing_Test(0 != %0)
|
||||
#define TEST_N(%0,%1) Testing_Test(%1 == %0)
|
||||
|
||||
#define TEST_TRUE_EX(%0,%2) Testing_Test(bool:(%0), (%2))
|
||||
#define TEST_FALSE_EX(%0,%2) Testing_Test(!(%0), (%2))
|
||||
#define TEST_NULL_EX(%0,%2) Testing_Test((%0) == 0, (%2))
|
||||
#define TEST_N_EX(%0,%1,%2) Testing_Test((%0) == (%1), (%2))
|
||||
|
||||
#define TEST_MSG "\2\2\2\2\2"
|
||||
#define TEST_FAILED "FAIL:"
|
||||
#define TEST_PASSED "PASS!"
|
||||
//#define TEST_FAILED "*** Test Failed:"
|
||||
//#define TEST_PASSED "*** Test Passed:"
|
||||
|
||||
#define _Y_TESTEQ(%0) "\"%0\"")
|
||||
#define _Y_TESTDQ:_Y_TESTEQ(%0"%1"%2) _Y_TESTDQ:_Y_TESTEQ(%0\x22;%1\x22;%2)
|
||||
//#define _Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0)%1) _Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0\x29;%1)
|
||||
#define _Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0)%1) _Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0\x29;%1)
|
||||
#define _Y_TESTOB:_Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0(%1) _Y_TESTOB:_Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0\x28;%1)
|
||||
|
||||
#define ASSERT(%0) Testing_Test(%0,TEST_MSG" %s", _Y_TESTOB:_Y_TESTCB:_Y_TESTDQ:_Y_TESTEQ(%0)
|
||||
#define ASSERT_TRUE(%0) ASSERT(!!%0) //Testing_Test(!!%0,__name)
|
||||
#define ASSERT_FALSE(%0) ASSERT(!%0) //Testing_Test(!%0,__name)
|
||||
#define ASSERT_NULL(%0) ASSERT(0 == %0) //Testing_Test(0==%0,__name)
|
||||
#define ASSERT_N:%1(%0) ASSERT(%1 == %0) //Testing_Test(%1==%0,__name)
|
||||
|
||||
#define ASK(%0) Testing_Ask(playerid,%0)
|
||||
|
||||
static stock
|
||||
YSI_g_sFailMessage[512],
|
||||
YSI_g_sPlayer = cellmax,
|
||||
bool:YSI_g_sAsked,
|
||||
YSI_g_sTests,
|
||||
YSI_g_sFails;
|
||||
|
||||
#if defined RUN_TESTS
|
||||
#define Test:%1() forward bool:Tezt_@%1(); public bool:Tezt_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
//#define Tests:%1() forward bool:Test_@%1(); public bool:Test_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
#define TestInit:%1() forward Init_@%1(); public Init_@%1() for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
#define TestClose:%1() forward Shut_@%1(); public Shut_@%1() for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
|
||||
#define PTest:%1(%2) forward bool:Tezp_@%1(%2); public bool:Tezp_@%1(%2) for(new string:__name[]=#%1,bool:__once=(printf("*** Player Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
//#define Tests:%1() forward bool:Test_@%1(); public bool:Test_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
#define PTestInit:%1(%2) forward Inip_@%1(%2); public Inip_@%1(%2) for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
#define PTestClose:%1(%2) forward Shup_@%1(%2); public Shup_@%1(%2) for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
#else
|
||||
#define Test:%1() stock bool:Test_@%1()
|
||||
#define TestInit:%1() stock Init_@%1()
|
||||
#define TestClose:%1() stock Shut_@%1()
|
||||
|
||||
#define PTest:%1(%2) stock bool:Test_@%1(%2)
|
||||
#define PTestInit:%1(%2) stock Init_@%1(%2)
|
||||
#define PTestClose:%1(%2) stock Shut_@%1(%2)
|
||||
#endif
|
||||
|
||||
// These all need to come AFTER the types are defined in case the have tests.
|
||||
#include "internal\y_version"
|
||||
|
||||
#include "y_amx"
|
||||
#include "internal\y_shortfunc"
|
||||
#include "y_debug"
|
||||
|
||||
#include "internal\y_natives"
|
||||
|
||||
#include "y_va"
|
||||
|
||||
/**--------------------------------------------------------------------------**\
|
||||
<summary>Testing_Ask</summary>
|
||||
<param name="playerid">Player to ask a question to.</param>
|
||||
<param name="str[]">What to ask.</param>
|
||||
<param name="va_args<>">Additional data.</param>
|
||||
<returns>
|
||||
-
|
||||
</returns>
|
||||
<remarks>
|
||||
Calls a dialog to ask the player if the given test actually passed.
|
||||
</remarks>
|
||||
\**--------------------------------------------------------------------------**/
|
||||
|
||||
stock Testing_Ask(playerid, str[] = "", va_args<>)
|
||||
{
|
||||
va_format(YSI_g_sFailMessage, sizeof (YSI_g_sFailMessage), str, va_start<2>);
|
||||
ShowPlayerDialog(playerid, Y_TESTING_DIALOG_ID, DIALOG_STYLE_MSGBOX, "Did the test pass?", YSI_g_sFailMessage, "Yes", "No");
|
||||
YSI_g_sAsked = true;
|
||||
}
|
||||
|
||||
stock Testing_Test(bool:x, str[] = "", va_args<>)
|
||||
{
|
||||
P:3("Testing_Test called: %i, \"%s\"", x, str);
|
||||
++YSI_g_sTests;
|
||||
if (!x)
|
||||
{
|
||||
++YSI_g_sFails;
|
||||
if (numargs() == 2)
|
||||
{
|
||||
P:T(TEST_FAILED " %s", va_start<1>);
|
||||
//printf("*** Test failed: %s", str);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str[0] == '\2')
|
||||
{
|
||||
strunpack(str, !TEST_FAILED, 6);
|
||||
str[5] = ' ';
|
||||
}
|
||||
P:T(str, va_start<2>);
|
||||
}
|
||||
}
|
||||
#if defined TEST_SHOW_PASSES
|
||||
else /*if (numargs() == 2)
|
||||
{
|
||||
P:T(TEST_PASSED " %s", va_start<1>);
|
||||
}
|
||||
else
|
||||
{
|
||||
P:T(str, va_start<2>);
|
||||
if (str[0] == '\2')
|
||||
{
|
||||
strunpack(str, !TEST_PASSED, 17);
|
||||
str[16] = ' ';
|
||||
}
|
||||
printf(str);
|
||||
P:T(str, va_start<2>);*/
|
||||
{
|
||||
P:T(TEST_PASSED, va_start<2>);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**--------------------------------------------------------------------------**\
|
||||
<summary>Testing_Run</summary>
|
||||
<param name="&tests">Number of tests run.</param>
|
||||
<param name="&fails">Number of tests which failed.</param>
|
||||
<param name="buffer[33]">The name of the first test which failed.</param>
|
||||
<returns>
|
||||
Wether all tests were sucessful or not.
|
||||
</returns>
|
||||
<remarks>
|
||||
-
|
||||
|
||||
native Testing_Run(&tests, &fails, buffer[33] = "");
|
||||
|
||||
</remarks>
|
||||
\**--------------------------------------------------------------------------**/
|
||||
|
||||
stock bool:Testing_Run(&tests, &fails, lastfail[33] = "", bool:p = false)
|
||||
{
|
||||
P:3("bool:Testing_Run called: %i, %i, \"%s\", %i", tests, fails, lastfail, p);
|
||||
#pragma unused p, lastfail
|
||||
#if defined RUN_TESTS
|
||||
P:2("Testing_Run() called");
|
||||
new
|
||||
idx,
|
||||
buffer[32];
|
||||
while ((idx = AMX_GetPublicName(idx, buffer, "Tezt_@")))
|
||||
{
|
||||
strunpack(buffer, buffer);
|
||||
//++YSI_g_sTests;
|
||||
// Call the setup function if there is one.
|
||||
buffer[0] = 'I';
|
||||
buffer[1] = 'n';
|
||||
buffer[2] = 'i';
|
||||
buffer[3] = 't';
|
||||
CallLocalFunction(buffer, "");
|
||||
// Call the test.
|
||||
buffer[0] = 'T';
|
||||
buffer[1] = 'e';
|
||||
buffer[2] = 'z';
|
||||
buffer[3] = 't';
|
||||
fails = YSI_g_sFails;
|
||||
P:5("Testing_Run(): Calling %s", buffer[6]);
|
||||
CallLocalFunction(buffer, "");
|
||||
#if !defined TEST_SHOW_PASSES
|
||||
if (YSI_g_sFails == fails)
|
||||
{
|
||||
printf(TEST_PASSED);
|
||||
printf(" ");
|
||||
}
|
||||
#endif
|
||||
/*if (YSI_g_sFails != fails)
|
||||
{
|
||||
if (YSI_g_sFails)
|
||||
{
|
||||
++YSI_g_sFails;
|
||||
}
|
||||
else
|
||||
{
|
||||
fails = 0;
|
||||
// Copy the string over.
|
||||
while ((lastfail[fails] = buffer[fails + 6])) ++fails;
|
||||
YSI_g_sFails = 1;
|
||||
}
|
||||
//C:1(if (p) printf("*** Test failed: %s", buffer[fails + 6]););
|
||||
}*/
|
||||
// Call the shutdown function if there is one.
|
||||
buffer[0] = 'S';
|
||||
buffer[1] = 'h';
|
||||
buffer[2] = 'u';
|
||||
buffer[3] = 't';
|
||||
CallLocalFunction(buffer, "");
|
||||
}
|
||||
tests = YSI_g_sTests;
|
||||
fails = YSI_g_sFails;
|
||||
return fails == 0;
|
||||
#else
|
||||
#pragma unused tests, fails, lastfail
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**--------------------------------------------------------------------------**\
|
||||
<summary>Testing_Player</summary>
|
||||
<param name="playerid">Player to test on.</param>
|
||||
<param name="&idx">Next test to run.</param>
|
||||
<param name="&tests">Number of tests run.</param>
|
||||
<param name="&fails">Number of tests which failed.</param>
|
||||
<param name="buffer[33]">The name of the first test which failed.</param>
|
||||
<returns>
|
||||
Wether all tests were sucessful or not.
|
||||
</returns>
|
||||
<remarks>
|
||||
-
|
||||
|
||||
native Testing_Run(&tests, &fails, buffer[33] = "");
|
||||
|
||||
</remarks>
|
||||
\**--------------------------------------------------------------------------**/
|
||||
|
||||
stock bool:Testing_Player(playerid, &idx, &tests, &fails, lastfail[33] = "", bool:p = false)
|
||||
{
|
||||
P:3("bool:Testing_Player called: %i, %i, %i, %i, \"%s\", %i", playerid, idx, tests, fails, lastfail, p);
|
||||
#pragma unused p
|
||||
#if defined RUN_TESTS
|
||||
P:2("Testing_Player() called");
|
||||
new
|
||||
//idx,
|
||||
buffer[32];
|
||||
//while ((idx = AMX_GetPublicName(idx, buffer, "Tezt_@")))
|
||||
if ((idx = AMX_GetPublicName(idx, buffer, "Tezp_@")))
|
||||
{
|
||||
strunpack(buffer, buffer);
|
||||
//++YSI_g_sTests;
|
||||
// Call the setup function if there is one.
|
||||
buffer[0] = 'I';
|
||||
buffer[1] = 'n';
|
||||
buffer[2] = 'i';
|
||||
buffer[3] = 'p';
|
||||
CallLocalFunction(buffer, "");
|
||||
// Call the test.
|
||||
buffer[0] = 'T';
|
||||
buffer[1] = 'e';
|
||||
buffer[2] = 'z';
|
||||
buffer[3] = 'p';
|
||||
fails = YSI_g_sFails;
|
||||
P:5("Testing_Player(): Calling %s", buffer[6]);
|
||||
CallLocalFunction(buffer, "");
|
||||
#if !defined TEST_SHOW_PASSES
|
||||
if (YSI_g_sFails == fails)
|
||||
{
|
||||
printf(TEST_PASSED);
|
||||
printf(" ");
|
||||
}
|
||||
#endif
|
||||
/*if (YSI_g_sFails != fails)
|
||||
{
|
||||
if (YSI_g_sFails)
|
||||
{
|
||||
++YSI_g_sFails;
|
||||
}
|
||||
else
|
||||
{
|
||||
fails = 0;
|
||||
// Copy the string over.
|
||||
while ((lastfail[fails] = buffer[fails + 6])) ++fails;
|
||||
YSI_g_sFails = 1;
|
||||
}
|
||||
//C:1(if (p) printf("*** Test failed: %s", buffer[fails + 6]););
|
||||
}*/
|
||||
// Call the shutdown function if there is one.
|
||||
//buffer[0] = 'S';
|
||||
//buffer[1] = 'h';
|
||||
//buffer[2] = 'u';
|
||||
//buffer[3] = 'p';
|
||||
//CallLocalFunction(buffer, "");
|
||||
}
|
||||
tests = YSI_g_sTests;
|
||||
fails = YSI_g_sFails;
|
||||
return fails == 0;
|
||||
#else
|
||||
#pragma unused tests, fails, lastfail
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined RUN_TESTS
|
||||
/*#define Test:%1() forward bool:Tezt_@%1(); public bool:Tezt_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
//#define Tests:%1() forward bool:Test_@%1(); public bool:Test_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
#define TestInit:%1() forward Init_@%1(); public Init_@%1() for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
#define TestClose:%1() forward Shut_@%1(); public Shut_@%1() for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
|
||||
#define PTest:%1(%2) forward bool:Tezp_@%1(%2); public bool:Tezp_@%1(%2) for(new string:__name[]=#%1,bool:__once=(printf("*** Player Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
//#define Tests:%1() forward bool:Test_@%1(); public bool:Test_@%1() for(new string:__name[]=#%1,bool:__once=(printf("*** Test %s start", __name) || TRUE);__once;__once=(printf(" ") && FALSE))
|
||||
#define PTestInit:%1(%2) forward Inip_@%1(%2); public Inip_@%1(%2) for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))
|
||||
#define PTestClose:%1(%2) forward Shup_@%1(%2); public Shup_@%1(%2) for(new string:__name[]=#%1,bool:__once=TRUE;__once;__once=(printf(" ", __name) && FALSE))*/
|
||||
|
||||
#if defined _AUTO_RUN_TESTS
|
||||
#if !defined FILTERSCRIPT
|
||||
// Hook main in gamemodes.
|
||||
main()
|
||||
{
|
||||
// Disable error messages (as we're likely to generate them).
|
||||
state ysi_debug : off;
|
||||
CallLocalFunction("Testing_main", "");
|
||||
new
|
||||
tests,
|
||||
fails;
|
||||
printf(" ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" || STARTING TESTS... || ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" ");
|
||||
Testing_Run(tests, fails, _, true);
|
||||
printf("*** Tests: %d, Fails: %d", tests, fails);
|
||||
if (!fails)
|
||||
{
|
||||
printf(" ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" || ALL TESTS PASSED! || ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" ");
|
||||
}
|
||||
state ysi_debug : on;
|
||||
}
|
||||
|
||||
#define main forward Testing_main(); public Testing_main
|
||||
|
||||
Testing_Next(playerid)
|
||||
{
|
||||
new
|
||||
buffer[32];
|
||||
for ( ; ; )
|
||||
{
|
||||
new
|
||||
fails = YSI_g_sFails;
|
||||
// Get the last test (nicely fails for cellmax).
|
||||
if ((YSI_g_sPlayer = AMX_GetPublicName(YSI_g_sPlayer, buffer, "Tezp_@")))
|
||||
{
|
||||
strunpack(buffer, buffer);
|
||||
// Call the shutdown function if there is one.
|
||||
buffer[0] = 'S';
|
||||
buffer[1] = 'h';
|
||||
buffer[2] = 'u';
|
||||
buffer[3] = 'p';
|
||||
CallLocalFunction(buffer, "i", playerid);
|
||||
}
|
||||
// Get the new test, but don't store the index.
|
||||
if (AMX_GetPublicName(YSI_g_sPlayer, buffer, "Tezp_@"))
|
||||
{
|
||||
YSI_g_sAsked = false;
|
||||
//++YSI_g_sTests;
|
||||
strunpack(buffer, buffer);
|
||||
// Call the setup function if there is one.
|
||||
buffer[0] = 'I';
|
||||
buffer[1] = 'n';
|
||||
buffer[2] = 'i';
|
||||
buffer[3] = 'p';
|
||||
CallLocalFunction(buffer, "i", playerid);
|
||||
// Call the test.
|
||||
buffer[0] = 'T';
|
||||
buffer[1] = 'e';
|
||||
buffer[2] = 'z';
|
||||
buffer[3] = 'p';
|
||||
P:5("Testing_Next(): Calling %s", buffer[6]);
|
||||
CallLocalFunction(buffer, "i", playerid);
|
||||
}
|
||||
else
|
||||
{
|
||||
YSI_g_sAsked = true;
|
||||
// No more tests.
|
||||
printf("*** Tests: %d, Fails: %d", YSI_g_sTests, YSI_g_sFails);
|
||||
if (!YSI_g_sFails)
|
||||
{
|
||||
printf(" ");
|
||||
printf(" ||==========================|| ");
|
||||
printf(" || ALL PLAYER TESTS PASSED! || ");
|
||||
printf(" ||==========================|| ");
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
// If the test needs a player but doesn't ask them anything
|
||||
// then we can't wait for "OnDialogResponse" to run the next
|
||||
// one.
|
||||
if (YSI_g_sAsked)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (fails == YSI_g_sFails)
|
||||
{
|
||||
printf(TEST_PASSED);
|
||||
}
|
||||
}
|
||||
//while (!YSI_g_sAsked);
|
||||
}
|
||||
|
||||
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
|
||||
{
|
||||
if (dialogid == Y_TESTING_DIALOG_ID)
|
||||
{
|
||||
++YSI_g_sTests;
|
||||
if (response)
|
||||
{
|
||||
// Pass.
|
||||
printf(TEST_PASSED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fail.
|
||||
printf(TEST_FAILED " %s", YSI_g_sFailMessage);
|
||||
++YSI_g_sFails;
|
||||
}
|
||||
Testing_Next(playerid);
|
||||
return 1;
|
||||
}
|
||||
#if defined Testing_OnDialogResponse
|
||||
return Testing_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined _ALS_OnDialogResponse
|
||||
#undef OnDialogResponse
|
||||
#else
|
||||
#define _ALS_OnDialogResponse
|
||||
#endif
|
||||
#define OnDialogResponse Testing_OnDialogResponse
|
||||
#if defined Testing_OnDialogResponse
|
||||
forward Testing_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
|
||||
#endif
|
||||
|
||||
public OnPlayerSpawn(playerid)
|
||||
{
|
||||
if (YSI_g_sPlayer == cellmax && !IsPlayerNPC(playerid))
|
||||
{
|
||||
printf(" ");
|
||||
printf(" ||==========================|| ");
|
||||
printf(" || STARTING PLAYER TESTS... || ");
|
||||
printf(" ||==========================|| ");
|
||||
printf(" ");
|
||||
YSI_g_sTests = 0;
|
||||
YSI_g_sFails = 0;
|
||||
Testing_Next(playerid);
|
||||
}
|
||||
#if defined Testing_OnPlayerSpawn
|
||||
return Testing_OnPlayerSpawn(playerid);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined _ALS_OnPlayerSpawn
|
||||
#undef OnPlayerSpawn
|
||||
#else
|
||||
#define _ALS_OnPlayerSpawn
|
||||
#endif
|
||||
#define OnPlayerSpawn Testing_OnPlayerSpawn
|
||||
#if defined Testing_OnPlayerSpawn
|
||||
forward Testing_OnPlayerSpawn(playerid);
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
Testing_RunAll()
|
||||
{
|
||||
// Disable error messages (as we're likely to generate them).
|
||||
state ysi_debug : off;
|
||||
new
|
||||
tests,
|
||||
fails;
|
||||
printf(" ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" || STARTING TESTS... || ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" ");
|
||||
Testing_Run(tests, fails, _, true);
|
||||
printf("*** Tests: %d, Fails: %d", tests, fails);
|
||||
if (!fails)
|
||||
{
|
||||
printf(" ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" || ALL TESTS PASSED! || ");
|
||||
printf(" ||===================|| ");
|
||||
printf(" ");
|
||||
}
|
||||
state ysi_debug : on;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
//#define Tests:%1() stock bool:Tests_@%1()
|
||||
/*#define Test:%1() stock bool:Test_@%1()
|
||||
#define TestInit:%1() stock Init_@%1()
|
||||
#define TestClose:%1() stock Shut_@%1()
|
||||
|
||||
#define PTest:%1(%2) stock bool:Test_@%1(%2)
|
||||
#define PTestInit:%1(%2) stock Init_@%1(%2)
|
||||
#define PTestClose:%1(%2) stock Shut_@%1(%2)*/
|
||||
#endif
|
||||
5
samples/Thrift/linguist.thrift
Normal file
5
samples/Thrift/linguist.thrift
Normal file
@@ -0,0 +1,5 @@
|
||||
struct PullRequest {
|
||||
1: string title
|
||||
}
|
||||
|
||||
|
||||
12
samples/XML/Example.mdpolicy
Normal file
12
samples/XML/Example.mdpolicy
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PolicySet name="Example.mdpolicy">
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp">
|
||||
<FileWidth>120</FileWidth>
|
||||
<TabsToSpaces>False</TabsToSpaces>
|
||||
<NoTabsAfterNonTabs>True</NoTabsAfterNonTabs>
|
||||
</TextStylePolicy>
|
||||
<DotNetNamingPolicy>
|
||||
<DirectoryNamespaceAssociation>None</DirectoryNamespaceAssociation>
|
||||
<ResourceNamePolicy>FileFormatDefault</ResourceNamePolicy>
|
||||
</DotNetNamingPolicy>
|
||||
</PolicySet>
|
||||
13
samples/XML/intellij.iml
Normal file
13
samples/XML/intellij.iml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="backend node_modules" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
125
samples/XML/xhtml-struct-1.mod
Normal file
125
samples/XML/xhtml-struct-1.mod
Normal file
@@ -0,0 +1,125 @@
|
||||
<!-- ...................................................................... -->
|
||||
<!-- XHTML Structure Module .............................................. -->
|
||||
<!-- file: xhtml-struct-1.mod
|
||||
|
||||
This is XHTML, a reformulation of HTML as a modular XML application.
|
||||
Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
|
||||
Revision: $Id: xhtml-struct-1.mod,v 1.1.1.1 2006/01/09 19:23:30 rcrews Exp $ SMI
|
||||
|
||||
This DTD module is identified by the PUBLIC and SYSTEM identifiers:
|
||||
|
||||
PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
|
||||
SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-struct-1.mod"
|
||||
|
||||
Revisions:
|
||||
(none)
|
||||
....................................................................... -->
|
||||
|
||||
<!-- Document Structure
|
||||
|
||||
title, head, body, html
|
||||
|
||||
The Structure Module defines the major structural elements and
|
||||
their attributes.
|
||||
|
||||
Note that the content model of the head element type is redeclared
|
||||
when the Base Module is included in the DTD.
|
||||
|
||||
The parameter entity containing the XML namespace URI value used
|
||||
for XHTML is '%XHTML.xmlns;', defined in the Qualified Names module.
|
||||
-->
|
||||
|
||||
<!-- title: Document Title ............................. -->
|
||||
|
||||
<!-- The title element is not considered part of the flow of text.
|
||||
It should be displayed, for example as the page header or
|
||||
window title. Exactly one title is required per document.
|
||||
-->
|
||||
|
||||
<!ENTITY % title.element "INCLUDE" >
|
||||
<![%title.element;[
|
||||
<!ENTITY % title.content "( #PCDATA )" >
|
||||
<!ENTITY % title.qname "title" >
|
||||
<!ELEMENT %title.qname; %title.content; >
|
||||
<!-- end of title.element -->]]>
|
||||
|
||||
<!ENTITY % title.attlist "INCLUDE" >
|
||||
<![%title.attlist;[
|
||||
<!ATTLIST %title.qname;
|
||||
%XHTML.xmlns.attrib;
|
||||
%I18n.attrib;
|
||||
>
|
||||
<!-- end of title.attlist -->]]>
|
||||
|
||||
<!-- head: Document Head ............................... -->
|
||||
|
||||
<!ENTITY % head.element "INCLUDE" >
|
||||
<![%head.element;[
|
||||
<!ENTITY % head.content
|
||||
"( %HeadOpts.mix;, %title.qname;, %HeadOpts.mix; )"
|
||||
>
|
||||
<!ENTITY % head.qname "head" >
|
||||
<!ELEMENT %head.qname; %head.content; >
|
||||
<!-- end of head.element -->]]>
|
||||
|
||||
<!ENTITY % head.attlist "INCLUDE" >
|
||||
<![%head.attlist;[
|
||||
<!-- reserved for future use with document profiles
|
||||
-->
|
||||
<!ENTITY % profile.attrib
|
||||
"profile %URI.datatype; '%XHTML.profile;'"
|
||||
>
|
||||
|
||||
<!ATTLIST %head.qname;
|
||||
%XHTML.xmlns.attrib;
|
||||
%I18n.attrib;
|
||||
%profile.attrib;
|
||||
>
|
||||
<!-- end of head.attlist -->]]>
|
||||
|
||||
<!-- body: Document Body ............................... -->
|
||||
|
||||
<!ENTITY % body.element "INCLUDE" >
|
||||
<![%body.element;[
|
||||
<!ENTITY % body.content
|
||||
"( %Block.mix; )+"
|
||||
>
|
||||
<!ENTITY % body.qname "body" >
|
||||
<!ELEMENT %body.qname; %body.content; >
|
||||
<!-- end of body.element -->]]>
|
||||
|
||||
<!ENTITY % body.attlist "INCLUDE" >
|
||||
<![%body.attlist;[
|
||||
<!ATTLIST %body.qname;
|
||||
%Common.attrib;
|
||||
>
|
||||
<!-- end of body.attlist -->]]>
|
||||
|
||||
<!-- html: XHTML Document Element ...................... -->
|
||||
|
||||
<!ENTITY % html.element "INCLUDE" >
|
||||
<![%html.element;[
|
||||
<!ENTITY % html.content "( %head.qname;, %body.qname; )" >
|
||||
<!ENTITY % html.qname "html" >
|
||||
<!ELEMENT %html.qname; %html.content; >
|
||||
<!-- end of html.element -->]]>
|
||||
|
||||
<!ENTITY % html.attlist "INCLUDE" >
|
||||
<![%html.attlist;[
|
||||
<!-- version attribute value defined in driver
|
||||
-->
|
||||
<!ENTITY % XHTML.version.attrib
|
||||
"version %FPI.datatype; #FIXED '%XHTML.version;'"
|
||||
>
|
||||
|
||||
<!-- see the Qualified Names module for information
|
||||
on how to extend XHTML using XML namespaces
|
||||
-->
|
||||
<!ATTLIST %html.qname;
|
||||
%XHTML.xmlns.attrib;
|
||||
%XHTML.version.attrib;
|
||||
%I18n.attrib;
|
||||
>
|
||||
<!-- end of html.attlist -->]]>
|
||||
|
||||
<!-- end of xhtml-struct-1.mod -->
|
||||
@@ -188,14 +188,16 @@ def load_grammars(tmp_dir, source, all_scopes)
|
||||
scope = grammar['scopeName']
|
||||
|
||||
if all_scopes.key?(scope)
|
||||
$stderr.puts "WARN: Duplicated scope #{scope}\n" +
|
||||
" Current package: #{p.url}\n" +
|
||||
" Previous package: #{all_scopes[scope]}"
|
||||
unless all_scopes[scope] == p.url
|
||||
$stderr.puts "WARN: Duplicated scope #{scope}\n" +
|
||||
" Current package: #{p.url}\n" +
|
||||
" Previous package: #{all_scopes[scope]}"
|
||||
end
|
||||
next
|
||||
end
|
||||
all_scopes[scope] = p.url
|
||||
grammar
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
def install_grammars(grammars, path)
|
||||
|
||||
50
test/fixtures/Generated/ABM8G.mod
vendored
Normal file
50
test/fixtures/Generated/ABM8G.mod
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
PCBNEW-LibModule-V1 Wed 10 Aug 2011 05:57:27 PM COT
|
||||
# encoding utf-8
|
||||
$INDEX
|
||||
ABM8G
|
||||
$EndINDEX
|
||||
$MODULE ABM8G
|
||||
Po 0 0 0 15 4E430CBD 4E430CC5 ~~
|
||||
Li ABM8G
|
||||
Sc 4E430CC5
|
||||
AR
|
||||
Op 0 0 0
|
||||
T0 591 -1378 354 354 0 39 N V 21 N "ABM8G"
|
||||
T1 0 787 354 354 0 39 N V 21 N "VAL**"
|
||||
DS -591 394 1299 394 79 21
|
||||
DS 1299 394 1299 -1063 79 21
|
||||
DS 1299 -1063 -472 -1063 79 21
|
||||
DS -472 -1063 -472 472 79 21
|
||||
DS -472 472 -472 551 79 21
|
||||
DS -472 551 -591 551 79 21
|
||||
DS -591 551 -591 433 79 21
|
||||
$PAD
|
||||
Sh "1" R 551 472 0 0 0
|
||||
Dr 0 0 0
|
||||
At SMD N 00888000
|
||||
Ne 0 ""
|
||||
Po 0 0
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "2" R 551 472 0 0 0
|
||||
Dr 0 0 0
|
||||
At SMD N 00888000
|
||||
Ne 0 ""
|
||||
Po 866 0
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "3" R 551 472 0 0 0
|
||||
Dr 0 0 0
|
||||
At SMD N 00888000
|
||||
Ne 0 ""
|
||||
Po 866 -669
|
||||
$EndPAD
|
||||
$PAD
|
||||
Sh "4" R 551 472 0 0 0
|
||||
Dr 0 0 0
|
||||
At SMD N 00888000
|
||||
Ne 0 ""
|
||||
Po 0 -669
|
||||
$EndPAD
|
||||
$EndMODULE ABM8G
|
||||
$EndLIBRARY
|
||||
19
test/fixtures/Generated/ms2.mod
vendored
Normal file
19
test/fixtures/Generated/ms2.mod
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
GFORTRAN module version '0' created from ms2.f90 on Thu Sep 5 10:09:19 2013
|
||||
MD5:8a80cd5db1bc612a28603959302dbf37 -- If you edit this, you'll get what you deserve.
|
||||
|
||||
(() () () () () () () () () () () () () () () () () () () () () () () ()
|
||||
() () ())
|
||||
|
||||
()
|
||||
|
||||
()
|
||||
|
||||
()
|
||||
|
||||
()
|
||||
|
||||
(2 'ms2' 'ms2' 'ms2' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN
|
||||
UNKNOWN) (UNKNOWN 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0)
|
||||
)
|
||||
|
||||
('ms2' 0 2)
|
||||
1
test/fixtures/SVG/alg_schema.link.svg
vendored
Symbolic link
1
test/fixtures/SVG/alg_schema.link.svg
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
alg_schema.svg
|
||||
269
test/fixtures/SVG/alg_schema.svg
vendored
Normal file
269
test/fixtures/SVG/alg_schema.svg
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.0 r9654"
|
||||
sodipodi:docname="alg_schema.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.834386"
|
||||
inkscape:cx="409.42881"
|
||||
inkscape:cy="681.83774"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g3759"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="993"
|
||||
inkscape:window-x="1280"
|
||||
inkscape:window-y="31"
|
||||
inkscape:window-maximized="0"
|
||||
showguides="true"
|
||||
inkscape:snap-global="false">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3914" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3759"
|
||||
transform="translate(-3.3909149,-21.218048)">
|
||||
<rect
|
||||
ry="11.855058"
|
||||
rx="14.468504"
|
||||
y="138.58023"
|
||||
x="108.08632"
|
||||
height="66.263969"
|
||||
width="247.48737"
|
||||
id="rect2985"
|
||||
style="fill:#1f3d55;fill-opacity:1;fill-rule:evenodd;stroke:#3f5d75;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text3755"
|
||||
y="163.58023"
|
||||
x="238.39091"
|
||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:24px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1"
|
||||
y="163.58023"
|
||||
x="238.39091"
|
||||
id="tspan3757"
|
||||
sodipodi:role="line">Sequence KEY</tspan><tspan
|
||||
style="font-size:24px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1"
|
||||
y="193.58023"
|
||||
x="238.39091"
|
||||
sodipodi:role="line"
|
||||
id="tspan4055">256 bits</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g3870"
|
||||
transform="translate(-0.73178617,29.27145)">
|
||||
<g
|
||||
id="g3759-5"
|
||||
transform="translate(-0.40143056,286.32219)">
|
||||
<rect
|
||||
style="fill:#1f3d55;fill-opacity:1;fill-rule:evenodd;stroke:#3f5d75;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="rect2985-5"
|
||||
width="247.48737"
|
||||
height="74.751289"
|
||||
x="108.08632"
|
||||
y="130.09291"
|
||||
rx="14.468504"
|
||||
ry="13.373494" />
|
||||
<flowRoot
|
||||
transform="translate(2.4712344,-292.01415)"
|
||||
style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
id="flowRoot3797"
|
||||
xml:space="preserve"><flowRegion
|
||||
id="flowRegion3799"><rect
|
||||
style="font-size:24px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1"
|
||||
y="428.79074"
|
||||
x="125"
|
||||
height="58.346195"
|
||||
width="86.479271"
|
||||
id="rect3801" /></flowRegion><flowPara
|
||||
id="flowPara3805">Salt</flowPara><flowPara
|
||||
id="flowPara3841">96 bits</flowPara></flowRoot> <flowRoot
|
||||
transform="translate(115.26831,-291.40674)"
|
||||
style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
id="flowRoot3797-6"
|
||||
xml:space="preserve"><flowRegion
|
||||
id="flowRegion3799-5"><rect
|
||||
style="font-size:24px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1"
|
||||
y="428.79074"
|
||||
x="125"
|
||||
height="60.933453"
|
||||
width="104.07261"
|
||||
id="rect3801-6" /></flowRegion><flowPara
|
||||
id="flowPara3805-9">Counter</flowPara><flowPara
|
||||
id="flowPara3809-3">32 bits</flowPara></flowRoot> <path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3845"
|
||||
d="m 229.11476,138.88943 0,57.95451"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(0.6979728,0,0,0.6979728,71.363842,197.71804)"
|
||||
id="g3759-7">
|
||||
<rect
|
||||
ry="13.373494"
|
||||
rx="14.297379"
|
||||
y="130.09291"
|
||||
x="108.08632"
|
||||
height="74.751289"
|
||||
width="244.56023"
|
||||
id="rect2985-4"
|
||||
style="fill:#1f3d55;fill-opacity:1;fill-rule:evenodd;stroke:#3f5d75;stroke-width:7.16360283;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text3755-5"
|
||||
y="178.58023"
|
||||
x="141.31805"
|
||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#beff83;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:32px;fill:#beff83;fill-opacity:1"
|
||||
y="178.58023"
|
||||
x="141.31805"
|
||||
id="tspan3757-2"
|
||||
sodipodi:role="line">AES Cipher</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:#6ea1cc;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
|
||||
d="m 225,437.36218 0,-50 -15,5 25,-35 25,35 -15,-5 0,50 z"
|
||||
id="path3912"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<path
|
||||
style="fill:#6ea1cc;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 340,302.36218 50,0 -5,-15 35,25 -35,25 5,-15 -50,0 z"
|
||||
id="path3912-5"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<path
|
||||
style="fill:#6ea1cc;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 245,192.36218 0,50 15,-5 -25,35 -25,-35 15,5 0,-50 z"
|
||||
id="path3912-4"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<g
|
||||
transform="matrix(0.6979728,0,0,0.6979728,361.36384,197.71804)"
|
||||
id="g3759-7-7">
|
||||
<rect
|
||||
ry="13.373494"
|
||||
rx="17.857012"
|
||||
y="130.09291"
|
||||
x="108.08632"
|
||||
height="74.751289"
|
||||
width="305.44867"
|
||||
id="rect2985-4-4"
|
||||
style="fill:#1f3d55;fill-opacity:1;fill-rule:evenodd;stroke:#3f5d75;stroke-width:7.16360283;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text3755-5-4"
|
||||
y="159.80484"
|
||||
x="255.9357"
|
||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#beff83;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:25.78897095px;text-align:center;text-anchor:middle;fill:#beff83;fill-opacity:1"
|
||||
y="159.80484"
|
||||
x="255.9357"
|
||||
sodipodi:role="line"
|
||||
id="tspan3979">Secure random data</tspan><tspan
|
||||
style="font-size:25.78897095px;text-align:center;text-anchor:middle;fill:#beff83;fill-opacity:1"
|
||||
y="192.04105"
|
||||
x="255.9357"
|
||||
sodipodi:role="line"
|
||||
id="tspan3983">128 bits</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:#6ea1cc;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:0.45614035"
|
||||
d="m 550,352.36218 0,50 15,-5 -25,35 -25,-35 15,5 0,-50 z"
|
||||
id="path3912-5-0"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
x="540"
|
||||
y="382.36218"
|
||||
id="text4003"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
x="540"
|
||||
y="382.36218"
|
||||
id="tspan4007"
|
||||
style="font-size:16px;text-align:center;text-anchor:middle">Division by alphabet length</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
x="540"
|
||||
y="402.36218"
|
||||
style="font-size:16px;text-align:center;text-anchor:middle"
|
||||
id="tspan4053">repeated passcode-length times.</tspan></text>
|
||||
<g
|
||||
transform="matrix(0.6979728,0,0,0.6979728,344.55869,369.3865)"
|
||||
id="g3759-7-7-7">
|
||||
<g
|
||||
id="g4045"
|
||||
transform="translate(-1.21417,-6.070852)">
|
||||
<rect
|
||||
style="fill:#1f3d55;fill-opacity:1;fill-rule:evenodd;stroke:#3f5d75;stroke-width:7.16360283;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="rect2985-4-4-8"
|
||||
width="305.44867"
|
||||
height="74.751289"
|
||||
x="131.15555"
|
||||
y="130.09291"
|
||||
rx="17.857012"
|
||||
ry="13.373494" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#beff83;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
||||
x="283.77673"
|
||||
y="158.71724"
|
||||
id="text3755-5-4-6"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
id="tspan3983-8"
|
||||
sodipodi:role="line"
|
||||
x="283.77673"
|
||||
y="158.71724"
|
||||
style="font-size:25.78897095px;text-align:center;text-anchor:middle;fill:#beff83;fill-opacity:1">Passcode</tspan><tspan
|
||||
id="tspan4043"
|
||||
sodipodi:role="line"
|
||||
x="283.77673"
|
||||
y="190.95346"
|
||||
style="font-size:25.78897095px;text-align:center;text-anchor:middle;fill:#beff83;fill-opacity:1">2-16 characters</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -217,6 +217,15 @@ class TestBlob < Minitest::Test
|
||||
assert sample_blob("Java/ProtocolBuffer.java").generated?
|
||||
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
|
||||
assert sample_blob("Go/api.pb.go").generated?
|
||||
assert sample_blob("Go/embedded.go").generated?
|
||||
|
||||
# Apache Thrift generated code
|
||||
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
|
||||
assert sample_blob("Go/gen-go-linguist-thrift.go").generated?
|
||||
assert sample_blob("Java/gen-java-linguist-thrift.java").generated?
|
||||
assert sample_blob("JavaScript/gen-js-linguist-thrift.js").generated?
|
||||
assert sample_blob("Ruby/gen-rb-linguist-thrift.rb").generated?
|
||||
assert sample_blob("Objective-C/gen-cocoa-linguist-thrift.m").generated?
|
||||
|
||||
# Generated JNI
|
||||
assert sample_blob("C/jni_layer.h").generated?
|
||||
@@ -270,6 +279,9 @@ class TestBlob < Minitest::Test
|
||||
# Rails vendor/
|
||||
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
|
||||
|
||||
# Vendor/
|
||||
assert sample_blob("Vendor/my_great_file.h").vendored?
|
||||
|
||||
# 'thirdparty' directory
|
||||
assert sample_blob("thirdparty/lib/main.c").vendored?
|
||||
|
||||
@@ -414,6 +426,9 @@ class TestBlob < Minitest::Test
|
||||
# Normalize
|
||||
assert sample_blob("some/asset/path/normalize.css").vendored?
|
||||
|
||||
# Carthage
|
||||
assert sample_blob('Carthage/blah').vendored?
|
||||
|
||||
# Cocoapods
|
||||
assert sample_blob('Pods/blah').vendored?
|
||||
|
||||
@@ -465,9 +480,15 @@ class TestBlob < Minitest::Test
|
||||
# Sphinx docs
|
||||
assert sample_blob("docs/_build/asset.doc").vendored?
|
||||
assert sample_blob("docs/theme/file.css").vendored?
|
||||
|
||||
|
||||
# Vagrant
|
||||
assert sample_blob("puphpet/file.pp").vendored?
|
||||
|
||||
# Fabric.io
|
||||
assert sample_blob("Fabric.framework/Fabric.h").vendored?
|
||||
|
||||
# Crashlytics
|
||||
assert sample_blob("Crashlytics.framework/Crashlytics.h").vendored?
|
||||
end
|
||||
|
||||
def test_documentation
|
||||
@@ -539,6 +560,8 @@ class TestBlob < Minitest::Test
|
||||
blob = fixture_blob(filepath)
|
||||
if language == 'Data'
|
||||
assert blob.language.nil?, "A language was found for #{filepath}"
|
||||
elsif language == 'Generated'
|
||||
assert blob.generated?, "#{filepath} is not a generated file"
|
||||
else
|
||||
assert blob.language, "No language for #{filepath}"
|
||||
assert_equal language, blob.language.name, blob.name
|
||||
|
||||
@@ -48,8 +48,7 @@ class TestHeuristcs < Minitest::Test
|
||||
def test_pl_prolog_perl_by_heuristics
|
||||
assert_heuristics({
|
||||
"Prolog" => all_fixtures("Prolog/*.pl"),
|
||||
"Perl" => all_fixtures("Perl/*.pl"),
|
||||
"Perl" => ["Perl/perl-test.t"],
|
||||
"Perl" => all_fixtures("Perl/*.pl") + ["Perl/perl-test.t"],
|
||||
"Perl6" => all_fixtures("Perl6/*.pl")
|
||||
})
|
||||
end
|
||||
|
||||
2
vendor/grammars/AutoHotkey
vendored
2
vendor/grammars/AutoHotkey
vendored
Submodule vendor/grammars/AutoHotkey updated: 9b42c86e75...8a9bb55597
2
vendor/grammars/Docker.tmbundle
vendored
2
vendor/grammars/Docker.tmbundle
vendored
Submodule vendor/grammars/Docker.tmbundle updated: 8f28cd8714...8ff6e62c89
1
vendor/grammars/Handlebars
vendored
Submodule
1
vendor/grammars/Handlebars
vendored
Submodule
Submodule vendor/grammars/Handlebars added at 60532f35cf
2
vendor/grammars/InnoSetup
vendored
2
vendor/grammars/InnoSetup
vendored
Submodule vendor/grammars/InnoSetup updated: 875ba96c32...417c64d7b3
2
vendor/grammars/NimLime
vendored
2
vendor/grammars/NimLime
vendored
Submodule vendor/grammars/NimLime updated: 663b417558...4acce8b67b
1
vendor/grammars/SMT.tmbundle
vendored
Submodule
1
vendor/grammars/SMT.tmbundle
vendored
Submodule
Submodule vendor/grammars/SMT.tmbundle added at 5b8231f516
1
vendor/grammars/Sublime-Modula-2
vendored
Submodule
1
vendor/grammars/Sublime-Modula-2
vendored
Submodule
Submodule vendor/grammars/Sublime-Modula-2 added at f30f2fbe3b
2
vendor/grammars/SublimePapyrus
vendored
2
vendor/grammars/SublimePapyrus
vendored
Submodule vendor/grammars/SublimePapyrus updated: 26036db16d...db14899948
1
vendor/grammars/atom-fsharp
vendored
Submodule
1
vendor/grammars/atom-fsharp
vendored
Submodule
Submodule vendor/grammars/atom-fsharp added at 55785b6af0
2
vendor/grammars/carto-atom
vendored
2
vendor/grammars/carto-atom
vendored
Submodule vendor/grammars/carto-atom updated: c00fb6c461...9895909323
2
vendor/grammars/css.tmbundle
vendored
2
vendor/grammars/css.tmbundle
vendored
Submodule vendor/grammars/css.tmbundle updated: 2ce91736ca...94f7111c29
2
vendor/grammars/d.tmbundle
vendored
2
vendor/grammars/d.tmbundle
vendored
Submodule vendor/grammars/d.tmbundle updated: ccb8b6ba11...f7953e41fd
2
vendor/grammars/dart-sublime-bundle
vendored
2
vendor/grammars/dart-sublime-bundle
vendored
Submodule vendor/grammars/dart-sublime-bundle updated: 4c599ca5f2...67f23dfef2
2
vendor/grammars/factor
vendored
2
vendor/grammars/factor
vendored
Submodule vendor/grammars/factor updated: aa1a5f22ba...0124e630f0
1
vendor/grammars/fsharpbinding
vendored
1
vendor/grammars/fsharpbinding
vendored
Submodule vendor/grammars/fsharpbinding deleted from ad3f073464
2
vendor/grammars/grace-tmbundle
vendored
2
vendor/grammars/grace-tmbundle
vendored
Submodule vendor/grammars/grace-tmbundle updated: 2fba162ce7...9e8bb893f0
2
vendor/grammars/graphviz.tmbundle
vendored
2
vendor/grammars/graphviz.tmbundle
vendored
Submodule vendor/grammars/graphviz.tmbundle updated: 2760230b50...d1d489f893
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user