mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge branch 'master' of https://github.com/github/linguist into patch-1
This commit is contained in:
		| @@ -12,8 +12,9 @@ path = ARGV[0] || Dir.pwd | ||||
| if File.directory?(path) | ||||
|   repo = Linguist::Repository.from_directory(path) | ||||
|   repo.languages.sort_by { |_, size| size }.reverse.each do |language, size| | ||||
|     percentage = ((size / repo.size.to_f) * 100).round | ||||
|     puts "%-4s %s" % ["#{percentage}%", language] | ||||
|     percentage = ((size / repo.size.to_f) * 100) | ||||
|     percentage = sprintf '%.2f' % percentage | ||||
|     puts "%-7s %s" % ["#{percentage}%", language] | ||||
|   end | ||||
| elsif File.file?(path) | ||||
|   blob = Linguist::FileBlob.new(path, Dir.pwd) | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| Gem::Specification.new do |s| | ||||
|   s.name    = 'github-linguist' | ||||
|   s.version = '2.9.6' | ||||
|   s.version = '2.9.8' | ||||
|   s.summary = "GitHub Language detection" | ||||
|  | ||||
|   s.authors  = "GitHub" | ||||
|   | ||||
| @@ -58,7 +58,8 @@ module Linguist | ||||
|         generated_parser? || | ||||
|         generated_net_docfile? || | ||||
|         generated_net_designer_file? || | ||||
|         generated_protocol_buffer? | ||||
|         generated_protocol_buffer? || | ||||
|         generated_jni_header? | ||||
|     end | ||||
|  | ||||
|     # Internal: Is the blob an XCode project file? | ||||
| @@ -181,5 +182,16 @@ module Linguist | ||||
|  | ||||
|       return lines[0].include?("Generated by the protocol buffer compiler.  DO NOT EDIT!") | ||||
|     end | ||||
|  | ||||
|     # Internal: Is the blob a C/C++ header generated by the Java JNI tool javah? | ||||
|     # | ||||
|     # Returns true of false. | ||||
|     def generated_jni_header? | ||||
|       return false unless extname == '.h' | ||||
|       return false unless lines.count > 2 | ||||
|  | ||||
|       return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */") | ||||
|       return lines[1].include?("#include <jni.h>") | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -27,7 +27,7 @@ module Linguist | ||||
|     # | ||||
|     # Returns an array | ||||
|     def self.detectable_markup | ||||
|       ["AsciiDoc", "CSS", "Creole", "Less", "Markdown", "MediaWiki", "Org", "RDoc", "Sass", "Textile", "reStructuredText"] | ||||
|       ["CSS", "Less", "Sass"] | ||||
|     end | ||||
|  | ||||
|     # Internal: Create a new Language object | ||||
|   | ||||
| @@ -22,13 +22,19 @@ | ||||
| # Any additions or modifications (even trivial) should have corresponding | ||||
| # test change in `test/test_blob.rb`. | ||||
| # | ||||
| # Please keep this list alphabetized. Capitalization comes before lower case. | ||||
| # Please keep this list alphabetized. | ||||
|  | ||||
| ABAP: | ||||
|   type: programming | ||||
|   lexer: ABAP | ||||
|   primary_extension: .abap | ||||
|  | ||||
|    | ||||
| ANTLR: | ||||
|   type: programming | ||||
|   color: "#9DC3FF" | ||||
|   lexer: ANTLR | ||||
|   primary_extension: .g4 | ||||
|    | ||||
| ASP: | ||||
|   type: programming | ||||
|   color: "#6a40fd" | ||||
| @@ -62,6 +68,10 @@ Ada: | ||||
|   extensions: | ||||
|   - .ads | ||||
|  | ||||
| Agda: | ||||
|   type: programming | ||||
|   primary_extension: .agda | ||||
|  | ||||
| ApacheConf: | ||||
|   type: markup | ||||
|   aliases: | ||||
| @@ -91,16 +101,6 @@ Arduino: | ||||
|   lexer: C++ | ||||
|   primary_extension: .ino | ||||
|  | ||||
| AsciiDoc: | ||||
|   type: markup | ||||
|   lexer: Text only | ||||
|   ace_mode: asciidoc | ||||
|   wrap: true | ||||
|   primary_extension: .asciidoc | ||||
|   extensions: | ||||
|   - .adoc | ||||
|   - .asc | ||||
|  | ||||
| Assembly: | ||||
|   type: programming | ||||
|   lexer: NASM | ||||
| @@ -127,6 +127,7 @@ Awk: | ||||
|   lexer: Awk | ||||
|   primary_extension: .awk | ||||
|   extensions: | ||||
|   - .auk | ||||
|   - .gawk | ||||
|   - .mawk | ||||
|   - .nawk | ||||
| @@ -147,6 +148,11 @@ Befunge: | ||||
| BlitzMax: | ||||
|   primary_extension: .bmx | ||||
|  | ||||
| Bluespec: | ||||
|   type: programming | ||||
|   lexer: verilog | ||||
|   primary_extension: .bsv | ||||
|  | ||||
| Boo: | ||||
|   type: programming | ||||
|   color: "#d4bec1" | ||||
| @@ -194,8 +200,10 @@ C++: | ||||
|   - .H | ||||
|   - .h++ | ||||
|   - .hh | ||||
|   - .hpp | ||||
|   - .hxx | ||||
|   - .tcc | ||||
|   - .tpp | ||||
|  | ||||
| C-ObjDump: | ||||
|   type: data | ||||
| @@ -245,14 +253,26 @@ ChucK: | ||||
|   lexer: Java | ||||
|   primary_extension: .ck | ||||
|  | ||||
| Clean: | ||||
|   type: programming | ||||
|   color: "#3a81ad" | ||||
|   lexer: Text only | ||||
|   primary_extension: .icl | ||||
|   extensions: | ||||
|   - .dcl | ||||
|  | ||||
| Clojure: | ||||
|   type: programming | ||||
|   ace_mode: clojure | ||||
|   color: "#db5855" | ||||
|   primary_extension: .clj | ||||
|   extensions: | ||||
|   - .cl2 | ||||
|   - .cljc | ||||
|   - .cljs | ||||
|   - .cljscm | ||||
|   - .cljx | ||||
|   - .hic | ||||
|   filenames: | ||||
|   - riemann.config | ||||
|  | ||||
| @@ -291,6 +311,7 @@ Common Lisp: | ||||
|   primary_extension: .lisp | ||||
|   extensions: | ||||
|   - .asd | ||||
|   - .cl | ||||
|   - .lsp | ||||
|   - .ny | ||||
|   - .podsl | ||||
| @@ -307,16 +328,16 @@ Cpp-ObjDump: | ||||
|   - .c++objdump | ||||
|   - .cxx-objdump | ||||
|  | ||||
| Creole: | ||||
|   type: markup | ||||
|   lexer: Text only | ||||
|   wrap: true | ||||
|   primary_extension: .creole | ||||
|  | ||||
| Cucumber: | ||||
|   lexer: Gherkin | ||||
|   primary_extension: .feature | ||||
|  | ||||
| Cuda: | ||||
|   lexer: CUDA | ||||
|   primary_extension: .cu | ||||
|   extensions: | ||||
|   - .cuh | ||||
|  | ||||
| Cython: | ||||
|   type: programming | ||||
|   group: Python | ||||
| @@ -336,6 +357,14 @@ D-ObjDump: | ||||
|   type: data | ||||
|   lexer: d-objdump | ||||
|   primary_extension: .d-objdump | ||||
|    | ||||
| DM: | ||||
|   type: programming | ||||
|   color: "#075ff1" | ||||
|   lexer: Text only | ||||
|   primary_extension: .dm | ||||
|   aliases: | ||||
|   - byond | ||||
|  | ||||
| DOT: | ||||
|   type: programming | ||||
| @@ -364,7 +393,7 @@ DCPU-16 ASM: | ||||
|   - .dasm | ||||
|   aliases: | ||||
|   - dasm16 | ||||
|  | ||||
|    | ||||
| Diff: | ||||
|   primary_extension: .diff | ||||
|  | ||||
| @@ -413,6 +442,8 @@ Emacs Lisp: | ||||
|   - elisp | ||||
|   - emacs | ||||
|   primary_extension: .el | ||||
|   filenames:    | ||||
|   - .emacs | ||||
|   extensions: | ||||
|   - .emacs | ||||
|  | ||||
| @@ -528,6 +559,12 @@ Gettext Catalog: | ||||
|   extensions: | ||||
|   - .pot | ||||
|  | ||||
| Glyph: | ||||
|   type: programming | ||||
|   color: "#e4cc98" | ||||
|   lexer: Tcl | ||||
|   primary_extension: .glf | ||||
|  | ||||
| Go: | ||||
|   type: programming | ||||
|   color: "#a89b4d" | ||||
| @@ -628,7 +665,6 @@ Haskell: | ||||
|  | ||||
| Haxe: | ||||
|   type: programming | ||||
|   lexer: haXe | ||||
|   ace_mode: haxe | ||||
|   color: "#346d51" | ||||
|   primary_extension: .hx | ||||
| @@ -643,6 +679,17 @@ INI: | ||||
|   - .properties | ||||
|   primary_extension: .ini | ||||
|  | ||||
| Idris: | ||||
|   type: programming | ||||
|   lexer: Text only | ||||
|   primary_extension: .idr | ||||
|   extensions: | ||||
|   - .lidr | ||||
|  | ||||
| Inno Setup: | ||||
|   primary_extension: .iss | ||||
|   lexer: Text only | ||||
|  | ||||
| IRC log: | ||||
|   lexer: IRC logs | ||||
|   search_term: irc | ||||
| @@ -673,6 +720,19 @@ JSON: | ||||
|   ace_mode: json | ||||
|   searchable: false | ||||
|   primary_extension: .json | ||||
|   extensions: | ||||
|   - .sublime-keymap | ||||
|   - .sublime_metrics | ||||
|   - .sublime-mousemap | ||||
|   - .sublime-project | ||||
|   - .sublime_session | ||||
|   - .sublime-settings | ||||
|   - .sublime-workspace | ||||
|  | ||||
| Jade: | ||||
|   group: HTML | ||||
|   type: markup | ||||
|   primary_extension: .jade | ||||
|  | ||||
| Java: | ||||
|   type: programming | ||||
| @@ -715,6 +775,12 @@ Julia: | ||||
|   primary_extension: .jl | ||||
|   color: "#a270ba" | ||||
|  | ||||
| KRL: | ||||
|   lexer: Text only | ||||
|   type: programming | ||||
|   color: "#f5c800" | ||||
|   primary_extension: .krl | ||||
|  | ||||
| Kotlin: | ||||
|   type: programming | ||||
|   primary_extension: .kt | ||||
| @@ -735,7 +801,6 @@ LLVM: | ||||
| Lasso: | ||||
|   type: programming | ||||
|   lexer: Lasso | ||||
|   ace_mode: lasso | ||||
|   color: "#2584c3" | ||||
|   primary_extension: .lasso | ||||
|  | ||||
| @@ -743,7 +808,6 @@ Less: | ||||
|   type: markup | ||||
|   group: CSS | ||||
|   lexer: CSS | ||||
|   ace_mode: less | ||||
|   primary_extension: .less | ||||
|  | ||||
| LilyPond: | ||||
| @@ -752,6 +816,13 @@ LilyPond: | ||||
|   extensions: | ||||
|   - .ily | ||||
|  | ||||
| Literate Agda: | ||||
|   type: programming | ||||
|   group: Agda | ||||
|   primary_extension: .lagda | ||||
|   extensions: | ||||
|     - .lagda | ||||
|  | ||||
| Literate CoffeeScript: | ||||
|   type: programming | ||||
|   group: CoffeeScript | ||||
| @@ -862,12 +933,6 @@ Max: | ||||
|   - .maxhelp | ||||
|   - .maxpat | ||||
|  | ||||
| MediaWiki: | ||||
|   type: markup | ||||
|   lexer: Text only | ||||
|   wrap: true | ||||
|   primary_extension: .mediawiki | ||||
|  | ||||
| MiniD: # Legacy | ||||
|   searchable: false | ||||
|   primary_extension: .minid # Dummy extension | ||||
| @@ -997,11 +1062,11 @@ OpenEdge ABL: | ||||
|   - abl | ||||
|   primary_extension: .p | ||||
|  | ||||
| Org: | ||||
|   type: markup | ||||
| Oxygene: | ||||
|   type: programming | ||||
|   lexer: Text only | ||||
|   wrap: true | ||||
|   primary_extension: .org | ||||
|   color: "#5a63a3" | ||||
|   primary_extension: .oxygene | ||||
|  | ||||
| PHP: | ||||
|   type: programming | ||||
| @@ -1084,6 +1149,9 @@ PowerShell: | ||||
|   aliases: | ||||
|   - posh | ||||
|   primary_extension: .ps1 | ||||
|   extensions: | ||||
|   - .psd1 | ||||
|   - .psm1 | ||||
|  | ||||
| Processing: | ||||
|   type: programming | ||||
| @@ -1098,6 +1166,13 @@ Prolog: | ||||
|   extensions: | ||||
|   - .pro | ||||
|  | ||||
| Protocol Buffer: | ||||
|   type: markup | ||||
|   aliases: | ||||
|   - protobuf | ||||
|   - Protocol Buffers | ||||
|   primary_extension: .proto | ||||
|  | ||||
| Puppet: | ||||
|   type: programming | ||||
|   color: "#cc5555" | ||||
| @@ -1134,20 +1209,31 @@ Python traceback: | ||||
|   searchable: false | ||||
|   primary_extension: .pytb | ||||
|  | ||||
| QML: | ||||
|   type: markup | ||||
|   color: "#44a51c" | ||||
|   primary_extension: .qml | ||||
|  | ||||
| R: | ||||
|   type: programming | ||||
|   color: "#198ce7" | ||||
|   lexer: S | ||||
|   primary_extension: .r | ||||
|   extensions: | ||||
|   - .R | ||||
|   filenames: | ||||
|   - .Rprofile | ||||
|  | ||||
| RDoc: | ||||
|   type: markup | ||||
|   lexer: Text only | ||||
|   ace_mode: rdoc | ||||
|   wrap: true | ||||
|   primary_extension: .rdoc | ||||
| REALbasic: | ||||
|   type: programming | ||||
|   lexer: VB.net | ||||
|   primary_extension: .rbbas | ||||
|   extensions: | ||||
|   - .rbfrm | ||||
|   - .rbmnu | ||||
|   - .rbres | ||||
|   - .rbtbar | ||||
|   - .rbuistate | ||||
|  | ||||
| RHTML: | ||||
|   type: markup | ||||
| @@ -1187,6 +1273,12 @@ Rebol: | ||||
| Redcode: | ||||
|   primary_extension: .cw | ||||
|  | ||||
| RobotFramework: | ||||
|   type: programming | ||||
|   primary_extension: .robot | ||||
|   # extensions: | ||||
|   # - .txt | ||||
|  | ||||
| Rouge: | ||||
|   type: programming | ||||
|   lexer: Clojure | ||||
| @@ -1210,6 +1302,7 @@ Ruby: | ||||
|   - .gemspec | ||||
|   - .god | ||||
|   - .irbrc | ||||
|   - .mspec | ||||
|   - .podspec | ||||
|   - .rbuild | ||||
|   - .rbw | ||||
| @@ -1259,6 +1352,11 @@ Scala: | ||||
|   color: "#7dd3b0" | ||||
|   primary_extension: .scala | ||||
|  | ||||
| Scaml: | ||||
|   group: HTML | ||||
|   type: markup | ||||
|   primary_extension: .scaml | ||||
|  | ||||
| Scheme: | ||||
|   type: programming | ||||
|   color: "#1e4aec" | ||||
| @@ -1337,6 +1435,8 @@ Tcl: | ||||
|   type: programming | ||||
|   color: "#e4cc98" | ||||
|   primary_extension: .tcl | ||||
|   extensions: | ||||
|   - .adp | ||||
|  | ||||
| Tcsh: | ||||
|   type: programming | ||||
| @@ -1357,6 +1457,9 @@ TeX: | ||||
|   - .dtx | ||||
|   - .ins | ||||
|   - .ltx | ||||
|   - .mkii | ||||
|   - .mkiv | ||||
|   - .mkvi | ||||
|   - .sty | ||||
|   - .toc | ||||
|  | ||||
| @@ -1419,9 +1522,7 @@ Verilog: | ||||
|   color: "#848bf3" | ||||
|   primary_extension: .v | ||||
|   extensions: | ||||
|   - .sv | ||||
|   - .svh | ||||
|   - .vh | ||||
|   - .veo | ||||
|  | ||||
| VimL: | ||||
|   type: programming | ||||
| @@ -1431,6 +1532,7 @@ VimL: | ||||
|   - vim | ||||
|   primary_extension: .vim | ||||
|   filenames: | ||||
|   - .vimrc | ||||
|   - vimrc | ||||
|   - gvimrc | ||||
|  | ||||
| @@ -1441,6 +1543,7 @@ Visual Basic: | ||||
|   primary_extension: .vb | ||||
|   extensions: | ||||
|   - .bas | ||||
|   - .frm | ||||
|   - .frx | ||||
|   - .vba | ||||
|   - .vbs | ||||
| @@ -1467,6 +1570,8 @@ XML: | ||||
|   extensions: | ||||
|   - .axml | ||||
|   - .ccxml | ||||
|   - .clixml | ||||
|   - .cproject | ||||
|   - .dita | ||||
|   - .ditamap | ||||
|   - .ditaval | ||||
| @@ -1476,6 +1581,8 @@ XML: | ||||
|   - .kml | ||||
|   - .mxml | ||||
|   - .plist | ||||
|   - .ps1xml | ||||
|   - .psc1 | ||||
|   - .pt | ||||
|   - .rdf | ||||
|   - .rss | ||||
| @@ -1518,6 +1625,8 @@ XQuery: | ||||
|   primary_extension: .xquery | ||||
|   extensions: | ||||
|   - .xq | ||||
|   - .xql | ||||
|   - .xqm | ||||
|   - .xqy | ||||
|  | ||||
| XS: | ||||
| @@ -1569,6 +1678,11 @@ mupad: | ||||
|   lexer: MuPAD | ||||
|   primary_extension: .mu | ||||
|  | ||||
| nesC: | ||||
|   type: programming | ||||
|   color: "#ffce3b" | ||||
|   primary_extension: .nc | ||||
|  | ||||
| ooc: | ||||
|   type: programming | ||||
|   lexer: Ooc | ||||
| @@ -1591,3 +1705,9 @@ wisp: | ||||
|   ace_mode: clojure | ||||
|   color: "#7582D1" | ||||
|   primary_extension: .wisp | ||||
|  | ||||
| xBase: | ||||
|   type: programming | ||||
|   lexer: Text only | ||||
|   color: "#3a4040" | ||||
|   primary_extension: .prg | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -12,6 +12,9 @@ | ||||
| # Caches | ||||
| - cache/ | ||||
|  | ||||
| # Dependencies | ||||
| - ^[Dd]ependencies/ | ||||
|  | ||||
| # C deps | ||||
| #  https://github.com/joyent/node | ||||
| - ^deps/ | ||||
| @@ -27,8 +30,12 @@ | ||||
| # Erlang bundles | ||||
| - ^rebar$ | ||||
|  | ||||
| # Bootstrap minified css and js | ||||
| - (^|/)bootstrap([^.]*)(\.min)\.(js|css)$ | ||||
|  | ||||
| # Vendored dependencies | ||||
| - vendor/ | ||||
| - thirdparty/ | ||||
| - vendors?/ | ||||
|  | ||||
| # Debian packaging | ||||
| - ^debian/ | ||||
| @@ -86,6 +93,8 @@ | ||||
| # WAF | ||||
| - ^waf$ | ||||
|  | ||||
| # .osx | ||||
| - ^.osx$ | ||||
|  | ||||
| ## Obj-C ## | ||||
|  | ||||
| @@ -108,7 +117,22 @@ | ||||
| - ^[Pp]ackages/ | ||||
|  | ||||
| # ExtJS | ||||
| - (^|/)extjs/ | ||||
| - (^|/)extjs/.*?\.js$ | ||||
| - (^|/)extjs/.*?\.xml$ | ||||
| - (^|/)extjs/.*?\.txt$ | ||||
| - (^|/)extjs/.*?\.html$ | ||||
| - (^|/)extjs/.*?\.properties$ | ||||
| - (^|/)extjs/.sencha/ | ||||
| - (^|/)extjs/docs/ | ||||
| - (^|/)extjs/builds/ | ||||
| - (^|/)extjs/cmd/ | ||||
| - (^|/)extjs/examples/ | ||||
| - (^|/)extjs/locale/ | ||||
| - (^|/)extjs/packages/ | ||||
| - (^|/)extjs/plugins/ | ||||
| - (^|/)extjs/resources/ | ||||
| - (^|/)extjs/src/ | ||||
| - (^|/)extjs/welcome/ | ||||
|  | ||||
| # Samples folders | ||||
| - ^[Ss]amples/ | ||||
| @@ -125,5 +149,12 @@ | ||||
| # Test fixtures | ||||
| - ^[Tt]est/fixtures/ | ||||
|  | ||||
| # PhoneGap/Cordova | ||||
| - (^|/)cordova([^.]*)(\.min)?\.js$ | ||||
| - (^|/)cordova\-\d\.\d(\.\d)?(\.min)?\.js$ | ||||
|  | ||||
| # Vagrant | ||||
| - ^Vagrantfile$ | ||||
|  | ||||
| # .DS_Store's | ||||
| - .[Dd][Ss]_[Ss]tore$ | ||||
|   | ||||
							
								
								
									
										39
									
								
								samples/Agda/NatCat.agda
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								samples/Agda/NatCat.agda
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| module NatCat where | ||||
|  | ||||
| open import Relation.Binary.PropositionalEquality | ||||
|  | ||||
| -- If you can show that a relation only ever has one inhabitant | ||||
| -- you get the category laws for free | ||||
| module | ||||
|   EasyCategory | ||||
|   (obj : Set) | ||||
|   (_⟶_ : obj → obj → Set) | ||||
|   (_∘_ : ∀ {x y z} → x ⟶ y → y ⟶ z → x ⟶ z) | ||||
|   (id : ∀ x → x ⟶ x) | ||||
|   (single-inhabitant : (x y : obj) (r s : x ⟶ y) → r ≡ s) | ||||
|   where | ||||
|  | ||||
|   idʳ : ∀ x y (r : x ⟶ y) → r ∘ id y ≡ r | ||||
|   idʳ x y r = single-inhabitant x y (r ∘ id y) r  | ||||
|  | ||||
|   idˡ : ∀ x y (r : x ⟶ y) → id x ∘ r ≡ r | ||||
|   idˡ x y r = single-inhabitant x y (id x ∘ r) r | ||||
|  | ||||
|   ∘-assoc : ∀ w x y z (r : w ⟶ x) (s : x ⟶ y) (t : y ⟶ z) → (r ∘ s) ∘ t ≡ r ∘ (s ∘ t) | ||||
|   ∘-assoc w x y z r s t = single-inhabitant w z ((r ∘ s) ∘ t) (r ∘ (s ∘ t)) | ||||
|  | ||||
| open import Data.Nat | ||||
|  | ||||
| same : (x y : ℕ) (r s : x ≤ y) → r ≡ s | ||||
| same .0 y z≤n z≤n = refl | ||||
| same .(suc m) .(suc n) (s≤s {m} {n} r) (s≤s s) = cong s≤s (same m n r s) | ||||
|  | ||||
| ≤-trans : ∀ x y z → x ≤ y → y ≤ z → x ≤ z | ||||
| ≤-trans .0 y z z≤n s = z≤n | ||||
| ≤-trans .(suc m) .(suc n) .(suc n₁) (s≤s {m} {n} r) (s≤s {.n} {n₁} s) = s≤s (≤-trans m n n₁ r s) | ||||
|  | ||||
| ≤-refl : ∀ x → x ≤ x | ||||
| ≤-refl zero = z≤n | ||||
| ≤-refl (suc x) = s≤s (≤-refl x) | ||||
|  | ||||
| module Nat-EasyCategory = EasyCategory ℕ _≤_ (λ {x}{y}{z} → ≤-trans x y z) ≤-refl same | ||||
| @@ -1,13 +0,0 @@ | ||||
| Gregory Romé has written an AsciiDoc plugin for the Redmine project management application. | ||||
|  | ||||
| https://github.com/foo-users/foo | ||||
| へと `vicmd` キーマップを足してみている試み、 | ||||
| アニメーションgifです。 | ||||
|  | ||||
| tag::romé[] | ||||
| Gregory Romé has written an AsciiDoc plugin for the Redmine project management application. | ||||
| end::romé[] | ||||
|  | ||||
| == Überschrift | ||||
|  | ||||
| * Codierungen sind verrückt auf älteren Versionen von Ruby | ||||
| @@ -1,10 +0,0 @@ | ||||
| AsciiDoc Home Page | ||||
| ================== | ||||
|  | ||||
| Example Articles | ||||
| ~~~~~~~~~~~~~~~~ | ||||
| - Item 1 | ||||
|  | ||||
| - Item 2 | ||||
|  | ||||
| - Item 3 | ||||
| @@ -1,25 +0,0 @@ | ||||
| Document Title | ||||
| ============== | ||||
| Doc Writer <thedoc@asciidoctor.org> | ||||
| :idprefix: id_ | ||||
|  | ||||
| Preamble paragraph. | ||||
|  | ||||
| NOTE: This is test, only a test. | ||||
|  | ||||
| == Section A | ||||
|  | ||||
| *Section A* paragraph. | ||||
|  | ||||
| === Section A Subsection | ||||
|  | ||||
| *Section A* 'subsection' paragraph. | ||||
|  | ||||
| == Section B | ||||
|  | ||||
| *Section B* paragraph. | ||||
|  | ||||
| .Section B list | ||||
| * Item 1 | ||||
| * Item 2 | ||||
| * Item 3 | ||||
							
								
								
									
										167
									
								
								samples/Bluespec/TL.bsv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								samples/Bluespec/TL.bsv
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| package TL; | ||||
|  | ||||
| interface TL; | ||||
|    method Action ped_button_push(); | ||||
|  | ||||
|          (* always_enabled *) | ||||
|          method Action set_car_state_N(Bool x); | ||||
|          (* always_enabled *) | ||||
|          method Action set_car_state_S(Bool x); | ||||
|          (* always_enabled *) | ||||
|          method Action set_car_state_E(Bool x); | ||||
|          (* always_enabled *) | ||||
|          method Action set_car_state_W(Bool x); | ||||
|  | ||||
|    method Bool lampRedNS(); | ||||
|    method Bool lampAmberNS(); | ||||
|    method Bool lampGreenNS(); | ||||
|  | ||||
|    method Bool lampRedE(); | ||||
|    method Bool lampAmberE(); | ||||
|    method Bool lampGreenE(); | ||||
|  | ||||
|    method Bool lampRedW(); | ||||
|    method Bool lampAmberW(); | ||||
|    method Bool lampGreenW(); | ||||
|  | ||||
|    method Bool lampRedPed(); | ||||
|    method Bool lampAmberPed(); | ||||
|    method Bool lampGreenPed(); | ||||
| endinterface: TL | ||||
|  | ||||
| typedef enum { | ||||
|          AllRed, | ||||
|          GreenNS, AmberNS, | ||||
|          GreenE, AmberE, | ||||
|          GreenW, AmberW, | ||||
|          GreenPed, AmberPed} TLstates deriving (Eq, Bits); | ||||
|  | ||||
| typedef UInt#(5) Time32; | ||||
| typedef UInt#(20) CtrSize; | ||||
|  | ||||
| (* synthesize *) | ||||
| module sysTL(TL); | ||||
|    Time32 allRedDelay = 2; | ||||
|    Time32 amberDelay = 4; | ||||
|    Time32 nsGreenDelay = 20; | ||||
|    Time32 ewGreenDelay = 10; | ||||
|    Time32 pedGreenDelay = 10; | ||||
|    Time32 pedAmberDelay = 6; | ||||
|  | ||||
|    CtrSize clocks_per_sec = 100; | ||||
|  | ||||
|    Reg#(TLstates) state <- mkReg(AllRed); | ||||
|    Reg#(TLstates) next_green <- mkReg(GreenNS); | ||||
|    Reg#(Time32) secs <- mkReg(0); | ||||
|    Reg#(Bool) ped_button_pushed <- mkReg(False); | ||||
|          Reg#(Bool) car_present_N <- mkReg(True); | ||||
|    Reg#(Bool) car_present_S <- mkReg(True); | ||||
|    Reg#(Bool) car_present_E <- mkReg(True); | ||||
|    Reg#(Bool) car_present_W <- mkReg(True); | ||||
|          Bool car_present_NS = car_present_N || car_present_S; | ||||
|    Reg#(CtrSize) cycle_ctr <- mkReg(0); | ||||
|  | ||||
|    rule dec_cycle_ctr (cycle_ctr != 0); | ||||
|       cycle_ctr <= cycle_ctr - 1; | ||||
|    endrule | ||||
|  | ||||
|    Rules low_priority_rule = (rules | ||||
|                         rule inc_sec (cycle_ctr == 0); | ||||
|                                  secs <= secs + 1; | ||||
|                                  cycle_ctr <= clocks_per_sec; | ||||
|                         endrule endrules); | ||||
|  | ||||
|    function Action next_state(TLstates ns); | ||||
|          action | ||||
|                                  state <= ns; | ||||
|                                  secs <= 0; | ||||
|       endaction | ||||
|    endfunction: next_state | ||||
|  | ||||
|    function TLstates green_seq(TLstates x); | ||||
|       case (x) | ||||
|                                  GreenNS: return (GreenE); | ||||
|                                  GreenE:  return (GreenW); | ||||
|                                  GreenW:  return (GreenNS); | ||||
|       endcase | ||||
|    endfunction | ||||
|  | ||||
|    function Bool car_present(TLstates x); | ||||
|       case (x) | ||||
|                                  GreenNS: return (car_present_NS); | ||||
|                                  GreenE:  return (car_present_E); | ||||
|                                  GreenW:  return (car_present_W); | ||||
|       endcase | ||||
|    endfunction | ||||
|  | ||||
|    function Rules make_from_green_rule(TLstates green_state, Time32 delay, Bool car_is_present, TLstates ns); | ||||
|                         return (rules | ||||
|                                  rule from_green (state == green_state && (secs >= delay || !car_is_present)); | ||||
|                                                 next_state(ns); | ||||
|                                  endrule endrules); | ||||
|    endfunction: make_from_green_rule | ||||
|  | ||||
|    function Rules make_from_amber_rule(TLstates amber_state, TLstates ng); | ||||
|       return (rules | ||||
|                                  rule from_amber (state == amber_state && secs >= amberDelay); | ||||
|                                                 next_state(AllRed); | ||||
|                                                 next_green <= ng; | ||||
|                                  endrule endrules); | ||||
|    endfunction: make_from_amber_rule | ||||
|  | ||||
|    Rules hprs[7]; | ||||
|  | ||||
|    hprs[1] = make_from_green_rule(GreenNS, nsGreenDelay, car_present_NS, AmberNS); | ||||
|    hprs[2] = make_from_amber_rule(AmberNS, GreenE); | ||||
|    hprs[3] = make_from_green_rule(GreenE, ewGreenDelay, car_present_E, AmberE); | ||||
|    hprs[4] = make_from_amber_rule(AmberE, GreenW); | ||||
|    hprs[5] = make_from_green_rule(GreenW, ewGreenDelay, car_present_W, AmberW); | ||||
|    hprs[6] = make_from_amber_rule(AmberW, GreenNS); | ||||
|  | ||||
|          hprs[0] = (rules | ||||
|                         rule fromAllRed (state == AllRed && secs >= allRedDelay); | ||||
|                                  if (ped_button_pushed) action | ||||
|                                                 ped_button_pushed <= False; | ||||
|                                                 next_state(GreenPed); | ||||
|                                  endaction else if (car_present(next_green)) | ||||
|                               next_state(next_green); | ||||
|                            else if (car_present(green_seq(next_green))) | ||||
|                                     next_state(green_seq(next_green)); | ||||
|          else if (car_present(green_seq(green_seq(next_green)))) | ||||
|                                     next_state(green_seq(green_seq(next_green))); | ||||
|          else | ||||
|                                     noAction; | ||||
|                         endrule: fromAllRed endrules); | ||||
|  | ||||
|          Rules high_priority_rules = hprs[0]; | ||||
|    for (Integer i = 1; i<7; i=i+1) | ||||
|       high_priority_rules = rJoin(hprs[i], high_priority_rules); | ||||
|  | ||||
|          addRules(preempts(high_priority_rules, low_priority_rule)); | ||||
|  | ||||
|    method Action ped_button_push(); | ||||
|       ped_button_pushed <= True; | ||||
|    endmethod: ped_button_push | ||||
|  | ||||
|    method Action set_car_state_N(b) ; car_present_N <= b; endmethod | ||||
|    method Action set_car_state_S(b) ; car_present_S <= b; endmethod | ||||
|    method Action set_car_state_E(b) ; car_present_E <= b; endmethod | ||||
|    method Action set_car_state_W(b) ; car_present_W <= b; endmethod | ||||
|  | ||||
|    method lampRedNS() = (!(state == GreenNS || state == AmberNS)); | ||||
|    method lampAmberNS() = (state == AmberNS); | ||||
|    method lampGreenNS() = (state == GreenNS); | ||||
|    method lampRedE() = (!(state == GreenE || state == AmberE)); | ||||
|    method lampAmberE() = (state == AmberE); | ||||
|    method lampGreenE() = (state == GreenE); | ||||
|    method lampRedW() = (!(state == GreenW || state == AmberW)); | ||||
|    method lampAmberW() = (state == AmberW); | ||||
|    method lampGreenW() = (state == GreenW); | ||||
|  | ||||
|    method lampRedPed() = (!(state == GreenPed || state == AmberPed)); | ||||
|    method lampAmberPed() = (state == AmberPed); | ||||
|    method lampGreenPed() = (state == GreenPed); | ||||
|  | ||||
| endmodule: sysTL | ||||
|  | ||||
| endpackage: TL | ||||
							
								
								
									
										109
									
								
								samples/Bluespec/TbTL.bsv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								samples/Bluespec/TbTL.bsv
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| package TbTL; | ||||
|  | ||||
| import TL::*; | ||||
|  | ||||
| interface Lamp; | ||||
|    method Bool changed; | ||||
|    method Action show_offs; | ||||
|    method Action show_ons; | ||||
|    method Action reset; | ||||
| endinterface | ||||
|  | ||||
| module mkLamp#(String name, Bool lamp)(Lamp); | ||||
|    Reg#(Bool) prev <- mkReg(False); | ||||
|  | ||||
|    method changed = (prev != lamp); | ||||
|  | ||||
|    method Action show_offs; | ||||
|       if (prev && !lamp) | ||||
|       $write (name + " off, "); | ||||
|    endmethod | ||||
|  | ||||
|    method Action show_ons; | ||||
|       if (!prev && lamp) | ||||
|       $write (name + " on, "); | ||||
|    endmethod | ||||
|  | ||||
|    method Action reset; | ||||
|       prev <= lamp; | ||||
|    endmethod | ||||
| endmodule | ||||
|  | ||||
|  | ||||
| (* synthesize *) | ||||
| module mkTest(); | ||||
|    let dut <- sysTL; | ||||
|  | ||||
|    Reg#(Bit#(16)) ctr <- mkReg(0); | ||||
|  | ||||
|    Reg#(Bool) carN <- mkReg(False); | ||||
|    Reg#(Bool) carS <- mkReg(False); | ||||
|    Reg#(Bool) carE <- mkReg(False); | ||||
|    Reg#(Bool) carW <- mkReg(False); | ||||
|  | ||||
|    Lamp lamps[12]; | ||||
|  | ||||
|    lamps[0] <- mkLamp("0:  NS  red  ", dut.lampRedNS); | ||||
|    lamps[1] <- mkLamp("1:  NS  amber", dut.lampAmberNS); | ||||
|    lamps[2] <- mkLamp("2:  NS  green", dut.lampGreenNS); | ||||
|    lamps[3] <- mkLamp("3:  E   red  ", dut.lampRedE); | ||||
|    lamps[4] <- mkLamp("4:  E   amber", dut.lampAmberE); | ||||
|    lamps[5] <- mkLamp("5:  E   green", dut.lampGreenE); | ||||
|    lamps[6] <- mkLamp("6:  W   red  ", dut.lampRedW); | ||||
|    lamps[7] <- mkLamp("7:  W   amber", dut.lampAmberW); | ||||
|    lamps[8] <- mkLamp("8:  W   green", dut.lampGreenW); | ||||
|  | ||||
|    lamps[9]  <- mkLamp("9:  Ped red  ", dut.lampRedPed); | ||||
|    lamps[10] <- mkLamp("10: Ped amber", dut.lampAmberPed); | ||||
|    lamps[11] <- mkLamp("11: Ped green", dut.lampGreenPed); | ||||
|  | ||||
|    rule start (ctr == 0); | ||||
|       $dumpvars; | ||||
|    endrule | ||||
|  | ||||
|    rule detect_cars; | ||||
|       dut.set_car_state_N(carN); | ||||
|       dut.set_car_state_S(carS); | ||||
|       dut.set_car_state_E(carE); | ||||
|       dut.set_car_state_W(carW); | ||||
|    endrule | ||||
|  | ||||
|    rule go; | ||||
|       ctr <= ctr + 1; | ||||
|       if (ctr == 5000) carN <= True; | ||||
|       if (ctr == 6500) carN <= False; | ||||
|       if (ctr == 12_000) dut.ped_button_push; | ||||
|    endrule | ||||
|  | ||||
|    rule stop (ctr > 32768); | ||||
|       $display("TESTS FINISHED"); | ||||
|       $finish(0); | ||||
|    endrule | ||||
|  | ||||
|    function do_offs(l) = l.show_offs; | ||||
|       function do_ons(l) = l.show_ons; | ||||
|       function do_reset(l) = l.reset; | ||||
|  | ||||
|       function do_it(f); | ||||
|          action | ||||
|          for (Integer i=0; i<12; i=i+1) | ||||
|             f(lamps[i]); | ||||
|          endaction | ||||
|       endfunction | ||||
|  | ||||
|       function any_changes(); | ||||
|          Bool b = False; | ||||
|          for (Integer i=0; i<12; i=i+1) | ||||
|              b = b || lamps[i].changed; | ||||
|          return b; | ||||
|       endfunction | ||||
|  | ||||
|       rule show (any_changes()); | ||||
|       do_it(do_offs); | ||||
|       do_it(do_ons); | ||||
|       do_it(do_reset); | ||||
|       $display("(at time %d)", $time); | ||||
|    endrule | ||||
| endmodule | ||||
|  | ||||
| endpackage | ||||
| @@ -1,39 +0,0 @@ | ||||
| void foo() | ||||
| { | ||||
|   cudaArray* cu_array; | ||||
|   texture<float, 2, cudaReadModeElementType> tex; | ||||
|  | ||||
|   // Allocate array | ||||
|   cudaChannelFormatDesc description = cudaCreateChannelDesc<float>(); | ||||
|   cudaMallocArray(&cu_array, &description, width, height); | ||||
|  | ||||
|   // Copy image data to array | ||||
|   cudaMemcpyToArray(cu_array, image, width*height*sizeof(float), cudaMemcpyHostToDevice); | ||||
|  | ||||
|   // Set texture parameters (default) | ||||
|   tex.addressMode[0] = cudaAddressModeClamp; | ||||
|   tex.addressMode[1] = cudaAddressModeClamp; | ||||
|   tex.filterMode = cudaFilterModePoint; | ||||
|   tex.normalized = false; // do not normalize coordinates | ||||
|  | ||||
|   // Bind the array to the texture | ||||
|   cudaBindTextureToArray(tex, cu_array); | ||||
|  | ||||
|   // Run kernel | ||||
|   dim3 blockDim(16, 16, 1); | ||||
|   dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1); | ||||
|   kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width); | ||||
|  | ||||
|   // Unbind the array from the texture | ||||
|   cudaUnbindTexture(tex); | ||||
| } //end foo() | ||||
|  | ||||
| __global__ void kernel(float* odata, int height, int width) | ||||
| { | ||||
|    unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; | ||||
|    unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; | ||||
|    if (x < width && y < height) { | ||||
|       float c = tex2D(tex, x, y); | ||||
|       odata[y*width+x] = c; | ||||
|    } | ||||
| } | ||||
							
								
								
									
										61
									
								
								samples/C/jni_layer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								samples/C/jni_layer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* DO NOT EDIT THIS FILE - it is machine generated */ | ||||
| #include <jni.h> | ||||
| /* Header for class jni_JniLayer */ | ||||
|  | ||||
| #ifndef _Included_jni_JniLayer | ||||
| #define _Included_jni_JniLayer | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_initialize | ||||
|  * Signature: ([II)J | ||||
|  */ | ||||
| JNIEXPORT jlong JNICALL Java_jni_JniLayer_jni_1layer_1initialize | ||||
|   (JNIEnv *, jobject, jintArray, jint, jint); | ||||
|  | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_mainloop | ||||
|  * Signature: (J)V | ||||
|  */ | ||||
| JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1mainloop | ||||
|   (JNIEnv *, jobject, jlong); | ||||
|  | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_set_button | ||||
|  * Signature: (JII)V | ||||
|  */ | ||||
| JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1set_1button | ||||
|   (JNIEnv *, jobject, jlong, jint, jint); | ||||
|  | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_set_analog | ||||
|  * Signature: (JIIF)V | ||||
|  */ | ||||
| JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1set_1analog | ||||
|   (JNIEnv *, jobject, jlong, jint, jint, jfloat); | ||||
|  | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_report_analog_chg | ||||
|  * Signature: (JI)V | ||||
|  */ | ||||
| JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1report_1analog_1chg | ||||
|   (JNIEnv *, jobject, jlong, jint); | ||||
|  | ||||
| /* | ||||
|  * Class:     jni_JniLayer | ||||
|  * Method:    jni_layer_kill | ||||
|  * Signature: (J)V | ||||
|  */ | ||||
| JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1kill | ||||
|   (JNIEnv *, jobject, jlong); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
| #endif | ||||
							
								
								
									
										5
									
								
								samples/C/syscalldefs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								samples/C/syscalldefs.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| static const syscalldef syscalldefs[] = { | ||||
|         [SYSCALL_OR_NUM(0, SYS_restart_syscall)]        = MAKE_UINT16(0, 1), | ||||
|         [SYSCALL_OR_NUM(1, SYS_exit)]         = MAKE_UINT16(1, 17), | ||||
|         [SYSCALL_OR_NUM(2, SYS_fork)]         = MAKE_UINT16(0, 22), | ||||
| }; | ||||
							
								
								
									
										17
									
								
								samples/Clojure/for.clj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								samples/Clojure/for.clj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| (defn prime? [n] | ||||
|    (not-any? zero? (map #(rem n %) (range 2 n)))) | ||||
|  | ||||
| (range 3 33 2) | ||||
| '(3 5 7 9 11 13 15 17 19 21 23 25 27 29 31) | ||||
|  | ||||
| ;; :when continues through the collection even if some have the | ||||
| ;; condition evaluate to false, like filter | ||||
| (for [x (range 3 33 2) :when (prime? x)] | ||||
|    x) | ||||
| '(3 5 7 11 13 17 19 23 29 31) | ||||
|  | ||||
| ;; :while stops at the first collection element that evaluates to | ||||
| ;; false, like take-while | ||||
| (for [x (range 3 33 2) :while (prime? x)] | ||||
|    x) | ||||
| '(3 5 7) | ||||
							
								
								
									
										8
									
								
								samples/Clojure/hiccup.hic
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								samples/Clojure/hiccup.hic
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| [:html | ||||
|  [:head | ||||
|   [:meta {:charset "utf-8"}] | ||||
|   [:link {:rel "stylesheet" :href "css/bootstrap.min.css"}] | ||||
|   [:script {:src "app.js"}]] | ||||
|  [:body | ||||
|   [:div.nav | ||||
|    [:p "Hello world!"]]]] | ||||
							
								
								
									
										13
									
								
								samples/Clojure/into-array.cljc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								samples/Clojure/into-array.cljc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| (defn into-array | ||||
|   ([aseq] | ||||
|      (into-array nil aseq)) | ||||
|   ([type aseq] | ||||
|      (let [n (count aseq) | ||||
|            a (make-array n)] | ||||
|        (loop [aseq (seq aseq) | ||||
|               i 0] | ||||
|          (if (< i n) | ||||
|            (do | ||||
|              (aset a i (first aseq)) | ||||
|              (recur (next aseq) (inc i))) | ||||
|            a))))) | ||||
							
								
								
									
										15
									
								
								samples/Clojure/protocol.cljs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								samples/Clojure/protocol.cljs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| (defprotocol ISound (sound [])) | ||||
|   | ||||
| (deftype Cat [] | ||||
|   ISound | ||||
|   (sound [_] "Meow!")) | ||||
|   | ||||
| (deftype Dog [] | ||||
|   ISound | ||||
|   (sound [_] "Woof!")) | ||||
|   | ||||
| (extend-type default | ||||
|   ISound | ||||
|   (sound [_] "... silence ...")) | ||||
|   | ||||
| (sound 1) ;; => "... silence ..." | ||||
							
								
								
									
										5
									
								
								samples/Clojure/rand.cljscm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								samples/Clojure/rand.cljscm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| (defn rand | ||||
|   "Returns a random floating point number between 0 (inclusive) and | ||||
|   n (default 1) (exclusive)." | ||||
|   ([] (scm* [n] (random-real))) | ||||
|   ([n] (* (rand) n))) | ||||
							
								
								
									
										20
									
								
								samples/Clojure/svg.cljx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								samples/Clojure/svg.cljx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| ^:clj (ns c2.svg | ||||
|         (:use [c2.core :only [unify]] | ||||
|               [c2.maths :only [Pi Tau radians-per-degree | ||||
|                                sin cos mean]])) | ||||
|  | ||||
| ^:cljs (ns c2.svg | ||||
|          (:use [c2.core :only [unify]] | ||||
|                [c2.maths :only [Pi Tau radians-per-degree | ||||
|                                 sin cos mean]]) | ||||
|          (:require [c2.dom :as dom])) | ||||
|  | ||||
| ;;Stub for float fn, which does not exist on cljs runtime | ||||
| ^:cljs (def float identity) | ||||
|  | ||||
| (defn ->xy | ||||
|   "Convert coordinates (potentially map of `{:x :y}`) to 2-vector." | ||||
|   [coordinates] | ||||
|   (cond | ||||
|    (and (vector? coordinates) (= 2 (count coordinates))) coordinates | ||||
|    (map? coordinates) [(:x coordinates) (:y coordinates)])) | ||||
							
								
								
									
										20
									
								
								samples/Clojure/unit-test.cl2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								samples/Clojure/unit-test.cl2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| (deftest function-tests | ||||
|   (is (= 3 | ||||
|          (count [1 2 3]))) | ||||
|   (is (= false | ||||
|          (not true))) | ||||
|   (is (= true | ||||
|          (contains? {:foo 1 :bar 2} :foo))) | ||||
|  | ||||
|   (is (= {"foo" 1, "baz" 3} | ||||
|          (select-keys {:foo 1 :bar 2 :baz 3} [:foo :baz]))) | ||||
|  | ||||
|   (is (= [1 2 3] | ||||
|          (vals {:foo 1 :bar 2 :baz 3}))) | ||||
|  | ||||
|   (is (= ["foo" "bar" "baz"] | ||||
|          (keys {:foo 1 :bar 2 :baz 3}))) | ||||
|  | ||||
|   (is (= [2 4 6] | ||||
|          (filter (fn [x] (=== (rem x 2) 0)) [1 2 3 4 5 6])))) | ||||
|  | ||||
							
								
								
									
										21
									
								
								samples/Common Lisp/sample.lisp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								samples/Common Lisp/sample.lisp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| ;;;; -*- lisp -*- | ||||
|  | ||||
| (in-package :foo) | ||||
|  | ||||
| ;;; Header comment. | ||||
| (defvar *foo*) | ||||
|  | ||||
| (eval-when (:execute :compile-toplevel :load-toplevel) | ||||
|   (defun add (x &optional y &key z) | ||||
|     (declare (ignore z)) | ||||
|     ;; Inline comment. | ||||
|     (+ x (or y 1)))) | ||||
|  | ||||
| #| | ||||
| Multi-line comment. | ||||
| |# | ||||
|  | ||||
| (defmacro foo (x &body b) | ||||
|   (if x | ||||
|       `(1+ ,x)   ;After-line comment. | ||||
|       42)) | ||||
| @@ -1,47 +0,0 @@ | ||||
| = Creole | ||||
|  | ||||
| Creole is a Creole-to-HTML converter for Creole, the lightweight markup | ||||
| language (http://wikicreole.org/). Github uses this converter to render *.creole files. | ||||
|  | ||||
| Project page on github: | ||||
|  | ||||
| * http://github.com/minad/creole | ||||
|  | ||||
| Travis-CI: | ||||
|  | ||||
| * https://travis-ci.org/minad/creole | ||||
|  | ||||
| RDOC: | ||||
|  | ||||
| * http://rdoc.info/projects/minad/creole | ||||
|  | ||||
| == INSTALLATION | ||||
|  | ||||
| {{{ | ||||
| gem install creole | ||||
| }}} | ||||
|  | ||||
| == SYNOPSIS | ||||
|  | ||||
| {{{ | ||||
| require 'creole' | ||||
| html = Creole.creolize('== Creole text') | ||||
| }}} | ||||
|  | ||||
| == BUGS | ||||
|  | ||||
| If you found a bug, please report it at the Creole project's tracker | ||||
| on GitHub: | ||||
|  | ||||
| http://github.com/minad/creole/issues | ||||
|  | ||||
| == AUTHORS | ||||
|  | ||||
| * Lars Christensen (larsch) | ||||
| * Daniel Mendler (minad) | ||||
|  | ||||
| == LICENSE | ||||
|  | ||||
| Creole is Copyright (c) 2008 - 2013 Lars Christensen, Daniel Mendler. It is free software, and | ||||
| may be redistributed under the terms specified in the README file of | ||||
| the Ruby distribution. | ||||
							
								
								
									
										52
									
								
								samples/Cuda/scalarProd_kernel.cuh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								samples/Cuda/scalarProd_kernel.cuh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| __global__ void scalarProdGPU( | ||||
|     float *d_C, | ||||
|     float *d_A, | ||||
|     float *d_B, | ||||
|     int vectorN, | ||||
|     int elementN | ||||
| ) | ||||
| { | ||||
|     //Accumulators cache | ||||
|     __shared__ float accumResult[ACCUM_N]; | ||||
|  | ||||
|     //////////////////////////////////////////////////////////////////////////// | ||||
|     // Cycle through every pair of vectors, | ||||
|     // taking into account that vector counts can be different | ||||
|     // from total number of thread blocks | ||||
|     //////////////////////////////////////////////////////////////////////////// | ||||
|     for (int vec = blockIdx.x; vec < vectorN; vec += gridDim.x) | ||||
|     { | ||||
|         int vectorBase = IMUL(elementN, vec); | ||||
|         int vectorEnd  = vectorBase + elementN; | ||||
|  | ||||
|         //////////////////////////////////////////////////////////////////////// | ||||
|         // Each accumulator cycles through vectors with | ||||
|         // stride equal to number of total number of accumulators ACCUM_N | ||||
|         // At this stage ACCUM_N is only preferred be a multiple of warp size | ||||
|         // to meet memory coalescing alignment constraints. | ||||
|         //////////////////////////////////////////////////////////////////////// | ||||
|         for (int iAccum = threadIdx.x; iAccum < ACCUM_N; iAccum += blockDim.x) | ||||
|         { | ||||
|             float sum = 0; | ||||
|  | ||||
|             for (int pos = vectorBase + iAccum; pos < vectorEnd; pos += ACCUM_N) | ||||
|                 sum += d_A[pos] * d_B[pos]; | ||||
|  | ||||
|             accumResult[iAccum] = sum; | ||||
|         } | ||||
|  | ||||
|         //////////////////////////////////////////////////////////////////////// | ||||
|         // Perform tree-like reduction of accumulators' results. | ||||
|         // ACCUM_N has to be power of two at this stage | ||||
|         //////////////////////////////////////////////////////////////////////// | ||||
|         for (int stride = ACCUM_N / 2; stride > 0; stride >>= 1) | ||||
|         { | ||||
|             __syncthreads(); | ||||
|  | ||||
|             for (int iAccum = threadIdx.x; iAccum < stride; iAccum += blockDim.x) | ||||
|                 accumResult[iAccum] += accumResult[stride + iAccum]; | ||||
|         } | ||||
|  | ||||
|         if (threadIdx.x == 0) d_C[vec] = accumResult[0]; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										46
									
								
								samples/Cuda/vectorAdd.cu
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								samples/Cuda/vectorAdd.cu
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| #include <stdio.h> | ||||
| #include <cuda_runtime.h> | ||||
|  | ||||
| /** | ||||
|  * CUDA Kernel Device code | ||||
|  * | ||||
|  * Computes the vector addition of A and B into C. The 3 vectors have the same | ||||
|  * number of elements numElements. | ||||
|  */ | ||||
| __global__ void | ||||
| vectorAdd(const float *A, const float *B, float *C, int numElements) | ||||
| { | ||||
|     int i = blockDim.x * blockIdx.x + threadIdx.x; | ||||
|  | ||||
|     if (i < numElements) | ||||
|     { | ||||
|         C[i] = A[i] + B[i]; | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Host main routine | ||||
|  */ | ||||
| int | ||||
| main(void) | ||||
| { | ||||
|     // Error code to check return values for CUDA calls | ||||
|     cudaError_t err = cudaSuccess; | ||||
|  | ||||
|     // Launch the Vector Add CUDA Kernel | ||||
|     int threadsPerBlock = 256; | ||||
|     int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; | ||||
|     vectorAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, numElements); | ||||
|     err = cudaGetLastError(); | ||||
|  | ||||
|     if (err != cudaSuccess) | ||||
|     { | ||||
|         fprintf(stderr, "Failed to launch vectorAdd kernel (error code %s)!\n", cudaGetErrorString(err)); | ||||
|         exit(EXIT_FAILURE); | ||||
|     } | ||||
|  | ||||
|     // Reset the device and exit | ||||
|     err = cudaDeviceReset(); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										87
									
								
								samples/DM/example.dm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								samples/DM/example.dm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| // This is a single line comment. | ||||
| /* | ||||
| 	This is a multi-line comment | ||||
| */ | ||||
|  | ||||
| // Pre-processor keywords | ||||
|  | ||||
| #define PI 3.1415 | ||||
|  | ||||
| #if PI == 4 | ||||
|  | ||||
| #define G 5 | ||||
|  | ||||
| #elif PI == 3 | ||||
|  | ||||
| #define I 6 | ||||
|  | ||||
| #else | ||||
|  | ||||
| #define K 7 | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| var/GlobalCounter = 0 | ||||
| var/const/CONST_VARIABLE = 2 | ||||
| var/list/MyList = list("anything", 1, new /datum/entity) | ||||
| var/list/EmptyList[99] // creates a list of 99 null entries | ||||
| var/list/NullList = null | ||||
|  | ||||
| /* | ||||
| 	Entity Class | ||||
| */ | ||||
|  | ||||
| /datum/entity | ||||
| 	var/name = "Entity" | ||||
| 	var/number = 0 | ||||
|  | ||||
| /datum/entity/proc/myFunction() | ||||
| 	world.log << "Entity has called myFunction" | ||||
|  | ||||
| /datum/entity/New() | ||||
| 	number = GlobalCounter++ | ||||
|  | ||||
| /* | ||||
| 	Unit Class, Extends from Entity | ||||
| */ | ||||
|  | ||||
| /datum/entity/unit | ||||
| 	name = "Unit" | ||||
|  | ||||
| /datum/entity/unit/New() | ||||
| 	..() // calls the parent's proc; equal to super() and base() in other languages | ||||
| 	number = rand(1, 99) | ||||
|  | ||||
| /datum/entity/unit/myFunction() | ||||
| 	world.log << "Unit has overriden and called myFunction" | ||||
|  | ||||
| // Global Function | ||||
| /proc/ReverseList(var/list/input) | ||||
| 	var/list/output = list() | ||||
| 	for(var/i = input.len; i >= 1; i--) // IMPORTANT: List Arrays count from 1. | ||||
| 		output += input[i] // "+= x" is ".Add(x)" | ||||
| 	return output | ||||
|  | ||||
| // Bitflags | ||||
| /proc/DoStuff() | ||||
| 	var/bitflag = 0 | ||||
| 	bitflag |= 8 | ||||
| 	return bitflag | ||||
|  | ||||
| /proc/DoOtherStuff() | ||||
| 	var/bitflag = 65535 // 16 bits is the maximum amount | ||||
| 	bitflag &= ~8 | ||||
| 	return bitflag | ||||
|  | ||||
| // Logic | ||||
| /proc/DoNothing() | ||||
| 	var/pi = PI | ||||
| 	if(pi == 4) | ||||
| 		world.log << "PI is 4" | ||||
| 	else if(pi == CONST_VARIABLE) | ||||
| 		world.log << "PI is [CONST_VARIABLE]!" | ||||
| 	else | ||||
| 		world.log << "PI is approximety [pi]" | ||||
|  | ||||
| #undef PI // Undefine PI | ||||
							
								
								
									
										42
									
								
								samples/Idris/Chars.idr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								samples/Idris/Chars.idr
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| module Prelude.Char | ||||
|  | ||||
| import Builtins | ||||
|  | ||||
| isUpper : Char -> Bool | ||||
| isUpper x = x >= 'A' && x <= 'Z' | ||||
|  | ||||
| isLower : Char -> Bool | ||||
| isLower x = x >= 'a' && x <= 'z' | ||||
|  | ||||
| isAlpha : Char -> Bool | ||||
| isAlpha x = isUpper x || isLower x | ||||
|  | ||||
| isDigit : Char -> Bool | ||||
| isDigit x = (x >= '0' && x <= '9') | ||||
|  | ||||
| isAlphaNum : Char -> Bool | ||||
| isAlphaNum x = isDigit x || isAlpha x | ||||
|  | ||||
| isSpace : Char -> Bool | ||||
| isSpace x = x == ' '  || x == '\t' || x == '\r' || | ||||
|             x == '\n' || x == '\f' || x == '\v' || | ||||
|             x == '\xa0' | ||||
|  | ||||
| isNL : Char -> Bool | ||||
| isNL x = x == '\r' || x == '\n' | ||||
|  | ||||
| toUpper : Char -> Char | ||||
| toUpper x = if (isLower x) | ||||
|                then (prim__intToChar (prim__charToInt x - 32)) | ||||
|                else x | ||||
|  | ||||
| toLower : Char -> Char | ||||
| toLower x = if (isUpper x) | ||||
|                then (prim__intToChar (prim__charToInt x + 32)) | ||||
|                else x | ||||
|  | ||||
| isHexDigit : Char -> Bool | ||||
| isHexDigit x = elem (toUpper x) hexChars where | ||||
|   hexChars : List Char | ||||
|   hexChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | ||||
|               'A', 'B', 'C', 'D', 'E', 'F'] | ||||
							
								
								
									
										3
									
								
								samples/Jade/hello.jade
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								samples/Jade/hello.jade
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| p. | ||||
|   Hello, | ||||
|   World! | ||||
							
								
								
									
										15
									
								
								samples/KRL/helloworld.krl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								samples/KRL/helloworld.krl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| ruleset sample { | ||||
|   meta { | ||||
|     name "Hello World" | ||||
|     description << | ||||
| Hello world | ||||
| >> | ||||
|     author "Phil Windley" | ||||
|   } | ||||
|  | ||||
|   // just one rule | ||||
|   rule hello { | ||||
|     select when web pageview | ||||
|     notify("Hello world!", "Just a note to say hello"); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										82
									
								
								samples/Literate Agda/NatCat.lagda
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								samples/Literate Agda/NatCat.lagda
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,82 @@ | ||||
| \documentclass{article} | ||||
|  | ||||
|  % The following packages are needed because unicode | ||||
|  % is translated (using the next set of packages) to | ||||
|  % latex commands. You may need more packages if you | ||||
|  % use more unicode characters: | ||||
|  | ||||
|  \usepackage{amssymb} | ||||
|  \usepackage{bbm} | ||||
|  \usepackage[greek,english]{babel} | ||||
|  | ||||
|  % This handles the translation of unicode to latex: | ||||
|  | ||||
|  \usepackage{ucs} | ||||
|  \usepackage[utf8x]{inputenc} | ||||
|  \usepackage{autofe} | ||||
|  | ||||
|  % Some characters that are not automatically defined | ||||
|  % (you figure out by the latex compilation errors you get), | ||||
|  % and you need to define: | ||||
|  | ||||
|  \DeclareUnicodeCharacter{8988}{\ensuremath{\ulcorner}} | ||||
|  \DeclareUnicodeCharacter{8989}{\ensuremath{\urcorner}} | ||||
|  \DeclareUnicodeCharacter{8803}{\ensuremath{\overline{\equiv}}} | ||||
|  | ||||
|  % Add more as you need them (shouldn’t happen often). | ||||
|  | ||||
|  % Using “\newenvironment” to redefine verbatim to | ||||
|  % be called “code” doesn’t always work properly.  | ||||
|  % You can more reliably use: | ||||
|  | ||||
|  \usepackage{fancyvrb} | ||||
|  | ||||
|  \DefineVerbatimEnvironment | ||||
|    {code}{Verbatim} | ||||
|    {} % Add fancy options here if you like. | ||||
|  | ||||
|  \begin{document} | ||||
|  | ||||
|  \begin{code} | ||||
| module NatCat where | ||||
|  | ||||
| open import Relation.Binary.PropositionalEquality | ||||
|  | ||||
| -- If you can show that a relation only ever has one inhabitant | ||||
| -- you get the category laws for free | ||||
| module | ||||
|   EasyCategory | ||||
|   (obj : Set) | ||||
|   (_⟶_ : obj → obj → Set) | ||||
|   (_∘_ : ∀ {x y z} → x ⟶ y → y ⟶ z → x ⟶ z) | ||||
|   (id : ∀ x → x ⟶ x) | ||||
|   (single-inhabitant : (x y : obj) (r s : x ⟶ y) → r ≡ s) | ||||
|   where | ||||
|  | ||||
|   idʳ : ∀ x y (r : x ⟶ y) → r ∘ id y ≡ r | ||||
|   idʳ x y r = single-inhabitant x y (r ∘ id y) r  | ||||
|  | ||||
|   idˡ : ∀ x y (r : x ⟶ y) → id x ∘ r ≡ r | ||||
|   idˡ x y r = single-inhabitant x y (id x ∘ r) r | ||||
|  | ||||
|   ∘-assoc : ∀ w x y z (r : w ⟶ x) (s : x ⟶ y) (t : y ⟶ z) → (r ∘ s) ∘ t ≡ r ∘ (s ∘ t) | ||||
|   ∘-assoc w x y z r s t = single-inhabitant w z ((r ∘ s) ∘ t) (r ∘ (s ∘ t)) | ||||
|  | ||||
| open import Data.Nat | ||||
|  | ||||
| same : (x y : ℕ) (r s : x ≤ y) → r ≡ s | ||||
| same .0 y z≤n z≤n = refl | ||||
| same .(suc m) .(suc n) (s≤s {m} {n} r) (s≤s s) = cong s≤s (same m n r s) | ||||
|  | ||||
| ≤-trans : ∀ x y z → x ≤ y → y ≤ z → x ≤ z | ||||
| ≤-trans .0 y z z≤n s = z≤n | ||||
| ≤-trans .(suc m) .(suc n) .(suc n₁) (s≤s {m} {n} r) (s≤s {.n} {n₁} s) = s≤s (≤-trans m n n₁ r s) | ||||
|  | ||||
| ≤-refl : ∀ x → x ≤ x | ||||
| ≤-refl zero = z≤n | ||||
| ≤-refl (suc x) = s≤s (≤-refl x) | ||||
|  | ||||
| module Nat-EasyCategory = EasyCategory ℕ _≤_ (λ {x}{y}{z} → ≤-trans x y z) ≤-refl same | ||||
|  \end{code} | ||||
|  | ||||
|  \end{document}  | ||||
| @@ -1,90 +0,0 @@ | ||||
|  | ||||
| = Overview = | ||||
|  | ||||
| The GDB Tracepoint Analysis feature is an extension to the Tracing and Monitoring Framework that allows the visualization and analysis of C/C++ tracepoint data collected by GDB and stored to a log file. | ||||
|  | ||||
| = Getting Started = | ||||
|  | ||||
| The feature can be installed from the Eclipse update site by selecting '''Linux Tools''' > '''GDB Tracepoint Analysis'''. | ||||
|  | ||||
| The feature requires GDB version 7.2 or later to be installed on the local host. The executable program 'gdb' must be found in the path. | ||||
|  | ||||
| = GDB Trace Perspective = | ||||
|  | ||||
| To open the perspective, select '''Window''' > '''Open Perspective''' > '''Other...''' > '''GDB Trace'''. | ||||
|  | ||||
| The perspective includes the following views by default: | ||||
|  | ||||
| * '''Project Explorer''': This view shows the projects in the workspace and is used to create and manage Tracing projects. | ||||
| * '''Debug''': This view shows the running C/C++ Postmortem Debugger instances and displays the thread and stack trace associated with a tracepoint. | ||||
| * '''Trace Control''': This view shows the status of the debugger and allows navigation of trace records. | ||||
| * '''Console''': This view displays console output of the C/C++ Postmortem Debugger. | ||||
|  | ||||
| The editor area contains the '''Events''' and '''C/C++''' editors when a GDB Trace is opened. | ||||
|  | ||||
| [[Image:images/GDBTracePerspective.png]] | ||||
|  | ||||
| = Collecting Tracepoint Data = | ||||
|  | ||||
| Collecting the C/C++ tracepoint data is outside the scope of this feature. It can be done from the GDB command line or by using the CDT debug component within Eclipse. See the CDT FAQ entry in the [[#References | References]] section. | ||||
|  | ||||
| = Importing Tracepoint Data = | ||||
|  | ||||
| Some information in this section is redundant with the LTTng User Guide. For further details, see the LTTng User Guide entry in the [[#References | References]] section. | ||||
|  | ||||
| == Creating a Tracing Project == | ||||
|  | ||||
| In the '''Project Explorer''' view, right-click and select '''New''' > '''Project...''' from the context menu. In the '''New Project''' dialog, select '''Tracing''' > '''Tracing Project''', click '''Next''', name your project and click '''Finish'''. | ||||
|  | ||||
| == Importing a GDB Trace == | ||||
|  | ||||
| In your tracing project, right-click on the '''Traces''' folder and select '''Import...'''. Browse to, or enter, a source directory. Select the trace file in the tree. Optionally set the trace type to '''GDB : GDB Trace'''. Click '''Finish'''. | ||||
|  | ||||
| Alternatively, the trace can be drag & dropped to the '''Traces''' folder from any external file manager. | ||||
|  | ||||
| == Selecting the GDB Trace Type == | ||||
|  | ||||
| Right-click the imported trace in the '''Traces''' folder and choose '''Select Trace Type...''' > '''GDB''' > '''GDB Trace''' from the context menu. This step can be omitted if the trace type was selected at import. | ||||
|  | ||||
| The trace will be updated with the GDB icon [[Image:images/gdb_icon16.png]]. | ||||
|  | ||||
| == Selecting the Trace Executable == | ||||
|  | ||||
| The executable file that created the tracepoint data must be identified so that the C/C++ Postmortem Debugger can be launched properly. | ||||
|  | ||||
| Right-click the GDB trace in the '''Traces''' folder and choose '''Select Trace Executable...''' from the context menu. Browse to, or enter, the path of the executable file and press '''OK'''. | ||||
|  | ||||
| The selected file must be recognized by GDB as an executable. | ||||
|  | ||||
| = Visualizing Tracepoint Data = | ||||
|  | ||||
| == Opening a GDB Trace == | ||||
|  | ||||
| In the '''Traces''' folder, double-click the GDB trace or right-click it and select '''Open''' from the context menu. | ||||
|  | ||||
| The tracepoint data will be opened in an Events editor, and a C/C++ Postmortem Debugger instance will be launched. | ||||
|  | ||||
| If available in the workspace, the source code corresponding to the first trace record will also be opened in a C/C++ editor. | ||||
|  | ||||
| At this point it is recommended to relocate the Events editor outside of the default editor area, so that it is not hidden by the C/C++ editor. | ||||
|  | ||||
| == Viewing Trace Data == | ||||
|  | ||||
| In the Events editor, a table is shown with one row for each trace record. The '''Trace Frame''' column shows the sequential trace record number. The '''Tracepoint''' column shows the number assigned by GDB at collection time for this tracepoint. The '''File''' column shows the file name, line number and method where the tracepoint was set. The '''Content''' column shows the data collected at run-time by the tracepoint. | ||||
|  | ||||
| Searching and filtering can be done on any column by entering a regular expression in the column header. | ||||
|  | ||||
| == Navigating the GDB Trace == | ||||
|  | ||||
| Trace records can be selected in the Events editor using the keyboard or mouse. The C/C++ Postmortem Debugger in the '''Debug''' view will be updated to show the stack trace of the current trace record. | ||||
|  | ||||
| The trace can also be navigated from the '''Trace Control''' view by clicking the '''Next Trace Record''' or '''Previous Trace Record''' buttons. The Events editor and '''Debug''' views will be updated. | ||||
|  | ||||
| = References = | ||||
|  | ||||
| * [http://wiki.eclipse.org/index.php/Linux_Tools_Project/LTTng2/User_Guide LTTng User Guide] | ||||
| * [http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_trace_my_application_using_C.2FC.2B.2B_Tracepoints.3F CDT FAQ - How can I trace my application using C/C++ Tracepoints?] | ||||
|  | ||||
| = Updating This Document = | ||||
|  | ||||
| This document is maintained in a collaborative wiki.  If you wish to update or modify this document please visit [http://wiki.eclipse.org/index.php/Linux_Tools_Project/GDB_Tracepoint_Analysis/User_Guide http://wiki.eclipse.org/Linux_Tools_Project/GDB_Tracepoint_Analysis/User_Guide] | ||||
							
								
								
									
										23
									
								
								samples/OpenCL/sample.cl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								samples/OpenCL/sample.cl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| /* Old-style comment. */ | ||||
|  | ||||
| // New-style comment. | ||||
|  | ||||
| typedef float foo_t; | ||||
|  | ||||
| #ifndef ZERO | ||||
| #define ZERO (0.0) | ||||
| #endif | ||||
|  | ||||
| #define FOO(x) ((x) + \ | ||||
|   ZERO) | ||||
|  | ||||
| __kernel | ||||
| void foo(__global const foo_t * x, __local foo_t y, const uint n) | ||||
| { | ||||
|   barrier(CLK_LOCAL_MEM_FENCE); | ||||
|  | ||||
|   if (n > 42) { | ||||
|     *x += y; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -1,164 +0,0 @@ | ||||
| #+OPTIONS:    H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc | ||||
| #+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate | ||||
| #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@) | ||||
| #+TAGS:       Write(w) Update(u) Fix(f) Check(c) | ||||
| #+TITLE:      org-ruby | ||||
| #+AUTHOR:     Brian Dewey | ||||
| #+EMAIL:      bdewey@gmail.com | ||||
| #+LANGUAGE:   en | ||||
| #+PRIORITIES: A C B | ||||
| #+CATEGORY:   worg | ||||
|  | ||||
| {Back to Worg's index} | ||||
|  | ||||
| * Motivation | ||||
|  | ||||
|   The dominant simple plain-text markup languages for the web are | ||||
|   Textile and Markdown. A factor for the popularity of those markup | ||||
|   formats is the widespread availability of simple, free packages for | ||||
|   converting the formats to HTML. For example, the world of | ||||
|   Ruby-powered websites has settled on RedCloth for converting Textile | ||||
|   to HTML. | ||||
|  | ||||
|   The default way to convert org-mode files to HTML is the powerful | ||||
|   publishing functionality provided by =emacs=. However, =emacs= does | ||||
|   not easiliy integrate into many existing website frameworks. | ||||
|  | ||||
|   =Org-ruby= tries to make it easier to use org-mode files in both | ||||
|   dyanmic and static website generation tools written in | ||||
|   Ruby. =Org-ruby= is a simple Ruby gem to convert org-mode files to | ||||
|   HTML. | ||||
|  | ||||
| * Using Org-ruby | ||||
|  | ||||
|   =Org-ruby= follows the same model as other Ruby markup | ||||
|   libraries. You install the gem: | ||||
|  | ||||
|   #+BEGIN_EXAMPLE | ||||
|   sudo gem install org-ruby | ||||
|   #+END_EXAMPLE | ||||
|  | ||||
|   Then, to convert an org-file to HTML in your Ruby code: | ||||
|  | ||||
|   #+BEGIN_EXAMPLE | ||||
|   require 'rubygems' | ||||
|   require 'org-ruby' | ||||
|  | ||||
|   data = IO.read(filename) | ||||
|   puts Orgmode::Parser.new(data).to_html | ||||
|   #+END_EXAMPLE | ||||
|  | ||||
| * Walkthrough: Using org-ruby with Webby | ||||
|  | ||||
|   Here is an example of how to integrate =org-ruby= into Webby, a | ||||
|   static website generation tool written in Ruby. | ||||
|  | ||||
|   Webby follows a similar pattern to other static site generation | ||||
|   tools (like nanoc, Jekyll, and webgen): | ||||
|  | ||||
|   - You author website content in text with simple markup | ||||
|   - Each page is fed through one or more /filters/ to produce HTML | ||||
|   - The HTML is mixed in with layouts to produce the final pages | ||||
|  | ||||
|   For a Webby site, a the source for a page may look like this: | ||||
|  | ||||
|   #+BEGIN_EXAMPLE | ||||
|   --- | ||||
|   title:           Special Directories | ||||
|   created_at:      2009-12-17 | ||||
|   status:          Complete | ||||
|   filter: | ||||
|     - erb | ||||
|     - maruku | ||||
|   tags: | ||||
|     - powershell | ||||
|   --- | ||||
|   <%= @page.title %> | ||||
|   ================== | ||||
|  | ||||
|   Special Directories are a set of directories, each of which has a | ||||
|   function that will navigate you to the appropriate directory using | ||||
|   the push-location cmdlet. For example, the function `home` might | ||||
|   navigate to `c:\users\bdewey.` | ||||
|  | ||||
|   Install | ||||
|   ------- | ||||
|  | ||||
|   Copy the module to somewhere in `ENV:PSModulePath`. Then, | ||||
|  | ||||
|       InstallModule SpecialDirectories | ||||
|   #+END_EXAMPLE | ||||
|  | ||||
|   In the above example, the text is written in Markdown. At the top of | ||||
|   the file, metadata informs Webby to pass the text through two | ||||
|   /filters/ to produce HTML. The first filter, =erb=, handles embedded | ||||
|   Ruby. In this case, it will replace ~<%= @page.title %>~ with the | ||||
|   page title (=Special Directories=). The second filter uses Maruku to | ||||
|   translate Markdown into HTML. | ||||
|  | ||||
|   You can use the exact same pattern to include org-mode files in a | ||||
|   Webby site. For this walkthrough, I assume you already have Webby | ||||
|   installed, and that you've already created a site. | ||||
|  | ||||
|   1. Make sure you have =org-ruby= installed: =sudo gem install | ||||
|      org-ruby=. | ||||
|   2. You need to register a new Webby filter to handle org-mode | ||||
|      content. Webby makes this easy. In the =lib/= folder of your | ||||
|      site, create a file =orgmode.rb=: | ||||
|  | ||||
|      #+BEGIN_EXAMPLE | ||||
|      require 'org-ruby' | ||||
|  | ||||
|      Webby::Filters.register :org do |input| | ||||
|        Orgmode::Parser.new(input).to_html | ||||
|      end | ||||
|      #+END_EXAMPLE | ||||
|  | ||||
|      This code creates a new filter, =org=, that will use the | ||||
|      =org-ruby= parser to translate org-mode input into HTML. | ||||
|   3. Create your content. For example: | ||||
|  | ||||
|      #+BEGIN_EXAMPLE | ||||
| --- | ||||
| title:              Orgmode Parser | ||||
| created_at:         2009-12-21 | ||||
| status:             Under development | ||||
| filter: | ||||
|   - erb | ||||
|   - org | ||||
| tags: | ||||
|   - orgmode | ||||
|   - ruby | ||||
| --- | ||||
| <%= @page.title %> | ||||
|  | ||||
|   Status: <%= @page.status %> | ||||
|  | ||||
| * Description | ||||
|  | ||||
|   Helpful Ruby routines for parsing orgmode files. The most | ||||
|   significant thing this library does today is convert orgmode files | ||||
|   to textile. Currently, you cannot do much to customize the | ||||
|   conversion. The supplied textile conversion is optimized for | ||||
|   extracting "content" from the orgfile as opposed to "metadata." | ||||
|  | ||||
|  | ||||
| * History | ||||
|  | ||||
| ** 2009-12-29: Version 0.4 | ||||
|  | ||||
|    - The first thing output in HTML gets the class "title" | ||||
|    - HTML output is now indented | ||||
|    - Proper support for multi-paragraph list items. | ||||
|  | ||||
|      See? This paragraph is part of the last bullet. | ||||
|  | ||||
|    - Fixed bugs: | ||||
|      - "rake spec" wouldn't work on Linux. Needed "require 'rubygems'". | ||||
|        #+END_EXAMPLE | ||||
|  | ||||
|      This file will go through the =erb= and =org= filters; as defined | ||||
|      in the previous step, the =org= filter will use =org-ruby= to | ||||
|      generate HTML. | ||||
|  | ||||
|   That's all there is to it! | ||||
							
								
								
									
										55
									
								
								samples/Oxygene/Loops.oxygene
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								samples/Oxygene/Loops.oxygene
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <PropertyGroup> | ||||
|     <RootNamespace>Loops</RootNamespace> | ||||
|     <OutputType>exe</OutputType> | ||||
|     <AssemblyName>Loops</AssemblyName> | ||||
|     <AllowGlobals>False</AllowGlobals> | ||||
|     <AllowLegacyOutParams>False</AllowLegacyOutParams> | ||||
|     <AllowLegacyCreate>False</AllowLegacyCreate> | ||||
|     <ApplicationIcon>Properties\App.ico</ApplicationIcon> | ||||
|     <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> | ||||
|     <ProjectGuid>{916BD89C-B610-4CEE-9CAF-C515D88E2C94}</ProjectGuid> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||||
|     <DefineConstants>DEBUG;TRACE;</DefineConstants> | ||||
|     <OutputPath>.\bin\Debug</OutputPath> | ||||
|     <GeneratePDB>True</GeneratePDB> | ||||
|     <GenerateMDB>True</GenerateMDB> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||||
|     <OutputPath>.\bin\Release</OutputPath> | ||||
|     <EnableAsserts>False</EnableAsserts> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Oxygene\RemObjects.Oxygene.targets" /> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="mscorlib"> | ||||
|       <HintPath>$(Framework)\mscorlib.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System"> | ||||
|       <HintPath>$(Framework)\System.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Core"> | ||||
|       <HintPath>$(ProgramFiles)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Data"> | ||||
|       <HintPath>$(Framework)\System.Data.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Xml"> | ||||
|       <HintPath>$(Framework)\System.Xml.dll</HintPath> | ||||
|     </Reference> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Program.pas" /> | ||||
|     <Content Include="Properties\App.ico" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.pas" /> | ||||
|     <EmbeddResource Include="Properties\Resources.resx"> | ||||
|       <Generator>ResXFileCodeGenerator</Generator> | ||||
|     </EmbeddResource> | ||||
|     <Compile Include="Properties\Resources.Designer.pas" /> | ||||
|     <None Include="Properties\Settings.settings"> | ||||
|       <Generator>SettingsSingleFileGenerator</Generator> | ||||
|     </None> | ||||
|     <Compile Include="Properties\Settings.Designer.pas" /> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										125
									
								
								samples/Oxygene/Program.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								samples/Oxygene/Program.pas
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | ||||
| namespace Loops; | ||||
|  | ||||
| interface | ||||
|  | ||||
| uses System.Linq; | ||||
|  | ||||
| type | ||||
|   ConsoleApp = class | ||||
|   public | ||||
|     class method Main; | ||||
|     method loopsTesting; | ||||
|     method fillData : sequence of Country; | ||||
|   var  | ||||
|     Countries : sequence of Country; | ||||
|   end; | ||||
|  | ||||
| type  | ||||
|   Country = public class | ||||
|   public | ||||
|     property Name : String; | ||||
|     property Capital : String; | ||||
|  | ||||
|     constructor (setName : String; setCapital : String); | ||||
|   end; | ||||
| implementation | ||||
|  | ||||
| class method ConsoleApp.Main; | ||||
| begin | ||||
|   Console.WriteLine('Loops example'); | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   with myConsoleApp := new ConsoleApp() do | ||||
|      myConsoleApp.loopsTesting; | ||||
| end; | ||||
|  | ||||
| method ConsoleApp.loopsTesting; | ||||
| begin | ||||
|   {---------------------------------} | ||||
|   {"for" loop, taking every 5th item} | ||||
|   for i : Int32 :=0 to 50 step 5 do  | ||||
|   begin | ||||
|     Console.Write(i); Console.Write(' '); | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); Console.WriteLine(); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {"for" loop, going from high to low value} | ||||
|   for i : Int32 := 10 downto 1 do | ||||
|   begin | ||||
|     Console.Write(i); Console.Write(' '); | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); Console.WriteLine(); | ||||
|  | ||||
|   Countries := fillData; | ||||
|    | ||||
|   {---------------------------------} | ||||
|   {loop with defined "index" variable, which will count from 0 through the number of elements looped} | ||||
|   Console.WriteLine('Countries: '); | ||||
|   for each c in Countries index num do  | ||||
|     Console.WriteLine(Convert.ToString(num + 1) + ') ' + c.Name); | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   Console.WriteLine('Cities: '); | ||||
|   var ind : Integer :=0; | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {simple "loop" construct that loops endlessly, until broken out of} | ||||
|   loop | ||||
|   begin | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Capital); | ||||
|     Inc(ind); | ||||
|     if ind = Countries.Count then break; | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {the type of 'c' is inferred automatically} | ||||
|   for each c in Countries do | ||||
|     Console.WriteLine(c.Capital + ' is the capital of ' + c.Name); | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   ind := 0; | ||||
|   Console.WriteLine('Cities: '); | ||||
|  | ||||
|   {"repeat ... until" loop} | ||||
|   repeat  | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Capital); | ||||
|     Inc(ind); | ||||
|   until ind = Countries.Count; | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   ind := 0; | ||||
|   Console.WriteLine('Countries: '); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {"while ... do" loop} | ||||
|   while ind < Countries.Count do | ||||
|   begin | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Name); | ||||
|     Inc(ind); | ||||
|   end; | ||||
|  | ||||
|   Console.ReadLine(); | ||||
| end; | ||||
|  | ||||
| method ConsoleApp.fillData: sequence of Country; | ||||
| begin | ||||
|   result := [new Country('UK', 'London'), new Country('USA', 'Washington'), new Country('Germany', 'Berlin'),  | ||||
|              new Country('Ukraine', 'Kyiv'), new Country('Russia', 'Moscow'), new Country('France', 'Paris')]; | ||||
|               | ||||
| end; | ||||
|  | ||||
| constructor Country (setName :String; setCapital: String); | ||||
| begin | ||||
|   Name := setName; | ||||
|   Capital := setCapital; | ||||
| end; | ||||
|  | ||||
| end. | ||||
							
								
								
									
										27
									
								
								samples/Protocol Buffer/addressbook.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								samples/Protocol Buffer/addressbook.proto
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| package tutorial; | ||||
|  | ||||
| option java_package = "com.example.tutorial"; | ||||
| option java_outer_classname = "AddressBookProtos"; | ||||
|  | ||||
| message Person { | ||||
|   required string name = 1; | ||||
|   required int32 id = 2; | ||||
|   optional string email = 3; | ||||
|  | ||||
|   enum PhoneType { | ||||
|     MOBILE = 0; | ||||
|     HOME = 1; | ||||
|     WORK = 2; | ||||
|   } | ||||
|  | ||||
|   message PhoneNumber { | ||||
|     required string number = 1; | ||||
|     optional PhoneType type = 2 [default = HOME]; | ||||
|   } | ||||
|  | ||||
|   repeated PhoneNumber phone = 4; | ||||
| } | ||||
|  | ||||
| message AddressBook { | ||||
|   repeated Person person = 1; | ||||
| } | ||||
| @@ -1,129 +0,0 @@ | ||||
| = \RDoc - Ruby Documentation System | ||||
|  | ||||
| home :: https://github.com/rdoc/rdoc | ||||
| rdoc :: http://docs.seattlerb.org/rdoc | ||||
| bugs :: https://github.com/rdoc/rdoc/issues | ||||
| code quality :: {<img src="https://codeclimate.com/badge.png" alt="code climate">}[https://codeclimate.com/github/rdoc/rdoc] | ||||
|  | ||||
| == Description | ||||
|  | ||||
| RDoc produces HTML and command-line documentation for Ruby projects.  RDoc | ||||
| includes the +rdoc+ and +ri+ tools for generating and displaying documentation | ||||
| from the command-line. | ||||
|  | ||||
| == Generating Documentation | ||||
|  | ||||
| Once installed, you can create documentation using the +rdoc+ command | ||||
|  | ||||
|   $ rdoc [options] [names...] | ||||
|  | ||||
| For an up-to-date option summary, type | ||||
|  | ||||
|   $ rdoc --help | ||||
|  | ||||
| A typical use might be to generate documentation for a package of Ruby | ||||
| source (such as RDoc itself). | ||||
|  | ||||
|   $ rdoc | ||||
|  | ||||
| This command generates documentation for all the Ruby and C source | ||||
| files in and below the current directory.  These will be stored in a | ||||
| documentation tree starting in the subdirectory +doc+. | ||||
|  | ||||
| You can make this slightly more useful for your readers by having the | ||||
| index page contain the documentation for the primary file.  In our | ||||
| case, we could type | ||||
|  | ||||
|   % rdoc --main README.rdoc | ||||
|  | ||||
| You'll find information on the various formatting tricks you can use | ||||
| in comment blocks in the documentation this generates. | ||||
|  | ||||
| RDoc uses file extensions to determine how to process each file.  File names | ||||
| ending +.rb+ and +.rbw+ are assumed to be Ruby source.  Files | ||||
| ending +.c+ are parsed as C files.  All other files are assumed to | ||||
| contain just Markup-style markup (with or without leading '#' comment | ||||
| markers).  If directory names are passed to RDoc, they are scanned | ||||
| recursively for C and Ruby source files only. | ||||
|  | ||||
| To generate documentation using +rake+ see RDoc::Task. | ||||
|  | ||||
| To generate documentation programmatically: | ||||
|  | ||||
|   gem 'rdoc' | ||||
|   require 'rdoc/rdoc' | ||||
|  | ||||
|   options = RDoc::Options.new | ||||
|   # see RDoc::Options | ||||
|  | ||||
|   rdoc = RDoc::RDoc.new | ||||
|   rdoc.document options | ||||
|   # see RDoc::RDoc | ||||
|  | ||||
| == Writing Documentation | ||||
|  | ||||
| To write documentation for RDoc place a comment above the class, module, | ||||
| method, constant, or attribute you want documented: | ||||
|  | ||||
|   ## | ||||
|   # This class represents an arbitrary shape by a series of points. | ||||
|  | ||||
|   class Shape | ||||
|  | ||||
|     ## | ||||
|     # Creates a new shape described by a +polyline+. | ||||
|     # | ||||
|     # If the +polyline+ does not end at the same point it started at the | ||||
|     # first pointed is copied and placed at the end of the line. | ||||
|     # | ||||
|     # An ArgumentError is raised if the line crosses itself, but shapes may | ||||
|     # be concave. | ||||
|  | ||||
|     def initialize polyline | ||||
|       # ... | ||||
|     end | ||||
|  | ||||
|   end | ||||
|  | ||||
| The default comment markup format is the RDoc::Markup format. | ||||
| TomDoc[rdoc-ref:RDoc::TomDoc], Markdown[rdoc-ref:RDoc::Markdown] and | ||||
| RD[rdoc-ref:RDoc::RD] format comments are also supported.  You can set the | ||||
| default comment format for your entire project by creating a | ||||
| <tt>.rdoc_options</tt> file.  See RDoc::Options@Saved+Options for instructions | ||||
| on creating one.  You can also set the comment format for a single file | ||||
| through the +:markup:+ directive, but this is only recommended if you wish to | ||||
| switch markup formats.  See RDoc::Markup@Other+directives. | ||||
|  | ||||
| Comments can contain directives that tell RDoc information that it cannot | ||||
| otherwise discover through parsing.  See RDoc::Markup@Directives to control | ||||
| what is or is not documented, to define method arguments or to break up | ||||
| methods in a class by topic.  See RDoc::Parser::Ruby for directives used to | ||||
| teach RDoc about metaprogrammed methods. | ||||
|  | ||||
| See RDoc::Parser::C for documenting C extensions with RDoc. | ||||
|  | ||||
| To determine how well your project is documented run <tt>rdoc -C lib</tt> to | ||||
| get a documentation coverage report.  <tt>rdoc -C1 lib</tt> includes parameter | ||||
| names in the documentation coverage report. | ||||
|  | ||||
| == Bugs | ||||
|  | ||||
| See CONTRIBUTING@Bugs for information on filing a bug report.  It's OK to file | ||||
| a bug report for anything you're having a problem with.  If you can't figure | ||||
| out how to make RDoc produce the output you like that is probably a | ||||
| documentation bug. | ||||
|  | ||||
| == License | ||||
|  | ||||
| RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. | ||||
| Portions (c) 2007-2011 Eric Hodel.  Portions copyright others, see individual | ||||
| files and LEGAL.rdoc for details. | ||||
|  | ||||
| RDoc is free software, and may be redistributed under the terms specified in | ||||
| LICENSE.rdoc. | ||||
|  | ||||
| == Warranty | ||||
|  | ||||
| This software is provided "as is" and without any express or implied | ||||
| warranties, including, without limitation, the implied warranties of | ||||
| merchantability and fitness for a particular purpose. | ||||
							
								
								
									
										45
									
								
								samples/RobotFramework/data_driven.robot
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								samples/RobotFramework/data_driven.robot
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| *** Settings *** | ||||
| Documentation     Example test cases using the data-driven testing approach. | ||||
| ... | ||||
| ...               Tests use `Calculate` keyword created in this file, that in | ||||
| ...               turn uses keywords in `CalculatorLibrary`. An exception is | ||||
| ...               the last test that has a custom _template keyword_. | ||||
| ... | ||||
| ...               The data-driven style works well when you need to repeat | ||||
| ...               the same workflow multiple times. | ||||
| ... | ||||
| ...               Notice that one of these tests fails on purpose to show how | ||||
| ...               failures look like. | ||||
| Test Template     Calculate | ||||
| Library           CalculatorLibrary | ||||
|  | ||||
| *** Test Cases ***    Expression    Expected | ||||
| Addition              12 + 2 + 2    16 | ||||
|                       2 + -3        -1 | ||||
|  | ||||
| Subtraction           12 - 2 - 2    8 | ||||
|                       2 - -3        5 | ||||
|  | ||||
| Multiplication        12 * 2 * 2    48 | ||||
|                       2 * -3        -6 | ||||
|  | ||||
| Division              12 / 2 / 2    3 | ||||
|                       2 / -3        -1 | ||||
|  | ||||
| Failing               1 + 1         3 | ||||
|  | ||||
| Calculation error     [Template]    Calculation should fail | ||||
|                       kekkonen      Invalid button 'k'. | ||||
|                       ${EMPTY}      Invalid expression. | ||||
|                       1 / 0         Division by zero. | ||||
|  | ||||
| *** Keywords *** | ||||
| Calculate | ||||
|     [Arguments]    ${expression}    ${expected} | ||||
|     Push buttons    C${expression}= | ||||
|     Result should be    ${expected} | ||||
|  | ||||
| Calculation should fail | ||||
|     [Arguments]    ${expression}    ${expected} | ||||
|     ${error} =    Should cause error    C${expression}= | ||||
|     Should be equal    ${expected}    ${error}    # Using `BuiltIn` keyword | ||||
							
								
								
									
										33
									
								
								samples/RobotFramework/gherkin.robot
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								samples/RobotFramework/gherkin.robot
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| *** Settings *** | ||||
| Documentation     Example test case using the gherkin syntax. | ||||
| ... | ||||
| ...               This test has a workflow similar to the keyword-driven | ||||
| ...               examples. The difference is that the keywords use higher | ||||
| ...               abstraction level and their arguments are embedded into | ||||
| ...               the keyword names. | ||||
| ... | ||||
| ...               This kind of _gherkin_ syntax has been made popular by | ||||
| ...               [http://cukes.info|Cucumber]. It works well especially when | ||||
| ...               tests act as examples that need to be easily understood also | ||||
| ...               by the business people. | ||||
| Library           CalculatorLibrary | ||||
|  | ||||
| *** Test Cases *** | ||||
| Addition | ||||
|     Given calculator has been cleared | ||||
|     When user types "1 + 1" | ||||
|     and user pushes equals | ||||
|     Then result is "2" | ||||
|  | ||||
| *** Keywords *** | ||||
| Calculator has been cleared | ||||
|     Push button    C | ||||
|  | ||||
| User types "${expression}" | ||||
|     Push buttons    ${expression} | ||||
|  | ||||
| User pushes equals | ||||
|     Push button    = | ||||
|  | ||||
| Result is "${result}" | ||||
|     Result should be    ${result} | ||||
							
								
								
									
										37
									
								
								samples/RobotFramework/keyword_driven.robot
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								samples/RobotFramework/keyword_driven.robot
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| *** Settings *** | ||||
| Documentation     Example test cases using the keyword-driven testing approach. | ||||
| ... | ||||
| ...               All tests contain a workflow constructed from keywords in | ||||
| ...               `CalculatorLibrary`. Creating new tests or editing existing | ||||
| ...               is easy even for people without programming skills. | ||||
| ... | ||||
| ...               This kind of style works well for normal test automation. | ||||
| ...               If also business people need to understand tests, using | ||||
| ...               _gherkin_ style may work better. | ||||
| Library           CalculatorLibrary | ||||
|  | ||||
| *** Test Cases *** | ||||
| Push button | ||||
|     Push button    1 | ||||
|     Result should be    1 | ||||
|  | ||||
| Push multiple buttons | ||||
|     Push button    1 | ||||
|     Push button    2 | ||||
|     Result should be    12 | ||||
|  | ||||
| Simple calculation | ||||
|     Push button    1 | ||||
|     Push button    + | ||||
|     Push button    2 | ||||
|     Push button    = | ||||
|     Result should be    3 | ||||
|  | ||||
| Longer calculation | ||||
|     Push buttons    5 + 4 - 3 * 2 / 1 = | ||||
|     Result should be    3 | ||||
|  | ||||
| Clear | ||||
|     Push button    1 | ||||
|     Push button    C | ||||
|     Result should be    ${EMPTY}    # ${EMPTY} is a built-in variable | ||||
							
								
								
									
										3
									
								
								samples/Scaml/hello.scaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								samples/Scaml/hello.scaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| %p | ||||
|   Hello, | ||||
|   World! | ||||
| @@ -198,6 +198,9 @@ class TestBlob < Test::Unit::TestCase | ||||
|     assert blob("Java/ProtocolBuffer.java").generated? | ||||
|     assert blob("Python/protocol_buffer_pb2.py").generated? | ||||
|  | ||||
|     # Generated JNI | ||||
|     assert blob("C/jni_layer.h").generated? | ||||
|  | ||||
|     # Minified CSS | ||||
|     assert !blob("CSS/bootstrap.css").generated? | ||||
|     assert blob("CSS/bootstrap.min.css").generated? | ||||
| @@ -207,12 +210,18 @@ class TestBlob < Test::Unit::TestCase | ||||
|     assert !blob("Text/README").vendored? | ||||
|     assert !blob("ext/extconf.rb").vendored? | ||||
|  | ||||
|     # Dependencies | ||||
|     assert blob("dependencies/windows/headers/GL/glext.h").vendored? | ||||
|  | ||||
|     # Node dependencies | ||||
|     assert blob("node_modules/coffee-script/lib/coffee-script.js").vendored? | ||||
|  | ||||
|     # Rails vendor/ | ||||
|     assert blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored? | ||||
|  | ||||
|     # 'thirdparty' directory | ||||
|     assert blob("thirdparty/lib/main.c").vendored? | ||||
|  | ||||
|     # C deps | ||||
|     assert blob("deps/http_parser/http_parser.c").vendored? | ||||
|     assert blob("deps/v8/src/v8.h").vendored? | ||||
| @@ -309,6 +318,15 @@ class TestBlob < Test::Unit::TestCase | ||||
|     # Test fixtures | ||||
|     assert blob("test/fixtures/random.rkt").vendored? | ||||
|     assert blob("Test/fixtures/random.rkt").vendored? | ||||
|      | ||||
|     # Cordova/PhoneGap | ||||
|     assert blob("cordova.js").vendored? | ||||
|     assert blob("cordova.min.js").vendored? | ||||
|     assert blob("cordova-2.1.0.js").vendored? | ||||
|     assert blob("cordova-2.1.0.min.js").vendored? | ||||
|  | ||||
|     # Vagrant | ||||
|     assert blob("Vagrantfile").vendored? | ||||
|   end | ||||
|  | ||||
|   def test_language | ||||
|   | ||||
		Reference in New Issue
	
	Block a user