mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81b7a412c3 | ||
|
|
09b9a8b441 | ||
|
|
701e720ab8 | ||
|
|
e709ce7d56 | ||
|
|
32c89a5405 | ||
|
|
1735982a73 | ||
|
|
625e0aa1af | ||
|
|
00e1a3f8fd | ||
|
|
539256b08e | ||
|
|
ff791f5a39 | ||
|
|
304fc344a1 | ||
|
|
9d940755e7 | ||
|
|
bc04232f87 | ||
|
|
e17ebec098 | ||
|
|
7cd23036a7 | ||
|
|
44c5413abf | ||
|
|
50ab58e91f | ||
|
|
1fd0732390 | ||
|
|
ed1b9ee899 | ||
|
|
d3c04d6310 | ||
|
|
f66ffe305f | ||
|
|
2a9ff0083c | ||
|
|
c1cf7ea825 | ||
|
|
67f7268a55 | ||
|
|
a55ee7eb09 | ||
|
|
203f6d1944 | ||
|
|
42c68f21d1 | ||
|
|
7e8be1293e | ||
|
|
09c234ec26 | ||
|
|
65a26c3e73 | ||
|
|
98f35aefdc | ||
|
|
38a3714514 | ||
|
|
491700f925 | ||
|
|
4d033e7e83 | ||
|
|
efc3638065 | ||
|
|
b7685ab317 | ||
|
|
83c5f6a004 | ||
|
|
aa5a94cc3e | ||
|
|
a5b6331ab5 | ||
|
|
2164b28c64 | ||
|
|
0fb824b345 | ||
|
|
29ee094d66 | ||
|
|
4a7ae50ec8 | ||
|
|
398439a937 | ||
|
|
a3bc3a7615 | ||
|
|
7989fbd613 | ||
|
|
c389c79be9 | ||
|
|
1fd2f921fd | ||
|
|
ed851849db | ||
|
|
cfb9f6f0a4 | ||
|
|
3d5a0da62e | ||
|
|
4e15369f9a | ||
|
|
5b3152d99d | ||
|
|
a6955f4edb | ||
|
|
ac2723abe3 | ||
|
|
0d0e219532 | ||
|
|
cf35807709 | ||
|
|
c2b53db96d | ||
|
|
8e6efc3a7d | ||
|
|
4b6f05b4d1 | ||
|
|
7aad5f93e4 | ||
|
|
dcc598442b | ||
|
|
91877056fb | ||
|
|
868e9df434 | ||
|
|
9ae0bdbb43 | ||
|
|
a3aaa1ec4d | ||
|
|
5fb6f34d8a |
@@ -143,8 +143,8 @@ If you are the current maintainer of this gem:
|
||||
0. Make sure your local dependencies are up to date: `bundle install`
|
||||
0. Ensure that samples are updated: `bundle exec rake samples`
|
||||
0. Ensure that tests are green: `bundle exec rake test`
|
||||
0. Bump gem version in github-linguist.gemspec. For example, [like this](https://github.com/github/linguist/commit/97908204a385940e47251af9ecb689e8f6515c48).
|
||||
0. Make a PR to github/linguist. For example, [#1075](https://github.com/github/linguist/pull/1075).
|
||||
0. Bump gem version in `lib/linguist/version.rb`. For example, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985).
|
||||
0. Make a PR to github/linguist. For example, [#1238](https://github.com/github/linguist/pull/1238).
|
||||
0. Build a local gem: `gem build github-linguist.gemspec`
|
||||
0. Testing:
|
||||
0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem
|
||||
|
||||
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
||||
s.files = Dir['lib/**/*']
|
||||
s.executables << 'linguist'
|
||||
|
||||
s.add_dependency 'charlock_holmes', '~> 0.7.1'
|
||||
s.add_dependency 'charlock_holmes', '~> 0.7.3'
|
||||
s.add_dependency 'escape_utils', '~> 1.0.1'
|
||||
s.add_dependency 'mime-types', '~> 1.19'
|
||||
s.add_dependency 'pygments.rb', '~> 0.5.4'
|
||||
|
||||
@@ -112,6 +112,12 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
def ruby_encoding
|
||||
if hash = detect_encoding
|
||||
hash[:ruby_encoding]
|
||||
end
|
||||
end
|
||||
|
||||
# Try to guess the encoding
|
||||
#
|
||||
# Returns: a Hash, with :encoding, :confidence, :type
|
||||
@@ -256,10 +262,16 @@ module Linguist
|
||||
# without changing the encoding of `data`, and
|
||||
# also--importantly--without having to duplicate many (potentially
|
||||
# large) strings.
|
||||
encoded_newlines = ["\r\n", "\r", "\n"].
|
||||
map { |nl| nl.encode(encoding).force_encoding(data.encoding) }
|
||||
begin
|
||||
encoded_newlines = ["\r\n", "\r", "\n"].
|
||||
map { |nl| nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data.encoding) }
|
||||
|
||||
data.split(Regexp.union(encoded_newlines), -1)
|
||||
data.split(Regexp.union(encoded_newlines), -1)
|
||||
rescue Encoding::ConverterNotFoundError
|
||||
# The data is not splittable in the detected encoding. Assume it's
|
||||
# one big line.
|
||||
[data]
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
@@ -430,6 +430,14 @@ Common Lisp:
|
||||
- clisp
|
||||
- ecl
|
||||
|
||||
Component Pascal:
|
||||
type: programming
|
||||
lexer: Delphi
|
||||
color: "#b0ce4e"
|
||||
extensions:
|
||||
- .cp
|
||||
- .cps
|
||||
|
||||
Coq:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -1895,6 +1903,13 @@ SQL:
|
||||
- .udf
|
||||
- .viw
|
||||
|
||||
STON:
|
||||
type: data
|
||||
group: Smalltalk
|
||||
lexer: JSON
|
||||
extensions:
|
||||
- .ston
|
||||
|
||||
Sage:
|
||||
type: programming
|
||||
lexer: Python
|
||||
@@ -2017,8 +2032,9 @@ Standard ML:
|
||||
aliases:
|
||||
- sml
|
||||
extensions:
|
||||
- .sml
|
||||
- .ML
|
||||
- .fun
|
||||
- .sml
|
||||
|
||||
Stata:
|
||||
type: programming
|
||||
@@ -2048,6 +2064,7 @@ SuperCollider:
|
||||
|
||||
Swift:
|
||||
type: programming
|
||||
color: "#ffac45"
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .swift
|
||||
@@ -2160,6 +2177,14 @@ UnrealScript:
|
||||
extensions:
|
||||
- .uc
|
||||
|
||||
VCL:
|
||||
type: programming
|
||||
lexer: Perl
|
||||
ace_mode: perl
|
||||
color: "#0298c3"
|
||||
extensions:
|
||||
- .vcl
|
||||
|
||||
VHDL:
|
||||
type: programming
|
||||
lexer: vhdl
|
||||
@@ -2348,6 +2373,14 @@ Zephir:
|
||||
extensions:
|
||||
- .zep
|
||||
|
||||
Zimpl:
|
||||
type: programming
|
||||
lexer: Text only
|
||||
extensions:
|
||||
- .zimpl
|
||||
- .zmpl
|
||||
- .zpl
|
||||
|
||||
eC:
|
||||
type: programming
|
||||
search_term: ec
|
||||
@@ -2378,6 +2411,7 @@ mupad:
|
||||
nesC:
|
||||
type: programming
|
||||
color: "#ffce3b"
|
||||
lexer: nesC
|
||||
extensions:
|
||||
- .nc
|
||||
|
||||
|
||||
@@ -92,6 +92,10 @@
|
||||
".cl",
|
||||
".lisp"
|
||||
],
|
||||
"Component Pascal": [
|
||||
".cp",
|
||||
".cps"
|
||||
],
|
||||
"Coq": [
|
||||
".v"
|
||||
],
|
||||
@@ -562,6 +566,7 @@
|
||||
".nut"
|
||||
],
|
||||
"Standard ML": [
|
||||
".ML",
|
||||
".fun",
|
||||
".sig",
|
||||
".sml"
|
||||
@@ -575,6 +580,9 @@
|
||||
".matah",
|
||||
".sthlp"
|
||||
],
|
||||
"STON": [
|
||||
".ston"
|
||||
],
|
||||
"Stylus": [
|
||||
".styl"
|
||||
],
|
||||
@@ -610,6 +618,9 @@
|
||||
"UnrealScript": [
|
||||
".uc"
|
||||
],
|
||||
"VCL": [
|
||||
".vcl"
|
||||
],
|
||||
"Verilog": [
|
||||
".v"
|
||||
],
|
||||
@@ -660,6 +671,9 @@
|
||||
],
|
||||
"Zephir": [
|
||||
".zep"
|
||||
],
|
||||
"Zimpl": [
|
||||
".zmpl"
|
||||
]
|
||||
},
|
||||
"interpreters": {
|
||||
@@ -726,8 +740,8 @@
|
||||
".gemrc"
|
||||
]
|
||||
},
|
||||
"tokens_total": 612602,
|
||||
"languages_total": 798,
|
||||
"tokens_total": 614357,
|
||||
"languages_total": 811,
|
||||
"tokens": {
|
||||
"ABAP": {
|
||||
"*/**": 1,
|
||||
@@ -15333,6 +15347,181 @@
|
||||
"line": 2,
|
||||
"After": 1
|
||||
},
|
||||
"Component Pascal": {
|
||||
"MODULE": 2,
|
||||
"ObxControls": 1,
|
||||
";": 123,
|
||||
"IMPORT": 2,
|
||||
"Dialog": 1,
|
||||
"Ports": 1,
|
||||
"Properties": 1,
|
||||
"Views": 1,
|
||||
"CONST": 1,
|
||||
"beginner": 5,
|
||||
"advanced": 3,
|
||||
"expert": 1,
|
||||
"guru": 2,
|
||||
"TYPE": 1,
|
||||
"View": 6,
|
||||
"POINTER": 2,
|
||||
"TO": 2,
|
||||
"RECORD": 2,
|
||||
"(": 91,
|
||||
"Views.View": 2,
|
||||
")": 94,
|
||||
"size": 1,
|
||||
"INTEGER": 10,
|
||||
"END": 31,
|
||||
"VAR": 9,
|
||||
"data*": 1,
|
||||
"class*": 1,
|
||||
"list*": 1,
|
||||
"Dialog.List": 1,
|
||||
"width*": 1,
|
||||
"predef": 12,
|
||||
"ARRAY": 2,
|
||||
"OF": 2,
|
||||
"PROCEDURE": 12,
|
||||
"SetList": 4,
|
||||
"BEGIN": 13,
|
||||
"IF": 11,
|
||||
"data.class": 5,
|
||||
"THEN": 12,
|
||||
"data.list.SetLen": 3,
|
||||
"data.list.SetItem": 11,
|
||||
"ELSIF": 1,
|
||||
"ELSE": 3,
|
||||
"v": 6,
|
||||
"CopyFromSimpleView": 2,
|
||||
"source": 2,
|
||||
"v.size": 10,
|
||||
".size": 1,
|
||||
"Restore": 2,
|
||||
"f": 1,
|
||||
"Views.Frame": 1,
|
||||
"l": 1,
|
||||
"t": 1,
|
||||
"r": 7,
|
||||
"b": 1,
|
||||
"[": 13,
|
||||
"]": 13,
|
||||
"f.DrawRect": 1,
|
||||
"Ports.fill": 1,
|
||||
"Ports.red": 1,
|
||||
"HandlePropMsg": 2,
|
||||
"msg": 2,
|
||||
"Views.PropMessage": 1,
|
||||
"WITH": 1,
|
||||
"Properties.SizePref": 1,
|
||||
"DO": 4,
|
||||
"msg.w": 1,
|
||||
"msg.h": 1,
|
||||
"ClassNotify*": 1,
|
||||
"op": 4,
|
||||
"from": 2,
|
||||
"to": 5,
|
||||
"Dialog.changed": 2,
|
||||
"OR": 4,
|
||||
"&": 8,
|
||||
"data.list.index": 3,
|
||||
"data.width": 4,
|
||||
"Dialog.Update": 2,
|
||||
"data": 2,
|
||||
"Dialog.UpdateList": 1,
|
||||
"data.list": 1,
|
||||
"ClassNotify": 1,
|
||||
"ListNotify*": 1,
|
||||
"ListNotify": 1,
|
||||
"ListGuard*": 1,
|
||||
"par": 2,
|
||||
"Dialog.Par": 2,
|
||||
"par.disabled": 1,
|
||||
"ListGuard": 1,
|
||||
"WidthGuard*": 1,
|
||||
"par.readOnly": 1,
|
||||
"#": 3,
|
||||
"WidthGuard": 1,
|
||||
"Open*": 1,
|
||||
"NEW": 2,
|
||||
"*": 1,
|
||||
"Ports.mm": 1,
|
||||
"Views.OpenAux": 1,
|
||||
"Open": 1,
|
||||
"ObxControls.": 1,
|
||||
"ObxFact": 1,
|
||||
"Stores": 1,
|
||||
"Models": 1,
|
||||
"TextModels": 1,
|
||||
"TextControllers": 1,
|
||||
"Integers": 1,
|
||||
"Read": 3,
|
||||
"TextModels.Reader": 2,
|
||||
"x": 15,
|
||||
"Integers.Integer": 3,
|
||||
"i": 17,
|
||||
"len": 5,
|
||||
"beg": 11,
|
||||
"ch": 14,
|
||||
"CHAR": 3,
|
||||
"buf": 5,
|
||||
"r.ReadChar": 5,
|
||||
"WHILE": 3,
|
||||
"r.eot": 4,
|
||||
"<=>": 1,
|
||||
"ReadChar": 1,
|
||||
"ASSERT": 1,
|
||||
"eot": 1,
|
||||
"<": 8,
|
||||
"r.Pos": 2,
|
||||
"-": 1,
|
||||
"REPEAT": 3,
|
||||
"INC": 4,
|
||||
"UNTIL": 3,
|
||||
"+": 1,
|
||||
"r.SetPos": 2,
|
||||
"X": 1,
|
||||
"Integers.ConvertFromString": 1,
|
||||
"Write": 3,
|
||||
"w": 4,
|
||||
"TextModels.Writer": 2,
|
||||
"Integers.Sign": 2,
|
||||
"w.WriteChar": 3,
|
||||
"Integers.Digits10Of": 1,
|
||||
"DEC": 1,
|
||||
"Integers.ThisDigit10": 1,
|
||||
"Compute*": 1,
|
||||
"end": 6,
|
||||
"n": 3,
|
||||
"s": 3,
|
||||
"Stores.Operation": 1,
|
||||
"attr": 3,
|
||||
"TextModels.Attributes": 1,
|
||||
"c": 3,
|
||||
"TextControllers.Controller": 1,
|
||||
"TextControllers.Focus": 1,
|
||||
"NIL": 3,
|
||||
"c.HasSelection": 1,
|
||||
"c.GetSelection": 1,
|
||||
"c.text.NewReader": 1,
|
||||
"r.ReadPrev": 2,
|
||||
"r.attr": 1,
|
||||
"Integers.Compare": 1,
|
||||
"Integers.Long": 3,
|
||||
"MAX": 1,
|
||||
"LONGINT": 1,
|
||||
"SHORT": 1,
|
||||
"Integers.Short": 1,
|
||||
"Integers.Product": 1,
|
||||
"Models.BeginScript": 1,
|
||||
"c.text": 2,
|
||||
"c.text.Delete": 1,
|
||||
"c.text.NewWriter": 1,
|
||||
"w.SetPos": 1,
|
||||
"w.SetAttr": 1,
|
||||
"Models.EndScript": 1,
|
||||
"Compute": 1,
|
||||
"ObxFact.": 1
|
||||
},
|
||||
"Coq": {
|
||||
"Inductive": 41,
|
||||
"day": 9,
|
||||
@@ -60658,67 +60847,67 @@
|
||||
"newplayer.MoveTo": 1
|
||||
},
|
||||
"Standard ML": {
|
||||
"structure": 15,
|
||||
"LazyBase": 4,
|
||||
"LAZY_BASE": 5,
|
||||
"struct": 13,
|
||||
"type": 6,
|
||||
"a": 78,
|
||||
"exception": 2,
|
||||
"Undefined": 6,
|
||||
"fun": 60,
|
||||
"delay": 6,
|
||||
"f": 46,
|
||||
"force": 18,
|
||||
"(": 840,
|
||||
")": 845,
|
||||
"val": 147,
|
||||
"undefined": 2,
|
||||
"fn": 127,
|
||||
"raise": 6,
|
||||
"end": 55,
|
||||
"LazyMemoBase": 4,
|
||||
"datatype": 29,
|
||||
"|": 226,
|
||||
"Done": 2,
|
||||
"of": 91,
|
||||
"lazy": 13,
|
||||
"unit": 7,
|
||||
"-": 20,
|
||||
"let": 44,
|
||||
"open": 9,
|
||||
"B": 2,
|
||||
"inject": 5,
|
||||
"x": 74,
|
||||
"isUndefined": 4,
|
||||
"ignore": 3,
|
||||
";": 21,
|
||||
"false": 32,
|
||||
"handle": 4,
|
||||
"true": 36,
|
||||
"toString": 4,
|
||||
"if": 51,
|
||||
"then": 51,
|
||||
"else": 51,
|
||||
"eqBy": 5,
|
||||
"p": 10,
|
||||
"y": 50,
|
||||
"eq": 3,
|
||||
"op": 2,
|
||||
"compare": 8,
|
||||
"Ops": 3,
|
||||
"map": 3,
|
||||
"Lazy": 2,
|
||||
"LazyFn": 4,
|
||||
"LazyMemo": 2,
|
||||
"signature": 2,
|
||||
"LAZY_BASE": 3,
|
||||
"sig": 2,
|
||||
"type": 5,
|
||||
"a": 74,
|
||||
"lazy": 12,
|
||||
"-": 19,
|
||||
")": 826,
|
||||
"end": 52,
|
||||
"LAZY": 1,
|
||||
"bool": 9,
|
||||
"val": 143,
|
||||
"inject": 3,
|
||||
"toString": 3,
|
||||
"(": 822,
|
||||
"string": 14,
|
||||
"eq": 2,
|
||||
"*": 9,
|
||||
"eqBy": 3,
|
||||
"compare": 7,
|
||||
"order": 2,
|
||||
"map": 2,
|
||||
"b": 58,
|
||||
"structure": 10,
|
||||
"Ops": 2,
|
||||
"LazyBase": 2,
|
||||
"struct": 9,
|
||||
"exception": 1,
|
||||
"Undefined": 3,
|
||||
"fun": 51,
|
||||
"delay": 3,
|
||||
"f": 37,
|
||||
"force": 9,
|
||||
"undefined": 1,
|
||||
"fn": 124,
|
||||
"raise": 5,
|
||||
"LazyMemoBase": 2,
|
||||
"datatype": 28,
|
||||
"|": 225,
|
||||
"Done": 1,
|
||||
"of": 90,
|
||||
"unit": 6,
|
||||
"let": 43,
|
||||
"open": 8,
|
||||
"B": 1,
|
||||
"x": 59,
|
||||
"isUndefined": 2,
|
||||
"ignore": 2,
|
||||
";": 20,
|
||||
"false": 31,
|
||||
"handle": 3,
|
||||
"true": 35,
|
||||
"if": 50,
|
||||
"then": 50,
|
||||
"else": 50,
|
||||
"p": 6,
|
||||
"y": 44,
|
||||
"op": 1,
|
||||
"Lazy": 1,
|
||||
"LazyFn": 2,
|
||||
"LazyMemo": 1,
|
||||
"functor": 2,
|
||||
"Main": 1,
|
||||
"S": 2,
|
||||
@@ -61795,6 +61984,56 @@
|
||||
"return": 1,
|
||||
"/": 1
|
||||
},
|
||||
"STON": {
|
||||
"[": 11,
|
||||
"]": 11,
|
||||
"{": 15,
|
||||
"#a": 1,
|
||||
"#b": 1,
|
||||
"}": 15,
|
||||
"Rectangle": 1,
|
||||
"#origin": 1,
|
||||
"Point": 2,
|
||||
"-": 2,
|
||||
"#corner": 1,
|
||||
"TestDomainObject": 1,
|
||||
"#created": 1,
|
||||
"DateAndTime": 2,
|
||||
"#modified": 1,
|
||||
"#integer": 1,
|
||||
"#float": 1,
|
||||
"#description": 1,
|
||||
"#color": 1,
|
||||
"#green": 1,
|
||||
"#tags": 1,
|
||||
"#two": 1,
|
||||
"#beta": 1,
|
||||
"#medium": 1,
|
||||
"#bytes": 1,
|
||||
"ByteArray": 1,
|
||||
"#boolean": 1,
|
||||
"false": 1,
|
||||
"ZnResponse": 1,
|
||||
"#headers": 2,
|
||||
"ZnHeaders": 1,
|
||||
"ZnMultiValueDictionary": 1,
|
||||
"#entity": 1,
|
||||
"ZnStringEntity": 1,
|
||||
"#contentType": 1,
|
||||
"ZnMimeType": 1,
|
||||
"#main": 1,
|
||||
"#sub": 1,
|
||||
"#parameters": 1,
|
||||
"#contentLength": 1,
|
||||
"#string": 1,
|
||||
"#encoder": 1,
|
||||
"ZnUTF8Encoder": 1,
|
||||
"#statusLine": 1,
|
||||
"ZnStatusLine": 1,
|
||||
"#version": 1,
|
||||
"#code": 1,
|
||||
"#reason": 1
|
||||
},
|
||||
"Stylus": {
|
||||
"border": 6,
|
||||
"-": 10,
|
||||
@@ -63540,6 +63779,87 @@
|
||||
"log": 1,
|
||||
"defaultproperties": 1
|
||||
},
|
||||
"VCL": {
|
||||
"sub": 23,
|
||||
"vcl_recv": 2,
|
||||
"{": 50,
|
||||
"if": 14,
|
||||
"(": 50,
|
||||
"req.request": 18,
|
||||
"&&": 14,
|
||||
")": 50,
|
||||
"return": 33,
|
||||
"pipe": 4,
|
||||
";": 48,
|
||||
"}": 50,
|
||||
"pass": 9,
|
||||
"req.http.Authorization": 2,
|
||||
"||": 4,
|
||||
"req.http.Cookie": 2,
|
||||
"lookup": 2,
|
||||
"vcl_pipe": 2,
|
||||
"vcl_pass": 2,
|
||||
"vcl_hash": 2,
|
||||
"set": 10,
|
||||
"req.hash": 3,
|
||||
"+": 17,
|
||||
"req.url": 2,
|
||||
"req.http.host": 4,
|
||||
"else": 3,
|
||||
"server.ip": 2,
|
||||
"hash": 2,
|
||||
"vcl_hit": 2,
|
||||
"obj.cacheable": 2,
|
||||
"deliver": 8,
|
||||
"vcl_miss": 2,
|
||||
"fetch": 3,
|
||||
"vcl_fetch": 2,
|
||||
"obj.http.Set": 1,
|
||||
"-": 21,
|
||||
"Cookie": 2,
|
||||
"obj.prefetch": 1,
|
||||
"s": 3,
|
||||
"vcl_deliver": 2,
|
||||
"vcl_discard": 1,
|
||||
"discard": 2,
|
||||
"vcl_prefetch": 1,
|
||||
"vcl_timeout": 1,
|
||||
"vcl_error": 2,
|
||||
"obj.http.Content": 2,
|
||||
"Type": 2,
|
||||
"synthetic": 2,
|
||||
"utf": 2,
|
||||
"//W3C//DTD": 2,
|
||||
"XHTML": 2,
|
||||
"Strict//EN": 2,
|
||||
"http": 3,
|
||||
"//www.w3.org/TR/xhtml1/DTD/xhtml1": 2,
|
||||
"strict.dtd": 2,
|
||||
"obj.status": 4,
|
||||
"obj.response": 6,
|
||||
"req.xid": 2,
|
||||
"//www.varnish": 1,
|
||||
"cache.org/": 1,
|
||||
"req.restarts": 1,
|
||||
"req.http.x": 1,
|
||||
"forwarded": 1,
|
||||
"for": 1,
|
||||
"req.http.X": 3,
|
||||
"Forwarded": 3,
|
||||
"For": 3,
|
||||
"client.ip": 2,
|
||||
"hash_data": 3,
|
||||
"beresp.ttl": 2,
|
||||
"<": 1,
|
||||
"beresp.http.Set": 1,
|
||||
"beresp.http.Vary": 1,
|
||||
"hit_for_pass": 1,
|
||||
"obj.http.Retry": 1,
|
||||
"After": 1,
|
||||
"vcl_init": 1,
|
||||
"ok": 2,
|
||||
"vcl_fini": 1
|
||||
},
|
||||
"Verilog": {
|
||||
"////////////////////////////////////////////////////////////////////////////////": 14,
|
||||
"//": 117,
|
||||
@@ -66571,6 +66891,47 @@
|
||||
"convert": 1,
|
||||
"converter": 2,
|
||||
"getConverters": 1
|
||||
},
|
||||
"Zimpl": {
|
||||
"#": 2,
|
||||
"param": 1,
|
||||
"columns": 2,
|
||||
";": 7,
|
||||
"set": 3,
|
||||
"I": 3,
|
||||
"{": 2,
|
||||
"..": 1,
|
||||
"}": 2,
|
||||
"IxI": 6,
|
||||
"*": 2,
|
||||
"TABU": 4,
|
||||
"[": 8,
|
||||
"<i,j>": 3,
|
||||
"in": 5,
|
||||
"]": 8,
|
||||
"<m,n>": 2,
|
||||
"with": 1,
|
||||
"(": 6,
|
||||
"m": 4,
|
||||
"i": 8,
|
||||
"or": 3,
|
||||
"n": 4,
|
||||
"j": 8,
|
||||
")": 6,
|
||||
"and": 1,
|
||||
"abs": 2,
|
||||
"-": 3,
|
||||
"var": 1,
|
||||
"x": 4,
|
||||
"binary": 1,
|
||||
"maximize": 1,
|
||||
"queens": 1,
|
||||
"sum": 2,
|
||||
"subto": 1,
|
||||
"c1": 1,
|
||||
"forall": 1,
|
||||
"do": 1,
|
||||
"card": 2
|
||||
}
|
||||
},
|
||||
"language_tokens": {
|
||||
@@ -66598,6 +66959,7 @@
|
||||
"COBOL": 90,
|
||||
"CoffeeScript": 2951,
|
||||
"Common Lisp": 2186,
|
||||
"Component Pascal": 825,
|
||||
"Coq": 18259,
|
||||
"Creole": 134,
|
||||
"Crystal": 1506,
|
||||
@@ -66731,8 +67093,9 @@
|
||||
"SourcePawn": 2080,
|
||||
"SQL": 1485,
|
||||
"Squirrel": 130,
|
||||
"Standard ML": 6405,
|
||||
"Standard ML": 6567,
|
||||
"Stata": 3133,
|
||||
"STON": 100,
|
||||
"Stylus": 76,
|
||||
"SuperCollider": 133,
|
||||
"Swift": 1128,
|
||||
@@ -66744,6 +67107,7 @@
|
||||
"TXL": 213,
|
||||
"TypeScript": 109,
|
||||
"UnrealScript": 2873,
|
||||
"VCL": 545,
|
||||
"Verilog": 3778,
|
||||
"VHDL": 42,
|
||||
"VimL": 20,
|
||||
@@ -66757,7 +67121,8 @@
|
||||
"XSLT": 44,
|
||||
"Xtend": 399,
|
||||
"YAML": 77,
|
||||
"Zephir": 1026
|
||||
"Zephir": 1026,
|
||||
"Zimpl": 123
|
||||
},
|
||||
"languages": {
|
||||
"ABAP": 1,
|
||||
@@ -66784,6 +67149,7 @@
|
||||
"COBOL": 4,
|
||||
"CoffeeScript": 9,
|
||||
"Common Lisp": 3,
|
||||
"Component Pascal": 2,
|
||||
"Coq": 12,
|
||||
"Creole": 1,
|
||||
"Crystal": 3,
|
||||
@@ -66917,8 +67283,9 @@
|
||||
"SourcePawn": 1,
|
||||
"SQL": 5,
|
||||
"Squirrel": 1,
|
||||
"Standard ML": 4,
|
||||
"Standard ML": 5,
|
||||
"Stata": 7,
|
||||
"STON": 7,
|
||||
"Stylus": 1,
|
||||
"SuperCollider": 1,
|
||||
"Swift": 43,
|
||||
@@ -66930,6 +67297,7 @@
|
||||
"TXL": 1,
|
||||
"TypeScript": 3,
|
||||
"UnrealScript": 2,
|
||||
"VCL": 2,
|
||||
"Verilog": 13,
|
||||
"VHDL": 1,
|
||||
"VimL": 2,
|
||||
@@ -66943,7 +67311,8 @@
|
||||
"XSLT": 1,
|
||||
"Xtend": 2,
|
||||
"YAML": 2,
|
||||
"Zephir": 2
|
||||
"Zephir": 2,
|
||||
"Zimpl": 1
|
||||
},
|
||||
"md5": "e41e5530c6efe39b710ace7e1d5d318c"
|
||||
"md5": "92c117f774abe712958bb369c4e1dde9"
|
||||
}
|
||||
@@ -168,6 +168,9 @@
|
||||
- (^|/)extjs/src/
|
||||
- (^|/)extjs/welcome/
|
||||
|
||||
# Html5shiv
|
||||
- (^|/)html5shiv(\.min)?\.js$
|
||||
|
||||
# Samples folders
|
||||
- ^[Ss]amples/
|
||||
|
||||
@@ -196,3 +199,8 @@
|
||||
|
||||
# Mercury --use-subdirs
|
||||
- Mercury/
|
||||
|
||||
# R packages
|
||||
- ^vignettes/
|
||||
- ^inst/extdata/
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "2.11.2"
|
||||
VERSION = "2.11.5"
|
||||
end
|
||||
|
||||
130
samples/Component Pascal/Example.cp
Normal file
130
samples/Component Pascal/Example.cp
Normal file
@@ -0,0 +1,130 @@
|
||||
MODULE ObxControls;
|
||||
(**
|
||||
project = "BlackBox"
|
||||
organization = "www.oberon.ch"
|
||||
contributors = "Oberon microsystems"
|
||||
version = "System/Rsrc/About"
|
||||
copyright = "System/Rsrc/About"
|
||||
license = "Docu/BB-License"
|
||||
changes = ""
|
||||
issues = ""
|
||||
|
||||
**)
|
||||
|
||||
IMPORT Dialog, Ports, Properties, Views;
|
||||
|
||||
CONST beginner = 0; advanced = 1; expert = 2; guru = 3; (* user classes *)
|
||||
|
||||
TYPE
|
||||
View = POINTER TO RECORD (Views.View)
|
||||
size: INTEGER (* border size in mm *)
|
||||
END;
|
||||
|
||||
VAR
|
||||
data*: RECORD
|
||||
class*: INTEGER; (* current user class *)
|
||||
list*: Dialog.List; (* list of currently available sizes, derived from class *)
|
||||
width*: INTEGER (* width of next view to be opened. Derived from
|
||||
class, or entered through a text entry field *)
|
||||
END;
|
||||
|
||||
predef: ARRAY 6 OF INTEGER; (* table of predefined sizes *)
|
||||
|
||||
|
||||
PROCEDURE SetList;
|
||||
BEGIN
|
||||
IF data.class = beginner THEN
|
||||
data.list.SetLen(1);
|
||||
data.list.SetItem(0, "default")
|
||||
ELSIF data.class = advanced THEN
|
||||
data.list.SetLen(4);
|
||||
data.list.SetItem(0, "default");
|
||||
data.list.SetItem(1, "small");
|
||||
data.list.SetItem(2, "medium");
|
||||
data.list.SetItem(3, "large");
|
||||
ELSE
|
||||
data.list.SetLen(6);
|
||||
data.list.SetItem(0, "default");
|
||||
data.list.SetItem(1, "small");
|
||||
data.list.SetItem(2, "medium");
|
||||
data.list.SetItem(3, "large");
|
||||
data.list.SetItem(4, "tiny");
|
||||
data.list.SetItem(5, "huge");
|
||||
END
|
||||
END SetList;
|
||||
|
||||
(* View *)
|
||||
|
||||
PROCEDURE (v: View) CopyFromSimpleView (source: Views.View);
|
||||
BEGIN
|
||||
v.size := source(View).size
|
||||
END CopyFromSimpleView;
|
||||
|
||||
PROCEDURE (v: View) Restore (f: Views.Frame; l, t, r, b: INTEGER);
|
||||
BEGIN (* fill view with a red square of size v.size *)
|
||||
IF v.size = 0 THEN v.size := predef[0] END; (* lazy initialization of size *)
|
||||
f.DrawRect(0, 0, v.size, v.size, Ports.fill, Ports.red)
|
||||
END Restore;
|
||||
|
||||
PROCEDURE (v: View) HandlePropMsg (VAR msg: Views.PropMessage);
|
||||
BEGIN
|
||||
WITH msg: Properties.SizePref DO
|
||||
IF v.size = 0 THEN v.size := predef[0] END; (* lazy initialization of size *)
|
||||
msg.w := v.size; msg.h := v.size (* tell environment about desired width and height *)
|
||||
ELSE (* ignore other messages *)
|
||||
END
|
||||
END HandlePropMsg;
|
||||
|
||||
(* notifiers *)
|
||||
|
||||
PROCEDURE ClassNotify* (op, from, to: INTEGER);
|
||||
BEGIN (* react to change in data.class *)
|
||||
IF op = Dialog.changed THEN
|
||||
IF (to = beginner) OR (to = advanced) & (data.list.index > 3) THEN
|
||||
(* if class is reduced, make sure that selection contains legal elements *)
|
||||
data.list.index := 0; data.width := predef[0]; (* modify interactor *)
|
||||
Dialog.Update(data) (* redraw controls where necessary *)
|
||||
END;
|
||||
SetList;
|
||||
Dialog.UpdateList(data.list) (* reconstruct list box contents *)
|
||||
END
|
||||
END ClassNotify;
|
||||
|
||||
PROCEDURE ListNotify* (op, from, to: INTEGER);
|
||||
BEGIN (* reacto to change in data.list (index to was selected) *)
|
||||
IF op = Dialog.changed THEN
|
||||
data.width := predef[to]; (* modify interactor *)
|
||||
Dialog.Update(data) (* redraw controls where necessary *)
|
||||
END
|
||||
END ListNotify;
|
||||
|
||||
(* guards *)
|
||||
|
||||
PROCEDURE ListGuard* (VAR par: Dialog.Par);
|
||||
BEGIN (* disable list box for a beginner *)
|
||||
par.disabled := data.class = beginner
|
||||
END ListGuard;
|
||||
|
||||
PROCEDURE WidthGuard* (VAR par: Dialog.Par);
|
||||
BEGIN (* make text entry field read-only if user is not guru *)
|
||||
par.readOnly := data.class # guru
|
||||
END WidthGuard;
|
||||
|
||||
(* commands *)
|
||||
|
||||
PROCEDURE Open*;
|
||||
VAR v: View;
|
||||
BEGIN
|
||||
NEW(v); (* create and initialize a new view *)
|
||||
v.size := data.width * Ports.mm; (* define view's size in function of class *)
|
||||
Views.OpenAux(v, "Example") (* open the view in a window *)
|
||||
END Open;
|
||||
|
||||
BEGIN (* initialization of global variables *)
|
||||
predef[0] := 40; predef[1] := 30; predef[2] := 50; (* predefined sizes *)
|
||||
predef[3] := 70; predef[4] := 20; predef[5] := 100;
|
||||
data.class := beginner; (* default values *)
|
||||
data.list.index := 0;
|
||||
data.width := predef[0];
|
||||
SetList
|
||||
END ObxControls.
|
||||
71
samples/Component Pascal/Example2.cps
Normal file
71
samples/Component Pascal/Example2.cps
Normal file
@@ -0,0 +1,71 @@
|
||||
MODULE ObxFact;
|
||||
(**
|
||||
project = "BlackBox"
|
||||
organization = "www.oberon.ch"
|
||||
contributors = "Oberon microsystems"
|
||||
version = "System/Rsrc/About"
|
||||
copyright = "System/Rsrc/About"
|
||||
license = "Docu/BB-License"
|
||||
changes = ""
|
||||
issues = ""
|
||||
|
||||
**)
|
||||
|
||||
IMPORT
|
||||
Stores, Models, TextModels, TextControllers, Integers;
|
||||
|
||||
PROCEDURE Read(r: TextModels.Reader; VAR x: Integers.Integer);
|
||||
VAR i, len, beg: INTEGER; ch: CHAR; buf: POINTER TO ARRAY OF CHAR;
|
||||
BEGIN
|
||||
r.ReadChar(ch);
|
||||
WHILE ~r.eot & (ch <= " ") DO r.ReadChar(ch) END;
|
||||
ASSERT(~r.eot & (((ch >= "0") & (ch <= "9")) OR (ch = "-")));
|
||||
beg := r.Pos() - 1; len := 0;
|
||||
REPEAT INC(len); r.ReadChar(ch) UNTIL r.eot OR (ch < "0") OR (ch > "9");
|
||||
NEW(buf, len + 1);
|
||||
i := 0; r.SetPos(beg);
|
||||
REPEAT r.ReadChar(buf[i]); INC(i) UNTIL i = len;
|
||||
buf[i] := 0X;
|
||||
Integers.ConvertFromString(buf^, x)
|
||||
END Read;
|
||||
|
||||
PROCEDURE Write(w: TextModels.Writer; x: Integers.Integer);
|
||||
VAR i: INTEGER;
|
||||
BEGIN
|
||||
IF Integers.Sign(x) < 0 THEN w.WriteChar("-") END;
|
||||
i := Integers.Digits10Of(x);
|
||||
IF i # 0 THEN
|
||||
REPEAT DEC(i); w.WriteChar(Integers.ThisDigit10(x, i)) UNTIL i = 0
|
||||
ELSE w.WriteChar("0")
|
||||
END
|
||||
END Write;
|
||||
|
||||
PROCEDURE Compute*;
|
||||
VAR beg, end, i, n: INTEGER; ch: CHAR;
|
||||
s: Stores.Operation;
|
||||
r: TextModels.Reader; w: TextModels.Writer; attr: TextModels.Attributes;
|
||||
c: TextControllers.Controller;
|
||||
x: Integers.Integer;
|
||||
BEGIN
|
||||
c := TextControllers.Focus();
|
||||
IF (c # NIL) & c.HasSelection() THEN
|
||||
c.GetSelection(beg, end);
|
||||
r := c.text.NewReader(NIL); r.SetPos(beg); r.ReadChar(ch);
|
||||
WHILE ~r.eot & (beg < end) & (ch <= " ") DO r.ReadChar(ch); INC(beg) END;
|
||||
IF ~r.eot & (beg < end) THEN
|
||||
r.ReadPrev; Read(r, x);
|
||||
end := r.Pos(); r.ReadPrev; attr :=r.attr;
|
||||
IF (Integers.Sign(x) > 0) & (Integers.Compare(x, Integers.Long(MAX(LONGINT))) <= 0) THEN
|
||||
n := SHORT(Integers.Short(x)); i := 2; x := Integers.Long(1);
|
||||
WHILE i <= n DO x := Integers.Product(x, Integers.Long(i)); INC(i) END;
|
||||
Models.BeginScript(c.text, "computation", s);
|
||||
c.text.Delete(beg, end);
|
||||
w := c.text.NewWriter(NIL); w.SetPos(beg); w.SetAttr(attr);
|
||||
Write(w, x);
|
||||
Models.EndScript(c.text, s)
|
||||
END
|
||||
END
|
||||
END
|
||||
END Compute;
|
||||
|
||||
END ObxFact.
|
||||
1
samples/STON/Array.ston
Normal file
1
samples/STON/Array.ston
Normal file
@@ -0,0 +1 @@
|
||||
[1, 2, 3]
|
||||
1
samples/STON/Dictionary.ston
Normal file
1
samples/STON/Dictionary.ston
Normal file
@@ -0,0 +1 @@
|
||||
{#a : 1, #b : 2}
|
||||
4
samples/STON/Rectangle.ston
Normal file
4
samples/STON/Rectangle.ston
Normal file
@@ -0,0 +1,4 @@
|
||||
Rectangle {
|
||||
#origin : Point [ -40, -15 ],
|
||||
#corner : Point [ 60, 35 ]
|
||||
}
|
||||
15
samples/STON/TestDomainObject.ston
Normal file
15
samples/STON/TestDomainObject.ston
Normal file
@@ -0,0 +1,15 @@
|
||||
TestDomainObject {
|
||||
#created : DateAndTime [ '2012-02-14T16:40:15+01:00' ],
|
||||
#modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ],
|
||||
#integer : 39581,
|
||||
#float : 73.84789359463944,
|
||||
#description : 'This is a test',
|
||||
#color : #green,
|
||||
#tags : [
|
||||
#two,
|
||||
#beta,
|
||||
#medium
|
||||
],
|
||||
#bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ],
|
||||
#boolean : false
|
||||
}
|
||||
30
samples/STON/ZNResponse.ston
Normal file
30
samples/STON/ZNResponse.ston
Normal file
@@ -0,0 +1,30 @@
|
||||
ZnResponse {
|
||||
#headers : ZnHeaders {
|
||||
#headers : ZnMultiValueDictionary {
|
||||
'Date' : 'Fri, 04 May 2012 20:09:23 GMT',
|
||||
'Modification-Date' : 'Thu, 10 Feb 2011 08:32:30 GMT',
|
||||
'Content-Length' : '113',
|
||||
'Server' : 'Zinc HTTP Components 1.0',
|
||||
'Vary' : 'Accept-Encoding',
|
||||
'Connection' : 'close',
|
||||
'Content-Type' : 'text/html;charset=utf-8'
|
||||
}
|
||||
},
|
||||
#entity : ZnStringEntity {
|
||||
#contentType : ZnMimeType {
|
||||
#main : 'text',
|
||||
#sub : 'html',
|
||||
#parameters : {
|
||||
'charset' : 'utf-8'
|
||||
}
|
||||
},
|
||||
#contentLength : 113,
|
||||
#string : '<html>\n<head><title>Small</title></head>\n<body><h1>Small</h1><p>This is a small HTML document</p></body>\n</html>\n',
|
||||
#encoder : ZnUTF8Encoder { }
|
||||
},
|
||||
#statusLine : ZnStatusLine {
|
||||
#version : 'HTTP/1.1',
|
||||
#code : 200,
|
||||
#reason : 'OK'
|
||||
}
|
||||
}
|
||||
24
samples/STON/methodProperties.ston
Normal file
24
samples/STON/methodProperties.ston
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"class" : {
|
||||
},
|
||||
"instance" : {
|
||||
"clientList:listElement:" : "dkh 03/20/2014 16:27",
|
||||
"copyObjectMenuAction:selectionIndex:" : "dkh 10/13/2013 10:20",
|
||||
"definitionForSelection:" : "dkh 10/13/2013 10:15",
|
||||
"editMenuActionSpec" : "dkh 10/13/2013 10:19",
|
||||
"itemSelected:listElement:selectedIndex:shiftPressed:" : "dkh 10/20/2013 11:06",
|
||||
"menuActionSpec:" : "dkh 10/19/2013 17:12",
|
||||
"repository:" : "dkh 10/19/2013 17:36",
|
||||
"theList" : "dkh 10/12/2013 15:51",
|
||||
"versionInfoBlock:" : "dkh 10/19/2013 17:08",
|
||||
"versionInfoDiffVsSelection:selectedIndex:" : "dkh 10/19/2013 17:48",
|
||||
"versionInfoDiffVsWorkingCopy:selectedIndex:" : "dkh 10/20/2013 12:36",
|
||||
"versionInfoSelect:selectedIndex:" : "dkh 10/12/2013 17:04",
|
||||
"versionInfos" : "dkh 10/19/2013 17:13",
|
||||
"versionSummaryIsClosing" : "dkh 10/20/2013 10:19",
|
||||
"windowIsClosing:" : "dkh 10/20/2013 10:39",
|
||||
"windowLabel" : "dkh 05/20/2014 11:00",
|
||||
"windowLocation" : "dkh 05/23/2014 10:17",
|
||||
"windowName" : "dkh 10/12/2013 16:00",
|
||||
"workingCopy" : "dkh 10/12/2013 16:16",
|
||||
"workingCopy:" : "dkh 10/12/2013 16:17" } }
|
||||
19
samples/STON/properties.ston
Normal file
19
samples/STON/properties.ston
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"category" : "Topez-Server-Core",
|
||||
"classinstvars" : [
|
||||
],
|
||||
"classvars" : [
|
||||
],
|
||||
"commentStamp" : "",
|
||||
"instvars" : [
|
||||
"workingCopy",
|
||||
"repository",
|
||||
"versionInfos",
|
||||
"versionInfoBlock",
|
||||
"selectedVersionInfo",
|
||||
"versionInfoSummaryWindowId" ],
|
||||
"name" : "TDVersionInfoBrowser",
|
||||
"pools" : [
|
||||
],
|
||||
"super" : "TDAbstractMonticelloToolBuilder",
|
||||
"type" : "normal" }
|
||||
75
samples/Standard ML/Foo.ML
Normal file
75
samples/Standard ML/Foo.ML
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
structure LazyBase:> LAZY_BASE =
|
||||
struct
|
||||
type 'a lazy = unit -> 'a
|
||||
|
||||
exception Undefined
|
||||
|
||||
fun delay f = f
|
||||
|
||||
fun force f = f()
|
||||
|
||||
val undefined = fn () => raise Undefined
|
||||
end
|
||||
|
||||
structure LazyMemoBase:> LAZY_BASE =
|
||||
struct
|
||||
|
||||
datatype 'a susp = NotYet of unit -> 'a
|
||||
| Done of 'a
|
||||
|
||||
type 'a lazy = unit -> 'a susp ref
|
||||
|
||||
exception Undefined
|
||||
|
||||
fun delay f =
|
||||
let
|
||||
val r = ref (NotYet f)
|
||||
in
|
||||
fn () => r
|
||||
end
|
||||
|
||||
fun force f =
|
||||
case f() of
|
||||
ref (Done x) => x
|
||||
| r as ref (NotYet f') =>
|
||||
let
|
||||
val a = f'()
|
||||
in
|
||||
r := Done a
|
||||
; a
|
||||
end
|
||||
|
||||
val undefined = fn () => raise Undefined
|
||||
end
|
||||
|
||||
functor LazyFn(B: LAZY_BASE): LAZY' =
|
||||
struct
|
||||
|
||||
open B
|
||||
|
||||
fun inject x = delay (fn () => x)
|
||||
|
||||
fun isUndefined x =
|
||||
(ignore (force x)
|
||||
; false)
|
||||
handle Undefined => true
|
||||
|
||||
fun toString f x = if isUndefined x then "_|_" else f (force x)
|
||||
|
||||
fun eqBy p (x,y) = p(force x,force y)
|
||||
fun eq (x,y) = eqBy op= (x,y)
|
||||
fun compare p (x,y) = p(force x,force y)
|
||||
|
||||
structure Ops =
|
||||
struct
|
||||
val ! = force
|
||||
val ? = inject
|
||||
end
|
||||
|
||||
fun map f x = delay (fn () => f (force x))
|
||||
|
||||
end
|
||||
|
||||
structure Lazy' = LazyFn(LazyBase)
|
||||
structure LazyMemo = LazyFn(LazyMemoBase)
|
||||
43
samples/Text/ISO-2022-KR.txt
Normal file
43
samples/Text/ISO-2022-KR.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
$)C#
|
||||
# Out-AnsiGraph.psm1
|
||||
# Author: xcud
|
||||
# History:
|
||||
# v0.1 September 21, 2009 initial version
|
||||
#
|
||||
# PS Example> ps | select -first 5 | sort -property VM |
|
||||
# Out-AnsiGraph ProcessName, VM
|
||||
# AEADISRV 14508032
|
||||
# audiodg 50757632
|
||||
# conhost 73740288
|
||||
# AppleMobileDeviceService 92061696
|
||||
# btdna 126443520
|
||||
#
|
||||
function Out-AnsiGraph($Parameter1=$null) {
|
||||
BEGIN {
|
||||
$q = new-object Collections.queue
|
||||
$max = 0; $namewidth = 0;
|
||||
}
|
||||
|
||||
PROCESS {
|
||||
if($_) {
|
||||
$name = $_.($Parameter1[0]);
|
||||
$val = $_.($Parameter1[1])
|
||||
if($max -lt $val) { $max = $val}
|
||||
if($namewidth -lt $name.length) {
|
||||
$namewidth = $name.length }
|
||||
$q.enqueue(@($name, $val))
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
$q | %{
|
||||
$graph = ""; 0..($_[1]/$max*20) |
|
||||
%{ $graph += "" }
|
||||
$name = "{0,$namewidth}" -f $_[0]
|
||||
"$name $graph " + $_[1]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember Out-AnsiGraph
|
||||
703
samples/Text/Visual_Battlers.rb
Normal file
703
samples/Text/Visual_Battlers.rb
Normal file
@@ -0,0 +1,703 @@
|
||||
#==============================================================================
|
||||
#
|
||||
# <20><> Yanfly Engine Ace - Visual Battlers v1.01
|
||||
# -- Last Updated: 2012.07.24
|
||||
# -- Level: Easy
|
||||
# -- Requires: n/a
|
||||
#
|
||||
# <20><> Modified by:
|
||||
# -- Yami
|
||||
# -- Kread-Ex
|
||||
# -- Archeia_Nessiah
|
||||
#==============================================================================
|
||||
|
||||
$imported = {} if $imported.nil?
|
||||
$imported["YEA-VisualBattlers"] = true
|
||||
|
||||
#==============================================================================
|
||||
# <20><> Updates
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# 2012.12.18 - Added preset views and able to change direction in-game.
|
||||
# 2012.07.24 - Finished Script.
|
||||
# 2012.01.05 - Started Script.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Introduction
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# This script provides a visual for all actors by default charsets. The actions
|
||||
# and movements are alike Final Fantasy 1, only move forward and backward when
|
||||
# start and finish actions.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Instructions
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# To change the player direction in-game, use the snippet below in a script
|
||||
# call:
|
||||
#
|
||||
# $game_system.party_direction = n
|
||||
#
|
||||
# To install this script, open up your script editor and copy/paste this script
|
||||
# to an open slot below <20><> Materials but above <20><> Main. Remember to save.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Compatibility
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
|
||||
# it will run with RPG Maker VX without adjusting.
|
||||
#
|
||||
#==============================================================================
|
||||
|
||||
module YEA
|
||||
module VISUAL_BATTLERS
|
||||
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
# - Party Location Setting -
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
# These settings are adjusted for Party Location. Each Actor will have
|
||||
# coordinates calculated by below formula. There are two samples coordinates
|
||||
# below, change PARTY_DIRECTION to the base index you want to use.
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
PARTY_DIRECTION = 6 # This direction is opposite from actual direction.
|
||||
|
||||
PARTY_LOCATION_BASE_COORDINATES ={
|
||||
# Index => [base_x, base_y, mod_x, mod_y],
|
||||
2 => [ 250, 290, 40, 0], #UP
|
||||
4 => [ 150, 280, 20, -20], #LEFT
|
||||
3 => [ 460, 280, 30, -10], #RIGHT
|
||||
6 => [ 460, 230, 20, 20], #DEFAULT RIGHT
|
||||
8 => [ 260, 230, 40, 0], #DOWN
|
||||
} # Do not remove this.
|
||||
|
||||
PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x"
|
||||
PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y"
|
||||
|
||||
end # VISUAL_BATTLERS
|
||||
end # YEA
|
||||
|
||||
#==============================================================================
|
||||
# <20><> Editting anything past this point may potentially result in causing
|
||||
# computer damage, incontinence, explosion of user's head, coma, death, and/or
|
||||
# halitosis so edit at your own risk.
|
||||
#==============================================================================
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Direction
|
||||
#==============================================================================
|
||||
|
||||
module Direction
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# self.correct
|
||||
#--------------------------------------------------------------------------
|
||||
def self.correct(direction)
|
||||
case direction
|
||||
when 1; return 4
|
||||
when 3; return 6
|
||||
when 7; return 4
|
||||
when 9; return 6
|
||||
else; return direction
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# self.opposite
|
||||
#--------------------------------------------------------------------------
|
||||
def self.opposite(direction)
|
||||
case direction
|
||||
when 1; return 6
|
||||
when 2; return 8
|
||||
when 3; return 4
|
||||
when 4; return 6
|
||||
when 6; return 4
|
||||
when 7; return 6
|
||||
when 8; return 2
|
||||
when 9; return 4
|
||||
else; return direction
|
||||
end
|
||||
end
|
||||
|
||||
end # Direction
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_System
|
||||
#==============================================================================
|
||||
|
||||
class Game_System; attr_accessor :party_direction; end
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_BattleCharacter
|
||||
#==============================================================================
|
||||
|
||||
class Game_BattleCharacter < Game_Character
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# initialize
|
||||
#--------------------------------------------------------------------------
|
||||
def initialize(actor)
|
||||
super()
|
||||
setup_actor(actor)
|
||||
@move_x_rate = 0
|
||||
@move_y_rate = 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# setup_actor
|
||||
#--------------------------------------------------------------------------
|
||||
def setup_actor(actor)
|
||||
@actor = actor
|
||||
@step_anime = true
|
||||
set_graphic(@actor.character_name, @actor.character_index)
|
||||
setup_coordinates
|
||||
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
|
||||
direction = Direction.opposite(dr)
|
||||
set_direction(Direction.correct(direction))
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# sprite=
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite=(sprite)
|
||||
@sprite = sprite
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# setup_coordinates
|
||||
#--------------------------------------------------------------------------
|
||||
def setup_coordinates
|
||||
location = ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0]
|
||||
base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1]
|
||||
mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2]
|
||||
mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3]
|
||||
@actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X)
|
||||
@actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y)
|
||||
@actor.origin_x = @actor.screen_x
|
||||
@actor.origin_y = @actor.screen_y
|
||||
@actor.create_move_to(screen_x, screen_y, 1)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# index
|
||||
#--------------------------------------------------------------------------
|
||||
def index
|
||||
return @actor.index
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_x
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_x
|
||||
return @actor.screen_x
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_y
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_y
|
||||
return @actor.screen_y
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_z
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_z
|
||||
return @actor.screen_z
|
||||
end
|
||||
|
||||
end # Game_BattleCharacter
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Battler
|
||||
#==============================================================================
|
||||
|
||||
class Game_Battler < Game_BattlerBase
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance variables
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :moved_back
|
||||
attr_accessor :origin_x
|
||||
attr_accessor :origin_y
|
||||
attr_accessor :screen_x
|
||||
attr_accessor :screen_y
|
||||
attr_accessor :started_turn
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: execute_damage
|
||||
#--------------------------------------------------------------------------
|
||||
alias game_battler_execute_damage_vb execute_damage
|
||||
def execute_damage(user)
|
||||
game_battler_execute_damage_vb(user)
|
||||
if @result.hp_damage > 0
|
||||
move_backward(24, 6) unless @moved_back
|
||||
@moved_back = true
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# face_opposing_party
|
||||
#--------------------------------------------------------------------------
|
||||
def face_opposing_party
|
||||
direction = ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: face_coordinate
|
||||
#--------------------------------------------------------------------------
|
||||
def face_coordinate(destination_x, destination_y)
|
||||
x1 = Integer(@screen_x)
|
||||
x2 = Integer(destination_x)
|
||||
y1 = Graphics.height - Integer(@screen_y)
|
||||
y2 = Graphics.height - Integer(destination_y)
|
||||
return if x1 == x2 and y1 == y2
|
||||
#---
|
||||
angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI)
|
||||
if (0..225) === angle or (-225..0) === angle
|
||||
direction = 6
|
||||
elsif (226..675) === angle
|
||||
direction = 9
|
||||
elsif (676..1125) === angle
|
||||
direction = 8
|
||||
elsif (1126..1575) === angle
|
||||
direction = 7
|
||||
elsif (1576..1800) === angle or (-1800..-1576) === angle
|
||||
direction = 4
|
||||
elsif (-1575..-1126) === angle
|
||||
direction = 1
|
||||
elsif (-1125..-676) === angle
|
||||
direction = 2
|
||||
elsif (-675..-226) === angle
|
||||
direction = 3
|
||||
end
|
||||
#---
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# create_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def create_move_to(destination_x, destination_y, frames = 12)
|
||||
@destination_x = destination_x
|
||||
@destination_y = destination_y
|
||||
frames = [frames, 1].max
|
||||
@move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max
|
||||
@move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# update_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def update_move_to
|
||||
@move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
|
||||
@move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
|
||||
value = [(@screen_x - @destination_x).abs, @move_x_rate].min
|
||||
@screen_x += (@destination_x > @screen_x) ? value : -value
|
||||
value = [(@screen_y - @destination_y).abs, @move_y_rate].min
|
||||
@screen_y += (@destination_y > @screen_y) ? value : -value
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_forward
|
||||
#--------------------------------------------------------------------------
|
||||
def move_forward(distance = 24, frames = 12)
|
||||
direction = forward_direction
|
||||
move_direction(direction, distance, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_backward
|
||||
#--------------------------------------------------------------------------
|
||||
def move_backward(distance = 24, frames = 12)
|
||||
direction = Direction.opposite(forward_direction)
|
||||
move_direction(direction, distance, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def move_direction(direction, distance = 24, frames = 12)
|
||||
case direction
|
||||
when 1; move_x = distance / -2; move_y = distance / 2
|
||||
when 2; move_x = distance * 0; move_y = distance * 1
|
||||
when 3; move_x = distance / -2; move_y = distance / 2
|
||||
when 4; move_x = distance * -1; move_y = distance * 0
|
||||
when 6; move_x = distance * 1; move_y = distance * 0
|
||||
when 7; move_x = distance / -2; move_y = distance / -2
|
||||
when 8; move_x = distance * 0; move_y = distance * -1
|
||||
when 9; move_x = distance / 2; move_y = distance / -2
|
||||
else; return
|
||||
end
|
||||
destination_x = @screen_x + move_x
|
||||
destination_y = @screen_y + move_y
|
||||
create_move_to(destination_x, destination_y, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# forward_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def forward_direction
|
||||
return ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def move_origin
|
||||
create_move_to(@origin_x, @origin_y)
|
||||
face_coordinate(@origin_x, @origin_y)
|
||||
@moved_back = false
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return false if dead? || !exist?
|
||||
return @move_x_rate != 0 || @move_y_rate != 0
|
||||
end
|
||||
|
||||
end # Game_Battler
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Actor
|
||||
#==============================================================================
|
||||
|
||||
class Game_Actor < Game_Battler
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# overwrite method: use_sprite?
|
||||
#--------------------------------------------------------------------------
|
||||
def use_sprite?
|
||||
return true
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_x
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_x
|
||||
return @screen_x rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_y
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_y
|
||||
return @screen_y rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_z
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_z
|
||||
return 100
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite
|
||||
index = $game_party.battle_members.index(self)
|
||||
return SceneManager.scene.spriteset.actor_sprites[index]
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: character
|
||||
#--------------------------------------------------------------------------
|
||||
def character
|
||||
return sprite.character_base
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# face_opposing_party
|
||||
#--------------------------------------------------------------------------
|
||||
def face_opposing_party
|
||||
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
|
||||
direction = Direction.opposite(dr)
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# forward_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def forward_direction
|
||||
return Direction.opposite(($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION))
|
||||
end
|
||||
|
||||
end # Game_Actor
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Enemy
|
||||
#==============================================================================
|
||||
|
||||
class Game_Enemy < Game_Battler
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite
|
||||
return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: character
|
||||
#--------------------------------------------------------------------------
|
||||
def character
|
||||
return sprite
|
||||
end
|
||||
|
||||
end # Game_Enemy
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Troop
|
||||
#==============================================================================
|
||||
|
||||
class Game_Troop < Game_Unit
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: setup
|
||||
#--------------------------------------------------------------------------
|
||||
alias game_troop_setup_vb setup
|
||||
def setup(troop_id)
|
||||
game_troop_setup_vb(troop_id)
|
||||
set_coordinates
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: set_coordinates
|
||||
#--------------------------------------------------------------------------
|
||||
def set_coordinates
|
||||
for member in members
|
||||
member.origin_x = member.screen_x
|
||||
member.origin_y = member.screen_y
|
||||
member.create_move_to(member.screen_x, member.screen_y, 1)
|
||||
end
|
||||
end
|
||||
|
||||
end # Game_Troop
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Sprite_Battler
|
||||
#==============================================================================
|
||||
|
||||
class Sprite_Battler < Sprite_Base
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance_variable
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :character_base
|
||||
attr_accessor :character_sprite
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: dispose
|
||||
#--------------------------------------------------------------------------
|
||||
alias sprite_battler_dispose_vb dispose
|
||||
def dispose
|
||||
dispose_character_sprite
|
||||
sprite_battler_dispose_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: dispose_character_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def dispose_character_sprite
|
||||
@character_sprite.dispose unless @character_sprite.nil?
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: update
|
||||
#--------------------------------------------------------------------------
|
||||
alias sprite_battler_update_vb update
|
||||
def update
|
||||
sprite_battler_update_vb
|
||||
return if @battler.nil?
|
||||
update_move_to
|
||||
update_character_base
|
||||
update_character_sprite
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_character_base
|
||||
#--------------------------------------------------------------------------
|
||||
def update_character_base
|
||||
return if @character_base.nil?
|
||||
@character_base.update
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_character_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def update_character_sprite
|
||||
return if @character_sprite.nil?
|
||||
@character_sprite.update
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def update_move_to
|
||||
@battler.update_move_to
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return false if @battler.nil?
|
||||
return @battler.moving?
|
||||
end
|
||||
|
||||
end # Sprite_Battler
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Sprite_BattleCharacter
|
||||
#==============================================================================
|
||||
|
||||
class Sprite_BattleCharacter < Sprite_Character
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# initialize
|
||||
#--------------------------------------------------------------------------
|
||||
def initialize(viewport, character = nil)
|
||||
super(viewport, character)
|
||||
character.sprite = self
|
||||
end
|
||||
|
||||
end # Sprite_BattleCharacter
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Spriteset_Battle
|
||||
#==============================================================================
|
||||
|
||||
class Spriteset_Battle
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance_variable
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :actor_sprites
|
||||
attr_accessor :enemy_sprites
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# overwrite method: create_actors
|
||||
#--------------------------------------------------------------------------
|
||||
def create_actors
|
||||
total = $game_party.max_battle_members
|
||||
@current_party = $game_party.battle_members.clone
|
||||
@actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
|
||||
for actor in $game_party.battle_members
|
||||
@actor_sprites[actor.index].battler = actor
|
||||
create_actor_sprite(actor)
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: create_actor_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def create_actor_sprite(actor)
|
||||
character = Game_BattleCharacter.new(actor)
|
||||
character_sprite = Sprite_BattleCharacter.new(@viewport1, character)
|
||||
@actor_sprites[actor.index].character_base = character
|
||||
@actor_sprites[actor.index].character_sprite = character_sprite
|
||||
actor.face_opposing_party
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: update_actors
|
||||
#--------------------------------------------------------------------------
|
||||
alias spriteset_battle_update_actors_vb update_actors
|
||||
def update_actors
|
||||
if @current_party != $game_party.battle_members
|
||||
dispose_actors
|
||||
create_actors
|
||||
end
|
||||
spriteset_battle_update_actors_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return battler_sprites.any? {|sprite| sprite.moving? }
|
||||
end
|
||||
|
||||
end # Spriteset_Battle
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Scene_Battle
|
||||
#==============================================================================
|
||||
|
||||
class Scene_Battle < Scene_Base
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance variables
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :spriteset
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: process_action_end
|
||||
#--------------------------------------------------------------------------
|
||||
alias scene_battle_process_action_end_vb process_action_end
|
||||
def process_action_end
|
||||
start_battler_move_origin
|
||||
scene_battle_process_action_end_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: execute_action
|
||||
#--------------------------------------------------------------------------
|
||||
alias scene_battle_execute_action_vb execute_action
|
||||
def execute_action
|
||||
start_battler_move_forward
|
||||
scene_battle_execute_action_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: start_battler_move_forward
|
||||
#--------------------------------------------------------------------------
|
||||
def start_battler_move_forward
|
||||
return if @subject.started_turn
|
||||
@subject.started_turn = true
|
||||
@subject.move_forward
|
||||
wait_for_moving
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: start_battler_move_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def start_battler_move_origin
|
||||
@subject.started_turn = nil
|
||||
move_battlers_origin
|
||||
wait_for_moving
|
||||
@subject.face_opposing_party rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: move_battlers_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def move_battlers_origin
|
||||
for member in all_battle_members
|
||||
next if member.dead?
|
||||
next unless member.exist?
|
||||
member.move_origin
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: wait_for_moving
|
||||
#--------------------------------------------------------------------------
|
||||
def wait_for_moving
|
||||
update_for_wait
|
||||
update_for_wait while @spriteset.moving?
|
||||
end
|
||||
|
||||
end # Scene_Battle
|
||||
|
||||
#==============================================================================
|
||||
#
|
||||
# <20><> End of File
|
||||
#
|
||||
#==============================================================================
|
||||
1
samples/Text/iso8859-8-i.txt
Normal file
1
samples/Text/iso8859-8-i.txt
Normal file
@@ -0,0 +1 @@
|
||||
%<25><><EFBFBD>
|
||||
152
samples/VCL/varnish2_default.vcl
Normal file
152
samples/VCL/varnish2_default.vcl
Normal file
@@ -0,0 +1,152 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Verdens Gang AS
|
||||
* Copyright (c) 2006-2008 Linpro AS
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* The default VCL code.
|
||||
*
|
||||
* NB! You do NOT need to copy & paste all of these functions into your
|
||||
* own vcl code, if you do not provide a definition of one of these
|
||||
* functions, the compiler will automatically fall back to the default
|
||||
* code from this file.
|
||||
*
|
||||
* This code will be prefixed with a backend declaration built from the
|
||||
* -b argument.
|
||||
*/
|
||||
|
||||
sub vcl_recv {
|
||||
if (req.request != "GET" &&
|
||||
req.request != "HEAD" &&
|
||||
req.request != "PUT" &&
|
||||
req.request != "POST" &&
|
||||
req.request != "TRACE" &&
|
||||
req.request != "OPTIONS" &&
|
||||
req.request != "DELETE") {
|
||||
/* Non-RFC2616 or CONNECT which is weird. */
|
||||
return (pipe);
|
||||
}
|
||||
if (req.request != "GET" && req.request != "HEAD") {
|
||||
/* We only deal with GET and HEAD by default */
|
||||
return (pass);
|
||||
}
|
||||
if (req.http.Authorization || req.http.Cookie) {
|
||||
/* Not cacheable by default */
|
||||
return (pass);
|
||||
}
|
||||
return (lookup);
|
||||
}
|
||||
|
||||
sub vcl_pipe {
|
||||
# Note that only the first request to the backend will have
|
||||
# X-Forwarded-For set. If you use X-Forwarded-For and want to
|
||||
# have it set for all requests, make sure to have:
|
||||
# set req.http.connection = "close";
|
||||
# here. It is not set by default as it might break some broken web
|
||||
# applications, like IIS with NTLM authentication.
|
||||
return (pipe);
|
||||
}
|
||||
|
||||
sub vcl_pass {
|
||||
return (pass);
|
||||
}
|
||||
|
||||
sub vcl_hash {
|
||||
set req.hash += req.url;
|
||||
if (req.http.host) {
|
||||
set req.hash += req.http.host;
|
||||
} else {
|
||||
set req.hash += server.ip;
|
||||
}
|
||||
return (hash);
|
||||
}
|
||||
|
||||
sub vcl_hit {
|
||||
if (!obj.cacheable) {
|
||||
return (pass);
|
||||
}
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_miss {
|
||||
return (fetch);
|
||||
}
|
||||
|
||||
sub vcl_fetch {
|
||||
if (!obj.cacheable) {
|
||||
return (pass);
|
||||
}
|
||||
if (obj.http.Set-Cookie) {
|
||||
return (pass);
|
||||
}
|
||||
set obj.prefetch = -30s;
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_deliver {
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_discard {
|
||||
/* XXX: Do not redefine vcl_discard{}, it is not yet supported */
|
||||
return (discard);
|
||||
}
|
||||
|
||||
sub vcl_prefetch {
|
||||
/* XXX: Do not redefine vcl_prefetch{}, it is not yet supported */
|
||||
return (fetch);
|
||||
}
|
||||
|
||||
sub vcl_timeout {
|
||||
/* XXX: Do not redefine vcl_timeout{}, it is not yet supported */
|
||||
return (discard);
|
||||
}
|
||||
|
||||
sub vcl_error {
|
||||
set obj.http.Content-Type = "text/html; charset=utf-8";
|
||||
synthetic {"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>"} obj.status " " obj.response {"</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error "} obj.status " " obj.response {"</h1>
|
||||
<p>"} obj.response {"</p>
|
||||
<h3>Guru Meditation:</h3>
|
||||
<p>XID: "} req.xid {"</p>
|
||||
<hr>
|
||||
<address>
|
||||
<a href="http://www.varnish-cache.org/">Varnish cache server</a>
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
"};
|
||||
return (deliver);
|
||||
}
|
||||
149
samples/VCL/varnish3_default.vcl
Normal file
149
samples/VCL/varnish3_default.vcl
Normal file
@@ -0,0 +1,149 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Verdens Gang AS
|
||||
* Copyright (c) 2006-2011 Varnish Software AS
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The default VCL code.
|
||||
*
|
||||
* NB! You do NOT need to copy & paste all of these functions into your
|
||||
* own vcl code, if you do not provide a definition of one of these
|
||||
* functions, the compiler will automatically fall back to the default
|
||||
* code from this file.
|
||||
*
|
||||
* This code will be prefixed with a backend declaration built from the
|
||||
* -b argument.
|
||||
*/
|
||||
|
||||
sub vcl_recv {
|
||||
if (req.restarts == 0) {
|
||||
if (req.http.x-forwarded-for) {
|
||||
set req.http.X-Forwarded-For =
|
||||
req.http.X-Forwarded-For + ", " + client.ip;
|
||||
} else {
|
||||
set req.http.X-Forwarded-For = client.ip;
|
||||
}
|
||||
}
|
||||
if (req.request != "GET" &&
|
||||
req.request != "HEAD" &&
|
||||
req.request != "PUT" &&
|
||||
req.request != "POST" &&
|
||||
req.request != "TRACE" &&
|
||||
req.request != "OPTIONS" &&
|
||||
req.request != "DELETE") {
|
||||
/* Non-RFC2616 or CONNECT which is weird. */
|
||||
return (pipe);
|
||||
}
|
||||
if (req.request != "GET" && req.request != "HEAD") {
|
||||
/* We only deal with GET and HEAD by default */
|
||||
return (pass);
|
||||
}
|
||||
if (req.http.Authorization || req.http.Cookie) {
|
||||
/* Not cacheable by default */
|
||||
return (pass);
|
||||
}
|
||||
return (lookup);
|
||||
}
|
||||
|
||||
sub vcl_pipe {
|
||||
# Note that only the first request to the backend will have
|
||||
# X-Forwarded-For set. If you use X-Forwarded-For and want to
|
||||
# have it set for all requests, make sure to have:
|
||||
# set bereq.http.connection = "close";
|
||||
# here. It is not set by default as it might break some broken web
|
||||
# applications, like IIS with NTLM authentication.
|
||||
return (pipe);
|
||||
}
|
||||
|
||||
sub vcl_pass {
|
||||
return (pass);
|
||||
}
|
||||
|
||||
sub vcl_hash {
|
||||
hash_data(req.url);
|
||||
if (req.http.host) {
|
||||
hash_data(req.http.host);
|
||||
} else {
|
||||
hash_data(server.ip);
|
||||
}
|
||||
return (hash);
|
||||
}
|
||||
|
||||
sub vcl_hit {
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_miss {
|
||||
return (fetch);
|
||||
}
|
||||
|
||||
sub vcl_fetch {
|
||||
if (beresp.ttl <= 0s ||
|
||||
beresp.http.Set-Cookie ||
|
||||
beresp.http.Vary == "*") {
|
||||
/*
|
||||
* Mark as "Hit-For-Pass" for the next 2 minutes
|
||||
*/
|
||||
set beresp.ttl = 120 s;
|
||||
return (hit_for_pass);
|
||||
}
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_deliver {
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_error {
|
||||
set obj.http.Content-Type = "text/html; charset=utf-8";
|
||||
set obj.http.Retry-After = "5";
|
||||
synthetic {"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>"} + obj.status + " " + obj.response + {"</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error "} + obj.status + " " + obj.response + {"</h1>
|
||||
<p>"} + obj.response + {"</p>
|
||||
<h3>Guru Meditation:</h3>
|
||||
<p>XID: "} + req.xid + {"</p>
|
||||
<hr>
|
||||
<p>Varnish cache server</p>
|
||||
</body>
|
||||
</html>
|
||||
"};
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_init {
|
||||
return (ok);
|
||||
}
|
||||
|
||||
sub vcl_fini {
|
||||
return (ok);
|
||||
}
|
||||
21
samples/Zimpl/sample.zmpl
Normal file
21
samples/Zimpl/sample.zmpl
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: queens3.zpl,v 1.3 2009/09/13 16:15:53 bzfkocht Exp $
|
||||
#
|
||||
# This is a formulation of the n queens problem using binary variables.
|
||||
# variables. Since the number of queens is maximized, the size of the
|
||||
# board can be set arbitrarily.
|
||||
#
|
||||
param columns := 8;
|
||||
|
||||
set I := { 1 .. columns };
|
||||
set IxI := I * I;
|
||||
|
||||
set TABU[<i,j> in IxI] := { <m,n> in IxI with
|
||||
(m != i or n != j) and (m == i or n == j or abs(m - i) == abs(n - j)) };
|
||||
|
||||
var x[IxI] binary;
|
||||
|
||||
maximize queens: sum <i,j> in IxI : x[i,j];
|
||||
|
||||
subto c1: forall <i,j> in IxI do
|
||||
card(TABU[i,j]) - card(TABU[i,j]) * x[i,j] >= sum <m,n> in TABU[i,j] : x[m,n];
|
||||
|
||||
@@ -97,15 +97,26 @@ class TestBlob < Test::Unit::TestCase
|
||||
def test_sloc
|
||||
assert_equal 2, blob("Ruby/foo.rb").sloc
|
||||
assert_equal 3, blob("Text/utf16le-windows.txt").sloc
|
||||
assert_equal 1, blob("Text/iso8859-8-i.txt").sloc
|
||||
end
|
||||
|
||||
def test_encoding
|
||||
assert_equal "ISO-8859-2", blob("Text/README").encoding
|
||||
assert_equal "ISO-8859-2", blob("Text/README").ruby_encoding
|
||||
assert_equal "ISO-8859-1", blob("Text/dump.sql").encoding
|
||||
assert_equal "ISO-8859-1", blob("Text/dump.sql").ruby_encoding
|
||||
assert_equal "UTF-8", blob("Text/foo.txt").encoding
|
||||
assert_equal "UTF-8", blob("Text/foo.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le.txt").encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").ruby_encoding
|
||||
assert_equal "ISO-2022-KR", blob("Text/ISO-2022-KR.txt").encoding
|
||||
assert_equal "binary", blob("Text/ISO-2022-KR.txt").ruby_encoding
|
||||
assert_nil blob("Binary/dog.o").encoding
|
||||
|
||||
assert_equal "windows-1252", blob("Text/Visual_Battlers.rb").encoding
|
||||
assert_equal "Windows-1252", blob("Text/Visual_Battlers.rb").ruby_encoding
|
||||
end
|
||||
|
||||
def test_binary
|
||||
@@ -364,6 +375,10 @@ class TestBlob < Test::Unit::TestCase
|
||||
# NuGet Packages
|
||||
assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
|
||||
|
||||
# Html5shiv
|
||||
assert blob("Scripts/html5shiv.js").vendored?
|
||||
assert blob("Scripts/html5shiv.min.js").vendored?
|
||||
|
||||
# Test fixtures
|
||||
assert blob("test/fixtures/random.rkt").vendored?
|
||||
assert blob("Test/fixtures/random.rkt").vendored?
|
||||
|
||||
Reference in New Issue
Block a user