Compare commits

...

46 Commits

Author SHA1 Message Date
Brian Lopez
81b7a412c3 Merge pull request #1270 from github/cut-release-v2.11.5
Bump version for 2.11.5 release
2014-06-10 15:28:27 -07:00
Brian Lopez
09b9a8b441 bump version for 2.11.5 release 2014-06-10 16:00:08 -05:00
Arfon Smith
701e720ab8 Merge pull request #1259 from github/bump-charlock-again
Bump charlock to 0.7.3
2014-06-09 11:10:30 -05:00
Arfon Smith
e709ce7d56 Samples 2014-06-09 06:27:26 -05:00
Arfon Smith
32c89a5405 Merge pull request #1260 from dalehenrich/patch-1
.ston extension for "Smalltalk Object Notation"
2014-06-09 06:26:34 -05:00
Dale Henrichs
1735982a73 Merge branch 'ston_test' of github.com:dalehenrich/linguist into ston_test 2014-06-08 21:21:56 -07:00
Dale Henrichs
625e0aa1af add sample files 2014-06-08 21:21:29 -07:00
Dale Henrichs
00e1a3f8fd ahhh, caps are sorted before lower case ... 2014-06-08 20:56:09 -07:00
Dale Henrichs
539256b08e send to travis 2014-06-08 20:49:45 -07:00
Dale Henrichs
ff791f5a39 "looks like I should have used JSON lexer
- let's see what travis has to say
2014-06-08 20:41:41 -07:00
Arfon Smith
304fc344a1 Merge pull request #1257 from simonwistow/master
Add support for the Varnish VCL edge scripting language
2014-06-08 21:46:32 -05:00
Dale Henrichs
9d940755e7 .ston extension for "Smalltalk Object Notation"
See https://github.com/svenvc/ston
2014-06-07 14:49:39 -07:00
Brian Lopez
bc04232f87 add the fixture 2014-06-07 15:32:29 -05:00
Brian Lopez
e17ebec098 Bump charlock to 0.7.3
This version includes a fix for the encoding lookup table for some
encoding aliases in the ICU detection API
2014-06-07 15:25:44 -05:00
Simon Wistow
7cd23036a7 Add support for the Varnish VCL edge scripting language 2014-06-06 12:59:50 -07:00
Arfon Smith
44c5413abf Merge pull request #1256 from github/1042-update
1042 update
2014-06-06 12:38:45 -05:00
Arfon Smith
50ab58e91f Merge commit 'refs/pull/1042/head' of github.com:github/linguist into 1042
Conflicts:
	lib/linguist/vendor.yml
2014-06-06 12:32:30 -05:00
Arfon Smith
1fd0732390 Merge branch 'master' into 1042
Conflicts:
	lib/linguist/vendor.yml
2014-06-06 12:31:56 -05:00
Arfon Smith
ed1b9ee899 Merge pull request #1255 from github/680-update
680 update
2014-06-06 12:12:09 -05:00
Arfon Smith
d3c04d6310 nesC 2014-06-06 12:08:38 -05:00
Julian Gehring
f66ffe305f Change R package ignores to absolute paths 2014-06-06 08:57:11 -07:00
Arfon Smith
2a9ff0083c Merge branch 'master' into 814
Conflicts:
	lib/linguist/languages.yml
2014-06-06 09:55:08 -05:00
Brian Lopez
c1cf7ea825 Merge pull request #1254 from github/cut-release-v2.11.4
v2.11.4 release
2014-06-05 10:03:43 -07:00
Brian Lopez
67f7268a55 bump version for v2.11.4 release 2014-06-05 10:55:32 -05:00
Brian Lopez
a55ee7eb09 Merge pull request #1253 from github/newer-charlock
Use the :ruby_encoding value from charlock 0.7.2
2014-06-05 08:51:46 -07:00
Brian Lopez
203f6d1944 forgot to add the test fixture 2014-06-04 17:15:33 -05:00
Brian Lopez
42c68f21d1 test ruby_encoding 2014-06-04 15:59:42 -05:00
Brian Lopez
7e8be1293e Use the :ruby_encoding value from charlock 0.7.2 2014-06-04 15:51:33 -05:00
Arfon Smith
09c234ec26 Merge pull request #1190 from Madsn/patch-1
Add html5shiv to vendor.yml
2014-06-04 10:30:03 -05:00
Arfon Smith
65a26c3e73 Merge pull request #1248 from github/1035-update
1035 update
2014-06-03 22:06:54 -05:00
Arfon Smith
98f35aefdc Merge branch 'master' into 1035
Conflicts:
	lib/linguist/languages.yml
	lib/linguist/samples.json
2014-06-03 22:03:59 -05:00
Arfon Smith
38a3714514 Samples update 2014-06-03 21:37:25 -05:00
Arfon Smith
491700f925 Merge pull request #1198 from Spirit-of-Oberon/master
Support of the Component Pascal language
2014-06-03 21:36:52 -05:00
ilovb
ac2723abe3 example 2 for Component Pascal 2014-05-17 00:02:34 +04:00
ilovb
0d0e219532 add example for Component Pascal 2014-05-16 23:47:27 +04:00
ilovb
cf35807709 add lexer for Component Pascal 2014-05-16 23:29:52 +04:00
ilovb
c2b53db96d remove Component Pascal examples 2014-05-16 23:08:28 +04:00
ilovb
8e6efc3a7d remove Component Pascal Document 2014-05-16 22:39:18 +04:00
ilovb
4b6f05b4d1 remove ace mode 2014-05-16 22:17:05 +04:00
ilovb
7aad5f93e4 Support of the Component Pascal language
http://en.wikipedia.org/wiki/Component_Pascal
2014-05-16 21:36:23 +04:00
Mikkel Madsen
dcc598442b Handle minified html5shiv 2014-05-13 09:01:37 +02:00
Mikkel Madsen
91877056fb Extend vendor test for html5shiv 2014-05-13 09:00:43 +02:00
Mikkel Madsen
868e9df434 Add html5shiv to vendor.yml 2014-05-13 08:56:08 +02:00
Julian Gehring
9ae0bdbb43 Add R package ignores to vendor.yml
Ignore vignette and external data directories which contain no R source code
2014-04-03 21:29:18 +02:00
Aleks Kissinger
a3aaa1ec4d included sample and extension .ML extension for Standard ML files 2014-04-02 12:41:54 +01:00
Pat Pannuto
5fb6f34d8a Add misser lexer entry for nesC to languages.yml
The nesC entry in the languages.yml file was missing a lexer entry
and thus wasn't getting picked up. This adds the required lexer line.
2013-12-05 14:55:00 -05:00
21 changed files with 1855 additions and 62 deletions

View File

@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.files = Dir['lib/**/*'] s.files = Dir['lib/**/*']
s.executables << 'linguist' 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 'escape_utils', '~> 1.0.1'
s.add_dependency 'mime-types', '~> 1.19' s.add_dependency 'mime-types', '~> 1.19'
s.add_dependency 'pygments.rb', '~> 0.5.4' s.add_dependency 'pygments.rb', '~> 0.5.4'

View File

@@ -112,6 +112,12 @@ module Linguist
end end
end end
def ruby_encoding
if hash = detect_encoding
hash[:ruby_encoding]
end
end
# Try to guess the encoding # Try to guess the encoding
# #
# Returns: a Hash, with :encoding, :confidence, :type # Returns: a Hash, with :encoding, :confidence, :type
@@ -258,7 +264,7 @@ module Linguist
# large) strings. # large) strings.
begin begin
encoded_newlines = ["\r\n", "\r", "\n"]. encoded_newlines = ["\r\n", "\r", "\n"].
map { |nl| nl.encode(encoding, "ASCII-8BIT").force_encoding(data.encoding) } 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 rescue Encoding::ConverterNotFoundError

View File

@@ -430,6 +430,14 @@ Common Lisp:
- clisp - clisp
- ecl - ecl
Component Pascal:
type: programming
lexer: Delphi
color: "#b0ce4e"
extensions:
- .cp
- .cps
Coq: Coq:
type: programming type: programming
extensions: extensions:
@@ -1895,6 +1903,13 @@ SQL:
- .udf - .udf
- .viw - .viw
STON:
type: data
group: Smalltalk
lexer: JSON
extensions:
- .ston
Sage: Sage:
type: programming type: programming
lexer: Python lexer: Python
@@ -2017,8 +2032,9 @@ Standard ML:
aliases: aliases:
- sml - sml
extensions: extensions:
- .sml - .ML
- .fun - .fun
- .sml
Stata: Stata:
type: programming type: programming
@@ -2161,6 +2177,14 @@ UnrealScript:
extensions: extensions:
- .uc - .uc
VCL:
type: programming
lexer: Perl
ace_mode: perl
color: "#0298c3"
extensions:
- .vcl
VHDL: VHDL:
type: programming type: programming
lexer: vhdl lexer: vhdl
@@ -2387,6 +2411,7 @@ mupad:
nesC: nesC:
type: programming type: programming
color: "#ffce3b" color: "#ffce3b"
lexer: nesC
extensions: extensions:
- .nc - .nc

View File

@@ -92,6 +92,10 @@
".cl", ".cl",
".lisp" ".lisp"
], ],
"Component Pascal": [
".cp",
".cps"
],
"Coq": [ "Coq": [
".v" ".v"
], ],
@@ -562,6 +566,7 @@
".nut" ".nut"
], ],
"Standard ML": [ "Standard ML": [
".ML",
".fun", ".fun",
".sig", ".sig",
".sml" ".sml"
@@ -575,6 +580,9 @@
".matah", ".matah",
".sthlp" ".sthlp"
], ],
"STON": [
".ston"
],
"Stylus": [ "Stylus": [
".styl" ".styl"
], ],
@@ -610,6 +618,9 @@
"UnrealScript": [ "UnrealScript": [
".uc" ".uc"
], ],
"VCL": [
".vcl"
],
"Verilog": [ "Verilog": [
".v" ".v"
], ],
@@ -729,8 +740,8 @@
".gemrc" ".gemrc"
] ]
}, },
"tokens_total": 612725, "tokens_total": 614357,
"languages_total": 799, "languages_total": 811,
"tokens": { "tokens": {
"ABAP": { "ABAP": {
"*/**": 1, "*/**": 1,
@@ -15336,6 +15347,181 @@
"line": 2, "line": 2,
"After": 1 "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": { "Coq": {
"Inductive": 41, "Inductive": 41,
"day": 9, "day": 9,
@@ -60661,67 +60847,67 @@
"newplayer.MoveTo": 1 "newplayer.MoveTo": 1
}, },
"Standard ML": { "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, "signature": 2,
"LAZY_BASE": 3,
"sig": 2, "sig": 2,
"type": 5,
"a": 74,
"lazy": 12,
"-": 19,
")": 826,
"end": 52,
"LAZY": 1, "LAZY": 1,
"bool": 9, "bool": 9,
"val": 143,
"inject": 3,
"toString": 3,
"(": 822,
"string": 14, "string": 14,
"eq": 2,
"*": 9, "*": 9,
"eqBy": 3,
"compare": 7,
"order": 2, "order": 2,
"map": 2,
"b": 58, "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, "functor": 2,
"Main": 1, "Main": 1,
"S": 2, "S": 2,
@@ -61798,6 +61984,56 @@
"return": 1, "return": 1,
"/": 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": { "Stylus": {
"border": 6, "border": 6,
"-": 10, "-": 10,
@@ -63543,6 +63779,87 @@
"log": 1, "log": 1,
"defaultproperties": 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": { "Verilog": {
"////////////////////////////////////////////////////////////////////////////////": 14, "////////////////////////////////////////////////////////////////////////////////": 14,
"//": 117, "//": 117,
@@ -66642,6 +66959,7 @@
"COBOL": 90, "COBOL": 90,
"CoffeeScript": 2951, "CoffeeScript": 2951,
"Common Lisp": 2186, "Common Lisp": 2186,
"Component Pascal": 825,
"Coq": 18259, "Coq": 18259,
"Creole": 134, "Creole": 134,
"Crystal": 1506, "Crystal": 1506,
@@ -66775,8 +67093,9 @@
"SourcePawn": 2080, "SourcePawn": 2080,
"SQL": 1485, "SQL": 1485,
"Squirrel": 130, "Squirrel": 130,
"Standard ML": 6405, "Standard ML": 6567,
"Stata": 3133, "Stata": 3133,
"STON": 100,
"Stylus": 76, "Stylus": 76,
"SuperCollider": 133, "SuperCollider": 133,
"Swift": 1128, "Swift": 1128,
@@ -66788,6 +67107,7 @@
"TXL": 213, "TXL": 213,
"TypeScript": 109, "TypeScript": 109,
"UnrealScript": 2873, "UnrealScript": 2873,
"VCL": 545,
"Verilog": 3778, "Verilog": 3778,
"VHDL": 42, "VHDL": 42,
"VimL": 20, "VimL": 20,
@@ -66829,6 +67149,7 @@
"COBOL": 4, "COBOL": 4,
"CoffeeScript": 9, "CoffeeScript": 9,
"Common Lisp": 3, "Common Lisp": 3,
"Component Pascal": 2,
"Coq": 12, "Coq": 12,
"Creole": 1, "Creole": 1,
"Crystal": 3, "Crystal": 3,
@@ -66962,8 +67283,9 @@
"SourcePawn": 1, "SourcePawn": 1,
"SQL": 5, "SQL": 5,
"Squirrel": 1, "Squirrel": 1,
"Standard ML": 4, "Standard ML": 5,
"Stata": 7, "Stata": 7,
"STON": 7,
"Stylus": 1, "Stylus": 1,
"SuperCollider": 1, "SuperCollider": 1,
"Swift": 43, "Swift": 43,
@@ -66975,6 +67297,7 @@
"TXL": 1, "TXL": 1,
"TypeScript": 3, "TypeScript": 3,
"UnrealScript": 2, "UnrealScript": 2,
"VCL": 2,
"Verilog": 13, "Verilog": 13,
"VHDL": 1, "VHDL": 1,
"VimL": 2, "VimL": 2,
@@ -66991,5 +67314,5 @@
"Zephir": 2, "Zephir": 2,
"Zimpl": 1 "Zimpl": 1
}, },
"md5": "482e5e1de8ec47e0b556809c8fe6f62b" "md5": "92c117f774abe712958bb369c4e1dde9"
} }

View File

@@ -168,6 +168,9 @@
- (^|/)extjs/src/ - (^|/)extjs/src/
- (^|/)extjs/welcome/ - (^|/)extjs/welcome/
# Html5shiv
- (^|/)html5shiv(\.min)?\.js$
# Samples folders # Samples folders
- ^[Ss]amples/ - ^[Ss]amples/
@@ -196,3 +199,8 @@
# Mercury --use-subdirs # Mercury --use-subdirs
- Mercury/ - Mercury/
# R packages
- ^vignettes/
- ^inst/extdata/

View File

@@ -1,3 +1,3 @@
module Linguist module Linguist
VERSION = "2.11.3" VERSION = "2.11.5"
end end

View 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.

View 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
View File

@@ -0,0 +1 @@
[1, 2, 3]

View File

@@ -0,0 +1 @@
{#a : 1, #b : 2}

View File

@@ -0,0 +1,4 @@
Rectangle {
#origin : Point [ -40, -15 ],
#corner : Point [ 60, 35 ]
}

View 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
}

View 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'
}
}

View 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" } }

View 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" }

View 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)

View 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

View 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
#
#==============================================================================

View 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);
}

View 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);
}

View File

@@ -102,11 +102,21 @@ class TestBlob < Test::Unit::TestCase
def test_encoding def test_encoding
assert_equal "ISO-8859-2", blob("Text/README").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").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").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").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").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_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 end
def test_binary def test_binary
@@ -365,6 +375,10 @@ class TestBlob < Test::Unit::TestCase
# NuGet Packages # NuGet Packages
assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored? 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 # Test fixtures
assert blob("test/fixtures/random.rkt").vendored? assert blob("test/fixtures/random.rkt").vendored?
assert blob("Test/fixtures/random.rkt").vendored? assert blob("Test/fixtures/random.rkt").vendored?